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/TLV320AIC3105: Audio routing in DT

Part Number: TLV320AIC3105
Other Parts Discussed in Thread: TLV320AIC3107, TLV320AIC3007, , TLV320AIC3106

Tool/software: Linux

Dear TI E2E Community,

I have done my audio routing for TLV320AIC3105 as below in DT to interface with my custom processor, Could anyone please confirm whether the below routing is correct for the portion of schematics attached 

audio-routing =

"Headphone Jack", "HPLOUT",
"Headphone Jack", "HPROUT",
"LINE1L", "Mic Jack",
"LINE2L", "Mic Jack";

And also, may I know what are all the routing configurations that I need to add in my machine driver file for interfacing this codec with my custom processor

Kindly do the needful as early as possible

Awaiting for your replies

Many Thanks in advance

  • Srini,

    Im not entirely clear on your 1st question.  the HPL and HPR outputs are headphone outputs,  and microphones can be connected to line1L and line2L.

    regarding routing configurations, there is a block diagram in the datasheet which shows all of the routing.  see below:

    you can also use This driver as a reference. It is far from perfect,  but it might save you some time. 

    best regards, 

    -steve Wilson

  • Dear Steve,

    The first question was related to audio routing configurations that you would do in Linux device trees for configuring codec inputs and outputs, where I was not very confident on this as described in the below link w.r.t "Machine Layer Configuration", I just wanted you to review the audio routing related configuration that I have done w.r.t  "Machine Layer Configuration"

     

     

    sound {
    compatible = "fsl,imx-audio-tlv320";
    model = "imx-tlv320";
    cpu-dai = <&sai3>;
    audio-codec = <&tlv320aic3105>;
    /*asrc-controller = <&asrc>;*/ /*TO BE CHECKED LATER */
    /*codec-master;*/ /*TO BE CHECKED LATER */
    /*gpr = <&gpr 4 0x100000 0x100000>;*/ /*TO BE CHECKED LATER */
    audio-routing =

    "Headphone Jack", "HPLOUT",
    "Headphone Jack", "HPROUT",
    "LINE1L", "Mic Jack",
    "LINE2L", "Mic Jack";

    /*mux-int-port = <2>;*/ /*TO BE CHECKED LATER */
    /*mux-ext-port = <5>; */ /*TO BE CHECKED LATER */
    };

    tlv320aic3105: tlv320aic3x@18 {
    compatible = "ti,tlv320aic3x";
    reg = <0x18>;
    gpio-reset = <&gpio5 4 GPIO_ACTIVE_LOW>; ----------------------------------------------------> Is this is correct????????
    clocks = <&clks IMX6UL_CLK_SAI3>;
    ai3x-micbias-vg = <2>; /* MICBIAS_2_5V */
    /* clock-names = "mclk"; */ /*TO BE CHECKED LATER*/
    status = "okay";

    clock-frequency = <12000000>; /*TO BE CHECKED LATER*/
    /* Regulators */
    DRVDD-supply = <&reg_3p3v>; /*TO BE CHECKED LATER*/
    AVDD-supply = <&reg_3p3v>; /*TO BE CHECKED LATER*/
    IOVDD-supply = <&reg_3p3v>; /*TO BE CHECKED LATER*/
    DVDD-supply = <&reg_1p8v>; /*TO BE CHECKED LATER*/
    };

    Could you please confirm that whether the highlighted routing related configuration is correct?? as per the portion of the schematics attached in my first post, Hope this is the key parameters to do the audio codec bringup with my custom processor

    I am unable to get this play back working

    root@imx6ull14x14evk:/# i2cdetect -y -a -r 1
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00: 00 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    root@imx6ull14x14evk:/# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: imxtlv320 [imx-tlv320], device 0: HiFi tlv320aic3x-hifi-0 []
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    root@imx6ull14x14evk:/# ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:04:9f:05:0b:12  
              inet addr:10.75.28.86  Bcast:10.75.29.255  Mask:255.255.254.0
              inet6 addr: fe80::204:9fff:fe05:b12/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:20048 errors:0 dropped:0 overruns:0 frame:0
              TX packets:10734 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:22544678 (21.5 MiB)  TX bytes:1945718 (1.8 MiB)
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:2404 errors:0 dropped:0 overruns:0 frame:0
              TX packets:2404 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1 
              RX bytes:182640 (178.3 KiB)  TX bytes:182640 (178.3 KiB)
    root@imx6ull14x14evk:/# ls
    Aadya                     bin   etc   jaya-t  mnt   run   test.txt    usr
    a2002011001-e02-8kHz.wav  boot  home  lib     opt   sbin  tmp         var
    aniketh                   dev   jaya  media   proc  sys   unit_tests
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# aplay -Dplughw:0,0 a2002011001-e02-8kHz.wav
    Playing WAVE 'a2002011001-e02-8kHz.wav' : Signed 16 bit Little Entlv320aic3x-codec 1-0018: Unable to sync registers 0x1-0x2. -11
    dian, Rate 8000 Hz, Stereo
    aplay: pcm_write:2023: write error: Input/output error
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# aplay a2002011001-e02-8kHz.wav                                                                                         
    tlv320aic3x-codec 1-0018: Unable to sync registers 0x4-0x8. -6
    Playing WAVE 'a2002011001-e02-8kHz.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
    ^CAborted by signal Interrupt...
    aplay: pcm_write:2023: write error: Interrupted system call
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# amixer
    amixer: Mixer default load error: No such device or address
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# amixer 
    amixer: Mixer default load error: Device or resource busy
    root@imx6ull14x14evk:/# i2cget -f -y 1 0x18 0x5
    Error: Read failed
     
    root@imx6ull14x14evk:/# cat /proc/asound/cards
     0 [imxtlv320      ]: imx-tlv320 - imx-tlv320
                          imx-tlv320
    root@imx6ull14x14evk:/# cat /proc/asound/devices
      0: [ 0]   : control
     16: [ 0- 0]: digital audio playback                    +-----------------------------+
     24: [ 0- 0]: digital audio capture                     |                             |
     33:        : timer                                     |  Cannot open /dev/ttyUSB0!  |
    root@imx6ull14x14evk:/# cat /proc/asound/card0/id       |                             |
    imxtlv320                                               +-----------------------------+
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# 
    root@imx6ull14x14evk:/# i2cdump -f -y 1 0x18
    No size specified (using byte-data access)
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    80: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    90: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    a0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    b0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    c0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    f0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
    root@imx6ull14x14evk:/# 

    root@imx6ull14x14evk:/#
    root@imx6ull14x14evk:/# aplay -Dplughw:0,0 a2002011001-e02-8kHz.wav
    Playing WAVE 'a2002011001-e02-8kHz.wav' : Signed 16 bit Little Entlv320aic3x-codec 1-0018: Unable to sync registers 0x1-0x2. -11
    dian, Rate 8000 Hz, Stereo
    aplay: pcm_write:2023: write error: Input/output error --  SEEMS TO BE MAINLY AUDIO ROUTING ISSUE
    root@imx6ull14x14evk:/#
    root@imx6ull14x14evk:/#

     

     

    On page number 19 in TLV320AIC3105 datasheet, it says as below

    10.3 Feature Description
    10.3.1 Hardware Reset
    The TLV320AIC3105 requires a hardware reset after power up for proper operation. After all power supplies are
    at their specified values, the RESET pin must be driven low for at least 10 ns. If this reset sequence is not
    performed, the TLV320AIC3105 may not respond properly to register reads/writes

    I have done as below as per the above is this correct??

    gpio-reset = <&gpio5 4 GPIO_ACTIVE_LOW>; ----------------------------------------------------> Is this is correct????????

    Kindly do the needful as early as possible

    Thanks,

    Srini 

     

  • Srini,

    I honestly don't have any experience with the imx6 processors, I don't really see where you are configuring any audio routing. where is this taking place?

    best regards,
    -Steve Wilson
  • Dear Steve,

    1. Could you please let me know the differences between  TLV320AIC3105 and TLV320AIC3107, TLV320AIC3007 part numbers ??, because as I found some references for TLV320AIC3107, TLV320AIC3007 part numbers which I can reuse it for my TLV320AIC3105 codec

    2. What should be the i2c pullup resistors value for i2c_sda and i2c_scl for 100Khz clock freq?

    Kindly do the needful as early as possible

    Thanks in advance

  • The TLV320AIC3107 and TLV320AIC3105 are both part of the TLV320AIC310x family, so there are many similarities. there are differences in input types (differential and SE) and the AIC3107/3007 have an integrated class-D speaker amplifier. Regarding the Register map, they are almost identical, I believe the only difference is Reg 73 and Reg76, But I may have misssed something.

    best regards,
    -Steve wilson
  • Thanks Steve,

    Could you please answer the below what is the pullup resistors value that needs to be put, ie., what is the value of Rp needs to be mounted as per TLV320AIC3105 datasheet page number 90??

    2. What should be the i2c pullup resistors value for i2c_sda and i2c_scl for 100Khz clock freq. what should be the value whether it should be 4.7k or 10k, does it works with 10k pullup resistors?

    3. Could you please talk to Pavel and help me to get the responses for the same issue whatever I have posted in the above? Am facing similar issue as posted in 

    4. Could you please share me reference schematics ie., TLV320AIC3105 interfaced to AM335x, so that I can compare with my custom processor (SAI3 - i.mx6ULL) interfaced to TLV320AIC3105EVM-K board

    5. Also, Could you please let me know how the I2C interface can be verified in TLV320AIC3105EVM-K board using TLV320AIC3105EVM-K evaluation tool??


    Thanks,
    Srini

  • Srini,

    2: The value of Rp will depend mostly on your requirements.  you can trade off speed and power consumption a little bit. we use 4.7k resistors on the EVM,  but I would advise that you take a look at this application report.  This is a great resource for determining the proper value for your use case.   keep in mind The TLV320AIC3105 can do standard or fast mode,  I don't think it is compatible with fast mode plus.

    3:This thread you linked to is resolved. Try posting in the AM335x forum

    4: I'm not sure I understand what you need here.  all you need to do is connect the reset, I2C, and I2S lines from the codec to your processor. 

    5: again I"m not sure what you mean.  The I2C is used to program the EVM. you can read all of the registers that you write to, and verify that they have the proper value. but I'm not sure what other kind of verification you are looking for

    best regards, 

    -Steve Wilson

  • Dear Steve

    1. Thanks, Can I only verify the i2c interface to TLV320AIC3105 board from my custom processor connected to  TLV320AIC3105EVM-K?? i.e, i2c wirte and i2c read, without connecting other audio lines mclk, lrclk, nclk, i2s_in and i2s_out from my processor to the TLV320AIC3105EVM-K?

    2. Is that the reset signal is mandatory to be driven from my processor to the codec to verify only the i2c interface to TLV320AIC3105 from my custom processor?

    3. Is that TLV320AIC3105 always acts as slave?? ie., MCLK needs to be provided by the processor to the Codec or is there any chances that Codec can also act as a master ie., can the codec also generate mclk to the processor?

    Kindly do the needful as early as possible

    Many Thanks in advance

    Eagerly awaiting for your replies

    Srini

  • Srini,

    1. you can leave the clocks connected from the USBMODEVM.

    2. The Reset signal must be held low during power up. for testing purposes, you can manually do this.

    3. TLV320AIC3105 can act as slave or master. this is controlled in register 8 by setting BCLK and WCLK as Outputs

    best regards, 

    -Steve Wilson

  • May I know the tlv320AIC3105 registers configuration for keeping DAC and ADC volume to the max extent?

  • Srini,

    There are no ADC volume registers. There are PGA gain registers (15 and 16)

    The DAC Volume registers are 43 and 44.

    best regards,
    -Steve Wilson
  • Is there anything that I need to explicitly configure any voltage regulators for 3.3v and 1.8v in software, if it is hardwired in hardware?

  • Srini,

    There are no configurable regulators on the TLV320AIC3105, well.. there is the micbias in register 25... but It doesn't sound like thats what you were asking about.

    best regards,
    -Steve Wilson
  • Thanks Steve,

    Is that BCLK and WCLK is always generated by the codec(ie., is that the codec is always the master for generating the BCLK and WCLK to the processor, or it can accept the BCLK and WCLK generated from the processor, in this case codec acts a slave is my understanding is correct?) ? for ex. how this clocks (ie., MCLK, BCLK and WCLK) are generated with reference to your AM335x and tlv320aic3106?

    May I know, if there is any codec registers where can I verify MCLK, BCLK and WCLK, if codec is capable of generating the MCLK, BCLK and WCLK to the processor and also the registers to read back for which the codec is receiving MCLK, BCLK and WCLK? 

    Kindly do the needful as early as possible

    Many Thanks in advance

  • Srini,  

    The AIC3105 can be master or slave.  this is set in Register 8 by setting bits D6-D7.  this toggles the  direction of WCLK and BCLK (0= input , 1 = output)

    For future reference, the datasheet for this device is found here.  The datasheet contains a great wealth of information.  please be sure to take a look and let me know if you cant find something in the datasheet. 

    best regards, 

    -Steve wilson