Subject: kern/36302: [patch] azalia(4) driver does not support headphones on Dell notebooks
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Aleksej Saushev <asau@hotbox.ru>
List: netbsd-bugs
Date: 05/09/2007 13:25:01
>Number:         36302
>Category:       kern
>Synopsis:       [patch] azalia(4) driver does not support headphones on Dell notebooks
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed May 09 13:25:01 +0000 2007
>Originator:     Aleksej Saushev <asau@hotbox.ru>
>Release:        NetBSD 4.99.19 as of 2007/05/08
>Organization:
>Environment:
System: NetBSD asau.local 4.99.19 NetBSD 4.99.19 (KERN) #4: Wed May 9 01:15:21 MSD 2007 root@asau.local:/usr/obj/sys/arch/i386/compile/KERN i386
Architecture: i386
Machine: i386
>Description:
	Headphones do not work on Dell Inspiron 6400 notebook.
>How-To-Repeat:
>Fix:
Apply patch below.

I think, the check may be made more general by using bit masks
like this:

#define STAC9220_IS_DELL(id) (((id) & 0xff00ffff) == 0x01001028)
	if (STAC9220_IS_DELL(this->subid)) {
		...
        }

instead of checking equality with known ids.

Index: sys/dev/pci/azalia_codec.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/azalia_codec.c,v
retrieving revision 1.38
diff -u -r1.38 azalia_codec.c
--- sys/dev/pci/azalia_codec.c	8 May 2007 05:18:20 -0000	1.38
+++ sys/dev/pci/azalia_codec.c	9 May 2007 13:22:07 -0000
@@ -2975,11 +2975,13 @@
 
 #define STAC9200_DELL_INSPIRON9400_ID	0x01cd1028
 #define STAC9200_DELL_640M_ID		0x01d81028
+#define STAC9220_DELL_INSPIRON6400_ID	0x01bd1028
 #define STAC9200_EVENT_HP	0
 #define STAC9200_NID_HP		0x0d
 #define STAC9200_NID_SPEAKER	0x0e
 	if (this->subid == STAC9200_DELL_INSPIRON9400_ID ||
-	    this->subid == STAC9200_DELL_640M_ID) {
+	    this->subid == STAC9200_DELL_640M_ID ||
+	    this->subid == STAC9220_DELL_INSPIRON6400_ID) {
 		/* setup a unsolicited event for the headphones */
 		this->comresp(this, STAC9200_NID_HP, CORB_SET_UNSOLICITED_RESPONSE,
 		    CORB_UNSOL_ENABLE | STAC9200_EVENT_HP, NULL);