CVS commit: [isaki-audio2] src/sys/arch/sgimips/mace

2019-05-04 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat May  4 12:03:04 UTC 2019

Modified Files:
src/sys/arch/sgimips/mace [isaki-audio2]: mavb.c

Log Message:
Correct precision.
Tested by naru@.  Thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.3 -r1.12.2.4 src/sys/arch/sgimips/mace/mavb.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/arch/sgimips/mace/mavb.c
diff -u src/sys/arch/sgimips/mace/mavb.c:1.12.2.3 src/sys/arch/sgimips/mace/mavb.c:1.12.2.4
--- src/sys/arch/sgimips/mace/mavb.c:1.12.2.3	Sat May  4 07:20:08 2019
+++ src/sys/arch/sgimips/mace/mavb.c	Sat May  4 12:03:03 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mavb.c,v 1.12.2.3 2019/05/04 07:20:08 isaki Exp $ */
+/* $NetBSD: mavb.c,v 1.12.2.4 2019/05/04 12:03:03 isaki Exp $ */
 /* $OpenBSD: mavb.c,v 1.6 2005/04/15 13:05:14 mickey Exp $ */
 
 /*
@@ -111,8 +111,8 @@ static const struct audio_format mavb_fo
 	{
 		.mode		= AUMODE_PLAY,
 		.encoding	= AUDIO_ENCODING_SLINEAR_BE,
-		.validbits	= 16,
-		.precision	= 16,
+		.validbits	= 24,
+		.precision	= 32,
 		.channels	= 2,
 		.channel_mask	= AUFMT_STEREO,
 		.frequency_type	= 0,



CVS commit: [isaki-audio2] src/sys/arch/sgimips/mace

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 13:05:46 UTC 2019

Modified Files:
src/sys/arch/sgimips/mace [isaki-audio2]: mavb.c

Log Message:
Adapt to audio2.
- The driver does not support recording so drop CAPTURE property.


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.1 -r1.12.2.2 src/sys/arch/sgimips/mace/mavb.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/arch/sgimips/mace/mavb.c
diff -u src/sys/arch/sgimips/mace/mavb.c:1.12.2.1 src/sys/arch/sgimips/mace/mavb.c:1.12.2.2
--- src/sys/arch/sgimips/mace/mavb.c:1.12.2.1	Sun Apr 21 05:11:21 2019
+++ src/sys/arch/sgimips/mace/mavb.c	Sun Apr 21 13:05:46 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mavb.c,v 1.12.2.1 2019/04/21 05:11:21 isaki Exp $ */
+/* $NetBSD: mavb.c,v 1.12.2.2 2019/04/21 13:05:46 isaki Exp $ */
 /* $OpenBSD: mavb.c,v 1.6 2005/04/15 13:05:14 mickey Exp $ */
 
 /*
@@ -29,7 +29,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 #include 
@@ -108,22 +107,19 @@ const char *ad1843_input[] = {
 	AudioNmono		/* AD1843_MISC_SETTINGS */
 };
 
-#define MAVB_NFORMATS 2
-#define MAVB_FORMAT(ch, chmask) \
-	{ \
-		.mode		= AUMODE_PLAY | AUMODE_RECORD, \
-		.encoding	= AUDIO_ENCODING_SLINEAR_BE, \
-		.validbits	= 16, \
-		.precision	= 16, \
-		.channels	= (ch), \
-		.channel_mask	= (chmask), \
-		.frequency_type	= 0, \
-		.frequency	= { 8000, 48000 }, \
-	}
-static const struct audio_format mavb_formats[MAVB_NFORMATS] = {
-	MAVB_FORMAT(1, AUFMT_MONAURAL),
-	MAVB_FORMAT(2, AUFMT_STEREO),
+static const struct audio_format mavb_formats[] = {
+	{
+		.mode		= AUMODE_PLAY,
+		.encoding	= AUDIO_ENCODING_SLINEAR_BE,
+		.validbits	= 16,
+		.precision	= 16,
+		.channels	= 2,
+		.channel_mask	= AUFMT_STEREO,
+		.frequency_type	= 0,
+		.frequency	= { 8000, 48000 },
+	},
 };
+#define MAVB_NFORMATS __arraycount(mavb_formats)
 
 struct mavb_softc {
 	device_t sc_dev;
@@ -152,101 +148,8 @@ struct mavb_softc {
 	u_int sc_play_format;
 
 	struct callout sc_volume_button_ch;
-
-	struct audio_format sc_formats[MAVB_NFORMATS];
-	struct audio_encoding_set *sc_encodings;
-};
-
-struct mavb_codecvar {
-	stream_filter_t base;
 };
 
-static stream_filter_t *mavb_factory
-(struct audio_softc *,
- int (*)(struct audio_softc *, stream_fetcher_t *, audio_stream_t *, int));
-static void mavb_dtor(stream_filter_t *);
-
-/* XXX I'm going to complain every time I have to copy this macro */
-#define DEFINE_FILTER(name)		\
-static int\
-name##_fetch_to(struct audio_softc *, stream_fetcher_t *,		\
-		audio_stream_t *, int);	\
-stream_filter_t *name(struct audio_softc *,\
-const audio_params_t *, const audio_params_t *);			\
-stream_filter_t *			\
-name(struct audio_softc *sc, const audio_params_t *from,		\
-const audio_params_t *to)		\
-{	\
-	return mavb_factory(sc, name##_fetch_to);			\
-}	\
-static int\
-name##_fetch_to(struct audio_softc *asc, stream_fetcher_t *self,	\
-audio_stream_t *dst, int max_used)
-
-DEFINE_FILTER(mavb_16to24)
-{
-	stream_filter_t *this;
-	int m, err;
-
-	this = (stream_filter_t *)self;
-	max_used = (max_used + 1) & ~1;
-	if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used)))
-		return err;
-	m = (dst->end - dst->start) & ~1;
-	m = uimin(m, max_used);
-	FILTER_LOOP_PROLOGUE(this->src, 2, dst, 4, m) {
-		d[3] = 0;
-		d[2] = s[1];
-		d[1] = s[0];
-		d[0] = (s[0] & 0x80) ? 0xff : 0;
-	} FILTER_LOOP_EPILOGUE(this->src, dst);
-
-	return 0;
-}
-
-DEFINE_FILTER(mavb_mts)
-{
-	stream_filter_t *this;
-	int m, err;
-
-	this = (stream_filter_t *)self;
-	max_used = (max_used + 1) & ~1;
-	if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used)))
-		return err;
-	m = (dst->end - dst->start) & ~1;
-	m = uimin(m, max_used);
-	FILTER_LOOP_PROLOGUE(this->src, 4, dst, 8, m) {
-		d[3] = d[7] = s[3];
-		d[2] = d[6] = s[2];
-		d[1] = d[5] = s[1];
-		d[0] = d[4] = s[0];
-	} FILTER_LOOP_EPILOGUE(this->src, dst);
-
-	return 0;
-}
-
-static stream_filter_t *
-mavb_factory(struct audio_softc *asc, int (*fetch_to)(struct audio_softc *, stream_fetcher_t *, audio_stream_t *, int))
-{
-	struct mavb_codecvar *this;
-
-	this = kmem_zalloc(sizeof(*this), KM_SLEEP);
-	this->base.base.fetch_to = fetch_to;
-	this->base.dtor = mavb_dtor;
-	this->base.set_fetcher = stream_filter_set_fetcher;
-	this->base.set_inputbuffer = stream_filter_set_inputbuffer;
-
-	return >base;
-}
-
-static void
-mavb_dtor(stream_filter_t *this)
-{
-
-	if (this != NULL)
-		kmem_free(this, sizeof(struct mavb_codecvar));
-}
-
 typedef uint64_t ad1843_addr_t;
 
 uint16_t ad1843_reg_read(struct mavb_softc *, ad1843_addr_t);
@@ -258,13 +161,11 @@ void mavb_attach(device_t, device_t, voi
 
 CFATTACH_DECL_NEW(mavb, sizeof(struct mavb_softc),
 mavb_match, mavb_attach, NULL, NULL);
-
-int mavb_open(void *, int);
-void mavb_close(void *);
-int mavb_query_encoding(void *, struct audio_encoding