When resuming the audio device, call audiosetinfo with the last known good

parameters. Fixes an issue with suspending the audio device while playback
is paused.
This commit is contained in:
jmcneill 2007-12-13 14:02:53 +00:00
parent df6e82e8f8
commit 67153124ea
2 changed files with 11 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: audio.c,v 1.228 2007/12/11 00:08:14 martin Exp $ */
/* $NetBSD: audio.c,v 1.229 2007/12/13 14:02:53 jmcneill Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.228 2007/12/11 00:08:14 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.229 2007/12/13 14:02:53 jmcneill Exp $");
#include "audio.h"
#if NAUDIO > 0
@ -329,6 +329,7 @@ audioattach(struct device *parent, struct device *self, void *aux)
sc->sc_dev = parent;
sc->sc_opencnt = 0;
sc->sc_writing = sc->sc_waitcomp = 0;
sc->sc_lastinfovalid = false;
error = audio_alloc_ring(sc, &sc->sc_pr, AUMODE_PLAY, AU_RING_SIZE);
if (error) {
@ -3544,6 +3545,9 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai)
goto cleanup;
}
sc->sc_lastinfo = *ai;
sc->sc_lastinfovalid = true;
cleanup:
if (cleared || pausechange) {
int init_error;
@ -4012,6 +4016,8 @@ audio_resume(device_t dv)
int s;
s = splaudio();
if (sc->sc_lastinfovalid)
audiosetinfo(sc, &sc->sc_lastinfo);
audio_mixer_restore(sc);
if (sc->sc_pbus == true)
audiostartp(sc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: audiovar.h,v 1.40 2007/12/09 20:27:52 jmcneill Exp $ */
/* $NetBSD: audiovar.h,v 1.41 2007/12/13 14:02:53 jmcneill Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -226,6 +226,8 @@ struct audio_softc {
#endif
u_int sc_lastgain;
struct audio_info sc_lastinfo;
bool sc_lastinfovalid;
mixer_ctrl_t *sc_mixer_state;
int sc_nmixer_states;