ASoC: meson: axg-tdm-interface: fix mclk setup without mclk-fs
authorJerome Brunet <jbrunet@baylibre.com>
Fri, 23 Feb 2024 17:51:07 +0000 (18:51 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 26 Feb 2024 14:03:13 +0000 (14:03 +0000)
By default, when mclk-fs is not provided, the tdm-interface driver
requests an MCLK that is 4x the bit clock, SCLK.

However there is no justification for this:

* If the codec needs MCLK for its operation, mclk-fs is expected to be set
  according to the codec requirements.
* If the codec does not need MCLK the minimum is 2 * SCLK, because this is
  minimum the divider between SCLK and MCLK can do.

Multiplying by 4 may cause problems because the PLL limit may be reached
sooner than it should, so use 2x instead.

Fixes: d60e4f1e4be5 ("ASoC: meson: add tdm interface driver")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://msgid.link/r/20240223175116.2005407-2-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/meson/axg-tdm-interface.c

index 1c3d433cefd23c400850429d1f9211f9d0da47a9..cd5168e826df4f2abbc605874013883d43646e28 100644 (file)
@@ -264,8 +264,8 @@ static int axg_tdm_iface_set_sclk(struct snd_soc_dai *dai,
        srate = iface->slots * iface->slot_width * params_rate(params);
 
        if (!iface->mclk_rate) {
-               /* If no specific mclk is requested, default to bit clock * 4 */
-               clk_set_rate(iface->mclk, 4 * srate);
+               /* If no specific mclk is requested, default to bit clock * 2 */
+               clk_set_rate(iface->mclk, 2 * srate);
        } else {
                /* Check if we can actually get the bit clock from mclk */
                if (iface->mclk_rate % srate) {