Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/broadcom use a fixed frequency (48kHz) and conf...



details:   https://anonhg.NetBSD.org/src/rev/f02dbe61085c
branches:  trunk
changeset: 802098:f02dbe61085c
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Sep 02 09:58:02 2014 +0000

description:
use a fixed frequency (48kHz) and configure the audio server at attach time, instead of at the beginning of playback

diffstat:

 sys/arch/arm/broadcom/bcm2835_vcaudio.c |  28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diffs (63 lines):

diff -r 7954a6d6b63d -r f02dbe61085c sys/arch/arm/broadcom/bcm2835_vcaudio.c
--- a/sys/arch/arm/broadcom/bcm2835_vcaudio.c   Tue Sep 02 09:55:48 2014 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_vcaudio.c   Tue Sep 02 09:58:02 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_vcaudio.c,v 1.3 2014/05/05 08:13:31 skrll Exp $ */
+/* $NetBSD: bcm2835_vcaudio.c,v 1.4 2014/09/02 09:58:02 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2013 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_vcaudio.c,v 1.3 2014/05/05 08:13:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_vcaudio.c,v 1.4 2014/09/02 09:58:02 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -242,7 +242,7 @@
        sc->sc_format.channels = 2;
        sc->sc_format.channel_mask = AUFMT_STEREO;
        sc->sc_format.frequency_type = 0;
-       sc->sc_format.frequency[0] = 8000;
+       sc->sc_format.frequency[0] = 48000;
        sc->sc_format.frequency[1] = 48000;
 
        error = auconv_create_encodings(&sc->sc_format, 1, &sc->sc_encodings);
@@ -298,6 +298,17 @@
        }
 
        memset(&msg, 0, sizeof(msg));
+       msg.type = VC_AUDIO_MSG_TYPE_CONFIG;
+       msg.u.config.channels = 2;
+       msg.u.config.samplerate = 48000;
+       msg.u.config.bps = 16;
+       error = vcaudio_msg_sync(sc, &msg, sizeof(msg));
+       if (error) {
+               device_printf(sc->sc_dev, "couldn't send CONFIG message (%d)\n",
+                   error);
+       }
+
+       memset(&msg, 0, sizeof(msg));
        msg.type = VC_AUDIO_MSG_TYPE_CONTROL;
        msg.u.control.volume = vol2pct(sc->sc_volume);
        msg.u.control.dest = VCAUDIO_DEST_AUTO;
@@ -393,17 +404,6 @@
 #endif
 
                memset(&msg, 0, sizeof(msg));
-               msg.type = VC_AUDIO_MSG_TYPE_CONFIG;
-               msg.u.config.channels = sc->sc_pparam.channels;
-               msg.u.config.samplerate = sc->sc_pparam.sample_rate;
-               msg.u.config.bps = sc->sc_pparam.precision;
-               error = vcaudio_msg_sync(sc, &msg, sizeof(msg));
-               if (error) {
-                       printf("%s: failed to config (%d)\n", __func__, error);
-                       goto done;
-               }
-
-               memset(&msg, 0, sizeof(msg));
                msg.type = VC_AUDIO_MSG_TYPE_START;
                error = vchi_msg_queue(sc->sc_service, &msg, sizeof(msg),
                    VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL);



Home | Main Index | Thread Index | Old Index