HDMI Audio with Zotac ZBOX AD02 (AMD Fusion / Neo X2)

Recently, I’ve been working on a solution for playing videos in public places (indoors). The requirement was an HD TV with an attached mini PC box, which plays a playlist created via web interface on a central server.
All the movies will be uploaded to the server and downloaded by the boxes through FTP. The box features a listening socket, for controlling the software remotely and checking the online-status. I used mplayer as the video player.
It was quite a fun project, involving custom configuration of X.org and a lot of Perl-coding on the box-side. It just boots up and starts playing it’s local playlist without user interaction. The server runs a PHP application for managing the boxes and creating playlists.

The box itself is a Zotac ZBOX AD02 with AMD Fusion chipset. It features an energy efficient AMD Neo X2 CPU, which contains a Radeon HD 3200 graphics core (It even supports AMD-V; AMD’s virtualization technology). It’s also got VESA mounting gear, so you can mount it to the back of most displays / TVs.
Everything went pretty good at first. I set up Debian 6 and installed AMD’s proprietary vdeo driver and got pretty smooth 1080p video playback. Wonderful video performance for such a small and relatively cheap PC!

My setup at this time was, that my old CRT monitor was connected through VGA and sound went through the front headphone jack. So as I was trying to hook the box to my TV through HDMI, I noticed there was no sound playing. I’ve tried a lot of things, from changing to the open source video drivers (radeon / radeonhd) to fiddling around with ALSA and some other stuff.
Finally, after lots of googleing, I found the cause: AMD’s HDMI Sound got supported by ALSA in version 1.0.23 (which was released in April 2010 …). Debian’s Kernel 2.6.32-5 still used ALSA 1.0.19, so I had to upgrade.

I downloaded the current Linux kernel source from kernel.org and followed this How To to build and install the debian package.

Then I had to disable the onboard Azalia sound chip in the BIOS settings, as there was still no HDMI audio as long as it was activated.

After booting the new kernel image, there is still one important step. I had to unmute the S/PDIF channel in alsamixer. If you don’t have the alsamixer command, you need to install alsa-utils through apt or aptitude.
In alsamixer there should only be the S/PDIF channel, so press m to unmute it. You can see it’s not mute when there is oo in the above box, instead of MM.

Now to find out the exact ALSA device/channel configuration to use for you applications, run aplay -l and you will see something like this:

**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
Subdevices: 0/1
Subdevice #0: subdevice #0

As we only have AMD’s HDMI Audio enabled, we only see this one soundcard. In ALSA speak this is device 0,3. Try playing a video or audiofile with mplayer now, to see if your sound is working correctly:

mplayer -ao alsa:device=plughw=0.3 /path/to/file.mp3

I use plughw here, because it automatically converts the audio stream to the right format for the soundcard, as opposed to hw, where the audio stream must be in the right format already.
Some applications (like aplay) take the device and channel separated by a comma (,) instead of a dot, so be aware of that.

Flattr this!


10 Comments

  • james |

    Thank you for sharing the experience.

    I would like to know whether you are using the open source drivers or the Catalyst driver?

    I bought an AD02 recently and installed Ubuntu 11.04 (64bit) on it. There are two problems:
    (1) There was a black screen when I switch user until I removed the Catalyst driver.
    (2) There is no HDMI sound. I’ll try your solution.

  • fronk |

    Hi james!

    I am using the Catalyst driver. The exact version is 8.841.
    But I am not using a display manager, just running Xorg (1.7.7) with my own xinit script. So I have no experience with user-switching.
    I couldn’t find reliable information, but AFAIK gdm’s user-switching attaches a new X-display to another virtual terminal, so maybe the Catalyst driver doesn’t support that or the acutal switch to the other virtual terminal.
    Maybe I’ll try this out sometime.

    As for the sound issue, just try my solution, and disable the onboard sound card. If you wish to use pulseaudio (the default in Ubuntu), you might still have to tweak some settings there. But I think I recall having it work with pulseaudio a while ago.

    HTH,

    fronk

  • james |

    Thanks Fronk.

    Unfortunately I did not succeed. My kernel is 2.6.38-11-generic, the ALSA version is v1.0.24.2. The Catalyst driver was activated. The onboard sound card was disabled. S/PDIF is unmuted.
    aplay -l returns
    —————————————————————————
    **** List of PLAYBACK Hardware Devices ****
    card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    —————————————————————————

    I’m confused about the card info. In your case it is HDMI [HDA ATI HDMI] but mine is „Generic“. Is there something missing?

    I found two web pages saying the HDMI audio is by default disabled and has to be re-enabled:
    (1) https://help.ubuntu.com/community/RadeonHD#HDMI_Audio (by editing xorg.conf).
    (2) https://bbs.archlinux.org/viewtopic.php?id=124130 ( by editing menu.lst)

    However, adding a Device section to xorg.conf as below caused a booting problem (display froze at the „UBUNTU“ screen).
    ——————————————————————
    Section „Device“
    Option „Audio“ „true“
    Option „HDMI“ „all“
    EndSection
    ——————————————————————
    Appending „radeon.audio=1″ to the GRUB_CMDLINE_LINUX_DEFAULT=“…“ line in /etc/default/grub, which I think is equivalent to revising the menu.lst file, does not make any difference. The resultant grub.cfg file has a corresponding line like this:

    linux /boot/vmlinuz-2.6.38-11-generic root=UUID=62004961-924f-476e-be42-5f57a0657363 ro quiet splash radeon.audio=1 vt.handoff=7

    I also added the following line to /etc/pulse/default.pa:
    load-module module-alsa-sink device=hw:0,3 sink_name=Generic

    So I’m basically running out of idea.

    Regards,

    James

  • Ramit |

    Hi,
    I am trying to replicate your setup nearly entirely. I am having trouble getting X to work correctly. It displays on my TV but only in 4:3 and not at a normal resolution. What driver did you install from apt? Would you mind posting or emailing me your xorg.conf as well?

    Thanks,
    Ramit

    P.S. Using Debian squeeze.

  • Ramit |

    I managed to get the video after installing the drivers again from sid. I was able to get mplayer to play the audio output correctly as well, but I am having difficulty finding the right setting for XBMC. Have you tried using XBMC yet?

  • Ramit |

    The tutorial here worked for me with HDMI audio. No go for analog or optical (my preferences). I did get analog working with mplayer on cmd though given your post but for some reason, mplayer does not like that. Weirdness….

  • Ramit |

    *mplayer does not like audio over HDMI, but that might be because it is streaming to my TV in an incorrect PCM format. It actually does work, but it has a horrible static to it.

  • fronk |

    Hi Ramit! Thanks for your comments.

    You might have disabled the internal sound card (Intel Azalia) in the BIOS settings. Maybe that’s why the digital audio is not working.

    Please run aplay -l and see if you have the „ALC888“ device:

    card 0: SB [HDA ATI SB], device 1: ALC888 Digital [ALC888 Digital]

    For mplayer, you need to use „plughw“ instead of just „hw“ in the device string like that:
    mplayer -ao alsa:device=plughw=0.3

    (this is the setting for HDMI with Azalia audio disabled. The digital output is plughw=0.1 for me, when I enable the Azalia device)

    To make this setting permanent, open the file .mplayer/config in your homefolder and add a line like the following:

    ao=alsa:device=plughw=0.3

    HTH,
    fronk

  • James |

    Hi,

    I just discovered what’s wrong with my HDMI audio! It turns out that my monitor, a Samsung SyncMaster TA550, blocked the audio.

    To get a decent video display, one has to name the HDMI as „PC“ or „DVI PC“. I chose the later as somebody suggested. Unfortunately, with this name it seems the HDMI audio is disabled. Once I changed the name to „PC“, both video and audio are working!

    Best Regards,
    James

So, what do you think ?

You must be logged in to post a comment.