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.

Beaglebone Black + Audio codec TLV320AIC32x4

Other Parts Discussed in Thread: TLV320AIC3254

Hi,

Interfacing TLV320AIC3254 with beaglebone black. Unable to play .wav with aplay. Below are my configurations, please let me know where i am going wrong.

Kernel : 4.1
Rootfs : Debian

Clock source TLV320AIC3254 : Externel 24Mhz


Device Tree:

    bone_audio_cape_audio_pins: pinmux_bone_audio_cape_audio_

pins {
        pinctrl-single,pins = <
            0x1ac (PIN_INPUT | MUX_MODE0)                      /* mcasp0_ahclkx, */
            0x19c (PIN_OUTPUT_PULLUP | MUX_MODE2)    /* mcasp0_ahclkr, */
            0x194 (PIN_OUTPUT_PULLUP | MUX_MODE0)   /* mcasp0_fsx,      */
            0x190 (PIN_OUTPUT_PULLUP | MUX_MODE0)   /* mcasp0_aclkr.mcasp0_aclkx */
            0x198 (PIN_OUTPUT_PULLUP | MUX_MODE0)
        >;
    };

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

    status = "okay";
    clock-frequency = <100000>;
    tlv320aic32x4: tlv320aic32x4@18 {
        compatible = "ti,tlv320aic32x4";
        reg = <0x18>;
        status = "okay";
    };
};
&mcasp0    {

    pinctrl-names = "default";
    pinctrl-0 = <&bone_audio_cape_audio_pins>;

    status = "okay";

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

    sound {
        compatible = "ti,beaglebone-black-audio";
        ti,model = "TI BeagleBone Black";
        ti,audio-codec = <&tlv320aic32x4>;
        ti,mcasp-controller = <&mcasp0>;
        ti,codec-clock-rate = <12000000>;
        ti,audio-routing =
            "Headphone Jack",       "HPLOUT",
            "Headphone Jack",       "HPROUT",
            "LINE1L",               "Line In",
            "LINE1R",               "Line In";
        clock-names = "mclk";
    };

dmesg log:

[   15.986046] tlv320aic32x4 2-0018: Failed getting the mclk. The current implementation does not support the usage of this codec without mclk
[   16.125732] tilcdc 4830e000.lcdc: no encoders/connectors found
[   16.156996] tlv320aic32x4: probe of 2-0018 failed with error -2
[   16.181105] tilcdc 4830e000.lcdc: failed to initialize mode setting
[   16.309482] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
[   16.619921] ERROR: could not get clock /sound:mclk(0)
[   16.625080] davinci_evm sound: ASoC: CODEC DAI hdmi-hifi not registered
[   16.773564] davinci_evm sound: snd_soc_register_card failed (-517)
  • Hi,

    Besides the device tree, there are some codec specific & machine layer configurations you need to do.
    Check the audio dac example, procedure is explained there: processors.wiki.ti.com/.../Sitara_Linux_Audio_DAC_Example

    Best Regards,
    Yordan
  • Hi Yordan,

    Thanks for the info. I am failing in defining regulators for TLV320AIC32X4 driver in Device tree, it requires ldoin, iov, dv, av. Following is the errors coming in dmesg.

    [ 16.607195] 2-0018 supply iov not found, using dummy regulator
    [ OK ] Started Update UTMP about System Boot/Shutdown.
    [ 16.773985] tilcdc 4830e000.lcdc: no encoders/connectors found
    [ 16.801256] tlv320aic32x4 2-0018: Missing supply 'dv' or 'ldoin'
    [ 16.827132] tilcdc 4830e000.lcdc: failed to initialize mode setting
    [ 16.888978] tlv320aic32x4 2-0018: Failed to setup regulators
  • Now i am able to detect the card.

    root@arm:~# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: Black [TI BeagleBone Black], device 0: AIC32X4 tlv320aic32x4-hifi-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0

    But boot messages throws errors

    [ 13.719312] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
    [ 13.756419] tilcdc 4830e000.lcdc: no encoders/connectors found
    [ 13.792712] tilcdc 4830e000.lcdc: failed to initialize mode setting
    [ 14.343914] tlv320aic32x4 2-0018: ASoC: no source widget found for HPLOUT
    [ 14.384486] tlv320aic32x4 2-0018: ASoC: Failed to add route HPLOUT -> direct -> Headphone Jack
    [ 14.428223] tlv320aic32x4 2-0018: ASoC: no source widget found for HPROUT
    [ 14.435074] tlv320aic32x4 2-0018: ASoC: Failed to add route HPROUT -> direct -> Headphone Jack
    [ 14.599897] tlv320aic32x4 2-0018: ASoC: no source widget found for LLOUT
    [ 14.668161] tlv320aic32x4 2-0018: ASoC: Failed to add route LLOUT -> direct -> Line Out
    [ 14.749106] tlv320aic32x4 2-0018: ASoC: no source widget found for RLOUT
    [ 14.852738] tlv320aic32x4 2-0018: ASoC: Failed to add route RLOUT -> direct -> Line Out
    [ 14.889580] tlv320aic32x4 2-0018: ASoC: no sink widget found for MIC3L
    [ 14.896171] tlv320aic32x4 2-0018: ASoC: Failed to add route Mic Bias -> direct -> MIC3L
    [ 14.964687] tlv320aic32x4 2-0018: ASoC: no sink widget found for MIC3R
    [ 15.006855] tlv320aic32x4 2-0018: ASoC: Failed to add route Mic Bias -> direct -> MIC3R
    [ 15.026121] tlv320aic32x4 2-0018: ASoC: no source widget found for Mic Jack
    [ 15.037345] tlv320aic32x4 2-0018: ASoC: Failed to add route Mic Jack -> direct -> Mic Bias
    [ 15.054627] tlv320aic32x4 2-0018: ASoC: no sink widget found for LINE1L
    [ 15.063343] tlv320aic32x4 2-0018: ASoC: Failed to add route Line In -> direct -> LINE1L
    [ 15.077925] tlv320aic32x4 2-0018: ASoC: no sink widget found for LINE2L
    [ 15.085869] tlv320aic32x4 2-0018: ASoC: Failed to add route Line In -> direct -> LINE2L
    [ 15.103363] tlv320aic32x4 2-0018: ASoC: no sink widget found for LINE1R
    [ 15.110227] tlv320aic32x4 2-0018: ASoC: Failed to add route Line In -> direct -> LINE1R
    [ 15.124383] tlv320aic32x4 2-0018: ASoC: no sink widget found for LINE2R
    [ 15.157657] tlv320aic32x4 2-0018: ASoC: Failed to add route Line In -> direct -> LINE2R
    [ 15.182209] davinci_evm sound: tlv320aic32x4-hifi <-> 48038000.mcasp mapping ok
    [ 15.234520] ------------[ cut here ]------------
    [ 15.239219] WARNING: CPU: 0 PID: 48 at drivers/clk/clk.c:1010 clk_core_disable+0x88/0x1a8()
    [ 15.247607] Modules linked in: snd_soc_evm(+) tilcdc omap_rng rng_core snd_soc_tlv320aic32x4 snd_soc_davinci_mcasp snd_soc_edma uio_pdrv_geo
    [ 15.260968] CPU: 0 PID: 48 Comm: kworker/u2:1 Not tainted 4.1.3+ #3
    [ 15.267259] Hardware name: Generic AM33XX (Flattened Device Tree)
    [ 15.273389] Workqueue: events_unbound async_run_entry_fn
    [ 15.278763] [<c0019a34>] (unwind_backtrace) from [<c001408c>] (show_stack+0x20/0x24)
    [ 15.286551] [<c001408c>] (show_stack) from [<c097cb6c>] (dump_stack+0x70/0xc0)
    [ 15.293814] [<c097cb6c>] (dump_stack) from [<c0044ecc>] (warn_slowpath_common+0x88/0xc0)
    [ 15.301944] [<c0044ecc>] (warn_slowpath_common) from [<c0044f30>] (warn_slowpath_null+0x2c/0x34)
    [ 15.310771] [<c0044f30>] (warn_slowpath_null) from [<c07da874>] (clk_core_disable+0x88/0x1a8)
    [ 15.319339] [<c07da874>] (clk_core_disable) from [<c07db0d0>] (clk_disable+0x34/0x40)
    [ 15.327223] [<c07db0d0>] (clk_disable) from [<bf03357c>] (aic32x4_set_bias_level+0xc4/0x194 [snd_soc_tlv320aic32x4])
    [ 15.337821] [<bf03357c>] (aic32x4_set_bias_level [snd_soc_tlv320aic32x4]) from [<c08186e4>] (snd_soc_codec_set_bias_level+0x28/0x2c)
    [ 15.349799] [<c08186e4>] (snd_soc_codec_set_bias_level) from [<c081fb00>] (snd_soc_dapm_set_bias_level+0x8c/0x204)
    [ 15.360199] [<c081fb00>] (snd_soc_dapm_set_bias_level) from [<c082085c>] (dapm_pre_sequence_async+0x50/0xb8)
    [ 15.370073] [<c082085c>] (dapm_pre_sequence_async) from [<c00656e4>] (async_run_entry_fn+0x70/0x1c0)
    [ 15.379252] [<c00656e4>] (async_run_entry_fn) from [<c005c994>] (process_one_work+0x148/0x474)
    [ 15.387906] [<c005c994>] (process_one_work) from [<c005cd40>] (worker_thread+0x3c/0x49c)
    [ 15.396041] [<c005cd40>] (worker_thread) from [<c006251c>] (kthread+0xe8/0x104)
    [ 15.403393] [<c006251c>] (kthread) from [<c0010648>] (ret_from_fork+0x14/0x2c)
    [ 15.410647] ---[ end trace 0b906036d35f1a90 ]---
    [ 16.429826] ------------[ cut here ]------------
    [ 16.435259] WARNING: CPU: 0 PID: 48 at drivers/clk/clk.c:909 clk_core_unprepare+0x94/0x1c4()
    [ 16.446093] Modules linked in: snd_soc_evm(+) tilcdc omap_rng rng_core snd_soc_tlv320aic32x4 snd_soc_davinci_mcasp snd_soc_edma uio_pdrv_geo
    [ 16.465157] CPU: 0 PID: 48 Comm: kworker/u2:1 Tainted: G W 4.1.3+ #3
    [ 16.473024] Hardware name: Generic AM33XX (Flattened Device Tree)
    [ 16.479242] Workqueue: events_unbound async_run_entry_fn
    [ 16.484617] [<c0019a34>] (unwind_backtrace) from [<c001408c>] (show_stack+0x20/0x24)
    [ 16.492450] [<c001408c>] (show_stack) from [<c097cb6c>] (dump_stack+0x70/0xc0)
    [ 16.499743] [<c097cb6c>] (dump_stack) from [<c0044ecc>] (warn_slowpath_common+0x88/0xc0)
    [ 16.507876] [<c0044ecc>] (warn_slowpath_common) from [<c0044f30>] (warn_slowpath_null+0x2c/0x34)
    [ 16.516742] [<c0044f30>] (warn_slowpath_null) from [<c07da4c8>] (clk_core_unprepare+0x94/0x1c4)
    [ 16.525531] [<c07da4c8>] (clk_core_unprepare) from [<c07db10c>] (clk_unprepare+0x30/0x38)
    [ 16.533798] [<c07db10c>] (clk_unprepare) from [<bf033584>] (aic32x4_set_bias_level+0xcc/0x194 [snd_soc_tlv320aic32x4])
    [ 16.544613] [<bf033584>] (aic32x4_set_bias_level [snd_soc_tlv320aic32x4]) from [<c08186e4>] (snd_soc_codec_set_bias_level+0x28/0x2c)
    [ 16.556622] [<c08186e4>] (snd_soc_codec_set_bias_level) from [<c081fb00>] (snd_soc_dapm_set_bias_level+0x8c/0x204)
    [ 16.567051] [<c081fb00>] (snd_soc_dapm_set_bias_level) from [<c082085c>] (dapm_pre_sequence_async+0x50/0xb8)
    [ 16.576955] [<c082085c>] (dapm_pre_sequence_async) from [<c00656e4>] (async_run_entry_fn+0x70/0x1c0)
    [ 16.586162] [<c00656e4>] (async_run_entry_fn) from [<c005c994>] (process_one_work+0x148/0x474)
    [ 16.594843] [<c005c994>] (process_one_work) from [<c005cd40>] (worker_thread+0x3c/0x49c)
    [ 16.603004] [<c005cd40>] (worker_thread) from [<c006251c>] (kthread+0xe8/0x104)
    [ 16.610382] [<c006251c>] (kthread) from [<c0010648>] (ret_from_fork+0x14/0x2c)
    [ 16.646302] ---[ end trace 0b906036d35f1a91 ]---