All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
To: "Detlev Casanova" <detlev.casanova@collabora.com>,
	<linux-kernel@vger.kernel.org>
Cc: "Nicolas Frattaroli" <frattaroli.nicolas@gmail.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Heiko Stuebner" <heiko@sntech.de>,
	<linux-rockchip@lists.infradead.org>,
	<linux-sound@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <kernel@collabora.com>,
	<alexandre.belloni@bootlin.com>, <thomas.petazzoni@bootlin.com>
Subject: [REGRESSION] Re: [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
Date: Tue, 10 Feb 2026 10:54:04 +0100	[thread overview]
Message-ID: <DGB6VK7LC8N7.322SYGWZXPL5W@bootlin.com> (raw)
In-Reply-To: <20250117163102.65807-1-detlev.casanova@collabora.com>

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


WARNING: multiple messages have this Message-ID (diff)
From: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
To: "Detlev Casanova" <detlev.casanova@collabora.com>,
	<linux-kernel@vger.kernel.org>
Cc: "Nicolas Frattaroli" <frattaroli.nicolas@gmail.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Heiko Stuebner" <heiko@sntech.de>,
	<linux-rockchip@lists.infradead.org>,
	<linux-sound@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <kernel@collabora.com>,
	<alexandre.belloni@bootlin.com>, <thomas.petazzoni@bootlin.com>
Subject: [REGRESSION] Re: [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
Date: Tue, 10 Feb 2026 10:54:04 +0100	[thread overview]
Message-ID: <DGB6VK7LC8N7.322SYGWZXPL5W@bootlin.com> (raw)
In-Reply-To: <20250117163102.65807-1-detlev.casanova@collabora.com>

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

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  parent reply	other threads:[~2026-02-10  9:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17 16:31 [PATCH v1] ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback Detlev Casanova
2025-01-17 16:31 ` Detlev Casanova
2025-01-21 18:10 ` Mark Brown
2025-01-21 18:10   ` Mark Brown
2026-02-10  9:54 ` Luca Ceresoli [this message]
2026-02-10  9:54   ` [REGRESSION] " Luca Ceresoli
2026-02-17 19:22   ` Mark Brown
2026-02-17 19:22     ` Mark Brown
2026-02-18 12:14     ` Luca Ceresoli
2026-02-18 12:14       ` Luca Ceresoli
2026-02-18 12:19   ` Luca Ceresoli
2026-02-18 12:19     ` Luca Ceresoli
2026-02-18 16:01     ` Detlev Casanova
2026-02-18 16:01       ` Detlev Casanova
2026-02-18 16:51       ` Luca Ceresoli
2026-02-18 16:51         ` Luca Ceresoli
2026-02-18 17:10         ` Mark Brown
2026-02-18 17:10           ` Mark Brown
2026-02-18 17:17           ` Detlev Casanova
2026-02-18 17:17             ` Detlev Casanova
2026-02-18 17:19             ` Mark Brown
2026-02-18 17:19               ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DGB6VK7LC8N7.322SYGWZXPL5W@bootlin.com \
    --to=luca.ceresoli@bootlin.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=broonie@kernel.org \
    --cc=detlev.casanova@collabora.com \
    --cc=frattaroli.nicolas@gmail.com \
    --cc=heiko@sntech.de \
    --cc=kernel@collabora.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.