Audio issue on Kirkwood t5325: no sound
Hello,
As part of some work around audio support on Marvell platforms, I've taken the Kirkwood-based HP t5325 thin client device that Martin Michlmayr kindly gave me and tried to use the audio part of it, with kernel 3.11-rc1. (My plan is to write the Device Tree binding for this audio driver, and then use it for Armada 370 based platforms).
My kernel configuration has the following options enabled:
CONFIG_SND_SOC=yCONFIG_SND_KIRKWOOD_SOC=yCONFIG_SND_KIRKWOOD_SOC_I2S=yCONFIG_SND_KIRKWOOD_SOC_OPENRD=yCONFIG_SND_KIRKWOOD_SOC_T5325=yCONFIG_SND_SOC_I2C_AND_SPI=yCONFIG_SND_SOC_ALC5623=yCONFIG_SND_SOC_CS42L51=y
So both the Kirkwood audio driver is enabled, the t5325-specific machine audio driver, and the ALC5623 codec. When booting, the system says:
t5325-audio t5325-audio: alc5621-hifi <-> kirkwood-i2s mapping ok [...]
ALSA device list:
#0: t5325
I can actually use aplay to play a sound, it plays fine, except that nothing goes out on the headphone jack, as if it was muted:
# aplay sensation.wav Playing WAVE 'sensation.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo #
I've unmuted all volume controls, and pushed all of them to the max value, as can be seen from the following amixer output:
# amixer Simple mixer control 'Headphone',0 Capabilities: pvolume pswitch Playback channels: Front Left - Front Right Limits: Playback 0 - 31 Mono: Front Left: Playback 31 [100%] [0.00dB] [on] Front Right: Playback 31 [100%] [0.00dB] [on] Simple mixer control 'Speaker',0 Capabilities: pvolume pswitch Playback channels: Front Left - Front Right Limits: Playback 0 - 31 Mono: Front Left: Playback 31 [100%] [0.00dB] [on] Front Right: Playback 31 [100%] [0.00dB] [on] Simple mixer control 'Speaker Mix AUXI2SPK',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Speaker Mix DAC2SPK',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Speaker Mix LI2SPK',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Speaker Mix MIC12SPK',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Speaker Mix MIC22SPK',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'SpeakerOut Mux',0 Capabilities: enum Items: 'Vmid' 'HPOut Mix' 'Speaker Mix' 'Mono Mix' Item0: 'Vmid' Simple mixer control 'SpeakerOut N Mux',0 Capabilities: enum Items: 'RN/-R' 'RP/+R' 'LN/-R' 'Vmid' Item0: 'Vmid' Simple mixer control 'PCM',0 Capabilities: pvolume Playback channels: Front Left - Front Right Limits: Playback 0 - 31 Mono: Front Left: Playback 31 [100%] [12.00dB] Front Right: Playback 31 [100%] [12.00dB] Simple mixer control 'LineIn',0 Capabilities: cvolume Capture channels: Front Left - Front Right Limits: Capture 0 - 31 Front Left: Capture 31 [100%] [12.00dB] Front Right: Capture 31 [100%] [12.00dB] Simple mixer control 'Mic 1 Boost',0 Capabilities: volume volume-joined Playback channels: Mono Capture channels: Mono Limits: 0 - 2 Mono: 0 [0%] [0.00dB] Simple mixer control 'Mic 2 Boost',0 Capabilities: volume volume-joined Playback channels: Mono Capture channels: Mono Limits: 0 - 2 Mono: 0 [0%] [0.00dB] Simple mixer control 'Mic1',0 Capabilities: cvolume cvolume-joined Capture channels: Mono Limits: Capture 0 - 31 Mono: Capture 23 [74%] [0.00dB] Simple mixer control 'Mic2',0 Capabilities: cvolume cvolume-joined Capture channels: Mono Limits: Capture 0 - 31 Mono: Capture 23 [74%] [0.00dB] Simple mixer control 'AuxI',0 Capabilities: cvolume Capture channels: Front Left - Front Right Limits: Capture 0 - 31 Front Left: Capture 23 [74%] [0.00dB] Front Right: Capture 23 [74%] [0.00dB] Simple mixer control 'AuxOut Mux',0 Capabilities: enum Items: 'Vmid' 'HPOut Mix' 'Speaker Mix' 'Mono Mix' Item0: 'Vmid' Simple mixer control 'Auxout',0 Capabilities: pvolume pswitch Playback channels: Front Left - Front Right Limits: Playback 0 - 31 Mono: Front Left: Playback 31 [100%] [0.00dB] [on] Front Right: Playback 31 [100%] [0.00dB] [on] Simple mixer control 'Mono Mix ADC2MONO_L',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Mono Mix ADC2MONO_R',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Mono Mix AUXI2MONO',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Mono Mix DAC2MONO',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Mono Mix LI2MONO',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Mono Mix MIC12MONO',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Mono Mix MIC22MONO',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'AB-D Amp Mux',0 Capabilities: enum Items: 'AB Amp' 'D Amp' Item0: 'AB Amp' Simple mixer control 'Digital Boost',0 Capabilities: volume volume-joined Playback channels: Mono Capture channels: Mono Limits: 0 - 3 Mono: 3 [100%] [18.00dB] Simple mixer control 'HP Mix AUXI2HP',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'HP Mix DAC2HP',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'HP Mix LI2HP',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'HP Mix MIC12HP',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'HP Mix MIC22HP',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'HPL Mix ADC2HP_L',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'HPR Mix ADC2HP_R',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on] Simple mixer control 'Left Capture Mix HPMixerL',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Left Capture Mix Left AuxI',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Left Capture Mix LineInL',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Left Capture Mix Mic1',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Left Capture Mix Mic2',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Left Capture Mix MonoMixer',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Left Capture Mix SPKMixer',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Left Headphone Mux',0 Capabilities: enum Items: 'Vmid' 'HP Left Mix' Item0: 'Vmid' Simple mixer control 'Rec',0 Capabilities: cvolume Capture channels: Front Left - Front Right Limits: Capture 0 - 31 Front Left: Capture 11 [35%] [0.00dB] Front Right: Capture 11 [35%] [0.00dB] Simple mixer control 'Right Capture Mix HPMixerR',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Right Capture Mix LineInR',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Right Capture Mix Mic1',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Right Capture Mix Mic2',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Right Capture Mix MonoMixer',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Right Capture Mix Right AuxI',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Right Capture Mix SPKMixer',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Right Headphone Mux',0 Capabilities: enum Items: 'Vmid' 'HP Right Mix' Item0: 'Vmid'
There are no kernel errors in the log, nothing that looks suspicious. Is there anything I've missed?
I've posted the complete kernel configuration at:
http://free-electrons.com/~thomas/pub/kirkwood-audio-kernel.config
And the complete kernel log at:
http://free-electrons.com/~thomas/pub/kirkwood-audio-kernel.log
Thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Quoted 5 lines · Thomas Petazzoni
As part of some work around audio support on Marvell platforms, I've taken the Kirkwood-based HP t5325 thin client device that Martin Michlmayr kindly gave me and tried to use the audio part of it, with kernel 3.11-rc1. (My plan is to write the Device Tree binding for this audio driver, and then use it for Armada 370 based platforms).
A couple of basic things to check:
1. /proc/asound/card0/pcm0p/sub0/status
Does this indicate that the hw_ptr and appl_ptr are updating ?
2. /proc/interrupts
Are you getting interrupts for kirkwood-i2s ?
That will confirm whether the I2S unit is reading data from the ring buffer. I suspect these will be a positive yes, given that aplay appears to work normally except being muted.
Another thing to check is the DAPM status, which you can find buried in /sys/kernel/debug/asoc - check all the DAPM status you can find below there, and check whether you think it's reasonable.
Russell,
Thanks for your feedback!
Quoted 7 lines · Russell King - ARM Linux
Quoted 5 lines · Thomas Petazzoni
As part of some work around audio support on Marvell platforms, I've taken the Kirkwood-based HP t5325 thin client device that Martin Michlmayr kindly gave me and tried to use the audio part of it, with kernel 3.11-rc1. (My plan is to write the Device Tree binding for this audio driver, and then use it for Armada 370 based platforms).
Quoted 5 lines
A couple of basic things to check:
1.
/proc/asound/card0/pcm0p/sub0/statusDoes this indicate that the
hw_ptrandappl_ptrare updating ?
Yes, it does:
# cat status state: RUNNING owner_pid : 720 trigger_time: 170.971641590 tstamp : 172.468710470 delay : 32224 avail : 544 avail_max : 28672 ----- hw_ptr : 66080 appl_ptr : 98304 # cat status state: RUNNING owner_pid : 720 trigger_time: 170.971641590 tstamp : 173.042343190 delay : 31520 avail : 1248 avail_max : 4096 ----- hw_ptr : 91360 appl_ptr : 122880
Quoted 3 lines
2.
/proc/interruptsAre you getting interrupts for kirkwood-i2s ?
Yes, I am:
# cat /proc/interrupts
CPU0
...
24: 109 orion_irq kirkwood-i2s
...
# cat /proc/interrupts
CPU0
...
24: 116 orion_irq kirkwood-i2s
...Quoted 3 lines
That will confirm whether the I2S unit is reading data from the ring buffer. I suspect these will be a positive yes, given that aplay appears to work normally except being muted.
Your suspicion was indeed correct. Seems like the audio samples are really being played.
Quoted 3 lines
Another thing to check is the DAPM status, which you can find buried in
/sys/kernel/debug/asoc- check all the DAPM status you can find below there, and check whether you think it's reasonable.
# for i in /sys/kernel/debug/asoc/t5325/dapm/* ; do echo $i ; cat "$i" ; done /sys/kernel/debug/asoc/t5325/dapm/Headphone Jack Headphone Jack: Off in 2 out 1 in "static" "HPR" in "static" "HPL" /sys/kernel/debug/asoc/t5325/dapm/Mic Jack Mic Jack: Off in 1 out 0 out "static" "MIC2" out "static" "MIC1" /sys/kernel/debug/asoc/t5325/dapm/Speaker Speaker: Off in 2 out 1 in "static" "SPKOUTN" in "static" "SPKOUT" /sys/kernel/debug/asoc/t5325/dapm/bias_level Off
I don't see anything that looks unreasonable in there, but I've never played with DAPM and related things, so it is very possible that my reasonable-guesser might be wrong on this.
Thoughts?
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Quoted 16 lines · Thomas Petazzoni
# for i in /sys/kernel/debug/asoc/t5325/dapm/* ; do echo $i ; cat "$i" ; done /sys/kernel/debug/asoc/t5325/dapm/Headphone Jack Headphone Jack: Off in 2 out 1 in "static" "HPR" in "static" "HPL" /sys/kernel/debug/asoc/t5325/dapm/Mic Jack Mic Jack: Off in 1 out 0 out "static" "MIC2" out "static" "MIC1" /sys/kernel/debug/asoc/t5325/dapm/Speaker Speaker: Off in 2 out 1 in "static" "SPKOUTN" in "static" "SPKOUT" /sys/kernel/debug/asoc/t5325/dapm/bias_level Off
Quoted 3 lines
I don't see anything that looks unreasonable in there, but I've never played with DAPM and related things, so it is very possible that my reasonable-guesser might be wrong on this.
The last one. I've seen that with the UDA134x driver too, where the bias level stays in a low power state, resulting in no audio output. I fixed it by adding DAPM to the UDA134x and my SA11x0 driver. Mark mentioned something about virtual DAPM support must not be working correctly.
This needs an understanding of the DAPM code, which I'm told is just a graph walk. However, trying to work out where stuff starts and how to follow the code through the stages of state changes in soc-dapm.c has proved to be quite an onerous task. I think there's only one or maybe two people on this planet who understands that chunk of code.
At this point, you need Mark or Liam to sort this out.
Quoted 16 lines · Thomas Petazzoni
# for i in /sys/kernel/debug/asoc/t5325/dapm/* ; do echo $i ; cat "$i" ; done /sys/kernel/debug/asoc/t5325/dapm/Headphone Jack Headphone Jack: Off in 2 out 1 in "static" "HPR" in "static" "HPL" /sys/kernel/debug/asoc/t5325/dapm/Mic Jack Mic Jack: Off in 1 out 0 out "static" "MIC2" out "static" "MIC1" /sys/kernel/debug/asoc/t5325/dapm/Speaker Speaker: Off in 2 out 1 in "static" "SPKOUTN" in "static" "SPKOUT" /sys/kernel/debug/asoc/t5325/dapm/bias_level Off
Quoted 3 lines
I don't see anything that looks unreasonable in there, but I've never played with DAPM and related things, so it is very possible that my reasonable-guesser might be wrong on this.
All those "Off" things mean that things are powered off which tends not
to involve them making any noise... Russell mentioned that he thought
this was a lack of DAPM stuff however looking here it seems there are
some DAPM widgets on your board?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130718/56ddfdb1/attachment.sig>
Quoted 4 lines · Mark Brown
All those "Off" things mean that things are powered off which tends not to involve them making any noise... Russell mentioned that he thought this was a lack of DAPM stuff however looking here it seems there are some DAPM widgets on your board?
And now I think about it further the fix here is essentially that we require DAPM on any device that wants power management these days - DAIs are now widget based so it's going to be much more sensible to just go through and add the relevant output pins to relevant legacy drivers.
This means that for uda134x (which I think is what you're using here, I have no context but that's what Russell mentioned?) someone needs to add widgets corresponding to the names for the inputs and outputs (just make up a name if there's just one of each and no datasheet) then link them with some DAPM routes:
{ "OUTPUT", NULL, "Playback" },
{ "Capture", NULL, "INPUT" },where INPUT and OUTPUT are the names of an input or output pin on the device defined as DAPM widgets:
SND_SOC_DAPM_INPUT("INPUT"),
SND_SOC_DAPM_OUTPUT("OUTPUT"),which I think is what Russell did.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130718/a6f5a8aa/attachment-0001.sig>
Quoted 7 lines · Mark Brown
Quoted 4 lines · Mark Brown
All those "Off" things mean that things are powered off which tends not to involve them making any noise... Russell mentioned that he thought this was a lack of DAPM stuff however looking here it seems there are some DAPM widgets on your board?
Quoted 6 lines
And now I think about it further the fix here is essentially that we require DAPM on any device that wants power management these days - DAIs are now widget based so it's going to be much more sensible to just go through and add the relevant output pins to relevant legacy drivers.
This means that for uda134x (which I think is what you're using here, I
No, this report is against ALC5623, which does appear to have widgets. I was remarking that this looks like the same kind of issue I had with UDA134x.
Note that the report indicates that the bias setting remains off while playing, and ALC5623 does this:
case SND_SOC_BIAS_OFF:
/* everything off, dac mute, inactive */
snd_soc_write(codec, ALC5623_PWR_MANAG_ADD2, 0);
snd_soc_write(codec, ALC5623_PWR_MANAG_ADD3, 0);
snd_soc_write(codec, ALC5623_PWR_MANAG_ADD1, 0);So if everything on the codec is powered down, it's not surprising that there is no audio output.
Quoted 7 lines · Russell King - ARM Linux
Quoted 1 line · Mark Brown
This means that for uda134x (which I think is what you're using here, I
No, this report is against ALC5623, which does appear to have widgets. I was remarking that this looks like the same kind of issue I had with UDA134x.
Ah, OK. In that case the issue is likely to be that no connection has been made between the audio interface and the outputs desired - probably some routing control needs to be enabled by userspace. If there's no visible path between a source of audio (like playback from the CPU) and a sink (such as an output) then the framework will think there's nothing to do.
Quoted 2 lines
So if everything on the codec is powered down, it's not surprising that there is no audio output.
Indeed, and if the routing isn't set up to connect an audio path the
core will not bother powering it on at all. The issue with the UDA134x
is that we need to give the framework the information that the playback
interfaces are connected to an output (or restore the code to do this in
the core but at this point since it's all data driven now in the drivers
it's easier and more robust to just plumb them in and avoid having to
deal with special cases which keep tripping us up).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130718/72605e9e/attachment.sig>