Re: [PATCH v2] ASoC: qcom: sc8280xp: Derive TDM channels from DT mask

From: Prasad Kumpatla

Date: Thu Oct 29 2026 - 13:30:11 EST


diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
index 9aae6aadd43d..f5b147962afa 100644
--- a/sound/soc/qcom/sc8280xp.c
+++ b/sound/soc/qcom/sc8280xp.c
@@ -303,6 +303,22 @@ static int sc8280xp_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
channels->min = 2;
channels->max = 2;
switch (cpu_dai->id) {
+ case PRIMARY_TDM_RX_0 ... QUINARY_TDM_TX_7:
+ case AIF_TDM_RX_0 ... AIF_TDM_TX_12: {
+ struct qcom_snd_tdm_slot_cfg cpu_cfg, codec_cfg;
+ unsigned int mask;
+
+ if (qcom_snd_get_dai_tdm_slots(rtd, &cpu_cfg, &codec_cfg))


qcom_snd_get_dai_tdm_slots() errors are silently ignored here and the channel count falls back to 2.
Could we distinguish the no-TDM-slot case from an actual parsing/configuration error?
This would also make invalid TDM configurations easier to debug.

Thanks,
Prasad

+ break;
+
+ /* Same slot mask selection as q6tdm_set_tdm_slot() */
+ mask = (cpu_dai->id & 0x1) ? cpu_cfg.tx_mask : cpu_cfg.rx_mask;
+ if (mask) {
+ channels->min = hweight32(mask);
+ channels->max = channels->min;
+ }
+ break;
+ }
case TX_CODEC_DMA_TX_0:
case TX_CODEC_DMA_TX_1:
case TX_CODEC_DMA_TX_2: