Device Tree for new Audio codec under imx8qm Custom

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Device Tree for new Audio codec under imx8qm Custom

5,587 次查看
vinothkumars
Senior Contributor IV

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 项奖励
回复
11 回复数

3,990 次查看
KBL
Contributor I

@vinothkumars did you find a soulution? We have the same problem and get the error:

nau8810 0-001a: ASoC: error at snd_soc_component_update_bits on nau8810.0-001a: -6

 

Regards,

Blume

0 项奖励
回复

5,420 次查看
DhavalS
Contributor II

Hi Team,

I am working on the same task. We have shared the part of the schematic to provide the idea how the SOC SAI1 and  codec pins are interfaced.

Just to provide more info on machine driver and also some more details

file : sound/soc/fsl/fsl-asoc-card.c

With this interfacing, we can see clock as follows on SAI1_TXC_CODEC and so on MCLK pin of the codec

  • Configure codec as slave and format is I2S (SND_SOC_DAIFMT_I2S)
    • Format S16_LE and two channel
    • Clock for Sampling rate 8k = 256000HZ
    • Clock for Sampling rate 48k = 1536000HZ
    • Audio output = Only noise and no audio

 

  • Configure codec as slave and format is PCM (SND_SOC_DAIFMT_DSP_A)
    • Format S16_LE and two channel
    • Clock for Sampling rate 8k = 512000HZ
    • Clock for Sampling rate 48k = 3072000HZ
    • Audio output = Only noise and no audio

Can you please let us know that MCLK_OUT0 of the SOC need to connect with the Codec MCLK pin instead of the SAI1_TXC_CODEC pin?

Any pointers are really appreciated.

0 项奖励
回复

5,405 次查看
igorpadykov
NXP Employee
NXP Employee

>Can you please let us know that MCLK_OUT0 of the SOC need to connect with

>the Codec MCLK pin instead of the SAI1_TXC_CODEC pin?

 

for MCLK_OUT0 connection one can look at p.12, p.31 U43 NC7WV16, p.24

U29 WM8960 SPF-29420  MCIMX8QM-CPU MEK – Schematics

 

Best regards
igor

0 项奖励
回复

5,397 次查看
DhavalS
Contributor II

Hi Igor,

 

Thanks a lot for your quick reponse.

I have seen this MCLK_OUT0 is connected with Codec MCLK pin in MEK board.

But, same thing is not connected in our case so to get proper clock and make codec work is MCLK_OUT0 required to connect with MCLK pin of codec or that is not mandetory ?

 

We are using sai1 for connection with codec and codec is nau8810.

0 项奖励
回复

5,383 次查看
igorpadykov
NXP Employee
NXP Employee

> our case so to get proper clock and make codec work is MCLK_OUT0

>required to connect with MCLK pin of codec or that is not mandetory ?

 

suggest to ask tech support vendor of this codec, if nau8810 codec MCLK is mandatory:

https://www.nuvoton.com/support/technical-support/nuforum/

 

Best regards
igor

 

 

0 项奖励
回复

5,365 次查看
DhavalS
Contributor II

Thanks Igor for the reply.

Just give me one information that If we use SAI1_TXC pin for clock instead of MCLK_OUT0 pin then

Is there any software configuration required in machine driver or dts node?

 

Thanks & Regards,

Dhaval

0 项奖励
回复

5,361 次查看
igorpadykov
NXP Employee
NXP Employee

>use SAI1_TXC pin for clock instead of MCLK_OUT0 pin then

>Is there any software configuration required in machine driver or dts node?

 

sorry nxp did not use such configuration in its bsps.

 

Best regards
igor

0 项奖励
回复

5,581 次查看
igorpadykov
NXP Employee
NXP Employee

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 项奖励
回复

5,561 次查看
vinothkumars
Senior Contributor IV

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 项奖励
回复

5,533 次查看
vinothkumars
Senior Contributor IV

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 项奖励
回复

5,517 次查看
vinothkumars
Senior Contributor IV

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 项奖励
回复