summaryrefslogtreecommitdiff
path: root/sys/arch/macppc/dev/i2s.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/macppc/dev/i2s.c')
-rw-r--r--sys/arch/macppc/dev/i2s.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/arch/macppc/dev/i2s.c b/sys/arch/macppc/dev/i2s.c
index d77ea6b7d8b..e7ccfe87aeb 100644
--- a/sys/arch/macppc/dev/i2s.c
+++ b/sys/arch/macppc/dev/i2s.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i2s.c,v 1.14 2008/10/29 03:00:19 deraadt Exp $ */
+/* $OpenBSD: i2s.c,v 1.15 2008/10/30 06:12:47 todd Exp $ */
/* $NetBSD: i2s.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */
/*-
@@ -389,10 +389,14 @@ i2s_set_params(h, setmode, usemode, play, rec)
p = mode == AUMODE_PLAY ? play : rec;
- if (p->sample_rate < 4000 || p->sample_rate > 50000 ||
- (p->precision != 8 && p->precision != 16) ||
- (p->channels != 1 && p->channels != 2))
- return EINVAL;
+ if (p->sample_rate < 4000)
+ p->sample_rate = 4000;
+ if (p->sample_rate > 50000)
+ p->sample_rate = 50000;
+ if (p->precision > 16)
+ p->precision = 16;
+ if (p->channels > 2)
+ p->channels = 2;
switch (p->encoding) {
case AUDIO_ENCODING_SLINEAR_LE:
@@ -868,9 +872,9 @@ i2s_set_rate(sc, rate)
int timo;
/* sanify */
- if (rate > 48000)
+ if (rate > (48000 + 44100) / 2)
rate = 48000;
- else if (rate < 44100)
+ else
rate = 44100;
switch (rate) {