CVS commit: [isaki-audio2] src/sys/dev/isa
Module Name:src Committed By: isaki Date: Sun May 5 01:57:06 UTC 2019 Modified Files: src/sys/dev/isa [isaki-audio2]: sbdsp.c Log Message: Fix typos (made in this branch). To generate a diff of this commit: cvs rdiff -u -r1.139.2.3 -r1.139.2.4 src/sys/dev/isa/sbdsp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/isa/sbdsp.c diff -u src/sys/dev/isa/sbdsp.c:1.139.2.3 src/sys/dev/isa/sbdsp.c:1.139.2.4 --- src/sys/dev/isa/sbdsp.c:1.139.2.3 Sat May 4 07:20:10 2019 +++ src/sys/dev/isa/sbdsp.c Sun May 5 01:57:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sbdsp.c,v 1.139.2.3 2019/05/04 07:20:10 isaki Exp $ */ +/* $NetBSD: sbdsp.c,v 1.139.2.4 2019/05/05 01:57:06 isaki Exp $ */ /*- * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.139.2.3 2019/05/04 07:20:10 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.139.2.4 2019/05/05 01:57:06 isaki Exp $"); #include "midi.h" #include "mpu.h" @@ -462,7 +462,7 @@ sbdsp_attach(struct sbdsp_softc *sc) } } - /* Construct sc_format from model */ + /* Construct sc_formats from model */ sbdsp_init_format(sc); if (sc->sc_nformats == 0) { aprint_error_dev(sc->sc_dev, @@ -597,7 +597,7 @@ sbdsp_init_format(struct sbdsp_softc *sc idx = (m->precision / 16) * 2 + (m->channels - 1); d = &dbase[idx]; if (d->mode == 0) { -/* The first elements of this room */ +/* The first element of this room */ *d = tmp; continue; }
CVS commit: [isaki-audio2] src/sys/dev/isa
Module Name:src Committed By: isaki Date: Fri May 3 03:00:33 UTC 2019 Modified Files: src/sys/dev/isa [isaki-audio2]: pas.c sb.c sbdsp.c sbdspvar.h Log Message: Adapt sbdsp to audio2. - Use new query_format/set_format interfaces. The formats are created from sb[pr]modes tables. - Drop INDEPENDENT property for models proir to SB_16. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.71.2.1 src/sys/dev/isa/pas.c cvs rdiff -u -r1.90 -r1.90.2.1 src/sys/dev/isa/sb.c cvs rdiff -u -r1.139.2.1 -r1.139.2.2 src/sys/dev/isa/sbdsp.c cvs rdiff -u -r1.61 -r1.61.54.1 src/sys/dev/isa/sbdspvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/isa/pas.c diff -u src/sys/dev/isa/pas.c:1.71 src/sys/dev/isa/pas.c:1.71.2.1 --- src/sys/dev/isa/pas.c:1.71 Sat Mar 16 12:09:58 2019 +++ src/sys/dev/isa/pas.c Fri May 3 03:00:33 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pas.c,v 1.71 2019/03/16 12:09:58 isaki Exp $ */ +/* $NetBSD: pas.c,v 1.71.2.1 2019/05/03 03:00:33 isaki Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -57,7 +57,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pas.c,v 1.71 2019/03/16 12:09:58 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pas.c,v 1.71.2.1 2019/05/03 03:00:33 isaki Exp $"); #include #include @@ -125,8 +125,8 @@ void pasconf(int, int, int, int); const struct audio_hw_if pas_hw_if = { .open = sbdsp_open, .close = sbdsp_close, - .query_encoding = sbdsp_query_encoding, - .set_params = sbdsp_set_params, + .query_format = sbdsp_query_format, + .set_format = sbdsp_set_format, .round_blocksize = sbdsp_round_blocksize, .halt_output = sbdsp_halt_output, .halt_input = sbdsp_halt_input, @@ -138,7 +138,6 @@ const struct audio_hw_if pas_hw_if = { .allocm = sb_malloc, .freem = sb_free, .round_buffersize = sb_round_buffersize, - .mappage = sb_mappage, .get_props = sbdsp_get_props, .trigger_output = sbdsp_trigger_output, .trigger_input = sbdsp_trigger_input, Index: src/sys/dev/isa/sb.c diff -u src/sys/dev/isa/sb.c:1.90 src/sys/dev/isa/sb.c:1.90.2.1 --- src/sys/dev/isa/sb.c:1.90 Sat Mar 16 12:09:58 2019 +++ src/sys/dev/isa/sb.c Fri May 3 03:00:33 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sb.c,v 1.90 2019/03/16 12:09:58 isaki Exp $ */ +/* $NetBSD: sb.c,v 1.90.2.1 2019/05/03 03:00:33 isaki Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sb.c,v 1.90 2019/03/16 12:09:58 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sb.c,v 1.90.2.1 2019/05/03 03:00:33 isaki Exp $"); #include "midi.h" @@ -82,8 +82,8 @@ int sb_getdev(void *, struct audio_devic const struct audio_hw_if sb_hw_if = { .open = sbdsp_open, .close = sbdsp_close, - .query_encoding = sbdsp_query_encoding, - .set_params = sbdsp_set_params, + .query_format = sbdsp_query_format, + .set_format = sbdsp_set_format, .round_blocksize = sbdsp_round_blocksize, .halt_output = sbdsp_halt_output, .halt_input = sbdsp_halt_input, @@ -95,7 +95,6 @@ const struct audio_hw_if sb_hw_if = { .allocm = sb_malloc, .freem = sb_free, .round_buffersize = sb_round_buffersize, - .mappage = sb_mappage, .get_props = sbdsp_get_props, .trigger_output = sbdsp_trigger_output, .trigger_input = sbdsp_trigger_input, Index: src/sys/dev/isa/sbdsp.c diff -u src/sys/dev/isa/sbdsp.c:1.139.2.1 src/sys/dev/isa/sbdsp.c:1.139.2.2 --- src/sys/dev/isa/sbdsp.c:1.139.2.1 Sun Apr 21 06:17:02 2019 +++ src/sys/dev/isa/sbdsp.c Fri May 3 03:00:33 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sbdsp.c,v 1.139.2.1 2019/04/21 06:17:02 isaki Exp $ */ +/* $NetBSD: sbdsp.c,v 1.139.2.2 2019/05/03 03:00:33 isaki Exp $ */ /*- * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.139.2.1 2019/04/21 06:17:02 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.139.2.2 2019/05/03 03:00:33 isaki Exp $"); #include "midi.h" #include "mpu.h" @@ -95,6 +95,7 @@ __KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1. #include #include +#include #include #include @@ -206,8 +207,34 @@ static struct sbmode sbrmodes[] = { { .model = -1 } }; +/* + * We actually can specify any value within the frequency range defined + * above. But according to definition of SB_RATE_TO_TC macro, only some + * of them are dividable (it's preferable, not mandatory). There are 9 + * values in the range that satisfy this condition but it's too much. + */ +static const int sbdsp_rates[] = { + 4000, + /* 5000, */ + /* 6250, */ + /* 1, */ + 12500, + /* 15625, */ + 2, + /* 25000, */ + 31250, +}; + void sbversion(struct sbdsp_softc *); void sbdsp_jazz16_probe(struct sbdsp_softc *); +void sbdsp_sbmode2format(struct audio_format *, const struct sbmode *, int); +int sbdsp_set_format16(struct sbdsp_softc *, int, + const audio_params_
CVS commit: [isaki-audio2] src/sys/dev/isa
Module Name:src Committed By: isaki Date: Thu Apr 25 14:00:20 UTC 2019 Modified Files: src/sys/dev/isa [isaki-audio2]: ess.c Log Message: Adapt to audio2. - Drop INDEPENDENT property. Both play and rec share the sample rate. To generate a diff of this commit: cvs rdiff -u -r1.84.2.1 -r1.84.2.2 src/sys/dev/isa/ess.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/isa/ess.c diff -u src/sys/dev/isa/ess.c:1.84.2.1 src/sys/dev/isa/ess.c:1.84.2.2 --- src/sys/dev/isa/ess.c:1.84.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/isa/ess.c Thu Apr 25 14:00:20 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ess.c,v 1.84.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: ess.c,v 1.84.2.2 2019/04/25 14:00:20 isaki Exp $ */ /* * Copyright 1997 @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ess.c,v 1.84.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ess.c,v 1.84.2.2 2019/04/25 14:00:20 isaki Exp $"); #include #include @@ -83,8 +83,6 @@ __KERNEL_RCSID(0, "$NetBSD: ess.c,v 1.84 #include #include -#include -#include #include #include @@ -115,15 +113,14 @@ unsigned uuu; int ess_setup_sc(struct ess_softc *, int); -int ess_open(void *, int); void ess_close(void *); int ess_getdev(void *, struct audio_device *); -int ess_drain(void *); -int ess_query_encoding(void *, struct audio_encoding *); +int ess_query_format(void *, audio_format_query_t *); -int ess_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, stream_filter_list_t *); +int ess_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); int ess_round_blocksize(void *, int, int, const audio_params_t *); @@ -215,11 +212,9 @@ struct audio_device ess_device = { */ const struct audio_hw_if ess_1788_hw_if = { - .open = ess_open, .close = ess_close, - .drain = ess_drain, - .query_encoding = ess_query_encoding, - .set_params = ess_set_params, + .query_format = ess_query_format, + .set_format = ess_set_format, .round_blocksize = ess_round_blocksize, .halt_output = ess_audio1_halt, .halt_input = ess_audio1_halt, @@ -231,7 +226,6 @@ const struct audio_hw_if ess_1788_hw_if .allocm = ess_malloc, .freem = ess_free, .round_buffersize = ess_round_buffersize, - .mappage = ess_mappage, .get_props = ess_1788_get_props, .trigger_output = ess_audio1_trigger_output, .trigger_input = ess_audio1_trigger_input, @@ -239,11 +233,9 @@ const struct audio_hw_if ess_1788_hw_if }; const struct audio_hw_if ess_1888_hw_if = { - .open = ess_open, .close = ess_close, - .drain = ess_drain, - .query_encoding = ess_query_encoding, - .set_params = ess_set_params, + .query_format = ess_query_format, + .set_format = ess_set_format, .round_blocksize = ess_round_blocksize, .halt_output = ess_audio2_halt, .halt_input = ess_audio1_halt, @@ -255,35 +247,25 @@ const struct audio_hw_if ess_1888_hw_if .allocm = ess_malloc, .freem = ess_free, .round_buffersize = ess_round_buffersize, - .mappage = ess_mappage, .get_props = ess_1888_get_props, .trigger_output = ess_audio2_trigger_output, .trigger_input = ess_audio1_trigger_input, .get_locks = ess_get_locks, }; -#define ESS_NFORMATS 8 -#define ESS_FORMAT(enc, prec, ch, chmask) \ - { \ - .mode = AUMODE_PLAY | AUMODE_RECORD, \ - .encoding = (enc), \ - .validbits = (prec), \ - .precision = (prec), \ - .channels = (ch), \ - .channel_mask = (chmask), \ - .frequency_type = 0, \ - .frequency = { ESS_MINRATE, ESS_MAXRATE }, \ - } -static const struct audio_format ess_formats[ESS_NFORMATS] = { - ESS_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 2, AUFMT_STEREO), - ESS_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 1, AUFMT_STEREO), - ESS_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 16, 2, AUFMT_STEREO), - ESS_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 16, 1, AUFMT_STEREO), - ESS_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 2, AUFMT_STEREO), - ESS_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 1, AUFMT_STEREO), - ESS_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 8, 2, AUFMT_STEREO), - ESS_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 8, 1, AUFMT_STEREO), +static const struct audio_format ess_formats[] = { + { + .mode = AUMODE_PLAY | AUMODE_RECORD, + .encoding = AUDIO_ENCODING_SLINEAR_LE, + .validbits = 16, + .precision = 16, + .channels = 2, + .channel_mask = AUFMT_STEREO, + .frequency_type = 0, + .frequency = { ESS_MINRATE, ESS_MAXRATE }, + }, }; +#define ESS_NFORMATS __arraycount(ess_formats) #ifdef AUDIO_DEBUG void ess_printsc(struct ess_softc *); @@ -1097,13 +1079,6 @@ skip: * Various routines to interface to higher level audio driver */ -int -ess_open(void *addr, int flags) -{ - - return 0; -} - void ess_close(void *addr) { @@ -1118,27 +1093,6 @@ ess_close(void *addr) DPRINTF(("ess_close: closed\n")); } -/* - * Wait f
CVS commit: [isaki-audio2] src/sys/dev/isa
Module Name:src Committed By: isaki Date: Sun Apr 21 06:17:03 UTC 2019 Modified Files: src/sys/dev/isa [isaki-audio2]: sbdsp.c Log Message: Not yet fully adapted to audio2 but make it compilable. - Drop FULLDUPLEX property. It is done in a tricky way. To generate a diff of this commit: cvs rdiff -u -r1.139 -r1.139.2.1 src/sys/dev/isa/sbdsp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/isa/sbdsp.c diff -u src/sys/dev/isa/sbdsp.c:1.139 src/sys/dev/isa/sbdsp.c:1.139.2.1 --- src/sys/dev/isa/sbdsp.c:1.139 Sun Feb 3 03:19:27 2019 +++ src/sys/dev/isa/sbdsp.c Sun Apr 21 06:17:02 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sbdsp.c,v 1.139 2019/02/03 03:19:27 mrg Exp $ */ +/* $NetBSD: sbdsp.c,v 1.139.2.1 2019/04/21 06:17:02 isaki Exp $ */ /*- * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.139 2019/02/03 03:19:27 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.139.2.1 2019/04/21 06:17:02 isaki Exp $"); #include "midi.h" #include "mpu.h" @@ -96,8 +96,6 @@ __KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1. #include #include #include -#include -#include #include #include @@ -412,9 +410,8 @@ sbdsp_attach(struct sbdsp_softc *sc) SBVER_MAJOR(sc->sc_version), SBVER_MINOR(sc->sc_version), sc->sc_model == SB_JAZZ ? ": " : ""); - sc->sc_fullduplex = ISSB16CLASS(sc) && - sc->sc_drq8 != -1 && sc->sc_drq16 != -1 && - sc->sc_drq8 != sc->sc_drq16; + /* XXX It's not true full duplex. */ + sc->sc_fullduplex = 0; if (sc->sc_drq8 != -1) { sc->sc_drq8_maxsize = isa_dmamaxsize(sc->sc_ic, @@ -574,12 +571,10 @@ sbdsp_set_params( struct sbdsp_softc *sc; struct sbmode *m; u_int rate, tc, bmode; - stream_filter_factory_t *swcode; int model; int chan; struct audio_params *p; - audio_params_t hw; - stream_filter_list_t *fil; + audio_params_t hw __unused; int mode; sc = addr; @@ -627,55 +622,17 @@ sbdsp_set_params( if (m->model == -1) return EINVAL; rate = p->sample_rate; - swcode = NULL; - fil = mode == AUMODE_PLAY ? pfil : rfil; hw = *p; tc = 1; bmode = -1; if (model == SB_16) { switch (p->encoding) { - case AUDIO_ENCODING_SLINEAR_BE: -if (p->precision == 16) { - hw.encoding = AUDIO_ENCODING_SLINEAR_LE; - swcode = swap_bytes; -} /* FALLTHROUGH */ case AUDIO_ENCODING_SLINEAR: case AUDIO_ENCODING_SLINEAR_LE: bmode = SB_BMODE_SIGNED; break; - case AUDIO_ENCODING_ULINEAR_BE: -if (p->precision == 16) { - hw.encoding = AUDIO_ENCODING_ULINEAR_LE; - swcode = swap_bytes; -} -/* FALLTHROUGH */ - case AUDIO_ENCODING_ULINEAR_LE: -bmode = SB_BMODE_UNSIGNED; -break; - - case AUDIO_ENCODING_ULAW: -hw.encoding = AUDIO_ENCODING_ULINEAR_LE; -if (mode == AUMODE_PLAY) { - hw.precision = hw.validbits = 16; - swcode = mulaw_to_linear16; - m = &sbpmodes[PLAY16]; -} else - swcode = linear8_to_mulaw; -bmode = SB_BMODE_UNSIGNED; -break; - - case AUDIO_ENCODING_ALAW: -hw.encoding = AUDIO_ENCODING_ULINEAR_LE; -if (mode == AUMODE_PLAY) { - hw.precision = hw.validbits = 16; - swcode = alaw_to_linear16; - m = &sbpmodes[PLAY16]; -} else - swcode = linear8_to_alaw; -bmode = SB_BMODE_UNSIGNED; -break; default: return EINVAL; } @@ -686,28 +643,6 @@ sbdsp_set_params( case AUDIO_ENCODING_SLINEAR: case AUDIO_ENCODING_SLINEAR_LE: break; - case AUDIO_ENCODING_ULINEAR_LE: -hw.encoding = AUDIO_ENCODING_SLINEAR_LE; -swcode = change_sign16; -break; - case AUDIO_ENCODING_SLINEAR_BE: -hw.encoding = AUDIO_ENCODING_SLINEAR_LE; -swcode = swap_bytes; -break; - case AUDIO_ENCODING_ULINEAR_BE: -hw.encoding = AUDIO_ENCODING_SLINEAR_LE; -swcode = swap_bytes_change_sign16; -break; - case AUDIO_ENCODING_ULAW: -hw.encoding = AUDIO_ENCODING_ULINEAR_LE; -swcode = mode == AUMODE_PLAY ? - mulaw_to_linear8 : linear8_to_mulaw; -break; - case AUDIO_ENCODING_ALAW: -hw.encoding = AUDIO_ENCODING_ULINEAR_LE; -swcode = mode == AUMODE_PLAY ? - alaw_to_linear8 : linear8_to_alaw; -break; default: return EINVAL; } @@ -715,32 +650,7 @@ sbdsp_set_params( p->sample_rate = SB_TC_TO_RATE(tc) / p->channels; hw.sample_rate = p->sample_rate; } else { - switch (p->encoding) { - case AUDIO_ENCODING_SLINEAR_BE: - case AUDIO_ENCODING_SLINEAR_LE: - case AUDIO_ENCODING_SLINEAR: -hw.encoding = AUDIO_ENCODING_ULINEAR_LE; -swcode = change_sign8; -break; - case AUDIO_ENCODING_ULINEAR_BE: - case AUDIO_ENCODING_ULINEAR_LE: -break; - case AUDIO_ENCODING_ULAW: -hw.encoding = AUDIO_ENCODING_ULINEAR_LE; -swcode = mode == AUMODE_PLAY ? - mulaw_to_linear8 : linear8_to_mulaw; -break; - case AUDIO_ENCODING_ALAW: -
CVS commit: [isaki-audio2] src/sys/dev/isa
Module Name:src Committed By: isaki Date: Sun Apr 21 06:09:01 UTC 2019 Modified Files: src/sys/dev/isa [isaki-audio2]: aria.c Log Message: Adapt to audio2. - Drop FULLDUPLEX property. The driver doesn't seem to be written as full duplex. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/dev/isa/aria.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/isa/aria.c diff -u src/sys/dev/isa/aria.c:1.39 src/sys/dev/isa/aria.c:1.39.2.1 --- src/sys/dev/isa/aria.c:1.39 Sat Mar 16 12:09:58 2019 +++ src/sys/dev/isa/aria.c Sun Apr 21 06:09:01 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: aria.c,v 1.39 2019/03/16 12:09:58 isaki Exp $ */ +/* $NetBSD: aria.c,v 1.39.2.1 2019/04/21 06:09:01 isaki Exp $ */ /*- * Copyright (c) 1995, 1996, 1998 The NetBSD Foundation, Inc. @@ -36,12 +36,7 @@ * o Look into where aria_prometheus_kludge() belongs. * o Add some DMA code. It accomplishes its goal by * direct IO at the moment. - * o Different programs should be able to open the device - * with O_RDONLY and O_WRONLY at the same time. But I - * do not see support for this in /sys/dev/audio.c, so * I cannot effectively code it. - * o We should nicely deal with the cards that can do mu-law - * and A-law output. * o Rework the mixer interface. * o Deal with the lvls better. We need to do better mapping * between logarithmic scales and the one byte that @@ -50,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: aria.c,v 1.39 2019/03/16 12:09:58 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aria.c,v 1.39.2.1 2019/04/21 06:09:01 isaki Exp $"); #include #include @@ -66,8 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: aria.c,v 1.3 #include #include -#include -#include #include #include @@ -147,12 +140,13 @@ void aria_do_kludge(bus_space_tag_t, bus u_short, u_short, u_short, u_short); void aria_prometheus_kludge(struct isa_attach_args *, bus_space_handle_t); -int aria_query_encoding(void *, struct audio_encoding *); +int aria_query_format(void *, audio_format_query_t *); int aria_round_blocksize(void *, int, int, const audio_params_t *); int aria_speaker_ctl(void *, int); int aria_commit_settings(void *); -int aria_set_params(void *, int, int, audio_params_t *, audio_params_t *, - stream_filter_list_t *, stream_filter_list_t *); +int aria_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); int aria_get_props(void *); void aria_get_locks(void *, kmutex_t **, kmutex_t **); @@ -196,6 +190,24 @@ struct audio_device aria_device = { "aria" }; +#define ARIA_FORMAT(enc, prec) \ + { \ + .mode = AUMODE_PLAY | AUMODE_RECORD, \ + .encoding = (enc), \ + .validbits = (prec), \ + .precision = (prec), \ + .channels = 2, \ + .channel_mask = AUFMT_STEREO, \ + .frequency_type = 6, \ + .frequency = { 7875, 11025, 15750, 22050, 31500, 44100 }, \ + } +/* XXX Some models seem to support mulaw/alaw. */ +const struct audio_format aria_formats[] = { + ARIA_FORMAT(AUDIO_ENCODING_ULINEAR, 8), + ARIA_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16), +}; +#define ARIA_NFORMATS __arraycount(aria_formats) + /* * Define our interface to the higher level audio driver. */ @@ -203,8 +215,8 @@ struct audio_device aria_device = { const struct audio_hw_if aria_hw_if = { .open = ariaopen, .close = ariaclose, - .query_encoding = aria_query_encoding, - .set_params = aria_set_params, + .query_format = aria_query_format, + .set_format = aria_set_format, .round_blocksize = aria_round_blocksize, .commit_settings = aria_commit_settings, .start_output = aria_start_output, @@ -500,68 +512,10 @@ aria_getdev(void *addr, struct audio_dev */ int -aria_query_encoding(void *addr, struct audio_encoding *fp) +aria_query_format(void *addr, audio_format_query_t *afp) { - struct aria_softc *sc; - sc = addr; - switch (fp->index) { - case 0: - strcpy(fp->name, AudioEmulaw); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - if ((ARIA_MODEL&sc->sc_hardware) == 0) -fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 1: - strcpy(fp->name, AudioEalaw); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - if ((ARIA_MODEL&sc->sc_hardware) == 0) -fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 2: - strcpy(fp->name, AudioEslinear); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 3: - strcpy(fp->name, AudioEslinear_le); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 4: - strcpy(fp->name, AudioEslinear_be); - fp->encoding = AUDIO_ENCODING_SLINEAR_BE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 5: - s