Device Tree for new Audio codec under imx8qm Custom

cancel
Showing results for 
Search instead for 
Did you mean: 

Device Tree for new Audio codec under imx8qm Custom

145 Views
vinothkumars
Senior Contributor III

Hi All,

 

I am working on IMX8QM Custom Platform. I unable to achieve new codec (nau8810) interface in my platform. Please find my below code and give your feedback.

 

Using I2C0 interface with SAI1

 

/* Do not have fsl codec interface driver, So I used the simple codec driver for interface */

+ sound{
+ compatible = "simple-audio-card";
+ lable = "nau8810-audio";
+ simple-audio-card,frame-master = <&nacpu>;
+ simple-audio-card,bitclock-master = <&nacpu>;
+ simple-audio-card,widgets = "Speaker", "Speaker";
+ simple-audio-card,routing = "Speaker", "Speaker";
+ simple-audio-card,dai-link {
+ format = "i2s";
+ cpu {
+ sound-dai = <&sai1 1>;
+ };
+ nacpu: codec {
+ sound-dai = <&nau8810>;
+ };
+ };
+ };

/* Under I2C0 */
+ nau8810: nau8810@1a {
+ #sound-dai-cells = <0>;
+ compatible = "nuvoton,nau8810";
+ reg = <0x1a>;
+ };


 

Regards,
Vinothkumar Sekar
0 Kudos
4 Replies

139 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Vinothkumar

 

for porting new codec one can look at Chapter 16 Porting Audio Codecs  i.MX Porting Guide​  

and Chapter 7 Audio   i.MX Linux Reference Manual​

 

Best regards
igor

0 Kudos

119 Views
vinothkumars
Senior Contributor III

Thank you @igorpadykov ,

 

I did the configuration and codec also detecting now, But, I got error while capture and playback. and also there is no audio from speaker

 

root@root:~# cat /proc/asound/cards
0 [D59050000sainau]: 59050000_sai-na - 59050000.sai-nau8810-hifi
59050000.sai-nau8810-hifi

root@root:~# arecord -d 0 -f u8 viz.wav
Recording WAVE 'viz.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
[ 1066.472264] nau8810 3-001a: ASoC: error at snd_soc_component_update_bits on nau8810.3-001a: -110
[ 1067.488257] nau8810 3-001a: ASoC: error at snd_soc_component_update_bits on nau8810.3-001a: -110
[ 1068.504247] nau8810 3-001a: ASoC: error at snd_soc_component_update_bits on nau8810.3-001a: -110



root@root:~# aplay viz.wav
Playing WAVE 'viz.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
[ 1670.316265] nau8810 3-001a: ASoC: error at snd_soc_component_update_bits on nau8810.3-001a: -110
[ 1671.332247] nau8810 3-001a: ASoC: error at snd_soc_component_update_bits on nau8810.3-001a: -110
[ 1672.348247] nau8810 3-001a: ASoC: error at snd_soc_component_update_bits on nau8810.3-001a: -110

 

Regards,
Vinothkumar Sekar
0 Kudos

91 Views
vinothkumars
Senior Contributor III

Thank you @igorpadykov for the reply,

Audio Codec DTS: 

/* Connected with I2C0 */
        nau8810: nau8810@1a {

                #sound-dai-cells = <0>;

                compatible = "nuvoton,nau8810";

                reg = <0x1a>;

                clocks = <&mclkout0_lpcg 0>;

                clock-names = "mclk";

                assigned-clocks = <&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_PLL>,

                                <&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_SLV_BUS>,

                                <&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_MST_BUS>,

                                <&mclkout0_lpcg 0>;

                assigned-clock-rates = <786432000>, <49152000>, <12288000>, <12288000>;




        };

 

/* Connected with SAI1 */
        sound-nau8810{

                compatible = "simple-audio-card";

                lable = "nau8810-audio";

                simple-audio-card,frame-master = <&nacpu>;

                simple-audio-card,bitclock-master = <&nacpu>;

                simple-audio-card,widgets =

                        "Speaker", "Ext Spk",

                        "Microphone", "Mic Jack";

                simple-audio-card,routing =

                        "Ext Spk", "MONOOUT",

                        "Ext Spk", "SPKOUTP",

                        "Ext Spk", "SPKOUTN",

                        "MICN", "Mic Jack",

                        "MICP", "Mic Jack",

                        "Mic Jack", "Mic Bias";




                simple-audio-card,dai-link {

                        format = "i2s";

                        cpu {

                                sound-dai = <&sai1>;

                        };

                        nacpu: codec {

                                sound-dai = <&nau8810>;

                        };

                };

        };





But, problem I here I don't MCLK line. MCLK and BCLK are shorted. 

 

vinothkumars_1-1632829284504.png

 

So, There is no separate MCLK and BCLK

 

Regards,
Vinothkumar Sekar
0 Kudos

75 Views
vinothkumars
Senior Contributor III

Hi @igorpadykov ,

 

Audio codec is working, But, I got noise instead of proper sound, Will you please check the device tree and schematic.

Regards,
Vinothkumar Sekar
0 Kudos