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 Adapt to audio2.
details: https://anonhg.NetBSD.org/src/rev/fa20733225cc
branches: isaki-audio2
changeset: 450909:fa20733225cc
user: isaki <isaki%NetBSD.org@localhost>
date: Mon Apr 29 09:32:07 2019 +0000
description:
Adapt to audio2.
diffstat:
sys/dev/pci/yds.c | 91 +++++++++++++--------------------------------------
sys/dev/pci/ydsvar.h | 4 +-
2 files changed, 25 insertions(+), 70 deletions(-)
diffs (193 lines):
diff -r 14e40c269bd9 -r fa20733225cc sys/dev/pci/yds.c
--- a/sys/dev/pci/yds.c Mon Apr 29 09:30:18 2019 +0000
+++ b/sys/dev/pci/yds.c Mon Apr 29 09:32:07 2019 +0000
@@ -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 <sys/cdefs.h>
-__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 @@
#include <sys/audioio.h>
#include <dev/audio_if.h>
-#include <dev/mulaw.h>
-#include <dev/auconv.h>
#include <dev/ic/ac97reg.h>
#include <dev/ic/ac97var.h>
#include <dev/ic/mpuvar.h>
@@ -151,10 +149,10 @@
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 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 @@
.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 @@
.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 @@
#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 @@
}
}
- if (0 != auconv_create_encodings(yds_formats, YDS_NFORMATS,
- &sc->sc_encodings)) {
- mutex_destroy(&sc->sc_lock);
- mutex_destroy(&sc->sc_intr_lock);
- return;
- }
-
audio_attach_mi(&yds_hw_if, sc, self);
sc->sc_legacy_iot = pa->pa_iot;
@@ -1253,29 +1238,17 @@
}
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)
+yds_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)
{
- if (setmode & AUMODE_RECORD) {
- if (auconv_set_converter(yds_formats, YDS_NFORMATS,
- AUMODE_RECORD, rec, FALSE, rfil) < 0)
- return EINVAL;
- }
- if (setmode & AUMODE_PLAY) {
- if (auconv_set_converter(yds_formats, YDS_NFORMATS,
- AUMODE_PLAY, play, FALSE, pfil) < 0)
- return EINVAL;
- }
return 0;
}
@@ -1735,22 +1708,6 @@
return size;
}
-static paddr_t
-yds_mappage(void *addr, void *mem, off_t off, int prot)
-{
- struct yds_softc *sc;
- struct yds_dma *p;
-
- if (off < 0)
- return -1;
- sc = addr;
- p = yds_find_dma(sc, mem);
- if (p == NULL)
- return -1;
- return bus_dmamem_mmap(sc->sc_dmatag, p->segs, p->nsegs,
- off, prot, BUS_DMA_WAITOK);
-}
-
static int
yds_get_props(void *addr)
{
diff -r 14e40c269bd9 -r fa20733225cc sys/dev/pci/ydsvar.h
--- a/sys/dev/pci/ydsvar.h Mon Apr 29 09:30:18 2019 +0000
+++ b/sys/dev/pci/ydsvar.h Mon Apr 29 09:32:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ydsvar.h,v 1.12 2017/06/25 16:07:48 christos Exp $ */
+/* $NetBSD: ydsvar.h,v 1.12.10.1 2019/04/29 09:32:07 isaki Exp $ */
/*
* Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto.
@@ -112,8 +112,6 @@
device_t sc_mpu;
bus_space_handle_t sc_mpu_ioh;
- struct audio_encoding_set *sc_encodings;
-
/*
* Power management
*/
Home |
Main Index |
Thread Index |
Old Index