summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-11-19 17:47:38 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-11-19 17:47:38 +0000
commit3909e6ffbbf9a5abf9637dcde0f292930d0e4da8 (patch)
tree38ddd992960e1ef5a4f295c992a960ed05c26fcc /sys/dev/pci
parent512bbf9eb5ef1c1e112255f7f0b72bc2a37932a8 (diff)
remove local hack and use ac97_set_rate; tested by form@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/auvia.c37
-rw-r--r--sys/dev/pci/auviavar.h8
2 files changed, 8 insertions, 37 deletions
diff --git a/sys/dev/pci/auvia.c b/sys/dev/pci/auvia.c
index 00eeb4a0518..f174df85b82 100644
--- a/sys/dev/pci/auvia.c
+++ b/sys/dev/pci/auvia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auvia.c,v 1.12 2001/11/06 19:53:19 miod Exp $ */
+/* $OpenBSD: auvia.c,v 1.13 2001/11/19 17:47:37 mickey Exp $ */
/* $NetBSD: auvia.c,v 1.7 2000/11/15 21:06:33 jdolecek Exp $ */
/*-
@@ -221,7 +221,6 @@ auvia_attach(struct device *parent, struct device *self, void *aux)
pcitag_t pt = pa->pa_tag;
pci_intr_handle_t ih;
pcireg_t pr;
- u_int16_t v;
int r, i;
if (pci_intr_map(pa, &ih)) {
@@ -277,22 +276,6 @@ auvia_attach(struct device *parent, struct device *self, void *aux)
return;
}
- /*
- * Print a warning if the codec doesn't support hardware variable
- * rate audio.
- */
- if (auvia_read_codec(sc, AC97_REG_EXT_AUDIO_ID, &v)
- || !(v & AC97_EXT_AUDIO_VRA)) {
- printf("%s: warning: codec doesn't support hardware AC'97 2.0 Variable Rate Audio\n",
- sc->sc_dev.dv_xname);
- sc->sc_fixed_rate = AUVIA_FIXED_RATE;
- } else {
- /* enable VRA */
- auvia_write_codec(sc, AC97_REG_EXT_AUDIO_CTRL,
- AC97_EXT_AUDIO_VRA | AC97_EXT_AUDIO_VRM);
- sc->sc_fixed_rate = 0;
- }
-
/* disable mutes */
for (i = 0; i < 4; i++) {
static struct {
@@ -521,7 +504,7 @@ auvia_set_params(void *addr, int setmode, int usemode,
struct auvia_softc *sc = addr;
struct audio_params *p;
u_int16_t regval;
- int reg, mode;
+ int mode;
/* for mode in (RECORD, PLAY) */
for (mode = AUMODE_RECORD; mode != -1;
@@ -531,20 +514,12 @@ auvia_set_params(void *addr, int setmode, int usemode,
p = mode == AUMODE_PLAY ? play : rec;
- if (p->sample_rate < 4000 || p->sample_rate > 48000 ||
- (p->precision != 8 && p->precision != 16) ||
- (p->channels != 1 && p->channels != 2))
+ if (ac97_set_rate(sc->codec_if, p, mode))
return (EINVAL);
- reg = mode == AUMODE_PLAY ?
- AC97_REG_FRONT_DAC_RATE : AC97_REG_PCM_ADC_RATE;
-
- if (!sc->sc_fixed_rate) {
- auvia_write_codec(sc, reg, (u_int16_t) p->sample_rate);
- auvia_read_codec(sc, reg, &regval);
- p->sample_rate = regval;
- } else
- p->sample_rate = sc->sc_fixed_rate;
+ if ((p->precision != 8 && p->precision != 16) ||
+ (p->channels != 1 && p->channels != 2))
+ return (EINVAL);
p->factor = 1;
p->sw_code = 0;
diff --git a/sys/dev/pci/auviavar.h b/sys/dev/pci/auviavar.h
index 0ea7fab5513..b6042b2a79d 100644
--- a/sys/dev/pci/auviavar.h
+++ b/sys/dev/pci/auviavar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: auviavar.h,v 1.3 2000/12/27 02:50:07 mickey Exp $ */
+/* $OpenBSD: auviavar.h,v 1.4 2001/11/19 17:47:37 mickey Exp $ */
/* $NetBSD: auviavar.h,v 1.1 2000/03/31 04:45:29 tsarna Exp $ */
/*-
@@ -53,13 +53,9 @@ struct auvia_softc_chan {
struct auvia_softc {
struct device sc_dev;
+ void *sc_ih; /* interrupt handle */
char sc_revision[8];
- u_long sc_fixed_rate; /* if codec doesn't support variable
- * rate audio, set to the fixed rate
- * it uses */
-
- void *sc_ih; /* interrupt handle */
pci_chipset_tag_t sc_pc;
pcitag_t sc_pt;