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.

[FAQ] Linux Drivers: Device drivers for AIC31xx/DAC31xx/AIC325x/AIC320x/AIC326x/AIC321x

  • Reference ALSA SoC codec drivers for the above mentioned devices are now available from kernel.org.  These device drivers have undergone limited testing on select OMAP3-based, OMAP4-based, and Sitara-based platforms.  While every attempt has been made to adhere to guidelines for the development of ALSA SoC codec drivers, use of these drivers on other application processor platforms may require significant additional code.  Device variants that include the miniDSP also require a binary firmware to be made available to the driver by the system.  Not all features of these device are supported by the drivers.

    UPDATE (06-Jan-2021):

    Device

    Driver

    Documentation

    Kernel Version Supported

    Notes

    TLV320ADCx140, PCMD3180, PCMD3140

    tlv320adcx140.c

    tlv320adcx140.h

    tlv320adcx140.yaml

    v5.0 or later

    TLV320ADC310x (TLV320ADC3101, TLV320ADC3100)

    tlv320adc310x.c

    tlv320adc310x.h

    v4.14 or later

    TLV320AIC23

    tlv320aic23-i2c.c

    tlv320aic23-spi.c

    tlv320aic23.c

    tlv320aic23.h

    v4.14 or later

    TLV320AIC26

    tlv320aic26.c

    tlv320aic26.h

    v4.14 or later
    TLV320DAC33

    tlv320dac33.c

    tlv320dac33.h

    TLV320AIC3100, TLV320AIC3110, TLV320AIC3111, TLV320AIC3120, TLV320DAC3100, TLV320DAC3101

    tlv320aic31xx.c

    tlv320aic31xx.h

    tlv320aic31xx.txt

    v4.19 or later

    tlv320aic31xx.c

    tlv320aic31xx.h

    backport to v3.18

    TLV320AIC3x, TLV320AIC33, TLV320AIC3007, TLV320AIC3101, TLV320AIC3104, TLV320AIC3105, TLV320AIC3106, TLV320AIC3107, TLV320AIC3109-Q1

    tlv320aic3x.c

    tlv320aic3x.h

    tlv320aic3x.txt

    v4.19 or later

    TLV320AIC3204, TLV320AIC3254, TLV320AIC3206, TLV320AIC3256

    tlv320aic32x4-clk.c

    tlv320aic32x4-i2c.c

    tlv320aic32x4-spi.c

    tlv320aic32x4.c

    tlv320aic32x4.h

    tlv320aic32x4.txt

    v4.19 or later

    TLV320AIC3262, TLV320AIC3263, TLV320AIC3212, TLV320AIC3268

    tlv320aic326x.c

    tlv320aic326x.h

     

    v4.19 or later

    PCM1681

    pcm1681.c

    v4.19 or later

    PCM1789

    pcm1789-i2c.c

    pcm1789.c

    pcm1789.txt

    v4.19 or later

    PCM179x

    pcm179x-i2c.c

    pcm179x-spi.c

    pcm179x.c

    pcm179x.h

    pcm179x.txt

    v4.19 or later

    PCM1862, PCM1863, PCM1864, PCM1865

    pcm186x-i2c.c

    pcm186x-spi.c

    pcm186x.c

    pcm186x.h

    pcm186x.txt

    v4.19 or later

    PCM3008

    pcm3008.c

    pcm3008.h

    v4.19 or later

    PCM3060

    pcm3060-i2c.c

    pcm3060-spi.c

    pcm3060.c

    pcm3060.h

    pcm3060.txt

    v5.0 or later

    PCM3168

    pcm3168a-i2c.c

    pcm3168a-spi.c

    pcm3168a.c

    pcm3168a.h

    v4.19 or later

    PCM5102A

    pcm5102a.c

    pcm5102a.txt

    v4.19 or later

    PCM512x

    pcm512x-i2c.c

    pcm512x-spi.c

    pcm512x.c

    pcm512x.h

    pcm512x.txt

    v4.19 or later

    PCM3008SW-LINUX , PCM3168ASW-LINUX , PCM1681SW-LINUX , TLV320AIC3XSW-LINUX , TLV320AIC31XX-DRIVERS , TLV320AIC31XXSW-LINUX , PCM3XXX-DRIVERS , PCM186X-DRIVERS , PCMD31XX-DRIVERS , PCM5XXX-DRIVERS , PCM17XXSW-DRIVERS , PCM179XSW-LINUX , TLV320ADCX140SW-DRIVERS , TLV320ADC31XX-DRIVERS , TLV320AIC2X-DRIVERS , TLV320DAC31XX-DRIVERS , TLV320AIC32XX-DRIVERS , TLV320AIC32X4SW-LINUX , TLV320AIC32X6-DRIVERS

    Some additional links:

    alsa.mirror.fr/.../alsa-driver-1.0.24.tar.bz2

    Look in these folders

    Codecs         alsa-driver-1.0.24\alsa-kernel\soc\codecs

    OMAP            alsa-driver-1.0.24\alsa-kernel\soc\omap

    DaVinci         alsa-driver-1.0.24\alsa-kernel\soc\davinci

     

    Useful commands to test these drivers:

    • Linux commands
      • I2C
        • i2cdetect  r 2 => shows devices connected
        • i2cget -y -f 2 0x4c 0x11 => gets I2C bus 2 at device 0x4C address and register 0x11
        • i2cset -y -f 2 0x4c 0x11 0x00 => sets I2C bus 2 at device 0x4C address and register 0x11 to 0x00
        • i2cdump -y -f 2 0x4c => show all registers at I2C bus 2 device 0x4c
      • Amixer
        • amixer controls => list all controls
        • amixer contents => list all controls and contents
        • amixer set CH1_ASI_EN on=> tuns on ASI for Ch1
      • Record
        • arecord –c<number of channels> -f <format> -r <sample_rate> -d <Duration> <file_name>
          format => type of the sample. The recognized sample formats are S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW A_LAW IMA_ADPCM MPEG GSM SPECIAL S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE
          Duration => duration of recording in seconds.
          sample_rate => 8000 Hz, 11025 Hz, 22050 Hz, 32000 Hz, 44100 Hz, 48000 Hz, 96000 Hz
          file_name => File name given to recorded audio

      • Speaker test:
      • Loopback
        • arecord -c 2 -f S16_LE -r 48000 | aplay -f S16_LE -c 2 -r 48000 --device="hw:0,1"
      • List any kernel messages
        • with "tlv"
          • dmesg | grep tlv
        • with "pcm"
          • dmesg | grep pcm

    Configuring audio devices for linux, typically requires that the DTS be modified in two areas:

    The DTS usually has two areas that need the device to be described: i2c and sound. For i2C you would have the following entry with options specific to a device. These options are typically documented in the yaml or txt file for the driver. For example for tlv320aic3x:
    &i2c0 {
    tlv320aic3x: tlv320aic3x@1b {
    compatible = "ti,tlv320aic3x";
    reg = <0x1b>;
    reset-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
    AVDD-supply = <&regulator>;
    IOVDD-supply = <&regulator>;
    DRVDD-supply = <&regulator>;
    DVDD-supply = <&regulator>;
    };
    };
    Also the DTS must describe the pins connected to the processor TDM or I2S bus. For a BeagleBone Black with a Sitara class processor using the McASP0 as the TDM bus peripheral with 32-bit data and TDM bus (dsp_a). Using the same example for tlv320aic3x:
    &mcasp0 {
    #sound-dai-cells = <0>;
    pinctrl-names = "default";
    pinctrl-0 = <&mcasp0_pins>;
    status = "okay";
    op-mode = <0>; /* MCASP_IIS_MODE */
    tdm-slots = <4>;
    serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
                         2 0 1 0
                       >;
    tx-num-evt = <32>;
    rx-num-evt = <32>;
    };
    / {
    clk_mcasp0_fixed: clk_mcasp0_fixed {
    #clock-cells = <0>;
    compatible = "fixed-clock";
    clock-frequency = <24576000>;
    };
    clk_mcasp0: clk_mcasp0 {
    #clock-cells = <0>;
    compatible = "gpio-gate-clock";
    clocks = <&clk_mcasp0_fixed>;
    enable-gpios = <&gpio1 27 0>; /* BeagleBone Black Clk enable on GPIO1_27 */
    };
    sound {
    compatible = "simple-audio-card";
    simple-audio-card,name = "TI BeagleBone Black";
    #sound-dai-cells = <0>;
    simple-audio-card,dai-link@0 {
    format = "dsp_a";
    bitclock-master = <&sound0_master>;
    frame-master = <&sound0_master>;
    sound0_master: cpu {
    sound-dai = <&mcasp0>;
    clocks = <&clk_mcasp0>;
    };
    codec {
    sound-dai = <&tlv320aic3x>;
    };
    };
    };
    };