Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/isaki-audio2]: src/sys/dev/pci More adapt to audio2.
details: https://anonhg.NetBSD.org/src/rev/e2153b8935d8
branches: isaki-audio2
changeset: 450864:e2153b8935d8
user: isaki <isaki%NetBSD.org@localhost>
date: Sat Apr 27 13:44:32 2019 +0000
description:
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.
diffstat:
sys/dev/pci/autri.c | 69 +++++++++++++---------------------------------------
1 files changed, 18 insertions(+), 51 deletions(-)
diffs (112 lines):
diff -r ec258acd73ce -r e2153b8935d8 sys/dev/pci/autri.c
--- a/sys/dev/pci/autri.c Sat Apr 27 13:25:33 2019 +0000
+++ b/sys/dev/pci/autri.c Sat Apr 27 13:44:32 2019 +0000
@@ -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 <sys/cdefs.h>
-__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_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 @@
.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 @@
};
#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 @@
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)
{
Home |
Main Index |
Thread Index |
Old Index