Module Name:    src
Committed By:   sborrill
Date:           Thu Sep  3 14:29:42 UTC 2009

Modified Files:
        src/sys/dev/pci: auich.c auichreg.h

Log Message:
SiS 7012 uses different multichannel control bits compared to other codecs
(data from linux via OpenBSD).


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/dev/pci/auich.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/auichreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/auich.c
diff -u src/sys/dev/pci/auich.c:1.129 src/sys/dev/pci/auich.c:1.130
--- src/sys/dev/pci/auich.c:1.129	Tue Mar 17 19:38:34 2009
+++ src/sys/dev/pci/auich.c	Thu Sep  3 14:29:42 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: auich.c,v 1.129 2009/03/17 19:38:34 dyoung Exp $	*/
+/*	$NetBSD: auich.c,v 1.130 2009/09/03 14:29:42 sborrill Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.129 2009/03/17 19:38:34 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.130 2009/09/03 14:29:42 sborrill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -185,6 +185,12 @@
 	enum ac97_host_flags sc_codecflags;
 	bool sc_spdif;
 
+	/* multi-channel control bits */
+	int sc_pcm246_mask;
+	int sc_pcm2;
+	int sc_pcm4;
+	int sc_pcm6;
+
 	/* DMA scatter-gather lists. */
 	bus_dmamap_t sc_cddmamap;
 #define	sc_cddma	sc_cddmamap->dm_segs[0].ds_addr
@@ -551,6 +557,10 @@
 	if (d->id == PCIID_SIS7012) {
 		sc->sc_sts_reg = ICH_PICB;
 		sc->sc_sample_shift = 0;
+		sc->sc_pcm246_mask = ICH_SIS_PCM246_MASK;
+		sc->sc_pcm2 = ICH_SIS_PCM2;
+		sc->sc_pcm4 = ICH_SIS_PCM4;
+		sc->sc_pcm6 = ICH_SIS_PCM6;
 		/* Un-mute output. From Linux. */
 		bus_space_write_4(sc->iot, sc->aud_ioh, ICH_SIS_NV_CTL,
 		    bus_space_read_4(sc->iot, sc->aud_ioh, ICH_SIS_NV_CTL) |
@@ -558,6 +568,10 @@
 	} else {
 		sc->sc_sts_reg = ICH_STS;
 		sc->sc_sample_shift = 1;
+		sc->sc_pcm246_mask = ICH_PCM246_MASK;
+		sc->sc_pcm2 = ICH_PCM2;
+		sc->sc_pcm4 = ICH_PCM4;
+		sc->sc_pcm6 = ICH_PCM6;
 	}
 
 	/* Workaround for a 440MX B-stepping erratum */
@@ -859,7 +873,7 @@
 	control = bus_space_read_4(sc->iot, sc->aud_ioh,
 	    ICH_GCTRL + sc->sc_modem_offset);
 	if (sc->sc_codectype == AC97_CODEC_TYPE_AUDIO) {
-		control &= ~(ICH_ACLSO | ICH_PCM246_MASK);
+		control &= ~(ICH_ACLSO | sc->sc_pcm246_mask);
 	} else {
 		control &= ~ICH_ACLSO;
 		control |= ICH_GIE;
@@ -1021,11 +1035,11 @@
 		    sc->sc_codectype == AC97_CODEC_TYPE_AUDIO) {
 			control = bus_space_read_4(sc->iot, sc->aud_ioh,
 			    ICH_GCTRL + sc->sc_modem_offset);
-				control &= ~ICH_PCM246_MASK;
+				control &= ~sc->sc_pcm246_mask;
 			if (p->channels == 4) {
-				control |= ICH_PCM4;
+				control |= sc->sc_pcm4;
 			} else if (p->channels == 6) {
-				control |= ICH_PCM6;
+				control |= sc->sc_pcm6;
 			}
 			bus_space_write_4(sc->iot, sc->aud_ioh,
 			    ICH_GCTRL + sc->sc_modem_offset, control);

Index: src/sys/dev/pci/auichreg.h
diff -u src/sys/dev/pci/auichreg.h:1.11 src/sys/dev/pci/auichreg.h:1.12
--- src/sys/dev/pci/auichreg.h:1.11	Mon Jan 14 21:33:04 2008
+++ src/sys/dev/pci/auichreg.h	Thu Sep  3 14:29:42 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: auichreg.h,v 1.11 2008/01/14 21:33:04 martin Exp $	*/
+/*	$NetBSD: auichreg.h,v 1.12 2009/09/03 14:29:42 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2000 Michael Shalayeff
@@ -85,6 +85,10 @@
 #define		 ICH_PCM2	0x000000 /* 2ch output */
 #define		 ICH_PCM4	0x100000 /* 4ch output */
 #define		 ICH_PCM6	0x200000 /* 6ch output */
+#define		ICH_SIS_PCM246_MASK	0x0000c0
+#define		 ICH_SIS_PCM2	0x000000 /* 2ch output */
+#define		 ICH_SIS_PCM4	0x000040 /* 4ch output */
+#define		 ICH_SIS_PCM6	0x000080 /* 6ch output */
 #define		ICH_S2RIE	0x40	/* int when tertiary codec resume */
 #define		ICH_SRIE	0x20	/* int when 2ndary codec resume */
 #define		ICH_PRIE	0x10	/* int when primary codec resume */

Reply via email to