ASoC: rockchip: i2s-tdm: Use param rate if not provided by set_sysclk
Subsystems (4)
PATCH 1/1 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.
--- sound/soc/rockchip/rockchip_i2s_tdm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/soc/rockchip/rockchip_i2s_tdm.c +10 -0
@@ -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;
Signature · 1 line
2.53.0
Hi,
This could also use a
Luca, feel free to add your Tested-by as well :)
Detlev.
Quoted 29 lines · Detlev Casanova
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 <[email protected]>--- sound/soc/rockchip/rockchip_i2s_tdm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)sound/soc/rockchip/rockchip_i2s_tdm.c +3
-0@@ -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
sound/soc/rockchip/rockchip_i2s_tdm.c static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream, · line 680
Quoted 10 lines
sound/soc/rockchip/rockchip_i2s_tdm.c +7
-0+* 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;
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Hello,
Quoted 26 lines · Detlev Casanova
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 <[email protected]>--- sound/soc/rockchip/rockchip_i2s_tdm.c | 10 ++++++++++ 1 file changed, 10 insertions(+)sound/soc/rockchip/rockchip_i2s_tdm.c +1
-0@@ -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; }
sound/soc/rockchip/rockchip_i2s_tdm.c static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream, · line 677
Quoted 10 lines
sound/soc/rockchip/rockchip_i2s_tdm.c +9
-0+/* +* 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); +
Maybe this could be set as the default value of i2s_tdm->mclk_rx_freq and i2s_tdm->mclk_tx_freq in rockchip_i2s_tdm_probe instead of relying on it being 0 and testing later on?
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Mark Brown
maintainerQuoted 9 lines · Alexandre Belloni
sound/soc/rockchip/rockchip_i2s_tdm.c static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream, · line 677
Quoted 3 lines · Detlev Casanova
sound/soc/rockchip/rockchip_i2s_tdm.c +3
-0+if (!mclk_rate) + mclk_rate =DEFAULT_MCLK_FS *params_rate (params); +Maybe this could be set as the default value of
i2s_tdm->mclk_rx_freqandi2s_tdm->mclk_tx_freqinrockchip_i2s_tdm_probeinstead of relying on it being 0 and testing later on?
That makes sense but since this is fixing a regression and I'd like to get the fix in I'll apply, we can improve things incrementally.
Quoted 11 lines · Mark Brown
Quoted 9 lines · Alexandre Belloni
sound/soc/rockchip/rockchip_i2s_tdm.c static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream, · line 677
Quoted 3 lines · Detlev Casanova
sound/soc/rockchip/rockchip_i2s_tdm.c +3
-0+if (!mclk_rate) + mclk_rate =DEFAULT_MCLK_FS *params_rate (params); +Maybe this could be set as the default value of
i2s_tdm->mclk_rx_freqandi2s_tdm->mclk_tx_freqinrockchip_i2s_tdm_probeinstead of relying on it being 0 and testing later on?
Quoted 2 lines
That makes sense but since this is fixing a regression and I'd like to get the fix in I'll apply, we can improve things incrementally.
Yeah, actually, Luca pointed that it is actually not a good suggestion because we need the rate of the stream to be able to set mclk_rate and we obviously don't have it in probe. So you can definitely apply the patch as-is.
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Mark Brown
maintainerQuoted 6 lines · Detlev Casanova
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.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: rockchip: i2s-tdm: Use param rate if not provided by set_sysclk
commit: 0783052534f547f8f201dd4554b1df9f1f8615b5
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
Hello Detlev, all,
Quoted 7 lines · Detlev Casanova
Hi,
This could also use a
Reported-by Luca Ceresoli <[email protected]>Luca, feel free to add your Tested-by as well :)
Ouch, too late, patch applied already.
Anyway, it looks correct, but I'm going to triple check in a couple days and get back in the remote case there is any issue.
Thanks for the responsiveness in sending the fix!
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com