Subject: Re: SiS 7012 audio
To: Bill Studenmund <wrstuden@netbsd.org>
From: Gary Duzan <gary@duzan.org>
List: tech-kern
Date: 07/19/2002 20:51:43
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <28527.1027126164.1@capo.xnet.duzan.org>
In Message <Pine.NEB.4.33.0207191626190.6476-100000@vespasia.home-net.internetconnect.net> ,
Bill Studenmund <wrstuden@netbsd.org> wrote:
=>On Sat, 20 Jul 2002, cube wrote:
=>
=>> Is someone currently working on making auich(4) working with that chip ?
=>
=>Not that I know of.
I made an attempt a while back to port the changes to the Linux
driver to support the 7012 to NetBSD, and while it does make sounds
now, it doesn't get the timing right. I'm not working on it actively
anymore since I'm pretty much stuck (and I bought an AudioPCI in
the mean time), but I'll attach my -current diffs in case you want
to look at it.
Gary D. Duzan
------- =_aaaaaaaaaa0
Content-Type: text/plain; name="7012.patch"; charset="us-ascii"
Content-ID: <28527.1027126164.2@capo.xnet.duzan.org>
Content-Description: 7012.patch
Index: auich.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pci/auich.c,v
retrieving revision 1.17
diff -u -r1.17 auich.c
--- auich.c 2002/04/11 10:54:23 1.17
+++ auich.c 2002/07/20 00:45:20
@@ -1,4 +1,4 @@
-/* $NetBSD: auich.c,v 1.16 2002/03/23 17:17:11 kent Exp $ */
+/* $NetBSD: auich.c,v 1.17 2002/04/11 10:54:23 augustss Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.16 2002/03/23 17:17:11 kent Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.17 2002/04/11 10:54:23 augustss Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -180,6 +180,9 @@
void *sc_powerhook;
int sc_suspend;
u_int16_t ext_status;
+
+ /* Status Register Offset */
+ int sts_reg;
};
#define FIXED_RATE 48000
@@ -187,7 +190,7 @@
/* Debug */
#ifdef AUDIO_DEBUG
#define DPRINTF(l,x) do { if (auich_debug & (l)) printf x; } while(0)
-int auich_debug = 0xfffe;
+int auich_debug = 0x0;
#define ICH_DEBUG_CODECIO 0x0001
#define ICH_DEBUG_DMA 0x0002
#define ICH_DEBUG_PARAM 0x0004
@@ -271,21 +274,25 @@
void auich_reset_codec(void *);
static const struct auich_devtype {
+ int vendor;
int product;
const char *name;
const char *shortname;
} auich_devices[] = {
- { PCI_PRODUCT_INTEL_82801AA_ACA,
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AA_ACA,
"i82801AA (ICH) AC-97 Audio", "ICH" },
- { PCI_PRODUCT_INTEL_82801AB_ACA,
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801AB_ACA,
"i82801AB (ICH0) AC-97 Audio", "ICH0" },
- { PCI_PRODUCT_INTEL_82801BA_ACA,
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801BA_ACA,
"i82801BA (ICH2) AC-97 Audio", "ICH2" },
- { PCI_PRODUCT_INTEL_82440MX_ACA,
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82440MX_ACA,
"i82440MX AC-97 Audio", "440MX" },
- { PCI_PRODUCT_INTEL_82801CA_AC,
+ { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801CA_AC,
"i82801CA AC-97 Audio", "i830M" },
+ { PCI_VENDOR_SIS, PCI_PRODUCT_SIS_7012,
+ "SiS 7012 AC-97 Audio", "SiS7012" },
+
{ 0,
NULL, NULL },
};
@@ -295,11 +302,9 @@
{
const struct auich_devtype *d;
- if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_INTEL)
- return (NULL);
-
for (d = auich_devices; d->name != NULL; d++) {
- if (PCI_PRODUCT(pa->pa_id) == d->product)
+ if ((PCI_VENDOR(pa->pa_id) == d->vendor) &&
+ (PCI_PRODUCT(pa->pa_id) == d->product))
return (d);
}
@@ -419,6 +424,14 @@
/* Watch for power change */
sc->sc_suspend = PWR_RESUME;
sc->sc_powerhook = powerhook_establish(auich_powerhook, sc);
+
+ /* SiS 7012 uses PICB instead of STS */
+ if ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_SIS) &&
+ (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SIS_7012)) {
+ sc->sts_reg = ICH_PICB;
+ } else {
+ sc->sts_reg = ICH_STS;
+ }
}
#define ICH_CODECIO_INTERVAL 10
@@ -580,6 +593,8 @@
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
return (0);
default:
+ printf("auich_query_encoding: invalid audio encoding (%d)\n",
+ aep->index + 1);
return (EINVAL);
}
}
@@ -630,8 +645,11 @@
(p->sample_rate != 22050) &&
(p->sample_rate != 32000) &&
(p->sample_rate != 44100) &&
- (p->sample_rate != 48000))
+ (p->sample_rate != 48000)) {
+ printf("%s: unsupported sample rate (%ld)\n",
+ sc->sc_dev.dv_xname, p->sample_rate);
return (EINVAL);
+ }
p->factor = 1;
if (p->precision == 8)
@@ -712,6 +730,8 @@
break;
default:
+ printf("%s: unsupported encoding (%d)\n",
+ sc->sc_dev.dv_xname, p->encoding);
return (EINVAL);
}
@@ -880,7 +900,8 @@
DPRINTF(ICH_DEBUG_DMA, ("auich_intr: gsts=0x%x\n", gsts));
if (gsts & ICH_POINT) {
- sts = bus_space_read_2(sc->iot, sc->aud_ioh, ICH_PCMO+ICH_STS);
+ sts = bus_space_read_2(sc->iot, sc->aud_ioh,
+ ICH_PCMO+sc->sts_reg);
DPRINTF(ICH_DEBUG_DMA,
("auich_intr: osts=0x%x\n", sts));
@@ -923,14 +944,15 @@
sc->sc_pintr(sc->sc_parg);
/* int ack */
- bus_space_write_2(sc->iot, sc->aud_ioh, ICH_PCMO + ICH_STS,
+ bus_space_write_2(sc->iot, sc->aud_ioh, ICH_PCMO + sc->sts_reg,
sts & (ICH_LVBCI | ICH_CELV | ICH_BCIS | ICH_FIFOE));
bus_space_write_2(sc->iot, sc->aud_ioh, ICH_GSTS, ICH_POINT);
ret++;
}
if (gsts & ICH_PIINT) {
- sts = bus_space_read_2(sc->iot, sc->aud_ioh, ICH_PCMI+ICH_STS);
+ sts = bus_space_read_2(sc->iot, sc->aud_ioh,
+ ICH_PCMI+sc->sts_reg);
DPRINTF(ICH_DEBUG_DMA,
("auich_intr: ists=0x%x\n", sts));
@@ -973,14 +995,15 @@
sc->sc_rintr(sc->sc_rarg);
/* int ack */
- bus_space_write_2(sc->iot, sc->aud_ioh, ICH_PCMI + ICH_STS,
+ bus_space_write_2(sc->iot, sc->aud_ioh, ICH_PCMI + sc->sts_reg,
sts & (ICH_LVBCI | ICH_CELV | ICH_BCIS | ICH_FIFOE));
bus_space_write_2(sc->iot, sc->aud_ioh, ICH_GSTS, ICH_POINT);
ret++;
}
if (gsts & ICH_MIINT) {
- sts = bus_space_read_2(sc->iot, sc->aud_ioh, ICH_MICI+ICH_STS);
+ sts = bus_space_read_2(sc->iot, sc->aud_ioh,
+ ICH_MICI+sc->sts_reg);
DPRINTF(ICH_DEBUG_DMA,
("auich_intr: ists=0x%x\n", sts));
if (sts & ICH_FIFOE)
Index: pcidevs
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pci/pcidevs,v
retrieving revision 1.453
diff -u -r1.453 pcidevs
--- pcidevs 2002/07/12 22:26:32 1.453
+++ pcidevs 2002/07/20 00:45:23
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.452 2002/07/09 23:47:45 matt Exp $
+$NetBSD: pcidevs,v 1.453 2002/07/12 22:26:32 enami Exp $
/*
* Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1906,6 +1906,7 @@
product SIS 6326 0x6326 6326 AGP VGA
product SIS 5597_USB 0x7001 5597/5598 USB host controller
product SIS 7016 0x7016 SiS 7016 10/100 Ethernet
+product SIS 7012 0x7012 SiS 7012 Sound
product SIS 7018 0x7018 SiS 7018 Sound
/* Silicon Motion products */
Index: pcidevs.h
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pci/pcidevs.h,v
retrieving revision 1.457
diff -u -r1.457 pcidevs.h
--- pcidevs.h 2002/07/12 22:27:55 1.457
+++ pcidevs.h 2002/07/20 00:45:25
@@ -1913,6 +1913,7 @@
#define PCI_PRODUCT_SIS_6326 0x6326 /* 6326 AGP VGA */
#define PCI_PRODUCT_SIS_5597_USB 0x7001 /* 5597/5598 USB host controller */
#define PCI_PRODUCT_SIS_7016 0x7016 /* SiS 7016 10/100 Ethernet */
+#define PCI_PRODUCT_SIS_7012 0x7012 /* SiS 7012 Sound */
#define PCI_PRODUCT_SIS_7018 0x7018 /* SiS 7018 Sound */
/* Silicon Motion products */
Index: pcidevs_data.h
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pci/pcidevs_data.h,v
retrieving revision 1.455
diff -u -r1.455 pcidevs_data.h
--- pcidevs_data.h 2002/07/12 22:27:56 1.455
+++ pcidevs_data.h 2002/07/20 00:45:25
@@ -5992,6 +5992,12 @@
"SiS 7016 10/100 Ethernet",
},
{
+ PCI_VENDOR_SIS, PCI_PRODUCT_SIS_7012,
+ 0,
+ "Silicon Integrated System",
+ "SiS 7012 Sound",
+ },
+ {
PCI_VENDOR_SIS, PCI_PRODUCT_SIS_7018,
0,
"Silicon Integrated System",
------- =_aaaaaaaaaa0--