From owner-freebsd-multimedia@FreeBSD.ORG Tue Aug 12 22:26:20 2008 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 555C01065679 for ; Tue, 12 Aug 2008 22:26:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id A7E6B8FC18 for ; Tue, 12 Aug 2008 22:26:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) X-Spam-Flag: SKIP X-Spam-Yversion: Spamooborona-2.1.0 Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.1.14) with ESMTPSA id 192907005 for freebsd-multimedia@FreeBSD.org; Wed, 13 Aug 2008 01:26:18 +0300 Message-ID: <48A20E02.6070609@FreeBSD.org> Date: Wed, 13 Aug 2008 01:26:10 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.16 (X11/20080726) MIME-Version: 1.0 To: freebsd-multimedia@FreeBSD.org Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: RFC: massive snd_hda driver update to better conform UAA specification X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2008 22:26:20 -0000 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 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