[PATCH v2 1/6] ASoC: dwc: Fix bit clock rate in TDM mode
From: phucduc . bui
Date: Tue Nov 10 2026 - 05:40:05 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
The bit clock is computed as rate * data_width * 2, which only fits
a two-slot I2S frame. Use rate * data_width * tdm_slots in TDM mode.
Fixes: 221acc16aee1 ("ASoC: dwc: Add TDM mode support")
Reviewed-by: Maxim Kochetkov <fido_max@xxxxxxxx>
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
Changes in v2:
- Move the indentation fixes into a separate commit.
- Add Maxim Kochetkov's Reviewed-by tag.
sound/soc/dwc/dwc-i2s.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c
index dbda943cfaf3..1f4d06a82333 100644
--- a/sound/soc/dwc/dwc-i2s.c
+++ b/sound/soc/dwc/dwc-i2s.c
@@ -332,6 +332,9 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,
} else {
u32 bitclk = config->sample_rate *
config->data_width * 2;
+ if (dev->tdm_slots)
+ bitclk = config->sample_rate *
+ config->data_width * dev->tdm_slots;
ret = clk_set_rate(dev->clk, bitclk);
if (ret) {
--
2.43.0