]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: rockchip: i2s-tdm: Use param rate if not provided by set_sysclk
authorDetlev Casanova <detlev.casanova@collabora.com>
Wed, 18 Feb 2026 20:18:34 +0000 (15:18 -0500)
committerMark Brown <broonie@kernel.org>
Thu, 19 Feb 2026 11:45:49 +0000 (11:45 +0000)
Drivers will not always call set_sysclk() for all clocks, especially when
default mclk-fs can be used.
When that is the case, use the clock rate set in the params multiplied by the
default mclk-fs.

Fixes: 5323186e2e8d ("ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback")
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://patch.msgid.link/20260218201834.924358-1-detlev.casanova@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/rockchip/rockchip_i2s_tdm.c

index 770b9bfbb384aeafdb55ac52a0768410e18fb581..fc52149ed6ae3e36ccba422f96eedcf85bd97f60 100644 (file)
@@ -22,6 +22,7 @@
 
 #define DRV_NAME "rockchip-i2s-tdm"
 
+#define DEFAULT_MCLK_FS                                256
 #define CH_GRP_MAX                             4  /* The max channel 8 / 2 */
 #define MULTIPLEX_CH_MAX                       10
 
@@ -665,6 +666,15 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,
                        mclk_rate = i2s_tdm->mclk_rx_freq;
                }
 
+               /*
+                * When the dai/component driver doesn't need to set mclk-fs for a specific
+                * clock, it can skip the call to set_sysclk() for that clock.
+                * In that case, simply use the clock rate from the params and multiply it by
+                * the default mclk-fs value.
+                */
+               if (!mclk_rate)
+                       mclk_rate = DEFAULT_MCLK_FS * params_rate(params);
+
                err = clk_set_rate(mclk, mclk_rate);
                if (err)
                        return err;