1. Set up HDMI
Set up your kernel to use HDMI adding the following code to bootargs on u-boot:
video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24
2. Test raw audio
In order to test only raw audio, use the following command:
aplay -D hw:1,0 Kaleidoscope.wav
3. Make HDMI audio the default output
In order to configure audio output over HDMI, please, replace content of file ~/.asoundrc to the following one
pcm.dmix_48000{
type dmix
ipc_key 5678293
ipc_key_add_uid yes
slave{
pcm "hw:1,0"
period_time 0
period_size 2048
buffer_size 24576
format S16_LE
rate 48000
}
}
pcm.!dsnoop_44100{
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 0
period_size 2048
buffer_size 24576
format S16_LE
rate 44100
}
}
pcm.!dsnoop_48000{
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave{
pcm "hw:1,0"
period_time 0
period_size 2048
buffer_size 24576
format S16_LE
rate 48000
}
}
pcm.asymed{
type asym
playback.pcm "dmix_48000"
capture.pcm "dsnoop_44100"
}
pcm.dsp0{
type plug
slave.pcm "asymed"
}
pcm.!default{
type plug
route_policy "average"
slave.pcm "asymed"
}
ctl.mixer0{
type hw
card 0
}
This will configure alsa to use sound card hw:1,0. Please, pay attention to use the proper audio card name for your device.
In order to see available sound cards on board:
root@imx53qsb:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: imx3stack [imx-3stack], device 0: SGTL5000 SGTL5000-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: imx3stackspdif [imx-3stack-spdif], device 0: IMX SPDIF mxc spdif-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
For detail on how to create asound.conf, please see alsa-lib configuration introduction.
4. Encoded audio
For encoded (i.e. AC3, DTS) audio, you can use, for example, ac3dec, an utility provided by alsa-tools with the following command line:
ac3dec -D hw:1,0 -C test.ac3
This would work for both HDMI audio and SPDIF audio. Double check your hardware and/or schematic in order to know which one to use.