Module Name: src
Committed By: nat
Date: Thu Jul 27 23:39:38 UTC 2017
Modified Files:
src/sys/dev: auconv.c auconv.h
src/sys/dev/ic: am7930.c
Log Message:
Add a null_filter to help with the audio autoconfig of pmax.
Tested by flxd@.
To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/auconv.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/auconv.h
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/ic/am7930.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/auconv.c
diff -u src/sys/dev/auconv.c:1.28 src/sys/dev/auconv.c:1.29
--- src/sys/dev/auconv.c:1.28 Thu Jun 22 02:09:37 2017
+++ src/sys/dev/auconv.c Thu Jul 27 23:39:37 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: auconv.c,v 1.28 2017/06/22 02:09:37 christos Exp $ */
+/* $NetBSD: auconv.c,v 1.29 2017/07/27 23:39:37 nat Exp $ */
/*
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.28 2017/06/22 02:09:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.29 2017/07/27 23:39:37 nat Exp $");
#include <sys/types.h>
#include <sys/audioio.h>
@@ -456,6 +456,24 @@ DEFINE_FILTER(swap_bytes)
return 0;
}
+DEFINE_FILTER(null_filter)
+{
+ stream_filter_t *this;
+ int m, err;
+
+ this = (stream_filter_t *)self;
+ max_used = (max_used + 1) & ~1; /* round up to even */
+ if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
+ return err;
+ m = (dst->end - dst->start) & ~1;
+ m = min(m, max_used);
+ FILTER_LOOP_PROLOGUE(this->src, 1, dst, 1, m) {
+ *d = *s;
+ } FILTER_LOOP_EPILOGUE(this->src, dst);
+
+ return 0;
+}
+
DEFINE_FILTER(swap_bytes_change_sign16)
{
stream_filter_t *this;
Index: src/sys/dev/auconv.h
diff -u src/sys/dev/auconv.h:1.18 src/sys/dev/auconv.h:1.19
--- src/sys/dev/auconv.h:1.18 Tue Jun 20 13:51:54 2017
+++ src/sys/dev/auconv.h Thu Jul 27 23:39:37 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: auconv.h,v 1.18 2017/06/20 13:51:54 nat Exp $ */
+/* $NetBSD: auconv.h,v 1.19 2017/07/27 23:39:37 nat Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -82,6 +82,7 @@ extern stream_filter_factory_t linear8_8
extern stream_filter_factory_t linear8_8_to_linear24;
extern stream_filter_factory_t linear8_8_to_linear16;
extern stream_filter_factory_t linear8_8_to_linear8;
+extern stream_filter_factory_t null_filter;
#define linear16_to_linear8 linear16_16_to_linear8
#define linear8_to_linear16 linear8_8_to_linear16
Index: src/sys/dev/ic/am7930.c
diff -u src/sys/dev/ic/am7930.c:1.55 src/sys/dev/ic/am7930.c:1.56
--- src/sys/dev/ic/am7930.c:1.55 Sun Jun 25 09:40:17 2017
+++ src/sys/dev/ic/am7930.c Thu Jul 27 23:39:37 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: am7930.c,v 1.55 2017/06/25 09:40:17 nat Exp $ */
+/* $NetBSD: am7930.c,v 1.56 2017/07/27 23:39:37 nat Exp $ */
/*
* Copyright (c) 1995 Rolf Grossmann
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: am7930.c,v 1.55 2017/06/25 09:40:17 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am7930.c,v 1.56 2017/07/27 23:39:37 nat Exp $");
#include "audio.h"
#if NAUDIO > 0
@@ -137,6 +137,7 @@ static const uint16_t ger_coeff[] = {
#define NGER (sizeof(ger_coeff) / sizeof(ger_coeff[0]))
};
+extern stream_filter_factory_t null_filter;
/*
* Reset chip and set boot-time softc defaults.
@@ -239,11 +240,14 @@ am7930_set_params(void *addr, int setmod
if (sc->sc_glue->output_conv != NULL) {
hw = *p;
hw.encoding = AUDIO_ENCODING_NONE;
+ hw.precision = 8;
+ pfil->append(pfil, null_filter, &hw);
hw.precision *= sc->sc_glue->factor;
pfil->append(pfil, sc->sc_glue->output_conv, &hw);
}
if (p->encoding == AUDIO_ENCODING_SLINEAR) {
hw = *p;
+ hw.precision = 8;
hw.encoding = AUDIO_ENCODING_ULAW;
pfil->append(pfil, linear8_to_mulaw, &hw);
}
@@ -260,11 +264,14 @@ am7930_set_params(void *addr, int setmod
if (sc->sc_glue->input_conv != NULL) {
hw = *r;
hw.encoding = AUDIO_ENCODING_NONE;
+ hw.precision = 8;
+ pfil->append(pfil, null_filter, &hw);
hw.precision *= sc->sc_glue->factor;
pfil->append(rfil, sc->sc_glue->input_conv, &hw);
}
if (r->encoding == AUDIO_ENCODING_SLINEAR) {
hw = *r;
+ hw.precision = 8;
hw.encoding = AUDIO_ENCODING_ULAW;
rfil->append(rfil, mulaw_to_linear8, &hw);
}