summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authoraugustss <augustss@NetBSD.org>1997-07-27 23:51:48 +0000
committeraugustss <augustss@NetBSD.org>1997-07-27 23:51:48 +0000
commitd58bc6796ff2806880334c38f31e4a7d123e6944 (patch)
tree743b1da0ff34ace8c0b45ba10b8756a930c2f3f6 /sys/dev
parent63decd94381c63d26ed2d9c899735d9ec9aac7e8 (diff)
audio: Simplify handling of AUDIO_SETFD and committing of encoding mode.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/audio.c66
-rw-r--r--sys/dev/ic/am7930.c22
-rw-r--r--sys/dev/isa/gus.c15
-rw-r--r--sys/dev/isa/pas.c12
-rw-r--r--sys/dev/isa/pss.c14
-rw-r--r--sys/dev/isa/sb.c8
-rw-r--r--sys/dev/isa/sbdsp.c18
-rw-r--r--sys/dev/isa/sbdspvar.h4
-rw-r--r--sys/dev/isa/wss.c15
9 files changed, 64 insertions, 110 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index 61e1bdb7114..8a292ffa157 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.53 1997/07/27 23:06:04 augustss Exp $ */
+/* $NetBSD: audio.c,v 1.54 1997/07/27 23:51:53 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -254,7 +254,6 @@ audio_hardware_attach(hwp, hdlp)
hwp->get_out_port == 0 ||
hwp->set_in_port == 0 ||
hwp->get_in_port == 0 ||
- hwp->commit_settings == 0 ||
hwp->start_output == 0 ||
hwp->start_input == 0 ||
hwp->halt_output == 0 ||
@@ -664,7 +663,8 @@ audio_open(dev, flags, ifmt, p)
DPRINTF(("audio_open: rr.buf=%p-%p pr.buf=%p-%p\n",
sc->sc_rr.start, sc->sc_rr.end, sc->sc_pr.start, sc->sc_pr.end));
- hw->commit_settings(sc->hw_hdl);
+ if (hw->commit_settings)
+ hw->commit_settings(sc->hw_hdl);
sc->sc_rchan = 0;
sc->sc_wchan = 0;
@@ -1283,9 +1283,19 @@ audio_ioctl(dev, cmd, addr, flag, p)
case AUDIO_SETFD:
DPRINTF(("AUDIO_SETFD\n"));
- error = hw->setfd(sc->hw_hdl, *(int *)addr);
- if (error == 0)
- sc->sc_full_duplex = *(int *)addr;
+ if (hw->props & AUDIO_PROP_FULLDUPLEX) {
+ if (hw->setfd)
+ error = hw->setfd(sc->hw_hdl, *(int *)addr);
+ else
+ error = 0;
+ if (!error)
+ sc->sc_full_duplex = *(int *)addr;
+ } else {
+ if (*(int *)addr)
+ error = ENOTTY;
+ else
+ error = 0;
+ }
break;
case AUDIO_GETPROPS:
@@ -1976,9 +1986,11 @@ audiosetinfo(sc, ai)
audio_init_record(sc);
}
- error = hw->commit_settings(sc->hw_hdl);
- if (error)
- return (error);
+ if (hw->commit_settings) {
+ error = hw->commit_settings(sc->hw_hdl);
+ if (error)
+ return (error);
+ }
if (cleared) {
s = splaudio();
@@ -2119,37 +2131,37 @@ mixer_ioctl(dev, cmd, addr, flag, p)
int error = EINVAL;
DPRINTF(("mixer_ioctl(%d,'%c',%d)\n",
- IOCPARM_LEN(cmd), IOCGROUP(cmd), cmd&0xff));
+ IOCPARM_LEN(cmd), IOCGROUP(cmd), cmd&0xff));
switch (cmd) {
case AUDIO_GETDEV:
- DPRINTF(("AUDIO_GETDEV\n"));
- error = hw->getdev(sc->hw_hdl, (audio_device_t *)addr);
- break;
+ DPRINTF(("AUDIO_GETDEV\n"));
+ error = hw->getdev(sc->hw_hdl, (audio_device_t *)addr);
+ break;
case AUDIO_MIXER_DEVINFO:
- DPRINTF(("AUDIO_MIXER_DEVINFO\n"));
- error = hw->query_devinfo(sc->hw_hdl, (mixer_devinfo_t *)addr);
- break;
+ DPRINTF(("AUDIO_MIXER_DEVINFO\n"));
+ error = hw->query_devinfo(sc->hw_hdl, (mixer_devinfo_t *)addr);
+ break;
case AUDIO_MIXER_READ:
- DPRINTF(("AUDIO_MIXER_READ\n"));
- error = hw->get_port(sc->hw_hdl, (mixer_ctrl_t *)addr);
- break;
+ DPRINTF(("AUDIO_MIXER_READ\n"));
+ error = hw->get_port(sc->hw_hdl, (mixer_ctrl_t *)addr);
+ break;
case AUDIO_MIXER_WRITE:
- DPRINTF(("AUDIO_MIXER_WRITE\n"));
- error = hw->set_port(sc->hw_hdl, (mixer_ctrl_t *)addr);
- if (error == 0)
- error = hw->commit_settings(sc->hw_hdl);
- break;
+ DPRINTF(("AUDIO_MIXER_WRITE\n"));
+ error = hw->set_port(sc->hw_hdl, (mixer_ctrl_t *)addr);
+ if (!error && hw->commit_settings)
+ error = hw->commit_settings(sc->hw_hdl);
+ break;
default:
- error = EINVAL;
- break;
+ error = EINVAL;
+ break;
}
DPRINTF(("mixer_ioctl(%d,'%c',%d) result %d\n",
- IOCPARM_LEN(cmd), IOCGROUP(cmd), cmd&0xff, error));
+ IOCPARM_LEN(cmd), IOCGROUP(cmd), cmd&0xff, error));
return (error);
}
#endif
diff --git a/sys/dev/ic/am7930.c b/sys/dev/ic/am7930.c
index 11ac062203c..2fbca9fdd40 100644
--- a/sys/dev/ic/am7930.c
+++ b/sys/dev/ic/am7930.c
@@ -1,4 +1,4 @@
-/* $NetBSD: am7930.c,v 1.23 1997/07/27 01:16:37 augustss Exp $ */
+/* $NetBSD: am7930.c,v 1.24 1997/07/27 23:51:52 augustss Exp $ */
/*
* Copyright (c) 1995 Rolf Grossmann
@@ -222,7 +222,6 @@ int amd7930_halt_input __P((void *));
int amd7930_cont_output __P((void *));
int amd7930_cont_input __P((void *));
int amd7930_getdev __P((void *, struct audio_device *));
-int amd7930_setfd __P((void *, int));
int amd7930_set_port __P((void *, mixer_ctrl_t *));
int amd7930_get_port __P((void *, mixer_ctrl_t *));
int amd7930_query_devinfo __P((void *, mixer_devinfo_t *));
@@ -231,7 +230,7 @@ int amd7930_query_devinfo __P((void *, mixer_devinfo_t *));
struct audio_hw_if sa_hw_if = {
amd7930_open,
amd7930_close,
- NULL,
+ 0,
amd7930_query_encoding,
amd7930_set_params,
amd7930_round_blocksize,
@@ -240,17 +239,17 @@ struct audio_hw_if sa_hw_if = {
amd7930_set_in_port,
amd7930_get_in_port,
amd7930_commit_settings,
- NULL,
- NULL,
+ 0,
+ 0,
amd7930_start_output,
amd7930_start_input,
amd7930_halt_output,
amd7930_halt_input,
amd7930_cont_output,
amd7930_cont_input,
- NULL,
+ 0,
amd7930_getdev,
- amd7930_setfd,
+ 0,
amd7930_set_port,
amd7930_get_port,
amd7930_query_devinfo,
@@ -663,15 +662,6 @@ amd7930_getdev(addr, retp)
}
int
-amd7930_setfd(addr, flag)
- void *addr;
- int flag;
-{
- /* Always full-duplex */
- return(0);
-}
-
-int
amd7930_set_port(addr, cp)
void *addr;
mixer_ctrl_t *cp;
diff --git a/sys/dev/isa/gus.c b/sys/dev/isa/gus.c
index e918706fa12..c6a62e427fd 100644
--- a/sys/dev/isa/gus.c
+++ b/sys/dev/isa/gus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gus.c,v 1.33 1997/07/27 01:16:55 augustss Exp $ */
+/* $NetBSD: gus.c,v 1.34 1997/07/27 23:51:55 augustss Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -418,7 +418,6 @@ STATIC void gus_start_playing __P((struct gus_softc *, int));
STATIC int gus_continue_playing __P((struct gus_softc *, int));
STATIC u_char guspeek __P((int, u_long));
STATIC u_long convert_to_16bit __P((u_long));
-STATIC int gus_setfd __P((void *, int));
STATIC int gus_mixer_set_port __P((void *, mixer_ctrl_t *));
STATIC int gus_mixer_get_port __P((void *, mixer_ctrl_t *));
STATIC int gusmax_mixer_set_port __P((void *, mixer_ctrl_t *));
@@ -623,7 +622,7 @@ struct audio_hw_if gus_hw_if = {
gus_speaker_ctl,
gus_getdev,
- gus_setfd,
+ NULL,
gus_mixer_set_port,
gus_mixer_get_port,
gus_mixer_query_devinfo,
@@ -2792,7 +2791,7 @@ gus_init_cs4231(sc)
gusmax_speaker_ctl,
gus_getdev,
- gus_setfd,
+ NULL,
gusmax_mixer_set_port,
gusmax_mixer_get_port,
gusmax_mixer_query_devinfo,
@@ -3163,14 +3162,6 @@ gus_cont_in_dma(addr)
}
-STATIC int
-gus_setfd(addr, flag)
- void *addr;
- int flag;
-{
- return(0); /* nothing fancy to do. */
-}
-
STATIC __inline int
gus_to_vol(cp, vol)
mixer_ctrl_t *cp;
diff --git a/sys/dev/isa/pas.c b/sys/dev/isa/pas.c
index 5aa05ad2cdf..7cdf20c7497 100644
--- a/sys/dev/isa/pas.c
+++ b/sys/dev/isa/pas.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pas.c,v 1.29 1997/07/27 01:17:02 augustss Exp $ */
+/* $NetBSD: pas.c,v 1.30 1997/07/27 23:51:57 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -111,7 +111,7 @@ void pasconf __P((int, int, int, int));
struct audio_hw_if pas_hw_if = {
pasopen,
sbdsp_close,
- NULL,
+ 0,
sbdsp_query_encoding,
sbdsp_set_params,
sbdsp_round_blocksize,
@@ -119,9 +119,9 @@ struct audio_hw_if pas_hw_if = {
sbdsp_get_out_port,
sbdsp_set_in_port,
sbdsp_get_in_port,
- sbdsp_commit_settings,
- NULL,
- NULL,
+ 0,
+ 0,
+ 0,
sbdsp_dma_output,
sbdsp_dma_input,
sbdsp_haltdma,
@@ -130,7 +130,7 @@ struct audio_hw_if pas_hw_if = {
sbdsp_contdma,
sbdsp_speaker_ctl,
pas_getdev,
- sbdsp_setfd,
+ 0,
sbdsp_mixer_set_port,
sbdsp_mixer_get_port,
sbdsp_mixer_query_devinfo,
diff --git a/sys/dev/isa/pss.c b/sys/dev/isa/pss.c
index b0b9cf28527..768a39a6ded 100644
--- a/sys/dev/isa/pss.c
+++ b/sys/dev/isa/pss.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pss.c,v 1.29 1997/07/27 01:17:04 augustss Exp $ */
+/* $NetBSD: pss.c,v 1.30 1997/07/27 23:51:59 augustss Exp $ */
/*
* Copyright (c) 1994 John Brezak
@@ -185,7 +185,6 @@ int mpuintr __P((void *));
int pss_speaker_ctl __P((void *, int));
int pss_getdev __P((void *, struct audio_device *));
-int pss_setfd __P((void *, int));
int pss_set_out_port __P((void *, int));
int pss_get_out_port __P((void *));
@@ -252,7 +251,7 @@ struct audio_hw_if pss_audio_if = {
ad1848_cont_in_dma,
pss_speaker_ctl,
pss_getdev,
- pss_setfd,
+ NULL,
pss_mixer_set_port,
pss_mixer_get_port,
pss_query_devinfo,
@@ -1395,15 +1394,6 @@ pss_getdev(addr, retp)
}
int
-pss_setfd(addr, flag)
- void *addr;
- int flag;
-{
- /* Can't do full-duplex */
- return(ENOTTY);
-}
-
-int
pss_set_out_port(addr, port)
void *addr;
int port;
diff --git a/sys/dev/isa/sb.c b/sys/dev/isa/sb.c
index a0af0d0372f..0bc7b658d42 100644
--- a/sys/dev/isa/sb.c
+++ b/sys/dev/isa/sb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sb.c,v 1.50 1997/07/27 01:17:05 augustss Exp $ */
+/* $NetBSD: sb.c,v 1.51 1997/07/27 23:52:00 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -77,7 +77,7 @@ int sb_getdev __P((void *, struct audio_device *));
struct audio_hw_if sb_hw_if = {
sbopen,
sbdsp_close,
- NULL,
+ 0,
sbdsp_query_encoding,
sbdsp_set_params,
sbdsp_round_blocksize,
@@ -85,7 +85,7 @@ struct audio_hw_if sb_hw_if = {
sbdsp_get_out_port,
sbdsp_set_in_port,
sbdsp_get_in_port,
- sbdsp_commit_settings,
+ 0,
sbdsp_dma_init_output,
sbdsp_dma_init_input,
sbdsp_dma_output,
@@ -96,7 +96,7 @@ struct audio_hw_if sb_hw_if = {
sbdsp_contdma,
sbdsp_speaker_ctl,
sb_getdev,
- sbdsp_setfd,
+ 0,
sbdsp_mixer_set_port,
sbdsp_mixer_get_port,
sbdsp_mixer_query_devinfo,
diff --git a/sys/dev/isa/sbdsp.c b/sys/dev/isa/sbdsp.c
index 1f32315dbee..58ab627a2f1 100644
--- a/sys/dev/isa/sbdsp.c
+++ b/sys/dev/isa/sbdsp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sbdsp.c,v 1.60 1997/07/27 01:17:07 augustss Exp $ */
+/* $NetBSD: sbdsp.c,v 1.61 1997/07/27 23:52:01 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -808,13 +808,6 @@ sbdsp_round_blocksize(addr, blk)
}
int
-sbdsp_commit_settings(addr)
- void *addr;
-{
- return 0;
-}
-
-int
sbdsp_open(sc, dev, flags)
struct sbdsp_softc *sc;
dev_t dev;
@@ -1507,15 +1500,6 @@ sbdsp_midi_output(sc, v)
}
#endif
-int
-sbdsp_setfd(addr, flag)
- void *addr;
- int flag;
-{
- /* Can't do full-duplex */
- return ENOTTY;
-}
-
void
sbdsp_set_mixer_gain(sc, port)
struct sbdsp_softc *sc;
diff --git a/sys/dev/isa/sbdspvar.h b/sys/dev/isa/sbdspvar.h
index cc75224c930..4d155cca9c6 100644
--- a/sys/dev/isa/sbdspvar.h
+++ b/sys/dev/isa/sbdspvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: sbdspvar.h,v 1.24 1997/07/27 01:17:08 augustss Exp $ */
+/* $NetBSD: sbdspvar.h,v 1.25 1997/07/27 23:52:02 augustss Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -172,7 +172,6 @@ int sbdsp_get_in_port __P((void *));
int sbdsp_get_avail_in_ports __P((void *));
int sbdsp_get_avail_out_ports __P((void *));
int sbdsp_speaker_ctl __P((void *, int));
-int sbdsp_commit_settings __P((void *));
int sbdsp_dma_init_input __P((void *, void *, int));
int sbdsp_dma_init_output __P((void *, void *, int));
@@ -195,7 +194,6 @@ int sbdsp_rdsp __P((struct sbdsp_softc *));
int sbdsp_intr __P((void *));
int sbdsp_set_sr __P((struct sbdsp_softc *, u_long *, int));
-int sbdsp_setfd __P((void *, int));
void sbdsp_mix_write __P((struct sbdsp_softc *, int, int));
int sbdsp_mix_read __P((struct sbdsp_softc *, int));
diff --git a/sys/dev/isa/wss.c b/sys/dev/isa/wss.c
index b4a69117f06..c0e10ff5501 100644
--- a/sys/dev/isa/wss.c
+++ b/sys/dev/isa/wss.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wss.c,v 1.27 1997/07/27 01:17:09 augustss Exp $ */
+/* $NetBSD: wss.c,v 1.28 1997/07/27 23:52:03 augustss Exp $ */
/*
* Copyright (c) 1994 John Brezak
@@ -139,7 +139,6 @@ struct audio_device wss_device = {
int wssopen __P((dev_t, int));
int wss_getdev __P((void *, struct audio_device *));
-int wss_setfd __P((void *, int));
int wss_set_out_port __P((void *, int));
int wss_get_out_port __P((void *));
@@ -181,7 +180,7 @@ struct audio_hw_if wss_hw_if = {
ad1848_cont_in_dma,
NULL,
wss_getdev,
- wss_setfd,
+ NULL,
wss_mixer_set_port,
wss_mixer_get_port,
wss_query_devinfo,
@@ -386,16 +385,6 @@ wss_getdev(addr, retp)
}
int
-wss_setfd(addr, flag)
- void *addr;
- int flag;
-{
- /* Can't do full-duplex */
- return(ENOTTY);
-}
-
-
-int
wss_set_out_port(addr, port)
void *addr;
int port;