AnsweredAssumed Answered

Problem with audio capture in the second SGTL5000 codec using I2S Master/Slave

Question asked by Caio Pereira on Oct 20, 2015
Latest reply on Oct 23, 2015 by Caio Pereira

Hello,

 

We're developing a base board for IMX6 Colibri System On Module  - Toradex, the application will use 2 audio codecs (SGTL5000), one codec is located on the System On Module and is connected to CCM_CLKO1 (IMX6 - Solo) the other codec is located on the base board and use a 12.288 MHz clock as reference. The second clock CCM_CLKO2 will be available for the ADV7180 and could not be used to the second audio codec.

In the begin, we have a problem to detect two audio codecs at the kernel startup, the fix to this problem was write a small work around in the sgtl5000.c driver to trick the LDO detection. (We will need to fix in a better way after solve the problem).

 

 

So for we have

 

SGTL 5000 System on Module - I2S - Slave (hw:1)

SGTL 5000 Base Board - I2S Master (hw:0) (We can use as I2S Slave?)

 

 

Linux Kernel: 3.10.17

 

SGTL 5000 Base Board Connection

             

SignalPinConflictsiMX6 FunctioniMX6 Note1iMX6 Note2iMX6 ALTiMX6 Pin SoCiMX6 Pin NoteiMX6 Compatibility
DIGITAL_AUDIO_2_I2S_MASTER_DIN159 AUD3_RXD ALT4CSI0_DATA07 Possible
DIGITAL_AUDIO_2_I2S_MASTER_DOUT155 AUD3_TXD ALT4CSI0_DATA05 Possible
DIGITAL_AUDIO_2_I2S_MASTER_LRCLK157 AUD3_TXFS ALT4CSI0_DATA06 Possible
DIGITAL_AUDIO_2_I2S_MASTER_SCLK153 AUD3_TXC ALT4CSI0_DATA04 Possible
I2C_1_SCL196 I2C3_SCL ALT2GPIO03 Standard
I2C_1_SDA194 I2C3_SDA ALT2GPIO06 Standard

 

 

 

Q1: With this configuration  I can play audio without problem but I can't capture audio from mic.

For this problem, the I2S Master it's the best option?

root@colibri-imx6:~# arecord temp1.wav -D hw:0 -f S16_LE -r 32000 -d 3 (

Recording WAVE 'temp1.wav' : Signed 16 bit Little Endian, Rate 32000 Hz, Mono

arecord: pcm_read:2031: read error: Input/output error

 

root@colibri-imx6:~# dmesg | tail

[   10.543575] libphy: 2188000.ethernet:00 - Link is Up - 100/Full

[   10.549523] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

[  426.024038] mxc_v4l_open: Mxc Camera no sensor ipu0/csi1

[  437.728972] mxc_v4l_open: Mxc Camera no sensor ipu0/csi1

[  461.730192] mxc_v4l_open: Mxc Camera no sensor ipu0/csi1

[  548.943287] ALSA sound/core/pcm_lib.c:1942 playback write error (DMA or IRQ trouble?)

[  609.233298] ALSA sound/core/pcm_lib.c:1942 capture write error (DMA or IRQ trouble?)

[  627.303295] ALSA sound/core/pcm_lib.c:1942 capture write error (DMA or IRQ trouble?)

[  647.763300] ALSA sound/core/pcm_lib.c:1942 capture write error (DMA or IRQ trouble?)

[  683.513295] ALSA sound/core/pcm_lib.c:1942 capture write error (DMA or IRQ trouble?)

root@colibri-imx6:~#

 

arecord: pcm_read:2031: read error: Input/output error

root@colibri-imx6:~# arecord -D hw:0 -f S16_LE temp.wav -d 2

Recording WAVE 'temp.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono

arecord: pcm_read:2031: read error: Input/output error

root@colibri-imx6:~# arecord -D hw:0 -f S16_LE temp.wav -d 2 -r 48000

Recording WAVE 'temp.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

arecord: pcm_read:2031: read error: Input/output error

 

 

Someone could help me to fix this?

 

What I doin'g wrong? Sometimes the definition of I2S Master/Slave confuse me (depend of the reference), so some could check if the SGTL5000 connection to the IMX6 and the device tree configuration are right?

 

 

Thank you!

 

Device Tree  Modifications

 

 

&ssi1 {

    fsl,mode = "i2s-slave";

    status = "okay";

};

 

&ssi2 {

        fsl,mode = "i2s-master";

        fsl,ssi-asynchronous;

        status = "okay";

};

 

sound1 {

        compatible = "fsl,imx6-colibri-sgtl5000",

                 "fsl,imx-audio-sgtl5000";

        model = "imx6-colibri-sgtl5000";

        ssi-controller = <&ssi2>;

        audio-codec = <&codec2>; /* SGTL 5000 on base board*/

        audio-routing =

            "MIC_IN", "Mic Jack",   

            "Mic Jack", "Mic Bias",

            "Headphone Jack", "HP_OUT";

        mux-int-port = <2>;

        mux-ext-port = <3>;            

    

    };

   

    sound2 {

        compatible = "fsl,imx6-colibri-sgtl5000",

                 "fsl,imx-audio-sgtl5000";

        model = "imx6-colibri-sgtl5000";

        ssi-controller = <&ssi1>;

        audio-codec = <&codec1>;

        audio-routing =

            "MIC_IN", "Mic Jack",

            "Mic Jack", "Mic Bias",

            "Headphone Jack", "HP_OUT";

        mux-int-port = <1>;

        mux-ext-port = <5>;   

    };

 

&audmux {

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_audmux_t2 &pinctrl_audmux_t1 &pinctrl_audmux_mclk_2 &pinctrl_mic_gnd

              >;

    status = "okay";

};

 

&i2c1 {

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_i2c1_1>;

    status = "okay";

   

    audioclk: ext12Mhz {

        compatible = "fixed-clock";

        #clock-cells = <0>;

        clock-frequency = <12288000>;

    };

   

    codec2: sgtl5000@0a {

        compatible = "fsl,sgtl5000";

        reg = <0x0a>;       

        clocks = <&audioclk 0>;       

        VDDA-supply = <&reg_2p5v>;

        VDDIO-supply = <&reg_3p3v>;

    };

};

 

i2c2 {

    clock-frequency = <100000>;

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_i2c2_1>;

    status = "okay";

 

    codec1: sgtl5000@0a {

        compatible = "fsl,sgtl5000";

        reg = <0x0a>;

        clocks = <&clks 201>;

        VDDA-supply = <&reg_2p5v>;

        VDDIO-supply = <&reg_3p3v>;

    };

};

 

audmux {

 

        pinctrl_audmux_t1: audmux-t1 {

            fsl,pins = <

                MX6QDL_PAD_KEY_COL0__AUD5_TXC  0x130b0

                MX6QDL_PAD_KEY_ROW0__AUD5_TXD  0x130b0

                MX6QDL_PAD_KEY_COL1__AUD5_TXFS 0x130b0

                MX6QDL_PAD_KEY_ROW1__AUD5_RXD  0x130b0

            >;

        };                 

       

   

        pinctrl_audmux_t2: audmux-t2 {

            fsl,pins = <

                MX6QDL_PAD_CSI0_DAT7__AUD3_RXD  0x130b0

                MX6QDL_PAD_CSI0_DAT5__AUD3_TXD  0x130b0

                MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0

                MX6QDL_PAD_CSI0_DAT4__AUD3_TXC  0x130b0

            >;

        };

};

 

 

Thank you very much.

 

Best Regards,

 

Caio Pereira

Original Attachment has been moved to: imx6dl-colibri-eval-v7.dts.zip

Original Attachment has been moved to: imx6qdl-colibri-v7.dtsi.zip

Outcomes