[PATCH 6.18.y] ASoC: qcom: sc7280: make use of common helpers

From: Xilin Wu

Date: Tue Apr 07 2026 - 04:33:42 EST


From: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx>

commit 8fdb030fe283c84fd8d378c97ad0f32d6cdec6ce upstream.

sc7280 machine driver can make use of common sdw functions to do most of
the soundwire related operations. Remove such redundant code from sc7280
driver.

[This is a partial backport containing only the sound/soc/qcom/sdw.c
changes which add LPASS CDC DMA DAI IDs to qcom_snd_is_sdw_dai().
The sc7280.c refactoring changes are omitted as they depend on
intermediate patches not present in 6.18.y. The sdw.c change fixes a
NULL pointer dereference for lpass-cpu based SoundWire links.]

Fixes: bcba17279327 ("ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx>
Tested-by: Steev Klimaszewski <threeway@xxxxxxxxx> # Thinkpad X13s
Link: https://patch.msgid.link/20251022143349.1081513-5-srinivas.kandagatla@xxxxxxxxxxxxxxxx
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
Signed-off-by: Xilin Wu <sophon@xxxxxxxxx>
---
sound/soc/qcom/sdw.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/sound/soc/qcom/sdw.c b/sound/soc/qcom/sdw.c
index 7b2cae92c812..5f880c74c8dc 100644
--- a/sound/soc/qcom/sdw.c
+++ b/sound/soc/qcom/sdw.c
@@ -2,6 +2,7 @@
// Copyright (c) 2018-2023, Linaro Limited.
// Copyright (c) 2018, The Linux Foundation. All rights reserved.

+#include <dt-bindings/sound/qcom,lpass.h>
#include <dt-bindings/sound/qcom,q6afe.h>
#include <linux/module.h>
#include <sound/soc.h>
@@ -35,6 +36,16 @@ static bool qcom_snd_is_sdw_dai(int id)
break;
}

+ /* DSP Bypass usecase, cpu dai index overlaps with DSP dai ids,
+ * DO NOT MERGE into top switch case */
+ switch (id) {
+ case LPASS_CDC_DMA_TX3:
+ case LPASS_CDC_DMA_RX0:
+ return true;
+ default:
+ break;
+ }
+
return false;
}


---
base-commit: dd26ea937ef593a9c47aa4c85296e6b57a5344a1
change-id: 20260407-qcom-sdw-6-18-2dabe461e17f

Best regards,
--
Xilin Wu <sophon@xxxxxxxxx>