audio codec: input/output error from aplay if "Pre-Amplifier DAC" and "Pre-Amplifier Mute" are off

882 views
Skip to first unread message

Marcus Weseloh

unread,
Nov 4, 2015, 11:51:33 AM11/4/15
to linux...@googlegroups.com
Hi all,

first of all: thank you very much for all your work on mainlining the
Allwinner chips, especially for adding OTG and audio codec support!

I've been testing the audio codec using the linux-sunxi/sunxi-next
branch on my Olimex SOM EVB. It works great, but it took me a while to
find the correct mixer settings. What really puzzled me were the
"input/output" errors from aplay if the mixer is not set properly.
If "Pre-Amplifier DAC" and "Pre-Amplifier Mute" are both off, then
aplay hangs for a while and reports "aplay: pcm_write:1939: write
error: Input/output error". Only when enabling those two mixer
controls does the aplay command return successfully. Now my question:
is this expected behaviour?

Below is a screen log showing the effect in more detail:

# amixer
Simple mixer control 'Left Mixer Left DAC',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'PA',0
Capabilities: volume volume-joined
Playback channels: Mono
Capture channels: Mono
Limits: 0 - 63
Mono: 0 [0%] [-99999.99dB]
Simple mixer control 'Pre-Amplifier DAC',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Pre-Amplifier Mixer',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Pre-Amplifier Mute',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Right Mixer Left DAC',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Right Mixer Right DAC',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
# aplay /usr/share/sounds/alsa/Noise.wav && echo "success!"
Playing WAVE '/usr/share/sounds/alsa/Noise.wav' : Signed 16 bit Little
Endian, Rate 48000 Hz, Mono
aplay: pcm_write:1939: write error: Input/output error
# amixer sset "Pre-Amplifier DAC" on
Simple mixer control 'Pre-Amplifier DAC',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
# aplay /usr/share/sounds/alsa/Noise.wav && echo "success!"
Playing WAVE '/usr/share/sounds/alsa/Noise.wav' : Signed 16 bit Little
Endian, Rate 48000 Hz, Mono
aplay: pcm_write:1939: write error: Input/output error
# amixer sset "Pre-Amplifier Mute" on
Simple mixer control 'Pre-Amplifier Mute',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
# aplay /usr/share/sounds/alsa/Noise.wav && echo "success!"
Playing WAVE '/usr/share/sounds/alsa/Noise.wav' : Signed 16 bit Little
Endian, Rate 48000 Hz, Mono
success!

Best regards,

Marcus

Chen-Yu Tsai

unread,
Nov 8, 2015, 10:39:43 PM11/8/15
to mwese...@gmail.com, linux-sunxi
On Thu, Nov 5, 2015 at 12:51 AM, Marcus Weseloh <mwese...@gmail.com> wrote:
> Hi all,
>
> first of all: thank you very much for all your work on mainlining the
> Allwinner chips, especially for adding OTG and audio codec support!
>
> I've been testing the audio codec using the linux-sunxi/sunxi-next
> branch on my Olimex SOM EVB. It works great, but it took me a while to
> find the correct mixer settings. What really puzzled me were the
> "input/output" errors from aplay if the mixer is not set properly.
> If "Pre-Amplifier DAC" and "Pre-Amplifier Mute" are both off, then
> aplay hangs for a while and reports "aplay: pcm_write:1939: write
> error: Input/output error". Only when enabling those two mixer
> controls does the aplay command return successfully. Now my question:
> is this expected behaviour?

AFAIK this is the behavior of ALSA. If there's no valid output path
for the default soundcard/route, it'll block instead of just dropping
output. Can't say if this is the "correct" behavior though. You should
probably ask the ALSA maintainers.

ChenYu
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Stefan Monnier

unread,
Nov 8, 2015, 11:01:02 PM11/8/15
to linux...@googlegroups.com
> AFAIK this is the behavior of ALSA. If there's no valid output path
> for the default soundcard/route, it'll block instead of just dropping
> output. Can't say if this is the "correct" behavior though. You should
> probably ask the ALSA maintainers.

I guess the main issue (which is sunxi-specific) is that the default
settings of sunxi's mixer should enable an output path.


Stefan

Chen-Yu Tsai

unread,
Nov 8, 2015, 11:08:55 PM11/8/15
to mon...@iro.umontreal.ca, linux-sunxi
Yes. Hans already raised the issue. This is a userspace setting, which
is in alsa-lib and not part of kernel proper.

See https://lkml.org/lkml/2015/9/30/867

ChenYu

Stefan Monnier

unread,
Nov 8, 2015, 11:53:12 PM11/8/15
to Chen-Yu Tsai, linux-sunxi
>> I guess the main issue (which is sunxi-specific) is that the default
>> settings of sunxi's mixer should enable an output path.
> Yes. Hans already raised the issue. This is a userspace setting, which
> is in alsa-lib and not part of kernel proper.
> See https://lkml.org/lkml/2015/9/30/867

Is there a patch for that available somewhere?


Stefan

Marcus Weseloh

unread,
Nov 9, 2015, 4:03:32 AM11/9/15
to Chen-Yu Tsai, linux-sunxi
2015-11-09 4:39 GMT+01:00 Chen-Yu Tsai <we...@csie.org>:
> On Thu, Nov 5, 2015 at 12:51 AM, Marcus Weseloh <mwese...@gmail.com> wrote:
>> If "Pre-Amplifier DAC" and "Pre-Amplifier Mute" are both off, then
>> aplay hangs for a while and reports "aplay: pcm_write:1939: write
>> error: Input/output error". Only when enabling those two mixer
>> controls does the aplay command return successfully. Now my question:
>> is this expected behaviour?
>
> AFAIK this is the behavior of ALSA. If there's no valid output path
> for the default soundcard/route, it'll block instead of just dropping
> output.

OK, I can understand that ALSA has no valid output path if the DAC is
switched off. But that sound playback breaks if "Pre-Amplifier Mute"
is switched off is weird. If a switch called "Mute" is off, then I
would expect to hear sound, not the other way round. And "muting"
sounds to me like it's not breaking the output path but simply
controlling the last switch before the generated sounds reaches the
speakers.

But maybe I'm looking at it from the wrong perspective. The switches
and mixer controls that are available at the moment are very
technical, map more or less directly to the switches and controls that
are available in the codec. Maybe the /usr/share/alsa/cards
configuration files map the "technical" controls exported by the codec
to more user friendly controls that I know from other systems / sound
cards?

Cheers,

Marcus
Reply all
Reply to author
Forward
0 new messages