[PATCH v1 1/2] ASoC: qcom: sdm845: skip set_channel_map for SDW stream DAIs

From: Mohammad Rafi Shaik

Date: Mon Jun 29 2026 - 10:40:48 EST


On sdm845 the SLIM Playback backend lists wcd934x alongside the qcom
SoundWire master and its SWR slave speaker codecs as codec DAIs on the
same link. sdm845_dai_init() was calling set_channel_map with hardcoded
wcd934x SLIM channel numbers for every codec DAI on that link, including
the SoundWire ones, corrupting their channel configuration.

Skip set_channel_map for any DAI that implements .set_stream, as that op
is the distinguishing marker of DAIs that own an SDW stream path — both
the qcom SWR master and SWR slave codecs register it, while wcd934x does
not. This confines the SLIM channel map to wcd934x where it belongs.

Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@xxxxxxxxxxxxxxxx>
---
sound/soc/qcom/sdm845.c | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c
index 0ce9dff4dc52..509d7a551397 100644
--- a/sound/soc/qcom/sdm845.c
+++ b/sound/soc/qcom/sdm845.c
@@ -294,13 +294,26 @@ static int sdm845_dai_init(struct snd_soc_pcm_runtime *rtd)
return 0;

for_each_rtd_codec_dais(rtd, i, codec_dai) {
- rval = snd_soc_dai_set_channel_map(codec_dai,
- ARRAY_SIZE(tx_ch),
- tx_ch,
- ARRAY_SIZE(rx_ch),
- rx_ch);
- if (rval != 0 && rval != -ENOTSUPP)
- return rval;
+ component = codec_dai->component;
+
+ if (!component || !component->dev)
+ continue;
+
+ /*
+ * Only wcd934x (SLIM codec) needs these static channel maps.
+ * DAIs that own an SDW stream — the qcom SWR master and SWR
+ * slave speaker codecs — implement .set_stream; skip them.
+ */
+ if (!codec_dai->driver || !codec_dai->driver->ops ||
+ !codec_dai->driver->ops->set_stream) {
+ rval = snd_soc_dai_set_channel_map(codec_dai,
+ ARRAY_SIZE(tx_ch),
+ tx_ch,
+ ARRAY_SIZE(rx_ch),
+ rx_ch);
+ if (rval != 0 && rval != -ENOTSUPP)
+ return rval;
+ }

snd_soc_dai_set_sysclk(codec_dai, 0,
WCD934X_DEFAULT_MCLK_RATE,
--
2.34.1