Switch to use internal PLL for iMCLK
authorMark Brown <broonie@kernel.org>
Tue, 7 Jun 2022 10:53:44 +0000 (11:53 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 7 Jun 2022 10:53:44 +0000 (11:53 +0100)
Merge series from Hui Wang <hui.wang@canonical.com>:

Taking your advice and try to enable internal PLL to get a more
accurate sample rate. And I also changed the fsl-asoc-card.c to support
the nau8822 codec, now the sound quality is pretty good on my imx6sx
EVB.

1  2 
sound/soc/codecs/nau8822.c

@@@ -726,10 -726,13 +726,17 @@@ static int nau8822_set_pll(struct snd_s
        struct nau8822_pll *pll_param = &nau8822->pll;
        int ret, fs;
  
 +      if (freq_in == pll_param->freq_in &&
 +          freq_out == pll_param->freq_out)
 +              return 0;
 +
+       if (freq_out == 0) {
+               dev_dbg(component->dev, "PLL disabled\n");
+               snd_soc_component_update_bits(component,
+                       NAU8822_REG_POWER_MANAGEMENT_1, NAU8822_PLL_EN_MASK, NAU8822_PLL_OFF);
+               return 0;
+       }
        fs = freq_out / 256;
  
        ret = nau8822_calc_pll(freq_in, fs, pll_param);