linux-stable/sound/soc
Joao Paulo Goncalves 866d844564 ASoC: ti: davinci-mcasp: Fix race condition during probe
commit d18ca8635d upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-05-17 11:51:04 +02:00
..
adi
amd
atmel Revert "ASoC: atmel: Remove system clock tree configuration for at91sam9g20ek" 2024-01-25 14:52:31 -08:00
au1x
bcm
cirrus
codecs ASoC: rt711-sdw: fix locking sequence 2024-04-10 16:19:41 +02:00
dwc
fsl ASoC: fsl_rpmsg: Fix error handler with pm_runtime_enable 2024-01-15 18:51:11 +01:00
generic ASoC: simple-card: fixup asoc_simple_probe() error handling 2023-11-08 17:26:44 +01:00
hisilicon
img
intel ASoC: Intel: bytcr_rt5640: Add an extra entry for the Chuwi Vi8 tablet 2024-03-26 18:21:13 -04:00
jz4740
kirkwood
mediatek
meson ASoC: meson: cards: select SND_DYNAMIC_MINORS 2024-05-17 11:50:49 +02:00
mxs
pxa ASoC: pxa: fix a memory leak in probe() 2023-10-25 11:59:03 +02:00
qcom
rockchip
samsung
sh
sof ASoC: SOF: sof-pci-dev: Fix community key quirk detection 2023-12-08 08:48:04 +01:00
spear
sprd
sti
stm
sunxi ASoC: sunxi: sun4i-spdif: Add support for Allwinner H616 2024-03-01 13:21:45 +01:00
tegra ASoC: tegra: Fix DSPK 16-bit playback 2024-05-17 11:51:04 +02:00
ti ASoC: ti: davinci-mcasp: Fix race condition during probe 2024-05-17 11:51:04 +02:00
uniphier
ux500
xilinx
xtensa
Kconfig
Makefile
soc-ac97.c
soc-acpi.c
soc-card.c
soc-component.c
soc-compress.c
soc-core.c ASoC: soc-core.c: Skip dummy codec when adding platforms 2024-04-13 13:01:46 +02:00
soc-dai.c
soc-dapm.c
soc-devres.c
soc-generic-dmaengine-pcm.c
soc-jack.c
soc-link.c
soc-ops.c ASoC: ops: Fix wraparound for mask in snd_soc_get_volsw 2024-04-10 16:19:41 +02:00
soc-pcm.c
soc-topology-test.c
soc-topology.c
soc-utils.c ASoC: soc-utils: Export snd_soc_dai_is_dummy() symbol 2023-10-10 21:59:04 +02:00