CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun May 5 05:59:40 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: cs4280.c cs4280reg.h cs428x.h Log Message: Remove encoding conversions on recording. These are handled in the upper layer now. To generate a diff of this commit: cvs rdiff -u -r1.71.2.2 -r1.71.2.3 src/sys/dev/pci/cs4280.c cvs rdiff -u -r1.7 -r1.7.156.1 src/sys/dev/pci/cs4280reg.h cvs rdiff -u -r1.16.42.1 -r1.16.42.2 src/sys/dev/pci/cs428x.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun May 5 05:59:40 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: cs4280.c cs4280reg.h cs428x.h Log Message: Remove encoding conversions on recording. These are handled in the upper layer now. To generate a diff of this commit: cvs rdiff -u -r1.71.2.2 -r1.71.2.3 src/sys/dev/pci/cs4280.c cvs rdiff -u -r1.7 -r1.7.156.1 src/sys/dev/pci/cs4280reg.h cvs rdiff -u -r1.16.42.1 -r1.16.42.2 src/sys/dev/pci/cs428x.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/pci/cs4280.c diff -u src/sys/dev/pci/cs4280.c:1.71.2.2 src/sys/dev/pci/cs4280.c:1.71.2.3 --- src/sys/dev/pci/cs4280.c:1.71.2.2 Sat May 4 07:20:10 2019 +++ src/sys/dev/pci/cs4280.c Sun May 5 05:59:40 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cs4280.c,v 1.71.2.2 2019/05/04 07:20:10 isaki Exp $ */ +/* $NetBSD: cs4280.c,v 1.71.2.3 2019/05/05 05:59:40 isaki Exp $ */ /* * Copyright (c) 1999, 2000 Tatoku Ogaito. All rights reserved. @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.71.2.2 2019/05/04 07:20:10 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.71.2.3 2019/05/05 05:59:40 isaki Exp $"); #include "midi.h" @@ -450,9 +450,6 @@ cs4280_intr(void *p) } /* Capture Interrupt */ if (intr & HISR_CINT) { - int i; - int16_t rdata; - handled = 1; mem = BA1READ4(sc, CS4280_CIE); BA1WRITE4(sc, CS4280_CIE, (mem & ~CIE_CI_MASK) | CIE_CI_DISABLE); @@ -463,53 +460,9 @@ cs4280_intr(void *p) if ((sc->sc_ri&1) == 0) empty_dma += sc->hw_blocksize; - /* - * XXX - * I think this audio data conversion should be - * happend in upper layer, but I put this here - * since there is no conversion function available. - */ - switch(sc->sc_rparam) { - case CF_16BIT_STEREO: -/* just copy it */ -memcpy(sc->sc_rn, empty_dma, sc->hw_blocksize); -sc->sc_rn += sc->hw_blocksize; -break; - case CF_16BIT_MONO: -for (i = 0; i < 512; i++) { - rdata = *((int16_t *)empty_dma)>>1; - empty_dma += 2; - rdata += *((int16_t *)empty_dma)>>1; - empty_dma += 2; - *((int16_t *)sc->sc_rn) = rdata; - sc->sc_rn += 2; -} -break; - case CF_8BIT_STEREO: -for (i = 0; i < 512; i++) { - rdata = *((int16_t*)empty_dma); - empty_dma += 2; - *sc->sc_rn++ = rdata >> 8; - rdata = *((int16_t*)empty_dma); - empty_dma += 2; - *sc->sc_rn++ = rdata >> 8; -} -break; - case CF_8BIT_MONO: -for (i = 0; i < 512; i++) { - rdata = *((int16_t*)empty_dma) >>1; - empty_dma += 2; - rdata += *((int16_t*)empty_dma) >>1; - empty_dma += 2; - *sc->sc_rn++ = rdata >>8; -} -break; - default: -/* Should not reach here */ -aprint_error_dev(sc->sc_dev, -"unknown sc->sc_rparam: %d\n", -sc->sc_rparam); - } + /* just copy it */ + memcpy(sc->sc_rn, empty_dma, sc->hw_blocksize); + sc->sc_rn += sc->hw_blocksize; if (sc->sc_rn >= sc->sc_re) sc->sc_rn = sc->sc_rs; } @@ -752,17 +705,6 @@ cs4280_trigger_input(void *addr, void *s /* initiate capture DMA */ BA1WRITE4(sc, CS4280_CBA, DMAADDR(p)); - /* setup format information for internal converter */ - sc->sc_rparam = 0; - if (param->precision == 8) { - sc->sc_rparam += CF_8BIT; - sc->sc_rcount <<= 1; - } - if (param->channels == 1) { - sc->sc_rparam += CF_MONO; - sc->sc_rcount <<= 1; - } - /* set CIE */ cie = BA1READ4(sc, CS4280_CIE) & ~CIE_CI_MASK; BA1WRITE4(sc, CS4280_CIE, cie | CIE_CI_ENABLE); Index: src/sys/dev/pci/cs4280reg.h diff -u src/sys/dev/pci/cs4280reg.h:1.7 src/sys/dev/pci/cs4280reg.h:1.7.156.1 --- src/sys/dev/pci/cs4280reg.h:1.7 Sat Apr 15 21:20:47 2006 +++ src/sys/dev/pci/cs4280reg.h Sun May 5 05:59:40 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cs4280reg.h,v 1.7 2006/04/15 21:20:47 jmcneill Exp $ */ +/* $NetBSD: cs4280reg.h,v 1.7.156.1 2019/05/05 05:59:40 isaki Exp $ */ /* * Copyright (c) 1999, 2000 Tatoku Ogaito. All rights reserved. @@ -217,14 +217,6 @@ #define FRMT_FTV 0x0adf -#define CF_MONO 0x01 -#define CF_8BIT 0x02 - -#define CF_16BIT_STEREO 0x00 -#define CF_16BIT_MONO 0x01 -#define CF_8BIT_STEREO 0x02 -#define CF_8BIT_MONO 0x03 - #define MIDI_BUSY_WAIT 100 #define MIDI_BUSY_DELAY 100 /* Delay when UART is busy */ Index: src/sys/dev/pci/cs428x.h diff -u src/sys/dev/pci/cs428x.h:1.16.42.1 src/sys/dev/pci/cs428x.h:1.16.42.2 --- src/sys/dev/pci/cs428x.h:1.16.42.1 Sun Apr 21 07:49:16 2019 +++ src/sys/dev/pci/cs428x.h Sun May 5 05:59:40 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cs428x.h,v 1.16.42.1 2019/04/21 07:49:16 isaki Exp $ */ +/* $NetBSD: cs428x.h,v 1.16.42.2 2019/05/05 05:59:40 isaki Exp $ */ /* * Copyright (c) 2000 Tatoku Ogaito. All rights reserved. @@ -118,7 +118,6 @@ struct cs428x_softc { int sc_ri; struct cs428x_dma *sc_rdma; char *sc_rbuf; - int sc_rparam; /* record format */ int
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun May 5 03:11:28 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: auixpvar.h Log Message: Remove sc_encodings. (I forgot it) To generate a diff of this commit: cvs rdiff -u -r1.8.42.2 -r1.8.42.3 src/sys/dev/pci/auixpvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun May 5 03:11:28 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: auixpvar.h Log Message: Remove sc_encodings. (I forgot it) To generate a diff of this commit: cvs rdiff -u -r1.8.42.2 -r1.8.42.3 src/sys/dev/pci/auixpvar.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/pci/auixpvar.h diff -u src/sys/dev/pci/auixpvar.h:1.8.42.2 src/sys/dev/pci/auixpvar.h:1.8.42.3 --- src/sys/dev/pci/auixpvar.h:1.8.42.2 Sat Apr 27 13:10:03 2019 +++ src/sys/dev/pci/auixpvar.h Sun May 5 03:11:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: auixpvar.h,v 1.8.42.2 2019/04/27 13:10:03 isaki Exp $*/ +/* $NetBSD: auixpvar.h,v 1.8.42.3 2019/05/05 03:11:28 isaki Exp $*/ /* * Copyright (c) 2004, 2005 Reinoud Zandijk @@ -119,7 +119,6 @@ struct auixp_softc { /* audio formats supported */ struct audio_format sc_formats[AUIXP_NFORMATS]; - struct audio_encoding_set *sc_encodings; /* codecs */ int sc_num_codecs;
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Wed May 1 09:41:50 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: emuxki.c Log Message: Use __nothing macro. To generate a diff of this commit: cvs rdiff -u -r1.67.2.4 -r1.67.2.5 src/sys/dev/pci/emuxki.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Wed May 1 09:41:50 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: emuxki.c Log Message: Use __nothing macro. To generate a diff of this commit: cvs rdiff -u -r1.67.2.4 -r1.67.2.5 src/sys/dev/pci/emuxki.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/pci/emuxki.c diff -u src/sys/dev/pci/emuxki.c:1.67.2.4 src/sys/dev/pci/emuxki.c:1.67.2.5 --- src/sys/dev/pci/emuxki.c:1.67.2.4 Wed May 1 06:34:46 2019 +++ src/sys/dev/pci/emuxki.c Wed May 1 09:41:50 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: emuxki.c,v 1.67.2.4 2019/05/01 06:34:46 isaki Exp $ */ +/* $NetBSD: emuxki.c,v 1.67.2.5 2019/05/01 09:41:50 isaki Exp $ */ /*- * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.67.2.4 2019/05/01 06:34:46 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.67.2.5 2019/05/01 09:41:50 isaki Exp $"); #include #include @@ -71,8 +71,8 @@ __KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1 # define DPRINTF(fmt...) do { if (emudebug) printf(fmt); } while (0) # define DPRINTFN(n,fmt...) do { if (emudebug>=(n)) printf(fmt); } while (0) #else -# define DPRINTF(fmt...) do { } while (0) -# define DPRINTFN(n,fmt...) do { } while (0) +# define DPRINTF(fmt...) __nothing +# define DPRINTFN(n,fmt...) __nothing #endif /*
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Wed May 1 06:34:46 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: emuxki.c Removed Files: src/sys/dev/pci [isaki-audio2]: emuxkivar.h Log Message: Reimplement emuxki driver. - Use single voice per playback and per recording. - Use fixed format, 2ch/48kHz, to simplify. - Fix several problems in previous driver. And now it works even on alpha! The driver is written by Y.Sugahara. Thanks! To generate a diff of this commit: cvs rdiff -u -r1.67.2.3 -r1.67.2.4 src/sys/dev/pci/emuxki.c cvs rdiff -u -r1.13 -r0 src/sys/dev/pci/emuxkivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Wed May 1 06:34:46 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: emuxki.c Removed Files: src/sys/dev/pci [isaki-audio2]: emuxkivar.h Log Message: Reimplement emuxki driver. - Use single voice per playback and per recording. - Use fixed format, 2ch/48kHz, to simplify. - Fix several problems in previous driver. And now it works even on alpha! The driver is written by Y.Sugahara. Thanks! To generate a diff of this commit: cvs rdiff -u -r1.67.2.3 -r1.67.2.4 src/sys/dev/pci/emuxki.c cvs rdiff -u -r1.13 -r0 src/sys/dev/pci/emuxkivar.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/pci/emuxki.c diff -u src/sys/dev/pci/emuxki.c:1.67.2.3 src/sys/dev/pci/emuxki.c:1.67.2.4 --- src/sys/dev/pci/emuxki.c:1.67.2.3 Wed May 1 06:03:14 2019 +++ src/sys/dev/pci/emuxki.c Wed May 1 06:34:46 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: emuxki.c,v 1.67.2.3 2019/05/01 06:03:14 isaki Exp $ */ +/* $NetBSD: emuxki.c,v 1.67.2.4 2019/05/01 06:34:46 isaki Exp $ */ /*- * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc. @@ -30,147 +30,227 @@ */ /* - * Driver for Creative Labs SBLive! series and probably PCI512. - * - * Known bugs: - * - inversed stereo at ac97 codec level - * (XXX jdolecek - don't see the problem? maybe because auvia(4) has - *it swapped too?) - * - bass disappear when you plug rear jack-in on Cambridge FPS2000 speakers - * (and presumably all speakers that support front and rear jack-in) - * - * TODO: - * - Digital Outputs - * - (midi/mpu),joystick support - * - Multiple voices play (problem with /dev/audio architecture) - * - Multiple sources recording (Pb with audio(4)) - * - Independent modification of each channel's parameters (via mixer ?) - * - DSP FX patches (to make fx like chipmunk) + * EMU10K1 single voice driver + * o. only 1 voice playback, 1 recording + * o. only s16le 2ch 48k + * This makes it simple to control buffers and interrupts + * while satisfying playback and recording quality. */ #include -__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.67.2.3 2019/05/01 06:03:14 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.67.2.4 2019/05/01 06:34:46 isaki Exp $"); #include #include #include #include #include -#include #include #include #include #include +#include +#include + #include #include #include #include +#include #include #include -#include + #include -#include -/* autoconf goo */ -static int emuxki_match(device_t, cfdata_t, void *); -static void emuxki_attach(device_t, device_t, void *); -static int emuxki_detach(device_t, int); +/* #define EMUXKI_DEBUG 1 */ +#ifdef EMUXKI_DEBUG +#define emudebug EMUXKI_DEBUG +# define DPRINTF(fmt...) do { if (emudebug) printf(fmt); } while (0) +# define DPRINTFN(n,fmt...) do { if (emudebug>=(n)) printf(fmt); } while (0) +#else +# define DPRINTF(fmt...) do { } while (0) +# define DPRINTFN(n,fmt...) do { } while (0) +#endif -/* DMA mem mgmt */ -static struct dmamem *dmamem_alloc(bus_dma_tag_t, size_t, bus_size_t, - int); -static void dmamem_free(struct dmamem *); +/* + * PCI + * Note: emuxki's page table entry uses only 31bit addressing. + * (Maybe, later chip has 32bit mode, but it isn't used now.) + */ -/* Emu10k1 init & shutdown */ -static int emuxki_init(struct emuxki_softc *); -static void emuxki_shutdown(struct emuxki_softc *); +#define EMU_PCI_CBIO (0x10) +#define EMU_SUBSYS_APS (0x40011102) -/* Emu10k1 mem mgmt */ -static void *emuxki_pmem_alloc(struct emuxki_softc *, size_t); -static void *emuxki_rmem_alloc(struct emuxki_softc *, size_t); +#define EMU_PTESIZE (4096) +#define EMU_MINPTE (3) +/* + * Hardware limit of PTE is 4096 entry but it's too big for single voice. + * Reasonable candidate is: + * 48kHz * 2ch * 2byte * 1sec * 3buf/EMU_PTESIZE = 141 + * and then round it up to 2^n. + */ +#define EMU_MAXPTE (256) +#define EMU_NUMCHAN (64) + +/* + * Internal recording DMA buffer + */ +/* Recommend the same size as EMU_PTESIZE to be symmetrical for play/rec */ +#define EMU_REC_DMABLKSIZE (4096) +/* must be EMU_REC_DMABLKSIZE * 2 */ +#define EMU_REC_DMASIZE (8192) +/* must be EMU_RECBS_BUFSIZE_(EMU_REC_DMASIZE) */ +#define EMU_REC_BUFSIZE_RECBS EMU_RECBS_BUFSIZE_8192 /* - * Emu10k1 channels funcs : There is no direct access to channels, everything - * is done through voices I will at least provide channel based fx params - * modification, later... + * DMA memory management */ -/* Emu10k1 voice mgmt */ -static struct emuxki_voice *emuxki_voice_new(struct emuxki_softc *, - uint8_t); -static void emuxki_voice_delete(struct emuxki_voice *); -static int emuxki_voice_set_audioparms(struct emuxki_softc *, - struct emuxki_voice *, uint8_t, - uint8_t, uint32_t); -/* emuxki_voice_set_fxparms will come later, it'll need channel distinction */ -static int
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Wed May 1 06:03:14 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: emuxki.c Log Message: Adapt to audio2. - XXX New set_format is not implemented at this point. This implementation can not adapt to audio2 (and it also has not worked since netbsd-8). The driver supports multiple hardware stream which is named 'voice'. This voice was allocated at open() and was deallocated at close(). However, in order to support mixing, some interfaces such as set_params() (or set_format in audio2) has to be called before open(). To generate a diff of this commit: cvs rdiff -u -r1.67.2.2 -r1.67.2.3 src/sys/dev/pci/emuxki.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/pci/emuxki.c diff -u src/sys/dev/pci/emuxki.c:1.67.2.2 src/sys/dev/pci/emuxki.c:1.67.2.3 --- src/sys/dev/pci/emuxki.c:1.67.2.2 Sun Apr 21 07:59:01 2019 +++ src/sys/dev/pci/emuxki.c Wed May 1 06:03:14 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: emuxki.c,v 1.67.2.2 2019/04/21 07:59:01 isaki Exp $ */ +/* $NetBSD: emuxki.c,v 1.67.2.3 2019/05/01 06:03:14 isaki Exp $ */ /*- * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc. @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.67.2.2 2019/04/21 07:59:01 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.67.2.3 2019/05/01 06:03:14 isaki Exp $"); #include #include @@ -64,8 +64,6 @@ __KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1 #include #include -#include -#include #include #include @@ -134,10 +132,10 @@ static void emuxki_stream_halt(struct em static int emuxki_open(void *, int); static void emuxki_close(void *); -static int emuxki_query_encoding(void *, struct audio_encoding *); -static int emuxki_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int emuxki_query_format(void *, audio_format_query_t *); +static int emuxki_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int emuxki_round_blocksize(void *, int, int, const audio_params_t *); static size_t emuxki_round_buffersize(void *, int, size_t); @@ -157,7 +155,6 @@ static int emuxki_query_devinfo(void *, static void*emuxki_allocm(void *, int, size_t); static void emuxki_freem(void *, void *, size_t); -static paddr_t emuxki_mappage(void *, void *, off_t, int); static int emuxki_get_props(void *); static void emuxki_get_locks(void *, kmutex_t **, kmutex_t **); @@ -180,8 +177,8 @@ CFATTACH_DECL_NEW(emuxki, sizeof(struct static const struct audio_hw_if emuxki_hw_if = { .open = emuxki_open, .close = emuxki_close, - .query_encoding = emuxki_query_encoding, - .set_params = emuxki_set_params, + .query_format = emuxki_query_format, + .set_format = emuxki_set_format, .round_blocksize = emuxki_round_blocksize, .halt_output = emuxki_halt_output, .halt_input = emuxki_halt_input, @@ -192,7 +189,6 @@ static const struct audio_hw_if emuxki_h .allocm = emuxki_allocm, .freem = emuxki_freem, .round_buffersize = emuxki_round_buffersize, - .mappage = emuxki_mappage, .get_props = emuxki_get_props, .trigger_output = emuxki_trigger_output, .trigger_input = emuxki_trigger_input, @@ -2089,124 +2085,20 @@ emuxki_close(void *addr) } static int -emuxki_query_encoding(void *addr, struct audio_encoding *fp) +emuxki_query_format(void *addr, audio_format_query_t *afp) { -#ifdef EMUXKI_DEBUG - struct emuxki_softc *sc; - - sc = addr; - printf("%s: emuxki_query_encoding called\n", device_xname(sc->sc_dev)); -#endif - - switch (fp->index) { - case 0: - strcpy(fp->name, AudioEulinear); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strcpy(fp->name, AudioEmulaw); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 2: - strcpy(fp->name, AudioEalaw); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 3: - strcpy(fp->name, AudioEslinear); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 4: - strcpy(fp->name, AudioEslinear_le); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 5: - strcpy(fp->name, AudioEulinear_le); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 6: - strcpy(fp->name, AudioEslinear_be); - fp->encoding = AUDIO_ENCODING_SLINEAR_BE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 7: - strcpy(fp->name, AudioEulinear_be); - fp->encoding = AUDIO_ENCODING_ULINEAR_BE; - fp->precision =
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Wed May 1 06:03:14 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: emuxki.c Log Message: Adapt to audio2. - XXX New set_format is not implemented at this point. This implementation can not adapt to audio2 (and it also has not worked since netbsd-8). The driver supports multiple hardware stream which is named 'voice'. This voice was allocated at open() and was deallocated at close(). However, in order to support mixing, some interfaces such as set_params() (or set_format in audio2) has to be called before open(). To generate a diff of this commit: cvs rdiff -u -r1.67.2.2 -r1.67.2.3 src/sys/dev/pci/emuxki.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Tue Apr 30 06:05:02 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: eap.c Log Message: More adapt to audio2. - Use set_format. - Remove an empty method. - XXX DAC1 and secondary audio device support should be removed. Now mixing two (or more) sources is done by audio layer. To generate a diff of this commit: cvs rdiff -u -r1.99.2.2 -r1.99.2.3 src/sys/dev/pci/eap.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/pci/eap.c diff -u src/sys/dev/pci/eap.c:1.99.2.2 src/sys/dev/pci/eap.c:1.99.2.3 --- src/sys/dev/pci/eap.c:1.99.2.2 Sun Apr 21 07:55:25 2019 +++ src/sys/dev/pci/eap.c Tue Apr 30 06:05:02 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: eap.c,v 1.99.2.2 2019/04/21 07:55:25 isaki Exp $ */ +/* $NetBSD: eap.c,v 1.99.2.3 2019/04/30 06:05:02 isaki Exp $ */ /* $OpenBSD: eap.c,v 1.6 1999/10/05 19:24:42 csapuntz Exp $ */ /* @@ -50,8 +50,13 @@ * ftp://download.intel.com/ial/scalableplatforms/audio/ac97r21.pdf */ +/* + * TODO: + * - Remove DAC1 and secondary audio device support. + */ + #include -__KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.99.2.2 2019/04/21 07:55:25 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.99.2.3 2019/04/30 06:05:02 isaki Exp $"); #include "midi.h" #include "joy_eap.h" @@ -69,7 +74,6 @@ __KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.99 #include #include -#include #include #include @@ -109,9 +113,9 @@ CFATTACH_DECL_NEW(eap, sizeof(struct eap static int eap_open(void *, int); static int eap_query_format(void *, struct audio_format_query *); -static int eap_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int eap_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int eap_trigger_output(void *, void *, void *, int, void (*)(void *), void *, const audio_params_t *); @@ -129,7 +133,6 @@ static int eap1371_mixer_get_port(void * static int eap1370_query_devinfo(void *, mixer_devinfo_t *); static void *eap_malloc(void *, int, size_t); static void eap_free(void *, void *, size_t); -static size_t eap_round_buffersize(void *, int, size_t); static int eap_get_props(void *); static void eap1370_set_mixer(struct eap_softc *, int, int); static uint32_t eap1371_src_wait(struct eap_softc *); @@ -157,7 +160,7 @@ static void eap_uart_txrdy(struct eap_so static const struct audio_hw_if eap1370_hw_if = { .open = eap_open, .query_format = eap_query_format, - .set_params = eap_set_params, + .set_format = eap_set_format, .halt_output = eap_halt_output, .halt_input = eap_halt_input, .getdev = eap_getdev, @@ -166,7 +169,6 @@ static const struct audio_hw_if eap1370_ .query_devinfo = eap1370_query_devinfo, .allocm = eap_malloc, .freem = eap_free, - .round_buffersize = eap_round_buffersize, .get_props = eap_get_props, .trigger_output = eap_trigger_output, .trigger_input = eap_trigger_input, @@ -176,7 +178,7 @@ static const struct audio_hw_if eap1370_ static const struct audio_hw_if eap1371_hw_if = { .open = eap_open, .query_format = eap_query_format, - .set_params = eap_set_params, + .set_format = eap_set_format, .halt_output = eap_halt_output, .halt_input = eap_halt_input, .getdev = eap_getdev, @@ -185,7 +187,6 @@ static const struct audio_hw_if eap1371_ .query_devinfo = eap1371_query_devinfo, .allocm = eap_malloc, .freem = eap_free, - .round_buffersize = eap_round_buffersize, .get_props = eap_get_props, .trigger_output = eap_trigger_output, .trigger_input = eap_trigger_input, @@ -209,24 +210,19 @@ static struct audio_device eap_device = "eap" }; -#define EAP_NFORMATS 4 -#define EAP_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 = { 4000, 48000 }, \ - } -static const struct audio_format eap_formats[EAP_NFORMATS] = { - EAP_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 2, AUFMT_STEREO), - EAP_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 1, AUFMT_MONAURAL), - EAP_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 2, AUFMT_STEREO), - EAP_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 1, AUFMT_MONAURAL), +static const struct audio_format eap_formats[] = { + { + .mode = AUMODE_PLAY | AUMODE_RECORD, + .encoding = AUDIO_ENCODING_SLINEAR_LE, + .validbits = 16, + .precision = 16, + .channels = 2, + .channel_mask = AUFMT_STEREO, + .frequency_type = 2, + .frequency = { 4000, 48000 }, + }, }; +#define EAP_NFORMATS __arraycount(eap_formats) static int eap_match(device_t parent, cfdata_t match, void *aux) @@ -944,54 +940,37 @@ eap_query_format(void *addr, struct audi
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Tue Apr 30 06:05:02 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: eap.c Log Message: More adapt to audio2. - Use set_format. - Remove an empty method. - XXX DAC1 and secondary audio device support should be removed. Now mixing two (or more) sources is done by audio layer. To generate a diff of this commit: cvs rdiff -u -r1.99.2.2 -r1.99.2.3 src/sys/dev/pci/eap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Mon Apr 29 09:32:07 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: yds.c ydsvar.h Log Message: Adapt to audio2. To generate a diff of this commit: cvs rdiff -u -r1.61.2.1 -r1.61.2.2 src/sys/dev/pci/yds.c cvs rdiff -u -r1.12 -r1.12.10.1 src/sys/dev/pci/ydsvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Mon Apr 29 09:30:18 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: sv.c Log Message: Adapt to audio2. - Drop INDEPENDENT property. Both play and rec seems to share the sample rate (however, they require different calculations?). - XXX It's better to modify frequency list more strictly. - Remove obsoleted and empty methods. To generate a diff of this commit: cvs rdiff -u -r1.54.2.1 -r1.54.2.2 src/sys/dev/pci/sv.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/pci/sv.c diff -u src/sys/dev/pci/sv.c:1.54.2.1 src/sys/dev/pci/sv.c:1.54.2.2 --- src/sys/dev/pci/sv.c:1.54.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/sv.c Mon Apr 29 09:30:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sv.c,v 1.54.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: sv.c,v 1.54.2.2 2019/04/29 09:30:18 isaki Exp $ */ /* $OpenBSD: sv.c,v 1.2 1998/07/13 01:50:15 csapuntz Exp $ */ /* @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.54.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.54.2.2 2019/04/29 09:30:18 isaki Exp $"); #include #include @@ -81,8 +81,6 @@ __KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.54. #include #include -#include -#include #include #include @@ -141,10 +139,10 @@ static int sv_freemem(struct sv_softc *, static void sv_init_mixer(struct sv_softc *); static int sv_open(void *, int); -static int sv_query_encoding(void *, struct audio_encoding *); -static int sv_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int sv_query_format(void *, audio_format_query_t *); +static int sv_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int sv_round_blocksize(void *, int, int, const audio_params_t *); static int sv_trigger_output(void *, void *, void *, int, void (*)(void *), void *, const audio_params_t *); @@ -158,8 +156,6 @@ static int sv_mixer_get_port(void *, mix static int sv_query_devinfo(void *, mixer_devinfo_t *); static void * sv_malloc(void *, int, size_t); static void sv_free(void *, void *, size_t); -static size_t sv_round_buffersize(void *, int, size_t); -static paddr_t sv_mappage(void *, void *, off_t, int); static int sv_get_props(void *); static void sv_get_locks(void *, kmutex_t **, kmutex_t **); @@ -169,8 +165,8 @@ voidsv_dumpregs(struct sv_softc *sc) static const struct audio_hw_if sv_hw_if = { .open = sv_open, - .query_encoding = sv_query_encoding, - .set_params = sv_set_params, + .query_format = sv_query_format, + .set_format = sv_set_format, .round_blocksize = sv_round_blocksize, .halt_output = sv_halt_output, .halt_input = sv_halt_input, @@ -180,32 +176,25 @@ static const struct audio_hw_if sv_hw_if .query_devinfo = sv_query_devinfo, .allocm = sv_malloc, .freem = sv_free, - .round_buffersize = sv_round_buffersize, - .mappage = sv_mappage, .get_props = sv_get_props, .trigger_output = sv_trigger_output, .trigger_input = sv_trigger_input, .get_locks = sv_get_locks, }; -#define SV_NFORMATS 4 -#define SV_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 = { 2000, 48000 }, \ - } -static const struct audio_format sv_formats[SV_NFORMATS] = { - SV_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 2, AUFMT_STEREO), - SV_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 1, AUFMT_MONAURAL), - SV_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 2, AUFMT_STEREO), - SV_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 1, AUFMT_MONAURAL), +static const struct audio_format sv_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 = { 2000, 48000 }, + }, }; +#define SV_NFORMATS __arraycount(sv_formats) static void @@ -582,105 +571,25 @@ sv_open(void *addr, int flags) } static int -sv_query_encoding(void *addr, struct audio_encoding *fp) +sv_query_format(void *addr, audio_format_query_t *afp) { - switch (fp->index) { - case 0: - strcpy(fp->name, AudioEulinear); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - return 0; - case 1: - strcpy(fp->name, AudioEmulaw); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - return 0; - case 2: - strcpy(fp->name, AudioEalaw); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - return 0; - case 3:
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Mon Apr 29 09:32:07 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: yds.c ydsvar.h Log Message: Adapt to audio2. To generate a diff of this commit: cvs rdiff -u -r1.61.2.1 -r1.61.2.2 src/sys/dev/pci/yds.c cvs rdiff -u -r1.12 -r1.12.10.1 src/sys/dev/pci/ydsvar.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/pci/yds.c diff -u src/sys/dev/pci/yds.c:1.61.2.1 src/sys/dev/pci/yds.c:1.61.2.2 --- src/sys/dev/pci/yds.c:1.61.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/yds.c Mon Apr 29 09:32:07 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: yds.c,v 1.61.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: yds.c,v 1.61.2.2 2019/04/29 09:32:07 isaki Exp $ */ /* * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.61.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.61.2.2 2019/04/29 09:32:07 isaki Exp $"); #include "mpu.h" @@ -57,8 +57,6 @@ __KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.61 #include #include -#include -#include #include #include #include @@ -151,10 +149,10 @@ CFATTACH_DECL_NEW(yds, sizeof(struct yds static int yds_open(void *, int); static void yds_close(void *); -static int yds_query_encoding(void *, struct audio_encoding *); -static int yds_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int yds_query_format(void *, audio_format_query_t *); +static int yds_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int yds_round_blocksize(void *, int, int, const audio_params_t *); static int yds_trigger_output(void *, void *, void *, int, void (*)(void *), void *, @@ -170,7 +168,6 @@ static int yds_mixer_get_port(void *, mi static void * yds_malloc(void *, int, size_t); static void yds_free(void *, void *, size_t); static size_t yds_round_buffersize(void *, int, size_t); -static paddr_t yds_mappage(void *, void *, off_t, int); static int yds_get_props(void *); static int yds_query_devinfo(void *, mixer_devinfo_t *); static void yds_get_locks(void *, kmutex_t **, kmutex_t **); @@ -206,8 +203,8 @@ static const struct audio_hw_if yds_hw_i .open = yds_open, .close = yds_close, .drain = NULL, - .query_encoding = yds_query_encoding, - .set_params = yds_set_params, + .query_format = yds_query_format, + .set_format = yds_set_format, .round_blocksize = yds_round_blocksize, .commit_settings = NULL, .init_output = NULL, @@ -225,7 +222,6 @@ static const struct audio_hw_if yds_hw_i .allocm = yds_malloc, .freem = yds_free, .round_buffersize = yds_round_buffersize, - .mappage = yds_mappage, .get_props = yds_get_props, .trigger_output = yds_trigger_output, .trigger_input = yds_trigger_input, @@ -267,22 +263,18 @@ static const struct { #define YDS_CAP_BITS "\020\005P44\004LEGFLEX\003LEGSEL\002MCODE1E\001MCODE1" #endif -#define YDS_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 = { 4000, 48000 }, \ - } static const struct audio_format yds_formats[] = { - YDS_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 2, AUFMT_STEREO), - YDS_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 1, AUFMT_MONAURAL), - YDS_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 2, AUFMT_STEREO), - YDS_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 1, AUFMT_MONAURAL), + { + .mode = AUMODE_PLAY | AUMODE_RECORD, + .encoding = AUDIO_ENCODING_SLINEAR_LE, + .validbits = 16, + .precision = 16, + .channels = 2, + .channel_mask = AUFMT_STEREO, + .frequency_type = 8, + .frequency = + { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000 }, + }, }; #define YDS_NFORMATS (sizeof(yds_formats) / sizeof(struct audio_format)) @@ -937,13 +929,6 @@ detected: } } - if (0 != auconv_create_encodings(yds_formats, YDS_NFORMATS, - >sc_encodings)) { - mutex_destroy(>sc_lock); - mutex_destroy(>sc_intr_lock); - return; - } - audio_attach_mi(_hw_if, sc, self); sc->sc_legacy_iot = pa->pa_iot; @@ -1253,29 +1238,17 @@ yds_close(void *addr) } static int -yds_query_encoding(void *addr, struct audio_encoding *fp) +yds_query_format(void *addr, audio_format_query_t *afp) { - struct yds_softc *sc; - sc = addr; - return auconv_query_encoding(sc->sc_encodings, fp); + return audio_query_format(yds_formats, YDS_NFORMATS, afp); } static int -yds_set_params(void *addr, int setmode, int usemode, - audio_params_t *play, audio_params_t* rec, - stream_filter_list_t *pfil, stream_filter_list_t *rfil)
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Mon Apr 29 09:30:18 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: sv.c Log Message: Adapt to audio2. - Drop INDEPENDENT property. Both play and rec seems to share the sample rate (however, they require different calculations?). - XXX It's better to modify frequency list more strictly. - Remove obsoleted and empty methods. To generate a diff of this commit: cvs rdiff -u -r1.54.2.1 -r1.54.2.2 src/sys/dev/pci/sv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 07:48:15 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: neo.c Log Message: Adapt to audio2. - XXX In audio2, number of blocks must be 3 or greater, so modify round_blocksize() to return bufsize / 4. - XXX Doesn't neo_trigger_input() need to subtract ssz from buffer end like trigger_output()? To generate a diff of this commit: cvs rdiff -u -r1.52.2.1 -r1.52.2.2 src/sys/dev/pci/neo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 07:48:15 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: neo.c Log Message: Adapt to audio2. - XXX In audio2, number of blocks must be 3 or greater, so modify round_blocksize() to return bufsize / 4. - XXX Doesn't neo_trigger_input() need to subtract ssz from buffer end like trigger_output()? To generate a diff of this commit: cvs rdiff -u -r1.52.2.1 -r1.52.2.2 src/sys/dev/pci/neo.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/pci/neo.c diff -u src/sys/dev/pci/neo.c:1.52.2.1 src/sys/dev/pci/neo.c:1.52.2.2 --- src/sys/dev/pci/neo.c:1.52.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/neo.c Sun Apr 28 07:48:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: neo.c,v 1.52.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: neo.c,v 1.52.2.2 2019/04/28 07:48:15 isaki Exp $ */ /* * Copyright (c) 1999 Cameron Grant @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: neo.c,v 1.52.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: neo.c,v 1.52.2.2 2019/04/28 07:48:15 isaki Exp $"); #include #include @@ -43,8 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: neo.c,v 1.52 #include #include -#include -#include #include @@ -176,11 +174,12 @@ static int nm_init(struct neo_softc *); static int neo_match(device_t, cfdata_t, void *); static void neo_attach(device_t, device_t, void *); static int neo_intr(void *); +static int neo_rate2index(u_int); -static int neo_query_encoding(void *, struct audio_encoding *); -static int neo_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int neo_query_format(void *, audio_format_query_t *); +static int neo_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int neo_round_blocksize(void *, int, int, const audio_params_t *); static int neo_trigger_output(void *, void *, void *, int, void (*)(void *), void *, @@ -202,7 +201,6 @@ static int neo_query_devinfo(void *, mix static void * neo_malloc(void *, int, size_t); static void neo_free(void *, void *, size_t); static size_t neo_round_buffersize(void *, int, size_t); -static paddr_t neo_mappage(void *, void *, off_t, int); static int neo_get_props(void *); static void neo_get_locks(void *, kmutex_t **, kmutex_t **); @@ -215,44 +213,30 @@ static struct audio_device neo_device = "neo" }; -/* The actual rates supported by the card. */ -static const int samplerates[9] = { - 8000, - 11025, - 16000, - 22050, - 24000, - 32000, - 44100, - 48000, - -}; - -#define NEO_NFORMATS 4 -#define NEO_FORMAT(enc, prec, ch, chmask) \ - { \ - .mode = AUMODE_PLAY | AUMODE_RECORD, \ - .encoding = (enc), \ - .validbits = (prec), \ - .precision = (prec), \ - .channels = (ch), \ - .channel_mask = (chmask), \ - .frequency_type = 8, \ - .frequency = \ - { 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000 }, \ - } -static const struct audio_format neo_formats[NEO_NFORMATS] = { - NEO_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 2, AUFMT_STEREO), - NEO_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 1, AUFMT_MONAURAL), - NEO_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 2, AUFMT_STEREO), - NEO_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 1, AUFMT_MONAURAL), +/* + * The frequency list in this format is also referred from neo_rate2index(). + * So don't rearrange or delete entries. + */ +static const struct audio_format neo_formats[] = { + { + .mode = AUMODE_PLAY | AUMODE_RECORD, + .encoding = AUDIO_ENCODING_SLINEAR_LE, + .validbits = 16, + .precision = 16, + .channels = 2, + .channel_mask = AUFMT_STEREO, + .frequency_type = 8, + .frequency = + { 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000 }, + }, }; +#define NEO_NFORMATS __arraycount(neo_formats) /* */ static const struct audio_hw_if neo_hw_if = { - .query_encoding = neo_query_encoding, - .set_params = neo_set_params, + .query_format = neo_query_format, + .set_format = neo_set_format, .round_blocksize = neo_round_blocksize, .halt_output = neo_halt_output, .halt_input = neo_halt_input, @@ -263,7 +247,6 @@ static const struct audio_hw_if neo_hw_i .allocm = neo_malloc, .freem = neo_free, .round_buffersize = neo_round_buffersize, - .mappage = neo_mappage, .get_props = neo_get_props, .trigger_output = neo_trigger_output, .trigger_input = neo_trigger_input, @@ -722,75 +705,38 @@ neo_flags_codec(void *v) } static int -neo_query_encoding(void *addr, struct audio_encoding *fp) +neo_query_format(void *addr, audio_format_query_t *afp) { - switch (fp->index) { - case 0: - strcpy(fp->name, AudioEulinear); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision =
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 07:01:45 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: gcscaudio.c Log Message: Adapt to audio2. To generate a diff of this commit: cvs rdiff -u -r1.16.2.1 -r1.16.2.2 src/sys/dev/pci/gcscaudio.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/pci/gcscaudio.c diff -u src/sys/dev/pci/gcscaudio.c:1.16.2.1 src/sys/dev/pci/gcscaudio.c:1.16.2.2 --- src/sys/dev/pci/gcscaudio.c:1.16.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/gcscaudio.c Sun Apr 28 07:01:45 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: gcscaudio.c,v 1.16.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: gcscaudio.c,v 1.16.2.2 2019/04/28 07:01:45 isaki Exp $ */ /*- * Copyright (c) 2008 SHIMIZU Ryo @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gcscaudio.c,v 1.16.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gcscaudio.c,v 1.16.2.2 2019/04/28 07:01:45 isaki Exp $"); #include #include @@ -40,8 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: gcscaudio.c, #include #include -#include -#include + #include #include @@ -101,7 +100,6 @@ struct gcscaudio_softc { #define GCSCAUDIO_MAXFORMATS 4 struct audio_format sc_formats[GCSCAUDIO_MAXFORMATS]; int sc_nformats; - struct audio_encoding_set *sc_encodings; /* AC97 codec */ struct ac97_host_if host_if; @@ -129,10 +127,10 @@ static void gcscaudio_attach(device_t, d /* for audio_hw_if */ static int gcscaudio_open(void *, int); static void gcscaudio_close(void *); -static int gcscaudio_query_encoding(void *, struct audio_encoding *); -static int gcscaudio_set_params(void *, int, int, audio_params_t *, -audio_params_t *, stream_filter_list_t *, -stream_filter_list_t *); +static int gcscaudio_query_format(void *, audio_format_query_t *); +static int gcscaudio_set_format(void *, int, +const audio_params_t *, const audio_params_t *, +audio_filter_reg_t *, audio_filter_reg_t *); static int gcscaudio_round_blocksize(void *, int, int, const audio_params_t *); static int gcscaudio_halt_output(void *); static int gcscaudio_halt_input(void *); @@ -143,7 +141,6 @@ static int gcscaudio_query_devinfo(void static void *gcscaudio_malloc(void *, int, size_t); static void gcscaudio_free(void *, void *, size_t); static size_t gcscaudio_round_buffersize(void *, int, size_t); -static paddr_t gcscaudio_mappage(void *, void *, off_t, int); static int gcscaudio_get_props(void *); static int gcscaudio_trigger_output(void *, void *, void *, int, void (*)(void *), void *, @@ -166,9 +163,6 @@ static void gcscaudio_spdif_event_codec( static int gcscaudio_append_formats(struct gcscaudio_softc *, const struct audio_format *); static int gcscaudio_wait_ready_codec(struct gcscaudio_softc *sc, const char *); -static int gcscaudio_set_params_ch(struct gcscaudio_softc *, - struct gcscaudio_softc_ch *, int, - audio_params_t *, stream_filter_list_t *); static int gcscaudio_allocate_dma(struct gcscaudio_softc *, size_t, void **, bus_dma_segment_t *, int, int *, bus_dmamap_t *); @@ -188,8 +182,8 @@ static const struct audio_hw_if gcscaudi .open = gcscaudio_open, .close = gcscaudio_close, .drain = NULL, - .query_encoding = gcscaudio_query_encoding, - .set_params = gcscaudio_set_params, + .query_format = gcscaudio_query_format, + .set_format = gcscaudio_set_format, .round_blocksize = gcscaudio_round_blocksize, .commit_settings = NULL, .init_output = NULL, @@ -207,7 +201,6 @@ static const struct audio_hw_if gcscaudi .allocm = gcscaudio_malloc, .freem = gcscaudio_free, .round_buffersize = gcscaudio_round_buffersize, - .mappage = gcscaudio_mappage, .get_props = gcscaudio_get_props, .trigger_output = gcscaudio_trigger_output, .trigger_input = gcscaudio_trigger_input, @@ -350,18 +343,9 @@ gcscaudio_attach(device_t parent, device } mutex_exit(>sc_lock); - if ((rc = auconv_create_encodings(sc->sc_formats, sc->sc_nformats, - >sc_encodings)) != 0) { - aprint_error_dev(self, - "auconv_create_encoding: error=%d\n", rc); - goto attach_failure_codec; - } - audio_attach_mi(_hw_if, sc, sc->sc_dev); return; -attach_failure_codec: - sc->codec_if->vtbl->detach(sc->codec_if); attach_failure_intr: pci_intr_disestablish(sc->sc_pc, sc->sc_ih); attach_failure_unmap: @@ -506,87 +490,58 @@ gcscaudio_close(void *arg) } static int -gcscaudio_query_encoding(void *arg, struct audio_encoding *fp) +gcscaudio_query_format(void *arg, audio_format_query_t *afp) { struct gcscaudio_softc *sc; sc = (struct
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 07:01:45 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: gcscaudio.c Log Message: Adapt to audio2. To generate a diff of this commit: cvs rdiff -u -r1.16.2.1 -r1.16.2.2 src/sys/dev/pci/gcscaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 06:36:50 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: fms.c Log Message: Adapt to audio2. - Searching nearest frequency is unnecessary in audio2. To generate a diff of this commit: cvs rdiff -u -r1.45.2.1 -r1.45.2.2 src/sys/dev/pci/fms.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 06:36:50 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: fms.c Log Message: Adapt to audio2. - Searching nearest frequency is unnecessary in audio2. To generate a diff of this commit: cvs rdiff -u -r1.45.2.1 -r1.45.2.2 src/sys/dev/pci/fms.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/pci/fms.c diff -u src/sys/dev/pci/fms.c:1.45.2.1 src/sys/dev/pci/fms.c:1.45.2.2 --- src/sys/dev/pci/fms.c:1.45.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/fms.c Sun Apr 28 06:36:50 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: fms.c,v 1.45.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: fms.c,v 1.45.2.2 2019/04/28 06:36:50 isaki Exp $ */ /*- * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fms.c,v 1.45.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fms.c,v 1.45.2.2 2019/04/28 06:36:50 isaki Exp $"); #include "mpu.h" @@ -52,8 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: fms.c,v 1.45 #include #include -#include -#include #include #include @@ -75,10 +73,10 @@ static int fms_match(device_t, cfdata_t, static void fms_attach(device_t, device_t, void *); static int fms_intr(void *); -static int fms_query_encoding(void *, struct audio_encoding *); -static int fms_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int fms_query_format(void *, audio_format_query_t *); +static int fms_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int fms_round_blocksize(void *, int, int, const audio_params_t *); static int fms_halt_output(void *); static int fms_halt_input(void *); @@ -88,8 +86,6 @@ static int fms_get_port(void *, mixer_ct static int fms_query_devinfo(void *, mixer_devinfo_t *); static void *fms_malloc(void *, int, size_t); static void fms_free(void *, void *, size_t); -static size_t fms_round_buffersize(void *, int, size_t); -static paddr_t fms_mappage(void *, void *, off_t, int); static int fms_get_props(void *); static int fms_trigger_output(void *, void *, void *, int, void (*)(void *), void *, @@ -108,10 +104,29 @@ static struct audio_device fms_device = "fms" }; +/* + * The frequency list in this format is also referred from fms_rate2index(). + * So don't rearrange or delete entries. + */ +static const struct audio_format fms_formats[] = { + { + .mode = AUMODE_PLAY | AUMODE_RECORD, + .encoding = AUDIO_ENCODING_SLINEAR_LE, + .validbits = 16, + .precision = 16, + .channels = 2, + .channel_mask = AUFMT_STEREO, + .frequency_type = 11, + .frequency = { 5500, 8000, 9600, 11025, 16000, 19200, + 22050, 32000, 38400, 44100, 48000}, + }, +}; +#define FMS_NFORMATS __arraycount(fms_formats) + static const struct audio_hw_if fms_hw_if = { - .query_encoding = fms_query_encoding, - .set_params = fms_set_params, + .query_format = fms_query_format, + .set_format = fms_set_format, .round_blocksize = fms_round_blocksize, .halt_output = fms_halt_output, .halt_input = fms_halt_input, @@ -121,8 +136,6 @@ static const struct audio_hw_if fms_hw_i .query_devinfo = fms_query_devinfo, .allocm = fms_malloc, .freem = fms_free, - .round_buffersize = fms_round_buffersize, - .mappage = fms_mappage, .get_props = fms_get_props, .trigger_output = fms_trigger_output, .trigger_input = fms_trigger_input, @@ -133,6 +146,7 @@ static int fms_attach_codec(void *, stru static int fms_read_codec(void *, uint8_t, uint16_t *); static int fms_write_codec(void *, uint8_t, uint16_t); static int fms_reset_codec(void *); +static int fms_rate2index(u_int); #define FM_PCM_VOLUME 0x00 #define FM_FM_VOLUME 0x02 @@ -462,145 +476,45 @@ fms_intr(void *arg) } static int -fms_query_encoding(void *addr, struct audio_encoding *fp) +fms_query_format(void *addr, audio_format_query_t *afp) { - switch (fp->index) { - case 0: - strcpy(fp->name, AudioEmulaw); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - return 0; - case 1: - strcpy(fp->name, AudioEslinear_le); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - return 0; - case 2: - strcpy(fp->name, AudioEulinear); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - return 0; - case 3: - strcpy(fp->name, AudioEalaw); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - return 0; - case 4: - strcpy(fp->name, AudioEulinear_le); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - return 0; - case 5: -
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 05:07:00 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: eso.c Log Message: Don't release sc_lock on eso_halt_{input,output}. halt_* is called with sc_lock && sc_intr_lock held. This lock order is first sc_lock and then sc_intr_lock. So unlocking sc_lock with sc_intr_lock held is wrong operation. And cv_wait(sc_intr_lock) will work even with sc_lock held. To generate a diff of this commit: cvs rdiff -u -r1.69.2.2 -r1.69.2.3 src/sys/dev/pci/eso.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 05:07:00 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: eso.c Log Message: Don't release sc_lock on eso_halt_{input,output}. halt_* is called with sc_lock && sc_intr_lock held. This lock order is first sc_lock and then sc_intr_lock. So unlocking sc_lock with sc_intr_lock held is wrong operation. And cv_wait(sc_intr_lock) will work even with sc_lock held. To generate a diff of this commit: cvs rdiff -u -r1.69.2.2 -r1.69.2.3 src/sys/dev/pci/eso.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/pci/eso.c diff -u src/sys/dev/pci/eso.c:1.69.2.2 src/sys/dev/pci/eso.c:1.69.2.3 --- src/sys/dev/pci/eso.c:1.69.2.2 Sun Apr 28 04:45:34 2019 +++ src/sys/dev/pci/eso.c Sun Apr 28 05:07:00 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: eso.c,v 1.69.2.2 2019/04/28 04:45:34 isaki Exp $ */ +/* $NetBSD: eso.c,v 1.69.2.3 2019/04/28 05:07:00 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: eso.c,v 1.69.2.2 2019/04/28 04:45:34 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: eso.c,v 1.69.2.3 2019/04/28 05:07:00 isaki Exp $"); #include "mpu.h" @@ -784,13 +784,7 @@ eso_halt_output(void *hdl) ESO_IO_A2DMAM_DMAENB); sc->sc_pintr = NULL; - mutex_exit(>sc_lock); error = cv_timedwait_sig(>sc_pcv, >sc_intr_lock, sc->sc_pdrain); - if (!mutex_tryenter(>sc_lock)) { - mutex_spin_exit(>sc_intr_lock); - mutex_enter(>sc_lock); - mutex_spin_enter(>sc_intr_lock); - } /* Shut down DMA completely. */ eso_write_mixreg(sc, ESO_MIXREG_A2C1, 0); @@ -816,13 +810,7 @@ eso_halt_input(void *hdl) DMA37MD_WRITE | DMA37MD_DEMAND); sc->sc_rintr = NULL; - mutex_exit(>sc_lock); error = cv_timedwait_sig(>sc_rcv, >sc_intr_lock, sc->sc_rdrain); - if (!mutex_tryenter(>sc_lock)) { - mutex_spin_exit(>sc_intr_lock); - mutex_enter(>sc_lock); - mutex_spin_enter(>sc_intr_lock); - } /* Shut down DMA completely. */ eso_write_ctlreg(sc, ESO_CTLREG_A1C2,
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 04:45:34 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: eso.c esoreg.h Log Message: Adapt to audio2. - Select a few typical frequencies which doesn't have rounding error instead of whole range. To generate a diff of this commit: cvs rdiff -u -r1.69.2.1 -r1.69.2.2 src/sys/dev/pci/eso.c cvs rdiff -u -r1.8 -r1.8.168.1 src/sys/dev/pci/esoreg.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/pci/eso.c diff -u src/sys/dev/pci/eso.c:1.69.2.1 src/sys/dev/pci/eso.c:1.69.2.2 --- src/sys/dev/pci/eso.c:1.69.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/eso.c Sun Apr 28 04:45:34 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: eso.c,v 1.69.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: eso.c,v 1.69.2.2 2019/04/28 04:45:34 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: eso.c,v 1.69.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: eso.c,v 1.69.2.2 2019/04/28 04:45:34 isaki Exp $"); #include "mpu.h" @@ -80,9 +80,6 @@ __KERNEL_RCSID(0, "$NetBSD: eso.c,v 1.69 #include #include -#include -#include - #include #include #include @@ -131,10 +128,10 @@ CFATTACH_DECL_NEW(eso, sizeof (struct es static int eso_intr(void *); /* MI audio layer interface */ -static int eso_query_encoding(void *, struct audio_encoding *); -static int eso_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int eso_query_format(void *, audio_format_query_t *); +static int eso_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int eso_round_blocksize(void *, int, int, const audio_params_t *); static int eso_halt_output(void *); static int eso_halt_input(void *); @@ -145,7 +142,6 @@ static int eso_query_devinfo(void *, mix static void * eso_allocm(void *, int, size_t); static void eso_freem(void *, void *, size_t); static size_t eso_round_buffersize(void *, int, size_t); -static paddr_t eso_mappage(void *, void *, off_t, int); static int eso_get_props(void *); static int eso_trigger_output(void *, void *, void *, int, void (*)(void *), void *, const audio_params_t *); @@ -154,8 +150,8 @@ static int eso_trigger_input(void *, voi static void eso_get_locks(void *, kmutex_t **, kmutex_t **); static const struct audio_hw_if eso_hw_if = { - .query_encoding = eso_query_encoding, - .set_params = eso_set_params, + .query_format = eso_query_format, + .set_format = eso_set_format, .round_blocksize = eso_round_blocksize, .halt_output = eso_halt_output, .halt_input = eso_halt_input, @@ -166,7 +162,6 @@ static const struct audio_hw_if eso_hw_i .allocm = eso_allocm, .freem = eso_freem, .round_buffersize = eso_round_buffersize, - .mappage = eso_mappage, .get_props = eso_get_props, .trigger_output = eso_trigger_output, .trigger_input = eso_trigger_input, @@ -179,28 +174,23 @@ static const char * const eso_rev2model[ "ES1946 Revision E" }; -#define ESO_NFORMATS 8 -#define ESO_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 = { ESO_MINRATE, ESO_MAXRATE }, \ - } -static const struct audio_format eso_formats[ESO_NFORMATS] = { - ESO_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 2, AUFMT_STEREO), - ESO_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 1, AUFMT_MONAURAL), - ESO_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 16, 2, AUFMT_STEREO), - ESO_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 16, 1, AUFMT_MONAURAL), - ESO_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 8, 2, AUFMT_STEREO), - ESO_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 8, 1, AUFMT_MONAURAL), - ESO_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 2, AUFMT_STEREO), - ESO_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 1, AUFMT_MONAURAL), +/* + * XXX The HW actually supports more frequencies but I select a few + * typical frequencies which does not include rounding error. + */ +static const struct audio_format eso_formats[] = { + { + .mode = AUMODE_PLAY | AUMODE_RECORD, + .encoding = AUDIO_ENCODING_SLINEAR_LE, + .validbits = 16, + .precision = 16, + .channels = 2, + .channel_mask = AUFMT_STEREO, + .frequency_type = 4, + .frequency = { 8000, 22050, 44100, 48000 }, + }, }; +#define ESO_NFORMATS __arraycount(eso_formats) /* @@ -700,76 +690,21 @@ eso_reset(struct eso_softc *sc) } static int -eso_query_encoding(void *hdl, struct audio_encoding *fp) +eso_query_format(void *hdl, audio_format_query_t *afp) { - switch (fp->index) { - case 0: - strcpy(fp->name, AudioEulinear); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; -
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 04:45:34 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: eso.c esoreg.h Log Message: Adapt to audio2. - Select a few typical frequencies which doesn't have rounding error instead of whole range. To generate a diff of this commit: cvs rdiff -u -r1.69.2.1 -r1.69.2.2 src/sys/dev/pci/eso.c cvs rdiff -u -r1.8 -r1.8.168.1 src/sys/dev/pci/esoreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 03:33:26 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: esm.c esmvar.h Log Message: Adapt to audio2. - Recording seems a bit tricky so I left it untouched. (It should work on audio2 as well if it works on -current/-8.) To generate a diff of this commit: cvs rdiff -u -r1.61.2.1 -r1.61.2.2 src/sys/dev/pci/esm.c cvs rdiff -u -r1.18 -r1.18.54.1 src/sys/dev/pci/esmvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 03:33:26 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: esm.c esmvar.h Log Message: Adapt to audio2. - Recording seems a bit tricky so I left it untouched. (It should work on audio2 as well if it works on -current/-8.) To generate a diff of this commit: cvs rdiff -u -r1.61.2.1 -r1.61.2.2 src/sys/dev/pci/esm.c cvs rdiff -u -r1.18 -r1.18.54.1 src/sys/dev/pci/esmvar.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/pci/esm.c diff -u src/sys/dev/pci/esm.c:1.61.2.1 src/sys/dev/pci/esm.c:1.61.2.2 --- src/sys/dev/pci/esm.c:1.61.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/esm.c Sun Apr 28 03:33:26 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: esm.c,v 1.61.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: esm.c,v 1.61.2.2 2019/04/28 03:33:26 isaki Exp $ */ /*- * Copyright (c) 2002, 2003 Matt Fredette @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.61.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.61.2.2 2019/04/28 03:33:26 isaki Exp $"); #include #include @@ -77,8 +77,6 @@ __KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.61 #include #include -#include -#include #include #include @@ -160,8 +158,8 @@ CFATTACH_DECL2_NEW(esm, sizeof(struct es esm_match, esm_attach, esm_detach, NULL, NULL, esm_childdet); const struct audio_hw_if esm_hw_if = { - .query_encoding = esm_query_encoding, - .set_params = esm_set_params, + .query_format = esm_query_format, + .set_format = esm_set_format, .round_blocksize = esm_round_blocksize, .init_output = esm_init_output, .init_input = esm_init_input, @@ -174,7 +172,6 @@ const struct audio_hw_if esm_hw_if = { .allocm = esm_malloc, .freem = esm_free, .round_buffersize = esm_round_buffersize, - .mappage = esm_mappage, .get_props = esm_get_props, .trigger_output = esm_trigger_output, .trigger_input = esm_trigger_input, @@ -187,23 +184,6 @@ struct audio_device esm_device = { "esm" }; -#define MAESTRO_NENCODINGS 8 -static audio_encoding_t esm_encoding[MAESTRO_NENCODINGS] = { - { 0, AudioEulinear, AUDIO_ENCODING_ULINEAR, 8, 0 }, - { 1, AudioEmulaw, AUDIO_ENCODING_ULAW, 8, - AUDIO_ENCODINGFLAG_EMULATED }, - { 2, AudioEalaw, AUDIO_ENCODING_ALAW, 8, AUDIO_ENCODINGFLAG_EMULATED }, - { 3, AudioEslinear, AUDIO_ENCODING_SLINEAR, 8, 0 }, - { 4, AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16, 0 }, - { 5, AudioEulinear_le, AUDIO_ENCODING_ULINEAR_LE, 16, - AUDIO_ENCODINGFLAG_EMULATED }, - { 6, AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16, - AUDIO_ENCODINGFLAG_EMULATED }, - { 7, AudioEulinear_be, AUDIO_ENCODING_ULINEAR_BE, 16, - AUDIO_ENCODINGFLAG_EMULATED }, -}; - -#define ESM_NFORMATS 4 #define ESM_FORMAT(enc, prec, ch, chmask) \ { \ .mode = AUMODE_PLAY | AUMODE_RECORD, \ @@ -215,12 +195,17 @@ static audio_encoding_t esm_encoding[MAE .frequency_type = 0, \ .frequency = { 4000, 48000 }, \ } -static const struct audio_format esm_formats[ESM_NFORMATS] = { +/* + * XXX Recodring on 16bit/stereo seems a bit tricky so I left all + * combination 8/16bit and mono/stereo. + */ +static const struct audio_format esm_formats[] = { ESM_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 2, AUFMT_STEREO), ESM_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 1, AUFMT_MONAURAL), ESM_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 2, AUFMT_STEREO), ESM_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 1, AUFMT_MONAURAL), }; +#define ESM_NFORMATS __arraycount(esm_formats) static const struct esm_quirks esm_quirks[] = { /* COMPAL 38W2 OEM Notebook, e.g. Dell INSPIRON 5000e */ @@ -1208,66 +1193,28 @@ esm_round_blocksize(void *sc, int blk, i } int -esm_query_encoding(void *sc, struct audio_encoding *fp) +esm_query_format(void *sc, audio_format_query_t *afp) { - DPRINTF(ESM_DEBUG_PARAM, - ("esm_query_encoding(%p, %d)\n", sc, fp->index)); - - if (fp->index < 0 || fp->index >= MAESTRO_NENCODINGS) - return EINVAL; - - *fp = esm_encoding[fp->index]; - return 0; + return audio_query_format(esm_formats, ESM_NFORMATS, afp); } int -esm_set_params(void *sc, int setmode, int usemode, - audio_params_t *play, audio_params_t *rec, - stream_filter_list_t *pfil, stream_filter_list_t *rfil) +esm_set_format(void *sc, int setmode, + const audio_params_t *play, const audio_params_t *rec, + audio_filter_reg_t *pfil, audio_filter_reg_t *rfil) { struct esm_softc *ess; - audio_params_t *p; - const audio_params_t *hw_play, *hw_rec; - stream_filter_list_t *fil; - int mode, i; DPRINTF(ESM_DEBUG_PARAM, - ("esm_set_params(%p, 0x%x, 0x%x, %p, %p)\n", - sc, setmode, usemode, play, rec)); + ("%s(%p, 0x%x, %p, %p)\n", __func__, + sc, setmode, play, rec)); ess = sc; - hw_play = NULL; - hw_rec = NULL; - for (mode = AUMODE_RECORD; mode != -1; - mode = mode == AUMODE_RECORD ? AUMODE_PLAY : -1) { - if
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 03:00:21 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: esa.c Log Message: Adapt to audio2. - Fix wrong round_blocksize() calculation. ~0x20 -> -0x20. To generate a diff of this commit: cvs rdiff -u -r1.63.2.1 -r1.63.2.2 src/sys/dev/pci/esa.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/pci/esa.c diff -u src/sys/dev/pci/esa.c:1.63.2.1 src/sys/dev/pci/esa.c:1.63.2.2 --- src/sys/dev/pci/esa.c:1.63.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/esa.c Sun Apr 28 03:00:21 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: esa.c,v 1.63.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: esa.c,v 1.63.2.2 2019/04/28 03:00:21 isaki Exp $ */ /* * Copyright (c) 2001-2008 Jared D. McNeill @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: esa.c,v 1.63.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esa.c,v 1.63.2.2 2019/04/28 03:00:21 isaki Exp $"); #include #include @@ -56,8 +56,6 @@ __KERNEL_RCSID(0, "$NetBSD: esa.c,v 1.63 #include #include -#include -#include #include #include @@ -104,10 +102,12 @@ static int esa_detach(device_t, int); static void esa_childdet(device_t, device_t); /* audio(9) functions */ -static int esa_query_encoding(void *, struct audio_encoding *); -static int esa_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int esa_query_format(void *, audio_format_query_t *); +static int esa_set_format(void *, int, + const audio_params_t *, + const audio_params_t *, + audio_filter_reg_t *, + audio_filter_reg_t *); static int esa_round_blocksize(void *, int, int, const audio_params_t *); static int esa_commit_settings(void *); @@ -119,7 +119,6 @@ static int esa_query_devinfo(void *, mi static void * esa_malloc(void *, int, size_t); static void esa_free(void *, void *, size_t); static int esa_getdev(void *, struct audio_device *); -static size_t esa_round_buffersize(void *, int, size_t); static int esa_get_props(void *); static int esa_trigger_output(void *, void *, void *, int, void (*)(void *), void *, @@ -166,45 +165,23 @@ static bool esa_suspend(device_t, const static bool esa_resume(device_t, const pmf_qual_t *); -#define ESA_NENCODINGS 8 -static audio_encoding_t esa_encoding[ESA_NENCODINGS] = { - { 0, AudioEulinear, AUDIO_ENCODING_ULINEAR, 8, 0 }, - { 1, AudioEmulaw, AUDIO_ENCODING_ULAW, 8, - AUDIO_ENCODINGFLAG_EMULATED }, - { 2, AudioEalaw, AUDIO_ENCODING_ALAW, 8, AUDIO_ENCODINGFLAG_EMULATED }, - { 3, AudioEslinear, AUDIO_ENCODING_SLINEAR, 8, - AUDIO_ENCODINGFLAG_EMULATED }, /* XXX: Are you sure? */ - { 4, AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16, 0 }, - { 5, AudioEulinear_le, AUDIO_ENCODING_ULINEAR_LE, 16, - AUDIO_ENCODINGFLAG_EMULATED }, - { 6, AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16, - AUDIO_ENCODINGFLAG_EMULATED }, - { 7, AudioEulinear_be, AUDIO_ENCODING_ULINEAR_BE, 16, - AUDIO_ENCODINGFLAG_EMULATED } -}; - -#define ESA_NFORMATS 4 -#define ESA_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 = { ESA_MINRATE, ESA_MAXRATE }, \ - } -static const struct audio_format esa_formats[ESA_NFORMATS] = { - ESA_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 2, AUFMT_STEREO), - ESA_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 1, AUFMT_MONAURAL), - ESA_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 2, AUFMT_STEREO), - ESA_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 1, AUFMT_MONAURAL), +static const struct audio_format esa_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 = { ESA_MINRATE, ESA_MAXRATE }, + }, }; +#define ESA_NFORMATS __arraycount(esa_formats) static const struct audio_hw_if esa_hw_if = { - .query_encoding = esa_query_encoding, - .set_params = esa_set_params, + .query_format = esa_query_format, + .set_format = esa_set_format, .round_blocksize = esa_round_blocksize, .commit_settings = esa_commit_settings, .halt_output = esa_halt_output, @@ -215,7 +192,6 @@ static const struct audio_hw_if esa_hw_i .query_devinfo = esa_query_devinfo, .allocm = esa_malloc, .freem = esa_free, - .round_buffersize = esa_round_buffersize, .mappage = esa_mappage, .get_props = esa_get_props, .trigger_output = esa_trigger_output, @@ -231,62 +207,24 @@ CFATTACH_DECL2_NEW(esa, sizeof(struct es */ static int -esa_query_encoding(void *hdl, struct audio_encoding *ae) +esa_query_format(void *hdl,
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 03:00:21 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: esa.c Log Message: Adapt to audio2. - Fix wrong round_blocksize() calculation. ~0x20 -> -0x20. To generate a diff of this commit: cvs rdiff -u -r1.63.2.1 -r1.63.2.2 src/sys/dev/pci/esa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 02:19:35 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: cmpci.c Log Message: Adapt to audio2. To generate a diff of this commit: cvs rdiff -u -r1.53.2.1 -r1.53.2.2 src/sys/dev/pci/cmpci.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/pci/cmpci.c diff -u src/sys/dev/pci/cmpci.c:1.53.2.1 src/sys/dev/pci/cmpci.c:1.53.2.2 --- src/sys/dev/pci/cmpci.c:1.53.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/cmpci.c Sun Apr 28 02:19:35 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cmpci.c,v 1.53.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: cmpci.c,v 1.53.2.2 2019/04/28 02:19:35 isaki Exp $ */ /* * Copyright (c) 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cmpci.c,v 1.53.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cmpci.c,v 1.53.2.2 2019/04/28 02:19:35 isaki Exp $"); #if defined(AUDIO_DEBUG) || defined(DEBUG) #define DPRINTF(x) if (cmpcidebug) printf x @@ -68,8 +68,6 @@ int cmpcidebug = 0; #include #include -#include -#include #include #include @@ -128,9 +126,10 @@ static struct cmpci_dmanode * cmpci_find /* * interface to machine independent layer */ -static int cmpci_query_encoding(void *, struct audio_encoding *); -static int cmpci_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, stream_filter_list_t *); +static int cmpci_query_format(void *, audio_format_query_t *); +static int cmpci_set_format(void *, int, +const audio_params_t *, const audio_params_t *, +audio_filter_reg_t *, audio_filter_reg_t *); static int cmpci_round_blocksize(void *, int, int, const audio_params_t *); static int cmpci_halt_output(void *); static int cmpci_halt_input(void *); @@ -141,7 +140,6 @@ static int cmpci_query_devinfo(void *, m static void *cmpci_allocm(void *, int, size_t); static void cmpci_freem(void *, void *, size_t); static size_t cmpci_round_buffersize(void *, int, size_t); -static paddr_t cmpci_mappage(void *, void *, off_t, int); static int cmpci_get_props(void *); static int cmpci_trigger_output(void *, void *, void *, int, void (*)(void *), void *, const audio_params_t *); @@ -150,8 +148,8 @@ static int cmpci_trigger_input(void *, v static void cmpci_get_locks(void *, kmutex_t **, kmutex_t **); static const struct audio_hw_if cmpci_hw_if = { - .query_encoding = cmpci_query_encoding, - .set_params = cmpci_set_params, + .query_format = cmpci_query_format, + .set_format = cmpci_set_format, .round_blocksize = cmpci_round_blocksize, .halt_output = cmpci_halt_output, .halt_input = cmpci_halt_input, @@ -162,31 +160,26 @@ static const struct audio_hw_if cmpci_hw .allocm = cmpci_allocm, .freem = cmpci_freem, .round_buffersize = cmpci_round_buffersize, - .mappage = cmpci_mappage, .get_props = cmpci_get_props, .trigger_output = cmpci_trigger_output, .trigger_input = cmpci_trigger_input, .get_locks = cmpci_get_locks, }; -#define CMPCI_NFORMATS 4 -#define CMPCI_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 = { 5512, 48000 }, \ - } -static const struct audio_format cmpci_formats[CMPCI_NFORMATS] = { - CMPCI_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 2, AUFMT_STEREO), - CMPCI_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 1, AUFMT_MONAURAL), - CMPCI_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 2, AUFMT_STEREO), - CMPCI_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 1, AUFMT_MONAURAL), +static const struct audio_format cmpci_formats[] = { + { + .mode = AUMODE_PLAY | AUMODE_RECORD, + .encoding = AUDIO_ENCODING_SLINEAR_LE, + .validbits = 16, + .precision = 16, + .channels = 2, + .channel_mask = AUFMT_STEREO, + .frequency_type = 8, + .frequency = + { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000 }, + }, }; +#define CMPCI_NFORMATS __arraycount(cmpci_formats) /* @@ -330,8 +323,7 @@ cmpci_rate_to_index(int rate) int i; for (i = 0; i < CMPCI_REG_NUMRATE - 1; i++) - if (rate <= - (cmpci_rate_table[i].rate+cmpci_rate_table[i+1].rate) / 2) + if (rate == cmpci_rate_table[i].rate) return i; return i; /* 48000 */ } @@ -572,69 +564,16 @@ cmpci_intr(void *handle) } static int -cmpci_query_encoding(void *handle, struct audio_encoding *fp) +cmpci_query_format(void *handle, audio_format_query_t *afp) { - switch (fp->index) { - case 0: - strcpy(fp->name, AudioEulinear); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 1: - strcpy(fp->name, AudioEmulaw); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags =
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 02:19:35 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: cmpci.c Log Message: Adapt to audio2. To generate a diff of this commit: cvs rdiff -u -r1.53.2.1 -r1.53.2.2 src/sys/dev/pci/cmpci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 02:15:32 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: azalia.c azalia.h Log Message: Adapt to audio2. To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.86.2.1 src/sys/dev/pci/azalia.c cvs rdiff -u -r1.21 -r1.21.54.1 src/sys/dev/pci/azalia.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/pci/azalia.c diff -u src/sys/dev/pci/azalia.c:1.86 src/sys/dev/pci/azalia.c:1.86.2.1 --- src/sys/dev/pci/azalia.c:1.86 Sat Mar 16 12:09:58 2019 +++ src/sys/dev/pci/azalia.c Sun Apr 28 02:15:32 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: azalia.c,v 1.86 2019/03/16 12:09:58 isaki Exp $ */ +/* $NetBSD: azalia.c,v 1.86.2.1 2019/04/28 02:15:32 isaki Exp $ */ /*- * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: azalia.c,v 1.86 2019/03/16 12:09:58 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: azalia.c,v 1.86.2.1 2019/04/28 02:15:32 isaki Exp $"); #include #include @@ -51,7 +51,6 @@ __KERNEL_RCSID(0, "$NetBSD: azalia.c,v 1 #include #include -#include #include #include @@ -205,9 +204,10 @@ static int azalia_stream_intr(stream_t * static int azalia_open(void *, int); static void azalia_close(void *); -static int azalia_query_encoding(void *, audio_encoding_t *); -static int azalia_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, stream_filter_list_t *); +static int azalia_query_format(void *, audio_format_query_t *); +static int azalia_set_format(void *, int, +const audio_params_t *, const audio_params_t *, +audio_filter_reg_t *, audio_filter_reg_t *); static int azalia_round_blocksize(void *, int, int, const audio_params_t *); static int azalia_halt_output(void *); static int azalia_halt_input(void *); @@ -235,8 +235,8 @@ CFATTACH_DECL2_NEW(azalia, sizeof(azalia static const struct audio_hw_if azalia_hw_if = { .open = azalia_open, .close = azalia_close, - .query_encoding = azalia_query_encoding, - .set_params = azalia_set_params, + .query_format = azalia_query_format, + .set_format = azalia_set_format, .round_blocksize = azalia_round_blocksize, .halt_output = azalia_halt_output, .halt_input = azalia_halt_input, @@ -1298,8 +1298,6 @@ azalia_codec_delete(codec_t *this) kmem_free(this->formats, this->szformats); this->formats = NULL; } - auconv_delete_encodings(this->encodings); - this->encodings = NULL; if (this->extra != NULL) { kmem_free(this->extra, this->szextra); this->extra = NULL; @@ -1318,7 +1316,7 @@ azalia_codec_construct_format(codec_t *t 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; @@ -1435,10 +1433,6 @@ azalia_codec_construct_format(codec_t *t } #endif - err = auconv_create_encodings(this->formats, this->nformats, - >encodings); - if (err) - return err; return 0; } @@ -2121,39 +2115,22 @@ azalia_close(void *v) } static int -azalia_query_encoding(void *v, audio_encoding_t *enc) +azalia_query_format(void *v, audio_format_query_t *afp) { azalia_t *az; codec_t *codec; az = v; codec = >codecs[az->codecno]; - return auconv_query_encoding(codec->encodings, enc); + return audio_query_format(codec->formats, codec->nformats, afp); } static int -azalia_set_params(void *v, int smode, int umode, audio_params_t *p, -audio_params_t *r, stream_filter_list_t *pfil, stream_filter_list_t *rfil) +azalia_set_format(void *v, int setmode, +const audio_params_t *p, const audio_params_t *r, +audio_filter_reg_t *pfil, audio_filter_reg_t *rfil) { - azalia_t *az; - codec_t *codec; - int index; - az = v; - codec = >codecs[az->codecno]; - smode &= az->mode_cap; - if (smode & AUMODE_RECORD && r != NULL) { - index = auconv_set_converter(codec->formats, codec->nformats, - AUMODE_RECORD, r, TRUE, rfil); - if (index < 0) - return EINVAL; - } - if (smode & AUMODE_PLAY && p != NULL) { - index = auconv_set_converter(codec->formats, codec->nformats, - AUMODE_PLAY, p, TRUE, pfil); - if (index < 0) - return EINVAL; - } return 0; } Index: src/sys/dev/pci/azalia.h diff -u src/sys/dev/pci/azalia.h:1.21 src/sys/dev/pci/azalia.h:1.21.54.1 --- src/sys/dev/pci/azalia.h:1.21 Wed Nov 23 23:07:35 2011 +++ src/sys/dev/pci/azalia.h Sun Apr 28 02:15:32 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: azalia.h,v 1.21 2011/11/23 23:07:35 jmcneill Exp $ */ +/* $NetBSD: azalia.h,v 1.21.54.1 2019/04/28 02:15:32 isaki Exp $ */ /*- * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc. @@ -584,7 +584,6 @@ typedef struct codec_t { struct audio_format *formats; int nformats; size_t szformats; - struct audio_encoding_set *encodings; uint32_t *extra; size_t szextra;
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 28 02:15:32 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: azalia.c azalia.h Log Message: Adapt to audio2. To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.86.2.1 src/sys/dev/pci/azalia.c cvs rdiff -u -r1.21 -r1.21.54.1 src/sys/dev/pci/azalia.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Apr 27 13:52:55 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: auvia.c auviavar.h Log Message: Adapt to audio2. - auvia_set_params_sub is also renamed because caller auvia_set_params is renamed to auvia_set_format. To generate a diff of this commit: cvs rdiff -u -r1.82.2.1 -r1.82.2.2 src/sys/dev/pci/auvia.c cvs rdiff -u -r1.16 -r1.16.54.1 src/sys/dev/pci/auviavar.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/pci/auvia.c diff -u src/sys/dev/pci/auvia.c:1.82.2.1 src/sys/dev/pci/auvia.c:1.82.2.2 --- src/sys/dev/pci/auvia.c:1.82.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/auvia.c Sat Apr 27 13:52:55 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: auvia.c,v 1.82.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: auvia.c,v 1.82.2.2 2019/04/27 13:52:55 isaki Exp $ */ /*- * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.82.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.82.2.2 2019/04/27 13:52:55 isaki Exp $"); #include #include @@ -52,8 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1. #include #include -#include -#include #include #include @@ -85,13 +83,13 @@ static int auvia_detach(device_t, int); static void auvia_childdet(device_t, device_t); static int auvia_open(void *, int); static void auvia_close(void *); -static int auvia_query_encoding(void *, struct audio_encoding *); -static void auvia_set_params_sub(struct auvia_softc *, +static int auvia_query_format(void *, audio_format_query_t *); +static void auvia_set_format_sub(struct auvia_softc *, struct auvia_softc_chan *, const audio_params_t *); -static int auvia_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int auvia_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int auvia_round_blocksize(void *, int, int, const audio_params_t *); static int auvia_halt_output(void *); static int auvia_halt_input(void *); @@ -101,8 +99,6 @@ static int auvia_get_port(void *, mixer_ static int auvia_query_devinfo(void *, mixer_devinfo_t *); static void * auvia_malloc(void *, int, size_t); static void auvia_free(void *, void *, size_t); -static size_t auvia_round_buffersize(void *, int, size_t); -static paddr_t auvia_mappage(void *, void *, off_t, int); static int auvia_get_props(void *); static int auvia_build_dma_ops(struct auvia_softc *, struct auvia_softc_chan *, @@ -212,8 +208,8 @@ CFATTACH_DECL2_NEW(auvia, sizeof (struct static const struct audio_hw_if auvia_hw_if = { .open = auvia_open, .close = auvia_close, - .query_encoding = auvia_query_encoding, - .set_params = auvia_set_params, + .query_format = auvia_query_format, + .set_format = auvia_set_format, .round_blocksize = auvia_round_blocksize, .halt_output = auvia_halt_output, .halt_input = auvia_halt_input, @@ -223,19 +219,15 @@ static const struct audio_hw_if auvia_hw .query_devinfo = auvia_query_devinfo, .allocm = auvia_malloc, .freem = auvia_free, - .round_buffersize = auvia_round_buffersize, - .mappage = auvia_mappage, .get_props = auvia_get_props, .trigger_output = auvia_trigger_output, .trigger_input = auvia_trigger_input, .get_locks = auvia_get_locks, }; -#define AUVIA_FORMATS_4CH_16 2 -#define AUVIA_FORMATS_6CH_16 3 -#define AUVIA_FORMATS_4CH_8 6 -#define AUVIA_FORMATS_6CH_8 7 -#define AUVIA_FORMAT_S16(aumode, ch, chmask) \ +#define AUVIA_FORMATS_4CH 2 +#define AUVIA_FORMATS_6CH 3 +#define AUVIA_FORMAT(aumode, ch, chmask) \ { \ .mode = (aumode), \ .encoding = AUDIO_ENCODING_SLINEAR_LE, \ @@ -246,26 +238,11 @@ static const struct audio_hw_if auvia_hw .frequency_type = 0, \ .frequency = { 4000, 48000 }, \ } -#define AUVIA_FORMAT_U8(aumode, ch, chmask) \ - { \ - .mode = (aumode), \ - .encoding = AUDIO_ENCODING_ULINEAR_LE, \ - .validbits = 8, \ - .precision = 8, \ - .channels = (ch), \ - .channel_mask = (chmask), \ - .frequency_type = 0, \ - .frequency = { 4000, 48000 }, \ - } static const struct audio_format auvia_formats[AUVIA_NFORMATS] = { - AUVIA_FORMAT_S16(AUMODE_PLAY | AUMODE_RECORD, 1, AUFMT_MONAURAL), - AUVIA_FORMAT_S16(AUMODE_PLAY | AUMODE_RECORD, 2, AUFMT_STEREO), - AUVIA_FORMAT_S16(AUMODE_PLAY, 4, AUFMT_SURROUND4), - AUVIA_FORMAT_S16(AUMODE_PLAY, 6, AUFMT_DOLBY_5_1), - AUVIA_FORMAT_U8 (AUMODE_PLAY | AUMODE_RECORD, 1, AUFMT_MONAURAL), - AUVIA_FORMAT_U8 (AUMODE_PLAY | AUMODE_RECORD, 2, AUFMT_STEREO), - AUVIA_FORMAT_U8 (AUMODE_PLAY, 4, AUFMT_SURROUND4), - AUVIA_FORMAT_U8 (AUMODE_PLAY, 6, AUFMT_DOLBY_5_1), + AUVIA_FORMAT(AUMODE_PLAY |
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Apr 27 13:52:55 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: auvia.c auviavar.h Log Message: Adapt to audio2. - auvia_set_params_sub is also renamed because caller auvia_set_params is renamed to auvia_set_format. To generate a diff of this commit: cvs rdiff -u -r1.82.2.1 -r1.82.2.2 src/sys/dev/pci/auvia.c cvs rdiff -u -r1.16 -r1.16.54.1 src/sys/dev/pci/auviavar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Apr 27 13:44:32 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: autri.c Log Message: More adapt to audio2. - Shrink autri_formats[]. HW actually supports frequencies other than 48kHz but they may include (ignorable) rounding error in thier calculation. So accept only 48kHz. It's enough. - Remove obsoleted and empty methods. To generate a diff of this commit: cvs rdiff -u -r1.56.2.2 -r1.56.2.3 src/sys/dev/pci/autri.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/pci/autri.c diff -u src/sys/dev/pci/autri.c:1.56.2.2 src/sys/dev/pci/autri.c:1.56.2.3 --- src/sys/dev/pci/autri.c:1.56.2.2 Sat Apr 27 13:25:33 2019 +++ src/sys/dev/pci/autri.c Sat Apr 27 13:44:32 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: autri.c,v 1.56.2.2 2019/04/27 13:25:33 isaki Exp $ */ +/* $NetBSD: autri.c,v 1.56.2.3 2019/04/27 13:44:32 isaki Exp $ */ /* * Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autri.c,v 1.56.2.2 2019/04/27 13:25:33 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autri.c,v 1.56.2.3 2019/04/27 13:44:32 isaki Exp $"); #include "midi.h" @@ -127,8 +127,6 @@ static int autri_mixer_set_port(void *, static int autri_mixer_get_port(void *, mixer_ctrl_t *); static void* autri_malloc(void *, int, size_t); static void autri_free(void *, void *, size_t); -static size_t autri_round_buffersize(void *, int, size_t); -static paddr_t autri_mappage(void *, void *, off_t, int); static int autri_get_props(void *); static int autri_query_devinfo(void *, mixer_devinfo_t *); static void autri_get_locks(void *, kmutex_t **, kmutex_t **); @@ -146,8 +144,6 @@ static const struct audio_hw_if autri_hw .query_devinfo = autri_query_devinfo, .allocm = autri_malloc, .freem = autri_free, - .round_buffersize = autri_round_buffersize, - .mappage = autri_mappage, .get_props = autri_get_props, .trigger_output = autri_trigger_output, .trigger_input = autri_trigger_input, @@ -171,28 +167,23 @@ static const struct midi_hw_if autri_mid }; #endif -#define AUTRI_NFORMATS 8 -#define AUTRI_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 = { 4000, 48000 }, \ - } -static const struct audio_format autri_formats[AUTRI_NFORMATS] = { - AUTRI_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 2, AUFMT_STEREO), - AUTRI_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16, 1, AUFMT_MONAURAL), - AUTRI_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 16, 2, AUFMT_STEREO), - AUTRI_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 16, 1, AUFMT_MONAURAL), - AUTRI_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 2, AUFMT_STEREO), - AUTRI_FORMAT(AUDIO_ENCODING_ULINEAR_LE, 8, 1, AUFMT_MONAURAL), - AUTRI_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 8, 2, AUFMT_STEREO), - AUTRI_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 8, 1, AUFMT_MONAURAL), +/* + * The hardware actually supports frequencies other than 48kHz. But + * 48kHz is the basis frequency of this hardware and it's enough. + */ +static const struct audio_format autri_formats[] = { + { + .mode = AUMODE_PLAY | AUMODE_RECORD, + .encoding = AUDIO_ENCODING_SLINEAR_LE, + .validbits = 16, + .precision = 16, + .channels = 2, + .channel_mask = AUFMT_STEREO, + .frequency_type = 1, + .frequency = { 48000 }, + }, }; +#define AUTRI_NFORMATS __arraycount(autri_formats) /* * register set/clear bit @@ -1067,30 +1058,6 @@ autri_find_dma(struct autri_softc *sc, v return p; } -static size_t -autri_round_buffersize(void *addr, int direction, size_t size) -{ - - return size; -} - -static paddr_t -autri_mappage(void *addr, void *mem, off_t off, int prot) -{ - struct autri_softc *sc; - struct autri_dma *p; - - if (off < 0) - return -1; - sc = addr; - 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); -} - static int autri_get_props(void *addr) {
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Apr 27 13:44:32 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: autri.c Log Message: More adapt to audio2. - Shrink autri_formats[]. HW actually supports frequencies other than 48kHz but they may include (ignorable) rounding error in thier calculation. So accept only 48kHz. It's enough. - Remove obsoleted and empty methods. To generate a diff of this commit: cvs rdiff -u -r1.56.2.2 -r1.56.2.3 src/sys/dev/pci/autri.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Apr 27 13:25:33 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: autri.c Log Message: Adapt to audio2. Tested on sparc64 by macallan@. Thank you. To generate a diff of this commit: cvs rdiff -u -r1.56.2.1 -r1.56.2.2 src/sys/dev/pci/autri.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/pci/autri.c diff -u src/sys/dev/pci/autri.c:1.56.2.1 src/sys/dev/pci/autri.c:1.56.2.2 --- src/sys/dev/pci/autri.c:1.56.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/autri.c Sat Apr 27 13:25:33 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: autri.c,v 1.56.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: autri.c,v 1.56.2.2 2019/04/27 13:25:33 isaki Exp $ */ /* * Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autri.c,v 1.56.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autri.c,v 1.56.2.2 2019/04/27 13:25:33 isaki Exp $"); #include "midi.h" @@ -52,8 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: autri.c,v 1. #include #include -#include -#include #include #include @@ -111,10 +109,10 @@ static void autri_disable_loop_interrupt #endif static int autri_open(void *, int); -static int autri_query_encoding(void *, struct audio_encoding *); -static int autri_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int autri_query_format(void *, audio_format_query_t *); +static int autri_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int autri_round_blocksize(void *, int, int, const audio_params_t *); static int autri_trigger_output(void *, void *, void *, int, void (*)(void *), void *, @@ -137,8 +135,8 @@ static void autri_get_locks(void *, kmut static const struct audio_hw_if autri_hw_if = { .open = autri_open, - .query_encoding = autri_query_encoding, - .set_params = autri_set_params, + .query_format = autri_query_format, + .set_format = autri_set_format, .round_blocksize = autri_round_blocksize, .halt_output = autri_halt_output, .halt_input = autri_halt_input, @@ -907,80 +905,18 @@ autri_open(void *addr, int flags) } static int -autri_query_encoding(void *addr, struct audio_encoding *fp) +autri_query_format(void *addr, audio_format_query_t *afp) { - switch (fp->index) { - case 0: - strcpy(fp->name, AudioEulinear); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strcpy(fp->name, AudioEmulaw); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 2: - strcpy(fp->name, AudioEalaw); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 3: - strcpy(fp->name, AudioEslinear); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 4: - strcpy(fp->name, AudioEslinear_le); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 5: - strcpy(fp->name, AudioEulinear_le); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 6: - strcpy(fp->name, AudioEslinear_be); - fp->encoding = AUDIO_ENCODING_SLINEAR_BE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 7: - strcpy(fp->name, AudioEulinear_be); - fp->encoding = AUDIO_ENCODING_ULINEAR_BE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - default: - return EINVAL; - } - - return 0; + return audio_query_format(autri_formats, AUTRI_NFORMATS, afp); } static int -autri_set_params(void *addr, int setmode, int usemode, -audio_params_t *play, audio_params_t *rec, stream_filter_list_t *pfil, -stream_filter_list_t *rfil) -{ - if (setmode & AUMODE_RECORD) { - if (auconv_set_converter(autri_formats, AUTRI_NFORMATS, - AUMODE_RECORD, rec, FALSE, rfil) < 0) - return EINVAL; - } - if (setmode & AUMODE_PLAY) { - if (auconv_set_converter(autri_formats, AUTRI_NFORMATS, - AUMODE_PLAY, play, FALSE, pfil) < 0) - return EINVAL; - } +autri_set_format(void *addr, int setmode, +const audio_params_t *play, const audio_params_t *rec, +audio_filter_reg_t *pfil, audio_filter_reg_t *rfil) +{ + return 0; }
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Apr 27 13:25:33 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: autri.c Log Message: Adapt to audio2. Tested on sparc64 by macallan@. Thank you. To generate a diff of this commit: cvs rdiff -u -r1.56.2.1 -r1.56.2.2 src/sys/dev/pci/autri.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Apr 27 13:10:03 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: auixp.c auixpvar.h Log Message: Adapt to audio2. - Move auixp_formats' definition from header to source. - Make compilable even with DEBUG_AUIXP. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.45.2.1 src/sys/dev/pci/auixp.c cvs rdiff -u -r1.8.42.1 -r1.8.42.2 src/sys/dev/pci/auixpvar.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/pci/auixp.c diff -u src/sys/dev/pci/auixp.c:1.45 src/sys/dev/pci/auixp.c:1.45.2.1 --- src/sys/dev/pci/auixp.c:1.45 Sat Mar 16 12:09:58 2019 +++ src/sys/dev/pci/auixp.c Sat Apr 27 13:10:03 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: auixp.c,v 1.45 2019/03/16 12:09:58 isaki Exp $ */ +/* $NetBSD: auixp.c,v 1.45.2.1 2019/04/27 13:10:03 isaki Exp $ */ /* * Copyright (c) 2004, 2005 Reinoud Zandijk @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1.45 2019/03/16 12:09:58 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1.45.2.1 2019/04/27 13:10:03 isaki Exp $"); #include #include @@ -68,8 +68,6 @@ __KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1. #include #include -#include -#include #include #include @@ -119,6 +117,25 @@ struct audio_device auixp_device = { "auixp" }; +/* + * current AC'97 driver only supports SPDIF outputting channel 3&4 i.e. STEREO + */ +#define AUIXP_FORMAT(aumode, ch, chmask) \ + { \ + .mode = (aumode), \ + .encoding = AUDIO_ENCODING_SLINEAR_LE, \ + .validbits = 16, \ + .precision = 16, \ + .channels = (ch), \ + .channel_mask = (chmask), \ + .frequency_type = 0, \ + .frequency = { 7000, 48000 }, \ + } +static const struct audio_format auixp_formats[AUIXP_NFORMATS] = { + AUIXP_FORMAT(AUMODE_PLAY | AUMODE_RECORD, 2, AUFMT_STEREO), + AUIXP_FORMAT(AUMODE_PLAY, 4, AUFMT_SURROUND4), + AUIXP_FORMAT(AUMODE_PLAY, 6, AUFMT_DOLBY_5_1), +}; /* codec detection constant indicating the interrupt flags */ #define ALL_CODECS_NOT_READY \ @@ -135,10 +152,10 @@ static int auixp_detach(device_t, int); /* audio(9) function prototypes */ -static int auixp_query_encoding(void *, struct audio_encoding *); -static int auixp_set_params(void *, int, int, audio_params_t *, - audio_params_t *, - stream_filter_list_t *, stream_filter_list_t *); +static int auixp_query_format(void *, audio_format_query_t *); +static int auixp_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int auixp_commit_settings(void *); static int auixp_round_blocksize(void *, int, int, const audio_params_t *); static int auixp_trigger_output(void *, void *, void *, int, @@ -161,7 +178,6 @@ static int auixp_intr(void *); static int auixp_allocmem(struct auixp_softc *, size_t, size_t, struct auixp_dma *); static int auixp_freemem(struct auixp_softc *, struct auixp_dma *); -static paddr_t auixp_mappage(void *, void *, off_t, int); /* Supporting subroutines */ static int auixp_init(struct auixp_softc *); @@ -199,7 +215,7 @@ static bool auixp_resume(device_t, const #ifdef DEBUG_AUIXP static struct auixp_softc *static_sc; -static void auixp_dumpreg(void); +static void auixp_dumpreg(void) __unused; # define DPRINTF(x) printf x; #else # define DPRINTF(x) @@ -207,8 +223,8 @@ static void auixp_dumpreg(void); static const struct audio_hw_if auixp_hw_if = { - .query_encoding = auixp_query_encoding, - .set_params = auixp_set_params, + .query_format = auixp_query_format, + .set_format = auixp_set_format, .round_blocksize = auixp_round_blocksize, .commit_settings = auixp_commit_settings, .halt_output = auixp_halt_output, @@ -220,7 +236,6 @@ static const struct audio_hw_if auixp_hw .allocm = auixp_malloc, .freem = auixp_free, .round_buffersize = auixp_round_buffersize, - .mappage = auixp_mappage, .get_props = auixp_get_props, .trigger_output = auixp_trigger_output, .trigger_input = auixp_trigger_input, @@ -237,14 +252,14 @@ CFATTACH_DECL_NEW(auixp, sizeof(struct a */ static int -auixp_query_encoding(void *hdl, struct audio_encoding *ae) +auixp_query_format(void *hdl, audio_format_query_t *afp) { struct auixp_codec *co; struct auixp_softc *sc; co = (struct auixp_codec *) hdl; sc = co->sc; - return auconv_query_encoding(sc->sc_encodings, ae); + return audio_query_format(sc->sc_formats, AUIXP_NFORMATS, afp); } @@ -365,14 +380,13 @@ auixp_commit_settings(void *hdl) /* set audio properties in desired setting */ static int -auixp_set_params(void *hdl, int setmode, int usemode, -audio_params_t *play, audio_params_t *rec, stream_filter_list_t *pfil, -stream_filter_list_t *rfil) +auixp_set_format(void *hdl, int setmode, +const audio_params_t *play, const audio_params_t *rec, +audio_filter_reg_t *pfil, audio_filter_reg_t
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Apr 27 13:10:03 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: auixp.c auixpvar.h Log Message: Adapt to audio2. - Move auixp_formats' definition from header to source. - Make compilable even with DEBUG_AUIXP. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.45.2.1 src/sys/dev/pci/auixp.c cvs rdiff -u -r1.8.42.1 -r1.8.42.2 src/sys/dev/pci/auixpvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Apr 27 12:57:54 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: auacer.c Log Message: Adapt to audio2. To generate a diff of this commit: cvs rdiff -u -r1.36.2.1 -r1.36.2.2 src/sys/dev/pci/auacer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Apr 27 12:57:54 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: auacer.c Log Message: Adapt to audio2. To generate a diff of this commit: cvs rdiff -u -r1.36.2.1 -r1.36.2.2 src/sys/dev/pci/auacer.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/pci/auacer.c diff -u src/sys/dev/pci/auacer.c:1.36.2.1 src/sys/dev/pci/auacer.c:1.36.2.2 --- src/sys/dev/pci/auacer.c:1.36.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/auacer.c Sat Apr 27 12:57:54 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: auacer.c,v 1.36.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: auacer.c,v 1.36.2.2 2019/04/27 12:57:54 isaki Exp $ */ /*- * Copyright (c) 2004, 2008 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1.36.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1.36.2.2 2019/04/27 12:57:54 isaki Exp $"); #include #include @@ -60,8 +60,6 @@ __KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1 #include #include -#include -#include #include @@ -128,7 +126,6 @@ struct auacer_softc { #define AUACER_NFORMATS 3 struct audio_format sc_formats[AUACER_NFORMATS]; - struct audio_encoding_set *sc_encodings; }; #define READ1(sc, a) bus_space_read_1(sc->iot, sc->aud_ioh, a) @@ -153,10 +150,10 @@ int auacer_debug = 0; static int auacer_intr(void *); -static int auacer_query_encoding(void *, struct audio_encoding *); -static int auacer_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int auacer_query_format(void *, audio_format_query_t *); +static int auacer_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int auacer_round_blocksize(void *, int, int, const audio_params_t *); static int auacer_halt_output(void *); @@ -168,7 +165,6 @@ static int auacer_query_devinfo(void *, static void *auacer_allocm(void *, int, size_t); static void auacer_freem(void *, void *, size_t); static size_t auacer_round_buffersize(void *, int, size_t); -static paddr_t auacer_mappage(void *, void *, off_t, int); static int auacer_get_props(void *); static int auacer_trigger_output(void *, void *, void *, int, void (*)(void *), void *, @@ -190,8 +186,8 @@ static int auacer_set_rate(struct auacer static void auacer_reset(struct auacer_softc *sc); static const struct audio_hw_if auacer_hw_if = { - .query_encoding = auacer_query_encoding, - .set_params = auacer_set_params, + .query_format = auacer_query_format, + .set_format = auacer_set_format, .round_blocksize = auacer_round_blocksize, .halt_output = auacer_halt_output, .halt_input = auacer_halt_input, @@ -202,7 +198,6 @@ static const struct audio_hw_if auacer_h .allocm = auacer_allocm, .freem = auacer_freem, .round_buffersize = auacer_round_buffersize, - .mappage = auacer_mappage, .get_props = auacer_get_props, .trigger_output = auacer_trigger_output, .trigger_input = auacer_trigger_input, @@ -219,8 +214,9 @@ static const struct audio_hw_if auacer_h .precision = 16, \ .channels = (ch), \ .channel_mask = (chmask), \ - .frequency_type = 0, \ - .frequency = { 8000, 48000 }, \ + .frequency_type = 9, \ + .frequency = { 8000, 11025, 12000, 16000, 22050, \ + 24000, 32000, 44100, 48000, }, \ } static const struct audio_format auacer_formats[AUACER_NFORMATS] = { AUACER_FORMAT(AUMODE_PLAY | AUMODE_RECORD, 2, AUFMT_STEREO), @@ -342,16 +338,7 @@ auacer_attach(device_t parent, device_t sc->sc_formats[i].frequency[0] = 48000; } } - mutex_exit(>sc_lock); - - if (0 != auconv_create_encodings(sc->sc_formats, AUACER_NFORMATS, - >sc_encodings)) { - mutex_destroy(>sc_lock); - mutex_destroy(>sc_intr_lock); - return; - } - mutex_enter(>sc_lock); mutex_spin_enter(>sc_intr_lock); auacer_reset(sc); mutex_spin_exit(>sc_intr_lock); @@ -500,13 +487,13 @@ auacer_reset(struct auacer_softc *sc) } static int -auacer_query_encoding(void *v, struct audio_encoding *aep) +auacer_query_format(void *v, audio_format_query_t *afp) { struct auacer_softc *sc; - DPRINTF(ALI_DEBUG_API, ("auacer_query_encoding\n")); + DPRINTF(ALI_DEBUG_API, ("%s\n", __func__)); sc = v; - return auconv_query_encoding(sc->sc_encodings, aep); + return audio_query_format(sc->sc_formats, AUACER_NFORMATS, afp); } static int @@ -537,17 +524,16 @@ auacer_set_rate(struct auacer_softc *sc, } static int -auacer_set_params(void *v, int setmode, int usemode, -audio_params_t *play, audio_params_t *rec, stream_filter_list_t *pfil, -stream_filter_list_t *rfil) +auacer_set_format(void *v, int setmode, +const audio_params_t *play, const audio_params_t *rec, +audio_filter_reg_t *pfil,
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Apr 27 12:53:37 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: auich.c Log Message: Adapt to audio2. - Correct frequency_type in modem_audio_format. - {spdif,modem}_audio_format in my previous commit (in this branch) was also wrong. :( To generate a diff of this commit: cvs rdiff -u -r1.154.2.1 -r1.154.2.2 src/sys/dev/pci/auich.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Apr 27 12:53:37 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: auich.c Log Message: Adapt to audio2. - Correct frequency_type in modem_audio_format. - {spdif,modem}_audio_format in my previous commit (in this branch) was also wrong. :( To generate a diff of this commit: cvs rdiff -u -r1.154.2.1 -r1.154.2.2 src/sys/dev/pci/auich.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/pci/auich.c diff -u src/sys/dev/pci/auich.c:1.154.2.1 src/sys/dev/pci/auich.c:1.154.2.2 --- src/sys/dev/pci/auich.c:1.154.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/auich.c Sat Apr 27 12:53:37 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: auich.c,v 1.154.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: auich.c,v 1.154.2.2 2019/04/27 12:53:37 isaki Exp $ */ /*- * Copyright (c) 2000, 2004, 2005, 2008 The NetBSD Foundation, Inc. @@ -111,7 +111,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.154.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.154.2.2 2019/04/27 12:53:37 isaki Exp $"); #include #include @@ -130,8 +130,6 @@ __KERNEL_RCSID(0, "$NetBSD: auich.c,v 1. #include #include -#include -#include #include #include @@ -231,8 +229,6 @@ struct auich_softc { #define AUICH_MODEM_NFORMATS 1 struct audio_format sc_audio_formats[AUICH_AUDIO_NFORMATS]; struct audio_format sc_modem_formats[AUICH_MODEM_NFORMATS]; - struct audio_encoding_set *sc_encodings; - struct audio_encoding_set *sc_spdif_encodings; int sc_cas_been_used; }; @@ -259,10 +255,10 @@ CFATTACH_DECL2_NEW(auich, sizeof(struct static int auich_open(void *, int); static void auich_close(void *); -static int auich_query_encoding(void *, struct audio_encoding *); -static int auich_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int auich_query_format(void *, struct audio_format_query *); +static int auich_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int auich_round_blocksize(void *, int, int, const audio_params_t *); static void auich_halt_pipe(struct auich_softc *, int); static int auich_halt_output(void *); @@ -274,7 +270,6 @@ static int auich_query_devinfo(void *, m static void *auich_allocm(void *, int, size_t); static void auich_freem(void *, void *, size_t); static size_t auich_round_buffersize(void *, int, size_t); -static paddr_t auich_mappage(void *, void *, off_t, int); static int auich_get_props(void *); static void auich_trigger_pipe(struct auich_softc *, int, struct auich_ring *); static void auich_intr_pipe(struct auich_softc *, int, struct auich_ring *); @@ -307,8 +302,8 @@ static void auich_spdif_event(void *, bo static const struct audio_hw_if auich_hw_if = { .open = auich_open, .close = auich_close, - .query_encoding = auich_query_encoding, - .set_params = auich_set_params, + .query_format = auich_query_format, + .set_format = auich_set_format, .round_blocksize = auich_round_blocksize, .halt_output = auich_halt_output, .halt_input = auich_halt_input, @@ -319,7 +314,6 @@ static const struct audio_hw_if auich_hw .allocm = auich_allocm, .freem = auich_freem, .round_buffersize = auich_round_buffersize, - .mappage = auich_mappage, .get_props = auich_get_props, .trigger_output = auich_trigger_output, .trigger_input = auich_trigger_input, @@ -348,11 +342,29 @@ static const struct audio_format auich_a #define AUICH_SPDIF_NFORMATS 1 static const struct audio_format auich_spdif_formats[AUICH_SPDIF_NFORMATS] = { - AUICH_FORMAT(AUMODE_PLAY | AUMODE_RECORD, 2, AUFMT_STEREO), + { + .mode = AUMODE_PLAY | AUMODE_RECORD, + .encoding = AUDIO_ENCODING_SLINEAR_LE, + .validbits = 16, + .precision = 16, + .channels = 2, + .channel_mask = AUFMT_STEREO, + .frequency_type = 1, + .frequency = { 48000 }, + }, }; static const struct audio_format auich_modem_formats[AUICH_MODEM_NFORMATS] = { - AUICH_FORMAT(AUMODE_PLAY | AUMODE_RECORD, 1, AUFMT_MONAURAL), + { + .mode = AUMODE_PLAY | AUMODE_RECORD, + .encoding = AUDIO_ENCODING_SLINEAR_LE, + .validbits = 16, + .precision = 16, + .channels = 1, + .channel_mask = AUFMT_MONAURAL, + .frequency_type = 2, + .frequency = { 8000, 16000 }, + }, }; #define PCI_ID_CODE0(v, p) PCI_ID_CODE(PCI_VENDOR_##v, PCI_PRODUCT_##v##_##p) @@ -636,19 +648,10 @@ map_done: } } mutex_exit(>sc_lock); - if (0 != auconv_create_encodings(sc->sc_audio_formats, - AUICH_AUDIO_NFORMATS, >sc_encodings)) - return; - if (0 != auconv_create_encodings(auich_spdif_formats, - AUICH_SPDIF_NFORMATS, >sc_spdif_encodings)) - return; } else { mutex_exit(>sc_lock); memcpy(sc->sc_modem_formats, auich_modem_formats,
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 21 07:59:01 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: emuxki.c Log Message: Make it compilable (on this branch). flags here is F(READ|WRITE), not AUOPEN_(READ|WRITE). To generate a diff of this commit: cvs rdiff -u -r1.67.2.1 -r1.67.2.2 src/sys/dev/pci/emuxki.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 21 07:59:01 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: emuxki.c Log Message: Make it compilable (on this branch). flags here is F(READ|WRITE), not AUOPEN_(READ|WRITE). To generate a diff of this commit: cvs rdiff -u -r1.67.2.1 -r1.67.2.2 src/sys/dev/pci/emuxki.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/pci/emuxki.c diff -u src/sys/dev/pci/emuxki.c:1.67.2.1 src/sys/dev/pci/emuxki.c:1.67.2.2 --- src/sys/dev/pci/emuxki.c:1.67.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/emuxki.c Sun Apr 21 07:59:01 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: emuxki.c,v 1.67.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: emuxki.c,v 1.67.2.2 2019/04/21 07:59:01 isaki Exp $ */ /*- * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc. @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.67.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.67.2.2 2019/04/21 07:59:01 isaki Exp $"); #include #include @@ -60,6 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1 #include #include #include +#include #include #include @@ -2043,7 +2044,7 @@ emuxki_open(void *addr, int flags) * recording source(s) which is necessary when setting recording * params This will be addressed very soon */ - if (flags & AUOPEN_READ) { + if (flags & FREAD) { sc->rvoice = emuxki_voice_new(sc, 0 /* EMU_VOICE_USE_RECORD */); if (sc->rvoice == NULL) return EBUSY; @@ -2052,7 +2053,7 @@ emuxki_open(void *addr, int flags) sc->rvoice->dataloc.source = EMU_RECSRC_ADC; } - if (flags & AUOPEN_WRITE) { + if (flags & FWRITE) { sc->pvoice = emuxki_voice_new(sc, EMU_VOICE_USE_PLAY); if (sc->pvoice == NULL) { if (sc->rvoice) {
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 21 07:55:25 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: eap.c Log Message: Adapt to audio2. - Drop INDEPENDENT property from es1370 which has only one clock. To generate a diff of this commit: cvs rdiff -u -r1.99.2.1 -r1.99.2.2 src/sys/dev/pci/eap.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/pci/eap.c diff -u src/sys/dev/pci/eap.c:1.99.2.1 src/sys/dev/pci/eap.c:1.99.2.2 --- src/sys/dev/pci/eap.c:1.99.2.1 Sun Apr 21 05:11:22 2019 +++ src/sys/dev/pci/eap.c Sun Apr 21 07:55:25 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: eap.c,v 1.99.2.1 2019/04/21 05:11:22 isaki Exp $ */ +/* $NetBSD: eap.c,v 1.99.2.2 2019/04/21 07:55:25 isaki Exp $ */ /* $OpenBSD: eap.c,v 1.6 1999/10/05 19:24:42 csapuntz Exp $ */ /* @@ -51,7 +51,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.99.2.1 2019/04/21 05:11:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.99.2.2 2019/04/21 07:55:25 isaki Exp $"); #include "midi.h" #include "joy_eap.h" @@ -69,10 +69,8 @@ __KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.99 #include #include -#include -#include -#include #include +#include #include #include @@ -110,11 +108,10 @@ CFATTACH_DECL_NEW(eap, sizeof(struct eap eap_match, eap_attach, eap_detach, NULL); static int eap_open(void *, int); -static int eap_query_encoding(void *, struct audio_encoding *); +static int eap_query_format(void *, struct audio_format_query *); static int eap_set_params(void *, int, int, audio_params_t *, audio_params_t *, stream_filter_list_t *, stream_filter_list_t *); -static int eap_round_blocksize(void *, int, int, const audio_params_t *); static int eap_trigger_output(void *, void *, void *, int, void (*)(void *), void *, const audio_params_t *); @@ -133,7 +130,6 @@ static int eap1370_query_devinfo(void *, static void *eap_malloc(void *, int, size_t); static void eap_free(void *, void *, size_t); static size_t eap_round_buffersize(void *, int, size_t); -static paddr_t eap_mappage(void *, void *, off_t, int); static int eap_get_props(void *); static void eap1370_set_mixer(struct eap_softc *, int, int); static uint32_t eap1371_src_wait(struct eap_softc *); @@ -160,9 +156,8 @@ static void eap_uart_txrdy(struct eap_so static const struct audio_hw_if eap1370_hw_if = { .open = eap_open, - .query_encoding = eap_query_encoding, + .query_format = eap_query_format, .set_params = eap_set_params, - .round_blocksize = eap_round_blocksize, .halt_output = eap_halt_output, .halt_input = eap_halt_input, .getdev = eap_getdev, @@ -172,7 +167,6 @@ static const struct audio_hw_if eap1370_ .allocm = eap_malloc, .freem = eap_free, .round_buffersize = eap_round_buffersize, - .mappage = eap_mappage, .get_props = eap_get_props, .trigger_output = eap_trigger_output, .trigger_input = eap_trigger_input, @@ -181,9 +175,8 @@ static const struct audio_hw_if eap1370_ static const struct audio_hw_if eap1371_hw_if = { .open = eap_open, - .query_encoding = eap_query_encoding, + .query_format = eap_query_format, .set_params = eap_set_params, - .round_blocksize = eap_round_blocksize, .halt_output = eap_halt_output, .halt_input = eap_halt_input, .getdev = eap_getdev, @@ -193,7 +186,6 @@ static const struct audio_hw_if eap1371_ .allocm = eap_malloc, .freem = eap_free, .round_buffersize = eap_round_buffersize, - .mappage = eap_mappage, .get_props = eap_get_props, .trigger_output = eap_trigger_output, .trigger_input = eap_trigger_input, @@ -945,61 +937,10 @@ eap_open(void *addr, int flags) } static int -eap_query_encoding(void *addr, struct audio_encoding *fp) +eap_query_format(void *addr, struct audio_format_query *afp) { - switch (fp->index) { - case 0: - strcpy(fp->name, AudioEulinear); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - return 0; - case 1: - strcpy(fp->name, AudioEmulaw); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - return 0; - case 2: - strcpy(fp->name, AudioEalaw); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - return 0; - case 3: - strcpy(fp->name, AudioEslinear); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - return 0; - case 4: - strcpy(fp->name, AudioEslinear_le); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - return 0; - case 5: - strcpy(fp->name, AudioEulinear_le); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; - fp->precision = 16; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - return 0; - case 6: - strcpy(fp->name, AudioEslinear_be); - fp->encoding = AUDIO_ENCODING_SLINEAR_BE; - fp->precision =
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 21 07:55:25 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: eap.c Log Message: Adapt to audio2. - Drop INDEPENDENT property from es1370 which has only one clock. To generate a diff of this commit: cvs rdiff -u -r1.99.2.1 -r1.99.2.2 src/sys/dev/pci/eap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 21 07:49:16 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: cs4280.c cs4281.c cs428x.c cs428x.h Log Message: Adapt cs428x families to audio2. - recording on cs4280 seems to have its own conversion. I will see it later but first make it compilable. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.71.2.1 src/sys/dev/pci/cs4280.c cvs rdiff -u -r1.54 -r1.54.2.1 src/sys/dev/pci/cs4281.c cvs rdiff -u -r1.18 -r1.18.14.1 src/sys/dev/pci/cs428x.c cvs rdiff -u -r1.16 -r1.16.42.1 src/sys/dev/pci/cs428x.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/pci/cs4280.c diff -u src/sys/dev/pci/cs4280.c:1.71 src/sys/dev/pci/cs4280.c:1.71.2.1 --- src/sys/dev/pci/cs4280.c:1.71 Sat Mar 16 12:09:58 2019 +++ src/sys/dev/pci/cs4280.c Sun Apr 21 07:49:16 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cs4280.c,v 1.71 2019/03/16 12:09:58 isaki Exp $ */ +/* $NetBSD: cs4280.c,v 1.71.2.1 2019/04/21 07:49:16 isaki Exp $ */ /* * Copyright (c) 1999, 2000 Tatoku Ogaito. All rights reserved. @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.71 2019/03/16 12:09:58 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.71.2.1 2019/04/21 07:49:16 isaki Exp $"); #include "midi.h" @@ -70,8 +70,6 @@ __KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1 #include #include -#include -#include #include #include @@ -90,10 +88,10 @@ __KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1 static int cs4280_match(device_t, cfdata_t, void *); static void cs4280_attach(device_t, device_t, void *); static int cs4280_intr(void *); -static int cs4280_query_encoding(void *, struct audio_encoding *); -static int cs4280_set_params(void *, int, int, audio_params_t *, - audio_params_t *, stream_filter_list_t *, - stream_filter_list_t *); +static int cs4280_query_format(void *, audio_format_query_t *); +static int cs4280_set_format(void *, int, + const audio_params_t *, const audio_params_t *, + audio_filter_reg_t *, audio_filter_reg_t *); static int cs4280_halt_output(void *); static int cs4280_halt_input(void *); static int cs4280_getdev(void *, struct audio_device *); @@ -159,8 +157,8 @@ static const struct cs4280_card_t cs4280 #define CS4280_CARDS_SIZE (sizeof(cs4280_cards)/sizeof(cs4280_cards[0])) static const struct audio_hw_if cs4280_hw_if = { - .query_encoding = cs4280_query_encoding, - .set_params = cs4280_set_params, + .query_format = cs4280_query_format, + .set_format = cs4280_set_format, .round_blocksize = cs428x_round_blocksize, .halt_output = cs4280_halt_output, .halt_input = cs4280_halt_input, @@ -171,7 +169,6 @@ static const struct audio_hw_if cs4280_h .allocm = cs428x_malloc, .freem = cs428x_free, .round_buffersize = cs428x_round_buffersize, - .mappage = cs428x_mappage, .get_props = cs428x_get_props, .trigger_output = cs4280_trigger_output, .trigger_input = cs4280_trigger_input, @@ -205,6 +202,26 @@ static struct audio_device cs4280_device "cs4280" }; +/* + * XXX recording must be 16bit stereo and sample rate range from + * 11025Hz to 48000Hz. However, it looks like to work with 8000Hz, + * although data sheets say lower limit is 11025Hz. + * XXX The combination of available formats is complicated, so I use + * a common format only. Please fix it if not suitable. + */ +static const struct audio_format cs4280_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 = { 8000, 48000 }, + } +}; +#define CS4280_NFORMATS __arraycount(cs4280_formats) static int cs4280_match(device_t parent, cfdata_t match, void *aux) @@ -550,161 +567,20 @@ cs4280_intr(void *p) } static int -cs4280_query_encoding(void *addr, struct audio_encoding *fp) +cs4280_query_format(void *addr, audio_format_query_t *afp) { - switch (fp->index) { - case 0: - strcpy(fp->name, AudioEulinear); - fp->encoding = AUDIO_ENCODING_ULINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 1: - strcpy(fp->name, AudioEmulaw); - fp->encoding = AUDIO_ENCODING_ULAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 2: - strcpy(fp->name, AudioEalaw); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; - break; - case 3: - strcpy(fp->name, AudioEslinear); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = 0; - break; - case 4: - strcpy(fp->name, AudioEslinear_le); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; - fp->precision = 16; - fp->flags = 0; - break; - case 5: - strcpy(fp->name, AudioEulinear_le); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; - fp->precision = 16; -
CVS commit: [isaki-audio2] src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sun Apr 21 07:49:16 UTC 2019 Modified Files: src/sys/dev/pci [isaki-audio2]: cs4280.c cs4281.c cs428x.c cs428x.h Log Message: Adapt cs428x families to audio2. - recording on cs4280 seems to have its own conversion. I will see it later but first make it compilable. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.71.2.1 src/sys/dev/pci/cs4280.c cvs rdiff -u -r1.54 -r1.54.2.1 src/sys/dev/pci/cs4281.c cvs rdiff -u -r1.18 -r1.18.14.1 src/sys/dev/pci/cs428x.c cvs rdiff -u -r1.16 -r1.16.42.1 src/sys/dev/pci/cs428x.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.