]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ASoC: imx-card: Set mclk for codec
authorChancel Liu <chancel.liu@nxp.com>
Wed, 9 Oct 2024 07:46:43 +0000 (15:46 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 10 Oct 2024 14:20:35 +0000 (15:20 +0100)
In some cases, ASoC machine driver may modify the mclk frequency
according to sample rate but the value in codec is still initial
frequency which should be replaced. For example, we should update
mclk before setup for cs42xx8 mclk relating registers.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Link: https://patch.msgid.link/1728460004-364-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/imx-card.c

index a7215bad648457bdc1b5ef6cdf6fe0bca0fc3db5..2f3dbbd157914e505ece16f2ea7a954cb71a85f6 100644 (file)
@@ -370,6 +370,11 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream,
                dev_err(dev, "failed to set cpui dai mclk1 rate (%lu): %d\n", mclk_freq, ret);
                return ret;
        }
+       ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk_freq, SND_SOC_CLOCK_IN);
+       if (ret && ret != -ENOTSUPP) {
+               dev_err(dev, "failed to set codec dai mclk rate (%lu): %d\n", mclk_freq, ret);
+               return ret;
+       }
 
        return 0;
 }