TLV320AIC32X4

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)

Although it is not the reason for your problem, but you mentioned first that the codec has the external frequency of 24MHz. Here is written only 12:
ti,codec-clock-rate = <12000000>;

Hi,

I also tried setting ti,codec-clock-rate = <24000000>; then also same errors.

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

I think these regulators are not necessary because you supply them in hardware anyway. Using dummy regulators is sufficient.

These are the problems to solve:
[ 15.986046] tlv320aic32x4 2-0018: Failed getting the mclk. The current implementation does not support the usage of this codec without mclk

[ 16.156996] tlv320aic32x4: probe of 2-0018 failed with error -2

[ 16.619921] ERROR: could not get clock /sound:mclk(0)

I have used this codec with imx6 and dm3730 without any issues but a kernels used were 3.0.15 and 3.2. Can’t help you with DTC config

[ 15.986046] tlv320aic32x4 2-0018: Failed getting the mclk. The current implementation does not support the usage of this codec without mclk

[ 16.156996] tlv320aic32x4: probe of 2-0018 failed with error -2

[ 16.619921] ERROR: could not get clock /sound:mclk(0)

I have solved the above errors & commented out aic32x4_setup_regulators function. after these changes following errors are coming

[ 18.295122] davinci_evm sound: ASoC: CODEC DAI hdmi-hifi not registered
[ 18.555250] davinci_evm sound: snd_soc_register_card failed (-517)

hdmi-hifi? You should disable it

Hi,

I disable hdmi-hifi & enabled tlv320aic32x4-hifi. Now the card is detected.

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] [] (unwind_backtrace) from [] (show_stack+0x20/0x24)
[ 15.286551] [] (show_stack) from [] (dump_stack+0x70/0xc0)
[ 15.293814] [] (dump_stack) from [] (warn_slowpath_common+0x88/0xc0)
[ 15.301944] [] (warn_slowpath_common) from [] (warn_slowpath_null+0x2c/0x34)
[ 15.310771] [] (warn_slowpath_null) from [] (clk_core_disable+0x88/0x1a8)
[ 15.319339] [] (clk_core_disable) from [] (clk_disable+0x34/0x40)
[ 15.327223] [] (clk_disable) from [] (aic32x4_set_bias_level+0xc4/0x194 [snd_soc_tlv320aic32x4])
[ 15.337821] [] (aic32x4_set_bias_level [snd_soc_tlv320aic32x4]) from [] (snd_soc_codec_set_bias_level+0x28/0x2c)
[ 15.349799] [] (snd_soc_codec_set_bias_level) from [] (snd_soc_dapm_set_bias_level+0x8c/0x204)
[ 15.360199] [] (snd_soc_dapm_set_bias_level) from [] (dapm_pre_sequence_async+0x50/0xb8)
[ 15.370073] [] (dapm_pre_sequence_async) from [] (async_run_entry_fn+0x70/0x1c0)
[ 15.379252] [] (async_run_entry_fn) from [] (process_one_work+0x148/0x474)
[ 15.387906] [] (process_one_work) from [] (worker_thread+0x3c/0x49c)
[ 15.396041] [] (worker_thread) from [] (kthread+0xe8/0x104)
[ 15.403393] [] (kthread) from [] (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] [] (unwind_backtrace) from [] (show_stack+0x20/0x24)
[ 16.492450] [] (show_stack) from [] (dump_stack+0x70/0xc0)
[ 16.499743] [] (dump_stack) from [] (warn_slowpath_common+0x88/0xc0)
[ 16.507876] [] (warn_slowpath_common) from [] (warn_slowpath_null+0x2c/0x34)
[ 16.516742] [] (warn_slowpath_null) from [] (clk_core_unprepare+0x94/0x1c4)
[ 16.525531] [] (clk_core_unprepare) from [] (clk_unprepare+0x30/0x38)
[ 16.533798] [] (clk_unprepare) from [] (aic32x4_set_bias_level+0xcc/0x194 [snd_soc_tlv320aic32x4])
[ 16.544613] [] (aic32x4_set_bias_level [snd_soc_tlv320aic32x4]) from [] (snd_soc_codec_set_bias_level+0x28/0x2c)
[ 16.556622] [] (snd_soc_codec_set_bias_level) from [] (snd_soc_dapm_set_bias_level+0x8c/0x204)
[ 16.567051] [] (snd_soc_dapm_set_bias_level) from [] (dapm_pre_sequence_async+0x50/0xb8)
[ 16.576955] [] (dapm_pre_sequence_async) from [] (async_run_entry_fn+0x70/0x1c0)
[ 16.586162] [] (async_run_entry_fn) from [] (process_one_work+0x148/0x474)
[ 16.594843] [] (process_one_work) from [] (worker_thread+0x3c/0x49c)
[ 16.603004] [] (worker_thread) from [] (kthread+0xe8/0x104)
[ 16.610382] [] (kthread) from [] (ret_from_fork+0x14/0x2c)
[ 16.646302] —[ end trace 0b906036d35f1a91 ]—

Hi,

Still not able to hear any sound from the codec. Below are some logs i have enabled some prints.

root@arm:~# aplay E2.wav
[ 39.250662]
[ 39.250662] ********* davinci_mcasp_startup ***********
[ 39.257491]
[ 39.257491] ********* evm_startup *********
Playing WAVE ‘E2.wav’ : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
[ 39.304634]
[ 39.304634] ********* evm_hw_params : 24000000 *********
[ 39.311824]
[ 39.311824] ********* davinci_mcasp_set_sysclk ***********
[ 39.321928]
[ 39.321928] ********* evm_hw_params : 24000000 *********
[ 39.357327]
[ 39.357327] ********* davinci_mcasp_calc_clk_div ***********
[ 39.364686] davinci-mcasp 48038000.mcasp: Sample-rate is off by 400 PPM
[ 39.376153]
[ 39.376153] ********* _davinci_mcasp_set_clkdiv ***********
[ 39.405694]
[ 39.405694] ********* davinci_mcasp_trigger ***********
[ 39.412465]
[ 39.412465] ********* davinci_mcasp_start ***********
[ 39.419022]
[ 39.419022] ********* mcasp_start_tx ***********
[ 39.425144]
[ 39.425144] ********* mcasp_set_ctl_reg ***********
[ 39.431526]
[ 39.431526] ********* mcasp_set_ctl_reg ***********
[ 39.437908]
[ 39.437908] ********* mcasp_set_ctl_reg ***********
[ 39.444290]
[ 39.444290] ********* mcasp_set_ctl_reg ***********
[ 39.450672]
[ 39.450672] ********* mcasp_set_ctl_reg ***********
[ 44.454860]
[ 44.454860] ********* davinci_mcasp_trigger ***********
[ 44.461676]
[ 44.461676] ********* davinci_mcasp_stop ***********
[ 44.468169]
[ 44.468169] ********* mcasp_stop_tx ***********
[ 44.474225]
[ 44.474225] ********* mcasp_is_synchronous ***********
[ 44.486497]
[ 44.486497] ********* davinci_mcasp_dai_probe ***********
[ 44.499382]
[ 44.499382] ********* evm_shutdown *********

Don’t forget to unmute all outputs in alsamixer

How did you solve the failed gettin mclk error?

Hii all,
Did any one solve this error.
Even I am not getting MCLK and BCLK.

-Vidhya