[PATCH] Revert "ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback"

Luca Ceresoli posted 1 patch 1 month, 1 week ago
sound/soc/rockchip/rockchip_i2s_tdm.c | 31 ++-----------------------------
1 file changed, 2 insertions(+), 29 deletions(-)
[PATCH] Revert "ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback"
Posted by Luca Ceresoli 1 month, 1 week ago
This reverts commit 5323186e2e8d33c073fad51e24f18e2d6dbae2da.

The reverted commit broke this driver for the RK3308 I2S.

The 'arecord -Vmono -d 2 -c 8 -f S16_LE -r 96000 /dev/null' command on
RK3308 now results in:

  rockchip-i2s-tdm ff320000.i2s: ASoC error (-22): at snd_soc_dai_hw_params() on ff320000.i2s
   ff320000.i2s-rk3308-hifi: ASoC error (-22): at __soc_pcm_hw_params() on ff320000.i2s-rk3308-hifi

Tested on:

 * Radxa Rock Pi S
 * Upstream Linux kernel
 * arm64 defconfig

Tested kernel versions:

 * v6.12: OK
 * 5323186e2e8d (commit being reverted): FAIL
 * 5323186e2e8d^: OK
 * 21cfbeae7d7c (commit being reverted, on stable/linux-6.12.y): FAIL
 * 21cfbeae7d7c^: OK
 * v6.19: FAIL
 * v6.19 + 'git revert 5323186e2e8d': OK
 * v6.19-11566-g254edc893f3a (current master as of today): FAIL
 * v6.19-11566-g254edc893f3a (current master as of today) + this revert: OK

Fixes: 5323186e2e8d ("ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/DGB6VK7LC8N7.322SYGWZXPL5W@bootlin.com/
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 sound/soc/rockchip/rockchip_i2s_tdm.c | 31 ++-----------------------------
 1 file changed, 2 insertions(+), 29 deletions(-)

diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
index 770b9bfbb384..b056d72e61ff 100644
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -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
 
@@ -69,8 +70,6 @@ struct rk_i2s_tdm_dev {
 	bool has_playback;
 	bool has_capture;
 	struct snd_soc_dai_driver *dai;
-	unsigned int mclk_rx_freq;
-	unsigned int mclk_tx_freq;
 };
 
 static int to_ch_num(unsigned int val)
@@ -618,27 +617,6 @@ static int rockchip_i2s_trcm_mode(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int rockchip_i2s_tdm_set_sysclk(struct snd_soc_dai *cpu_dai, int stream,
-				       unsigned int freq, int dir)
-{
-	struct rk_i2s_tdm_dev *i2s_tdm = to_info(cpu_dai);
-
-	if (i2s_tdm->clk_trcm) {
-		i2s_tdm->mclk_tx_freq = freq;
-		i2s_tdm->mclk_rx_freq = freq;
-	} else {
-		if (stream == SNDRV_PCM_STREAM_PLAYBACK)
-			i2s_tdm->mclk_tx_freq = freq;
-		else
-			i2s_tdm->mclk_rx_freq = freq;
-	}
-
-	dev_dbg(i2s_tdm->dev, "The target mclk_%s freq is: %d\n",
-		stream ? "rx" : "tx", freq);
-
-	return 0;
-}
-
 static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,
 				      struct snd_pcm_hw_params *params,
 				      struct snd_soc_dai *dai)
@@ -653,19 +631,15 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,
 
 		if (i2s_tdm->clk_trcm == TRCM_TX) {
 			mclk = i2s_tdm->mclk_tx;
-			mclk_rate = i2s_tdm->mclk_tx_freq;
 		} else if (i2s_tdm->clk_trcm == TRCM_RX) {
 			mclk = i2s_tdm->mclk_rx;
-			mclk_rate = i2s_tdm->mclk_rx_freq;
 		} else if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
 			mclk = i2s_tdm->mclk_tx;
-			mclk_rate = i2s_tdm->mclk_tx_freq;
 		} else {
 			mclk = i2s_tdm->mclk_rx;
-			mclk_rate = i2s_tdm->mclk_rx_freq;
 		}
 
-		err = clk_set_rate(mclk, mclk_rate);
+		err = clk_set_rate(mclk, DEFAULT_MCLK_FS * params_rate(params));
 		if (err)
 			return err;
 
@@ -825,7 +799,6 @@ static const struct snd_soc_dai_ops rockchip_i2s_tdm_dai_ops = {
 	.hw_params = rockchip_i2s_tdm_hw_params,
 	.set_bclk_ratio	= rockchip_i2s_tdm_set_bclk_ratio,
 	.set_fmt = rockchip_i2s_tdm_set_fmt,
-	.set_sysclk = rockchip_i2s_tdm_set_sysclk,
 	.set_tdm_slot = rockchip_dai_tdm_slot,
 	.trigger = rockchip_i2s_tdm_trigger,
 };

---
base-commit: 2961f841b025fb234860bac26dfb7fa7cb0fb122
change-id: 20260218-snd-rk3308-i2s-revert-set_sysclk-ed09c6914e1b

Best regards,
-- 
Luca Ceresoli <luca.ceresoli@bootlin.com>
Re: [PATCH] Revert "ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback"
Posted by Mark Brown 1 month, 1 week ago
On Wed, Feb 18, 2026 at 01:11:24PM +0100, Luca Ceresoli wrote:

> This reverts commit 5323186e2e8d33c073fad51e24f18e2d6dbae2da.

Please include human readable descriptions of things like commits and
issues being discussed in e-mail in your mails, this makes them much
easier for humans to read especially when they have no internet access.
I do frequently catch up on my mail on flights or while otherwise
travelling so this is even more pressing for me than just being about
making things a bit easier to read.

Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.