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/AM3358: Line level Audio out from TLV320AIC3104

Part Number: AM3358
Other Parts Discussed in Thread: TLV320AIC3104, , TLV320AIC3106

Tool/software: Linux

Hi,

I am trying to get line level audio out from TLV320AIC3104 with AM3358. I am able to get headphone audio on HPROUT and HPLOUT pins. What do I need to add in my device tree to get audio on LEFT_LOP and RIGHT_LOP pins?

Following is my sound part of device tree.

sound {
		compatible = "simple-audio-card";
		simple-audio-card,name = "AM335x-EVM";
		simple-audio-card,widgets =
			"Headphone", "Headphone Jack",
			"Line", "Line Out",
			"Line", "Line In";
		simple-audio-card,routing =
			"Headphone Jack",	"HPLOUT",
			"Headphone Jack",	"HPROUT",
			"LINE1L",		"Line In",
			"LINE1R",		"Line In",
			"Line Out", 	"LLOUT",
			"Line Out", 	"RLOUT";
		simple-audio-card,format = "dsp_b";
		simple-audio-card,bitclock-master = <&sound_master>;
		simple-audio-card,frame-master = <&sound_master>;
		simple-audio-card,bitclock-inversion;

		simple-audio-card,cpu {
			sound-dai = <&mcasp0>;
		};

		sound_master: simple-audio-card,codec {
			sound-dai = <&tlv320aic3104>;
			system-clock-frequency = <12000000>;
		};
	};

I added audio routes for LLOUT and RLOUT, but I am not getting any audio on line out. 

I also have another question. Can I get mono line out from TLV320AIC3104 or do I need TLV320AIC3106?

Thank you

  • Hi Samer,

    Do you use AM335x TI PSDK Linux v5.02 (kernel v4.14.79)?

    Do you use AM335x custom board?

    Samer Abbas said:
    I also have another question. Can I get mono line out from TLV320AIC3104 or do I need TLV320AIC3106?

    In Processors forum we support AM335x device. For TLV320AIC310x specific questions, you need to ask/post in the audio forum, link below.

    Samer Abbas said:
    I am trying to get line level audio out from TLV320AIC3104 with AM3358. I am able to get headphone audio on HPROUT and HPLOUT pins. What do I need to add in my device tree to get audio on LEFT_LOP and RIGHT_LOP pins?

    It seems to me that your device tree is correct, see below two files for more details:

    linux-kernel/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi

    linux-kernel/Documentation/devicetree/bindings/sound/tlv320aic3x.txt

    Check if your kernel boot log contains some errors/warnings relates to aic3104 codec configuration.

    Regards,
    Pavel

  • Pavel Botev said:

    Hi Samer,

    Do you use AM335x TI PSDK Linux v5.02 (kernel v4.14.79)?

    Do you use AM335x custom board?

    Yes and yes!

    Pavel Botev said:

    t seems to me that your device tree is correct, see below two files for more details:

    linux-kernel/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi

    linux-kernel/Documentation/devicetree/bindings/sound/tlv320aic3x.txt

    Check if your kernel boot log contains some errors/warnings relates to aic3104 codec configuration.

    Regards,
    Pavel

    This is exactly where I looked and got my device tree from before posting here. 

    And I do not see any warning or error in kernel boot log. I get audio on the headphone but not on the speaker pins.

    Thank you

  • Samer,

    I can be in help from AM335x McASP module side.

    "What do I need to add in my device tree to get audio on LEFT_LOP and RIGHT_LOP pins?"

    "I added audio routes for LLOUT and RLOUT, but I am not getting any audio on line out. "

    Can you please attach a scope to the AM335x McASP data out pin and check if you have there valid and expected signal? You can also check the other McASP pins (bit clock, frame sync). If audio data is transmitted successful from McASP module to the AIC3104 codec (through the data pin, AXR -> DIN), then your issue is related to the HW/SW of the AIC3104 codec and you need to seek for help in the Audio forum.

    Regards,
    Pavel
  • Pavel,

    I checked McASP signals and they look fine.

    How can I control LEFT-DAC and Right-DAC data path registers in my device tree?

    I would like to set the registers as in the highlighted part of the image below:

  • Samer,

    These registers belongs to the AIC3104 codec, and you need to check in Audio forum regarding how they are controlled.

    What I can say regarding AIC3104 codec configuration is that you can control AIC3104 codec settings from userspace with amixer tool. Check below user guide for details:

    software-dl.ti.com/.../Foundational_Components_Kernel_Drivers.html

    Regards,
    Pavel
  • Pavel,

    I followed the provided link and was able to get audio on Line out, but I am trying to get mono on line out.

    For mono configurations, I posted the question on Audio forum and got the response to "set page 0 register 7 D3-D4 to '11'. This means that the left DAC channel is automatically a mono mix of the left and right data received on the I2S bus. "


    But I don't know where to set these settings. I looked up amixer but did not find any settings to change values on this register. I would really appreciate if you can help me out.

    Thank you  


  • Samer,

    Regarding AIC3104 codec configuration, I can think of 3 possible places where you can check:

    1. amixer tool in userspace

    www.ti.com/.../sprac10.pdf - 6.4 Audio Playback is Muted

    processors.wiki.ti.com/.../AM335x_Audio_Driver's_Guide
    processors.wiki.ti.com/.../ALSA

    2. i2c tools in userspace, you can set AIC3104 registers with i2c commands (i2cset):

    software-dl.ti.com/.../Foundational_Components_Kernel_Drivers.html

    3. explore the AIC3104 codec driver and see if you can adjust it to your usecase:

    linux-kernel/sound/soc/codecs/tlv320aic3x.c


    Regards,
    Pavel
  • Pavel,

    I got it working! 

    I found the settings to route Left-DAC to play mono mix in "linux-kernel/sound/soc/codecs/tlv320aic3x.c" and "linux-kernel/sound/soc/codecs/tlv320aic3x.h"

    On line 1103 in tlv320aic3x.c

    data = (LDAC2LCH | RDAC2RCH);

    changed it to

    data = ( LDAC2MONOMIX | RDAC2RCH);

    I recompiled the Kernel and I also saw in my amixer settings my 'Line DAC' was ON but 'Line' setting was off. So I also turned on 'Line' and got the audio on LEFT_LOP/M.

    Thank you for the support!