From nobody@FreeBSD.org  Fri Dec 31 09:20:06 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A5F8516A4CF
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 31 Dec 2004 09:20:06 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 727CF43D31
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 31 Dec 2004 09:20:06 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id iBV9K6u5044953
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 31 Dec 2004 09:20:06 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id iBV9K6vg044952;
	Fri, 31 Dec 2004 09:20:06 GMT
	(envelope-from nobody)
Message-Id: <200412310920.iBV9K6vg044952@www.freebsd.org>
Date: Fri, 31 Dec 2004 09:20:06 GMT
From: KAWATA Masahiko <kawata@mta.biglobe.ne.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: No sound on PC which is implemented ac97 eapd in an inverted sense
X-Send-Pr-Version: www-2.3

>Number:         75687
>Category:       kern
>Synopsis:       [sound] [patch] No sound on PC which is implemented ac97 eapd in an inverted sense
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-multimedia
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 31 09:20:27 GMT 2004
>Closed-Date:    Mon Jan 09 11:24:51 GMT 2006
>Last-Modified:  Mon Jan 09 11:24:51 GMT 2006
>Originator:     KAWATA Masahiko
>Release:        FreeBSD 5.3-STABLE
>Organization:
>Environment:
FreeBSD owen 5.3-STABLE FreeBSD 5.3-STABLE #7: Wed Dec  8 00:46:20 UTC 2004
>Description:
      My note PC(NEC VersaPro VY10F/BH-L) has sound device as following;

      pcm0: <Intel ICH4 (82801DB)> port 0xe000-0xe03f,0xee00-0xeeff
        mem 0xffaff400-0xffaff4ff,0xffaff800-0xffaff9ff irq 9 at device 31.5 on pci0
      pcm0: [GIANT-LOCKED]
      pcm0: <Analog Devices AD1981B AC97 Codec>

      It seems recognized and work well, but sound dose not come out.
>How-To-Repeat:
      Boot PC. and execute sound application. no sound from speakers,
      nor from headphones.
>Fix:
      My PC is implemented ac97 eapd in an inverted sense.
      and some SONY note PC has same implementation(see kern/66422)
      So I propose new kernel option to slove this irregular implementation.
--- sys/dev/sound/pcm/ac97.c.orig       Sat May  8 03:41:40 2004
+++ sys/dev/sound/pcm/ac97.c    Mon Dec 13 01:26:40 2004
@@ -29,6 +29,7 @@
 #include <dev/sound/pcm/ac97_patch.h>

 #include "mixer_if.h"
+#include "opt_ac97.h"

 SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/ac97.c,v 1.51 2004/05/08 03:41:40 sanpei Exp $");

@@ -545,6 +546,10 @@
                snd_mtxunlock(codec->lock);
                return ENODEV;
        }
+
+#ifdef AC97_EAPD_INVERT
+       ac97_setflags(codec, AC97_F_EAPD_INV);
+#endif

        ac97_wrcd(codec, AC97_REG_POWER, (codec->flags & AC97_F_EAPD_INV)? 0x8000 : 0x0000);
        ac97_reset(codec);
--- sys/conf/options.orig       Fri Dec 31 13:58:59 2004
+++ sys/conf/options    Fri Dec 31 14:00:21 2004
@@ -682,3 +682,6 @@
 DCONS_POLL_HZ          opt_dcons.h
 DCONS_FORCE_CONSOLE    opt_dcons.h
 DCONS_FORCE_GDB                opt_dcons.h
+
+# for inverted sense AC97 EAPD
+AC97_EAPD_INVERT       opt_ac97.h
--- sys/conf/NOTES.orig Wed Nov 10 19:11:12 2004
+++ sys/conf/NOTES      Fri Dec 31 14:06:08 2004
@@ -2507,3 +2507,6 @@

 # Yet more undocumented options for linting.
 options        VGA_DEBUG
+
+# Some PC is implemented ac97 eapd in an inverted sense.
+#options       AC97_EAPD_INVERT


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->sound 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Apr 3 08:09:29 GMT 2005 
Responsible-Changed-Why:  
Note that this PR contains a patch and assign to appropriate mailing list. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75687 
State-Changed-From-To: open->closed 
State-Changed-By: ariff 
State-Changed-When: Mon Jan 9 11:24:20 UTC 2006 
State-Changed-Why:  
A better fix has been committed to -current and will be MFCed to 
-stable (RELENG_6) later. Thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75687 
>Unformatted:
