Skip to content

Commit 0783052

Browse files
cazoubroonie
authored andcommitted
ASoC: rockchip: i2s-tdm: Use param rate if not provided by set_sysclk
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: 5323186 ("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>
1 parent 80ca113 commit 0783052

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

sound/soc/rockchip/rockchip_i2s_tdm.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#define DRV_NAME "rockchip-i2s-tdm"
2424

25+
#define DEFAULT_MCLK_FS 256
2526
#define CH_GRP_MAX 4 /* The max channel 8 / 2 */
2627
#define MULTIPLEX_CH_MAX 10
2728

@@ -665,6 +666,15 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,
665666
mclk_rate = i2s_tdm->mclk_rx_freq;
666667
}
667668

669+
/*
670+
* When the dai/component driver doesn't need to set mclk-fs for a specific
671+
* clock, it can skip the call to set_sysclk() for that clock.
672+
* In that case, simply use the clock rate from the params and multiply it by
673+
* the default mclk-fs value.
674+
*/
675+
if (!mclk_rate)
676+
mclk_rate = DEFAULT_MCLK_FS * params_rate(params);
677+
668678
err = clk_set_rate(mclk, mclk_rate);
669679
if (err)
670680
return err;

0 commit comments

Comments
 (0)