RFC: massive snd_hda driver update to better conform UAA specification

eculp eculp at encontacto.net
Thu Aug 14 17:08:09 UTC 2008

Quoting Robert Noland <rnoland at FreeBSD.org>:

> On Wed, 2008-08-13 at 01:26 +0300, Alexander Motin wrote:
>> Hi.
>> I have made major snd_hda driver rewrite. I will be grateful for reviews
>> and any positive or negative feedbacks.
>> Here is my patches: http://people.freebsd.org/~mav/
>> For 8-CURRENT use:
>> http://people.freebsd.org/~mav/hda.20080812.patch

Yesterday I found time to test the patch and I am blown away.   
Everything sound related COMPLETELY works for the first time since I  
bought this Acer Aspire 5520-5679.  Connecting my headset EVEN blocks  
the speakers.  That has never worked.  FANTASTIC.  THANKS for your  
work.  I have even added the patch to my script for building and  
installing world and kernel in FreeBSD current 8 automatically until  
it is commited.  I would appreciate someone posting on the list when  
that happens.

The following is general info on my sound card with the patch applied.

hdac0: <NVidia MCP67 High Definition Audio Controller> mem  
0xd0880000-0xd0883fff irq 21 at device 7.0 on pci0
hdac0: DMA Coherency: Uncacheable / vendor=0x10de
hdac0: Reserved 0x4000 bytes for rid 0x10 type 3 at 0xd0880000
hdac0: [MPSAFE]
hdac0: [ITHREAD]
hdac0: hdac_dma_alloc: size=1024 -> roundsz=1024
hdac0: hdac_dma_alloc: size=2048 -> roundsz=2048

hdac0 at pci0:0:7:0:       class=0x040300 card=0x01261025 chip=0x055c10de  
rev=0xa1 hdr=0x00
     vendor     = 'Nvidia Corp'
     class      = multimedia

# cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 32bit 2007061600/i386)
Installed devices:
pcm0: <HDA codec Realtek ALC268 PCM #0> at hdac0 cad 0 kld snd_hda  
[20080812_0000] [GIANT] (1p:1v/1r:1v channels duplex default)
pcm1: <HDA codec Realtek ALC268 PCM #1> at hdac0 cad 0 kld snd_hda  
[20080812_0000] [MPSAFE] (1p:1v/1r:1v channels duplex)

Mixer vol      is currently set to 100:100
Mixer pcm      is currently set to 100:100
Mixer speaker  is currently set to 100:100
Mixer line     is currently set to 100:100
Mixer mic      is currently set to  50:50
Mixer rec      is currently set to 100:100
Mixer ogain    is currently set to  80:80
Mixer monitor  is currently set to 100:100

Thanks again.


> Nice work, applied to -CURRENT on my Dell D630 with no apparent
> regressions.  I'll attach the verbose dmesg.  It seems that I now have a
> monitor device which looks like it is the built in mic.
> wombat% mixer
> Mixer vol      is currently set to  75:75
> Mixer pcm      is currently set to  75:75
> Mixer speaker  is currently set to  75:75
> Mixer rec      is currently set to   0:0
> Mixer monitor  is currently set to  75:75
> robert.
>> For 7-STABLE try (I have no place to test it, but it builds):
>> http://people.freebsd.org/~mav/hda.7.20080812.patch
>> The main point of this change was to make driver conforming Universal
>> Audio Architecture (UAA) specification. UAA gives ability to avoid most
>> of device-dependent quirks (I have removed most of) and make driver more
>> friendly to a new hardware, more friendly to average user by using
>> information written by system integrators and much more configurable for
>> experienced users. UAA allows driver to get all configuration
>> information directly from HDA codec and configure system audio devices
>> according to it. Same time new driver allows easily override default
>> configuration using device.hints mechanism.
>> Second point of this change was to make driver multichannel. Now driver
>> supports multiple HDA codecs per controller, multiple function groups
>> per codec, multiple PCM devices per audio function group and multiple
>> channels per PCM device (last will be useful if FreeBSD OSS sometimes
>> will have multichannel support).
>> To demonstrate features I can show some operation examples from my
>> notebook. This is Acer TM6292 with very simple simple Realtek ALC268 HDA
>> codec.
>> 1. Previous driver gave me:
>>   - stereo playback (pcm0) via built in speakers and headphones without
>> jack sensing;
>>   - recording device (pcm0) from external mic. Built in mic, CD and line
>> in was dead.
>> 2. New driver by default without any quirks gives me:
>>   - stereo playback (pcm0) via built in speakers and headphones with
>> jack sensing;
>>   - recording device (pcm0) for built in mic (it does working!), line in
>> and mic in;
>>   - recording device (pcm1) for CD. CD does not working for some unknown
>> reason, I think it may be just not implemented in hardware.
>> 3. By adding to the loader.conf string
>> hint.hdac.0.cad0.nid20.config="seq=1"
>> it will be possible (when OSS will have multichannel support) to get
>> quadro playback via built in speakers and HP out connector. cad0 here
>> means codec with ID 0. nid20 means pin with ID 20 - HP out, seq=1
>> changes pin sequence inside association from 15 to 1 effectively
>> disabling redirection making HP out independent.
>> 4. By adding
>> hint.hdac.0.cad0.nid20.config="seq=1"
>> hint.hdac.0.cad0.nid21.config="as=3 seq=1"
>> it is possible to get two independent playback devices. One (pcm0) for
>> HP connector and second (pcm1) for built in speakers. Record will stay
>> as before. Here as=3 changes built in speakers pin association number
>> from 1 to 3 separating it completely from HP output.
>> 5. By adding
>> hint.hdac.0.cad0.nid26.config="as=1 seq=0 device=0"
>> hint.hdac.0.cad0.nid20.config="as=1 seq=15"
>> hint.hdac.0.cad0.nid21.config="as=3"
>> it is possible to get two independent playback devices. First (pcm0) for
>> playback via line in and HP out connectors with jack sensing in HP
>> connector and line in connector auto mute. And second (pcm1) for
>> playback via built in speakers. In this codec line in connector is
>> reversible. String device=0 changes it's description from Line in to
>> Line out forcing actual direction change.
>> Driver allows to build many others usage scenarios. The main limitation
>> factor is codec functionality. Presented ALC268 is very simple and
>> restricted one. But I have also successfully tested it on more powerful
>> AD1988 and there range of possible scenarios is wider while even default
>> configuration covers all present codec functionality.
>> More information about UAA you can find at:
>> http://www.microsoft.com/whdc/device/audio/default.mspx
>> If you will have any questions/problems boot your system with verbose
>> logging. Driver prints a lot of usable information there. If you will
>> send me problem reports add please attach that verbose boot output and
>> `cat /dev/sndstat` output to your message.
>> Thanks.
>> --
>> Alexander Motin
>> _______________________________________________
>> freebsd-multimedia at freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-multimedia
>> To unsubscribe, send any mail to  
>> "freebsd-multimedia-unsubscribe at freebsd.org"

More information about the freebsd-multimedia mailing list