mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] ASoC: qcom: sc8280xp: Derive TDM channels from DT mask
@ 2026-10-31  8:23 Shawn Guo
  2026-11-02 11:02 ` Prasad Kumpatla
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shawn Guo @ 2026-10-31  8:23 UTC (permalink / raw)
  To: Mark Brown
  Cc: Srinivas Kandagatla, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai, Mohammad Rafi Shaik, Zhangfei Gao, Prasad Kumpatla,
	Bartosz Golaszewski, linux-sound, linux-arm-msm, linux-kernel,
	Shawn Guo

Derive the backend channel count of TDM DAIs from the cpu DAI TDM
slot mask in the DT, using the same DAI ID ranges and tx/rx mask
selection as q6tdm_set_tdm_slot(), so the channel count always matches
the number of slots programmed into the DSP. Each board then gets the
channel count its dai-link describes, e.g. 4/4 on Nord RRD, 6/4 on
RIDE. Keep the default of two when the link has no TDM slot
description, and fail the fixup on an invalid one.

Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
---
Changes for v3:
- Propagate qcom_snd_get_dai_tdm_slots() errors other than -ENOENT
  instead of silently falling back to two channels (Prasad)
- Link to v2: https://lore.kernel.org/all/20261029022340.591372-1-shengchao.guo@oss.qualcomm.com/

Changes for v2:
- Cover all TDM DAIs (PRIMARY..QUINARY and AIF_TDM ranges), matching
  q6tdm_set_tdm_slot(), instead of only AIF_TDM_RX_8/TX_8 (Rafi)
- Link to v1: https://lore.kernel.org/all/20261021025310.2072026-1-shengchao.guo@oss.qualcomm.com/

 sound/soc/qcom/sc8280xp.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
index 9aae6aadd43d..8cc75a7ad866 100644
--- a/sound/soc/qcom/sc8280xp.c
+++ b/sound/soc/qcom/sc8280xp.c
@@ -303,6 +303,26 @@ 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;
+		int ret;
+
+		ret = qcom_snd_get_dai_tdm_slots(rtd, &cpu_cfg, &codec_cfg);
+		if (ret == -ENOENT)
+			break;
+		if (ret)
+			return ret;
+
+		/* 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:
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] ASoC: qcom: sc8280xp: Derive TDM channels from DT mask
  2026-10-31  8:23 [PATCH v3] ASoC: qcom: sc8280xp: Derive TDM channels from DT mask Shawn Guo
@ 2026-11-02 11:02 ` Prasad Kumpatla
  2026-11-02 13:08 ` Mark Brown
  2026-11-02 13:49 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Prasad Kumpatla @ 2026-11-02 11:02 UTC (permalink / raw)
  To: Shawn Guo, Mark Brown
  Cc: Srinivas Kandagatla, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai, Mohammad Rafi Shaik, Zhangfei Gao,
	Bartosz Golaszewski, linux-sound, linux-arm-msm, linux-kernel


On 10/31/2026 1:53 PM, Shawn Guo wrote:
> Derive the backend channel count of TDM DAIs from the cpu DAI TDM
> slot mask in the DT, using the same DAI ID ranges and tx/rx mask
> selection as q6tdm_set_tdm_slot(), so the channel count always matches
> the number of slots programmed into the DSP. Each board then gets the
> channel count its dai-link describes, e.g. 4/4 on Nord RRD, 6/4 on
> RIDE. Keep the default of two when the link has no TDM slot
> description, and fail the fixup on an invalid one.
>
> Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
> ---
> Changes for v3:
> - Propagate qcom_snd_get_dai_tdm_slots() errors other than -ENOENT
>    instead of silently falling back to two channels (Prasad)
> - Link to v2: https://lore.kernel.org/all/20261029022340.591372-1-shengchao.guo@oss.qualcomm.com/
>
LGTM,

Reviewed-by: Prasad Kumpatla<prasad.kumpatla@oss.qualcomm.com>

Thanks,
Prasad


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] ASoC: qcom: sc8280xp: Derive TDM channels from DT mask
  2026-10-31  8:23 [PATCH v3] ASoC: qcom: sc8280xp: Derive TDM channels from DT mask Shawn Guo
  2026-11-02 11:02 ` Prasad Kumpatla
@ 2026-11-02 13:08 ` Mark Brown
  2026-11-02 13:49 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-11-02 13:08 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Srinivas Kandagatla, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai, Mohammad Rafi Shaik, Zhangfei Gao, Prasad Kumpatla,
	Bartosz Golaszewski, linux-sound, linux-arm-msm, linux-kernel

On Sat, 31 Oct 2026 16:23:18 +0800, Shawn Guo wrote:
> ASoC: qcom: sc8280xp: Derive TDM channels from DT mask

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.5

Thanks!

[1/1] ASoC: qcom: sc8280xp: Derive TDM channels from DT mask
      https://git.kernel.org/broonie/sound/c/45e9d148a0a7

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] ASoC: qcom: sc8280xp: Derive TDM channels from DT mask
  2026-10-31  8:23 [PATCH v3] ASoC: qcom: sc8280xp: Derive TDM channels from DT mask Shawn Guo
  2026-11-02 11:02 ` Prasad Kumpatla
  2026-11-02 13:08 ` Mark Brown
@ 2026-11-02 13:49 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2026-11-02 13:49 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Mark Brown, Srinivas Kandagatla, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai, Mohammad Rafi Shaik, Zhangfei Gao, Prasad Kumpatla,
	linux-sound, linux-arm-msm, linux-kernel

On Sat, Oct 31, 2026 at 04:23:18PM +0800, Shawn Guo wrote:
> Derive the backend channel count of TDM DAIs from the cpu DAI TDM
> slot mask in the DT, using the same DAI ID ranges and tx/rx mask
> selection as q6tdm_set_tdm_slot(), so the channel count always matches
> the number of slots programmed into the DSP. Each board then gets the
> channel count its dai-link describes, e.g. 4/4 on Nord RRD, 6/4 on
> RIDE. Keep the default of two when the link has no TDM slot
> description, and fail the fixup on an invalid one.
> 
> Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
> ---
 
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-02 14:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-31  8:23 [PATCH v3] ASoC: qcom: sc8280xp: Derive TDM channels from DT mask Shawn Guo
2026-11-02 11:02 ` Prasad Kumpatla
2026-11-02 13:08 ` Mark Brown
2026-11-02 13:49 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®