From: Chancel Liu Date: Wed, 9 Oct 2024 07:46:43 +0000 (+0800) Subject: ASoC: imx-card: Set mclk for codec X-Git-Tag: v6.13-rc1~123^2~2^2~94^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=892373e4de626c61e91816e3d3970d82beb50c4b;p=thirdparty%2Fkernel%2Flinux.git ASoC: imx-card: Set mclk for codec 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 Signed-off-by: Shengjiu Wang Reviewed-by: Iuliana Prodan Link: https://patch.msgid.link/1728460004-364-2-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index a7215bad64845..2f3dbbd157914 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -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; }