This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PCM5242: Need support to bring-up PCM5242codec with IMX8MM with Android 11 code

Part Number: PCM5242
Other Parts Discussed in Thread: PCM5142

Hi Team,

We are working on PCM5242 Audio DAC with NXP processor in ANdorid11 code base.

I have integrated all the changes in DTSI and driver file.

After changes, DAC has been registered successfully. 

I checked the all clocks like WCLK MCLK BCLK and DIN pin , We are getting all the clocks properly while playing audio file. But NO sound.

Error we are facing:

E audio_hw_primary: start_output_stream: Invalid PCM card id: -1
I audio_hw_primary: start_output_stream: primary: 1, out: 0xee944630, device: 131072, address: , mode: 0, flags 0x2
I audio_hw_primary: select_output_device(), headphone 0 ,headset 0 ,speaker 2
D audio_hw_primary: start_output_stream: pcm_open: card: -1, pcm_device_id: 0, rate: 48000, channel: 2, format: 0, period_size: 0xc0, flag: 9

 

Looks like no card present:

I2C dump:

1. When audio not playing:

2. When trying to play audio file

DTSI changes:

sound-pcm512x {
compatible = "simple-audio-card";
simple-audio-card,name = "pcm512x-audio";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&dailink0_master4>;
simple-audio-card,frame-master = <&dailink0_master4>;

simple-audio-card,widgets =
"Line", "Left Line Out Jack",
"Line", "Right Line Out Jack";
simple-audio-card,routing =
"Left Line Out Jack", "OUTL",
"Right Line Out Jack", "OUTR";
dailink0_master4: simple-audio-card,cpu {
sound-dai = <&sai5>;
};
simple-audio-card,codec {
sound-dai = <&pcm5242>;
clocks = <&clk IMX8MM_CLK_SAI5_ROOT>;
};
};

pcm5242: pcm5242@4c {
compatible = "ti,pcm5242";
#sound-dai-cells = <0>;
reg = <0x4c>;
AVDD-supply = <&reg_3v3_vext>;
DVDD-supply = <&reg_3v3_vext>;
CPVDD-supply = <&reg_3v3_vext>;
clocks = <&ext_osc_22m>, <&ext_osc_24m>;
clock-names = "sclk0", "sclk1";
};

&sai5 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai5>;
assigned-clocks = <&clk IMX8MM_CLK_SAI5>;
assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
assigned-clock-rates = <24576000>;
status = "okay";
};

pinctrl_sai5: sai5grp {
fsl,pins = <
MX8MM_IOMUXC_SAI5_MCLK_SAI5_MCLK 0xd6 /*MCLK*/
MX8MM_IOMUXC_SAI5_RXD2_SAI5_TX_BCLK 0xd6 /*BCLK*/
MX8MM_IOMUXC_SAI5_RXD3_SAI5_TX_DATA0 0xd6 /*DIN*/
MX8MM_IOMUXC_SAI5_RXD1_SAI5_TX_SYNC 0xd6 /*WCLK*/
>;
};

NOTE: WE dont have proper driver. We are using driver of different family which is pcm5142.

sound/soc/codecs/pcm512x-i2c.c

sound/soc/codecs/pcm512x.c

Need your urgent support

Thanks

Divyesh

  • Please find below logs:

    01-01 00:00:00.234 0 0 E imx-pcm512x sound-pcm512x: failed to find codec device
    01-01 00:00:01.148 0 0 E pcm512x 3-004c: divyesh enter into CONFIG_OF func :pcm512x_probe
    01-01 00:00:01.155 0 0 E pcm512x 3-004c: divyesh enter into CONFIG_OF and dev->of_node func :pcm512x_probe

  • Hi Team,

    PLease find below update:

    above issue is solved.

    Need your help to bring-up one Audio DAC PCM5242.

    We are using PCM5242 DAC with IMX8MM NXP processor.

     

    So far I have added dtsi and driver changes. But not getting any sound from speaker.

     

    Changes:

            sound-pcm5242 {

                   compatible = "simple-audio-card";

                   simple-audio-card,name = "pcm5242_50w";

                   simple-audio-card,format = "i2s";

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

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

     

                   simple-audio-card,widgets =

                            "Line", "Left Line Out Jack",

                            "Line", "Right Line Out Jack";

                   simple-audio-card,routing =

                            "Left Line Out Jack", "OUTL",

                            "Right Line Out Jack", "OUTR";

                   dailink0_master4: simple-audio-card,cpu {

                           sound-dai = <&sai5>;

                   };

                   simple-audio-card,codec {

                           sound-dai = <&pcm5242>;

                           clocks = <&clk IMX8MM_CLK_SAI5_ROOT>;

                   };

           };

     

            pcm5242: pcm5242@4c {

                    compatible = "ti,pcm5242";

                    #sound-dai-cells = <0>;

                    reg = <0x4c>;

                    AVDD-supply = <&reg_3p3v>;

                    DVDD-supply = <&reg_3p3v>;

                    CPVDD-supply = <&reg_3p3v>;

                    clocks = <&ext_osc_22m>, <&ext_osc_24m>;

                    clock-names = "sclk0", "sclk1";

            };

     

    I2C dump:

    1. When audio is not playing:

    1. When Audio is playing:

     

    Sound controls:

     

    OUTPUT:

    All the I2S clocks are proper as expected , DIN data also present.

    But no audio output from speaker.

     

    Thanks

    Divyesh

  • Divyesh,

    I will take a look at this post tomorrow as I am wrapping up some other task in the queue.

    Regards,

    Arash

  • Hi ,

    Thanks for the reply.

    I need close this by Thursday. It would be helpful if you ask someone to look into this.

    Sorry for the inconvenience. But its urgent. On Friday I have release the build with customer.

    Thanks

  • I think I  will be able to close it by Thursday , if not i will ask  another engineer to look at this post .

    Regards,

    Arash

  • Thanks.. Looking forward to your response

  • Hi @Arash Loloee,

    Just for the info, We are using below driver for PCM5242:

    modified: arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
    modified: arch/arm64/configs/imx_v8_android_defconfig
    modified: sound/soc/codecs/pcm512x-i2c.c
    modified: sound/soc/codecs/pcm512x.c

    Thanks

    Divyesh

  • Hi Divyesh,  here is all the drivers that we can offer:

    e2e.ti.com/.../faq-linux-drivers-device-drivers-for-aic31xx-dac31xx-aic325x-aic320x-aic326x-aic321x

    Could you verify  the register dump when you are playing audio and have no Audio output . The part is not in standby or mute by any chance?

    Regards,

    Arash

  • Hi Arash

    If you check my earlier comment, I have shared i2cdump when playing audio and without audio. Could you please have a look once.

    Regarding driver, Im using driver from similar family PCM5142.  Both the ic's are having same register map.

    Thanks

    Divyesh

  • Hi Divyesh,  in the register dump,  when Audio is not playing , we see register 3 has  11 which is MUTE left & Right channels. Also Register 2 is 11 which is powerdown/standby.  That is why I asked to check and make sure registers read is correct. Based on your register dump, you are muting and powering down the device and thus there will be no audio playing.

    Regards,

    Arash

  • Hi Arash,

    When the audio is not playing, which means device will be in standby and mute only.. it seems correct..

    Have you checked register dump when audio is playing? 

    I can see logs from mute and unmute function properly when I try to play something. But not sure it is reflecting properly or not in register map.

    Thanks

    Divyesn

  • Hi Divyesh,

    May be we are talking about 2 different things. When you say "Audio is not playing"  we read it as "you want to play audio but it is not playing". In this condition  we read its register dump and we see it is muted ( and DAC is in power down too) . I guess you mean the issue is in the other register dump.

    I can run a simple test with our EVM and then get the register dump to you so you can compare it with yours and see what is written in your registers that makes it not working. 

    Let me know if this is something that you want.

    Regards,

    Arash

  • Hi Arash,

    Yes.

    Audio is not playing means ideal case when device boot up.(didn't try to play audio)

    Audio is playing means when we try to play audio using tinyplay or media player.

    Please share the working register dump

    I need your quick response today. I need to close it by today. 

    Thanks

    Divyesh

  • Hello Divyesh, Here is the register dump for PCM5242 on our EVM I hope this can help you.

    # -----------------------------
    # PCM5242

    w 98 00 00
    w 98 03 11
    w 98 00 00
    w 98 2a 00
    w 98 00 00
    w 98 02 10
    w 98 00 00
    w 98 00 00
    w 98 03 11
    w 98 00 00
    w 98 2a 00
    w 98 00 00
    w 98 02 10
    w 98 00 00
    w 98 01 11
    w 98 00 00
    w 98 03 11
    w 98 00 00
    w 98 2a 00
    w 98 00 00
    w 98 02 10
    w 98 00 00
    w 98 3d 44
    w 98 00 00
    w 98 3e 44
    w 98 00 01
    w 98 03 04
    w 98 00 00
    w 98 03 11
    w 98 02 10
    w 98 2b 01
    w 98 02 00
    w 98 03 00
    w 98 07 01
    w 98 08 20
    w 98 55 07
    w 98 00 00
    w 98 03 11
    w 98 00 00
    w 98 02 00
    w 98 00 00
    w 98 2a 11
    w 98 00 01
    w 98 02 11
    w 98 00 01
    w 98 06 00
    w 98 07 00
    w 98 07 00
    w 98 00 00
    w 98 3b 00
    w 98 3b 00
    w 98 00 01
    w 98 02 10
    w 98 02 00
    w 98 00 00
    w 98 29 00
    w 98 07 01
    w 98 28 02
    w 98 28 02
    w 98 2a 11
    w 98 00 01
    w 98 08 00
    w 98 00 00
    w 98 25 00
    w 98 07 00
    w 98 00 01
    w 98 05 00
    w 98 00 00
    w 98 2c 00
    w 98 25 00
    w 98 25 00
    w 98 25 00
    w 98 25 00
    w 98 25 00
    w 98 25 00
    w 98 3c 00
    w 98 03 11
    w 98 3e 30
    w 98 3f 22
    w 98 3f 22
    w 98 40 02
    w 98 40 02
    w 98 41 07
    w 98 41 07
    w 98 41 07
    w 98 3f 22
    w 98 3f 22
    w 98 3d 30
    w 98 03 00
    w 98 03 00

    Regards,

    Arash