Properly set "msb" and "bps" fields for both play and rec directions.
authorratchov <ratchov@openbsd.org>
Tue, 30 Aug 2016 11:20:09 +0000 (11:20 +0000)
committerratchov <ratchov@openbsd.org>
Tue, 30 Aug 2016 11:20:09 +0000 (11:20 +0000)
Fixes "audio0: different play and record parameters ... " errors, and
probably other unreported errors.

help and ok landry@

sys/arch/macppc/dev/i2s.c

index 4c77c94..8b9a144 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: i2s.c,v 1.32 2016/06/26 06:50:26 mglocker Exp $       */
+/*     $OpenBSD: i2s.c,v 1.33 2016/08/30 11:20:09 ratchov Exp $        */
 /*     $NetBSD: i2s.c,v 1.1 2003/12/27 02:19:34 grant Exp $    */
 
 /*-
@@ -295,13 +295,9 @@ i2s_set_params(h, setmode, usemode, play, rec)
                        p->precision = 16;
                if (p->channels > 2)
                        p->channels = 2;
-
-               switch (p->encoding) {
-               case AUDIO_ENCODING_SLINEAR_BE:
-                       break;
-               default:
-                       return (EINVAL);
-               }
+               p->bps = AUDIO_BPS(p->precision);
+               p->msb = 1;
+               p->encoding = AUDIO_ENCODING_SLINEAR_BE;
        }
 
        /* Set the speed */
@@ -309,10 +305,6 @@ i2s_set_params(h, setmode, usemode, play, rec)
                return EINVAL;
 
        p->sample_rate = sc->sc_rate;
-
-       p->bps = AUDIO_BPS(p->precision);
-       p->msb = 1;
-
        return 0;
 }