You are here: Digi Embedded Yocto > System development > Linux v3.14 Board Support Package > Devices and interfaces > Audio > SGTL5000 audio

SGTL5000 audio

The ConnectCore 6 SBC assembles one NXP SGTL5000 low-power stereo codec with the following features:

The codec is a slave chip, which the CPU controls via the I2C3 port of the ConnectCore 6 system-on-chip. The CPU drives audio data through the i.MX6 Synchronous Serial Interface (SSI) port 2 using the inter-IC sound bus standard (I2S).

The Digital Audio Mux (AUDMUX) i.MX6 system-on-chip interface is a subsystem of the CPU that routes audio data from the codec into the different ports of the CPU.

Kernel configuration

You can manage the SGTL5000 audio driver support through the following kernel configuration options:

These options are enabled as built-in on the default ConnectCore 6 SBC kernel configuration file.

Platform driver mapping

The ALSA SoC drivers for the i.MX6 are located at:

File Description
sound/soc/fsl/imx-sgtl5000.c Machine layer for the ALSA SoC layer
sound/soc/fsl/imx-pcm-dma.c Platform layer for the ALSA SoC layer
sound/soc/fsl/imx-pcm.h Header file for the PCM driver
sound/soc/fsl/fsl_ssi.c SSI CPU Digital-Analog Interface (DAI) driver for the ALSA SoC layer
sound/soc/fsl/fsl_ssi.h Header file for the SSI CPU DAI driver
sound/soc/codecs/sgtl5000.c ALSA SoC codec
sound/soc/codecs/sgtl5000.h ALSA SoC codec header file

Device tree bindings and customization

The ALSA SoC system bindings are documented at:

File Description
Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt Machine layer binding
Documentation/devicetree/bindings/sound/imx-audmux.txt Digital Audio Mux (AUDMUX) device bindings
Documentation/devicetree/bindings/sound/fsl-sai.txt Synchronous Audio Interface (SAI) bindings
Documentation/devicetree/bindings/sound/fsl,ssi.txt Synchronous Serial Interface (SSI) device bindings
Documentation/devicetree/bindings/sound/sgtl5000.txt SGTL5000 Stereo Codec bindings

The SGTL5000 audio interface is defined in the i.MX6 CPU and ConnectCore 6 SBC device tree files.

Definition of the SGTL5000 interface

ConnectCore 6 SBC device tree
sound {                                                                   
    compatible = "fsl,imx-audio-sgtl5000";                            
    model = "sgtl5000-audio";                                         
    cpu-dai = <&ssi2>;                                                
    audio-codec = <&sgtl5000>;                                        
    audio-routing =                                                   
        "MIC_IN", "Mic Jack",                                     
        "Mic Jack", "Mic Bias",                                   
        "Headphone Jack", "HP_OUT";                               
    mux-int-port = <2>;                                               
    mux-ext-port = <3>;                                               
    hp-det-gpios = <&gpio2 0 0>;                                      
    hp-det-debounce = <250>;                                          
}; 

SGTL5000 codec connected to I2C3 port

ConnectCore 6 SBC device tree
&i2c3 {
         sgtl5000: codec@0a {                                                   
                compatible = "fsl,sgtl5000";                                   
                reg = <0x0a>;                                                  
                clock-frequency = <24000000>;                                  
                clocks = <&clks 201>;                                          
                VDDA-supply = <&codec_power>;                                  
                VDDIO-supply = <&codec_power>;                                 
        };
};

Definition of SSI port 2

Common i.MX6 device tree
ssi2: ssi@0202c000 {                               
    compatible = "fsl,imx6q-ssi","fsl,imx21-ssi";
    reg = <0x0202c000 0x4000>;                 
    interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&clks IMX6QDL_CLK_SSI2_IPG>, 
        <&clks IMX6QDL_CLK_SSI2>;         
    clock-names = "ipg", "baud";               
    dmas = <&sdma 41 1 0>,                     
        <&sdma 42 1 0>;                     
    dma-names = "rx", "tx";                    
    fsl,fifo-depth = <15>;                     
    fsl,ssi-dma-events = <42 41>;              
    status = "disabled";                       
};

Enabling SSI port 2

ConnectCore 6 SBC device tree
&ssi2 {                                                                        
    fsl,mode = "i2s-slave";                                                
    status = "okay";                                                       
};

IOMUX configuration

Digital Audio Mux (AUDMUX) IOMUX configuration:

ConnectCore 6 SBC device tree
audmux {                                                                  
    pinctrl_audmux: audmux {                                          
        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           
        >;                                                        
    };                                                                
};

Power enable GPIO:

aud_pwr_en {                                                           
    pinctrl_aud_pwr_en: aud_pwr_en {                               
        fsl,pins = <                                           
            MX6QDL_PAD_EIM_OE__GPIO2_IO25 0x80000000       
        >;                                                     
    };                                                             
};

Known issues

Headphone jack on SBCV1

On version 1 of the ConnectCore 6 SBC carrier board, quick plug/unplug of the headphone jack may induce a glitch inside the codec that can cause it to malfunction. Reset the board to restore the codec to normal functioning. Hardware in newer versions of the SBC board resolves this issue.

 

© 2017 Digi International Inc. All rights reserved.
SGTL5000 audio updated on 24 April 2017 11:48:26 PM