Skip to main content

Audio Out

Audio out is supported in Linux on all CPUs, but not in the U-Boot.

Carrier BoardAudio InAudio Out
SOM Carrier BoardMicrophone jack and Line In jackHeadphone jack and HDMI

This test requires either headphones or speakers with a 3.5mm audio jack.

U-Boot

Audio out is currently not supported in U-Boot.

Linux

Playback devices

First lets see the available playback devices:

aplay --list-devices
**** List of PLAYBACK Hardware Devices ****
card 0: rcarsound [rcar-sound], device 0: rsnd-dai.0-da7213-hifi da7213-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: rcarsound [rcar-sound], device 1: rsnd-dai.0-i2s-hifi i2s-hifi-1 []
Subdevices: 1/1
Subdevice #0: subdevice #0

The main takeaway from the list above is that we have two devices, 0,0 and 0,1 (card,device). The default is 0,0 which is for the headphones. 0,1 is for HDMI output.

The default is headphone output, so in the Headphones section the examples does not specify the device in the aplay and speaker-test commands. If they did, this is what they would have looked like:

speaker-test -D hw:0,0 -c2 -t wav -l2
aplay -D hw:0,0 /usr/share/sounds/alsa/Front_Left.wav

Another, more flexible way, to specify device is to use the plughw device which will handle format conversions. It looks like this:

speaker-test -D plughw:0,0 -c2 -t wav -l2
aplay -D plughw:0,0 /usr/share/sounds/alsa/Front_Left.wav

Headphones

Use headphones in the jacket on the COM Carrier Board.

The alsa-utils package comes with a set of sample sound files available on the file system.

ls /usr/share/sounds/alsa/
Front_Center.wav   Noise.wav        Rear_Right.wav
Front_Left.wav Rear_Center.wav Side_Left.wav
Front_Right.wav Rear_Left.wav Side_Right.wav

The sound files can be played using the aplay command.

aplay /usr/share/sounds/alsa/Front_Left.wav

Note that even if the file is mono, it will be played as stereo. Another way to test the audio is with the speaker-test application.

speaker-test -c2 -l2 -twav

The speaker-test application has a lot of options to play with, but in our example the options are –c2 for stereo, -l2 to play each sound twice and –twav for wav-file testing.

If there is no sound at all, it is most likely because the output is off or muted. To get a long list of all mixer controls.

amixer
root@rzg3e-ea-som:~# amixer
Simple mixer control 'Headphone',0
Capabilities: volume pswitch
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 63
Front Left: 57 [90%] [0.00dB] Playback [off]
Front Right: 57 [90%] [0.00dB] Playback [off]
Simple mixer control 'Headphone Gain Ramping',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [on]
Front Right: Playback [on]
...

Or a shorter list of the names (still truncated below as it is a long list).

amixer controls
numid=39,iface=MIXER,name='Headphone Gain Ramping Switch'
numid=34,iface=MIXER,name='Headphone ZC Switch'
numid=28,iface=MIXER,name='Headphone Switch'
numid=7,iface=MIXER,name='Headphone Volume'
numid=40,iface=MIXER,name='Lineout Gain Ramping Switch'
numid=29,iface=MIXER,name='Lineout Switch'
numid=8,iface=MIXER,name='Lineout Volume'
numid=75,iface=MIXER,name='Mic 1 Amp Source MUX'
numid=23,iface=MIXER,name='Mic 1 Switch'
numid=1,iface=MIXER,name='Mic 1 Volume'
numid=76,iface=MIXER,name='Mic 2 Amp Source MUX'
numid=24,iface=MIXER,name='Mic 2 Switch'
numid=2,iface=MIXER,name='Mic 2 Volume'
numid=35,iface=MIXER,name='Aux Gain Ramping Switch'
numid=32,iface=MIXER,name='Aux ZC Switch'
numid=25,iface=MIXER,name='Aux Switch'
numid=3,iface=MIXER,name='Aux Volume'
numid=37,iface=MIXER,name='ADC Gain Ramping Switch'
numid=16,iface=MIXER,name='ADC HPF Cutoff'
numid=15,iface=MIXER,name='ADC HPF Switch'
numid=18,iface=MIXER,name='ADC Voice Cutoff'
numid=17,iface=MIXER,name='ADC Voice Mode Switch'
numid=27,iface=MIXER,name='ADC Switch'
...

There are a couple of settings that must be changed to enable headphone output:

amixer set "Headphone" 100%
amixer set "Headphone" on
amixer set "Mixout Left DAC Left" on
amixer set "Mixout Right DAC Right" on

HDMI Output

If you have a HDMI display with builtin speakers it is possible to redirect the audio to those instead of the headphones.

As explained in Playback devices, hdmi is the 0,1 device. To use it change device in the commands to one of:

speaker-test -D hw:0,1 -c2 -t wav -l2
aplay -D hw:0,1 /usr/share/sounds/alsa/Front_Left.wav

Another, more flexible way, to specify device is to use the plughw device which will handle format conversions. It looks like this:

speaker-test -D plughw:0,1 -c2 -t wav -l2
aplay -D plughw:0,1 /usr/share/sounds/alsa/Front_Left.wav