summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMarco S Hyman <marc@cvs.openbsd.org>2005-04-05 21:08:48 +0000
committerMarco S Hyman <marc@cvs.openbsd.org>2005-04-05 21:08:48 +0000
commitd0caf0184fdef2969aa4b69cc6c0b28ca02196bb (patch)
treeb9e06b096d0ef8058be9e038b136bbf4dbea3c56 /sys/dev
parent80d01fad140ee05685bd9dd26f196eb1fb0ab3a9 (diff)
Don't clobber the returned sample rate when the AC97 changes it.
This lets an application know, should it bother testing, that a requested bit rate is not available. 'looks ok to me' mickey@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/auich.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/pci/auich.c b/sys/dev/pci/auich.c
index 83558c8c0a1..656940bf833 100644
--- a/sys/dev/pci/auich.c
+++ b/sys/dev/pci/auich.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auich.c,v 1.50 2005/04/05 17:30:57 mickey Exp $ */
+/* $OpenBSD: auich.c,v 1.51 2005/04/05 21:08:47 marc Exp $ */
/*
* Copyright (c) 2000,2001 Michael Shalayeff
@@ -678,6 +678,7 @@ auich_set_params(v, setmode, usemode, play, rec)
struct auich_softc *sc = v;
int error;
u_int orate;
+ u_int adj_rate;
if (setmode & AUMODE_PLAY) {
play->factor = 1;
@@ -844,12 +845,13 @@ auich_set_params(v, setmode, usemode, play, rec)
return (EINVAL);
}
- orate = play->sample_rate;
+ orate = adj_rate = play->sample_rate;
if (sc->sc_ac97rate != 0)
- play->sample_rate = orate * AUICH_FIXED_RATE /
- sc->sc_ac97rate;
+ adj_rate = orate * AUICH_FIXED_RATE / sc->sc_ac97rate;
+ play->sample_rate = adj_rate;
error = ac97_set_rate(sc->codec_if, play, AUMODE_PLAY);
- play->sample_rate = orate;
+ if (play->sample_rate == adj_rate)
+ play->sample_rate = orate;
if (error)
return (error);
}