Module Name: src
Committed By: jmcneill
Date: Tue Sep 2 09:58:02 UTC 2014
Modified Files:
src/sys/arch/arm/broadcom: bcm2835_vcaudio.c
Log Message:
use a fixed frequency (48kHz) and configure the audio server at attach time,
instead of at the beginning of playback
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/broadcom/bcm2835_vcaudio.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/broadcom/bcm2835_vcaudio.c
diff -u src/sys/arch/arm/broadcom/bcm2835_vcaudio.c:1.3 src/sys/arch/arm/broadcom/bcm2835_vcaudio.c:1.4
--- src/sys/arch/arm/broadcom/bcm2835_vcaudio.c:1.3 Mon May 5 08:13:31 2014
+++ src/sys/arch/arm/broadcom/bcm2835_vcaudio.c Tue Sep 2 09:58:02 2014
@@ -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 <[email protected]>
@@ -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 @@ vcaudio_init(struct vcaudio_softc *sc)
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 @@ vcaudio_init(struct vcaudio_softc *sc)
}
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 @@ vcaudio_worker(struct work *wk, void *pr
#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);