From owner-freebsd-bugs@FreeBSD.ORG Mon Nov 16 02:30:02 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BC48106566C for ; Mon, 16 Nov 2009 02:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 4E6628FC1B for ; Mon, 16 Nov 2009 02:30:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nAG2U1Pr027326 for ; Mon, 16 Nov 2009 02:30:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nAG2U1Xu027325; Mon, 16 Nov 2009 02:30:01 GMT (envelope-from gnats) Resent-Date: Mon, 16 Nov 2009 02:30:01 GMT Resent-Message-Id: <200911160230.nAG2U1Xu027325@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "kabe@sra-tohoku.co.jp" (added by vega) Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9C981065676 for ; Mon, 16 Nov 2009 02:22:53 +0000 (UTC) (envelope-from kabe@sra-tohoku.co.jp) Received: from vega.sra-tohoku.jp (vega.sra-tohoku.jp [58.12.125.173]) by mx1.freebsd.org (Postfix) with ESMTP id 61A078FC0C for ; Mon, 16 Nov 2009 02:22:52 +0000 (UTC) Received: from vega.sra-tohoku.jp (localhost4 [127.0.0.1]) by vega.sra-tohoku.jp (8.13.8/8.13.4/vega) with SMTP id nAG1ih5V023025; Mon, 16 Nov 2009 10:44:43 +0900 (JST) (envelope-from kabe@sra-tohoku.co.jp) Message-Id: <2301916200910.Jf0K9deD231127$@sra-tohoku.co.jp.msg> Date: Mon, 16 Nov 2009 10:44:43 +0900 From: "kabe@sra-tohoku.co.jp" (added by vega) To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/140591: [PATCH][sound] No sound output on lineout/headphone jacks using AD1980 AC'97 codec chip (Fujitsu C610) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 02:30:02 -0000 >Number: 140591 >Category: kern >Synopsis: [PATCH][sound] No sound output on lineout/headphone jacks using AD1980 AC'97 codec chip (Fujitsu C610) >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Nov 16 02:30:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: kabe@sra-tohoku.co.jp >Release: FreeBSD 7.2-RELEASE i386 >Organization: - >Environment: System: FreeBSD capricorn.five.ten 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri Nov 13 02:26:07 JST 2009 kabe@capricorn.five.ten:/usr/obj/usr/src/sys/GENERIC i386 Fujitsu (Fujitsu-Siemens) C610 Intel ICH5 + AD1980 AC'97 codec >Description: Internal speaker perfectly works, but headphone or lineout jacks have no audio output. >How-To-Repeat: With motherboards with AD1980 codec, and monitoring its LINE_OUT pins, play some audio. No audio output. SURR_OUT/HP_OUT pins will have output. These AD1980 pins may be wired in various ways to lineout/headphone/internal speakers, and some configuration (particulary laptops) may not have one of the output wired. >Fix: The patch below will only fix Fujitsu C610, but just collapsing into void ad198x_patch(struct ac97_info* codec) { ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0400); } seems to be the better solution. Also backportable to older FreeBSD. (cd /usr/src; env TZ=GMT diff -u sys/dev/sound/pcm/ac97_patch.c{.dist,}) --- sys/dev/sound/pcm/ac97_patch.c.dist 2009-04-15 03:14:26.000000000 +0000 +++ sys/dev/sound/pcm/ac97_patch.c 2009-11-15 16:10:10.000000000 +0000 @@ -44,9 +44,46 @@ void ad198x_patch(struct ac97_info* codec) { + /* + * AD198x series have 2 pairs of analog output: + * SURR_OUT/HP_OUT(surround or headphone) and LINE_OUT. + * + * Since SURR_OUT/HP_OUT output pins are equipped with power amps, + * retail machines often wire these to headphones jacks and/or + * internal speakers. + * This also means "mixer phout" will adjust speaker volume + * and "mixer vol" adjust lineout level, _independently_. + * + * (Linux has flags to swap vol/phout, and FreeBSD can do similar + * by mix_setrealdev() and gang them with mix_setparentchild()) + * + * AD198x register 0x76 + * 0x0400: select mixer for SURR_OUT/HP_OUT output pins (default surround DAC) + * 0x0020: select surround DAC for LINE_OUT output pins (default mixer) + * + * Selecting surround DAC for any output will yield "no sound", + * until FreeBSD supports surround DAC handling. + * + * Previous ad198x_patch() had set 0x0420, but 0x0400 seems to be + * better for all instances. At least you have mixer output + * for all output pins. + * The value is valid for all AD1888, AD1980, AD1985 and AD1986. + * (AD1986, having independent SURR_OUT and HP_OUT, will select + * mixer output for SURR_OUT by setting 0x0400 bit.) + * + * Fujitsu C610 seems to wire SURR_OUT/HP_OUT for + * internal speaker, and LINE_OUT for lineout AND headphone jacks; + * by setting previous 0x0420, internal speaker works but + * no output for either jacks. + * ASUS A9T may had been working by not setting the register because + * it only wired LINE_OUT. + */ switch (ac97_getsubvendor(codec)) { case 0x11931043: /* Not for ASUS A9T (probably else too). */ break; + case 0x122f10cf: /* Fujitsu C610 (perhaps for others) */ + ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0400); + break; default: ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0420); break; >Release-Note: >Audit-Trail: >Unformatted: