[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

auixp audio patch for thr MSI megabook S270



Hi,

The attached patch makes the auixp audio driver work on my MSI Megabook 
S270 notebook. It is inspired from a similar quirk in the Linux driver.

I'd appreciate some testing on other systems using the auixp driver, to 
make sure it doesn't break working systems.

Thanks in advance.
-- 
Matthieu Herrb
Index: pci/auixp.c
===================================================================
RCS file: /cvs/OpenBSD/src/sys/dev/pci/auixp.c,v
retrieving revision 1.5
diff -u -r1.5 auixp.c
--- pci/auixp.c	13 Apr 2006 15:48:45 -0000	1.5
+++ pci/auixp.c	23 Apr 2006 20:48:43 -0000
@@ -1568,11 +1568,14 @@
 {
 	bus_space_tag_t      iot;
 	bus_space_handle_t   ioh;
+	pcireg_t subdev;
 	struct auixp_codec  *codec;
 	int timeout, codec_nr;
 
 	iot = sc->sc_iot;
 	ioh = sc->sc_ioh;
+	subdev = pci_conf_read(sc->sc_pct, sc->sc_tag, PCI_SUBSYS_ID_REG);
+
 	/* ATI IXP can have upto 3 codecs; mark all codecs as not existing */
 	sc->sc_codec_not_ready_bits = 0;
 	sc->sc_num_codecs = 0;
@@ -1613,6 +1616,11 @@
 		codec->host_if.write  = auixp_write_codec;
 		codec->host_if.reset  = auixp_reset_codec;
 		codec->host_if.flags  = auixp_flags_codec;
+		switch (subdev) {
+		case 0x1311462: /* MSI S270 */
+			codec->codec_flags = AC97_HOST_DONT_ENABLE_SPDIF;
+			break;
+		}
 	}
 
 	if (!(sc->sc_codec_not_ready_bits & ATI_REG_ISR_CODEC0_NOT_READY)) {
Index: ic/ac97.c
===================================================================
RCS file: /cvs/OpenBSD/src/sys/dev/ic/ac97.c,v
retrieving revision 1.59
diff -u -r1.59 ac97.c
--- ic/ac97.c	28 Dec 2005 14:36:25 -0000	1.59
+++ ic/ac97.c	23 Apr 2006 20:48:43 -0000
@@ -1132,7 +1132,11 @@
 	u_int16_t misc;
 
 	ac97_read(as, AC97_AV_REG_MISC, &misc);
-	misc |= AC97_AV_MISC_SPDIFEN;
+	if (as->host_flags & AC97_HOST_DONT_ENABLE_SPDIF) {
+		misc &= ~AC97_AV_MISC_SPDIFEN;
+	} else	{
+		misc |= AC97_AV_MISC_SPDIFEN;
+	}
 	misc &= ~AC97_AV_MISC_VREFDIS;
 	ac97_write(as, AC97_AV_REG_MISC, misc);
 
Index: ic/ac97.h
===================================================================
RCS file: /cvs/OpenBSD/src/sys/dev/ic/ac97.h,v
retrieving revision 1.18
diff -u -r1.18 ac97.h
--- ic/ac97.h	6 Jun 2005 21:12:44 -0000	1.18
+++ ic/ac97.h	23 Apr 2006 20:48:43 -0000
@@ -35,7 +35,8 @@
 enum ac97_host_flags {
 	AC97_HOST_DONT_READ = 0x1,
 	AC97_HOST_DONT_READANY = 0x2,
-	AC97_HOST_SWAPPED_CHANNELS = 0x4
+	AC97_HOST_SWAPPED_CHANNELS = 0x4,
+	AC97_HOST_DONT_ENABLE_SPDIF = 0x8
 };
 
 struct ac97_host_if {



Visit your host, monkey.org