* [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
@ 2025-01-17 16:31 Detlev Casanova
2025-01-21 18:10 ` Mark Brown
2026-02-10 9:54 ` [REGRESSION] " Luca Ceresoli
0 siblings, 2 replies; 11+ messages in thread
From: Detlev Casanova @ 2025-01-17 16:31 UTC (permalink / raw)
To: linux-kernel
Cc: Nicolas Frattaroli, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Heiko Stuebner, linux-rockchip, linux-sound,
linux-arm-kernel, kernel, Detlev Casanova
In commit
9e2ab4b18ebd ("ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates"),
the set_sysclk callback was removed as considered unused as the mclk rate
can be set in the hw_params callback.
The difference between hw_params and set_sysclk is that the former is
called with the audio sampling rate set in the params (e.g.: 48000 Hz)
while the latter is called with a clock rate already computed with
sampling_rate * mclk-fs (e.g.: 48000 * 256)
For HDMI audio using the Rockchip I2S TDM driver, the mclk-fs value must
be set to 128 instead of the default 256, and that value is set in the
device tree at the machine driver level (like a simple-audio-card
compatible node).
Therefore, the i2s_tdm driver has no idea that another mclk-fs value can
be configured and simply computes the mclk rate in the hw_params callback
with DEFAULT_MCLK_FS * params_rate(params), which is wrong for HDMI
audio.
Re-add the set_sysclk callback so that the mclk rate is computed by the
machine driver which has the correct mclk-fs value set in its device tree
node.
Fixes: 9e2ab4b18ebd ("ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates")
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
---
sound/soc/rockchip/rockchip_i2s_tdm.c | 31 +++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
index d1f28699652f..acd75e48851f 100644
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -22,7 +22,6 @@
#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
@@ -70,6 +69,8 @@ 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)
@@ -645,6 +646,27 @@ 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)
@@ -659,15 +681,19 @@ 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, DEFAULT_MCLK_FS * params_rate(params));
+ err = clk_set_rate(mclk, mclk_rate);
if (err)
return err;
@@ -827,6 +853,7 @@ 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,
};
--
2.48.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
2025-01-17 16:31 [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback Detlev Casanova
@ 2025-01-21 18:10 ` Mark Brown
2026-02-10 9:54 ` [REGRESSION] " Luca Ceresoli
1 sibling, 0 replies; 11+ messages in thread
From: Mark Brown @ 2025-01-21 18:10 UTC (permalink / raw)
To: linux-kernel, Detlev Casanova
Cc: Nicolas Frattaroli, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
Heiko Stuebner, linux-rockchip, linux-sound, linux-arm-kernel,
kernel
On Fri, 17 Jan 2025 11:31:02 -0500, Detlev Casanova wrote:
> In commit
> 9e2ab4b18ebd ("ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates"),
> the set_sysclk callback was removed as considered unused as the mclk rate
> can be set in the hw_params callback.
> The difference between hw_params and set_sysclk is that the former is
> called with the audio sampling rate set in the params (e.g.: 48000 Hz)
> while the latter is called with a clock rate already computed with
> sampling_rate * mclk-fs (e.g.: 48000 * 256)
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
commit: 5323186e2e8d33c073fad51e24f18e2d6dbae2da
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
^ permalink raw reply [flat|nested] 11+ messages in thread* [REGRESSION] Re: [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
2025-01-17 16:31 [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback Detlev Casanova
2025-01-21 18:10 ` Mark Brown
@ 2026-02-10 9:54 ` Luca Ceresoli
2026-02-17 19:22 ` Mark Brown
2026-02-18 12:19 ` Luca Ceresoli
1 sibling, 2 replies; 11+ messages in thread
From: Luca Ceresoli @ 2026-02-10 9:54 UTC (permalink / raw)
To: Detlev Casanova, linux-kernel
Cc: Nicolas Frattaroli, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Heiko Stuebner, linux-rockchip, linux-sound,
linux-arm-kernel, kernel, alexandre.belloni, thomas.petazzoni
Hello Detlev,
On Fri Jan 17, 2025 at 5:31 PM CET, Detlev Casanova wrote:
> In commit
> 9e2ab4b18ebd ("ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates"),
> the set_sysclk callback was removed as considered unused as the mclk rate
> can be set in the hw_params callback.
> The difference between hw_params and set_sysclk is that the former is
> called with the audio sampling rate set in the params (e.g.: 48000 Hz)
> while the latter is called with a clock rate already computed with
> sampling_rate * mclk-fs (e.g.: 48000 * 256)
>
> For HDMI audio using the Rockchip I2S TDM driver, the mclk-fs value must
> be set to 128 instead of the default 256, and that value is set in the
> device tree at the machine driver level (like a simple-audio-card
> compatible node).
> Therefore, the i2s_tdm driver has no idea that another mclk-fs value can
> be configured and simply computes the mclk rate in the hw_params callback
> with DEFAULT_MCLK_FS * params_rate(params), which is wrong for HDMI
> audio.
>
> Re-add the set_sysclk callback so that the mclk rate is computed by the
> machine driver which has the correct mclk-fs value set in its device tree
> node.
I'm afraid I just found this commit breaks audio capture on the RK3308.
Using 'arecord -Vmono -d 2 -c 8 -f S16_LE -r 96000 /dev/null' I get:
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 kernel
* arm64 defconfig
Tested kernel versions:
* v6.12 works
* 5323186e2e8d (this commit) fails
* 5323186e2e8d^ works
* 21cfbeae7d7c (same patch on stable/linux-6.12.y) fails
* 21cfbeae7d7c^ works
* v6.19 fails
* v6.19 + 'git revert 5323186e2e8d' works
I don't have more information at the moment.
> Fixes: 9e2ab4b18ebd ("ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates")
I'm the author of commit 9e2ab4b18ebd mentioned in the 'Fixes:' tag, so it
would have been good to Cc me. I would have had the option of testing your
patch and this regression could have been solved before getting in
mainline. I think b4 does it automatically (and perhaps get_maintainers
with appropriate flags).
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [REGRESSION] Re: [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
2026-02-10 9:54 ` [REGRESSION] " Luca Ceresoli
@ 2026-02-17 19:22 ` Mark Brown
2026-02-18 12:14 ` Luca Ceresoli
2026-02-18 12:19 ` Luca Ceresoli
1 sibling, 1 reply; 11+ messages in thread
From: Mark Brown @ 2026-02-17 19:22 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Detlev Casanova, linux-kernel, Nicolas Frattaroli, Liam Girdwood,
Jaroslav Kysela, Takashi Iwai, Heiko Stuebner, linux-rockchip,
linux-sound, linux-arm-kernel, kernel, alexandre.belloni,
thomas.petazzoni
[-- Attachment #1: Type: text/plain, Size: 321 bytes --]
On Tue, Feb 10, 2026 at 10:54:04AM +0100, Luca Ceresoli wrote:
> I'm afraid I just found this commit breaks audio capture on the RK3308.
Can you please send a revert explaining the issue so we can drop the
patch (unless a fix is forthcoming which doesn't seem likely right now,
we can always re-add the support later)?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [REGRESSION] Re: [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
2026-02-17 19:22 ` Mark Brown
@ 2026-02-18 12:14 ` Luca Ceresoli
0 siblings, 0 replies; 11+ messages in thread
From: Luca Ceresoli @ 2026-02-18 12:14 UTC (permalink / raw)
To: Mark Brown
Cc: Detlev Casanova, linux-kernel, Nicolas Frattaroli, Liam Girdwood,
Jaroslav Kysela, Takashi Iwai, Heiko Stuebner, linux-rockchip,
linux-sound, linux-arm-kernel, kernel, alexandre.belloni,
thomas.petazzoni
Hello Mark,
On Tue Feb 17, 2026 at 8:22 PM CET, Mark Brown wrote:
> On Tue, Feb 10, 2026 at 10:54:04AM +0100, Luca Ceresoli wrote:
>
>> I'm afraid I just found this commit breaks audio capture on the RK3308.
>
> Can you please send a revert explaining the issue so we can drop the
> patch (unless a fix is forthcoming which doesn't seem likely right now,
> we can always re-add the support later)?
Thanks for the feedback! Revert patch sent.
Best regards,
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [REGRESSION] Re: [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
2026-02-10 9:54 ` [REGRESSION] " Luca Ceresoli
2026-02-17 19:22 ` Mark Brown
@ 2026-02-18 12:19 ` Luca Ceresoli
2026-02-18 16:01 ` Detlev Casanova
1 sibling, 1 reply; 11+ messages in thread
From: Luca Ceresoli @ 2026-02-18 12:19 UTC (permalink / raw)
To: Luca Ceresoli, Detlev Casanova, linux-kernel
Cc: Nicolas Frattaroli, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Heiko Stuebner, linux-rockchip, linux-sound,
linux-arm-kernel, kernel, alexandre.belloni, thomas.petazzoni
Hello Detlev,
On Tue Feb 10, 2026 at 10:54 AM CET, Luca Ceresoli wrote:
> Hello Detlev,
>
> On Fri Jan 17, 2025 at 5:31 PM CET, Detlev Casanova wrote:
>> In commit
>> 9e2ab4b18ebd ("ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates"),
>> the set_sysclk callback was removed as considered unused as the mclk rate
>> can be set in the hw_params callback.
>> The difference between hw_params and set_sysclk is that the former is
>> called with the audio sampling rate set in the params (e.g.: 48000 Hz)
>> while the latter is called with a clock rate already computed with
>> sampling_rate * mclk-fs (e.g.: 48000 * 256)
>>
>> For HDMI audio using the Rockchip I2S TDM driver, the mclk-fs value must
>> be set to 128 instead of the default 256, and that value is set in the
>> device tree at the machine driver level (like a simple-audio-card
>> compatible node).
>> Therefore, the i2s_tdm driver has no idea that another mclk-fs value can
>> be configured and simply computes the mclk rate in the hw_params callback
>> with DEFAULT_MCLK_FS * params_rate(params), which is wrong for HDMI
>> audio.
>>
>> Re-add the set_sysclk callback so that the mclk rate is computed by the
>> machine driver which has the correct mclk-fs value set in its device tree
>> node.
>
> I'm afraid I just found this commit breaks audio capture on the RK3308.
>
> Using 'arecord -Vmono -d 2 -c 8 -f S16_LE -r 96000 /dev/null' I get:
>
> 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 kernel
> * arm64 defconfig
>
> Tested kernel versions:
>
> * v6.12 works
> * 5323186e2e8d (this commit) fails
> * 5323186e2e8d^ works
> * 21cfbeae7d7c (same patch on stable/linux-6.12.y) fails
> * 21cfbeae7d7c^ works
> * v6.19 fails
> * v6.19 + 'git revert 5323186e2e8d' works
>
> I don't have more information at the moment.
Let me add some more info to my previous report.
The function failing is clk_set_rate() in rockchip_i2s_tdm_hw_params().
I added some logging to rockchip_i2s_tdm_hw_params() and here's the output:
On v6.19-11566-g254edc893f3a (current Linux master)
At boot:
[ 3.324622] rockchip-i2s-tdm ff320000.i2s: The target mclk_tx freq is: 50176000
[ 3.324720] rockchip-i2s-tdm ff320000.i2s: using zero-initialized flat cache, this may cause unexpected behavior
When launching arecord:
[ 18.429389] rockchip_i2s_tdm_hw_params:653 i2s_tdm->is_master_mode = 1
[ 18.430154] rockchip_i2s_tdm_hw_params:654 i2s_tdm->mclk_tx clk_i2s2_8ch_tx
[ 18.430815] rockchip_i2s_tdm_hw_params:655 i2s_tdm->mclk_rx clk_i2s2_8ch_rx
[ 18.431465] rockchip_i2s_tdm_hw_params:656 i2s_tdm->mclk_tx_freq 50176000
[ 18.432097] rockchip_i2s_tdm_hw_params:657 i2s_tdm->mclk_rx_freq 0
[ 18.432677] rockchip_i2s_tdm_hw_params:658 i2s_tdm->clk_trcm 0
[ 18.433230] rockchip_i2s_tdm_hw_params:659 substream->stream 1
[ 18.433858] rockchip_i2s_tdm_hw_params:678 mclk clk_i2s2_8ch_rx
[ 18.434423] rockchip_i2s_tdm_hw_params:679 mclk_rate 0
[ 18.434977] rockchip_i2s_tdm_hw_params:682 clk_set_rate(clk_i2s2_8ch_rx, 0) returned -22
[ 18.435743] rockchip-i2s-tdm ff320000.i2s: ASoC error (-22): at snd_soc_dai_hw_params() on ff320000.i2s
[ 18.436699] ff320000.i2s-rk3308-hifi: ASoC error (-22): at __soc_pcm_hw_params() on ff320000.i2s-rk3308-hifi
On v6.19-11566-g254edc893f3a + 'git revert 5323186e2e8d'
At boot:
[ 3.283853] rockchip-i2s-tdm ff320000.i2s: using zero-initialized flat cache, this may cause unexpected behavior
When launching arecord:
[ 11.952290] rockchip_i2s_tdm_hw_params:631 i2s_tdm->is_master_mode = 1
[ 11.952955] rockchip_i2s_tdm_hw_params:632 i2s_tdm->mclk_tx clk_i2s2_8ch_tx
[ 11.953615] rockchip_i2s_tdm_hw_params:633 i2s_tdm->mclk_rx clk_i2s2_8ch_rx
[ 11.954355] rockchip_i2s_tdm_hw_params:636 i2s_tdm->clk_trcm 0
[ 11.954917] rockchip_i2s_tdm_hw_params:637 substream->stream 1
[ 11.955477] rockchip_i2s_tdm_hw_params:652 mclk clk_i2s2_8ch_rx
[ 11.956048] rockchip_i2s_tdm_hw_params:653 params_rate(params) 96000
[ 11.956769] rockchip_i2s_tdm_hw_params:656 clk_set_rate(clk_i2s2_8ch_rx, 24576000) returned 0
I cannot point to the right fix but the value 0 in i2s_tdm->mclk_rx_freq
appears as a good clue, perhaps it has never been set.
I hope this helps.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [REGRESSION] Re: [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
2026-02-18 12:19 ` Luca Ceresoli
@ 2026-02-18 16:01 ` Detlev Casanova
2026-02-18 16:51 ` Luca Ceresoli
0 siblings, 1 reply; 11+ messages in thread
From: Detlev Casanova @ 2026-02-18 16:01 UTC (permalink / raw)
To: Luca Ceresoli, linux-kernel
Cc: Nicolas Frattaroli, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Heiko Stuebner, linux-rockchip, linux-sound,
linux-arm-kernel, kernel, alexandre.belloni, thomas.petazzoni
[-- Attachment #1: Type: text/plain, Size: 5189 bytes --]
Hi Lucas, sorry for breaking support on your board.
I'm also surprised that you were not added in CC of the original patch.
Can you try to keep the patch and apply the attached one instead ?
Detlev.
On 2/18/26 07:19, Luca Ceresoli wrote:
> Hello Detlev,
>
> On Tue Feb 10, 2026 at 10:54 AM CET, Luca Ceresoli wrote:
>> Hello Detlev,
>>
>> On Fri Jan 17, 2025 at 5:31 PM CET, Detlev Casanova wrote:
>>> In commit
>>> 9e2ab4b18ebd ("ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates"),
>>> the set_sysclk callback was removed as considered unused as the mclk rate
>>> can be set in the hw_params callback.
>>> The difference between hw_params and set_sysclk is that the former is
>>> called with the audio sampling rate set in the params (e.g.: 48000 Hz)
>>> while the latter is called with a clock rate already computed with
>>> sampling_rate * mclk-fs (e.g.: 48000 * 256)
>>>
>>> For HDMI audio using the Rockchip I2S TDM driver, the mclk-fs value must
>>> be set to 128 instead of the default 256, and that value is set in the
>>> device tree at the machine driver level (like a simple-audio-card
>>> compatible node).
>>> Therefore, the i2s_tdm driver has no idea that another mclk-fs value can
>>> be configured and simply computes the mclk rate in the hw_params callback
>>> with DEFAULT_MCLK_FS * params_rate(params), which is wrong for HDMI
>>> audio.
>>>
>>> Re-add the set_sysclk callback so that the mclk rate is computed by the
>>> machine driver which has the correct mclk-fs value set in its device tree
>>> node.
>> I'm afraid I just found this commit breaks audio capture on the RK3308.
>>
>> Using 'arecord -Vmono -d 2 -c 8 -f S16_LE -r 96000 /dev/null' I get:
>>
>> 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 kernel
>> * arm64 defconfig
>>
>> Tested kernel versions:
>>
>> * v6.12 works
>> * 5323186e2e8d (this commit) fails
>> * 5323186e2e8d^ works
>> * 21cfbeae7d7c (same patch on stable/linux-6.12.y) fails
>> * 21cfbeae7d7c^ works
>> * v6.19 fails
>> * v6.19 + 'git revert 5323186e2e8d' works
>>
>> I don't have more information at the moment.
> Let me add some more info to my previous report.
>
> The function failing is clk_set_rate() in rockchip_i2s_tdm_hw_params().
>
> I added some logging to rockchip_i2s_tdm_hw_params() and here's the output:
>
> On v6.19-11566-g254edc893f3a (current Linux master)
>
> At boot:
> [ 3.324622] rockchip-i2s-tdm ff320000.i2s: The target mclk_tx freq is: 50176000
> [ 3.324720] rockchip-i2s-tdm ff320000.i2s: using zero-initialized flat cache, this may cause unexpected behavior
> When launching arecord:
> [ 18.429389] rockchip_i2s_tdm_hw_params:653 i2s_tdm->is_master_mode = 1
> [ 18.430154] rockchip_i2s_tdm_hw_params:654 i2s_tdm->mclk_tx clk_i2s2_8ch_tx
> [ 18.430815] rockchip_i2s_tdm_hw_params:655 i2s_tdm->mclk_rx clk_i2s2_8ch_rx
> [ 18.431465] rockchip_i2s_tdm_hw_params:656 i2s_tdm->mclk_tx_freq 50176000
> [ 18.432097] rockchip_i2s_tdm_hw_params:657 i2s_tdm->mclk_rx_freq 0
> [ 18.432677] rockchip_i2s_tdm_hw_params:658 i2s_tdm->clk_trcm 0
> [ 18.433230] rockchip_i2s_tdm_hw_params:659 substream->stream 1
> [ 18.433858] rockchip_i2s_tdm_hw_params:678 mclk clk_i2s2_8ch_rx
> [ 18.434423] rockchip_i2s_tdm_hw_params:679 mclk_rate 0
> [ 18.434977] rockchip_i2s_tdm_hw_params:682 clk_set_rate(clk_i2s2_8ch_rx, 0) returned -22
> [ 18.435743] rockchip-i2s-tdm ff320000.i2s: ASoC error (-22): at snd_soc_dai_hw_params() on ff320000.i2s
> [ 18.436699] ff320000.i2s-rk3308-hifi: ASoC error (-22): at __soc_pcm_hw_params() on ff320000.i2s-rk3308-hifi
>
> On v6.19-11566-g254edc893f3a + 'git revert 5323186e2e8d'
>
> At boot:
> [ 3.283853] rockchip-i2s-tdm ff320000.i2s: using zero-initialized flat cache, this may cause unexpected behavior
> When launching arecord:
> [ 11.952290] rockchip_i2s_tdm_hw_params:631 i2s_tdm->is_master_mode = 1
> [ 11.952955] rockchip_i2s_tdm_hw_params:632 i2s_tdm->mclk_tx clk_i2s2_8ch_tx
> [ 11.953615] rockchip_i2s_tdm_hw_params:633 i2s_tdm->mclk_rx clk_i2s2_8ch_rx
> [ 11.954355] rockchip_i2s_tdm_hw_params:636 i2s_tdm->clk_trcm 0
> [ 11.954917] rockchip_i2s_tdm_hw_params:637 substream->stream 1
> [ 11.955477] rockchip_i2s_tdm_hw_params:652 mclk clk_i2s2_8ch_rx
> [ 11.956048] rockchip_i2s_tdm_hw_params:653 params_rate(params) 96000
> [ 11.956769] rockchip_i2s_tdm_hw_params:656 clk_set_rate(clk_i2s2_8ch_rx, 24576000) returned 0
>
> I cannot point to the right fix but the value 0 in i2s_tdm->mclk_rx_freq
> appears as a good clue, perhaps it has never been set.
>
> I hope this helps.
>
> Luca
>
> --
> Luca Ceresoli, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
[-- Attachment #2: 0001-sound-rockchip-Use-param-freq-if-not-provided-by-set.patch --]
[-- Type: text/x-patch, Size: 1268 bytes --]
From f2441859c368fe25512a71e82160b0a307ed4429 Mon Sep 17 00:00:00 2001
From: Detlev Casanova <detlev.casanova@collabora.com>
Date: Wed, 18 Feb 2026 10:46:50 -0500
Subject: [PATCH] sound: rockchip: Use param freq if not provided by set_sysclk
Hi Lucas, sorry for breaking support on your board.
I'm also surprised that you were not added in CC of the original patch.
Can you try to keep the patch and apply this instead ?
Drivers will not always set the sysclk.
If that is the case, use the clock set in the params multiplied by the
default mclk-fs.
---
sound/soc/rockchip/rockchip_i2s_tdm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
index 770b9bfbb384..f2cda7e64b74 100644
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -665,6 +665,12 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,
mclk_rate = i2s_tdm->mclk_rx_freq;
}
+ /* If the dai/component driver didn't call set_sysclk(), simply
+ * use the freq from the params.
+ */
+ if (!mclk_rate)
+ mclk_rate = DEFAULT_MCLK_FS * params_rate(params);
+
err = clk_set_rate(mclk, mclk_rate);
if (err)
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [REGRESSION] Re: [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
2026-02-18 16:01 ` Detlev Casanova
@ 2026-02-18 16:51 ` Luca Ceresoli
2026-02-18 17:10 ` Mark Brown
0 siblings, 1 reply; 11+ messages in thread
From: Luca Ceresoli @ 2026-02-18 16:51 UTC (permalink / raw)
To: Detlev Casanova, linux-kernel
Cc: Nicolas Frattaroli, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Heiko Stuebner, linux-rockchip, linux-sound,
linux-arm-kernel, kernel, alexandre.belloni, thomas.petazzoni
Hello Detlev,
On Wed Feb 18, 2026 at 5:01 PM CET, Detlev Casanova wrote:
> Hi Lucas, sorry for breaking support on your board.
> I'm also surprised that you were not added in CC of the original patch.
>
> Can you try to keep the patch and apply the attached one instead ?
Thanks for the quick feedback.
About your patch:
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -665,6 +665,12 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,
mclk_rate = i2s_tdm->mclk_rx_freq;
}
+ /* If the dai/component driver didn't call set_sysclk(), simply
+ * use the freq from the params.
+ */
The comment is slightly incorrect: set_sysclk() was called in my case, but
only for playback, not for capture. You can reword accordingly.
+ if (!mclk_rate)
+ mclk_rate = DEFAULT_MCLK_FS * params_rate(params);
With this, and DEFAULT_MCLK_FS defined to 256, arecord is working again.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [REGRESSION] Re: [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
2026-02-18 16:51 ` Luca Ceresoli
@ 2026-02-18 17:10 ` Mark Brown
2026-02-18 17:17 ` Detlev Casanova
0 siblings, 1 reply; 11+ messages in thread
From: Mark Brown @ 2026-02-18 17:10 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Detlev Casanova, linux-kernel, Nicolas Frattaroli, Liam Girdwood,
Jaroslav Kysela, Takashi Iwai, Heiko Stuebner, linux-rockchip,
linux-sound, linux-arm-kernel, kernel, alexandre.belloni,
thomas.petazzoni
[-- Attachment #1: Type: text/plain, Size: 369 bytes --]
On Wed, Feb 18, 2026 at 05:51:51PM +0100, Luca Ceresoli wrote:
> On Wed Feb 18, 2026 at 5:01 PM CET, Detlev Casanova wrote:
> + if (!mclk_rate)
> + mclk_rate = DEFAULT_MCLK_FS * params_rate(params);
> With this, and DEFAULT_MCLK_FS defined to 256, arecord is working again.
I did have the revert queued, but a fix would be even better if the
patch could be sent?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [REGRESSION] Re: [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
2026-02-18 17:10 ` Mark Brown
@ 2026-02-18 17:17 ` Detlev Casanova
2026-02-18 17:19 ` Mark Brown
0 siblings, 1 reply; 11+ messages in thread
From: Detlev Casanova @ 2026-02-18 17:17 UTC (permalink / raw)
To: Mark Brown, Luca Ceresoli
Cc: linux-kernel, Nicolas Frattaroli, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, Heiko Stuebner, linux-rockchip, linux-sound,
linux-arm-kernel, kernel, alexandre.belloni, thomas.petazzoni
Hi Mark,
On 2/18/26 12:10, Mark Brown wrote:
> On Wed, Feb 18, 2026 at 05:51:51PM +0100, Luca Ceresoli wrote:
>> On Wed Feb 18, 2026 at 5:01 PM CET, Detlev Casanova wrote:
>> + if (!mclk_rate)
>> + mclk_rate = DEFAULT_MCLK_FS * params_rate(params);
>> With this, and DEFAULT_MCLK_FS defined to 256, arecord is working again.
> I did have the revert queued, but a fix would be even better if the
> patch could be sent?
A fix will follow a bit later today, then.
Detlev.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [REGRESSION] Re: [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
2026-02-18 17:17 ` Detlev Casanova
@ 2026-02-18 17:19 ` Mark Brown
0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2026-02-18 17:19 UTC (permalink / raw)
To: Detlev Casanova
Cc: Luca Ceresoli, linux-kernel, Nicolas Frattaroli, Liam Girdwood,
Jaroslav Kysela, Takashi Iwai, Heiko Stuebner, linux-rockchip,
linux-sound, linux-arm-kernel, kernel, alexandre.belloni,
thomas.petazzoni
[-- Attachment #1: Type: text/plain, Size: 259 bytes --]
On Wed, Feb 18, 2026 at 12:17:04PM -0500, Detlev Casanova wrote:
> On 2/18/26 12:10, Mark Brown wrote:
> > I did have the revert queued, but a fix would be even better if the
> > patch could be sent?
> A fix will follow a bit later today, then.
Fantastic!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-02-18 17:19 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-17 16:31 [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback Detlev Casanova
2025-01-21 18:10 ` Mark Brown
2026-02-10 9:54 ` [REGRESSION] " Luca Ceresoli
2026-02-17 19:22 ` Mark Brown
2026-02-18 12:14 ` Luca Ceresoli
2026-02-18 12:19 ` Luca Ceresoli
2026-02-18 16:01 ` Detlev Casanova
2026-02-18 16:51 ` Luca Ceresoli
2026-02-18 17:10 ` Mark Brown
2026-02-18 17:17 ` Detlev Casanova
2026-02-18 17:19 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox