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>;
+ };
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
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.
>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
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.
> 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
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
>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
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
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
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.
So, There is no separate MCLK and BCLK.
Hi @igorpadykov ,
Audio codec is working, But, I got noise instead of proper sound, Will you please check the device tree and schematic.