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.

AM335x- audio not working with TLV320AIC3106 codec.

Other Parts Discussed in Thread: TLV320AIC3106

Hi,

I am using custom make board with AM-3358 based board with TLV320aIC3106 codec.

After following the instructions on am335x-audio driver guide I have added a device tree entries, configured a kernel for ALSA sound modules.

But I am getting following error. I have added

################################################################################
Kernel log during boot up:

INIT: version 2.88 booting
Error opening /dev/fb0: No such file or directory
Starting udev
[    2.788874] udevd[802]: starting version 182
[    3.354402] PM: CM3 Firmware Version = 0x186
[    3.523565] c_can_platform 481cc000.d_can: c_can_platform device registered (regs=fa1cc000, irq=68)
[    3.698333] c_can_platform 481d0000.d_can: can't request region for resource [mem 0x44e10644-0x44e10647]
[    3.708544] c_can_platform 481d0000.d_can: control memory is not used for raminit
[    3.837983] inside aic31xx_device_init
[    3.842227]
[    3.842227] audio coded RSTn GPIO = 45
[    3.857107] c_can_platform 481d0000.d_can: c_can_platform device registered (regs=fa1d0000, irq=71)
[    3.889015] tlv320aic31xx-codec 1-001b: Failed to get supply 'HPVDD': -19
[    3.896210] tlv320aic31xx-codec 1-001b: Failed to request supplies: -19
[    6.610898] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[    6.759140] musb-hdrc musb-hdrc.0.auto: Enabled SW babble control
[    6.767272] musb-hdrc musb-hdrc.0.auto: MUSB HDRC host driver
[    6.870724] musb-hdrc musb-hdrc.0.auto: new USB bus registered, assigned bus number 1
[    6.925845] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    6.933122] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    6.940764] usb usb1: Product: MUSB HDRC host driver
[    6.946005] usb usb1: Manufacturer: Linux 3.12.10-ti2013.12.01 musb-hcd
[    6.953001] usb usb1: SerialNumber: musb-hdrc.0.auto
[    7.117161] hub 1-0:1.0: USB hub found
[    7.130972] hub 1-0:1.0: 1 port detected
[    7.144785] musb-hdrc musb-hdrc.1.auto: Enabled SW babble control
[    7.162056] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    7.168924] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 2
[    7.177426] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    7.184643] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    7.192284] usb usb2: Product: MUSB HDRC host driver
[    7.197523] usb usb2: Manufacturer: Linux 3.12.10-ti2013.12.01 musb-hcd
[    7.204518] usb usb2: SerialNumber: musb-hdrc.1.auto
[    7.210989] hub 2-0:1.0: USB hub found
[    7.214997] hub 2-0:1.0: 1 port detected
Starting Bootlog daemon: bootlogd: cannot allocate pseudo tty: No such file or directory
bootlogd.
[    7.379899] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered
[    7.829099] musb-hdrc musb-hdrc.1.auto: VBUS_ERROR in a_wait_vrise (80, <SessEnd), retry #3, port1 0008010c
ALSA: Restoring mixer settings...
/usr/sbin/alsactl: load_state:1696: No soundcards found...
Configuring network interfaces... ifconfig: SIOCGIFFLAGS: No such device
done.



################################################################################
On inserting tlv320aic31xx kernel module:

[   88.708956] inside aic31xx_device_init
[   88.713065] of_get_named_gpio_flags exited with status 45
[   88.718846]
[   88.718846] audio coded RSTn GPIO = 45
[   88.724912] tlv320aic31xx-codec 1-001b: Failed to get supply 'HPVDD': -19
[   88.732128] tlv320aic31xx-codec 1-001b: Failed to request supplies: -19


################################################################################
cat /proc/modules output:

root@am335x-evm:/dev/snd# cat /proc/modules
snd_soc_evm 7298 0 - Live 0xbf1d5000
snd_soc_davinci_mcasp 9484 0 - Live 0xbf1cf000
snd_soc_davinci 5438 1 snd_soc_davinci_mcasp, Live 0xbf1ca000
snd_soc_tlv320aic31xx 17697 0 - Live 0xbf1c1000
snd_rawmidi 16841 0 - Live 0xbf18e000
musb_dsps 6511 0 - Live 0xbf13d000
musb_hdrc 52593 1 musb_dsps, Live 0xbf117000
wlcore_sdio 4233 0 - Live 0xbf112000
snd_soc_core 99221 4 snd_soc_evm,snd_soc_davinci_mcasp,snd_soc_davinci,snd_soc_tlv320aic31xx, Live 0xbf0a3000
regmap_spi 1469 1 snd_soc_core, Live 0xbf09f000
snd_pcm 66734 3 snd_soc_evm,snd_soc_davinci,snd_soc_core, Live 0xbf067000
c_can_platform 4176 0 - Live 0xbf05d000
snd_timer 16028 1 snd_pcm, Live 0xbf04b000
ti_am335x_adc 3183 0 - Live 0xbf047000
snd_page_alloc 4843 1 snd_pcm, Live 0xbf03b000
snd_compress 7419 1 snd_soc_core, Live 0xbf031000
industrialio 32701 1 ti_am335x_adc, Live 0xbf020000
snd 45368 5 snd_rawmidi,snd_soc_core,snd_pcm,snd_timer,snd_compress, Live 0xbf00a000
soundcore 4767 1 snd, Live 0xbf004000
musb_am335x 1199 0 [permanent], Live 0xbf000000





################################################################################
aplay output

root@am335x-evm:/dev/snd# aplay
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4246:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4246:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4246:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4725:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM default
aplay: main:696: audio open error: No such file or directory

Following are the device tree entries.

mcasp0_pins: mcasp0_pins {
            pinctrl-single,pins = <
                0x60 (PIN_INPUT_PULLDOWN | MUX_MODE6)
                0x64 (PIN_INPUT_PULLDOWN | MUX_MODE6)
                0x68 (PIN_OUTPUT_PULLDOWN | MUX_MODE6)
                0x6C (PIN_INPUT_PULLDOWN | MUX_MODE6)
            >;
        };

        mcasp0_sleep_pins: mcasp0_sleep_pins {
            pinctrl-single,pins = <
                0x60 (PIN_INPUT_PULLDOWN | MUX_MODE7)
                0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7)
                0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7)
                0x6C (PIN_INPUT_PULLDOWN | MUX_MODE7)
            >;
        };

tlv320aic310x: tlv320aic310x@1b {
                compatible = "ti,tlv320aic310x";
                reg = <0x1b>;
                gpio-reset = <&gpio1 13 0>;
                status = "okay";
                #if 0
                /* Regulators */
                AVDD-supply = <&vaux2_reg>;
                IOVDD-supply = <&vaux2_reg>;
                DRVDD-supply = <&vaux2_reg>;
                DVDD-supply = <&vbat>;
                #endif
            };

sound {
            compatible = "ti,da850-evm-audio";
            ti,model = "DA850-EVM";
            ti,audio-codec = <&tlv320aic310x>;
            ti,mcasp-controller = <&mcasp0>;
            ti,codec-clock-rate = <12000000>;
            ti,audio-routing =
                "Headphone Jack",       "HPLOUT",
                "Headphone Jack",       "HPROUT",
                "LINE1L",               "Line In",
                "LINE1R",               "Line In";
        };

Regulators part is commented as we are not using any regulator IC but the power supplies can be switch ON-OFF using specific a GPIO pins.

Thanks & Regards,

Uday

  • Hi Uday,

    What about the codec I2C configuration interface?

  • Hi,
    Codec is connected on I2C1 interface.
    i2c1: i2c@4802a000 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2c1_pins>;
    status = "okay";
    clock-frequency = <100000>;

    Thanks & Regards,
    Uday
  • Above is my audio codec  interface.

    Thanks &Regards,

    Uday

  • Do you have this device registered on the I2C bus?

  • I suggest you check the device tree files for Starter Kit as a reference. It has an Audio codec onboard.

  • Hi,
    Without using audio modules if I give reset to codec device gets register on I2C bus with address 0x1b . but when audio modules gets loaded and I get UU when checking with i2cdetect command.
    Thanks & Regards,
    Uday
  • Hi Biser,
    I tried all instructions in sitara guides. My problem is Sound card is not getting generating in /dev/snd/ .To remove a error "tlv320aic31xx-codec 1-001b: Failed to get supply 'HPVDD': -19" I have commented a following code as I am not using any regulator IC.
    file name :- tlv320aic31xx.c
    #if 0
    for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++)
    aic31xx->supplies[i].supply = aic31xx_supply_names[i];

    ret = devm_regulator_bulk_get(aic31xx->dev,
    ARRAY_SIZE(aic31xx->supplies),
    aic31xx->supplies);
    if (ret != 0) {
    dev_err(aic31xx->dev, "Failed to request supplies: %d\n", ret);
    goto gpio_free;
    }

    gpio_free:
    if (aic31xx->pdata.gpio_reset)
    gpio_free(aic31xx->pdata.gpio_reset);
    #endif

    I am even not able to get any no sound card -found error also but cant see any sound card .

    Please let me know if any thing I am missing.
    I have probed the BCLK, WCLK but not getting any clock there .

    Thanks & Regards,
    Uday Rajeshirke.
  • Hi,
    following are the device tree entries we are using. Along with these device entries we have done changes in tlv320aic3x.c to by pass the bulk_regulator calls as we have comented same in device tree also.
    With this now sound card detection, sound device creations is happening properly.
    aplay comand is also working fine , we dont get any error . Message shows playing properly but no audio is hearable from codec output.
    Codec output is connected to power amplifier.
    I think we are missing some where on audio-routing. Need your help is understanding I2S audio channels out put path from codec.

    mcasp0_pins: mcasp0_pins {
    pinctrl-single,pins = <
    0x60 (PIN_INPUT_PULLDOWN | MUX_MODE6)
    0x64 (PIN_INPUT_PULLDOWN | MUX_MODE6)
    0x68 (PIN_OUTPUT_PULLDOWN | MUX_MODE6)
    0x6C (PIN_INPUT_PULLDOWN | MUX_MODE6)
    >;
    };

    mcasp0_sleep_pins: mcasp0_sleep_pins {
    pinctrl-single,pins = <
    0x60 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x6C (PIN_INPUT_PULLDOWN | MUX_MODE7)
    >;
    };
    i2c1: i2c@4802a000 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2c1_pins>;
    status = "okay";
    clock-frequency = <100000>;

    tlv320aic3106: tlv320aic3106@1b {
    compatible = "ti,tlv320aic3106";
    reg = <0x1b>;
    gpio-reset = <&gpio1 13 0>;
    status = "okay";
    #if 0
    /* Regulators */
    AVDD-supply = <&vaux2_reg>;
    IOVDD-supply = <&vaux2_reg>;
    DRVDD-supply = <&vaux2_reg>;
    DVDD-supply = <&vbat>;
    #endif
    };
    sound {
    compatible = "ti,da830-evm-audio";
    ti,model = "AM335x-EVM";
    ti,audio-codec = <&tlv320aic3106>;
    ti,mcasp-controller = <&mcasp0>;
    ti,codec-clock-rate = <24000000>;
    ti,audio-routing =
    "Headphone Jack", "HPLOUT",
    "Headphone Jack", "HPROUT",
    "LINE1L", "Line In",
    "LINE1R", "Line In";
    };

    &mcasp0 {
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&mcasp0_pins>;
    pinctrl-1 = <&mcasp0_sleep_pins>;

    status = "okay";

    op-mode = <0>; /* MCASP_IIS_MODE */
    tdm-slots = <2>;
    /* 16 serializer */
    serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
    0 0 1 2
    >;
    tx-num-evt = <32>;
    rx-num-evt = <32>;
    };

    Thanks & Regards,
    Uday
  • Uday Rajeshirke. said:
    I think we are missing some where on audio-routing. Need your help is understanding I2S audio channels out put path from codec.

    Please ask on the dedicated Codec forum: http://e2e.ti.com/support/data_converters/audio_converters/f/64  

  • Hi Biser,
    Thanks for reply.
    My problem got solved by changing following in device tree.
    serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
    0 0 1 2

    Thanks & Regards,
    Uday Rajeshirke.
  • Hi,
    Followign entry worked. Previously copied wrong entry for your review.
    serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
    1 2 0 0

    Thanks & Regards,
    Uday Rajeshirke.
  • Dear Uday,

    Does your codec work ok now?  I wonder SAIF0_MCLK connect  which pin of AM335x?

    have you test the clock on GPMC_A8 and GPMC_A9?