IMX6 with Android 5.1 WM8958 ssi issue

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

IMX6 with Android 5.1 WM8958 ssi issue

Jump to solution
4,245 Views
cristiansicilia
Contributor III

Dear *,

I have an IMX6 connected via AUD3 to interface 1 of WM8958, with MCLK on CLK2 and have the following configuration in device tree.

I would like to configure codec as SLAVE and SSI2 as master (and viceversa to test some other parts).

&i2c1 {

        clock-frequency = <100000>;

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_i2c1>;

        status = "okay";

        codec: wm8958@1a {

                compatible = "wlf,wm8958";

                reg = <0x1a>;

                clocks = <&clks 201>;

                clock-names = "mclk1";

                DBVDD1-supply = <&vgen3_reg>;

                DBVDD2-supply = <&vgen3_reg>;

                DBVDD3-supply = <&vgen3_reg>;

                DCVDD-supply;

                AVDD1-supply;

                AVDD2-supply = <&vgen3_reg>;

                CPVDD-supply = <&vgen3_reg>;

                SPKVDD1-supply = <&reg_audio>;

                SPKVDD2-supply = <&reg_audio>;

                wlf,ldo1ena = <&gpio3 13 0>;

                wlf,ldo2ena = <&gpio3 14 0>;

        };

....

}

....

        sound {

        compatible = "fsl,imx6ul-ddr3-arm2-wm8958",

                   "fsl,imx-audio-wm8958";

                model = "wm8958-audio";

                cpu-dai = <&ssi2>;

                audio-codec = <&codec>;

                asrc-controller = <&asrc>;

                audio-routing =

                        "Headphone Jack", "HPOUTL",

                        "Headphone Jack", "HPOUTR",

                        "Ext Spk", "SPKOUTL",

                        "Ext Spk", "SPKOUTR",

                        "MICBIAS", "AMIC",

                        "IN3R", "MICBIAS",

                        "DMIC", "MICBIAS",

                        "DMICDAT", "DMIC",

                        "CPU-Playback", "ASRC-Playback",

                        "Playback", "CPU-Playback",

                        "ASRC-Capture", "CPU-Capture",

                        "CPU-Capture", "Capture";

                mux-int-port = <2>;

                mux-ext-port = <3>;

                //hp-det-gpios = <&gpio7 8 1>;

                //mic-det-gpios = <&gpio1 9 1>;

                //codec-master;

        };

..

&ssi2 {

        fsl,mode = "i2s-master";

        status = "okay";

};

...

&audmux {

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_audmux>;

        status = "okay";

};

                pinctrl_audmux: audmuxgrp {

                        fsl,pins = <

                                MX6QDL_PAD_CSI0_DAT7__AUD3_RXD          0x130b0

                                MX6QDL_PAD_CSI0_DAT4__AUD3_TXC          0x130b0

                                MX6QDL_PAD_CSI0_DAT5__AUD3_TXD          0x110b0

                                MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS         0x130b0

                                MX6QDL_PAD_EIM_DA12__GPIO3_IO12         0x80000000

                                MX6QDL_PAD_GPIO_3__CCM_CLKO2            0x0001B0B0

                        >;

                };

Now if I will try to play a sound (with tinyplay for wav or with stagefright for mp3), no BCLK/FS/DACDAT will be activate.

If I configure codec as master (uncommenting codec-master in sound) and i2s-master to i2s-slave in &ssi2, I will see BCLK,FS continuously but playing an audio file nothing happens on DACDAT (every time pulled-up).

Someone can help me, I'm not expert in device-tree, probably I forgot to configure some parts.

I try also codec-master with i2s-slave and i2s-master and without codec-master with i2s-slave and i2s-master, but not work.

Thank's

Labels (3)
0 Kudos
Reply
1 Solution
2,692 Views
cristiansicilia
Contributor III

I found the problem, is report it:

The problem is the audmux configuration, is possible to configure it in the device-tree or fix the driver in  sound/soc/fsl/imx-wm8958.c where there are no configuration for audmux, I simply add

#include "imx-audmux.h"

and in imx_wm8958_probe after audio-codec

int int_port, ext_port;

...

      

       if (!strstr(cpu_np->name, "ssi"))

               goto audmux_bypass;

       ret = of_property_read_u32(np, "mux-int-port", &int_port);

       if (ret) {

               dev_err(&pdev->dev, "mux-int-port missing or invalid\n");

               return ret;

       }

       ret = of_property_read_u32(np, "mux-ext-port", &ext_port);

       if (ret) {

               dev_err(&pdev->dev, "mux-ext-port missing or invalid\n");

               return ret;

       }

       /*

        * The port numbering in the hardware manual starts at 1, while

        * the audmux API expects it starts at 0.

        */

       int_port--;

       ext_port--;

       ret = imx_audmux_v2_configure_port(int_port,

                       IMX_AUDMUX_V2_PTCR_SYN |

                       IMX_AUDMUX_V2_PTCR_TFSEL(ext_port) |

                       IMX_AUDMUX_V2_PTCR_TCSEL(ext_port) |

                       IMX_AUDMUX_V2_PTCR_TFSDIR |

                       IMX_AUDMUX_V2_PTCR_TCLKDIR,

                       IMX_AUDMUX_V2_PDCR_RXDSEL(ext_port));

       if (ret) {

               dev_err(&pdev->dev, "audmux internal port setup failed\n");

               return ret;

       }

       imx_audmux_v2_configure_port(ext_port,

                       IMX_AUDMUX_V2_PTCR_SYN,

                       IMX_AUDMUX_V2_PDCR_RXDSEL(int_port));

       if (ret) {

               dev_err(&pdev->dev, "audmux external port setup failed\n");

               return ret;

       }

audmux_bypass:

...

Thank's    

View solution in original post

0 Kudos
Reply
7 Replies
2,692 Views
aravinthkumarja
Senior Contributor II

Hi Cristian Sicilia,

I working same chip on Android6.0 . In this Mic is not working, headphone output is very low.

Can you give suggestion on this.

Regards,

Aravinth

0 Kudos
Reply
2,692 Views
cristiansicilia
Contributor III

Try with tynimix from command line, the BOOST tipically resolve the problem with speaker outout volume.

Recording could be a problem in selection the ritght path of codec (probably you hear from IN1 of codec and mic is on IN2 for example), you will resolve this with tinymix at runtime from command line (then you can change default setting).

Regards

0 Kudos
Reply
2,692 Views
aravinthkumarja
Senior Contributor II

Thanks for your response. Did you checked with Heaset or only external speaker and mic.?

Regards,

Aravinth 

0 Kudos
Reply
2,692 Views
cristiansicilia
Contributor III

In my schematic, the headset was on LEFT and the Speaker was on RIGHT ouput. 

Now with tinymix you can set to OFF LEFT and ON RIGHT (and viceversa), then you can control in this way the Headset and Speacker (in the same way with the input).

So you can manage the output (and input) in the same way if it is a speaker, headset, generic aux, etc.

0 Kudos
Reply
2,692 Views
jimmychan
NXP TechSupport
NXP TechSupport

For Android 5.1, the linux kernel is L3.14.52. I attach the L3.14.52 Linux BSP porting guide for your reference. Please read the Chapter 8 about the Audio codec porting.

0 Kudos
Reply
2,692 Views
cristiansicilia
Contributor III

Thank you for support,

I have check the configuration, but I don't see the problem.

I see different thing, like

ssi2: ssi@0202c000

but it seems already declared in imported dts, so I suppose that is not required, in any case from debug runtime data I found the ssi on 202c000 (SSI2).

The strange thing is that when I play a sound (in codec-master mode) the SSI don't generate DACDAT data, but remain pulled HIGH, like when it is configured to another out port.

This is the output from audmux, the strange thing (from my point of view) are:

1. in "<---ssi1" that should be the ssi2 in device tree, is connected with SSI5 (I expected SSI3 !?)

2. in "<--- ssi3" I don't see connection, I will expect that it is connected with ssi1

Probably I lost some step, but seems that the problem is in the audmux configuration.

# cat /sys/kernel/debug/audmux/ssi*                         

PDCR: 0000a000                                 <--- ssi0

PTCR: ad400800

TxFS output from SSI6, TxClk output from SSI6

Port is symmetric

Data received from SSI6

PDCR: 00008000                                 <--- ssi1

PTCR: a5000800

TxFS output from SSI5, TxClk output from SSI5

Port is symmetric

Data received from SSI5

PDCR: 00006000                                 <--- ssi2

PTCR: 9cc00800

TxFS output from SSI4, TxClk output from SSI4

Port is symmetric

Data received from SSI4

PDCR: 00004000                                 <--- ssi3

PTCR: 00000800

TxFS input, TxClk input

Port is symmetric

Data received from SSI3

PDCR: 00002000                                 <--- ssi4

PTCR: 00000800

TxFS input, TxClk input

Port is symmetric

Data received from imx-ssi.1

PDCR: 00000000                                 <--- ssi5

PTCR: 00000800

TxFS input, TxClk input

Port is symmetric

Data received from imx-ssi.0

PDCR: 0000c000                                 <--- ssi6

PTCR: 00000800

TxFS input, TxClk input

Port is symmetric

Data received from UNKNOWN

0 Kudos
Reply
2,693 Views
cristiansicilia
Contributor III

I found the problem, is report it:

The problem is the audmux configuration, is possible to configure it in the device-tree or fix the driver in  sound/soc/fsl/imx-wm8958.c where there are no configuration for audmux, I simply add

#include "imx-audmux.h"

and in imx_wm8958_probe after audio-codec

int int_port, ext_port;

...

      

       if (!strstr(cpu_np->name, "ssi"))

               goto audmux_bypass;

       ret = of_property_read_u32(np, "mux-int-port", &int_port);

       if (ret) {

               dev_err(&pdev->dev, "mux-int-port missing or invalid\n");

               return ret;

       }

       ret = of_property_read_u32(np, "mux-ext-port", &ext_port);

       if (ret) {

               dev_err(&pdev->dev, "mux-ext-port missing or invalid\n");

               return ret;

       }

       /*

        * The port numbering in the hardware manual starts at 1, while

        * the audmux API expects it starts at 0.

        */

       int_port--;

       ext_port--;

       ret = imx_audmux_v2_configure_port(int_port,

                       IMX_AUDMUX_V2_PTCR_SYN |

                       IMX_AUDMUX_V2_PTCR_TFSEL(ext_port) |

                       IMX_AUDMUX_V2_PTCR_TCSEL(ext_port) |

                       IMX_AUDMUX_V2_PTCR_TFSDIR |

                       IMX_AUDMUX_V2_PTCR_TCLKDIR,

                       IMX_AUDMUX_V2_PDCR_RXDSEL(ext_port));

       if (ret) {

               dev_err(&pdev->dev, "audmux internal port setup failed\n");

               return ret;

       }

       imx_audmux_v2_configure_port(ext_port,

                       IMX_AUDMUX_V2_PTCR_SYN,

                       IMX_AUDMUX_V2_PDCR_RXDSEL(int_port));

       if (ret) {

               dev_err(&pdev->dev, "audmux external port setup failed\n");

               return ret;

       }

audmux_bypass:

...

Thank's    

0 Kudos
Reply