[PATCH] ASoC: nau8822: choose the best master clock prescalar

Hui Wang hui.wang at canonical.com
Tue May 24 10:38:38 CEST 2022


On 5/24/22 16:07, David Lin wrote:
> On 2022/5/24 上午 11:33, Hui Wang wrote:
>> We have an imx6sx EVB with the codec nau8822, when playing the audio
>> with 48k sample rate, the audio sounds distorted and obviously faster
>>
<snip>
>> -            div = i;
>>           }
>>           dev_dbg(component->dev, "master clock prescaler %x for fs 
>> %d\n",
>>               div, rate);
>
> Regarding to your environment with input MCLK is 24 MHz, I think you 
> should enable PLL for the internal process of codec.
>
> So you should do the following calls/operations:
>
Thanks for your suggestion. In our case, we use the simple-card as the 
machine driver, the simple-card hard-codes the 2nd parameter of 
snd_soc_dai_set_sysclk() to 0, and we don't plan to write a new machine 
driver since sound quality is pretty good if setting to 46875Hz.

So according to your experience, does the new algorithm bring any side 
effect or break existing platforms? If so, we have to write a new 
machine driver (that is a big effort).

Thanks,

Hui.

> //PLL
>     ret = snd_soc_dai_set_sysclk(codec_dai, NAU8822_CLK_PLL,
>                       24000000, SND_SOC_CLOCK_IN);
>     if (ret < 0 )
>         dev_err(card->dev, "failed to set codec sysclk: %d\n", ret);
>
>     ret = snd_soc_dai_set_pll(codec_dai, 0, 0,
>                   24000000, 256 * params_rate(params));
>     if (ret < 0 )
>
>         dev_err(card->dev, "failed to set codec pll: %d\n", ret);
>
> David
>


More information about the Alsa-devel mailing list