imx8mm audio codec SGTL5000

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx8mm audio codec SGTL5000

466 Views
Shao
Contributor I

Hi,

I use advantech-ROM5721 and I face a problem about porting audio codec SGTL5000.

I set the codec sys_mclk to 24,576,000Hz and use codec internal PLL function descripte in datasheet Figure 9.

Here is device tree and driver I use.
The HP_Out and Line_Out output with a lot of noise (sounds likewhite noise).

I try some modify to fix the problem but unfortunately.

What I try

1. regard frequecny(24,576,000Hz) as  22579200 to setup the CHIP_CLK_CTRL register (as attachment line 965)

The noise almost cancel, but the tone different about 10%

Ex I play 1KHz single tone sound, output 1.09KHz tone.

 

2. change sys_clk to 22,579,200 (44,100Hz*512) at the device tree as below.

 

Spoiler

&sai1 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_sai1>;
    assigned-clocks = <&clk IMX8MM_CLK_SAI1>;
    assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
    // assigned-clock-rates = <0>, <24576000>;
    assigned-clock-rates = <0>, <22579200>;
    status = "okay";
};

&i2c4{

    codec: sgtl5000@a {
       compatible = "fsl,sgtl5000";
       reg = <0x0a>;
       clocks = <&clk IMX8MM_CLK_SAI1_ROOT>;
       clock-names = "mclk";
       pinctrl-names = "default";
       pinctrl-0 = <&pinctrl_sai1_mclk>;
       assigned-clocks = <&clk IMX8MM_CLK_SAI1>;
       assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
       // assigned-clock-rates = <24576000>;
       assigned-clock-rates = <22579200>;
    };

};

The driver only apply frequency to 23,130,353 Hz
I use printk in the function "sgtl5000_set_dai_sysclk " to check sysclk

Since the mclk/sample_freq is not equal to 256, 384 or 512, driver use the PLL setting.

 

Spoiler
printk("%s:sgtl5000->sysclk:%d\n", __func__, freq);
// [ 6.262997] sgtl5000_set_dai_sysclk:sgtl5000->sysclk:23130353

 

What is the sysclk prefre for sgtl5000?

How to change the sysclk to specific frequency(ex:22,579,200 (44,100Hz*512) or 11,289,600(44,100Hz*256))?

 

 

 

Labels (1)
0 Kudos
1 Reply

416 Views
Harvey021
NXP TechSupport
NXP TechSupport

Hi @Shao 

If the audio quality sounds good after modification, it is okay to the tone difference shown.

Best regards

Harvey

0 Kudos