Figure out how to play both mono and stereo .wav
files through the headphones on a Freescale MCIMX6Q-SDB running a stock core-image-minimal
with only added recipe alsa-utils
.
Some /sys/kernel/debug/
files to check out later:
/sys/kernel/debug/asoc/<cardname>/<codecname>/dapm/*
/sys/kernel/debug/regmap/<address>/registers
poky
and meta-freescale
layersMACHINE = imx6qdlsabresd
IMAGE_INSTALL_append = “ alsa-utils”
EXTRA_IMAGE_FEATURES = “package-management debug-tweaks”
Part of alsa-utils
package, in /usr/share/sounds/alsa/
(all mono files):
Front_Center.wav Front_Right.wav Rear_Center.wav Rear_Right.wav Side_Right.wav Front_Left.wav Noise.wav Rear_Left.wav Side_Left.wav
Also manually copied under /home/root/
:
-rw-r--r-- 1 root root 53544 Oct 4 17:42 pcm0808m.wav -rw-r--r-- 1 root root 107042 Oct 4 17:42 pcm0808s.wav -rw-r--r-- 1 root root 107042 Oct 4 17:42 pcm1608m.wav -rw-r--r-- 1 root root 214040 Oct 4 17:42 pcm1608s.wav
... Advanced Linux Sound Architecture Driver Initialized. ... wm8962 0-001a: customer id 0 revision D fsl-asrc 2034000.asrc: driver registered input: WM8962 Beep Generator as /devices/soc0/soc/2100000.aips-bus/21a0000.i2c/i2c-0/0-001a/input/input5 imx-wm8962 sound: wm8962 <-> 202c000.ssi mapping ok imx-wm8962 sound: snd-soc-dummy-dai <-> 2034000.asrc mapping ok imx-wm8962 sound: wm8962 <-> 202c000.ssi mapping ok imx-audio-hdmi sound-hdmi: hdmi-hifi <-> soc:hdmi_audio@00120000 mapping ok ... wm8962-supply: disabling SW4: disabling ALSA device list: #0: wm8962-audio #1: imx-hdmi-soc ...
With no other sound or CODEC configuration, first, turn up headphone volume:
# amixer cset name="Headphone Volume" 100,100 numid=24,iface=MIXER,name='Headphone Volume' ; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0 : values=100,100 | dBscale-min=-121.00dB,step=1.00dB,mute=1
In loop, play all mono files in /usr/share/sounds/alsa/
, they all play on the left headphone only (which is to be expected):
# for w in *.wav ; do > aplay $w > sleep 1 > done
For .wav
files under /home/root/
, mono files play only on left HP channel, stereo .wav
files play on both channels, so this verifies that both HP channels work, at least with stereo files.
To verify we can send digital input to the right channel, the digital audio interface supports swapping the channels immediately upon input:
# amixer cget name="DAC L/R Swap Switch" numid=20,iface=MIXER,name='DAC L/R Swap Switch' ; type=BOOLEAN,access=rw------,values=1 : values=off
Switch, so mono files play only on right headphone:
# amixer cset name="DAC L/R Swap Switch" on numid=20,iface=MIXER,name='DAC L/R Swap Switch' ; type=BOOLEAN,access=rw------,values=1 : values=on
Verified that that works, so turn this off. All this verifies is that we can route digital input to the right headphone.
By default, both HP channels bypass the HP mixers and get their output directly from the DAC:
root@imx6qdlsabresd:~# amixer get "HPOUTL PGA" Simple mixer control 'HPOUTL PGA',0 Capabilities: enum Items: 'DAC' 'Mixer' Item0: 'DAC' root@imx6qdlsabresd:~# amixer get "HPOUTR PGA" Simple mixer control 'HPOUTR PGA',0 Capabilities: enum Items: 'DAC' 'Mixer' Item0: 'DAC' root@imx6qdlsabresd:~#
The above represents bypassing the headphone mixers on both channels. Experiment with just mono files and try to set the left channel to come through the mixer for that channel.
First, switch to have HPOUTL come from the mixer, not directly from DACL. This should kill the output to the left HP channel (until we configure the mixer properly):
# amixer cset name="HPOUTL PGA" Mixer numid=95,iface=MIXER,name='HPOUTL PGA' ; type=ENUMERATED,access=rw------,values=1,items=2 ; Item #0 'DAC' ; Item #1 'Mixer' : values=1
# amixer get "HPOUTL PGA" Simple mixer control 'HPOUTL PGA',0 Capabilities: enum Items: 'DAC' 'Mixer' Item0: 'Mixer'
Indeed, playing mono files now produces no output at all (which is expected).
Now configure HPMIXL to get input from DACL:
# amixer set "HPMIXL DACL" on Simple mixer control 'HPMIXL DACL',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on]
But playing a mono wav file … no sound. Not good. Oh, wait, must turn on headphone mixer:
# amixer set "Headphone Mixer" on,on Simple mixer control 'Headphone Mixer',0 Capabilities: pswitch Playback channels: Front Left - Front Right Mono: Front Left: Playback [on] Front Right: Playback [on]
In short:
HPOUTL PGA
to “Mixer”HPMIXL DACL
Seems simple enough:
HPOUTR PGA
to “Mixer”HPMIXR DACL