Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: meson: axg-tdm-interface: Fix formatters in trigger"

This reverts commit bf5e4887eeddb48480568466536aa08ec7f179a5 because
the following and required commit e138233e56e9829e65b6293887063a1a3ccb2d68
causes the following system crash when using audio:
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:282

Fixes: bf5e4887eeddb4848056846 ("ASoC: meson: axg-tdm-interface: manage formatters in trigger")
Reported-by: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20220421155725.2589089-1-narmstrong@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Neil Armstrong and committed by
Mark Brown
c26830b6 eb577320

+5 -21
+5 -21
sound/soc/meson/axg-tdm-interface.c
··· 351 351 return 0; 352 352 } 353 353 354 - static int axg_tdm_iface_trigger(struct snd_pcm_substream *substream, 355 - int cmd, 354 + static int axg_tdm_iface_prepare(struct snd_pcm_substream *substream, 356 355 struct snd_soc_dai *dai) 357 356 { 358 - struct axg_tdm_stream *ts = 359 - snd_soc_dai_get_dma_data(dai, substream); 357 + struct axg_tdm_stream *ts = snd_soc_dai_get_dma_data(dai, substream); 360 358 361 - switch (cmd) { 362 - case SNDRV_PCM_TRIGGER_START: 363 - case SNDRV_PCM_TRIGGER_RESUME: 364 - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 365 - axg_tdm_stream_start(ts); 366 - break; 367 - case SNDRV_PCM_TRIGGER_SUSPEND: 368 - case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 369 - case SNDRV_PCM_TRIGGER_STOP: 370 - axg_tdm_stream_stop(ts); 371 - break; 372 - default: 373 - return -EINVAL; 374 - } 375 - 376 - return 0; 359 + /* Force all attached formatters to update */ 360 + return axg_tdm_stream_reset(ts); 377 361 } 378 362 379 363 static int axg_tdm_iface_remove_dai(struct snd_soc_dai *dai) ··· 397 413 .set_fmt = axg_tdm_iface_set_fmt, 398 414 .startup = axg_tdm_iface_startup, 399 415 .hw_params = axg_tdm_iface_hw_params, 416 + .prepare = axg_tdm_iface_prepare, 400 417 .hw_free = axg_tdm_iface_hw_free, 401 - .trigger = axg_tdm_iface_trigger, 402 418 }; 403 419 404 420 /* TDM Backend DAIs */