kernel-aes67/sound/soc/ti
Joao Paulo Goncalves d18ca8635d
ASoC: ti: davinci-mcasp: Fix race condition during probe
When using davinci-mcasp as CPU DAI with simple-card, there are some
conditions that cause simple-card to finish registering a sound card before
davinci-mcasp finishes registering all sound components. This creates a
non-working sound card from userspace with no problem indication apart
from not being able to play/record audio on a PCM stream. The issue
arises during simultaneous probe execution of both drivers. Specifically,
the simple-card driver, awaiting a CPU DAI, proceeds as soon as
davinci-mcasp registers its DAI. However, this process can lead to the
client mutex lock (client_mutex in soc-core.c) being held or davinci-mcasp
being preempted before PCM DMA registration on davinci-mcasp finishes.
This situation occurs when the probes of both drivers run concurrently.
Below is the code path for this condition. To solve the issue, defer
davinci-mcasp CPU DAI registration to the last step in the audio part of
it. This way, simple-card CPU DAI parsing will be deferred until all
audio components are registered.

Fail Code Path:

simple-card.c: probe starts
simple-card.c: simple_dai_link_of: simple_parse_node(..,cpu,..) returns EPROBE_DEFER, no CPU DAI yet
davinci-mcasp.c: probe starts
davinci-mcasp.c: devm_snd_soc_register_component() register CPU DAI
simple-card.c: probes again, finish CPU DAI parsing and call devm_snd_soc_register_card()
simple-card.c: finish probe
davinci-mcasp.c: *dma_pcm_platform_register() register PCM  DMA
davinci-mcasp.c: probe finish

Cc: stable@vger.kernel.org
Fixes: 9fbd58cf4a ("ASoC: davinci-mcasp: Choose PCM driver based on configured DMA controller")
Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Reviewed-by: Jai Luthra <j-luthra@ti.com>
Link: https://lore.kernel.org/r/20240417184138.1104774-1-jpaulo.silvagoncalves@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-04-19 09:42:04 +09:00
..
Kconfig ASoC: ti: ams-delta: Allow it to be test compiled 2023-10-23 19:40:21 +01:00
Makefile
ams-delta.c ASoC: ams-delta.c: use component after check 2023-10-27 17:37:34 +01:00
davinci-evm.c ASoC: Use device_get_match_data() 2023-10-09 13:13:59 +01:00
davinci-i2s.c
davinci-i2s.h
davinci-mcasp.c ASoC: ti: davinci-mcasp: Fix race condition during probe 2024-04-19 09:42:04 +09:00
davinci-mcasp.h
edma-pcm.c
edma-pcm.h
j721e-evm.c ASoC: ti: j721e-evm: Use devm_kcalloc() instead of devm_kzalloc() 2024-01-22 00:06:41 +00:00
n810.c GPIO descriptors for TI ASoC codecs 2023-10-02 16:17:47 +01:00
omap-abe-twl6040.c ASoC: ti: convert not to use asoc_xxx() 2023-09-25 14:16:16 +02:00
omap-dmic.c ASoC: Explicitly include correct DT includes 2023-10-09 13:13:56 +01:00
omap-dmic.h
omap-hdmi.c ASoC: ti: use devm_snd_soc_register_card() 2024-01-22 00:06:00 +00:00
omap-mcbsp-priv.h
omap-mcbsp-st.c ASoC: ti: convert not to use asoc_xxx() 2023-09-25 14:16:16 +02:00
omap-mcbsp.c ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings 2023-10-30 13:30:20 +00:00
omap-mcbsp.h
omap-mcpdm.c ASoC: Explicitly include correct DT includes 2023-10-09 13:13:56 +01:00
omap-mcpdm.h
omap-twl4030.c GPIO descriptors for TI ASoC codecs 2023-10-02 16:17:47 +01:00
omap3pandora.c GPIO descriptors for TI ASoC codecs 2023-10-02 16:17:47 +01:00
osk5912.c GPIO descriptors for TI ASoC codecs 2023-10-02 16:17:47 +01:00
rx51.c GPIO descriptors for TI ASoC codecs 2023-10-02 16:17:47 +01:00
sdma-pcm.c
sdma-pcm.h
udma-pcm.c
udma-pcm.h