-.\" $OpenBSD: audio.9,v 1.33 2022/10/28 15:13:59 kn Exp $
+.\" $OpenBSD: audio.9,v 1.34 2022/11/02 10:41:34 kn Exp $
.\" $NetBSD: audio.9,v 1.14 2000/02/11 22:56:15 kleink Exp $
.\"
.\" Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: October 28 2022 $
+.Dd $Mdocdate: November 2 2022 $
.Dt AUDIO 9
.Os
.Sh NAME
int (*halt_output)(void *);
int (*halt_input)(void *);
- int (*speaker_ctl)(void *, int);
-#define SPKR_ON 1
-#define SPKR_OFF 0
-
int (*set_port)(void *, struct mixer_ctrl *);
int (*get_port)(void *, struct mixer_ctrl *);
.Fn start_input )
in progress.
This function returns 0 on success, otherwise an error code.
-.It Ft int Fn (*speaker_ctl) "void *hdl" "int on"
-This function is optional.
-If supplied, it is called when a half duplex device changes between
-playing and recording.
-It can, e.g., be used to turn the speaker on and off.
-This function returns 0 on success, otherwise an error code.
.It Ft int Fn (*set_port) "void *hdl" "struct mixer_ctrl *mc"
This function is called when the
.Dv AUDIO_MIXER_WRITE
-/* $OpenBSD: nec86.c,v 1.8 2022/10/28 15:09:45 kn Exp $ */
+/* $OpenBSD: nec86.c,v 1.9 2022/11/02 10:41:34 kn Exp $ */
/* $NecBSD: nec86.c,v 1.11 1999/07/23 11:04:39 honda Exp $ */
/* $NetBSD$ */
.start_input = nec86hw_pdma_input,
.halt_output = nec86hw_halt_pdma,
.halt_input = nec86hw_halt_pdma,
- .speaker_ctl = nec86hw_speaker_ctl,
.set_port = nec86hw_mixer_set_port,
.get_port = nec86hw_mixer_get_port,
.query_devinfo = nec86hw_mixer_query_devinfo,
-/* $OpenBSD: nec86hw.c,v 1.8 2022/10/28 15:09:45 kn Exp $ */
+/* $OpenBSD: nec86hw.c,v 1.9 2022/11/02 10:41:34 kn Exp $ */
/* $NecBSD: nec86hw.c,v 1.13 1998/03/14 07:04:54 kmatsuda Exp $ */
/* $NetBSD$ */
if (sc->sc_open != 0 || nec86hw_reset(sc) != 0)
return ENXIO;
+ nec86hw_speaker_ctl(sc, (flags & FWRITE) ? SPKR_ON : SPKR_OFF);
+
sc->sc_open = 1;
sc->sc_intr = NULL;
sc->sc_arg = NULL;
-/* $OpenBSD: audio.c,v 1.203 2022/10/28 15:13:59 kn Exp $ */
+/* $OpenBSD: audio.c,v 1.204 2022/11/02 10:41:34 kn Exp $ */
/*
* Copyright (c) 2015 Alexandre Ratchov <alex@caoua.org>
*
if (flags & FREAD)
sc->mode |= AUMODE_RECORD;
- if (sc->ops->speaker_ctl) {
- /*
- * XXX: what is this used for?
- */
- sc->ops->speaker_ctl(sc->arg,
- (sc->mode & AUMODE_PLAY) ? SPKR_ON : SPKR_OFF);
- }
-
error = audio_setpar(sc);
if (error)
goto bad;
-/* $OpenBSD: audio_if.h,v 1.41 2022/10/28 15:13:59 kn Exp $ */
+/* $OpenBSD: audio_if.h,v 1.42 2022/11/02 10:41:34 kn Exp $ */
/* $NetBSD: audio_if.h,v 1.24 1998/01/10 14:07:25 tv Exp $ */
/*
int (*halt_output)(void *);
int (*halt_input)(void *);
- int (*speaker_ctl)(void *, int);
#define SPKR_ON 1
#define SPKR_OFF 0
-/* $OpenBSD: ess.c,v 1.32 2022/10/28 14:55:46 kn Exp $ */
+/* $OpenBSD: ess.c,v 1.33 2022/11/02 10:41:34 kn Exp $ */
/* $NetBSD: ess.c,v 1.44.4.1 1999/06/21 01:18:00 thorpej Exp $ */
/*
.round_blocksize = ess_round_blocksize,
.halt_output = ess_audio1_halt,
.halt_input = ess_audio1_halt,
- .speaker_ctl = ess_speaker_ctl,
.set_port = ess_set_port,
.get_port = ess_get_port,
.query_devinfo = ess_query_devinfo,
.round_blocksize = ess_round_blocksize,
.halt_output = ess_audio2_halt,
.halt_input = ess_audio1_halt,
- .speaker_ctl = ess_speaker_ctl,
.set_port = ess_set_port,
.get_port = ess_get_port,
.query_devinfo = ess_query_devinfo,
ess_setup(sc); /* because we did a reset */
+ ess_speaker_ctl(sc, (flags & FWRITE) ? SPKR_ON : SPKR_OFF);
+
sc->sc_open = 1;
DPRINTF(("ess_open: opened\n"));
-/* $OpenBSD: gus.c,v 1.54 2022/10/28 14:55:46 kn Exp $ */
+/* $OpenBSD: gus.c,v 1.55 2022/11/02 10:41:34 kn Exp $ */
/* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */
/*-
.start_input = gus_dma_input,
.halt_output = gus_halt_out_dma,
.halt_input = gus_halt_in_dma,
- .speaker_ctl = gus_speaker_ctl,
.set_port = gus_mixer_set_port,
.get_port = gus_mixer_get_port,
.query_devinfo = gus_mixer_query_devinfo,
.start_input = gusmax_dma_input,
.halt_output = gusmax_halt_out_dma,
.halt_input = gusmax_halt_in_dma,
- .speaker_ctl = gusmax_speaker_ctl,
.set_port = gusmax_mixer_set_port,
.get_port = gusmax_mixer_get_port,
.query_devinfo = gusmax_mixer_query_devinfo,
if (sc->sc_flags & GUS_OPEN)
return EBUSY;
+ gus_speaker_ctl(sc, (flags & FWRITE) ? SPKR_ON : SPKR_OFF);
+
/*
* Some initialization
*/
}
/*
- * Interface to the audio layer - turn the output on or off. Note that some
+ * Turn the output on or off. Note that some
* of these bits are flipped in the register
*/
-int
-gusmax_speaker_ctl(void *addr, int newstate)
-{
- struct ad1848_softc *sc = addr;
- return gus_speaker_ctl(sc->parent, newstate);
-}
-
int
gus_speaker_ctl(void *addr, int newstate)
{
-/* $OpenBSD: gusvar.h,v 1.12 2022/10/28 14:55:46 kn Exp $ */
+/* $OpenBSD: gusvar.h,v 1.13 2022/11/02 10:41:34 kn Exp $ */
/* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */
/*-
int gusmax_dma_input(void *, void *, int, void (*)(void *), void *);
int gusmax_halt_out_dma(void *);
int gusmax_halt_in_dma(void *);
-int gusmax_speaker_ctl(void *, int);
void gus_deinterleave(struct gus_softc *, void *, int);
-/* $OpenBSD: pas.c,v 1.36 2022/10/28 14:55:46 kn Exp $ */
+/* $OpenBSD: pas.c,v 1.37 2022/11/02 10:41:34 kn Exp $ */
/* $NetBSD: pas.c,v 1.37 1998/01/12 09:43:43 thorpej Exp $ */
/*
.round_blocksize = sbdsp_round_blocksize,
.halt_output = sbdsp_haltdma,
.halt_input = sbdsp_haltdma,
- .speaker_ctl = sbdsp_speaker_ctl,
.set_port = sbdsp_mixer_set_port,
.get_port = sbdsp_mixer_get_port,
.query_devinfo = sbdsp_mixer_query_devinfo,
-/* $OpenBSD: sb.c,v 1.34 2022/10/28 14:55:46 kn Exp $ */
+/* $OpenBSD: sb.c,v 1.35 2022/11/02 10:41:34 kn Exp $ */
/* $NetBSD: sb.c,v 1.57 1998/01/12 09:43:46 thorpej Exp $ */
/*
.round_blocksize = sbdsp_round_blocksize,
.halt_output = sbdsp_haltdma,
.halt_input = sbdsp_haltdma,
- .speaker_ctl = sbdsp_speaker_ctl,
.set_port = sbdsp_mixer_set_port,
.get_port = sbdsp_mixer_get_port,
.query_devinfo = sbdsp_mixer_query_devinfo,
-/* $OpenBSD: sbdsp.c,v 1.43 2022/10/30 10:55:52 kn Exp $ */
+/* $OpenBSD: sbdsp.c,v 1.44 2022/11/02 10:41:34 kn Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
if (sbdsp_reset(sc) != 0)
return EIO;
+ sbdsp_speaker_ctl(sc, (flags & FWRITE) ? SPKR_ON : SPKR_OFF);
+
sc->sc_open = SB_OPEN_AUDIO;
sc->sc_openflags = flags;
sc->sc_intrm = 0;