wm8962 with iMX6d on a custom board

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

wm8962 with iMX6d on a custom board

Jump to solution
4,462 Views
haggaytavyumi
Contributor III

Hello all

I use the iMX6d and the WM8962 in my custom board he is just like the sabreSD schematics with one change I use the AUD5 SSI pins instead of the AUD3 pins.

The BSP version I use is 3.14.52 YOCTO.

I have reconfigured the the DTS in the pin muxing:

/*wm8962-audio*/

        pinctrl_audmux: audmux_grp {

            fsl,pins = <

                MX6QDL_PAD_DISP0_DAT19__AUD5_RXD    0x130b0

                MX6QDL_PAD_DISP0_DAT16__AUD5_TXC    0x130b0

                MX6QDL_PAD_DISP0_DAT17__AUD5_TXD    0x130b0

                MX6QDL_PAD_DISP0_DAT18__AUD5_TXFS    0x130b0               

            >;

        };

sound {

        compatible = "fsl,imx6q-sabresd-wm8962",

               "fsl,imx-audio-wm8962";

        model = "wm8962-audio";

        cpu-dai = <&ssi1>;

        audio-codec = <&codec>;

        asrc-controller = <&asrc>;

        amic-mono;

        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 = <1>;

        mux-ext-port = <5>;

        hp-det-gpios = <&gpio7 13 1>;

        mic-det-gpios = <&gpio7 13 1>;

    };

&i2c3 {

    clock-frequency = <100000>;

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_i2c3>;

    status = "okay";

    codec: wm8962@1a {

        compatible = "wlf,wm8962";

        reg = <0x1a>;

        clocks = <&clks 201>;

        DCVDD-supply = <&reg_audio>;

        DBVDD-supply = <&reg_audio>;

        AVDD-supply = <&reg_audio>;

        CPVDD-supply = <&reg_audio>;

        MICVDD-supply = <&reg_audio>;

        PLLVDD-supply = <&reg_audio>;

        SPKVDD1-supply = <&reg_audio>;

        SPKVDD2-supply = <&reg_audio>;

        gpio-cfg = <

            0x0000 /* 0:Default */

            0x0000 /* 1:Default */

            0x0013 /* 2:FN_DMICCLK */

            0x0000 /* 3:Default */

            0x8014 /* 4:FN_DMICCDAT */

            0x0000 /* 5:Default */

        >;

       };

};

&audmux {

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_audmux>;

    status = "okay";

};

The driver is loads fine:

ALSA device list:

   #0: wm8962-audio

   #1: imx-hdmi-soc

with one error:

wm8962 2-001a: DC servo timed out

now the problem is that I can't play sound. I have tested it with the command:

cat /dev/urandom | aplay -D hw:0,0 -f S24_LE

sound is not consistent it start and stops.

while I am trying to play sound with Gstreamer  :

gst-launch-1.0 audiotestsrc wave=0 ! alsasink device=hw:0,0 slave-method=0

I get nothing.any ideas?

the HDMI sound doesn't work as well with a different error :

imx-hdmi-audio imx-hdmi-audio: HDMI Video is not ready!

imx-hdmi-audio imx-hdmi-audio: ASoC: can't open platform imx-hdmi-audio: -22

Tags (1)
0 Kudos
1 Solution
2,878 Views
haggaytavyumi
Contributor III

OK

I have managed  to fix the problem.

The reason for all this mess was the regulator which I have configured  to "regulator-always-on".

    reg_audio: regulator@2 {
            compatible = "regulator-fixed";
            reg = <2>;
            regulator-name = "wm8962-supply";
            gpio = <&gpio1 30 0>;
            enable-active-high;
            /*regulator-always-on;*/
        };

Another  change was the mono speaker configuration in the driver.

The mono function is not  working.

The reason was wrong parameter in WM8962_CLASS_D_CONTROL_1 register.

I have changed the line 2193 in file wm8962.c to :

 

@@ -2188,7 +2190,7 @@ SND_SOC_DAPM_MIXER("Speaker Mixer", WM8962_MIXER_ENABLES, 1, 0,

                   spkmixl, ARRAY_SIZE(spkmixl)),

SND_SOC_DAPM_MUX_E("Speaker PGA", WM8962_PWR_MGMT_2, 4, 0, &spkoutl_mux,

                   out_pga_event, SND_SOC_DAPM_POST_PMU),

-SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 7, 0, NULL, 0),

+SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 6, 0, NULL, 0),

SND_SOC_DAPM_OUTPUT("SPKOUT"),

};

now it is working.

I have made some more changes to my sound node in the DTS.

    sound {
        compatible = "fsl,imx6q-sabresd-wm8962",
               "fsl,imx-audio-wm8962";
        model = "wm8962-audio";
        cpu-dai = <&ssi2>;
        audio-codec = <&codec>;
        asrc-controller = <&asrc>;
        audio-routing =
            "Headphone Jack", "HPOUTL",
            "Headphone Jack", "HPOUTR",
            "Ext Spk", "SPKOUT",
            "Mic Jack","AMIC",
            "Mic Bias","IN1R",
            "MICBIAS", "AMIC",
            "IN3R", "MICBIAS",
            "IN2L", "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 = <5>;
        hp-det-gpios = <&gpio7 13 GPIO_ACTIVE_HIGH>;
        mic-det-gpios = <&gpio7 13 GPIO_ACTIVE_HIGH>;    
    };

Now the problem is that I have two microphones plugged in and only the right mic is working.

Does some one know how to configure the two mics to work simultaneously.

I don't care if it mixed to mono.

Thanks

View solution in original post

0 Kudos
3 Replies
2,879 Views
haggaytavyumi
Contributor III

OK

I have managed  to fix the problem.

The reason for all this mess was the regulator which I have configured  to "regulator-always-on".

    reg_audio: regulator@2 {
            compatible = "regulator-fixed";
            reg = <2>;
            regulator-name = "wm8962-supply";
            gpio = <&gpio1 30 0>;
            enable-active-high;
            /*regulator-always-on;*/
        };

Another  change was the mono speaker configuration in the driver.

The mono function is not  working.

The reason was wrong parameter in WM8962_CLASS_D_CONTROL_1 register.

I have changed the line 2193 in file wm8962.c to :

 

@@ -2188,7 +2190,7 @@ SND_SOC_DAPM_MIXER("Speaker Mixer", WM8962_MIXER_ENABLES, 1, 0,

                   spkmixl, ARRAY_SIZE(spkmixl)),

SND_SOC_DAPM_MUX_E("Speaker PGA", WM8962_PWR_MGMT_2, 4, 0, &spkoutl_mux,

                   out_pga_event, SND_SOC_DAPM_POST_PMU),

-SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 7, 0, NULL, 0),

+SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 6, 0, NULL, 0),

SND_SOC_DAPM_OUTPUT("SPKOUT"),

};

now it is working.

I have made some more changes to my sound node in the DTS.

    sound {
        compatible = "fsl,imx6q-sabresd-wm8962",
               "fsl,imx-audio-wm8962";
        model = "wm8962-audio";
        cpu-dai = <&ssi2>;
        audio-codec = <&codec>;
        asrc-controller = <&asrc>;
        audio-routing =
            "Headphone Jack", "HPOUTL",
            "Headphone Jack", "HPOUTR",
            "Ext Spk", "SPKOUT",
            "Mic Jack","AMIC",
            "Mic Bias","IN1R",
            "MICBIAS", "AMIC",
            "IN3R", "MICBIAS",
            "IN2L", "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 = <5>;
        hp-det-gpios = <&gpio7 13 GPIO_ACTIVE_HIGH>;
        mic-det-gpios = <&gpio7 13 GPIO_ACTIVE_HIGH>;    
    };

Now the problem is that I have two microphones plugged in and only the right mic is working.

Does some one know how to configure the two mics to work simultaneously.

I don't care if it mixed to mono.

Thanks

0 Kudos
2,879 Views
igorpadykov
NXP Employee
NXP Employee

Hi haggay

error wm8962 2-001a: DC servo timed out

may mean hardware problems with codec power-up, recommended to

check audio codec clocks and voltages with oscilloscope.

Also one can try solution provided

i.mx6Q audio codec wm8962 sometimes failed to play

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
2,879 Views
haggaytavyumi
Contributor III

Hi igor

Thank you for your replay.

I have checked the clock that the iMX is delivering to the WM8962 and it look like the clock is only active when the linux plays sound.

while the codec should get the clock all the time. do you have any idea why and how to solve it?

p.s

The solution you mentioned is not very helpful because it is a solution for very old BSP.

0 Kudos