Other Parts Discussed in Thread: TLV320AIC3254, TPS65910
Tool/software: Linux
Hi:
we are developing a customized board based on AM3354.
our BSP is ti-processor-sdk-linux-am335x-evm-03.02.00.05
we use tlv320aic3254 as the codec chip and connect it to AM3354 on mcasp0.
the hardware connection of I2S bus is like this:
AM3354 TLV320AIC3254
MCASP0_ACLKX <- BCLK McASP transmit bit clock.
MCASP0_FSX <- WCLK McASP transmit frame sync or left/right clock (LRCLK)
MCASP0_AXR0 -> DIN
MCASP0_AXR1 <- DOUT
For TLV320AIC3254.We have a microphone connected to IN1L and IN1R. and we have a headphone connected to HPL and HPR of TLV320AIC3254
Here is my dts file configuration:
sound {
compatible = "simple-audio-card";
simple-audio-card,name = "tlv320aic32x4";
simple-audio-card,widgets =
"Headphone", "Headphone Jack",
"Line", "Line In";
simple-audio-card,routing =
"Headphone Jack", "HPL",
"Headphone Jack", "HPR",
"IN1_L", "Line In",
"IN1_R", "Line In";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&sound_master>;
simple-audio-card,frame-master = <&sound_master>;
simple-audio-card,bitclock-inversion;
simple-audio-card,cpu {
sound-dai = <&mcasp0>;
};
sound_master: simple-audio-card,codec {
sound-dai = <&tlv320aic32x4>;
system-clock-frequency = <12000000>;
};
};
....
i2c1_pins: pinmux_i2c1_pins {
pinctrl-single,pins = <
0x168 (PIN_INPUT_PULLUP | MUX_MODE3) /* uart0_ctsn.i2c1_sda AM335X_I2C1_SDA */
0x16C (PIN_INPUT_PULLUP | MUX_MODE3) /* uart0_rtsn.i2c1_scl AM335X_I2C1_SCL */
>;
};
...
mcasp0_pins: mcasp0_pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x9A8, PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_axr1.mcasp0_axr1 AM335X_MCASP0_AXR1 */
AM33XX_IOPAD(0x998, PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_axr0.mcasp0_axr0 AM335X_MCASP0_AXR0 */
AM33XX_IOPAD(0x994, PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_fsx.mcasp0_fsx AM335X_MCASP0_FSX */
AM33XX_IOPAD(0x990, PIN_INPUT_PULLDOWN | MUX_MODE0) /* mcasp0_aclkx.mcasp0_aclkx AM335X_MCASP0_ACLKX */
>;
};
....
&i2c1 {
pinctrl-names = "default";
pinctrl-0 = <&i2c1_pins>;
status = "okay";
clock-frequency = <100000>;
tlv320aic32x4: tlv320aic32x4@18 {
#sound-dai-cells = <0>;
compatible = "ti,tlv320aic32x4";
reg = <0x18>;
};
};
...
&mcasp0 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&mcasp0_pins>;
status = "okay";
op-mode = <0>; /* MCASP_IIS_MODE */
tdm-slots = <2>; /* Indicates number of channels transmitted or received over one serializer. */
serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
1 2 0 0
>;
tx-num-evt = <32>;
rx-num-evt = <32>;
};
so.
after booting up the linux.we can see the kernel log like this:
asoc-simple-card sound: tlv320aic32x4-hifi <-> 48038000.mcasp mapping ok
ALSA device list:
#0: AM335x-EVM
and because i found that the alsa-lib and alsa-utils are already in place in the ti sdk rootfs.
without any configuration on asound.conf
i just did this:
root@am335x-evm:/home# aplay -vvv s.wav
Playing WAVE 's.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Plug PCM: Hardware PCM card 0 'tlv320aic32x4' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 44100
exact rate : 44100 (44100/1)
msbits : 16
buffer_size : 22052
period_size : 5513
period_time : 125011
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 5513
period_event : 0
start_threshold : 22052
stop_threshold : 22052
silence_threshold: 0
silence_size : 0
boundary : 1445199872
appl_ptr : 0
hw_ptr : 0
Max peak (11026 samples): 0x00000000 # 0%
Max peak (11026 samples): 0x00000002 # 0%
Max peak (11026 samples): 0x00000004 # 0%
Max peak (11026 samples): 0x00000005 # 0%
Max peak (64 samples): 0x00000004 # 0%
aplay: pcm_write:1940: write error: Input/output error
there is no sound coming from the headphone...and after some time.the aplay just stopped with this error "aplay: pcm_write:1940: write error: Input/output error"
Here are some additional information i got:
root@am335x-evm:/home# ls -l /dev/snd/
drwxr-xr-x 2 root root 60 Feb 10 08:57 by-path
crw-rw---- 1 root audio 116, 2 Feb 10 08:57 controlC0
crw-rw---- 1 root audio 116, 4 Feb 10 08:57 pcmC0D0c
crw-rw---- 1 root audio 116, 3 Feb 10 08:57 pcmC0D0p
crw-rw---- 1 root audio 116, 33 Feb 10 08:57 timer
root@am335x-evm:/home# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: tlv320aic32x4 [tlv320aic32x4], device 0: davinci-mcasp.0-tlv320aic32x4-hifi tlv320aic32x4-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
root@am335x-evm:/home# aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
default:CARD=tlv320aic32x4
tlv320aic32x4,
Default Audio Device
sysdefault:CARD=tlv320aic32x4
tlv320aic32x4,
Default Audio Device
root@am335x-evm:/home# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: tlv320aic32x4 [tlv320aic32x4], device 0: davinci-mcasp.0-tlv320aic32x4-hifi tlv320aic32x4-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
root@am335x-evm:/home# cat /proc/asound/card0/pcm0c/info
card: 0
device: 0
subdevice: 0
stream: CAPTURE
id: davinci-mcasp.0-tlv320aic32x4-hifi tlv320aic32x4-hifi-0
name:
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
root@am335x-evm:/home# cat /proc/asound/card0/
id pcm0c/ pcm0p/
root@am335x-evm:/home# cat /proc/asound/card0/pcm0p/
info sub0/
root@am335x-evm:/home# cat /proc/asound/card0/pcm0p/info
card: 0
device: 0
subdevice: 0
stream: PLAYBACK
id: davinci-mcasp.0-tlv320aic32x4-hifi tlv320aic32x4-hifi-0
name:
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
root@am335x-evm:/home# ami
amidi amixer
root@am335x-evm:/home# amixer
Simple mixer control 'PCM',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 175
Mono:
Front Left: Playback 87 [50%] [-20.00dB]
Front Right: Playback 87 [50%] [-20.00dB]
Simple mixer control 'Mic PGA',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [off]
Front Right: Playback [off]
Simple mixer control 'ADC Level',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 64
Front Left: 24 [38%] [0.00dB]
Front Right: 24 [38%] [0.00dB]
Simple mixer control 'ADCFGA Left Mute',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control 'ADCFGA Right Mute',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control 'AGC Attack Time',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 31
Front Left: 0 [0%]
Front Right: 0 [0%]
Simple mixer control 'AGC Decay Time',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 31
Front Left: 0 [0%]
Front Right: 0 [0%]
Simple mixer control 'AGC Gain Hysteresis',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 3
Front Left: 0 [0%]
Front Right: 0 [0%]
Simple mixer control 'AGC Hysteresis',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 3
Front Left: 0 [0%]
Front Right: 0 [0%]
Simple mixer control 'AGC Left',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'AGC Max PGA',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 127
Front Left: 127 [100%]
Front Right: 127 [100%]
Simple mixer control 'AGC Noise Debounce',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 31
Front Left: 0 [0%]
Front Right: 0 [0%]
Simple mixer control 'AGC Noise Threshold',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 31
Front Left: 0 [0%]
Front Right: 0 [0%]
Simple mixer control 'AGC Right',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'AGC Signal Debounce',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 15
Front Left: 0 [0%]
Front Right: 0 [0%]
Simple mixer control 'AGC Target Level',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 7
Front Left: 0 [0%]
Front Right: 0 [0%]
Simple mixer control 'HP DAC',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [off]
Front Right: Playback [off]
Simple mixer control 'HP Driver Gain',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 35
Front Left: 6 [17%] [0.00dB]
Front Right: 6 [17%] [0.00dB]
Simple mixer control 'HPL Output Mixer IN1_L',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'HPL Output Mixer L_DAC',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'HPR Output Mixer IN1_R',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'HPR Output Mixer R_DAC',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'LO DAC',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [off]
Front Right: Playback [off]
Simple mixer control 'LO Driver Gain',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 35
Front Left: 6 [17%] [0.00dB]
Front Right: 6 [17%] [0.00dB]
Simple mixer control 'LOL Output Mixer L_DAC',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'LOR Output Mixer R_DAC',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Left Input Mixer IN1_L P',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Left Input Mixer IN2_L P',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Left Input Mixer IN3_L P',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'PGA Level',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 95
Front Left: 0 [0%] [0.00dB]
Front Right: 0 [0%] [0.00dB]
Simple mixer control 'Right Input Mixer IN1_R P',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Right Input Mixer IN2_R P',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Right Input Mixer IN3_R P',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
I'm not really familiar with ALSA or the audio driver part of the kernel...So i don't know where to begin dealing with this error.
Can you guys help?
Thanks lot in advance!!
semiyd