From c3ae19c91b5b97f9db722e017d7bae8b092fc6ef Mon Sep 17 00:00:00 2001 From: ratchov Date: Wed, 10 Jun 2015 20:14:02 +0000 Subject: [PATCH] Don't claim the autri(4) driver supports big-ending, signed 8-bit, or unsigned 16-bit samples. Fixes sound on big endian machines. --- sys/dev/pci/autri.c | 38 ++++++-------------------------------- 1 file 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; } -- 2.20.1