Hi,
We connected a DSP (dirana3) as audio inputs to I2S3 and I2S4 of TX2 and connect a speaker as audio output to I2S1. Shown as below. See the attached device tree related to sound.
dirana3 -----------> (i2s3)
| TX2 (i2s1) -----------> speaker (A2B)
----------------> (i2s4)
Here i2s3/4 are configured as masters and i2s1 as slave.
I want to configure the audio processing such that the output of dirana3 goes to TX2 and I am able to hear it on the speaker. The input to I2s3 and I2S4 may be muxed. I have so far not had much luck in doing so.
Can you suggest a workable configuration using amixer.
As a starter, I tried this scenario:
#Configure speaker
amixer sset "MIXER1-1 Mux" "ADMAIF1"
amixer sset "AMX1-1 Mux" "MIXER1-1"
amixer sset "I2S1 Mux" "AMX1"
amixer sset "Adder1 RX1" on
amixer sset "Adder1 RX2" on
amixer sset "Mixer Enable" on
#play a wav file
aplay -D hw:0,0 -c 6 -f S32_LE /root/n51441.wav
I can not hear the sound, and the scope shows no fsync on I2S1 bus. Some debugging shows the audio driver complains the following (I put some lines in kernel/sound/soc/soc/soc-dapm.c …)
root@nvidia:~# aplay -D hw:0,8 -c 6 -f S32_LE /root/n51441.wav
Warning: format is changed to S16_LE
aying WAVE '/root/n51441.wav' :
Signed 16 bit Little Endian, Rate 44100 Hz, Channels 6
[ 111.130498] tegra210_i2s_runtime_resume ============>
[ 111.146679] snd_soc_dai_link_event source_p name (null). sink name (null)
[ 111.156272] source_p->source name I2S1 DAP Transmit. sname I2S1 DAP Transmit
[ 111.165447] source_p->sink name I2S1 DAP Transmit-d Playback. sname (null)
[ 111.172396] sink_p->source name I2S1 DAP Transmit-d Playback. sname (null)
[ 111.179367] sink_p->sink name d Playback. sname d Playback <---------------------- # 1
[ 111.184950] tegra210_i2s_hw_params ============> DAP, 8
[ 111.190251] ===> tegra210_i2s_hw_params format SNDRV_PCM_FORMAT_S32_LE
[ 111.196964] ===> tegra210_i2s_hw_params srate 0
[ 111.201659] ===> frame_format TEGRA210_I2S_CTRL_FRAME_FORMAT_FSYNC_MODE
[ 111.208455] tegra210_i2s_set_slot_ctrl =====> 8, ff, ff
[ 111.213707] tegra210_i2s_hw_params ============> -1, 1023, 0, 0, 32, 8
[ 111.220225] tegra210-i2s tegra210-i2s.0: Can't set channel bit count
[ 111.226589] tegra210-i2s tegra210-i2s.0: ASoC: can't set DAP hw params: -22
[ 111.233539] tegra186-snd-p2382 sound_ref: ASoC: PRE_PMU: I2S1 DAP Transmit-d Playback event failed: -22
[ 111.242938] snd_soc_dai_link_event source_p name (null). sink name (null)
[ 111.249818] source_p->source name I2S3 DAP Transmit. sname I2S3 DAP Transmit
[ 111.256960] source_p->sink name I2S3 DAP Transmit-x Playback. sname (null)
[ 111.263942] sink_p->source name I2S3 DAP Transmit-x Playback. sname (null)
[ 111.270889] sink_p->sink name x Playback. sname x Playback <--------------------- # 2
[ 111.276472] tegra210_i2s_hw_params ============> DAP, 8
[ 111.281771] ===> tegra210_i2s_hw_params format SNDRV_PCM_FORMAT_S32_LE
[ 111.288486] ===> tegra210_i2s_hw_params srate 48000
[ 111.293525] ===> frame_format TEGRA210_I2S_CTRL_FRAME_FORMAT_FSYNC_MODE
[ 111.300323] tegra210_i2s_set_slot_ctrl =====> 8, ff, ff
[ 111.305562] tegra210_i2s_hw_params ============> 255, 1023, 12288000, 48000, 32, 8
[ 111.313115] tegra210_i2s_set_slot_rate =====> 12288000
.....
aplay: pcm_write:1939: write error: Input/output error
I don’t understand why there are two “routes” (#1 and #2), one having the wrong setting (srate = 0).
For an experiment, I removed I2S3/4/6 from the dts (see the attached) and left only I2S1, then configure the same way and play the same file. Everything is fine then:
root@nvidia:~# aplay -D hw:0,8 -c 6 -f S32_LE /root/n51441.wav
Warning: format is changed to S16_LE
aying WAVE '/root/n51441.wav' :
Signed 16 bit Little Endian, Rate 44100 Hz, Channels 6
[ 566.997855] snd_soc_dai_link_event source_p name (null). sink name (null)
{ 567.010028] source_p->source name I2S1 DAP Transmit. sname I2S1 DAP Transmit
[ 567.022560] source_p->sink name I2S1 DAP Transmit-d Playback. sname (null)
[ 567.034156] sink_p->source name I2S1 DAP Transmit-d Playback. sname (null)
[ 567.043726] sink_p->sink name d Playback. sname d Playback
[ 567.051916] tegra210_i2s_hw_params ============> DAP, 8
[ 567.057243] ===> tegra210_i2s_hw_params format SNDRV_PCM_FORMAT_S32_LE
[ 567.063933] ===> tegra210_i2s_hw_params srate 44100
[ 567.068991] ===> frame_format TEGRA210_I2S_CTRL_FRAME_FORMAT_FSYNC_MODE
[ 567.075783] tegra210_i2s_set_slot_ctrl =====> 8, ff, ff
[ 567.081003] tegra210_i2s_hw_params ============> 255, 1023, 11289600, 44100, 32, 8
[ 567.088577] tegra210_i2s_set_slot_rate =====> 11289600
Looks like I2S3/4 are interfering with I2S. Any insight and recommendations?
Thanks a lot.
Jin
tegra186-sound.dts.txt (16.3 KB)
tegra186-sound-one-i2s.dts.txt (15.1 KB)