linux/sound/soc/rockchip
Detlev Casanova 21cfbeae7d ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
[ Upstream commit 5323186e2e ]

In commit
9e2ab4b18e ("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: 9e2ab4b18e ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-02-08 09:58:10 +01:00
..
Kconfig ASoC: Kconfig: fix spelling of "up to" 2023-01-25 14:24:03 +00:00
Makefile ASoC: rockchip: Use *-y instead of *-objs in Makefile 2024-05-08 11:39:27 +09:00
rk3288_hdmi_analog.c ASoC: rockchip: Convert RK3288 HDMI to GPIO descriptors 2023-10-09 13:14:12 +01:00
rk3399_gru_sound.c i2c: make i2c_bus_type const 2024-01-18 21:10:43 +01:00
rockchip_i2s.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
rockchip_i2s.h ASoC: rockchip: i2s: Add support for frame inversion 2021-08-26 13:59:40 +01:00
rockchip_i2s_tdm.c ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback 2025-02-08 09:58:10 +01:00
rockchip_i2s_tdm.h ASoC: rockchip: add support for i2s-tdm controller 2021-10-07 16:58:16 +01:00
rockchip_max98090.c ASoC: DT matching and header cleanups 2023-10-09 23:14:18 +01:00
rockchip_pdm.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
rockchip_pdm.h ASoC: rockchip: pdm: Add support for path map 2021-09-13 01:44:10 +01:00
rockchip_rt5645.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
rockchip_spdif.c ASoC: Switch back to struct platform_driver::remove() 2024-09-09 18:26:49 +01:00
rockchip_spdif.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00