Skip to content

Commit bf461fd

Browse files
RanderWangkeyonjie
authored andcommitted
ASoC:SOF:get spcm from FE dai link during BE dai link prepare
BE dai link prepare() needs to setup hw_params again only if the internal flag (hw_params_upon_resume) is set for the pcm stream. But since BE dai links themselves don't have a pcm, we need to use the FE dai link that is connected to the BE dai link to check for the flag. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
1 parent 49bb879 commit bf461fd

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

sound/soc/sof/intel/hda-dai.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,25 @@ static int hda_link_pcm_prepare(struct snd_pcm_substream *substream,
169169
struct snd_soc_dai *dai)
170170
{
171171
struct snd_soc_pcm_runtime *rtd = substream->private_data;
172+
struct snd_soc_dpcm *dpcm;
172173
struct snd_sof_dev *sdev =
173174
snd_soc_component_get_drvdata(dai->component);
174175
struct snd_sof_pcm *spcm;
175176
int stream = substream->stream;
176177

177-
spcm = snd_sof_find_spcm_dai(sdev, rtd);
178-
if (!spcm)
179-
return -EINVAL;
178+
for_each_dpcm_fe(rtd, stream, dpcm) {
179+
spcm = snd_sof_find_spcm_dai(sdev, dpcm->fe);
180+
if (!spcm)
181+
return -EINVAL;
180182

181-
/* setup hw_params again only if resuming from system suspend */
182-
if (!spcm->hw_params_upon_resume[stream])
183-
return 0;
183+
/* setup hw_params only if resuming from system suspend */
184+
if (spcm->hw_params_upon_resume[stream])
185+
goto params;
186+
}
187+
188+
return 0;
184189

190+
params:
185191
dev_dbg(sdev->dev, "hda: prepare stream %d dir %d\n",
186192
spcm->pcm.pcm_id, substream->stream);
187193

0 commit comments

Comments
 (0)