Skip to content

Commit ef5c23a

Browse files
TE-N-ShengjiuWangbroonie
authored andcommitted
ASoC: fsl_asrc_dma: get codec or cpu dai from backend
With audio graph card, original cpu dai is changed to codec device in backend, so if cpu dai is dummy device in backend, get the codec dai device, which is the real hardware device connected. The specific case is ASRC->SAI->AMIX->CODEC. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://patch.msgid.link/20250319033504.2898605-1-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a31a493 commit ef5c23a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

sound/soc/fsl/fsl_asrc_dma.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,24 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,
156156
for_each_dpcm_be(rtd, stream, dpcm) {
157157
struct snd_soc_pcm_runtime *be = dpcm->be;
158158
struct snd_pcm_substream *substream_be;
159-
struct snd_soc_dai *dai = snd_soc_rtd_to_cpu(be, 0);
159+
struct snd_soc_dai *dai_cpu = snd_soc_rtd_to_cpu(be, 0);
160+
struct snd_soc_dai *dai_codec = snd_soc_rtd_to_codec(be, 0);
161+
struct snd_soc_dai *dai;
160162

161163
if (dpcm->fe != rtd)
162164
continue;
163165

166+
/*
167+
* With audio graph card, original cpu dai is changed to codec
168+
* device in backend, so if cpu dai is dummy device in backend,
169+
* get the codec dai device, which is the real hardware device
170+
* connected.
171+
*/
172+
if (!snd_soc_dai_is_dummy(dai_cpu))
173+
dai = dai_cpu;
174+
else
175+
dai = dai_codec;
176+
164177
substream_be = snd_soc_dpcm_get_substream(be, stream);
165178
dma_params_be = snd_soc_dai_get_dma_data(dai, substream_be);
166179
dev_be = dai->dev;

0 commit comments

Comments
 (0)