Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Cleanup:
details: https://anonhg.NetBSD.org/src/rev/ece43b1cf5c9
branches: trunk
changeset: 552756:ece43b1cf5c9
user: mycroft <mycroft%NetBSD.org@localhost>
date: Thu Oct 02 07:41:53 2003 +0000
description:
Cleanup:
* auich_calibrate() assumes that the AC97 part is in its reset state. To
ensure this, call audio_attach_mi() after auich_calibrate().
* Explicitly support 12000Hz and 24000Hz. (Why is there a discrete list at
all?)
* Fix an obvious recording bug -- we were acking the wrong interrupt.
* Ensure that we don't get an interrupt during the AC97 speed probe by clearing
the "interrupt on completion" bit in the DMA setup.
diffstat:
sys/dev/pci/auich.c | 40 +++++++++++++++++++++++-----------------
1 files changed, 23 insertions(+), 17 deletions(-)
diffs (128 lines):
diff -r 54c77fa87d4f -r ece43b1cf5c9 sys/dev/pci/auich.c
--- a/sys/dev/pci/auich.c Thu Oct 02 07:19:37 2003 +0000
+++ b/sys/dev/pci/auich.c Thu Oct 02 07:41:53 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auich.c,v 1.41 2003/09/28 13:37:19 kent Exp $ */
+/* $NetBSD: auich.c,v 1.42 2003/10/02 07:41:53 mycroft Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -115,7 +115,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.41 2003/09/28 13:37:19 kent Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.42 2003/10/02 07:41:53 mycroft Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -283,7 +283,8 @@
void auich_powerhook(int, void *);
int auich_set_rate(struct auich_softc *, int, u_long);
-void auich_calibrate(struct device *);
+void auich_finish_attach(struct device *);
+void auich_calibrate(struct auich_softc *);
struct audio_hw_if auich_hw_if = {
@@ -504,15 +505,22 @@
if (ac97_attach(&sc->host_if) != 0)
return;
- audio_attach_mi(&auich_hw_if, sc, &sc->sc_dev);
-
/* Watch for power change */
sc->sc_suspend = PWR_RESUME;
sc->sc_powerhook = powerhook_establish(auich_powerhook, sc);
- if (!IS_FIXED_RATE(sc->codec_if)) {
- config_interrupts(self, auich_calibrate);
- }
+ config_interrupts(self, auich_finish_attach);
+}
+
+void
+auich_finish_attach(struct device *self)
+{
+ struct auich_softc *sc = (void *)self;
+
+ if (!IS_FIXED_RATE(sc->codec_if))
+ auich_calibrate(sc);
+
+ audio_attach_mi(&auich_hw_if, sc, &sc->sc_dev);
}
#define ICH_CODECIO_INTERVAL 10
@@ -728,8 +736,10 @@
if ((p->sample_rate != 8000) &&
(p->sample_rate != 11025) &&
+ (p->sample_rate != 12000) &&
(p->sample_rate != 16000) &&
(p->sample_rate != 22050) &&
+ (p->sample_rate != 24000) &&
(p->sample_rate != 32000) &&
(p->sample_rate != 44100) &&
(p->sample_rate != 48000))
@@ -1135,7 +1145,7 @@
/* int ack */
bus_space_write_2(sc->iot, sc->aud_ioh, ICH_PCMI + sc->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);
+ bus_space_write_2(sc->iot, sc->aud_ioh, ICH_GSTS, ICH_PIINT);
ret++;
}
@@ -1429,16 +1439,14 @@
/* Calibrate card (some boards are overclocked and need scaling) */
void
-auich_calibrate(struct device *self)
+auich_calibrate(struct auich_softc *sc)
{
- struct auich_softc *sc;
struct timeval t1, t2;
u_int8_t ociv, nciv;
u_int32_t wait_us, actual_48k_rate, bytes, ac97rate;
void *temp_buffer;
struct auich_dma *p;
- sc = (struct auich_softc*)self;
/*
* Grab audio from input for fixed interval and compare how
* much we actually get with what we expect. Interval needs
@@ -1456,7 +1464,7 @@
return;
}
sc->dmalist_pcmi[0].base = DMAADDR(p);
- sc->dmalist_pcmi[0].len = (bytes / sc->sc_sample_size) | ICH_DMAF_IOC;
+ sc->dmalist_pcmi[0].len = (bytes / sc->sc_sample_size);
/*
* our data format is stereo, 16 bit so each sample is 4 bytes.
@@ -1472,7 +1480,6 @@
/* prepare */
ociv = bus_space_read_1(sc->iot, sc->aud_ioh, ICH_PCMI + ICH_CIV);
- nciv = ociv;
bus_space_write_4(sc->iot, sc->aud_ioh, ICH_PCMI + ICH_BDBAR,
sc->sc_cddma + ICH_PCMI_OFF(0));
bus_space_write_1(sc->iot, sc->aud_ioh, ICH_PCMI + ICH_LVI,
@@ -1483,14 +1490,13 @@
bus_space_write_1(sc->iot, sc->aud_ioh, ICH_PCMI + ICH_CTRL, ICH_RPBM);
/* wait */
- while (nciv == ociv) {
+ do {
microtime(&t2);
if (t2.tv_sec - t1.tv_sec > 1)
break;
nciv = bus_space_read_1(sc->iot, sc->aud_ioh,
ICH_PCMI + ICH_CIV);
- }
- microtime(&t2);
+ } while (nciv == ociv);
/* stop */
bus_space_write_1(sc->iot, sc->aud_ioh, ICH_PCMI + ICH_CTRL, 0);
Home |
Main Index |
Thread Index |
Old Index