Genode's audio driver
This documents some findings of mine whilst debugging "audio_drv", Genode's HDA/Ensoniq audio driver, trying to understand why it won't support my Asus HDA chipset.
Debugging, tracing
Edit "dde_bsd_audio.inc" and enable those 3 lines:
CC_OPT += -DAUDIO_DEBUG CC_OPT += -DAZALIA_DEBUG CC_OPT += -DDIAGNOSTIC
The second one especially, relates to initialization and hardware probing, which is interesting to debug cases of "could not initialize sound card" and "no supported sound card" errors.
Edit your runfile's "audio_drv" section to add the following:
\ <libc stdin=\"/dev/null\" stdout=\"/dev/log\" stderr=\"/dev/log\"/> \ <vfs> \ <dir name=\"dev\"> \ <log/> \ <null/> \ </dir> \ </vfs>
Compile with:
make drivers/audio
The produced stdout output is not quite supported by Genode::printf. So one needs to patch the "contrib" code like thus:
- formats like e.g. "%2.2d" are not supported; make them e.g. "%2d" instead.
- format "%b" is not supported; make it "%d" or "%x" instead.
If you have no other option than on-screen display of the LOG, it helps to add 1000 ms of "pauses" here and there, to have time to read the scrolling lines; e.g. add DELAY(1000); in azalia_codec_init() ..etc.
Known problems
Multiple HDA devices spread out on separate PCI slots (as is the case with e.g. the Asus F2A55M mo-bo): if the analog devices comes behind the HDMI device, Genode might choke. Situation:
- it seems the Genode team has already met that problem before:
- they hardcoded a skip-first-PCI-slot test in bus.cc
- a similar hack could be applied for F2A55M ..etc chipsets, until the driver comes up with a more general workaround.
"Big" number of audio jacks: the driver might run out of heap memory, allocating space to store the jack labels and information. Situation:
This bug is tracked in ticket 3451.
Call paths
azalia_pci_attach() azalia_init azalia_get_ctrlr_caps (reads the number of codecs) azalia_init_codecs for each codec: azalia_codec_init() azalia_print_codec() pick the first codec that is *analog*
..prints codec and HDA version.. azalia_codec_print_audiofunc() for each widget: azalia_widget_print_widget()