summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorjhay <jhay@FreeBSD.org>2002-04-14 10:39:59 +0000
committerjhay <jhay@FreeBSD.org>2002-04-14 10:39:59 +0000
commit9c6b97e0231072e9dc4cd0c3b8376e5aec63e95e (patch)
treeec62343aa42a5b92cd461b81ac61f3ac30233d6f /sys/dev
parent9089f1baf84bd0b413bea2d19ab65f4a8c6600a6 (diff)
downloadFreeBSD-src-9c6b97e0231072e9dc4cd0c3b8376e5aec63e95e.zip
FreeBSD-src-9c6b97e0231072e9dc4cd0c3b8376e5aec63e95e.tar.gz
Fix the play / record rate setting so that it actually works.
The extra microphone channel capability is part of the "normal" ac97 capabilities and not an extended ac97 capability. Now recording on codecs without a seperate mic channel works. MFC after: 1 week
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/sound/pci/ich.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/sound/pci/ich.c b/sys/dev/sound/pci/ich.c
index c44e221..c639285 100644
--- a/sys/dev/sound/pci/ich.c
+++ b/sys/dev/sound/pci/ich.c
@@ -298,7 +298,12 @@ ichchan_setspeed(kobj_t obj, void *data, u_int32_t speed)
if (sc->ac97rate <= 32000 || sc->ac97rate >= 64000)
sc->ac97rate = 48000;
r = (speed * 48000) / sc->ac97rate;
- ch->spd = (ac97_setrate(sc->codec, ch->spdreg, r) * sc->ac97rate) / 48000;
+ /*
+ * Cast the return value of ac97_setrate() to u_int so that
+ * the math don't overflow into the negative range.
+ */
+ ch->spd = ((u_int)ac97_setrate(sc->codec, ch->spdreg, r) *
+ sc->ac97rate) / 48000;
} else {
ch->spd = 48000;
}
@@ -682,8 +687,8 @@ ich_pci_attach(device_t dev)
extcaps = ac97_getextcaps(sc->codec);
sc->hasvra = extcaps & AC97_EXTCAP_VRA;
sc->hasvrm = extcaps & AC97_EXTCAP_VRM;
- sc->hasmic = extcaps & AC97_CAP_MICCHANNEL;
- ac97_setextmode(sc->codec, sc->hasvra | sc->hasvrm | sc->hasmic);
+ sc->hasmic = ac97_getcaps(sc->codec) & AC97_CAP_MICCHANNEL;
+ ac97_setextmode(sc->codec, sc->hasvra | sc->hasvrm);
if (pcm_register(dev, sc, 1, sc->hasmic? 2 : 1))
goto bad;
OpenPOWER on IntegriCloud