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.

Linux/TLV320AIC3254-Q1: TLV320AIC3254-Q1 linux driver and interfacing with raspberry pi board

Part Number: TLV320AIC3254-Q1
Other Parts Discussed in Thread: TLV320AIC3254, TLV320AIC3111, TLV320AIC3106, TLV320AIC23, CC3200

Tool/software: Linux

Hi,

I want to interface  TLV320AIC3254-Q1 which has AEC, noise cancellation with raspberry pi board running linux.

How to interface with raspberry pi ?

Availability for linux driver... ?

Device tree file (.dts) to load kernel module...?

please help me out...

Thanks & Regards,

shrikant

  • Hi Shrikant,

    Welcome to TI E2E community.
    Can you please let us know which kernel version are you using for your Pi board? Also which Raspberry Pi version(Pi 1/2/3)?
    Generally, if the TLV 320AIC code is part of your Kernel for Pi, the you just need to enable in the kernel configuration. Please confirm it.
    Have a look at the below link also. May help you.

    e2e.ti.com/.../266169

    Thanks,
    Prabhuraj
    BlackPepper Technologies
  • Thanks for your reply,

    1. We are using Raspberry pi model b+ v1.2 and raspberry pi 2 model b. In future, we are planning to move on raspberry pi 3. So you can consider any one above model.
    2. kernel version: 4.9.20+ or 4.9.35+.

    3. Also one more question, in raspberry pi, the y mention enabling particular codec driver needs to add "dtoverlay" in /boot//config.txt. Can we do it using modprobe command for TLV320AIC3254-Q1..?

    Thanks,

    shrikant

  • Hi Shrikant,

    I can see TI's SND_SOC_TLV320AIC32X4 kernel config in 4.9 kernel downloaded from official RPi git hub. I am referring bcmrpi_defconfig kernel config file. So, it should be possible for you to enable this driver for Pi.


    thanks,
    Prabhuraj
    BlackPepper Technollogies
  • Ok.

    You mean to say i need to configure kernel and after that it will be loaded automatically..?

    Does it will support Linux ALSA library and utilities...?

    Thanks,

    shrikant

  • Hi Shrikant,

    Ideally, you can enable TLV320.. from the kernel configs.

    There are dedicated Raspberry Pi forums which will help you regarding ALSA.

    thanks,
    prabhuraj
    BlackPepper Technologies
  • Hi Shrikant,

    Yes, it should be possible to use ALSA library straight away for using the TLV320AIC32x4 codec. You need to enable the TLV320AIC32x4 in kernel configuration as suggested

    You need to enable in dts, an entry for the same with compatible  e.g. (this is just an example and will vary in rasp pi for other platforms like i2c number and pinctrl):  

    &i2c2 {

       pinctrl-names = "default";

       pinctrl-0 = <&i2c2_pins &sc16is7xx_pins>;

       status = "okay";

       clock-frequency = <100000>;

       tlv320aic32x4: tlv320aic32x4@18 {

           compatible = "ti,tlv320aic32x4";

           reg = <0x18>;

           status = "okay";

       };

    };

    Need to mention about the codec in sound framework in dts like e.g. (again sample one, it will vary for rasp pi):

        sound {
            compatible = "ti,beaglebone-black-audio";
            ti,model = "TI BeagleBone Black";
            ti,audio-codec = <&tlv320aic32x4>;
            ti,mcasp-controller = <&mcasp0>;
            ti,codec-clock-rate = <12000000>;
            ti,audio-routing =
                "Headphone Jack",       "HPLOUT",
                "Headphone Jack",       "HPROUT",
                "LINE1L",               "Line In",
                "LINE1R",               "Line In";
            clock-names = "mclk";
        };

    In addition you need to take care of pin muxing and clocking for I2C and I2S in device tree.

  • There is one file in kernel source code tlv320aic32x4.txt which contains:

    The tlv320aic32x4 serial control bus communicates through I2C protocols

    Required properties:
    - compatible: Should be "ti,tlv320aic32x4"
    - reg: I2C slave address
    - supply-*: Required supply regulators are:
    "iov" - digital IO power supply
    "ldoin" - LDO power supply
    "dv" - Digital core power supply
    "av" - Analog core power supply
    If you supply ldoin, dv and av are optional. Otherwise they are required
    See regulator/regulator.txt for more information about the detailed binding
    format.

    Optional properties:
    - reset-gpios: Reset-GPIO phandle with args as described in gpio/gpio.txt
    - clocks/clock-names: Clock named 'mclk' for the master clock of the codec.
    See clock/clock-bindings.txt for information about the detailed format.


    Example:

    codec: tlv320aic32x4@18 {
    compatible = "ti,tlv320aic32x4";
    reg = <0x18>;
    clocks = <&clks 201>;
    clock-names = "mclk";
    };


    Does it will help for writing dts file ?
  • Yes, you can refer this and write your dts.

    thanks,
    Prabhuraj
    BlackPepper Technologies
  • Hi,
    Yes it should help.
  • i am new to dtoverlay and dts file structure.

    Can you please help/guide  for writing .dts file for  TLV320AIC3254 on raspbery pi ...?

    Thanks,

    Shrikant

  • Hi Shrikant,

    This is TI forum. DTS is slightly different way done for rasp pi from the common way. To get rasp pi specific queries addressed, would suggest you to post rasp pi forum for quick response. www.raspberrypi.org/.../ 

  • ok Dwarakesh. Thanks for help.
    I will check raspberry pi forums for this.
  • Hi ,

    Can you please provide any sample TLV320AIC3254 dts file any board like beagle-bone or any TI' any board ?
    So that i can refer and write my own for raspberry pi ?

    Thanks,
    Shrikant
  • Hi Shrikant,

    tlv320aic32x4.txt that you shared is a good starting point. I am not able to find the exact TI codec module in any of the DTS files that I have, to give as an example. Snippet I shared in previous post could also be used for reference. Also with tlv320aic32x4.txt as main reference and by checking how, other codec like tlv320aic3x, tlv320aic3111, tlv320aic3106 as references you can check how to configure dts. Entries for these codec are already available in dts files for various architectures under under arch/arm/boot/dts folder. Just grep for them.
  • Hi,

    I can't see   TI's SND_SOC_TLV320AIC32X4 kernel config in 4.9 kernel.

    I did  "make menuconfig" and then .config is created and in that file only following entries :  

    CONFIG_SND_SOC_TLV320AIC23=m
    CONFIG_SND_SOC_TLV320AIC23_I2C=m
    CONFIG_SND_SOC_TLV320AIC23_SPI=m
    CONFIG_SND_SOC_TLV320AIC31XX=m
    CONFIG_SND_SOC_TLV320AIC3X=m

    how you got entry for SND_SOC_TLV320AIC32X4 ?

    Thanks,

    shrikant

  • Hi Shrikant,

    Copy bcmrpi_defconfig file(I assume this is your defconfig file, if any other, please check in that) from arch/arm/configs to .config file. Then do make menuconfig ARCH=arm
    Now search for SND_SOC_TLV320AIC32X4. You should find it.

    Thanks,
    Prabhuraj
    blackPepper Technologies
  • hi

    I managed to hack kernel config file and able to compile a kernel module for tlv320aic32x4 series.
    Please can you send the output of "lsmod"  command to your technical team:

    Module                  Size
     Used by

    bnep                   11847  2
    bluetooth             377680  5 bnep
    cfg80211              524570  0
    rfkill                 21272  3 bluetooth,cfg80211
    spidev                  7034  0
    snd_bcm2835            22966  1
    i2c_bcm2835             6401  0
    spi_bcm2835             7628  0
    bcm2835_gpiomem         3791  0
    fixed                   3029  0
    uio_pdrv_genirq         3718  0
    uio                    10134  1 uio_pdrv_genirq
    snd_soc_tlv320aic32x4_spi     2020  0
    snd_soc_tlv320aic32x4_i2c     2020  0
    snd_soc_tlv320aic32x4    24093  2 snd_soc_tlv320aic32x4_spi,snd_soc_tlv320aic32x4_i2c
    snd_soc_core          175984  1 snd_soc_tlv320aic32x4

    snd_pcm_dmaengine       6002  1 snd_soc_core
    snd_compress           10112  1 snd_soc_core
    snd_pcm                97377  4 snd_pcm_dmaengine,snd_soc_

    tlv320aic32x4,snd_bcm2835,snd_soc_core
    snd_timer              22610  1 snd_pcm
    snd                    68426  7 snd_compress,snd_timer,snd_bcm2835,snd_soc_core,snd_pcm
    i2c_dev                 6674  0
    fuse                   93798  3
    ipv6                  380873  44


    You can see  "snd_soc_tlv320aic32x4"  in the modules list.

    I am not able write dts file . can you help me out for  ...?
    can you help me out for further possibility without dts file using directly ALSA library?

    If  i  want to interface tlv320aic32x4  other than raspberry pi i.e any TI board like cc3200 or any other processor ....then  what can be options..?
    Regards,

    Shrikant