diff options
57 files changed, 104 insertions, 2270 deletions
diff --git a/share/man/man9/audio.9 b/share/man/man9/audio.9 index bfd86916e48..a51cb8c85fb 100644 --- a/share/man/man9/audio.9 +++ b/share/man/man9/audio.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: audio.9,v 1.24 2016/09/01 10:14:08 ratchov Exp $ +.\" $OpenBSD: audio.9,v 1.25 2016/09/14 06:12:19 ratchov Exp $ .\" $NetBSD: audio.9,v 1.14 2000/02/11 22:56:15 kleink Exp $ .\" .\" Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: September 1 2016 $ +.Dd $Mdocdate: September 14 2016 $ .Dt AUDIO 9 .Os .Sh NAME @@ -45,9 +45,6 @@ structure. struct audio_hw_if { int (*open)(void *, int); void (*close)(void *); - int (*drain)(void *); - - int (*query_encoding)(void *, struct audio_encoding *); int (*set_params)(void *, int, int, struct audio_params *, struct audio_params *); int (*round_blocksize)(void *, int); @@ -78,15 +75,12 @@ struct audio_hw_if { void *(*allocm)(void *, int, size_t, int, int); void (*freem)(void *, void *, int); size_t (*round_buffersize)(void *, int, size_t); - paddr_t (*mappage)(void *, void *, off_t, int); - int (*get_props)(void *); int (*trigger_output)(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); int (*trigger_input)(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); - void (*get_default_params)(void *, int, struct audio_params *); }; struct audio_params { @@ -160,22 +154,6 @@ is matched by a call to This function returns 0 on success, otherwise an error code. .It Fn "void (*close)" "void *hdl" This function is called when the audio device is closed. -.It Fn "int (*drain)" "void *hdl" -This function is optional. -If supplied, it is called before the device is closed or when the -.Dv AUDIO_DRAIN -.Xr ioctl 2 -is called. -It makes sure that no samples remain to be played that could -be lost when -.Fn close -is called. -This function returns 0 on success, otherwise an error code. -.It Fn "int (*query_encoding)" "void *hdl" "struct audio_encoding *ae" -This function fills -.Fa ae -and returns 0 or, if there is no encoding with the given number, returns -.Er EINVAL . .It Fn "int (*set_params)" "void *hdl" "int setmode" "int usemode" \ "struct audio_params *play" "struct audio_params *rec" This function is called to set the audio encoding mode. @@ -375,18 +353,6 @@ Note that the buffer size is always a multiple of the block size, so and .Fn round_buffersize must be consistent. -.It Fn "paddr_t (*mappage)" "void *hdl" "void *addr" "off_t offs" "int prot" -This function is optional. -If supplied, it is called for -.Xr mmap 2 . -It returns the map value for the page at offset -.Fa offs -from address -.Fa addr -mapped with protection -.Fa prot . -This function returns \-1 on failure, or a machine dependent opaque -value on success. .It Fn "int (*get_props)" "void *hdl" This function returns a combination of .Dv AUDIO_PROP_xxx @@ -435,21 +401,6 @@ will be called with the argument Once started, the transfer may be stopped using .Fn halt_input . This function returns 0 on success, otherwise an error code. -.It Fn "void (*get_default_params)" "void *hdl" "int direction" \ -"struct audio_params *param" -This function is optional. -If supplied, it is called to retrieve the default configuration -for the given -.Fa direction , -parameterized in -.Fa param . -.Fa direction -is -.Dv AUMODE_PLAY -or -.Dv AUMODE_RECORD . -The default configuration should not include emulated formats, and should -reflect the optimal operating configuration for the underlying hardware. .El .Pp If the audio hardware is capable of input from more @@ -497,7 +448,6 @@ and be of class .Dv AudioCoutputs . .Sh SEE ALSO .Xr ioctl 2 , -.Xr mmap 2 , .Xr open 2 , .Xr sio_open 3 , .Xr audio 4 , diff --git a/sys/arch/hppa/gsc/harmony.c b/sys/arch/hppa/gsc/harmony.c index 853745aefb1..d71f20644da 100644 --- a/sys/arch/hppa/gsc/harmony.c +++ b/sys/arch/hppa/gsc/harmony.c @@ -1,4 +1,4 @@ -/* $OpenBSD: harmony.c,v 1.31 2015/09/08 07:14:04 deraadt Exp $ */ +/* $OpenBSD: harmony.c,v 1.32 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 2003 Jason L. Wright (jason@thought.net) @@ -56,7 +56,6 @@ int harmony_open(void *, int); void harmony_close(void *); -int harmony_query_encoding(void *, struct audio_encoding *); int harmony_set_params(void *, int, int, struct audio_params *, struct audio_params *); int harmony_round_blocksize(void *, int); @@ -79,8 +78,6 @@ int harmony_trigger_input(void *, void *, void *, int, struct audio_hw_if harmony_sa_hw_if = { harmony_open, harmony_close, - NULL, - harmony_query_encoding, harmony_set_params, harmony_round_blocksize, harmony_commit_settings, @@ -99,11 +96,9 @@ struct audio_hw_if harmony_sa_hw_if = { harmony_allocm, harmony_freem, harmony_round_buffersize, - NULL, harmony_get_props, harmony_trigger_output, - harmony_trigger_input, - NULL + harmony_trigger_input }; int harmony_match(struct device *, void *, void *); @@ -402,48 +397,6 @@ harmony_close(void *vsc) } int -harmony_query_encoding(void *vsc, struct audio_encoding *fp) -{ - struct harmony_softc *sc = vsc; - int err = 0; - - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEmulaw, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEalaw, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = 0; - break; - case 2: - strlcpy(fp->name, AudioEslinear_be, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_BE; - fp->precision = 16; - fp->flags = 0; - break; - case 3: - if (sc->sc_hasulinear8) { - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - } - /*FALLTHROUGH*/ - default: - err = EINVAL; - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - return (err); -} - -int harmony_set_params(void *vsc, int setmode, int usemode, struct audio_params *p, struct audio_params *r) { diff --git a/sys/arch/luna88k/cbus/nec86.c b/sys/arch/luna88k/cbus/nec86.c index 45c450f148c..e18f7f78858 100644 --- a/sys/arch/luna88k/cbus/nec86.c +++ b/sys/arch/luna88k/cbus/nec86.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nec86.c,v 1.1 2014/12/28 13:03:18 aoyama Exp $ */ +/* $OpenBSD: nec86.c,v 1.2 2016/09/14 06:12:19 ratchov Exp $ */ /* $NecBSD: nec86.c,v 1.11 1999/07/23 11:04:39 honda Exp $ */ /* $NetBSD$ */ @@ -76,8 +76,6 @@ struct audio_device nec86_device = { struct audio_hw_if nec86_hw_if = { .open = nec86hw_open, .close = nec86hw_close, - .drain = NULL, - .query_encoding = nec86hw_query_encoding, .set_params = nec86hw_set_params, .round_blocksize = nec86hw_round_blocksize, .commit_settings = nec86hw_commit_settings, @@ -96,11 +94,9 @@ struct audio_hw_if nec86_hw_if = { .allocm = NULL, .freem = NULL, .round_buffersize = NULL, - .mappage = NULL, .get_props = nec86_get_props, .trigger_output = NULL, - .trigger_input = NULL, - .get_default_params = NULL + .trigger_input = NULL }; /* diff --git a/sys/arch/luna88k/cbus/nec86hw.c b/sys/arch/luna88k/cbus/nec86hw.c index ba6718f2165..f70e11227a1 100644 --- a/sys/arch/luna88k/cbus/nec86hw.c +++ b/sys/arch/luna88k/cbus/nec86hw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nec86hw.c,v 1.3 2015/06/25 06:43:45 ratchov Exp $ */ +/* $OpenBSD: nec86hw.c,v 1.4 2016/09/14 06:12:19 ratchov Exp $ */ /* $NecBSD: nec86hw.c,v 1.13 1998/03/14 07:04:54 kmatsuda Exp $ */ /* $NetBSD$ */ @@ -238,35 +238,6 @@ nec86hw_set_params(void *addr, int mode, int usemode, struct audio_params *p, } int -nec86hw_query_encoding(void *addr, struct audio_encoding *fp) -{ - - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof(fp->name)); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->bps = 1; - fp->msb = 1; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear_le, sizeof(fp->name)); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->bps = 2; - fp->msb = 1; /* is this OK? */ - fp->flags = 0; - break; - default: - return EINVAL; - /*NOTREACHED*/ - } - - return 0; -} - -int nec86hw_round_blocksize(void *addr, int blk) { u_int base = NEC86_INTRBLK_UNIT; diff --git a/sys/arch/luna88k/cbus/nec86hwvar.h b/sys/arch/luna88k/cbus/nec86hwvar.h index a7e36d051fc..3ff3e06ded5 100644 --- a/sys/arch/luna88k/cbus/nec86hwvar.h +++ b/sys/arch/luna88k/cbus/nec86hwvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nec86hwvar.h,v 1.1 2014/12/28 13:03:18 aoyama Exp $ */ +/* $OpenBSD: nec86hwvar.h,v 1.2 2016/09/14 06:12:19 ratchov Exp $ */ /* $NecBSD: nec86hwvar.h,v 1.10 1998/03/14 07:04:55 kmatsuda Exp $ */ /* $NetBSD$ */ @@ -143,7 +143,6 @@ void nec86hw_close(void *); int nec86hw_set_params(void *, int, int, struct audio_params *, struct audio_params *); -int nec86hw_query_encoding(void *, struct audio_encoding *); int nec86hw_round_blocksize(void *, int); diff --git a/sys/arch/macppc/dev/aoa.c b/sys/arch/macppc/dev/aoa.c index 990104f46c5..7ac139e4965 100644 --- a/sys/arch/macppc/dev/aoa.c +++ b/sys/arch/macppc/dev/aoa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aoa.c,v 1.7 2016/07/02 16:28:50 mglocker Exp $ */ +/* $OpenBSD: aoa.c,v 1.8 2016/09/14 06:12:19 ratchov Exp $ */ /*- * Copyright (c) 2005 Tsubai Masanari. All rights reserved. @@ -57,7 +57,6 @@ int aoa_match(struct device *, void *, void *); void aoa_attach(struct device *, struct device *, void *); void aoa_defer(struct device *); void aoa_set_volume(struct aoa_softc *, int, int); -void aoa_get_default_params(void *, int, struct audio_params *); struct cfattach aoa_ca = { sizeof(struct aoa_softc), aoa_match, aoa_attach @@ -70,8 +69,6 @@ struct cfdriver aoa_cd = { struct audio_hw_if aoa_hw_if = { i2s_open, i2s_close, - NULL, - i2s_query_encoding, i2s_set_params, i2s_round_blocksize, NULL, @@ -90,11 +87,9 @@ struct audio_hw_if aoa_hw_if = { i2s_allocm, NULL, i2s_round_buffersize, - i2s_mappage, i2s_get_props, i2s_trigger_output, - i2s_trigger_input, - aoa_get_default_params + i2s_trigger_input }; struct audio_device aoa_device = { @@ -162,9 +157,3 @@ aoa_set_volume(struct aoa_softc *sc, int left, int right) { /* This device doesn't provide volume control. */ } - -void -aoa_get_default_params(void *addr, int mode, struct audio_params *params) -{ - i2s_get_default_params(params); -} diff --git a/sys/arch/macppc/dev/awacs.c b/sys/arch/macppc/dev/awacs.c index 58fcff171e0..57a20febbb4 100644 --- a/sys/arch/macppc/dev/awacs.c +++ b/sys/arch/macppc/dev/awacs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: awacs.c,v 1.32 2015/09/08 08:29:35 deraadt Exp $ */ +/* $OpenBSD: awacs.c,v 1.33 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: awacs.c,v 1.4 2001/02/26 21:07:51 wiz Exp $ */ /*- @@ -95,7 +95,6 @@ int awacs_rx_intr(void *); int awacs_open(void *, int); void awacs_close(void *); -int awacs_query_encoding(void *, struct audio_encoding *); int awacs_set_params(void *, int, int, struct audio_params *, struct audio_params *); int awacs_round_blocksize(void *, int); @@ -110,7 +109,6 @@ int awacs_set_port(void *, mixer_ctrl_t *); int awacs_get_port(void *, mixer_ctrl_t *); int awacs_query_devinfo(void *, mixer_devinfo_t *); size_t awacs_round_buffersize(void *, int, size_t); -paddr_t awacs_mappage(void *, void *, off_t, int); int awacs_get_props(void *); void *awacs_allocm(void *, int, size_t, int, int); @@ -132,8 +130,6 @@ struct cfdriver awacs_cd = { struct audio_hw_if awacs_hw_if = { awacs_open, awacs_close, - NULL, /* drain */ - awacs_query_encoding, awacs_set_params, awacs_round_blocksize, NULL, /* commit_setting */ @@ -152,11 +148,9 @@ struct audio_hw_if awacs_hw_if = { awacs_allocm, /* allocm */ NULL, /* freem */ awacs_round_buffersize, /* round_buffersize */ - awacs_mappage, awacs_get_props, awacs_trigger_output, - awacs_trigger_input, - NULL + awacs_trigger_input }; struct audio_device awacs_device = { @@ -497,25 +491,6 @@ awacs_close(void *h) } int -awacs_query_encoding(void *h, struct audio_encoding *ae) -{ - switch (ae->index) { - case 0: - strlcpy(ae->name, AudioEslinear_be, sizeof ae->name); - ae->encoding = AUDIO_ENCODING_SLINEAR_BE; - ae->precision = 16; - ae->flags = 0; - break; - default: - return (EINVAL); - } - ae->bps = AUDIO_BPS(ae->precision); - ae->msb = 1; - - return (0); -} - -int awacs_set_params(void *h, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) { @@ -910,14 +885,6 @@ awacs_allocm(void *h, int dir, size_t size, int type, int flags) return p->addr; } -paddr_t -awacs_mappage(void *h, void *mem, off_t off, int prot) -{ - if (off < 0) - return -1; - return -1; /* XXX */ -} - int awacs_get_props(void *h) { diff --git a/sys/arch/macppc/dev/daca.c b/sys/arch/macppc/dev/daca.c index 7ca974ad873..ea6e5e87629 100644 --- a/sys/arch/macppc/dev/daca.c +++ b/sys/arch/macppc/dev/daca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: daca.c,v 1.8 2010/02/26 21:53:43 jasper Exp $ */ +/* $OpenBSD: daca.c,v 1.9 2016/09/14 06:12:19 ratchov Exp $ */ /*- * Copyright (c) 2002,2003 Tsubai Masanari. All rights reserved. @@ -63,7 +63,6 @@ void daca_attach(struct device *, struct device *, void *); void daca_defer(struct device *); void daca_init(struct daca_softc *); void daca_set_volume(struct daca_softc *, int, int); -void daca_get_default_params(void *, int, struct audio_params *); struct cfattach daca_ca = { sizeof(struct daca_softc), daca_match, daca_attach @@ -76,8 +75,6 @@ struct cfdriver daca_cd = { struct audio_hw_if daca_hw_if = { i2s_open, i2s_close, - NULL, - i2s_query_encoding, i2s_set_params, i2s_round_blocksize, NULL, @@ -96,11 +93,9 @@ struct audio_hw_if daca_hw_if = { i2s_allocm, /* allocm */ NULL, i2s_round_buffersize, - i2s_mappage, i2s_get_props, i2s_trigger_output, - i2s_trigger_input, - daca_get_default_params + i2s_trigger_input }; struct audio_device daca_device = { @@ -199,9 +194,3 @@ daca_set_volume(struct daca_softc *sc, int left, int right) data = left << 8 | right; kiic_write(sc->sc_i2c, DEQaddr, DEQ_AVOL, &data, 2); } - -void -daca_get_default_params(void *addr, int mode, struct audio_params *params) -{ - i2s_get_default_params(params); -} diff --git a/sys/arch/macppc/dev/i2s.c b/sys/arch/macppc/dev/i2s.c index 8b9a1443ad1..f6160955ef1 100644 --- a/sys/arch/macppc/dev/i2s.c +++ b/sys/arch/macppc/dev/i2s.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i2s.c,v 1.33 2016/08/30 11:20:09 ratchov Exp $ */ +/* $OpenBSD: i2s.c,v 1.34 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: i2s.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */ /*- @@ -52,15 +52,6 @@ # define DPRINTF(x) #endif -struct audio_params i2s_audio_default = { - 44100, /* sample_rate */ - AUDIO_ENCODING_SLINEAR_BE, /* encoding */ - 16, /* precision */ - 2, /* bps */ - 1, /* msb */ - 2 /* channels */ -}; - void i2s_mute(u_int, int); int i2s_cint(void *); u_int i2s_gpio_offset(struct i2s_softc *, char *, int *); @@ -230,30 +221,6 @@ i2s_close(h) } int -i2s_query_encoding(h, ae) - void *h; - struct audio_encoding *ae; -{ - int err = 0; - - switch (ae->index) { - case 0: - strlcpy(ae->name, AudioEslinear_be, sizeof(ae->name)); - ae->encoding = AUDIO_ENCODING_SLINEAR_BE; - ae->precision = 16; - ae->flags = 0; - break; - default: - err = EINVAL; - break; - } - ae->bps = AUDIO_BPS(ae->precision); - ae->msb = 1; - return (err); -} - - -int i2s_set_params(h, setmode, usemode, play, rec) void *h; int setmode, usemode; @@ -308,12 +275,6 @@ i2s_set_params(h, setmode, usemode, play, rec) return 0; } -void -i2s_get_default_params(struct audio_params *params) -{ - *params = i2s_audio_default; -} - int i2s_round_blocksize(h, size) void *h; @@ -633,18 +594,6 @@ i2s_round_buffersize(h, dir, size) return size; } -paddr_t -i2s_mappage(h, mem, off, prot) - void *h; - void *mem; - off_t off; - int prot; -{ - if (off < 0) - return -1; - return -1; /* XXX */ -} - int i2s_get_props(h) void *h; diff --git a/sys/arch/macppc/dev/i2svar.h b/sys/arch/macppc/dev/i2svar.h index 8c4701fdb87..efece60bed6 100644 --- a/sys/arch/macppc/dev/i2svar.h +++ b/sys/arch/macppc/dev/i2svar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i2svar.h,v 1.8 2011/06/07 16:29:51 mpi Exp $ */ +/* $OpenBSD: i2svar.h,v 1.9 2016/09/14 06:12:19 ratchov Exp $ */ /*- * Copyright (c) 2001,2003 Tsubai Masanari. All rights reserved. @@ -96,9 +96,7 @@ void i2s_attach(struct device *, struct i2s_softc *, struct confargs *); int i2s_intr(void *); int i2s_open(void *, int); void i2s_close(void *); -int i2s_query_encoding(void *, struct audio_encoding *); int i2s_set_params(void *, int, int, struct audio_params *, struct audio_params *); -void i2s_get_default_params(struct audio_params *); int i2s_round_blocksize(void *, int); int i2s_halt_output(void *); int i2s_halt_input(void *); @@ -106,7 +104,6 @@ int i2s_set_port(void *, mixer_ctrl_t *); int i2s_get_port(void *, mixer_ctrl_t *); int i2s_query_devinfo(void *, mixer_devinfo_t *); size_t i2s_round_buffersize(void *, int, size_t); -paddr_t i2s_mappage(void *, void *, off_t, int); int i2s_get_props(void *); int i2s_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); diff --git a/sys/arch/macppc/dev/onyx.c b/sys/arch/macppc/dev/onyx.c index f0f71b2a21f..8a4cefb534a 100644 --- a/sys/arch/macppc/dev/onyx.c +++ b/sys/arch/macppc/dev/onyx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: onyx.c,v 1.10 2009/10/26 20:17:27 deraadt Exp $ */ +/* $OpenBSD: onyx.c,v 1.11 2016/09/14 06:12:19 ratchov Exp $ */ /*- * Copyright (c) 2005 Tsubai Masanari. All rights reserved. @@ -72,7 +72,6 @@ int onyx_match(struct device *, void *, void *); void onyx_attach(struct device *, struct device *, void *); void onyx_defer(struct device *); void onyx_set_volume(struct onyx_softc *, int, int); -void onyx_get_default_params(void *, int, struct audio_params *); struct cfattach onyx_ca = { sizeof(struct onyx_softc), onyx_match, onyx_attach @@ -85,8 +84,6 @@ struct cfdriver onyx_cd = { struct audio_hw_if onyx_hw_if = { i2s_open, i2s_close, - NULL, - i2s_query_encoding, i2s_set_params, i2s_round_blocksize, NULL, @@ -105,11 +102,9 @@ struct audio_hw_if onyx_hw_if = { i2s_allocm, NULL, i2s_round_buffersize, - i2s_mappage, i2s_get_props, i2s_trigger_output, - i2s_trigger_input, - onyx_get_default_params + i2s_trigger_input }; struct audio_device onyx_device = { @@ -207,9 +202,3 @@ onyx_set_volume(struct onyx_softc *sc, int left, int right) kiic_write(sc->sc_i2c, PCM3052_I2C_ADDR, PCM3052_REG_RIGHT_VOLUME, &data, 1); } - -void -onyx_get_default_params(void *addr, int mode, struct audio_params *params) -{ - i2s_get_default_params(params); -} diff --git a/sys/arch/macppc/dev/snapper.c b/sys/arch/macppc/dev/snapper.c index 3fba8d3c8a0..1a6dc82898e 100644 --- a/sys/arch/macppc/dev/snapper.c +++ b/sys/arch/macppc/dev/snapper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snapper.c,v 1.35 2009/10/26 20:17:27 deraadt Exp $ */ +/* $OpenBSD: snapper.c,v 1.36 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: snapper.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */ /*- @@ -67,7 +67,6 @@ void snapper_set_volume(struct snapper_softc *, int, int); void snapper_set_bass(struct snapper_softc *, int); void snapper_set_treble(struct snapper_softc *, int); void snapper_set_input(struct snapper_softc *, int); -void snapper_get_default_params(void *, int, struct audio_params *); int tas3004_write(struct snapper_softc *, u_int, const void *); int tas3004_init(struct snapper_softc *); @@ -82,8 +81,6 @@ struct cfdriver snapper_cd = { struct audio_hw_if snapper_hw_if = { i2s_open, i2s_close, - NULL, - i2s_query_encoding, i2s_set_params, i2s_round_blocksize, NULL, @@ -102,11 +99,9 @@ struct audio_hw_if snapper_hw_if = { i2s_allocm, /* allocm */ NULL, i2s_round_buffersize, - i2s_mappage, i2s_get_props, i2s_trigger_output, - i2s_trigger_input, - snapper_get_default_params + i2s_trigger_input }; struct audio_device snapper_device = { @@ -740,9 +735,3 @@ snapper_getdev(void *h, struct audio_device *retp) *retp = snapper_device; return (0); } - -void -snapper_get_default_params(void *addr, int mode, struct audio_params *params) -{ - i2s_get_default_params(params); -} diff --git a/sys/arch/macppc/dev/tumbler.c b/sys/arch/macppc/dev/tumbler.c index efc68fa6595..2b1519d6f07 100644 --- a/sys/arch/macppc/dev/tumbler.c +++ b/sys/arch/macppc/dev/tumbler.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tumbler.c,v 1.7 2009/10/26 20:17:27 deraadt Exp $ */ +/* $OpenBSD: tumbler.c,v 1.8 2016/09/14 06:12:19 ratchov Exp $ */ /*- * Copyright (c) 2001,2003 Tsubai Masanari. All rights reserved. @@ -65,7 +65,6 @@ void tumbler_defer(struct device *); void tumbler_set_volume(struct tumbler_softc *, int, int); void tumbler_set_bass(struct tumbler_softc *, int); void tumbler_set_treble(struct tumbler_softc *, int); -void tumbler_get_default_params(void *, int, struct audio_params *); int tas3001_write(struct tumbler_softc *, u_int, const void *); int tas3001_init(struct tumbler_softc *); @@ -80,8 +79,6 @@ struct cfdriver tumbler_cd = { struct audio_hw_if tumbler_hw_if = { i2s_open, i2s_close, - NULL, - i2s_query_encoding, i2s_set_params, i2s_round_blocksize, NULL, @@ -100,11 +97,9 @@ struct audio_hw_if tumbler_hw_if = { i2s_allocm, /* allocm */ NULL, i2s_round_buffersize, - i2s_mappage, i2s_get_props, i2s_trigger_output, - i2s_trigger_input, - tumbler_get_default_params + i2s_trigger_input }; struct audio_device tumbler_device = { @@ -494,9 +489,3 @@ tumbler_getdev(void *h, struct audio_device *retp) *retp = tumbler_device; return (0); } - -void -tumbler_get_default_params(void *addr, int mode, struct audio_params *params) -{ - i2s_get_default_params(params); -} diff --git a/sys/arch/sgi/dev/mavb.c b/sys/arch/sgi/dev/mavb.c index eba9a936eb0..f00e1245e60 100644 --- a/sys/arch/sgi/dev/mavb.c +++ b/sys/arch/sgi/dev/mavb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mavb.c,v 1.18 2015/05/11 06:46:21 ratchov Exp $ */ +/* $OpenBSD: mavb.c,v 1.19 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -160,7 +160,6 @@ struct cfdriver mavb_cd = { int mavb_open(void *, int); void mavb_close(void *); -int mavb_query_encoding(void *, struct audio_encoding *); int mavb_set_params(void *, int, int, struct audio_params *, struct audio_params *); int mavb_round_blocksize(void *hdl, int bs); @@ -175,13 +174,10 @@ int mavb_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); int mavb_trigger_input(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); -void mavb_get_default_params(void *, int, struct audio_params *); struct audio_hw_if mavb_sa_hw_if = { mavb_open, mavb_close, - 0, - mavb_query_encoding, mavb_set_params, mavb_round_blocksize, 0, @@ -200,11 +196,9 @@ struct audio_hw_if mavb_sa_hw_if = { 0, 0, 0, - 0, mavb_get_props, mavb_trigger_output, - mavb_trigger_input, - mavb_get_default_params + mavb_trigger_input }; struct audio_device mavb_device = { @@ -224,36 +218,6 @@ mavb_close(void *hdl) { } -int -mavb_query_encoding(void *hdl, struct audio_encoding *ae) -{ - switch (ae->index) { - case 0: - /* 24-bit Signed Linear PCM LSB-aligned. */ - strlcpy(ae->name, AudioEslinear_be, sizeof ae->name); - ae->encoding = AUDIO_ENCODING_SLINEAR_BE; - ae->precision = 24; - ae->flags = 0; - break; - default: - return (EINVAL); - } - ae->bps = AUDIO_BPS(ae->precision); - ae->msb = 0; - return (0); -} - -void -mavb_get_default_params(void *hdl, int mode, struct audio_params *p) -{ - p->sample_rate = 48000; - p->encoding = AUDIO_ENCODING_SLINEAR_BE; - p->precision = 24; - p->bps = 4; - p->msb = 0; - p->channels = 2; -} - static int mavb_set_play_rate(struct mavb_softc *sc, u_long sample_rate) { diff --git a/sys/arch/sparc64/dev/ce4231.c b/sys/arch/sparc64/dev/ce4231.c index 5ea32287c05..eeebcf06bb0 100644 --- a/sys/arch/sparc64/dev/ce4231.c +++ b/sys/arch/sparc64/dev/ce4231.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ce4231.c,v 1.33 2015/05/11 06:52:35 ratchov Exp $ */ +/* $OpenBSD: ce4231.c,v 1.34 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -133,7 +133,6 @@ u_int8_t ce4231_read(struct ce4231_softc *, u_int8_t); /* Audio interface */ int ce4231_open(void *, int); void ce4231_close(void *); -int ce4231_query_encoding(void *, struct audio_encoding *); int ce4231_set_params(void *, int, int, struct audio_params *, struct audio_params *); int ce4231_round_blocksize(void *, int); @@ -155,8 +154,6 @@ int ce4231_trigger_input(void *, void *, void *, int, struct audio_hw_if ce4231_sa_hw_if = { ce4231_open, ce4231_close, - 0, - ce4231_query_encoding, ce4231_set_params, ce4231_round_blocksize, ce4231_commit_settings, @@ -175,11 +172,9 @@ struct audio_hw_if ce4231_sa_hw_if = { ce4231_alloc, ce4231_free, 0, - 0, ce4231_get_props, ce4231_trigger_output, - ce4231_trigger_input, - 0 + ce4231_trigger_input }; struct cfattach audioce_ca = { @@ -469,52 +464,6 @@ ce4231_close(addr) } int -ce4231_query_encoding(addr, fp) - void *addr; - struct audio_encoding *fp; -{ - int err = 0; - - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEmulaw, sizeof(fp->name)); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEalaw, sizeof(fp->name)); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = 0; - break; - case 2: - strlcpy(fp->name, AudioEslinear_le, sizeof(fp->name)); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 3: - strlcpy(fp->name, AudioEulinear, sizeof(fp->name)); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 4: - strlcpy(fp->name, AudioEslinear_be, sizeof(fp->name)); - fp->encoding = AUDIO_ENCODING_SLINEAR_BE; - fp->precision = 16; - fp->flags = 0; - break; - default: - err = EINVAL; - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - return (err); -} - -int ce4231_set_params(addr, setmode, usemode, p, r) void *addr; int setmode, usemode; diff --git a/sys/dev/audio.c b/sys/dev/audio.c index a6590c069d4..920889e6ad9 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audio.c,v 1.151 2016/08/31 07:22:43 ratchov Exp $ */ +/* $OpenBSD: audio.c,v 1.152 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 2015 Alexandre Ratchov <alex@caoua.org> * @@ -1018,7 +1018,6 @@ audio_attach(struct device *parent, struct device *self, void *aux) if (ops == 0 || ops->open == 0 || ops->close == 0 || - ops->query_encoding == 0 || ops->set_params == 0 || (ops->start_output == 0 && ops->trigger_output == 0) || (ops->start_input == 0 && ops->trigger_input == 0) || diff --git a/sys/dev/audio_if.h b/sys/dev/audio_if.h index 35a01d07bf1..dab2389e15f 100644 --- a/sys/dev/audio_if.h +++ b/sys/dev/audio_if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: audio_if.h,v 1.31 2016/08/31 07:22:43 ratchov Exp $ */ +/* $OpenBSD: audio_if.h,v 1.32 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: audio_if.h,v 1.24 1998/01/10 14:07:25 tv Exp $ */ /* @@ -54,52 +54,30 @@ */ struct audio_device; -struct audio_encoding; struct mixer_devinfo; struct mixer_ctrl; struct audio_params { u_long sample_rate; /* sample rate */ - u_int encoding; /* mu-law, linear, etc */ - u_int precision; /* bits/sample */ - u_int bps; /* bytes/sample */ - u_int msb; /* data alignment */ - u_int channels; /* mono(1), stereo(2) */ -}; - -/* - * query_encoding argument - */ -typedef struct audio_encoding { - int index; -#define MAX_AUDIO_DEV_LEN 16 - char name[MAX_AUDIO_DEV_LEN]; #define AUDIO_ENCODING_NONE 0 /* no encoding assigned */ #define AUDIO_ENCODING_ULAW 1 /* ITU G.711 mu-law */ #define AUDIO_ENCODING_ALAW 2 /* ITU G.711 A-law */ -#define AUDIO_ENCODING_ADPCM 5 /* adaptive differential PCM */ #define AUDIO_ENCODING_SLINEAR_LE 6 #define AUDIO_ENCODING_SLINEAR_BE 7 #define AUDIO_ENCODING_ULINEAR_LE 8 #define AUDIO_ENCODING_ULINEAR_BE 9 #define AUDIO_ENCODING_SLINEAR 10 #define AUDIO_ENCODING_ULINEAR 11 - int encoding; - int precision; - int bps; - int msb; - int flags; -#define AUDIO_ENCODINGFLAG_EMULATED 1 /* software emulation mode */ -} audio_encoding_t; + u_int encoding; /* mu-law, linear, etc */ + u_int precision; /* bits/sample */ + u_int bps; /* bytes/sample */ + u_int msb; /* data alignment */ + u_int channels; /* mono(1), stereo(2) */ +}; struct audio_hw_if { int (*open)(void *, int); /* open hardware */ void (*close)(void *); /* close hardware */ - int (*drain)(void *); /* Optional: drain buffers */ - - /* Encoding. */ - /* XXX should we have separate in/out? */ - int (*query_encoding)(void *, struct audio_encoding *); /* Set the audio encoding parameters (record and play). * Return 0 on success, or an error code if the @@ -150,7 +128,6 @@ struct audio_hw_if { void *(*allocm)(void *, int, size_t, int, int); void (*freem)(void *, void *, int); size_t (*round_buffersize)(void *, int, size_t); - paddr_t (*mappage)(void *, void *, off_t, int); int (*get_props)(void *); /* device properties */ @@ -158,7 +135,6 @@ struct audio_hw_if { void (*)(void *), void *, struct audio_params *); int (*trigger_input)(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); - void (*get_default_params)(void *, int, struct audio_params *); }; struct audio_attach_args { diff --git a/sys/dev/ic/ac97.c b/sys/dev/ic/ac97.c index 7c0bc2dbee7..8e8e84e2dec 100644 --- a/sys/dev/ic/ac97.c +++ b/sys/dev/ic/ac97.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ac97.c,v 1.81 2015/08/28 00:03:53 deraadt Exp $ */ +/* $OpenBSD: ac97.c,v 1.82 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 1999, 2000 Constantine Sapuntzakis @@ -607,12 +607,6 @@ int ac97debug = 0; #define DPRINTFN(n,x) #endif -void -ac97_get_default_params(struct audio_params *params) -{ - *params = ac97_audio_default; -} - int ac97_read(struct ac97_softc *as, u_int8_t reg, u_int16_t *val) { diff --git a/sys/dev/ic/ac97.h b/sys/dev/ic/ac97.h index abdd405dbf3..df08f5ff938 100644 --- a/sys/dev/ic/ac97.h +++ b/sys/dev/ic/ac97.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ac97.h,v 1.25 2010/12/22 09:54:27 jakemsr Exp $ */ +/* $OpenBSD: ac97.h,v 1.26 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 1999 Constantine Sapuntzakis @@ -88,7 +88,6 @@ struct ac97_codec_if { int ac97_attach(struct ac97_host_if *); int ac97_resume(struct ac97_host_if *, struct ac97_codec_if *); int ac97_set_rate(struct ac97_codec_if *, int, u_long *); -void ac97_get_default_params(struct audio_params *); #define AC97_REG_RESET 0x00 #define AC97_CAPS_MICIN 0x0001 diff --git a/sys/dev/ic/am7930.c b/sys/dev/ic/am7930.c index ea0e80548aa..ad7d08b0167 100644 --- a/sys/dev/ic/am7930.c +++ b/sys/dev/ic/am7930.c @@ -1,4 +1,4 @@ -/* $OpenBSD: am7930.c,v 1.6 2015/05/11 06:46:21 ratchov Exp $ */ +/* $OpenBSD: am7930.c,v 1.7 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: am7930.c,v 1.44 2001/11/13 13:14:34 lukem Exp $ */ /* @@ -235,27 +235,6 @@ am7930_set_params(void *addr, int setmode, int usemode, } int -am7930_query_encoding(void *addr, struct audio_encoding *fp) -{ - struct am7930_softc *sc = addr; - - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEmulaw, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = sc->sc_glue->precision; - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 0; - fp->flags = 0; - break; - default: - return EINVAL; - /*NOTREACHED*/ - } - return 0; -} - -int am7930_round_blocksize(void *addr, int blk) { return blk; diff --git a/sys/dev/ic/am7930var.h b/sys/dev/ic/am7930var.h index a0a1945ce89..8ce7e9d1894 100644 --- a/sys/dev/ic/am7930var.h +++ b/sys/dev/ic/am7930var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: am7930var.h,v 1.3 2015/05/11 06:46:21 ratchov Exp $ */ +/* $OpenBSD: am7930var.h,v 1.4 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: am7930var.h,v 1.10 2005/01/15 15:19:52 kent Exp $ */ /* @@ -103,12 +103,10 @@ void am7930_init(struct am7930_softc *, int); */ struct audio_device; -struct audio_encoding; struct audio_params; int am7930_open(void *, int); void am7930_close(void *); -int am7930_query_encoding(void *, struct audio_encoding *); int am7930_set_params(void *, int, int, struct audio_params *, struct audio_params *); int am7930_commit_settings(void *); diff --git a/sys/dev/ic/arcofi.c b/sys/dev/ic/arcofi.c index ba601b0c4ea..b24b62aa445 100644 --- a/sys/dev/ic/arcofi.c +++ b/sys/dev/ic/arcofi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arcofi.c,v 1.13 2015/06/26 04:25:18 miod Exp $ */ +/* $OpenBSD: arcofi.c,v 1.14 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 2011 Miodrag Vallat. @@ -203,7 +203,6 @@ int arcofi_halt_input(void *); int arcofi_halt_output(void *); int arcofi_open(void *, int); int arcofi_query_devinfo(void *, mixer_devinfo_t *); -int arcofi_query_encoding(void *, struct audio_encoding *); int arcofi_round_blocksize(void *, int); int arcofi_set_params(void *, int, int, struct audio_params *, struct audio_params *); @@ -214,7 +213,6 @@ int arcofi_start_output(void *, void *, int, void (*)(void *), void *); /* const */ struct audio_hw_if arcofi_hw_if = { .open = arcofi_open, .close = arcofi_close, - .query_encoding = arcofi_query_encoding, .set_params = arcofi_set_params, .round_blocksize = arcofi_round_blocksize, .commit_settings = arcofi_commit_settings, @@ -320,46 +318,6 @@ arcofi_drain(void *v) return 0; } -int -arcofi_query_encoding(void *v, struct audio_encoding *ae) -{ - switch (ae->index) { - /* - * 8-bit encodings: u-Law and A-Law are native - */ - case 0: - strlcpy(ae->name, AudioEmulaw, sizeof ae->name); - ae->precision = 8; - ae->encoding = AUDIO_ENCODING_ULAW; - ae->flags = 0; - break; - case 1: - strlcpy(ae->name, AudioEalaw, sizeof ae->name); - ae->precision = 8; - ae->encoding = AUDIO_ENCODING_ALAW; - ae->flags = 0; - break; - - /* - * 16-bit encodings: slinear big-endian is native - */ - case 2: - strlcpy(ae->name, AudioEslinear_be, sizeof ae->name); - ae->precision = 16; - ae->encoding = AUDIO_ENCODING_SLINEAR_BE; - ae->flags = 0; - break; - - default: - return EINVAL; - } - - ae->bps = AUDIO_BPS(ae->precision); - ae->msb = 1; - - return 0; -} - /* * Compute proper sample and hardware settings. Invoked both for record * and playback, as we don't support independent settings. diff --git a/sys/dev/isa/ad1848.c b/sys/dev/isa/ad1848.c index a1e985c205c..55ea7509d0e 100644 --- a/sys/dev/isa/ad1848.c +++ b/sys/dev/isa/ad1848.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ad1848.c,v 1.44 2015/06/25 06:43:46 ratchov Exp $ */ +/* $OpenBSD: ad1848.c,v 1.45 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: ad1848.c,v 1.45 1998/01/30 02:02:38 augustss Exp $ */ /* @@ -907,44 +907,6 @@ ad1848_mixer_set_port(struct ad1848_softc *ac, struct ad1848_devmap *map, } int -ad1848_query_encoding(void *addr, struct audio_encoding *fp) -{ - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEmulaw, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEalaw, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = 0; - break; - case 2: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 3: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - default: - return EINVAL; - /*NOTREACHED*/ - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (0); -} - -int ad1848_set_params(void *addr, int setmode, int usemode, struct audio_params *p, struct audio_params *r) { @@ -1497,12 +1459,6 @@ ad1848_round(void *addr, int direction, size_t size) return size; } -paddr_t -ad1848_mappage(void *addr, void *mem, off_t off, int prot) -{ - return isa_mappage(mem, off, prot); -} - int ad1848_get_props(void *addr) { diff --git a/sys/dev/isa/ad1848var.h b/sys/dev/isa/ad1848var.h index 0e193f77465..6eb97fce07a 100644 --- a/sys/dev/isa/ad1848var.h +++ b/sys/dev/isa/ad1848var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ad1848var.h,v 1.14 2011/06/29 17:48:22 tedu Exp $ */ +/* $OpenBSD: ad1848var.h,v 1.15 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: ad1848var.h,v 1.22 1998/01/19 22:18:26 augustss Exp $ */ /* @@ -182,7 +182,6 @@ void ad1848_close(void *); void ad1848_forceintr(struct ad1848_softc *); -int ad1848_query_encoding(void *, struct audio_encoding *); int ad1848_set_params(void *, int, int, struct audio_params *, struct audio_params *); int ad1848_round_blocksize(void *, int); @@ -214,7 +213,6 @@ void ad1848_mute_channel(struct ad1848_softc *, int device, int mute); void *ad1848_malloc(void *, int, size_t, int, int); void ad1848_free(void *, void *, int); size_t ad1848_round(void *, int, size_t); -paddr_t ad1848_mappage(void *, void *, off_t, int); int ad1848_get_props(void *); diff --git a/sys/dev/isa/ess.c b/sys/dev/isa/ess.c index 1e42e6bc9b3..ded28774eaa 100644 --- a/sys/dev/isa/ess.c +++ b/sys/dev/isa/ess.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ess.c,v 1.22 2015/06/25 06:43:46 ratchov Exp $ */ +/* $OpenBSD: ess.c,v 1.23 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: ess.c,v 1.44.4.1 1999/06/21 01:18:00 thorpej Exp $ */ /* @@ -119,9 +119,6 @@ int ess_open(void *, int); void ess_1788_close(void *); void ess_1888_close(void *); int ess_getdev(void *, struct audio_device *); -int ess_drain(void *); - -int ess_query_encoding(void *, struct audio_encoding *); int ess_set_params(void *, int, int, struct audio_params *, struct audio_params *); @@ -151,7 +148,6 @@ int ess_get_port(void *, mixer_ctrl_t *); void *ess_malloc(void *, int, size_t, int, int); void ess_free(void *, void *, int); size_t ess_round_buffersize(void *, int, size_t); -paddr_t ess_mappage(void *, void *, off_t, int); int ess_query_devinfo(void *, mixer_devinfo_t *); @@ -213,8 +209,6 @@ struct audio_device ess_device = { struct audio_hw_if ess_1788_hw_if = { ess_open, ess_1788_close, - ess_drain, - ess_query_encoding, ess_set_params, ess_round_blocksize, NULL, @@ -233,18 +227,14 @@ struct audio_hw_if ess_1788_hw_if = { ess_malloc, ess_free, ess_round_buffersize, - ess_mappage, ess_1788_get_props, ess_audio1_trigger_output, - ess_audio1_trigger_input, - NULL + ess_audio1_trigger_input }; struct audio_hw_if ess_1888_hw_if = { ess_open, ess_1888_close, - ess_drain, - ess_query_encoding, ess_set_params, ess_round_blocksize, NULL, @@ -263,11 +253,9 @@ struct audio_hw_if ess_1888_hw_if = { ess_malloc, ess_free, ess_round_buffersize, - ess_mappage, ess_1888_get_props, ess_audio2_trigger_output, - ess_audio1_trigger_input, - NULL + ess_audio1_trigger_input }; #ifdef AUDIO_DEBUG @@ -1074,17 +1062,6 @@ ess_1888_close(void *addr) DPRINTF(("ess_1888_close: closed\n")); } -/* - * Wait for FIFO to drain, and analog section to settle. - * XXX should check FIFO empty bit. - */ -int -ess_drain(void *addr) -{ - tsleep(addr, PWAIT | PCATCH, "essdr", hz/20); /* XXX */ - return (0); -} - /* XXX should use reference count */ int ess_speaker_ctl(void *addr, int newstate) @@ -1110,45 +1087,6 @@ ess_getdev(void *addr, struct audio_device *retp) } int -ess_query_encoding(void *addr, struct audio_encoding *fp) -{ - /*struct ess_softc *sc = addr;*/ - - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 2: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 3: - strlcpy(fp->name, AudioEulinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return EINVAL; - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (0); -} - -int ess_set_params(void *addr, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) { @@ -2156,12 +2094,6 @@ ess_round_buffersize(void *addr, int direction, size_t size) return (size); } -paddr_t -ess_mappage(void *addr, void *mem, off_t off, int prot) -{ - return (isa_mappage(mem, off, prot)); -} - int ess_1788_get_props(void *addr) { diff --git a/sys/dev/isa/gus.c b/sys/dev/isa/gus.c index 70881f89edc..a3741beb31e 100644 --- a/sys/dev/isa/gus.c +++ b/sys/dev/isa/gus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gus.c,v 1.43 2015/06/25 20:05:11 ratchov Exp $ */ +/* $OpenBSD: gus.c,v 1.44 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */ /*- @@ -263,10 +263,6 @@ static const unsigned short gus_log_volumes[512] = { struct audio_hw_if gus_hw_if = { gusopen, gusclose, - NULL, /* drain */ - - gus_query_encoding, - gus_set_params, gus_round_blocksize, @@ -290,21 +286,15 @@ struct audio_hw_if gus_hw_if = { gus_malloc, gus_free, gus_round, - gus_mappage, gus_get_props, NULL, - NULL, NULL }; static struct audio_hw_if gusmax_hw_if = { gusmaxopen, gusmax_close, - NULL, /* drain */ - - gus_query_encoding, /* query encoding */ - gusmax_set_params, gusmax_round_blocksize, @@ -329,11 +319,9 @@ static struct audio_hw_if gusmax_hw_if = { ad1848_malloc, ad1848_free, ad1848_round, - ad1848_mappage, gusmax_get_props, NULL, - NULL, NULL }; @@ -3115,44 +3103,6 @@ mute: return 0; } -int -gus_query_encoding(void *addr, struct audio_encoding *fp) -{ - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEslinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 2: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 3: - strlcpy(fp->name, AudioEulinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return(EINVAL); - /*NOTREACHED*/ - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (0); -} - void * gus_malloc(void *addr, int direction, size_t size, int pool, int flags) { @@ -3181,12 +3131,6 @@ gus_round(void *addr, int direction, size_t size) return size; } -paddr_t -gus_mappage(void *addr, void *mem, off_t off, int prot) -{ - return isa_mappage(mem, off, prot); -} - /* * Setup the ICS mixer in "transparent" mode: reset everything to a sensible * level. Levels as suggested by GUS SDK code. diff --git a/sys/dev/isa/gusvar.h b/sys/dev/isa/gusvar.h index eb28efac411..2608925295d 100644 --- a/sys/dev/isa/gusvar.h +++ b/sys/dev/isa/gusvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: gusvar.h,v 1.8 2015/06/25 20:05:11 ratchov Exp $ */ +/* $OpenBSD: gusvar.h,v 1.9 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */ /*- @@ -369,11 +369,9 @@ int gusmax_mixer_set_port(void *, mixer_ctrl_t *); int gusmax_mixer_get_port(void *, mixer_ctrl_t *); int gus_mixer_query_devinfo(void *, mixer_devinfo_t *); int gusmax_mixer_query_devinfo(void *, mixer_devinfo_t *); -int gus_query_encoding(void *, struct audio_encoding *); void *gus_malloc(void *, int, size_t, int, int); void gus_free(void *, void *, int); size_t gus_round(void *, int, size_t); -paddr_t gus_mappage(void *, void *, off_t, int); int gus_get_props(void *); int gusmax_get_props(void *); diff --git a/sys/dev/isa/pas.c b/sys/dev/isa/pas.c index b951ccfd7d7..f7700e262e9 100644 --- a/sys/dev/isa/pas.c +++ b/sys/dev/isa/pas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pas.c,v 1.27 2014/09/14 14:17:25 jsg Exp $ */ +/* $OpenBSD: pas.c,v 1.28 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: pas.c,v 1.37 1998/01/12 09:43:43 thorpej Exp $ */ /* @@ -112,8 +112,6 @@ void pasconf(int, int, int, int); struct audio_hw_if pas_hw_if = { sbdsp_open, sbdsp_close, - 0, - sbdsp_query_encoding, sbdsp_set_params, sbdsp_round_blocksize, 0, @@ -132,11 +130,9 @@ struct audio_hw_if pas_hw_if = { sb_malloc, sb_free, sb_round, - sb_mappage, sbdsp_get_props, sbdsp_trigger_output, - sbdsp_trigger_input, - NULL + sbdsp_trigger_input }; /* The Address Translation code is used to convert I/O register addresses to diff --git a/sys/dev/isa/sb.c b/sys/dev/isa/sb.c index 3b93243232a..13aaa5d6921 100644 --- a/sys/dev/isa/sb.c +++ b/sys/dev/isa/sb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sb.c,v 1.27 2014/09/14 14:17:25 jsg Exp $ */ +/* $OpenBSD: sb.c,v 1.28 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: sb.c,v 1.57 1998/01/12 09:43:46 thorpej Exp $ */ /* @@ -104,8 +104,6 @@ int sb_getdev(void *, struct audio_device *); struct audio_hw_if sb_hw_if = { sbdsp_open, sbdsp_close, - 0, - sbdsp_query_encoding, sbdsp_set_params, sbdsp_round_blocksize, 0, @@ -124,11 +122,9 @@ struct audio_hw_if sb_hw_if = { sb_malloc, sb_free, sb_round, - sb_mappage, sbdsp_get_props, sbdsp_trigger_output, - sbdsp_trigger_input, - NULL + sbdsp_trigger_input }; #ifdef AUDIO_DEBUG diff --git a/sys/dev/isa/sbdsp.c b/sys/dev/isa/sbdsp.c index 8b5146816d4..52da66da3cc 100644 --- a/sys/dev/isa/sbdsp.c +++ b/sys/dev/isa/sbdsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sbdsp.c,v 1.36 2015/06/25 06:43:46 ratchov Exp $ */ +/* $OpenBSD: sbdsp.c,v 1.37 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -444,86 +444,6 @@ sbdsp_mix_read(sc, mixerport) */ int -sbdsp_query_encoding(addr, fp) - void *addr; - struct audio_encoding *fp; -{ - struct sbdsp_softc *sc = addr; - int emul, found = 0; - - emul = ISSB16CLASS(sc) ? 0 : AUDIO_ENCODINGFLAG_EMULATED; - - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - found = 1; - break; - case 1: - strlcpy(fp->name, AudioEmulaw, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - found = 1; - break; - case 2: - strlcpy(fp->name, AudioEalaw, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - found = 1; - break; - case 3: - strlcpy(fp->name, AudioEslinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = emul; - found = 1; - break; - } - if (found) { - fp->bps = 1; - fp->msb = 1; - return 0; - } else if (!ISSB16CLASS(sc) && sc->sc_model != SB_JAZZ) - return EINVAL; - - switch(fp->index) { - case 4: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 5: - strlcpy(fp->name, AudioEulinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; - fp->precision = 16; - fp->flags = emul; - break; - case 6: - strlcpy(fp->name, AudioEslinear_be, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_BE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 7: - strlcpy(fp->name, AudioEulinear_be, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR_BE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - default: - return EINVAL; - } - fp->bps = 2; - fp->msb = 1; - return 0; -} - -int sbdsp_set_params(addr, setmode, usemode, play, rec) void *addr; int setmode, usemode; @@ -2262,16 +2182,6 @@ sb_round(addr, direction, size) return size; } -paddr_t -sb_mappage(addr, mem, off, prot) - void *addr; - void *mem; - off_t off; - int prot; -{ - return isa_mappage(mem, off, prot); -} - int sbdsp_get_props(addr) void *addr; diff --git a/sys/dev/isa/sbdspvar.h b/sys/dev/isa/sbdspvar.h index 6ed2779e5f6..188cdf205b2 100644 --- a/sys/dev/isa/sbdspvar.h +++ b/sys/dev/isa/sbdspvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sbdspvar.h,v 1.17 2013/11/29 03:39:00 brad Exp $ */ +/* $OpenBSD: sbdspvar.h,v 1.18 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: sbdspvar.h,v 1.37 1998/08/10 00:20:39 mycroft Exp $ */ /* @@ -204,7 +204,6 @@ int sbdsp_set_out_gain_real(void *, u_int, u_char); int sbdsp_get_out_gain(void *); int sbdsp_set_monitor_gain(void *, u_int); int sbdsp_get_monitor_gain(void *); -int sbdsp_query_encoding(void *, struct audio_encoding *); int sbdsp_set_params(void *, int, int, struct audio_params *, struct audio_params *); int sbdsp_round_blocksize(void *, int); int sbdsp_get_avail_in_ports(void *); @@ -243,7 +242,6 @@ int sbdsp_mixer_query_devinfo(void *, mixer_devinfo_t *); void *sb_malloc(void *, int, size_t, int, int); void sb_free(void *, void *, int); size_t sb_round(void *, int, size_t); -paddr_t sb_mappage(void *, void *, off_t, int); int sbdsp_get_props(void *); diff --git a/sys/dev/pci/auacer.c b/sys/dev/pci/auacer.c index 57fd2ebf120..8b26b2511b9 100644 --- a/sys/dev/pci/auacer.c +++ b/sys/dev/pci/auacer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auacer.c,v 1.18 2015/05/11 06:46:21 ratchov Exp $ */ +/* $OpenBSD: auacer.c,v 1.19 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: auacer.c,v 1.3 2004/11/10 04:20:26 kent Exp $ */ /*- @@ -153,7 +153,6 @@ struct cfattach auacer_ca = { int auacer_open(void *, int); void auacer_close(void *); -int auacer_query_encoding(void *, struct audio_encoding *); int auacer_set_params(void *, int, int, struct audio_params *, struct audio_params *); int auacer_round_blocksize(void *, int); @@ -166,13 +165,11 @@ int auacer_query_devinfo(void *, mixer_devinfo_t *); void *auacer_allocm(void *, int, size_t, int, int); void auacer_freem(void *, void *, int); size_t auacer_round_buffersize(void *, int, size_t); -paddr_t auacer_mappage(void *, void *, off_t, int); int auacer_get_props(void *); int auacer_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); int auacer_trigger_input(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); -void auacer_get_default_params(void *, int, struct audio_params *); int auacer_alloc_cdata(struct auacer_softc *); @@ -188,8 +185,6 @@ static void auacer_reset(struct auacer_softc *sc); struct audio_hw_if auacer_hw_if = { auacer_open, auacer_close, - NULL, /* drain */ - auacer_query_encoding, auacer_set_params, auacer_round_blocksize, NULL, /* commit_setting */ @@ -208,11 +203,9 @@ struct audio_hw_if auacer_hw_if = { auacer_allocm, auacer_freem, auacer_round_buffersize, - auacer_mappage, auacer_get_props, auacer_trigger_output, - auacer_trigger_input, - auacer_get_default_params + auacer_trigger_input }; int auacer_attach_codec(void *, struct ac97_codec_if *); @@ -434,33 +427,6 @@ auacer_close(void *v) DPRINTF(ALI_DEBUG_API, ("auacer_close\n")); } -void -auacer_get_default_params(void *addr, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - -int -auacer_query_encoding(void *v, struct audio_encoding *aep) -{ - DPRINTF(ALI_DEBUG_API, ("auacer_query_encoding\n")); - - switch (aep->index) { - case 0: - strlcpy(aep->name, AudioEslinear_le, sizeof aep->name); - aep->encoding = AUDIO_ENCODING_SLINEAR_LE; - aep->precision = 16; - aep->flags = 0; - break; - default: - return (EINVAL); - } - aep->bps = AUDIO_BPS(aep->precision); - aep->msb = 1; - - return (0); -} - int auacer_set_rate(struct auacer_softc *sc, int mode, u_long srate) { @@ -692,23 +658,6 @@ auacer_round_buffersize(void *v, int direction, size_t size) return size; } -paddr_t -auacer_mappage(void *v, void *mem, off_t off, int prot) -{ - struct auacer_softc *sc = v; - struct auacer_dma *p; - - if (off < 0) - return (-1); - - for (p = sc->sc_dmas; p && KERNADDR(p) != mem; p = p->next) - ; - if (!p) - return (-1); - return (bus_dmamem_mmap(sc->dmat, p->segs, p->nsegs, - off, prot, BUS_DMA_WAITOK)); -} - int auacer_get_props(void *v) { diff --git a/sys/dev/pci/auglx.c b/sys/dev/pci/auglx.c index 1e9b71cf337..a01a2a5bd57 100644 --- a/sys/dev/pci/auglx.c +++ b/sys/dev/pci/auglx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auglx.c,v 1.13 2015/05/11 06:46:21 ratchov Exp $ */ +/* $OpenBSD: auglx.c,v 1.14 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org> @@ -214,7 +214,6 @@ struct cfdriver auglx_cd = { int auglx_open(void *, int); void auglx_close(void *); -int auglx_query_encoding(void *, struct audio_encoding *); int auglx_set_params(void *, int, int, struct audio_params *, struct audio_params *); int auglx_round_blocksize(void *, int); @@ -227,7 +226,6 @@ int auglx_query_devinfo(void *, mixer_devinfo_t *); void *auglx_allocm(void *, int, size_t, int, int); void auglx_freem(void *, void *, int); size_t auglx_round_buffersize(void *, int, size_t); -paddr_t auglx_mappage(void *, void *, off_t, int); int auglx_get_props(void *); int auglx_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); @@ -238,13 +236,10 @@ int auglx_alloc_prd(struct auglx_softc *, size_t, struct auglx_ring *); void auglx_free_prd(struct auglx_softc *sc, struct auglx_ring *bm); int auglx_allocmem(struct auglx_softc *, size_t, size_t, struct auglx_dma *); void auglx_freemem(struct auglx_softc *, struct auglx_dma *); -void auglx_get_default_params(void *, int, struct audio_params *); struct audio_hw_if auglx_hw_if = { auglx_open, auglx_close, - NULL, /* drain */ - auglx_query_encoding, auglx_set_params, auglx_round_blocksize, NULL, /* commit_setting */ @@ -263,11 +258,9 @@ struct audio_hw_if auglx_hw_if = { auglx_allocm, auglx_freem, auglx_round_buffersize, - auglx_mappage, auglx_get_props, auglx_trigger_output, - auglx_trigger_input, - auglx_get_default_params + auglx_trigger_input }; int auglx_match(struct device *, void *, void *); @@ -476,27 +469,6 @@ auglx_close(void *v) { } - -int -auglx_query_encoding(void *v, struct audio_encoding *aep) -{ - switch (aep->index) { - case 0: - strlcpy(aep->name, AudioEslinear_le, sizeof aep->name); - aep->encoding = AUDIO_ENCODING_SLINEAR_LE; - aep->precision = 16; - aep->flags = 0; - break; - default: - return EINVAL; - } - aep->bps = AUDIO_BPS(aep->precision); - aep->msb = 1; - - return 0; -} - - int auglx_set_params(void *v, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) @@ -670,23 +642,6 @@ auglx_round_buffersize(void *v, int direction, size_t size) return size; } -paddr_t -auglx_mappage(void *v, void *mem, off_t off, int prot) -{ - struct auglx_softc *sc = v; - struct auglx_dma *p; - - if (off < 0) - return -1; - - for (p = sc->sc_dmas; p && p->addr != mem; p = p->next); - if (!p) - return -1; - - return bus_dmamem_mmap(sc->sc_dmat, p->segs, p->nsegs, - off, prot, BUS_DMA_WAITOK); -} - int auglx_get_props(void *v) { @@ -917,12 +872,6 @@ auglx_freemem(struct auglx_softc *sc, struct auglx_dma *p) bus_dmamem_free(sc->sc_dmat, p->segs, p->nsegs); } -void -auglx_get_default_params(void *addr, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - int auglx_alloc_prd(struct auglx_softc *sc, size_t size, struct auglx_ring *bm) { diff --git a/sys/dev/pci/auich.c b/sys/dev/pci/auich.c index c22915c169a..0c56fb66c4b 100644 --- a/sys/dev/pci/auich.c +++ b/sys/dev/pci/auich.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auich.c,v 1.104 2015/05/11 06:46:21 ratchov Exp $ */ +/* $OpenBSD: auich.c,v 1.105 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 2000,2001 Michael Shalayeff @@ -292,7 +292,6 @@ static const struct auich_devtype { int auich_open(void *, int); void auich_close(void *); -int auich_query_encoding(void *, struct audio_encoding *); int auich_set_params(void *, int, int, struct audio_params *, struct audio_params *); int auich_round_blocksize(void *, int); @@ -306,7 +305,6 @@ int auich_query_devinfo(void *, mixer_devinfo_t *); void *auich_allocm(void *, int, size_t, int, int); void auich_freem(void *, void *, int); size_t auich_round_buffersize(void *, int, size_t); -paddr_t auich_mappage(void *, void *, off_t, int); int auich_get_props(void *); void auich_trigger_pipe(struct auich_softc *, int, struct auich_ring *); void auich_intr_pipe(struct auich_softc *, int, struct auich_ring *); @@ -317,15 +315,12 @@ int auich_trigger_input(void *, void *, void *, int, void (*)(void *), int auich_alloc_cdata(struct auich_softc *); int auich_allocmem(struct auich_softc *, size_t, size_t, struct auich_dma *); int auich_freemem(struct auich_softc *, struct auich_dma *); -void auich_get_default_params(void *, int, struct audio_params *); int auich_resume(struct auich_softc *); struct audio_hw_if auich_hw_if = { auich_open, auich_close, - NULL, /* drain */ - auich_query_encoding, auich_set_params, auich_round_blocksize, NULL, /* commit_setting */ @@ -344,11 +339,9 @@ struct audio_hw_if auich_hw_if = { auich_allocm, auich_freem, auich_round_buffersize, - auich_mappage, auich_get_props, auich_trigger_output, - auich_trigger_input, - auich_get_default_params + auich_trigger_input }; int auich_attach_codec(void *, struct ac97_codec_if *); @@ -675,29 +668,6 @@ auich_close(void *v) sc->codec_if->vtbl->unlock(sc->codec_if); } -void -auich_get_default_params(void *addr, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - -int -auich_query_encoding(void *v, struct audio_encoding *aep) -{ - switch (aep->index) { - case 0: - strlcpy(aep->name, AudioEslinear_le, sizeof aep->name); - aep->encoding = AUDIO_ENCODING_SLINEAR_LE; - aep->precision = 16; - aep->flags = 0; - aep->bps = 2; - aep->msb = 1; - return (0); - default: - return (EINVAL); - } -} - int auich_set_params(void *v, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) @@ -977,27 +947,6 @@ auich_round_buffersize(void *v, int direction, size_t size) return size; } -paddr_t -auich_mappage(void *v, void *mem, off_t off, int prot) -{ - struct auich_softc *sc = v; - struct auich_dma *p; - - if (off < 0) - return -1; - - p = NULL; - if (sc->sc_pdma != NULL && sc->sc_pdma->addr == mem) - p = sc->sc_pdma; - else if (sc->sc_rdma != NULL && sc->sc_rdma->addr == mem) - p = sc->sc_rdma; - else - return -1; - - return bus_dmamem_mmap(sc->dmat, p->segs, p->nsegs, - off, prot, BUS_DMA_WAITOK); -} - int auich_get_props(void *v) { diff --git a/sys/dev/pci/auixp.c b/sys/dev/pci/auixp.c index 4207cac6cef..8177737b680 100644 --- a/sys/dev/pci/auixp.c +++ b/sys/dev/pci/auixp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auixp.c,v 1.36 2015/12/11 16:07:01 mpi Exp $ */ +/* $OpenBSD: auixp.c,v 1.37 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: auixp.c,v 1.9 2005/06/27 21:13:09 thorpej Exp $ */ /* @@ -110,7 +110,6 @@ struct cfattach auixp_ca = { int auixp_open(void *v, int flags); void auixp_close(void *v); -int auixp_query_encoding(void *, struct audio_encoding *); int auixp_set_params(void *, int, int, struct audio_params *, struct audio_params *); int auixp_commit_settings(void *); @@ -133,8 +132,6 @@ int auixp_intr(void *); int auixp_allocmem(struct auixp_softc *, size_t, size_t, struct auixp_dma *); int auixp_freemem(struct auixp_softc *, struct auixp_dma *); -paddr_t auixp_mappage(void *, void *, off_t, int); -void auixp_get_default_params(void *, int, struct audio_params *); /* Supporting subroutines */ int auixp_init(struct auixp_softc *); @@ -170,8 +167,6 @@ void auixp_update_busbusy(struct auixp_softc *); struct audio_hw_if auixp_hw_if = { auixp_open, auixp_close, - NULL, /* drain */ - auixp_query_encoding, auixp_set_params, auixp_round_blocksize, auixp_commit_settings, @@ -190,11 +185,9 @@ struct audio_hw_if auixp_hw_if = { auixp_malloc, auixp_free, auixp_round_buffersize, - auixp_mappage, auixp_get_props, auixp_trigger_output, - auixp_trigger_input, - auixp_get_default_params + auixp_trigger_input }; int @@ -209,32 +202,6 @@ auixp_close(void *v) { } -void -auixp_get_default_params(void *v, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - -int -auixp_query_encoding(void *hdl, struct audio_encoding *aep) -{ - switch (aep->index) { - case 0: - strlcpy(aep->name, AudioEslinear_le, sizeof aep->name); - aep->encoding = AUDIO_ENCODING_SLINEAR_LE; - aep->precision = 16; - aep->flags = 0; - break; - default: - return (EINVAL); - } - aep->bps = AUDIO_BPS(aep->precision); - aep->msb = 1; - - return (0); -} - - /* commit setting and program ATI IXP chip */ int auixp_commit_settings(void *hdl) @@ -977,36 +944,6 @@ auixp_freemem(struct auixp_softc *sc, struct auixp_dma *p) return 0; } - -/* memory map dma memory */ -paddr_t -auixp_mappage(void *hdl, void *mem, off_t off, int prot) -{ - struct auixp_codec *co; - struct auixp_softc *sc; - struct auixp_dma *p; - - co = (struct auixp_codec *) hdl; - sc = co->sc; - /* for sanity */ - if (off < 0) - return -1; - - /* look up allocated DMA area */ - SLIST_FOREACH(p, &sc->sc_dma_list, dma_chain) { - if (KERNADDR(p) == mem) - break; - } - - /* have we found it ? */ - if (!p) - return -1; - - /* return mmap'd region */ - return bus_dmamem_mmap(sc->sc_dmat, p->segs, p->nsegs, - off, prot, BUS_DMA_WAITOK); -} - int auixp_match(struct device *dev, void *match, void *aux) { diff --git a/sys/dev/pci/autri.c b/sys/dev/pci/autri.c index d46cf79e9df..715f920e1f6 100644 --- a/sys/dev/pci/autri.c +++ b/sys/dev/pci/autri.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autri.c,v 1.39 2015/06/10 20:14:02 ratchov Exp $ */ +/* $OpenBSD: autri.c,v 1.40 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro. @@ -121,7 +121,6 @@ struct cfattach autri_ca = { int autri_open(void *, int); void autri_close(void *); -int autri_query_encoding(void *, struct audio_encoding *); int autri_set_params(void *, int, int, struct audio_params *, struct audio_params *); int autri_round_blocksize(void *, int); @@ -136,7 +135,6 @@ int autri_mixer_set_port(void *, mixer_ctrl_t *); int autri_mixer_get_port(void *, mixer_ctrl_t *); void *autri_malloc(void *, int, size_t, int, int); void autri_free(void *, void *, int); -paddr_t autri_mappage(void *, void *, off_t, int); int autri_get_props(void *); int autri_query_devinfo(void *addr, mixer_devinfo_t *dip); @@ -145,8 +143,6 @@ int autri_get_portnum_by_name(struct autri_softc *, char *, char *, char *); struct audio_hw_if autri_hw_if = { autri_open, autri_close, - NULL, /* drain */ - autri_query_encoding, autri_set_params, autri_round_blocksize, NULL, /* commit_settings */ @@ -165,11 +161,9 @@ struct audio_hw_if autri_hw_if = { autri_malloc, autri_free, NULL, - autri_mappage, autri_get_props, autri_trigger_output, - autri_trigger_input, - NULL + autri_trigger_input }; #if NMIDI > 0 @@ -900,31 +894,6 @@ autri_close(void *addr) } int -autri_query_encoding(void *addr, struct audio_encoding *fp) -{ - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return (EINVAL); - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return 0; -} - -int autri_set_params(void *addr, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) { @@ -1102,23 +1071,6 @@ autri_find_dma(struct autri_softc *sc, void *addr) return p; } -paddr_t -autri_mappage(void *addr, void *mem, off_t off, int prot) -{ - struct autri_softc *sc = addr; - struct autri_dma *p; - - if (off < 0) - return (-1); - - p = autri_find_dma(sc, mem); - if (!p) - return (-1); - - return (bus_dmamem_mmap(sc->sc_dmatag, p->segs, p->nsegs, - off, prot, BUS_DMA_WAITOK)); -} - int autri_get_props(void *addr) { diff --git a/sys/dev/pci/auvia.c b/sys/dev/pci/auvia.c index a68db8c2c89..5dae0bc4854 100644 --- a/sys/dev/pci/auvia.c +++ b/sys/dev/pci/auvia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auvia.c,v 1.55 2015/05/11 06:46:21 ratchov Exp $ */ +/* $OpenBSD: auvia.c,v 1.56 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: auvia.c,v 1.28 2002/11/04 16:38:49 kent Exp $ */ /*- @@ -74,12 +74,10 @@ int auvia_match(struct device *, void *, void *); void auvia_attach(struct device *, struct device *, void *); int auvia_open(void *, int); void auvia_close(void *); -int auvia_query_encoding(void *, struct audio_encoding *); void auvia_set_params_sub(struct auvia_softc *, struct auvia_softc_chan *, struct audio_params *); int auvia_set_params(void *, int, int, struct audio_params *, struct audio_params *); -void auvia_get_default_params(void *, int, struct audio_params *); int auvia_round_blocksize(void *, int); int auvia_halt_output(void *); int auvia_halt_input(void *); @@ -90,7 +88,6 @@ int auvia_query_devinfo(void *, mixer_devinfo_t *); void * auvia_malloc(void *, int, size_t, int, int); void auvia_free(void *, void *, int); size_t auvia_round_buffersize(void *, int, size_t); -paddr_t auvia_mappage(void *, void *, off_t, int); int auvia_get_props(void *); int auvia_build_dma_ops(struct auvia_softc *, struct auvia_softc_chan *, struct auvia_dma *, void *, void *, int); @@ -185,8 +182,6 @@ struct cfattach auvia_ca = { struct audio_hw_if auvia_hw_if = { auvia_open, auvia_close, - NULL, /* drain */ - auvia_query_encoding, auvia_set_params, auvia_round_blocksize, NULL, /* commit_settings */ @@ -205,11 +200,9 @@ struct audio_hw_if auvia_hw_if = { auvia_malloc, auvia_free, auvia_round_buffersize, - auvia_mappage, auvia_get_props, auvia_trigger_output, - auvia_trigger_input, - auvia_get_default_params + auvia_trigger_input }; int auvia_attach_codec(void *, struct ac97_codec_if *); @@ -514,48 +507,6 @@ auvia_close(void *addr) } -int -auvia_query_encoding(void *addr, struct audio_encoding *fp) -{ - struct auvia_softc *sc = addr; - - if (sc->sc_spdif) { - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - fp->bps = 2; - fp->msb = 1; - return (0); - default: - return (EINVAL); - } - } else { - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return (EINVAL); - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (0); - } -} - void auvia_set_params_sub(struct auvia_softc *sc, struct auvia_softc_chan *ch, struct audio_params *p) @@ -596,12 +547,6 @@ auvia_set_params_sub(struct auvia_softc *sc, struct auvia_softc_chan *ch, } } -void -auvia_get_default_params(void *addr, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - int auvia_set_params(void *addr, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) @@ -881,26 +826,6 @@ auvia_round_buffersize(void *addr, int direction, size_t bufsize) return bufsize; } -paddr_t -auvia_mappage(void *addr, void *mem, off_t off, int prot) -{ - struct auvia_softc *sc = addr; - struct auvia_dma *p; - - if (off < 0) - return -1; - - for (p = sc->sc_dmas; p && p->addr != mem; p = p->next) - ; - - if (!p) - return -1; - - return bus_dmamem_mmap(sc->sc_dmat, &p->seg, 1, off, prot, - BUS_DMA_WAITOK); -} - - int auvia_get_props(void *addr) { diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c index 6465cf9d4e2..f909787b797 100644 --- a/sys/dev/pci/azalia.c +++ b/sys/dev/pci/azalia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.c,v 1.227 2016/04/24 06:45:20 jsg Exp $ */ +/* $OpenBSD: azalia.c,v 1.228 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */ /*- @@ -249,10 +249,8 @@ int azalia_stream_intr(stream_t *); int azalia_open(void *, int); void azalia_close(void *); -int azalia_query_encoding(void *, audio_encoding_t *); int azalia_set_params(void *, int, int, audio_params_t *, audio_params_t *); -void azalia_get_default_params(void *, int, struct audio_params*); int azalia_round_blocksize(void *, int); int azalia_halt_output(void *); int azalia_halt_input(void *); @@ -270,7 +268,6 @@ int azalia_trigger_input(void *, void *, void *, int, void (*)(void *), void *, audio_params_t *); int azalia_params2fmt(const audio_params_t *, uint16_t *); -int azalia_create_encodings(codec_t *); int azalia_match_format(codec_t *, int, audio_params_t *); int azalia_set_params_sub(codec_t *, int, audio_params_t *); @@ -295,8 +292,6 @@ struct cfdriver azalia_cd = { struct audio_hw_if azalia_hw_if = { azalia_open, azalia_close, - NULL, /* drain */ - azalia_query_encoding, azalia_set_params, azalia_round_blocksize, NULL, /* commit_settings */ @@ -315,11 +310,9 @@ struct audio_hw_if azalia_hw_if = { azalia_allocm, azalia_freem, azalia_round_buffersize, - NULL, /* mappage */ azalia_get_props, azalia_trigger_output, - azalia_trigger_input, - azalia_get_default_params + azalia_trigger_input }; static const char *pin_devices[16] = { @@ -2606,12 +2599,6 @@ azalia_codec_delete(codec_t *this) } this->nformats = 0; - if (this->encs != NULL) { - free(this->encs, M_DEVBUF, 0); - this->encs = NULL; - } - this->nencs = 0; - if (this->opins != NULL) { free(this->opins, M_DEVBUF, 0); this->opins = NULL; @@ -2650,7 +2637,7 @@ azalia_codec_construct_format(codec_t *this, int newdac, int newadc) const convgroup_t *group; uint32_t bits_rates; int variation; - int nbits, c, chan, i, err; + int nbits, c, chan, i; nid_t nid; variation = 0; @@ -2759,9 +2746,6 @@ azalia_codec_construct_format(codec_t *this, int newdac, int newadc) } } - err = azalia_create_encodings(this); - if (err) - return err; return 0; } @@ -3877,34 +3861,6 @@ azalia_close(void *v) } int -azalia_query_encoding(void *v, audio_encoding_t *enc) -{ - azalia_t *az; - codec_t *codec; - - az = v; - codec = &az->codecs[az->codecno]; - - if (enc->index < 0 || enc->index >= codec->nencs) - return (EINVAL); - - *enc = codec->encs[enc->index]; - - return (0); -} - -void -azalia_get_default_params(void *addr, int mode, struct audio_params *params) -{ - params->sample_rate = 48000; - params->encoding = AUDIO_ENCODING_SLINEAR_LE; - params->precision = 16; - params->bps = 2; - params->msb = 1; - params->channels = 2; -} - -int azalia_match_format(codec_t *codec, int mode, audio_params_t *par) { int i; @@ -3948,10 +3904,8 @@ azalia_set_params_sub(codec_t *codec, int mode, audio_params_t *par) opre = par->precision; if ((mode == AUMODE_PLAY && codec->dacs.ngroups == 0) || - (mode == AUMODE_RECORD && codec->adcs.ngroups == 0)) { - azalia_get_default_params(NULL, mode, par); + (mode == AUMODE_RECORD && codec->adcs.ngroups == 0)) return 0; - } i = azalia_match_format(codec, mode, par); if (i == codec->nformats && (par->precision != 16 || par->encoding != @@ -4340,66 +4294,3 @@ azalia_params2fmt(const audio_params_t *param, uint16_t *fmt) *fmt = ret; return 0; } - -int -azalia_create_encodings(codec_t *this) -{ - struct audio_format f; - int encs[16]; - int enc, nencs; - int i, j; - - nencs = 0; - for (i = 0; i < this->nformats && nencs < 16; i++) { - f = this->formats[i]; - enc = f.precision << 8 | f.encoding; - for (j = 0; j < nencs; j++) { - if (encs[j] == enc) - break; - } - if (j < nencs) - continue; - encs[j] = enc; - nencs++; - } - - if (this->encs != NULL) - free(this->encs, M_DEVBUF, 0); - this->nencs = 0; - this->encs = mallocarray(nencs, sizeof(struct audio_encoding), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (this->encs == NULL) { - printf("%s: out of memory in %s\n", - XNAME(this->az), __func__); - return ENOMEM; - } - - this->nencs = nencs; - for (i = 0; i < this->nencs; i++) { - this->encs[i].index = i; - this->encs[i].encoding = encs[i] & 0xff; - this->encs[i].precision = encs[i] >> 8; - this->encs[i].bps = AUDIO_BPS(encs[i] >> 8); - this->encs[i].msb = 1; - this->encs[i].flags = 0; - switch (this->encs[i].encoding) { - case AUDIO_ENCODING_SLINEAR_LE: - strlcpy(this->encs[i].name, - this->encs[i].precision == 8 ? - AudioEslinear : AudioEslinear_le, - sizeof this->encs[i].name); - break; - case AUDIO_ENCODING_ULINEAR_LE: - strlcpy(this->encs[i].name, - this->encs[i].precision == 8 ? - AudioEulinear : AudioEulinear_le, - sizeof this->encs[i].name); - break; - default: - DPRINTF(("%s: unknown format\n", __func__)); - break; - } - } - - return (0); -} diff --git a/sys/dev/pci/azalia.h b/sys/dev/pci/azalia.h index 74c00a0f2c7..ead7352ccb5 100644 --- a/sys/dev/pci/azalia.h +++ b/sys/dev/pci/azalia.h @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.h,v 1.64 2015/08/24 04:50:40 jsg Exp $ */ +/* $OpenBSD: azalia.h,v 1.65 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: azalia.h,v 1.6 2006/01/16 14:15:26 kent Exp $ */ /*- @@ -674,8 +674,6 @@ typedef struct codec_t { struct audio_format *formats; int nformats; - struct audio_encoding *encs; - int nencs; struct io_pin *ipins; int nipins; diff --git a/sys/dev/pci/cmpci.c b/sys/dev/pci/cmpci.c index c66a12803bb..c22a257136a 100644 --- a/sys/dev/pci/cmpci.c +++ b/sys/dev/pci/cmpci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmpci.c,v 1.40 2015/06/18 20:02:57 naddy Exp $ */ +/* $OpenBSD: cmpci.c,v 1.41 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: cmpci.c,v 1.25 2004/10/26 06:32:20 xtraeme Exp $ */ /* @@ -129,11 +129,9 @@ struct cmpci_dmanode * cmpci_find_dmamem(struct cmpci_softc *, */ int cmpci_open(void *, int); void cmpci_close(void *); -int cmpci_query_encoding(void *, struct audio_encoding *); int cmpci_set_params(void *, int, int, struct audio_params *, struct audio_params *); -void cmpci_get_default_params(void *, int, struct audio_params*); int cmpci_round_blocksize(void *, int); int cmpci_halt_output(void *); int cmpci_halt_input(void *); @@ -144,7 +142,6 @@ int cmpci_query_devinfo(void *, mixer_devinfo_t *); void *cmpci_malloc(void *, int, size_t, int, int); void cmpci_free(void *, void *, int); size_t cmpci_round_buffersize(void *, int, size_t); -paddr_t cmpci_mappage(void *, void *, off_t, int); int cmpci_get_props(void *); int cmpci_trigger_output(void *, void *, void *, int, void (*)(void *), void *, @@ -156,8 +153,6 @@ int cmpci_trigger_input(void *, void *, void *, int, struct audio_hw_if cmpci_hw_if = { cmpci_open, /* open */ cmpci_close, /* close */ - NULL, /* drain */ - cmpci_query_encoding, /* query_encoding */ cmpci_set_params, /* set_params */ cmpci_round_blocksize, /* round_blocksize */ NULL, /* commit_settings */ @@ -176,11 +171,9 @@ struct audio_hw_if cmpci_hw_if = { cmpci_malloc, /* malloc */ cmpci_free, /* free */ cmpci_round_buffersize,/* round_buffersize */ - cmpci_mappage, /* mappage */ cmpci_get_props, /* get_props */ cmpci_trigger_output, /* trigger_output */ - cmpci_trigger_input, /* trigger_input */ - cmpci_get_default_params + cmpci_trigger_input /* trigger_input */ }; /* @@ -642,42 +635,6 @@ cmpci_close(void *handle) } int -cmpci_query_encoding(void *handle, struct audio_encoding *fp) -{ - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return EINVAL; - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return 0; -} - -void -cmpci_get_default_params(void *addr, int mode, struct audio_params *params) -{ - params->sample_rate = 48000; - params->encoding = AUDIO_ENCODING_SLINEAR_LE; - params->precision = 16; - params->bps = 2; - params->msb = 1; - params->channels = 2; -} - -int cmpci_set_params(void *handle, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) { @@ -1847,19 +1804,6 @@ cmpci_round_buffersize(void *handle, int direction, size_t bufsize) return bufsize; } -paddr_t -cmpci_mappage(void *handle, void *addr, off_t offset, int prot) -{ - struct cmpci_softc *sc = handle; - struct cmpci_dmanode *p; - - if (offset < 0 || NULL == (p = cmpci_find_dmamem(sc, addr))) - return -1; - - return bus_dmamem_mmap(p->cd_tag, p->cd_segs, - nitems(p->cd_segs), offset, prot, BUS_DMA_WAITOK); -} - /* ARGSUSED */ int cmpci_get_props(void *handle) diff --git a/sys/dev/pci/cs4280.c b/sys/dev/pci/cs4280.c index 8f6e6cf688b..b60bd6e82da 100644 --- a/sys/dev/pci/cs4280.c +++ b/sys/dev/pci/cs4280.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cs4280.c,v 1.48 2015/12/11 16:07:01 mpi Exp $ */ +/* $OpenBSD: cs4280.c,v 1.49 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: cs4280.c,v 1.5 2000/06/26 04:56:23 simonb Exp $ */ /* @@ -195,10 +195,8 @@ int cs4280_init2(struct cs4280_softc *, int); int cs4280_open(void *, int); void cs4280_close(void *); -int cs4280_query_encoding(void *, struct audio_encoding *); int cs4280_set_params(void *, int, int, struct audio_params *, struct audio_params *); int cs4280_round_blocksize(void *, int); -void cs4280_get_default_params(void *, int, struct audio_params *); int cs4280_halt_output(void *); int cs4280_halt_input(void *); @@ -211,7 +209,6 @@ int cs4280_query_devinfo(void *addr, mixer_devinfo_t *dip); void *cs4280_malloc(void *, int, size_t, int, int); void cs4280_free(void *, void *, int); size_t cs4280_round_buffersize(void *, int, size_t); -paddr_t cs4280_mappage(void *, void *, off_t, int); int cs4280_get_props(void *); int cs4280_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); @@ -242,8 +239,6 @@ int cs4280_midi_output(void *, int); struct audio_hw_if cs4280_hw_if = { cs4280_open, cs4280_close, - NULL, - cs4280_query_encoding, cs4280_set_params, cs4280_round_blocksize, NULL, @@ -262,11 +257,9 @@ struct audio_hw_if cs4280_hw_if = { cs4280_malloc, cs4280_free, cs4280_round_buffersize, - 0, /* cs4280_mappage, */ cs4280_get_props, cs4280_trigger_output, - cs4280_trigger_input, - cs4280_get_default_params + cs4280_trigger_input }; #if NMIDI > 0 @@ -1014,25 +1007,6 @@ cs4280_close(void *addr) } int -cs4280_query_encoding(void *addr, struct audio_encoding *fp) -{ - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return (EINVAL); - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (0); -} - -int cs4280_set_params(void *addr, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) { @@ -1106,12 +1080,6 @@ cs4280_round_buffersize(void *addr, int direction, size_t size) return (size); } -void -cs4280_get_default_params(void *addr, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - int cs4280_get_props(void *hdl) { @@ -1133,25 +1101,6 @@ cs4280_mixer_get_port(void *addr, mixer_ctrl_t *cp) return (sc->codec_if->vtbl->mixer_get_port(sc->codec_if, cp)); } -paddr_t -cs4280_mappage(void *addr, void *mem, off_t off, int prot) -{ - struct cs4280_softc *sc = addr; - struct cs4280_dma *p; - - if (off < 0) - return (-1); - for (p = sc->sc_dmas; p && BUFADDR(p) != mem; p = p->next) - ; - if (!p) { - DPRINTF(("cs4280_mappage: bad buffer address\n")); - return (-1); - } - return (bus_dmamem_mmap(sc->sc_dmatag, p->segs, p->nsegs, - off, prot, BUS_DMA_WAITOK)); -} - - int cs4280_query_devinfo(void *addr, mixer_devinfo_t *dip) { diff --git a/sys/dev/pci/cs4281.c b/sys/dev/pci/cs4281.c index 1dc958191d4..4a52dbde4e3 100644 --- a/sys/dev/pci/cs4281.c +++ b/sys/dev/pci/cs4281.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cs4281.c,v 1.34 2015/08/04 14:53:08 stsp Exp $ */ +/* $OpenBSD: cs4281.c,v 1.35 2016/09/14 06:12:19 ratchov Exp $ */ /* $Tera: cs4281.c,v 1.18 2000/12/27 14:24:45 tacha Exp $ */ /* @@ -150,7 +150,6 @@ int cs4281_match(struct device *, void *, void *); void cs4281_attach(struct device *, struct device *, void *); int cs4281_activate(struct device *, int); int cs4281_intr(void *); -int cs4281_query_encoding(void *, struct audio_encoding *); int cs4281_set_params(void *, int, int, struct audio_params *, struct audio_params *); int cs4281_halt_output(void *); @@ -180,7 +179,6 @@ int cs4281_query_devinfo(void *, mixer_devinfo_t *); void *cs4281_malloc(void *, int, size_t, int, int); size_t cs4281_round_buffersize(void *, int, size_t); void cs4281_free(void *, void *, int); -paddr_t cs4281_mappage(void *, void *, off_t, int); int cs4281_allocmem(struct cs4281_softc *, size_t, int, int, struct cs4281_dma *); @@ -200,8 +198,6 @@ int cs4281_debug = 5; struct audio_hw_if cs4281_hw_if = { cs4281_open, cs4281_close, - NULL, - cs4281_query_encoding, cs4281_set_params, cs4281_round_blocksize, NULL, @@ -220,11 +216,9 @@ struct audio_hw_if cs4281_hw_if = { cs4281_malloc, cs4281_free, cs4281_round_buffersize, - NULL, /* cs4281_mappage, */ cs4281_get_props, cs4281_trigger_output, - cs4281_trigger_input, - NULL + cs4281_trigger_input }; #if NMIDI > 0 @@ -411,57 +405,6 @@ cs4281_intr(p) } int -cs4281_query_encoding(addr, fp) - void *addr; - struct audio_encoding *fp; -{ - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 2: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 3: - strlcpy(fp->name, AudioEulinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 4: - strlcpy(fp->name, AudioEslinear_be, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_BE; - fp->precision = 16; - fp->flags = 0; - break; - case 5: - strlcpy(fp->name, AudioEulinear_be, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR_BE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return EINVAL; - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (0); -} - -int cs4281_set_params(addr, setmode, usemode, play, rec) void *addr; int setmode, usemode; @@ -1301,29 +1244,6 @@ cs4281_round_buffersize(void *addr, int direction, size_t size) return (DMA_SIZE); } -paddr_t -cs4281_mappage(void *addr, void *mem, off_t off, int prot) -{ - struct cs4281_softc *sc; - struct cs4281_dma *p; - - sc = addr; - if (off < 0) - return -1; - - for (p = sc->sc_dmas; p && KERNADDR(p) != mem; p = p->next) - ; - - if (!p) { - DPRINTF(("cs4281_mappage: bad buffer address\n")); - return (-1); - } - - return (bus_dmamem_mmap(sc->sc_dmatag, p->segs, p->nsegs, off, prot, - BUS_DMA_WAITOK)); -} - - int cs4281_get_props(void *addr) { diff --git a/sys/dev/pci/eap.c b/sys/dev/pci/eap.c index 872e674ff41..27322dcfe92 100644 --- a/sys/dev/pci/eap.c +++ b/sys/dev/pci/eap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eap.c,v 1.51 2015/05/11 06:46:22 ratchov Exp $ */ +/* $OpenBSD: eap.c,v 1.52 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: eap.c,v 1.46 2001/09/03 15:07:37 reinoud Exp $ */ /* @@ -159,7 +159,6 @@ struct cfattach eap_ca = { int eap_open(void *, int); void eap_close(void *); -int eap_query_encoding(void *, struct audio_encoding *); int eap_set_params(void *, int, int, struct audio_params *, struct audio_params *); int eap_round_blocksize(void *, int); int eap_trigger_output(void *, void *, void *, int, void (*)(void *), @@ -168,7 +167,6 @@ int eap_trigger_input(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); int eap_halt_output(void *); int eap_halt_input(void *); -void eap_get_default_params(void *, int, struct audio_params *); int eap_resume(struct eap_softc *); void eap1370_write_codec(struct eap_softc *, int, int); int eap_getdev(void *, struct audio_device *); @@ -179,7 +177,6 @@ int eap1371_mixer_get_port(void *, mixer_ctrl_t *); int eap1370_query_devinfo(void *, mixer_devinfo_t *); void *eap_malloc(void *, int, size_t, int, int); void eap_free(void *, void *, int); -paddr_t eap_mappage(void *, void *, off_t, int); int eap_get_props(void *); void eap1370_set_mixer(struct eap_softc *sc, int a, int d); u_int32_t eap1371_src_wait(struct eap_softc *sc); @@ -201,8 +198,6 @@ int eap_midi_output(void *, int); struct audio_hw_if eap1370_hw_if = { eap_open, eap_close, - NULL, - eap_query_encoding, eap_set_params, eap_round_blocksize, NULL, @@ -221,18 +216,14 @@ struct audio_hw_if eap1370_hw_if = { eap_malloc, eap_free, NULL, - eap_mappage, eap_get_props, eap_trigger_output, - eap_trigger_input, - eap_get_default_params + eap_trigger_input }; struct audio_hw_if eap1371_hw_if = { eap_open, eap_close, - NULL, - eap_query_encoding, eap_set_params, eap_round_blocksize, NULL, @@ -251,11 +242,9 @@ struct audio_hw_if eap1371_hw_if = { eap_malloc, eap_free, NULL, - eap_mappage, eap_get_props, eap_trigger_output, - eap_trigger_input, - eap_get_default_params + eap_trigger_input }; #if NMIDI > 0 @@ -863,37 +852,6 @@ eap_close(void *addr) } int -eap_query_encoding(void *addr, struct audio_encoding *fp) -{ - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return (EINVAL); - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (0); -} - -void -eap_get_default_params(void *addr, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - -int eap_set_params(void *addr, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) { @@ -1576,22 +1534,6 @@ eap_free(void *addr, void *ptr, int pool) } } -paddr_t -eap_mappage(void *addr, void *mem, off_t off, int prot) -{ - struct eap_softc *sc = addr; - struct eap_dma *p; - - if (off < 0) - return (-1); - for (p = sc->sc_dmas; p && KERNADDR(p) != mem; p = p->next) - ; - if (!p) - return (-1); - return (bus_dmamem_mmap(sc->sc_dmatag, p->segs, p->nsegs, - off, prot, BUS_DMA_WAITOK)); -} - int eap_get_props(void *addr) { diff --git a/sys/dev/pci/emuxki.c b/sys/dev/pci/emuxki.c index 79955663be8..834041199fe 100644 --- a/sys/dev/pci/emuxki.c +++ b/sys/dev/pci/emuxki.c @@ -1,4 +1,4 @@ -/* $OpenBSD: emuxki.c,v 1.49 2015/08/11 21:10:59 ratchov Exp $ */ +/* $OpenBSD: emuxki.c,v 1.50 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: emuxki.c,v 1.1 2001/10/17 18:39:41 jdolecek Exp $ */ /*- @@ -158,11 +158,9 @@ void emuxki_write_micro(struct emuxki_softc *sc, u_int32_t pc, u_int32_t data); int emuxki_open(void *, int); void emuxki_close(void *); -int emuxki_query_encoding(void *, struct audio_encoding *); int emuxki_set_params(void *, int, int, struct audio_params *, struct audio_params *); -void emuxki_get_default_params(void *, int, struct audio_params *); int emuxki_round_blocksize(void *, int); size_t emuxki_round_buffersize(void *, int, size_t); @@ -182,7 +180,6 @@ int emuxki_query_devinfo(void *, mixer_devinfo_t *); void *emuxki_allocm(void *, int, size_t, int, int); void emuxki_freem(void *, void *, int); -paddr_t emuxki_mappage(void *, void *, off_t, int); int emuxki_get_props(void *); /* Interrupt handler */ @@ -219,8 +216,6 @@ struct cfattach emu_ca = { struct audio_hw_if emuxki_hw_if = { emuxki_open, emuxki_close, - NULL, /* drain */ - emuxki_query_encoding, emuxki_set_params, emuxki_round_blocksize, NULL, /* commit settings */ @@ -239,11 +234,9 @@ struct audio_hw_if emuxki_hw_if = { emuxki_allocm, emuxki_freem, emuxki_round_buffersize, - emuxki_mappage, emuxki_get_props, emuxki_trigger_output, - emuxki_trigger_input, - emuxki_get_default_params + emuxki_trigger_input }; #if 0 @@ -2078,37 +2071,6 @@ emuxki_close(void *addr) } int -emuxki_query_encoding(void *addr, struct audio_encoding *fp) -{ -#ifdef EMUXKI_DEBUG - struct emuxki_softc *sc = addr; - - printf("%s: emuxki_query_encoding called\n", sc->sc_dev.dv_xname); -#endif - - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return (EINVAL); - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (0); -} - -int emuxki_set_vparms(struct emuxki_voice *voice, struct audio_params *p) { u_int8_t b16, mode; @@ -2178,12 +2140,6 @@ emuxki_set_params(void *addr, int setmode, int usemode, return (0); } -void -emuxki_get_default_params(void *addr, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - int emuxki_halt_output(void *addr) { @@ -2334,24 +2290,6 @@ emuxki_round_buffersize(void *addr, int direction, size_t bsize) return (bsize); } -paddr_t -emuxki_mappage(void *addr, void *ptr, off_t off, int prot) -{ - struct emuxki_softc *sc = addr; - struct emuxki_mem *mem; - - LIST_FOREACH(mem, &sc->mem, next) { - if (KERNADDR(mem->dmamem) == ptr) { - struct dmamem *dm = mem->dmamem; - - return bus_dmamem_mmap(dm->dmat, dm->segs, dm->nsegs, - off, prot, BUS_DMA_WAITOK); - } - } - - return (-1); -} - int emuxki_get_props(void *addr) { diff --git a/sys/dev/pci/envy.c b/sys/dev/pci/envy.c index aeb7d115021..5f0617d019d 100644 --- a/sys/dev/pci/envy.c +++ b/sys/dev/pci/envy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: envy.c,v 1.66 2015/08/30 08:52:26 ratchov Exp $ */ +/* $OpenBSD: envy.c,v 1.67 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org> * @@ -98,7 +98,6 @@ int envy_open(void *, int); void envy_close(void *); void *envy_allocm(void *, int, size_t, int, int); void envy_freem(void *, void *, int); -int envy_query_encoding(void *, struct audio_encoding *); int envy_set_params(void *, int, int, struct audio_params *, struct audio_params *); int envy_round_blocksize(void *, int); @@ -180,8 +179,6 @@ struct cfdriver envy_cd = { struct audio_hw_if envy_hw_if = { envy_open, /* open */ envy_close, /* close */ - NULL, /* drain */ - envy_query_encoding, /* query_encoding */ envy_set_params, /* set_params */ envy_round_blocksize, /* round_blocksize */ NULL, /* commit_settings */ @@ -200,11 +197,9 @@ struct audio_hw_if envy_hw_if = { envy_allocm, /* malloc */ envy_freem, /* free */ envy_round_buffersize, /* round_buffersize */ - NULL, /* mappage */ envy_get_props, /* get_props */ envy_trigger_output, /* trigger_output */ - envy_trigger_input, /* trigger_input */ - NULL + envy_trigger_input /* trigger_input */ }; #if NMIDI > 0 @@ -1836,21 +1831,6 @@ envy_freem(void *self, void *addr, int type) } int -envy_query_encoding(void *self, struct audio_encoding *enc) -{ - if (enc->index == 0) { - strlcpy(enc->name, AudioEslinear_le, sizeof(enc->name)); - enc->encoding = AUDIO_ENCODING_SLINEAR_LE; - enc->precision = 24; - enc->bps = 4; - enc->msb = 1; - enc->flags = 0; - return 0; - } - return EINVAL; -} - -int envy_set_params(void *self, int setmode, int usemode, struct audio_params *p, struct audio_params *r) { diff --git a/sys/dev/pci/esa.c b/sys/dev/pci/esa.c index 0dc5db2bbed..5fa77a88a98 100644 --- a/sys/dev/pci/esa.c +++ b/sys/dev/pci/esa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: esa.c,v 1.29 2015/05/11 06:46:22 ratchov Exp $ */ +/* $OpenBSD: esa.c,v 1.30 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: esa.c,v 1.12 2002/03/24 14:17:35 jmcneill Exp $ */ /* @@ -105,10 +105,8 @@ int esa_activate(struct device *, int); /* audio(9) functions */ int esa_open(void *, int); void esa_close(void *); -int esa_query_encoding(void *, struct audio_encoding *); int esa_set_params(void *, int, int, struct audio_params *, struct audio_params *); -void esa_get_default_params(void *, int, struct audio_params *); int esa_round_blocksize(void *, int); int esa_commit_settings(void *); int esa_halt_output(void *); @@ -132,7 +130,6 @@ int esa_intr(void *); int esa_allocmem(struct esa_softc *, size_t, size_t, struct esa_dma *); int esa_freemem(struct esa_softc *, struct esa_dma *); -paddr_t esa_mappage(void *addr, void *mem, off_t off, int prot); /* Supporting subroutines */ u_int16_t esa_read_assp(struct esa_softc *, u_int16_t, u_int16_t); @@ -162,18 +159,9 @@ void esa_remove_list(struct esa_voice *, struct esa_list *, int); int esa_suspend(struct esa_softc *); int esa_resume(struct esa_softc *); -static audio_encoding_t esa_encoding[] = { - { 0, AudioEulinear, AUDIO_ENCODING_ULINEAR, 8, 1, 1, 0 }, - { 1, AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16, 2, 1, 0 } -}; - -#define ESA_NENCODINGS 8 - struct audio_hw_if esa_hw_if = { esa_open, esa_close, - NULL, /* drain */ - esa_query_encoding, esa_set_params, esa_round_blocksize, esa_commit_settings, @@ -192,11 +180,9 @@ struct audio_hw_if esa_hw_if = { esa_malloc, esa_free, esa_round_buffersize, - esa_mappage, esa_get_props, esa_trigger_output, - esa_trigger_input, - esa_get_default_params + esa_trigger_input }; struct cfdriver esa_cd = { @@ -227,23 +213,6 @@ esa_close(void *hdl) } int -esa_query_encoding(void *hdl, struct audio_encoding *ae) -{ - - if (ae->index < 0 || ae->index >= ESA_NENCODINGS) - return (EINVAL); - *ae = esa_encoding[ae->index]; - - return (0); -} - -void -esa_get_default_params(void *addr, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - -int esa_set_params(void *hdl, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) { @@ -1653,20 +1622,3 @@ esa_get_pointer(struct esa_softc *sc, struct esa_channel *ch) addr = lo | ((u_int32_t)hi << 16); return (addr - ch->start); } - -paddr_t -esa_mappage(void *addr, void *mem, off_t off, int prot) -{ - struct esa_voice *vc = addr; - struct esa_softc *sc = (struct esa_softc *)vc->parent; - struct esa_dma *p; - - if (off < 0) - return (-1); - for (p = vc->dma; p && KERNADDR(p) != mem; p = p->next) - ; - if (!p) - return (-1); - return (bus_dmamem_mmap(sc->sc_dmat, p->segs, p->nsegs, - off, prot, BUS_DMA_WAITOK)); -} diff --git a/sys/dev/pci/eso.c b/sys/dev/pci/eso.c index 28fc27c3d2c..6ee8f1fc1a9 100644 --- a/sys/dev/pci/eso.c +++ b/sys/dev/pci/eso.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eso.c,v 1.41 2016/01/14 00:07:32 jsg Exp $ */ +/* $OpenBSD: eso.c,v 1.42 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: eso.c,v 1.48 2006/12/18 23:13:39 kleink Exp $ */ /* @@ -105,10 +105,8 @@ int eso_intr(void *); /* MI audio layer interface */ int eso_open(void *, int); void eso_close(void *); -int eso_query_encoding(void *, struct audio_encoding *); int eso_set_params(void *, int, int, struct audio_params *, struct audio_params *); -void eso_get_default_params(void *, int, struct audio_params *); int eso_round_blocksize(void *, int); int eso_halt_output(void *); int eso_halt_input(void *); @@ -119,7 +117,6 @@ int eso_query_devinfo(void *, mixer_devinfo_t *); void * eso_allocm(void *, int, size_t, int, int); void eso_freem(void *, void *, int); size_t eso_round_buffersize(void *, int, size_t); -paddr_t eso_mappage(void *, void *, off_t, int); int eso_get_props(void *); int eso_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); @@ -130,8 +127,6 @@ void eso_setup(struct eso_softc *, int, int); struct audio_hw_if eso_hw_if = { eso_open, eso_close, - NULL, /* drain */ - eso_query_encoding, eso_set_params, eso_round_blocksize, NULL, /* commit_settings */ @@ -150,11 +145,9 @@ struct audio_hw_if eso_hw_if = { eso_allocm, eso_freem, eso_round_buffersize, - eso_mappage, eso_get_props, eso_trigger_output, - eso_trigger_input, - eso_get_default_params + eso_trigger_input }; const char * const eso_rev2model[] = { @@ -659,54 +652,6 @@ eso_close(void *hdl) } int -eso_query_encoding(void *hdl, struct audio_encoding *fp) -{ - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 2: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 3: - strlcpy(fp->name, AudioEulinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return (EINVAL); - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (0); -} - -void -eso_get_default_params(void *addr, int mode, struct audio_params *params) -{ - params->sample_rate = 48000; - params->encoding = AUDIO_ENCODING_ULINEAR_LE; - params->precision = 16; - params->bps = 2; - params->msb = 1; - params->channels = 2; -} - -int eso_set_params(void *hdl, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) { @@ -1642,24 +1587,6 @@ eso_round_buffersize(void *hdl, int direction, size_t bufsize) return (bufsize); } -paddr_t -eso_mappage(void *hdl, void *addr, off_t offs, int prot) -{ - struct eso_softc *sc = hdl; - struct eso_dma *ed; - - if (offs < 0) - return (-1); - for (ed = sc->sc_dmas; ed != NULL && KVADDR(ed) != addr; - ed = ed->ed_next) - ; - if (ed == NULL) - return (-1); - - return (bus_dmamem_mmap(ed->ed_dmat, ed->ed_segs, ed->ed_nsegs, - offs, prot, BUS_DMA_WAITOK)); -} - /* ARGSUSED */ int eso_get_props(void *hdl) diff --git a/sys/dev/pci/fms.c b/sys/dev/pci/fms.c index 58cef866471..c99f840720a 100644 --- a/sys/dev/pci/fms.c +++ b/sys/dev/pci/fms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fms.c,v 1.27 2015/05/11 06:46:22 ratchov Exp $ */ +/* $OpenBSD: fms.c,v 1.28 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: fms.c,v 1.5.4.1 2000/06/30 16:27:50 simonb Exp $ */ /*- @@ -75,10 +75,8 @@ int fms_intr(void *); int fms_open(void *, int); void fms_close(void *); -int fms_query_encoding(void *, struct audio_encoding *); int fms_set_params(void *, int, int, struct audio_params *, struct audio_params *); -void fms_get_default_params(void *, int, struct audio_params *); int fms_round_blocksize(void *, int); int fms_halt_output(void *); int fms_halt_input(void *); @@ -88,7 +86,6 @@ int fms_get_port(void *, mixer_ctrl_t *); int fms_query_devinfo(void *, mixer_devinfo_t *); void *fms_malloc(void *, int, size_t, int, int); void fms_free(void *, void *, int); -paddr_t fms_mappage(void *, void *, off_t, int); int fms_get_props(void *); int fms_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); @@ -113,8 +110,6 @@ struct audio_device fms_device = { struct audio_hw_if fms_hw_if = { fms_open, fms_close, - NULL, - fms_query_encoding, fms_set_params, fms_round_blocksize, NULL, @@ -133,11 +128,9 @@ struct audio_hw_if fms_hw_if = { fms_malloc, fms_free, NULL, - fms_mappage, fms_get_props, fms_trigger_output, - fms_trigger_input, - fms_get_default_params + fms_trigger_input }; int fms_attach_codec(void *, struct ac97_codec_if *); @@ -430,38 +423,6 @@ fms_close(void *addr) /* UNUSED struct fms_softc *sc = addr;*/ } -int -fms_query_encoding(void *addr, struct audio_encoding *fp) -{ - - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - default: - return EINVAL; - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return 0; -} - -void -fms_get_default_params(void *addr, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - /* * Range below -limit- is set to -rate- * What a pity FM801 does not have 24000 @@ -687,24 +648,6 @@ fms_free(void *addr, void *ptr, int pool) panic("fms_free: trying to free unallocated memory"); } -paddr_t -fms_mappage(void *addr, void *mem, off_t off, int prot) -{ - struct fms_softc *sc = addr; - struct fms_dma *p; - - if (off < 0) - return -1; - - for (p = sc->sc_dmas; p && p->addr != mem; p = p->next) - ; - if (!p) - return -1; - - return bus_dmamem_mmap(sc->sc_dmat, &p->seg, 1, off, prot, - BUS_DMA_WAITOK); -} - int fms_get_props(void *addr) { diff --git a/sys/dev/pci/maestro.c b/sys/dev/pci/maestro.c index e2247374ae1..02e601fe254 100644 --- a/sys/dev/pci/maestro.c +++ b/sys/dev/pci/maestro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: maestro.c,v 1.40 2016/05/13 19:51:39 ratchov Exp $ */ +/* $OpenBSD: maestro.c,v 1.41 2016/09/14 06:12:19 ratchov Exp $ */ /* $FreeBSD: /c/ncvs/src/sys/dev/sound/pci/maestro.c,v 1.3 2000/11/21 12:22:11 julian Exp $ */ /* * FreeBSD's ESS Agogo/Maestro driver @@ -467,10 +467,8 @@ int maestro_intr(void *); int maestro_open(void *, int); void maestro_close(void *); -int maestro_query_encoding(void *, struct audio_encoding *); int maestro_set_params(void *, int, int, struct audio_params *, struct audio_params *); -void maestro_get_default_params(void *, int, struct audio_params *); int maestro_round_blocksize(void *, int); int maestro_halt_output(void *); int maestro_halt_input(void *); @@ -480,7 +478,6 @@ int maestro_get_port(void *, mixer_ctrl_t *); int maestro_query_devinfo(void *, mixer_devinfo_t *); void *maestro_malloc(void *, int, size_t, int, int); void maestro_free(void *, void *, int); -paddr_t maestro_mappage(void *, void *, off_t, int); int maestro_get_props(void *); int maestro_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); @@ -535,8 +532,6 @@ struct cfattach maestro_ca = { struct audio_hw_if maestro_hw_if = { maestro_open, maestro_close, - NULL, - maestro_query_encoding, maestro_set_params, maestro_round_blocksize, NULL, @@ -555,11 +550,9 @@ struct audio_hw_if maestro_hw_if = { maestro_malloc, maestro_free, NULL, - maestro_mappage, maestro_get_props, maestro_trigger_output, - maestro_trigger_input, - maestro_get_default_params + maestro_trigger_input }; struct audio_device maestro_audev = { @@ -862,17 +855,6 @@ maestro_free(void *self, void *ptr, int pool) salloc_free(sc->dmapool, ptr); } -paddr_t -maestro_mappage(void *self, void *mem, off_t off, int prot) -{ - struct maestro_softc *sc = (struct maestro_softc *)self; - - if (off < 0) - return -1; - return bus_dmamem_mmap(sc->dmat, &sc->dmaseg, 1, - off, prot, BUS_DMA_WAITOK); -} - int maestro_get_props(void *self) { @@ -938,27 +920,6 @@ maestro_query_devinfo(void *self, mixer_devinfo_t *cp) return (ENXIO); } -struct audio_encoding maestro_tab[] = { - {0, AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16, 2, 1, 0}, - {1, AudioEslinear, AUDIO_ENCODING_SLINEAR, 8, 1, 1, 0}, - {2, AudioEulinear, AUDIO_ENCODING_ULINEAR, 8, 1, 1, 0} -}; - -int -maestro_query_encoding(void *hdl, struct audio_encoding *fp) -{ - if (fp->index < 0 || fp->index >= lengthof(maestro_tab)) - return (EINVAL); - *fp = maestro_tab[fp->index]; - return (0); -} - -void -maestro_get_default_params(void *addr, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - #define UNUSED __attribute__((unused)) void diff --git a/sys/dev/pci/neo.c b/sys/dev/pci/neo.c index cfd183a26ee..0130c9bfc5f 100644 --- a/sys/dev/pci/neo.c +++ b/sys/dev/pci/neo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neo.c,v 1.30 2015/05/11 06:46:22 ratchov Exp $ */ +/* $OpenBSD: neo.c,v 1.31 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk> @@ -180,9 +180,7 @@ int neo_intr(void *); int neo_open(void *, int); void neo_close(void *); -int neo_query_encoding(void *, struct audio_encoding *); int neo_set_params(void *, int, int, struct audio_params *, struct audio_params *); -void neo_get_default_params(void *, int, struct audio_params *); int neo_round_blocksize(void *, int); int neo_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); @@ -249,8 +247,6 @@ static int samplerates[9] = { struct audio_hw_if neo_hw_if = { neo_open, neo_close, - NULL, - neo_query_encoding, neo_set_params, #if 1 neo_round_blocksize, @@ -273,11 +269,9 @@ struct audio_hw_if neo_hw_if = { neo_malloc, neo_free, neo_round_buffersize, - 0, /* neo_mappage, */ neo_get_props, neo_trigger_output, - neo_trigger_input, - neo_get_default_params + neo_trigger_input }; @@ -748,37 +742,6 @@ neo_close(void *addr) sc->rintr = 0; } -int -neo_query_encoding(void *addr, struct audio_encoding *fp) -{ - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return (EINVAL); - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (0); -} - -void -neo_get_default_params(void *addr, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - /* Todo: don't commit settings to card until we've verified all parameters */ int neo_set_params(void *addr, int setmode, int usemode, diff --git a/sys/dev/pci/sv.c b/sys/dev/pci/sv.c index a7da7cf8b18..8f437896e47 100644 --- a/sys/dev/pci/sv.c +++ b/sys/dev/pci/sv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sv.c,v 1.32 2015/05/11 06:46:22 ratchov Exp $ */ +/* $OpenBSD: sv.c,v 1.33 2016/09/14 06:12:19 ratchov Exp $ */ /* * Copyright (c) 1998 Constantine Paul Sapuntzakis @@ -137,7 +137,6 @@ int sv_freemem(struct sv_softc *, struct sv_dma *); int sv_open(void *, int); void sv_close(void *); -int sv_query_encoding(void *, struct audio_encoding *); int sv_set_params(void *, int, int, struct audio_params *, struct audio_params *); int sv_round_blocksize(void *, int); int sv_dma_init_output(void *, void *, int); @@ -152,7 +151,6 @@ int sv_mixer_get_port(void *, mixer_ctrl_t *); int sv_query_devinfo(void *, mixer_devinfo_t *); void *sv_malloc(void *, int, size_t, int, int); void sv_free(void *, void *, int); -paddr_t sv_mappage(void *, void *, off_t, int); int sv_get_props(void *); void sv_dumpregs(struct sv_softc *sc); @@ -160,8 +158,6 @@ void sv_dumpregs(struct sv_softc *sc); struct audio_hw_if sv_hw_if = { sv_open, sv_close, - NULL, - sv_query_encoding, sv_set_params, sv_round_blocksize, NULL, @@ -180,10 +176,8 @@ struct audio_hw_if sv_hw_if = { sv_malloc, sv_free, NULL, - sv_mappage, sv_get_props, NULL, - NULL, NULL }; @@ -576,31 +570,6 @@ sv_close(void *addr) } int -sv_query_encoding(void *addr, struct audio_encoding *fp) -{ - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return (EINVAL); - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (0); -} - -int sv_set_params(void *addr, int setmode, int usemode, struct audio_params *p, struct audio_params *r) { @@ -1357,20 +1326,6 @@ sv_free(void *addr, void *ptr, int pool) } } -paddr_t -sv_mappage(void *addr, void *mem, off_t off, int prot) -{ - struct sv_softc *sc = addr; - struct sv_dma *p; - - for (p = sc->sc_dmas; p && KERNADDR(p) != mem; p = p->next) - ; - if (!p) - return (-1); - return (bus_dmamem_mmap(sc->sc_dmatag, p->segs, p->nsegs, - off, prot, BUS_DMA_WAITOK)); -} - int sv_get_props(void *addr) { diff --git a/sys/dev/pci/yds.c b/sys/dev/pci/yds.c index 04f763beb3f..db6abf32022 100644 --- a/sys/dev/pci/yds.c +++ b/sys/dev/pci/yds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yds.c,v 1.52 2015/12/11 16:07:02 mpi Exp $ */ +/* $OpenBSD: yds.c,v 1.53 2016/09/14 06:12:19 ratchov Exp $ */ /* $NetBSD: yds.c,v 1.5 2001/05/21 23:55:04 minoura Exp $ */ /* @@ -152,10 +152,8 @@ struct cfdriver yds_cd = { int yds_open(void *, int); void yds_close(void *); -int yds_query_encoding(void *, struct audio_encoding *); int yds_set_params(void *, int, int, struct audio_params *, struct audio_params *); -void yds_get_default_params(void *, int, struct audio_params *); int yds_round_blocksize(void *, int); int yds_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); @@ -169,7 +167,6 @@ int yds_mixer_get_port(void *, mixer_ctrl_t *); void *yds_malloc(void *, int, size_t, int, int); void yds_free(void *, void *, int); size_t yds_round_buffersize(void *, int, size_t); -paddr_t yds_mappage(void *, void *, off_t, int); int yds_get_props(void *); int yds_query_devinfo(void *addr, mixer_devinfo_t *dip); @@ -206,8 +203,6 @@ static void yds_dump_play_slot(struct yds_softc *, int); static struct audio_hw_if yds_hw_if = { yds_open, yds_close, - NULL, - yds_query_encoding, yds_set_params, yds_round_blocksize, NULL, @@ -226,11 +221,9 @@ static struct audio_hw_if yds_hw_if = { yds_malloc, yds_free, yds_round_buffersize, - yds_mappage, yds_get_props, yds_trigger_output, - yds_trigger_input, - yds_get_default_params + yds_trigger_input }; struct audio_device yds_device = { @@ -1094,37 +1087,6 @@ yds_close(void *addr) } int -yds_query_encoding(void *addr, struct audio_encoding *fp) -{ - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - default: - return (EINVAL); - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (0); -} - -void -yds_get_default_params(void *addr, int mode, struct audio_params *params) -{ - ac97_get_default_params(params); -} - -int yds_set_params(void *addr, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) { @@ -1622,21 +1584,6 @@ yds_round_buffersize(void *addr, int direction, size_t size) return (size); } -paddr_t -yds_mappage(void *addr, void *mem, off_t off, int prot) -{ - struct yds_softc *sc = addr; - struct yds_dma *p; - - if (off < 0) - return (-1); - p = yds_find_dma(sc, mem); - if (!p) - return (-1); - return (bus_dmamem_mmap(sc->sc_dmatag, p->segs, p->nsegs, - off, prot, BUS_DMA_WAITOK)); -} - int yds_get_props(void *addr) { diff --git a/sys/dev/sbus/cs4231.c b/sys/dev/sbus/cs4231.c index a5697d497bc..896fc1edf60 100644 --- a/sys/dev/sbus/cs4231.c +++ b/sys/dev/sbus/cs4231.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cs4231.c,v 1.35 2015/05/11 06:52:35 ratchov Exp $ */ +/* $OpenBSD: cs4231.c,v 1.36 2016/09/14 06:12:20 ratchov Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -134,7 +134,6 @@ u_int8_t cs4231_read(struct cs4231_softc *, u_int8_t); /* Audio interface */ int cs4231_open(void *, int); void cs4231_close(void *); -int cs4231_query_encoding(void *, struct audio_encoding *); int cs4231_set_params(void *, int, int, struct audio_params *, struct audio_params *); int cs4231_round_blocksize(void *, int); @@ -156,8 +155,6 @@ int cs4231_trigger_input(void *, void *, void *, int, struct audio_hw_if cs4231_sa_hw_if = { cs4231_open, cs4231_close, - 0, - cs4231_query_encoding, cs4231_set_params, cs4231_round_blocksize, cs4231_commit_settings, @@ -176,11 +173,9 @@ struct audio_hw_if cs4231_sa_hw_if = { cs4231_alloc, cs4231_free, 0, - 0, cs4231_get_props, cs4231_trigger_output, - cs4231_trigger_input, - 0 + cs4231_trigger_input }; struct cfattach audiocs_ca = { @@ -484,69 +479,6 @@ cs4231_close(void *vsc) } int -cs4231_query_encoding(void *vsc, struct audio_encoding *fp) -{ - int err = 0; - - switch (fp->index) { - case 0: - strlcpy(fp->name, AudioEmulaw, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strlcpy(fp->name, AudioEalaw, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = 0; - break; - case 2: - strlcpy(fp->name, AudioEslinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 3: - strlcpy(fp->name, AudioEulinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 4: - strlcpy(fp->name, AudioEslinear_be, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR_BE; - fp->precision = 16; - fp->flags = 0; - break; - case 5: - strlcpy(fp->name, AudioEslinear, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 6: - strlcpy(fp->name, AudioEulinear_le, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 7: - strlcpy(fp->name, AudioEulinear_be, sizeof fp->name); - fp->encoding = AUDIO_ENCODING_ULINEAR_BE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - default: - err = EINVAL; - } - fp->bps = AUDIO_BPS(fp->precision); - fp->msb = 1; - - return (err); -} - -int cs4231_set_params(void *vsc, int setmode, int usemode, struct audio_params *p, struct audio_params *r) { diff --git a/sys/dev/tc/bba.c b/sys/dev/tc/bba.c index a5ab938d179..d0df5e0b3a8 100644 --- a/sys/dev/tc/bba.c +++ b/sys/dev/tc/bba.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bba.c,v 1.5 2015/05/11 06:46:22 ratchov Exp $ */ +/* $OpenBSD: bba.c,v 1.6 2016/09/14 06:12:20 ratchov Exp $ */ /* $NetBSD: bba.c,v 1.38 2011/06/04 01:27:57 tsutsui Exp $ */ /* * Copyright (c) 2011 Miodrag Vallat. @@ -148,7 +148,6 @@ void *bba_allocm(void *, int, size_t, int, int); void bba_freem(void *, void *, int); size_t bba_round_buffersize(void *, int, size_t); int bba_get_props(void *); -paddr_t bba_mappage(void *, void *, off_t, int); int bba_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); int bba_trigger_input(void *, void *, void *, int, @@ -157,8 +156,6 @@ int bba_trigger_input(void *, void *, void *, int, struct audio_hw_if bba_hw_if = { am7930_open, am7930_close, - NULL, - am7930_query_encoding, am7930_set_params, bba_round_blocksize, /* md */ am7930_commit_settings, @@ -177,11 +174,9 @@ struct audio_hw_if bba_hw_if = { bba_allocm, /* md */ bba_freem, /* md */ bba_round_buffersize, /* md */ - bba_mappage, bba_get_props, bba_trigger_output, /* md */ - bba_trigger_input, /* md */ - NULL + bba_trigger_input /* md */ }; static struct audio_device bba_device = { @@ -607,29 +602,6 @@ bba_get_props(void *v) return AUDIO_PROP_MMAP | am7930_get_props(v); } -paddr_t -bba_mappage(void *v, void *mem, off_t offset, int prot) -{ - struct bba_softc *sc = v; - struct bba_mem **mp; - bus_dma_segment_t seg; - - if (offset < 0) - return -1; - - for (mp = &sc->sc_mem_head; *mp && (*mp)->kva != mem; - mp = &(*mp)->next) - continue; - if (*mp == NULL) - return -1; - - seg.ds_addr = (*mp)->addr; - seg.ds_len = (*mp)->size; - - return bus_dmamem_mmap(sc->sc_dmat, &seg, 1, offset, - prot, BUS_DMA_WAITOK); -} - int bba_round_blocksize(void *v, int blk) { diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c index 571d90c02ea..7b6e6b4c5ac 100644 --- a/sys/dev/usb/uaudio.c +++ b/sys/dev/usb/uaudio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uaudio.c,v 1.113 2015/11/27 10:59:32 mpi Exp $ */ +/* $OpenBSD: uaudio.c,v 1.114 2016/09/14 06:12:20 ratchov Exp $ */ /* $NetBSD: uaudio.c,v 1.90 2004/10/29 17:12:53 kent Exp $ */ /* @@ -245,8 +245,6 @@ struct uaudio_softc { #define UA_NOFRAC 0x20 /* don't do sample rate adjustment */ #define HAS_24 0x40 int sc_mode; /* play/record capability */ - struct audio_encoding *sc_encs; - int sc_nencs; struct mixerctl *sc_ctls; /* mixer controls */ int sc_nctls; /* # of mixer controls */ int sc_quirks; @@ -297,8 +295,6 @@ usbd_status uaudio_process_as void uaudio_add_alt(struct uaudio_softc *, const struct as_info *); -void uaudio_create_encodings(struct uaudio_softc *); - const usb_interface_descriptor_t *uaudio_find_iface (const char *, int, int *, int, int); @@ -374,7 +370,6 @@ void uaudio_chan_rintr int uaudio_open(void *, int); void uaudio_close(void *); int uaudio_drain(void *); -int uaudio_query_encoding(void *, struct audio_encoding *); void uaudio_get_minmax_rates (int, const struct as_info *, const struct audio_params *, int, int, int, u_long *, u_long *); @@ -396,13 +391,10 @@ int uaudio_mixer_set_port(void *, mixer_ctrl_t *); int uaudio_mixer_get_port(void *, mixer_ctrl_t *); int uaudio_query_devinfo(void *, mixer_devinfo_t *); int uaudio_get_props(void *); -void uaudio_get_default_params(void *, int, struct audio_params *); struct audio_hw_if uaudio_hw_if = { uaudio_open, uaudio_close, - uaudio_drain, - uaudio_query_encoding, uaudio_set_params, uaudio_round_blocksize, NULL, @@ -421,11 +413,9 @@ struct audio_hw_if uaudio_hw_if = { NULL, NULL, NULL, - NULL, uaudio_get_props, uaudio_trigger_output, - uaudio_trigger_input, - uaudio_get_default_params + uaudio_trigger_input }; struct audio_device uaudio_device = { @@ -571,8 +561,6 @@ uaudio_attach(struct device *parent, struct device *self, void *aux) printf(", %d mixer controls\n", sc->sc_nctls); - uaudio_create_encodings(sc); - DPRINTF(("uaudio_attach: doing audio_attach_mi\n")); audio_attach_mi(&uaudio_hw_if, sc, &sc->sc_dev); } @@ -599,25 +587,6 @@ uaudio_detach(struct device *self, int flags) return (rv); } -int -uaudio_query_encoding(void *addr, struct audio_encoding *fp) -{ - struct uaudio_softc *sc = addr; - - if (usbd_is_dying(sc->sc_udev)) - return (EIO); - - if (sc->sc_nalts == 0 || sc->sc_altflags == 0) - return (ENXIO); - - if (fp->index < 0 || fp->index >= sc->sc_nencs) - return (EINVAL); - - *fp = sc->sc_encs[fp->index]; - - return (0); -} - const usb_interface_descriptor_t * uaudio_find_iface(const char *buf, int size, int *offsp, int subtype, int flags) { @@ -1544,83 +1513,6 @@ uaudio_add_alt(struct uaudio_softc *sc, const struct as_info *ai) sc->sc_alts[sc->sc_nalts++] = *ai; } -void -uaudio_create_encodings(struct uaudio_softc *sc) -{ - int enc, encs[16], nencs, i, j; - - nencs = 0; - for (i = 0; i < sc->sc_nalts && nencs < 16; i++) { - enc = (sc->sc_alts[i].asf1desc->bSubFrameSize << 16) | - (sc->sc_alts[i].asf1desc->bBitResolution << 8) | - sc->sc_alts[i].encoding; - for (j = 0; j < nencs; j++) { - if (encs[j] == enc) - break; - } - if (j < nencs) - continue; - encs[j] = enc; - nencs++; - } - - sc->sc_nencs = 0; - sc->sc_encs = mallocarray(nencs, sizeof(struct audio_encoding), - M_USBDEV, M_NOWAIT); - if (sc->sc_encs == NULL) { - printf("%s: no memory\n", __func__); - return; - } - sc->sc_nencs = nencs; - - for (i = 0; i < sc->sc_nencs; i++) { - sc->sc_encs[i].index = i; - sc->sc_encs[i].encoding = encs[i] & 0xff; - sc->sc_encs[i].precision = (encs[i] >> 8) & 0xff; - sc->sc_encs[i].bps = (encs[i] >> 16) & 0xff; - sc->sc_encs[i].msb = 1; - sc->sc_encs[i].flags = 0; - switch (sc->sc_encs[i].encoding) { - case AUDIO_ENCODING_SLINEAR_LE: - strlcpy(sc->sc_encs[i].name, - sc->sc_encs[i].precision == 8 ? - AudioEslinear : AudioEslinear_le, - sizeof(sc->sc_encs[i].name)); - break; - case AUDIO_ENCODING_ULINEAR_LE: - if (sc->sc_encs[i].precision != 8) { - DPRINTF(("%s: invalid precision for ulinear: %d\n", - __func__, sc->sc_encs[i].precision)); - continue; - } - strlcpy(sc->sc_encs[i].name, AudioEulinear, - sizeof(sc->sc_encs[i].name)); - break; - case AUDIO_ENCODING_ALAW: - if (sc->sc_encs[i].precision != 8) { - DPRINTF(("%s: invalid precision for alaw: %d\n", - __func__, sc->sc_encs[i].precision)); - continue; - } - strlcpy(sc->sc_encs[i].name, AudioEalaw, - sizeof(sc->sc_encs[i].name)); - break; - case AUDIO_ENCODING_ULAW: - if (sc->sc_encs[i].precision != 8) { - DPRINTF(("%s: invalid precision for ulaw: %d\n", - __func__, sc->sc_encs[i].precision)); - continue; - } - strlcpy(sc->sc_encs[i].name, AudioEmulaw, - sizeof(sc->sc_encs[i].name)); - break; - default: - DPRINTF(("%s: unknown format\n", __func__)); - break; - } - } -} - usbd_status uaudio_process_as(struct uaudio_softc *sc, const char *buf, int *offsp, int size, const usb_interface_descriptor_t *id) @@ -2343,48 +2235,6 @@ uaudio_get_props(void *addr) return props; } -void -uaudio_get_default_params(void *addr, int mode, struct audio_params *p) -{ - struct uaudio_softc *sc = addr; - int flags, alt; - - /* try aucat(1) defaults: 44100 Hz stereo s16le */ - p->sample_rate = 44100; - p->encoding = AUDIO_ENCODING_SLINEAR_LE; - p->precision = 16; - p->bps = 2; - p->msb = 1; - p->channels = 2; - - /* If the device doesn't support the current mode, there's no - * need to find better parameters. - */ - if (!(sc->sc_mode & mode)) - return; - - flags = sc->sc_altflags; - if (flags & HAS_16) - ; - else if (flags & HAS_24) - p->precision = 24; - else { - p->precision = 8; - if (flags & HAS_8) - ; - else if (flags & HAS_8U) - p->encoding = AUDIO_ENCODING_ULINEAR_LE; - else if (flags & HAS_MULAW) - p->encoding = AUDIO_ENCODING_ULAW; - else if (flags & HAS_ALAW) - p->encoding = AUDIO_ENCODING_ALAW; - } - - alt = uaudio_match_alt(sc, p, mode); - if (alt != -1) - p->bps = sc->sc_alts[alt].asf1desc->bSubFrameSize; -} - int uaudio_get(struct uaudio_softc *sc, int which, int type, int wValue, int wIndex, int len) diff --git a/sys/dev/usb/utvfu.c b/sys/dev/usb/utvfu.c index 102774056b2..dbf36fdd5fa 100644 --- a/sys/dev/usb/utvfu.c +++ b/sys/dev/usb/utvfu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utvfu.c,v 1.7 2016/06/17 07:59:16 mglocker Exp $ */ +/* $OpenBSD: utvfu.c,v 1.8 2016/09/14 06:12:20 ratchov Exp $ */ /* * Copyright (c) 2013 Lubomir Rintel * Copyright (c) 2013 Federico Simoncelli @@ -772,7 +772,6 @@ void utvfu_as_bulk_thread(void *); int utvfu_audio_open(void *, int); void utvfu_audio_close(void *); -int utvfu_audio_query_encoding(void *, struct audio_encoding *); int utvfu_audio_set_params(void *, int, int, struct audio_params *, struct audio_params *); int utvfu_audio_halt_out(void *); @@ -786,8 +785,6 @@ int utvfu_audio_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); int utvfu_audio_trigger_input(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *); -void utvfu_audio_get_default_params(void *, int, - struct audio_params *); struct cfdriver utvfu_cd = { NULL, "utvfu", DV_DULL @@ -840,8 +837,6 @@ struct audio_device utvfu_audio_device = { struct audio_hw_if utvfu_au_hw_if = { utvfu_audio_open, /* open hardware */ utvfu_audio_close, /* close hardware */ - NULL, /* Optional: drain buffers */ - utvfu_audio_query_encoding, utvfu_audio_set_params, NULL, NULL, @@ -860,11 +855,9 @@ struct audio_hw_if utvfu_au_hw_if = { NULL, NULL, NULL, - NULL, utvfu_audio_get_props, utvfu_audio_trigger_output, - utvfu_audio_trigger_input, - utvfu_audio_get_default_params + utvfu_audio_trigger_input }; int @@ -1884,29 +1877,6 @@ utvfu_audio_close(void *v) } int -utvfu_audio_query_encoding(void *v, struct audio_encoding *p) -{ - struct utvfu_softc *sc = v; - - if (usbd_is_dying(sc->sc_udev)) - return (EIO); - - DPRINTF(1, "%s %s\n", DEVNAME(sc), __func__); - - if (p->index != 0) - return (EINVAL); - - strlcpy(p->name, AudioEslinear_le, sizeof(p->name)); - p->encoding = AUDIO_ENCODING_SLINEAR_LE; - p->precision = 16; - p->bps = 2; - p->msb = 1; - p->flags = 0; - - return (0); -} - -int utvfu_audio_set_params(void *v, int setmode, int usemode, struct audio_params *play, struct audio_params *rec) { @@ -2034,22 +2004,6 @@ utvfu_audio_get_props(void *v) return (0); } -void -utvfu_audio_get_default_params(void *v, int mode, struct audio_params *p) -{ - if (mode != AUMODE_RECORD) - return; - - DPRINTF(1, "%s %s\n", DEVNAME((struct utvfu_softc *)v), __func__); - - p->sample_rate = 48000; - p->encoding = AUDIO_ENCODING_SLINEAR_LE; - p->precision = 16; - p->bps = 2; - p->msb = 1; - p->channels = 2; -} - int utvfu_audio_trigger_output(void *v, void *start, void *end, int blksize, void (*intr)(void *), void *arg, struct audio_params *param) diff --git a/sys/sys/audioio.h b/sys/sys/audioio.h index 1d9aee36a1c..62a98e832e0 100644 --- a/sys/sys/audioio.h +++ b/sys/sys/audioio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: audioio.h,v 1.26 2016/08/31 07:22:43 ratchov Exp $ */ +/* $OpenBSD: audioio.h,v 1.27 2016/09/14 06:12:20 ratchov Exp $ */ /* $NetBSD: audioio.h,v 1.24 1998/08/13 06:28:41 mrg Exp $ */ /* @@ -222,22 +222,6 @@ typedef struct mixer_ctrl { #define AudioNlfe "lfe" #define AudioNextamp "extamp" -#define AudioEmulaw "mulaw" -#define AudioEalaw "alaw" -#define AudioEadpcm "adpcm" -#define AudioEslinear "slinear" -#define AudioEslinear_le "slinear_le" -#define AudioEslinear_be "slinear_be" -#define AudioEulinear "ulinear" -#define AudioEulinear_le "ulinear_le" -#define AudioEulinear_be "ulinear_be" -#define AudioEmpeg_l1_stream "mpeg_l1_stream" -#define AudioEmpeg_l1_packets "mpeg_l1_packets" -#define AudioEmpeg_l1_system "mpeg_l1_system" -#define AudioEmpeg_l2_stream "mpeg_l2_stream" -#define AudioEmpeg_l2_packets "mpeg_l2_packets" -#define AudioEmpeg_l2_system "mpeg_l2_system" - #define AudioCinputs "inputs" #define AudioCoutputs "outputs" #define AudioCrecord "record" |