]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
authorDetlev Casanova <detlev.casanova@collabora.com>
Fri, 17 Jan 2025 16:31:02 +0000 (11:31 -0500)
committerMark Brown <broonie@kernel.org>
Tue, 21 Jan 2025 15:21:49 +0000 (15:21 +0000)
commit5323186e2e8d33c073fad51e24f18e2d6dbae2da
treeb47415e7810b5f7ce8b7c38d6377a57bb40db6ed
parentd1e7dce240f1352816564dc483b734db334ebde4
ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback

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>
Link: https://patch.msgid.link/20250117163102.65807-1-detlev.casanova@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/rockchip/rockchip_i2s_tdm.c