Re: [PATCH 1/2] ASoC: qcom: sdm845: handle soundwire stream

From: Pierre-Louis Bossart
Date: Wed Mar 18 2020 - 11:28:27 EST




ÂÂÂÂÂ for_each_rtd_codec_dais(rtd, i, codec_dai) {
+ÂÂÂÂÂÂÂ sruntime = snd_soc_dai_get_sdw_stream(codec_dai,
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ substream->stream);
+ÂÂÂÂÂÂÂ if (sruntime != ERR_PTR(-ENOTSUPP))
+ÂÂÂÂÂÂÂÂÂÂÂ pdata->sruntime[cpu_dai->id] = sruntime;
+ÂÂÂÂÂÂÂ else
+ÂÂÂÂÂÂÂÂÂÂÂ pdata->sruntime[cpu_dai->id] = NULL;
+

Can you explain this part?
The get_sdw_stream() is supposed to return what was set by set_sdw_stream(), so if it's not supported isn't this an error?

In this case its not an error because we have
totally 3 codecs in this path.
One wcd934x Slimbus codec and two wsa881x Soundwire Codec.

wcd934x codec side will return ENOTSUPP which is not an error.

I must admit I am quite confused here.
After reading your response, I thought this was a case of codec-to-codec dailink, but then you also have a notion of cpu_dai?


ÂÂÂÂÂÂÂÂÂ ret = snd_soc_dai_get_channel_map(codec_dai,
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ &tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
@@ -425,8 +437,65 @@ static void sdm845_snd_shutdown(struct snd_pcm_substream *substream)
ÂÂÂÂÂ }
 }
+static int sdm845_snd_prepare(struct snd_pcm_substream *substream)
+{
+ÂÂÂ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ÂÂÂ struct sdm845_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
+ÂÂÂ struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+ÂÂÂ struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
+ÂÂÂ int ret;
+
+ÂÂÂ if (!sruntime)
+ÂÂÂÂÂÂÂ return 0;

same here, isn't this an error?

These callbacks are used for other dais aswell in this case
HDMI, Slimbus and Soundwire, so sruntime being null is not treated as error.

Same comment, how does the notion of cpu_dai come in the picture for a SoundWire dailink?
Would you mind listing what the components of the dailinks are?