summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2015-06-10 20:14:03 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2015-06-10 20:14:03 +0000
commit92e3d524276e2bfa137ebdd5d869630bbc317cc9 (patch)
treee1b7166e98d328c3b79d87fce72c5a3215daf9be /sys/dev/pci
parenta62a385bc6aebe80d2d07452232649939325d08c (diff)
Don't claim the autri(4) driver supports big-ending, signed 8-bit,
or unsigned 16-bit samples. Fixes sound on big endian machines.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/autri.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/sys/dev/pci/autri.c b/sys/dev/pci/autri.c
index 55e15990655..d46cf79e9df 100644
--- a/sys/dev/pci/autri.c
+++ b/sys/dev/pci/autri.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autri.c,v 1.38 2015/06/10 20:02:42 ratchov Exp $ */
+/* $OpenBSD: autri.c,v 1.39 2015/06/10 20:14:02 ratchov Exp $ */
/*
* Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro.
@@ -910,23 +910,11 @@ autri_query_encoding(void *addr, struct audio_encoding *fp)
fp->flags = 0;
break;
case 1:
- strlcpy(fp->name, AudioEslinear, sizeof fp->name);
- fp->encoding = AUDIO_ENCODING_SLINEAR;
- fp->precision = 8;
- fp->flags = 0;
- break;
- case 2:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
break;
- case 3:
- strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
- fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
- fp->precision = 16;
- fp->flags = 0;
- break;
default:
return (EINVAL);
}
@@ -947,28 +935,14 @@ autri_set_params(void *addr, int setmode, int usemode, struct audio_params *play
mode = mode == AUMODE_RECORD ? AUMODE_PLAY : -1) {
if ((setmode & mode) == 0)
continue;
-
p = mode == AUMODE_PLAY ? play : rec;
- if (p->sample_rate < 4000)
- p->sample_rate = 4000;
- if (p->sample_rate > 48000)
- p->sample_rate = 48000;
- if (p->precision > 16)
+ p->sample_rate = 48000;
+ if (p->precision != 8)
p->precision = 16;
- if (p->channels > 2)
+ if (p->channels != 1)
p->channels = 2;
- switch (p->encoding) {
- case AUDIO_ENCODING_SLINEAR_BE:
- case AUDIO_ENCODING_ULINEAR_BE:
- if (p->precision != 16)
- return EINVAL;
- break;
- case AUDIO_ENCODING_SLINEAR_LE:
- case AUDIO_ENCODING_ULINEAR_LE:
- break;
- default:
- return (EINVAL);
- }
+ p->encoding = p->precision == 16 ?
+ AUDIO_ENCODING_SLINEAR_LE : AUDIO_ENCODING_ULINEAR_LE;
p->bps = AUDIO_BPS(p->precision);
p->msb = 1;
}