Skip to content

Commit 9aff2e8

Browse files
Sheetalbroonie
authored andcommitted
ASoC: soc-pcm: Fix hw_params() and DAPM widget sequence
Issue: When multiple audio streams share a common BE DAI, the BE DAI widget can be powered up before its hardware parameters are configured. This incorrect sequence leads to intermittent pcm_write errors. For example, the below Tegra use-case throws an error: aplay(2 streams) -> AMX(mux) -> ADX(demux) -> arecord(2 streams), here, 'AMX TX' and 'ADX RX' are common BE DAIs. For above usecase when failure happens below sequence is observed: aplay(1) FE open() - BE DAI callbacks added to the list - BE DAI state = SND_SOC_DPCM_STATE_OPEN aplay(2) FE open() - BE DAI callbacks are not added to the list as the state is already SND_SOC_DPCM_STATE_OPEN during aplay(1) FE open(). aplay(2) FE hw_params() - BE DAI hw_params() callback ignored aplay(2) FE prepare() - Widget is powered ON without BE DAI hw_params() call aplay(1) FE hw_params() - BE DAI hw_params() is now called Fix: Add BE DAIs in the list if its state is either SND_SOC_DPCM_STATE_OPEN or SND_SOC_DPCM_STATE_HW_PARAMS as well. It ensures the widget is powered ON after BE DAI hw_params() callback. Fixes: 0c25db3 ("ASoC: soc-pcm: Don't reconnect an already active BE") Signed-off-by: Sheetal <sheetal@nvidia.com> Link: https://patch.msgid.link/20250404105953.2784819-1-sheetal@nvidia.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a9a69c3 commit 9aff2e8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sound/soc/soc-pcm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,10 +1584,13 @@ int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
15841584
/*
15851585
* Filter for systems with 'component_chaining' enabled.
15861586
* This helps to avoid unnecessary re-configuration of an
1587-
* already active BE on such systems.
1587+
* already active BE on such systems and ensures the BE DAI
1588+
* widget is powered ON after hw_params() BE DAI callback.
15881589
*/
15891590
if (fe->card->component_chaining &&
15901591
(be->dpcm[stream].state != SND_SOC_DPCM_STATE_NEW) &&
1592+
(be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN) &&
1593+
(be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) &&
15911594
(be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE))
15921595
continue;
15931596

0 commit comments

Comments
 (0)