This is an old revision of the document!
Overview
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
System configuration
- fully-updated
poky
andmeta-freescale
layers MACHINE = imx6qdlsabresd
IMAGE_INSTALL_append = “ alsa-utils”
EXTRA_IMAGE_FEATURES = “package-management”
Relevant dmesg output related to WM8962 codec
... 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 ...
Playing sample mono .wav files
Package `alsa-utils` comes with sample mono files:
Front_Center.wav Front_Left.wav Front_Right.wav Noise.wav Rear_Center.wav Rear_Left.wav Rear_Right.wav Side_Left.wav Side_Right.wav
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
and play all of them:
# for w in *.wav ; do > aplay $w > sleep 1 > done
All play only on the left channel, so this is clearly the default configuration for mono files.
Playing stereo files
Copy more sample files to target:
-rw-r--r-- 1 root root 53544 Oct 3 2017 pcm0808m.wav -rw-r--r-- 1 root root 107042 Oct 3 2017 pcm0808s.wav -rw-r--r-- 1 root root 107042 Oct 3 2017 pcm1608m.wav -rw-r--r-- 1 root root 214040 Oct 3 2017 pcm1608s.wav
Mono files play only on left, stereo files play on both.
Switching channels for mono files
By default:
# 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 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
Turn off for now.
Headphone mixers
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:~#
For the left channel, we can use the mixer and just feed the left channel into the mixer, effectively getting the same result:
# amixer set "HPOUTL PGA" Mixer Simple mixer control 'HPOUTL PGA',0 Capabilities: enum Items: 'DAC' 'Mixer' Item0: 'Mixer'
This effectively kills the left output channel until we set the mixer properly:
# amixer sget "HPMIXL DACL" Simple mixer control 'HPMIXL DACL',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [off]
# amixer sset "HPMIXL DACL" on Simple mixer control 'HPMIXL DACL',0 Capabilities: pswitch pswitch-joined Playback channels: Mono Mono: Playback [on]