2 operation:
Porting tlv audio card on the TX2 develop kit. The project need playback only, so mic can be ingnored.
We connected audio card to TX2 via 40-pin expansion header or J21.
pin27 → SDL pin28-> SCL
tegra186-quill-common.dtsi & tegra_machine_driver_mobile.c have been modified.
The codec tlv driver has been added to kernel, and compiled successfully.
3 Problems:
the codec cannot be detected.
demesg shows that “no acknowledge from address 0x18”.
and no signal cought on the J21 pin27 & pin28 by the oscilloscope.
any help would be greate appreciate.
Regards
Henry
according to the following picture, pin27 & pin28 are i2c-1 bus, but when run the bash shell, pin27 & pin28 go flat line, and signal can be cought on the pin8. We are confused.
any help would be greately appreciate.
Regards
Henry
As per above your codec seems to have registered fine.
Can you attach the codec driver and complete dmesg log? If this error is seen from codec driver, generally probe() fails and codec registration should not happen. So this is bit confusing.
Can you confirm the I2C lines used by your audio card?
Please check if you see signals on pin-3 and pin-5 in case you are using I2C_GP0 lines.
Hi @spujar
Thanks for your reply!
The whole dmesg has been upload to henry_tlv0.log.
The codec driver is “tlv320aic32x4.c”, which you can see in the SDK. The codec driver has been rarely modified. only some debugs added.
static int aic32x4_codec_probe(struct snd_soc_codec *codec)
{
printk(KERN_ERR "henry debug aic3204 codec probe enter!!!!!!!!!!!!!!!!!!!\n");
struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec);
u32 tmp_reg;
if (gpio_is_valid(aic32x4->rstn_gpio)) {
ndelay(10);
gpio_set_value(aic32x4->rstn_gpio, 1);
}
snd_soc_write(codec, AIC32X4_RESET, 0x01);
/* Power platform configuration */
if (aic32x4->power_cfg & AIC32X4_PWR_MICBIAS_2075_LDOIN) {
snd_soc_write(codec, AIC32X4_MICBIAS, AIC32X4_MICBIAS_LDOIN |
AIC32X4_MICBIAS_2075V);
}
if (aic32x4->power_cfg & AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE)
snd_soc_write(codec, AIC32X4_PWRCFG, AIC32X4_AVDDWEAKDISABLE);
tmp_reg = (aic32x4->power_cfg & AIC32X4_PWR_AIC32X4_LDO_ENABLE) ?
AIC32X4_LDOCTLEN : 0;
snd_soc_write(codec, AIC32X4_LDOCTL, tmp_reg);
tmp_reg = snd_soc_read(codec, AIC32X4_CMMODE);
if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36)
tmp_reg |= AIC32X4_LDOIN_18_36;
if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED)
tmp_reg |= AIC32X4_LDOIN2HP;
snd_soc_write(codec, AIC32X4_CMMODE, tmp_reg);
/* Mic PGA routing */
if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K)
snd_soc_write(codec, AIC32X4_LMICPGANIN,
AIC32X4_LMICPGANIN_IN2R_10K);
else
snd_soc_write(codec, AIC32X4_LMICPGANIN,
AIC32X4_LMICPGANIN_CM1L_10K);
if (aic32x4->micpga_routing & AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K)
snd_soc_write(codec, AIC32X4_RMICPGANIN,
AIC32X4_RMICPGANIN_IN1L_10K);
else
snd_soc_write(codec, AIC32X4_RMICPGANIN,
AIC32X4_RMICPGANIN_CM1R_10K);
/*
* Workaround: for an unknown reason, the ADC needs to be powered up
* and down for the first capture to work properly. It seems related to
* a HW BUG or some kind of behavior not documented in the datasheet.
*/
tmp_reg = snd_soc_read(codec, AIC32X4_ADCSETUP);
snd_soc_write(codec, AIC32X4_ADCSETUP, tmp_reg |
AIC32X4_LADC_EN | AIC32X4_RADC_EN);
snd_soc_write(codec, AIC32X4_ADCSETUP, tmp_reg);
printk(KERN_ERR "henry debug aic3204 codec probe leave!!!!!!!!!!!!!!!!!!!\n");
return 0;
}
snd_soc_write() function results in “no acknowledge from address 0x18”.
Of course! no siginal cought on pin27 pin28, even no audio card connected on the headers.
Unfortunately, pin3 and pin5 are the same phenomena, no signal either.
From the logs you attached it seems like codec access seems to be failing. There is no direct codec access in aic32x4_probe(). The errors happening in codec_probe() are not captured and thus it goes ahead with registering codec. Can you confirm if you captured the logs with audio card connected?
Since i2cdetect command works, it means I2C bus is working fine. Not sure why you are not seeing signals with oscilloscope.
Please share the changes you made in DTSI file.
Also please share schematics of your audio card connection with TX2.
Hi @spujar
Thanks for your reply.
Yes, the dmesg log was captured with audio card connected.
We modifiled DTSI again, and now signal can be cought on i2c bus 1. The previous error “no acknowledge from address 0x18” has gone, which is comforting.
But the pin7 MCLK still goes flat line on the oscilloscope.
Could you give some advices on how to config MCLK, and how to set frequency.
And dmsg log shows that “Failed to add route x OUT → direct → x Headphone”
[ 4.559915] tegra-asoc: sound: ASoC: no source widget found for x OUT
[ 4.559917] tegra-asoc: sound: ASoC: Failed to add route x OUT -> direct -> x Headphone
[ 4.559936] tegra-asoc: sound: ASoC: no sink widget found for x IN
[ 4.559938] tegra-asoc: sound: ASoC: Failed to add route x Mic -> direct -> x IN
according to this topic, shell has been run, and audio debug log has been upload.
Regarde
Henry
How to open this schematic file? Or you can attach an image file for a quick view.
I see that you have commented out all routes under “nvidia,audio-routing” except following: "x Headphone", "x OUT";
So I am expecting only following errors the widgets are missing:
[ 4.559915] tegra-asoc: sound: ASoC: no source widget found for x OUT
[ 4.559917] tegra-asoc: sound: ASoC: Failed to add route x OUT -> direct -> x Headphone
Please see if there is any disconnect between logs and your DTSI file.
Hi @spujar
Thanks for your reply.
The Audio.SchDoc is edited by AD, so you can open it by Altium Designer. And we captured images for a quick view, which has been uploaded.
Only playback is needed on our project, so mic can be ignored.
In the dtsi, we commented “x OUT”, and add HPL & HPR.
the previous errors “no source widget found for x OUT” has gone. It seems that tegra-asoc runs well. dmesg has been uploaded to henry_tlv02.log.
we run the speaker-test command, but MCLK BCLK WCLK go flat line on the oscilloscope. No sound playback. So confused that how could I2C transactions perform well, without a nomal MCLK? So, could you give some advices no how to config MCLK.
echo 0 | sudo tee /sys/kernel/debug/tracing/trace
echo 0 | sudo tee /sys/kernel/debug/tracing/events/enable
echo 1 | sudo tee /sys/kernel/debug/tracing/tracing_on
echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_path/enable
echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_widget_power/enable
root@t-desktop:/home/t# speaker-test -D hw:tegrasndt186ref,0 -c 2 -r 48000 -F S16_LE -t sine -f 500
Playback device is hw:tegrasndt186ref,0
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 500.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 8192
Period size range from 32 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 2048
was set buffer_size = 8192
0 - Front Left
1 - Front Right
Time per period = 0.197480
0 - Front Left
1 - Front Right
Time per period = 0.202294
0 - Front Left
1 - Front Right
Time per period = 0.202225
0 - Front Left
1 - Front Right
sudo cat /sys/kernel/debug/tracing/trace
...
alsa-sink-ADMAI-7483 [003] .... 610.633346: snd_soc_dapm_path: *ADMAIF1 Receive <- (direct) <- Playback 1
alsa-sink-ADMAI-7483 [003] .... 610.633357: snd_soc_dapm_path: *ADMAIF1 Receive <- (direct) <- ADMAIF1 CIF Receive-ADMAIF1 Receive
speaker-test-8463 [000] .... 620.729798: snd_soc_dapm_path: *ADMAIF1 Receive <- (direct) <- Playback 1
speaker-test-8463 [000] .... 620.729804: snd_soc_dapm_path: *ADMAIF1 Receive <- (direct) <- ADMAIF1 CIF Receive-ADMAIF1 Receive
Good to know this part is resolved now. You are one step closer.
This does not look correct.
Can you follow Jetson-IO guide and configure these pins for I2S and MCLK functionality? Once configured, you can probe as well when playback is running.
We use jetson-io.py and enable aud_mclk pin7 i2s1. kernel_tegra186-quill-p3310-1000-c03-00-base-hdr40-user-custom.dtbo has been exported successfully. But, all changes not work.
it seems that Device-Tree Overlay not work.
Could you give more details?
OK, let me explain it.
We used jetson-io.py to enable aud_mclk and i2s1 in the “manually” mode, than saved. the screen showd that kernel_tegra186-quill-p3310-1000-c03-00-base-hdr40-user-custom.dtb had been exported.
rebooted device.
used jetson-io.py, it showed that aud_mclk and i2s1 were still disanled.
thanks for listing the right value.
but, whatever we did, our test results were always the following.
.So, we wonder, is there any method to modify DTS directly to enable aud_mclk and i2s1?
use busybox devmem to set value, than cat /sys/kernel/debug/tegra_pinctrl_reg | egrep ‘dap1|mclk’. it turns out that busybox realy works.
But, after reboot device, all these 5 regs goes back to previous status.
According to logs, jetson-io.py is used to modify DT. We expact other method to modify DTSI, and than “make dtbs”, reflash kernel-dtb.
We wonder which DTSI to modify, could you give some advice?