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.

TLV320AIC3107 Alsa audio playback with AM335x

Other Parts Discussed in Thread: TLV320AIC3107

Hi,

i'm working on a custom board based on an AM335x and a TLV320AIC3107 (class-D amplifier)

My device tree seems OK since the Alsa soundcard gets detected (You'l find my kernel initialisation log attached)

I can hear a breath when i try to play some sounds that could indicate that the class-D amp. is powering through I2C, but i can't hear any sound from the speakers.

Here is what i get when i do a "speaker-test -c2"

speaker-test 1.0.25

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 32768
Period size range from 8 to 2048
Using max buffer size 32768
Periods = 4
was set period_size = 2048
was set buffer_size = 32768
 0 - Front Left
Write error: -5,Input/output error
xrun_recovery failed: -5,Input/output error
Transfer failed: Operation not permitted

If i look at kernel log, i can see:

ALSA sound/core/pcm_lib.c:1945 playback write error (DMA or IRQ trouble?)

The driver i'm using is the one for the TLV320AIC3007 under TI kernel 3.12.10 is it OK for the TLV320AIC3107 ?

Do you have a track i can follow to find what i'm doing wrong ?

Thanks in advance for any help.
Best regards

Here is my schema and device tree:



&i2c2 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c2_pins>;

	status = "okay";
	clock-frequency = <100000>;
	
	tlv320aic3007: tlv320aic3007@18 {
	
		compatible = "ti,tlv320aic3007";
		reg = <0x18>;
		status = "okay";
		
		/* Regulators */
    AVDD-supply = <&ldo4_reg>;
    IOVDD-supply = <&ldo4_reg>;
    DRVDD-supply = <&ldo4_reg>;
    DVDD-supply = <&ldo1_reg>; 

	};
};

&am33xx_pinmux {

  // on active l'horloge à 12Mhz
	pinctrl-names = "default";
	pinctrl-0 = <&clkout1_pin>;

  clkout1_pin: clkout1_pin {
  pinctrl-single,pins = <
      0x1b0 (MUX_MODE3 | PIN_OUTPUT_PULLDOWN)               /* AUD_MCLK  -> CLKOUT1 / xdma_event_intr0 / GPIO0_19  */
    >;
  };
  
  i2c2_pins: pinmux_i2c2_pins {
    pinctrl-single,pins = <
    /*SLEWCTRL_SLOW = 0x40*/
      0x178 0x73	/* uart1_ctsn.i2c2_sda, SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE3 */
      0x17c 0x73 	/* uart1_rtsn.i2c2_scl, SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE3 */
    >;
  };

  mcasp1_pins: mcasp1_pins {
  pinctrl-single,pins = <
    0x1ac (MUX_MODE3 | PIN_INPUT_PULLDOWN /*input!*/)		  /* AUD_DOUT / MCASP1_AXR1 -> GPIO3_21 */
    0x1a4 (MUX_MODE3 | PIN_OUTPUT_PULLDOWN)               /* AUD_WCLK / MCASP1_FSX -> AUDIO_FSX / GPIO3_19 */
    0x1a0 (MUX_MODE3 | PIN_OUTPUT_PULLDOWN)               /* AUD_BCLK / MCASP1_ACLKX -> GPIO3_18 */
    0x1a8 (MUX_MODE3 | PIN_OUTPUT_PULLDOWN)               /* AUD_DIN  / MCASP1_AXR0 -> GPIO3_20 */
    >;
  };
};

&mcasp1 {
  pinctrl-names = "default";
  pinctrl-0 = <&mcasp1_pins>;
  status = "okay";
  op-mode = <0>;          /* MCASP_IIS_MODE */
  tdm-slots = <2>;
  serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
    1 2 0 0 /* AXR0 AXR1 AXR2 AXR3 */ 
  >;
  tx-num-evt = <1>;
  rx-num-evt = <1>;
};

/ {
	sound {
		compatible = "ti,da830-evm-audio";
		ti,model = "DA830 EVM";
		ti,audio-codec = <&tlv320aic3007>;
		ti,mcasp-controller = <&mcasp1>;
		ti,codec-clock-rate = <12000000>;
		ti,audio-routing =
			"Headphone Jack",       "HPLOUT",
			"Headphone Jack",       "HPROUT",
			"Line Out",             "LLOUT",
			"Line Out",             "RLOUT",
			"MIC3L",                "Mic Jack",
			"MIC3R",                "Mic Jack",
			"LINE1L",               "Line In",
			"LINE2L",               "Line In",
			"LINE1R",               "Line In",
			"LINE2R",               "Line In";
	};
};

  • Hi, Baptiste,

    You can find info about our drivers on this post.

    -d2

  •  Thanks for the link Don, it helped.


    I managed to make it work, my pinmux direction was wrong, here is the correct one:

        
        0x1ac (MUX_MODE3 | PIN_INPUT_PULLDOWN)      /* AUD_DOUT */
        0x1a4 (MUX_MODE3 | PIN_INPUT_PULLDOWN)      /* AUD_WCLK */
        0x1a0 (MUX_MODE3 | PIN_INPUT_PULLDOWN)      /* AUD_BCLK */
        0x1a8 (MUX_MODE3 | PIN_OUTPUT_PULLDOWN)     /* AUD_DIN */
    

    Then i had to change Left DAC Mux to DAC_L1 with Alsamixer and i can hear a sound from my speakers !