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/TLV320DAC3100: Searching the right version of the driver and the right way to configure it for third party SOC. Mainline kernel documentation mentions this configuration but more details needed.

Part Number: TLV320DAC3100


Tool/software: Linux

Dear Ti experts

Your representative has recommended us the TLV320DAC3100 chip as one of the types with linux kernel support.

I also found appropriate example here https://www.kernel.org/doc/Documentation/devicetree/bindings/sound/simple-card.txt.

It is example 3

We are missing some deeper details how to configure the RESET pin binding and we also have problems accessing register pages above page zero via regmap.

Can you point us to some more detailed documentation?

Thank you

  • Hi, Jakub,

    Welcome to E2E and thank you for your interest in our products!

    I cannot find the information about the pages control in the linux driver that you attached. We usually recommend the drivers below, could you take a look at them and let me know if they work better for you?

    github.com/.../tlv320dac3100.h
    github.com/.../tlv320dac3100.c

    Best regards,
    Luis Fernando Rodríguez S.
  • Hi Luis,

    this version, you recommended us is really really old and it is impossible to compile it with mainline kernel v4.14.

    Our situation is described by this device tree (see attached file)

    /*Sound node:*/
    sound {
            compatible = "simple-audio-card";
            model = "tlv320aic3x-audio";
            #sound-dai-cells=<0>;
            /*tab the extra parameters not in 'example 3'*/
                    simple-audio-card,format = "i2s";
                    simple-audio-card,bitclock-master = <&dailink_master>;
                    simple-audio-card,frame-master = <&dailink_master>;
                    system-clock-frequency = <24000000>;
                    system-clock-direction = "out";
            simple-audio-card,widgets =
                    "Microphone", "Mic Jack",
                    "Line", "Line In",
                    "Line", "Line Out",
                    "Speaker", "Speaker",
                    "Headphone", "Headphone Jack";
            simple-audio-card,routing =
                    "Speaker", "SPK",
                    "Speaker", "Speaker",
                    "Speaker", "SPK ClassD",
                    "Headphone Jack", "HPL",
                    "Headphone Jack", "HPR";
            /* simple-audio-card,aux-devs = <&amp>; */
            simple-audio-card,cpu {
                    sound-dai = <&ssi2>;
            };
            dailink_master: simple-audio-card,codec {
                    sound-dai = <&audio_codec>;
                    clocks =  <&clks IMX6QDL_CLK_CKO>;
            };
    };
            
            
    /*i2c codec node*/
    &i2c1 {
            audio_codec: audio_codec@0x18 {
                    compatible = "ti,tlv320dac3100";
                    reg = <0x18>;
                    #sound-dai-cells=<0>;
    
                    ai31xx-micbias-vg = <MICBIAS_2_5V>;
                    aic31xx-reset-pin = <&gpio2 11 GPIO_ACTIVE_LOW>;
    
                    clocks = <&clks IMX6QDL_CLK_CKO>;
    
                    HPVDD-supply = <&reg_3p3v>;
                    SPRVDD-supply = <&reg_5p0v>;
                    SPLVDD-supply = <&reg_5p0v>;
                    AVDD-supply = <&reg_3p3v>;
                    IOVDD-supply = <&reg_1p8v>;
                    DVDD-supply = <&reg_1p8v>;
            };
    };
    
    /*audmux node*/
    &audmux {
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_audmux_2>;
            fsl,mux-int-port = <2>;
            fsl,mux-ext-port = <3>;
            status = "okay";
    };
    
    /*----------------------------------------------------------------------*/

  • Hi, Jakub,

    Can you access to the registers map and write individual values on each register? Usually, we don't support linux drivers but we can provide a correct registers configuration to have the device working properly.

    Best regards,
    Luis Fernando Rodríguez S.
  • Hi, Jakub,

    Excuse me, do you have an update on this? Please let me know if you have additional questions or comments.

    Best regards,
    Luis Fernando Rodríguez S.
  • Hello Luis,
    my name is Mirek, i am Jakubs colleague and the architect behind the embedded system using this HW.

    Yes, we can read/write registers.

    It would be very helpful if you could provide the correct register settings for desired functionality.
    Which is:
    - Codec (mentioned TLV320DAC3100) behaves as I2S master. MCLK is provided @24Mhz, BCLK and WCLK generated by the codec.
    - For start/test setting the clocks for simple 8-16bit dual channel audio will suffice.
    - Both DAC are active, the channels are routed as mono to the D-class output amplifier.

    I can then compare to our settings if there is a problem with driver or soc sound layer.

    Thank you

    Best regards

    Mirek

  • Hi Luis,
    I asked my colleague M. Kopecek to join our discussion. Please approve his post.
    Thank you
  • Nice to meet you, Miroslav,

    Thank you for providing the information about your expected clocking scheme.

    I prepared a script that we use for our evaluation modules initialization. I modified some parameters in order to generate a WCLK = 44.1KHz and BCLK = 1.4112 MHz from MCLK = 24MHz. 

    # Registers configuration for MCLK = 24MHz; WCLK = 44.1 KHz; BCLK = 1.4112 MHz
    
    # Page 0 is selected 
    w 30 00 00
    
    # SW Reset
    w 30 01 01
    
    # PLL_clkin = MCLK, Codec_Clkin = PLL
    w 30 04 03
    
    # PLL disabled, P = 2, R =1
    w 30 05 21
    
    # J = 7
    w 30 06 07
    
    # D = 0560 (decimal) = 10 0011 0000 (binary) = 02 30
    w 30 07 02
    w 30 08 30
    
    # PLL enabled
    w 30 05 a1
    
    # Mode is I2S, wordlength is 16, BCLK and WCLK as outputs
    w 30 1b 0c
    
    # BDIV_CLKIN = DAC_MODCLK = 5.6448 MHz
    w 30 1d 01
    
    # BCLK divider N = 4; BCLK = BDIV_CLKIN / N = 1.4112 MHz
    w 30 1e 84
    
    # NDAC is powered up and set to 3
    w 30 0b 83
    
    # MDAC is powered up and set to 5
    w 30 0c 85
    
    # DOSR = 128
    w 30 0e 80
    
    # DAC => 0 db gain left
    w 30 41 00
    
    # DAC => 0 db gain right
    w 30 42 00
    
    # Page 1 is selected
    w 30 00 01
    
    # De-pop, Power on = 800 ms, Step time = 4 ms
    w 30 21 4e
    
    # HPL and HPR powered up
    w 30 1f c2
    
    # LDAC routed to HPL, RDAC routed to HPR
    w 30 23 88
    
    # HPL unmute and gain 1db
    w 30 28 0e
    
    # HPR unmute and gain 1db
    w 30 29 0e
    
    # No attenuation on Headphone outputs
    w 30 24 00
    w 30 25 00
    
    # MIC BIAS = AVDD
    w 30 2e 0b
    
    # Page 0 is selected
    w 30 00 00
    
    # Select DAC DSP mode 11
    w 30 3c 0b
    
    # Power Up DAC left and right channels (soft step disable)
    w 30 3f d6
    
    # UNMUTE DAC left and right channels
    w 30 40 00
    
    # Page 1 selected
    w 30 00 01
    
    # DAC_L and DAC_R are routed to mixer amplifier
    w 30 23 44
    
    # Left Analog Volume to SPK
    w 30 26 80
    
    # Class-D Speaker Driver unmuted
    w 30 2a 04
    
    # Power-up Class-D driver
    w 30 20 c6
    
    # Left DAC channel to HPL		
    w 30 24 00
    
    # Right DAC channel to HPR
    w 30 25 00
    
    # HPL driver unmuted
    w 30 28 04
    
    # HPR driver unmuted
    w 30 29 04
    
    # HPL and HPR powered up
    w 30 1f c2

    Please take a look at it and let me know if you get the expected clock frequencies and speaker output. In addition, if you would like to modify some parameters, you may let me know to do the proper modifications.

    Have a good weekend!

    Best regards,
    Luis Fernando Rodríguez S.

  • Miroslav,

    I forgot to mention that the code format is:

    w 30 xx yy

    Where:
    "w" is an I2C write command
    "30" is the I2C address
    "xx" is the register address
    "yy" is the register data

    Hope this helps!

    Best regards,
    Luis Fernando Rodríguez S.
  • Miroslav, Jakub,

    Please let me know if this works for you or if you have additional questions and comments.

    Best regards,
    Luis Fernando Rodríguez S.
  • Hi Luis, will do. 
    Got to testing it today. Will post results as soon as i gather the data.

    Regards
    Mirek

  • Hi, Mirek,

    Do you need assistance with something else? Were you able to get the correct configuration with the script that I shared?

    Best regards,
    Luis Fernando Rodríguez S.
  • Greetings Luis,
    as of today, we got the IC working properly with our linux distro.
    - Thank you for the support, your configuration helped me to set up the clock properly.
    Will post the final source code & settings once i clean it up. Hopefully this week.

    Thank you for your support, please leave this thread open until i can get the final - working - configuration here.
    Best regards
    Miroslav Kopecek
  • Hi, Miroslav,

    I'm glad to read that the IC is working properly now.

    I will leave the thread open as you mentioned, so you can provide your final configuration.

    Thank you for your feedback.

    Have a great week!

    Best regards,
    Luis Fernando Rodríguez S.