Module Name: src
Committed By: jmcneill
Date: Sat May 12 23:51:07 UTC 2018
Modified Files:
src/sys/arch/arm/sunxi: sun8i_codec.c
src/sys/dev/fdt: ausoc.c
Log Message:
Pass mixer requests to the codec. It is the responsibility of the codec
to decide whether or not to dispatch to an aux device.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sun8i_codec.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/ausoc.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/arm/sunxi/sun8i_codec.c
diff -u src/sys/arch/arm/sunxi/sun8i_codec.c:1.3 src/sys/arch/arm/sunxi/sun8i_codec.c:1.4
--- src/sys/arch/arm/sunxi/sun8i_codec.c:1.3 Fri May 11 23:05:41 2018
+++ src/sys/arch/arm/sunxi/sun8i_codec.c Sat May 12 23:51:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_codec.c,v 1.3 2018/05/11 23:05:41 jmcneill Exp $ */
+/* $NetBSD: sun8i_codec.c,v 1.4 2018/05/12 23:51:06 jmcneill Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sun8i_codec.c,v 1.3 2018/05/11 23:05:41 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sun8i_codec.c,v 1.4 2018/05/12 23:51:06 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -147,8 +147,44 @@ sun8i_codec_set_params(void *priv, int s
return 0;
}
+static int
+sun8i_codec_set_port(void *priv, mixer_ctrl_t *mc)
+{
+ struct sun8i_codec_softc * const sc = priv;
+
+ if (!sc->sc_codec_analog)
+ return ENXIO;
+
+ return audio_dai_set_port(sc->sc_codec_analog, mc);
+}
+
+static int
+sun8i_codec_get_port(void *priv, mixer_ctrl_t *mc)
+{
+ struct sun8i_codec_softc * const sc = priv;
+
+ if (!sc->sc_codec_analog)
+ return ENXIO;
+
+ return audio_dai_get_port(sc->sc_codec_analog, mc);
+}
+
+static int
+sun8i_codec_query_devinfo(void *priv, mixer_devinfo_t *di)
+{
+ struct sun8i_codec_softc * const sc = priv;
+
+ if (!sc->sc_codec_analog)
+ return ENXIO;
+
+ return audio_dai_query_devinfo(sc->sc_codec_analog, di);
+}
+
static const struct audio_hw_if sun8i_codec_hw_if = {
.set_params = sun8i_codec_set_params,
+ .set_port = sun8i_codec_set_port,
+ .get_port = sun8i_codec_get_port,
+ .query_devinfo = sun8i_codec_query_devinfo,
};
static audio_dai_tag_t
Index: src/sys/dev/fdt/ausoc.c
diff -u src/sys/dev/fdt/ausoc.c:1.2 src/sys/dev/fdt/ausoc.c:1.3
--- src/sys/dev/fdt/ausoc.c:1.2 Fri May 11 22:49:19 2018
+++ src/sys/dev/fdt/ausoc.c Sat May 12 23:51:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ausoc.c,v 1.2 2018/05/11 22:49:19 jmcneill Exp $ */
+/* $NetBSD: ausoc.c,v 1.3 2018/05/12 23:51:06 jmcneill Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ausoc.c,v 1.2 2018/05/11 22:49:19 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ausoc.c,v 1.3 2018/05/12 23:51:06 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -44,9 +44,6 @@ __KERNEL_RCSID(0, "$NetBSD: ausoc.c,v 1.
static const char *compatible[] = { "simple-audio-card", NULL };
-#define AUSOC_MIXER_DAI(link) \
- ((link)->link_naux > 0 ? (link)->link_aux[0] : (link)->link_codec)
-
struct ausoc_link {
const char *link_name;
@@ -148,7 +145,7 @@ ausoc_set_port(void *priv, mixer_ctrl_t
{
struct ausoc_link * const link = priv;
- return audio_dai_set_port(AUSOC_MIXER_DAI(link), mc);
+ return audio_dai_set_port(link->link_codec, mc);
}
static int
@@ -156,7 +153,7 @@ ausoc_get_port(void *priv, mixer_ctrl_t
{
struct ausoc_link * const link = priv;
- return audio_dai_get_port(AUSOC_MIXER_DAI(link), mc);
+ return audio_dai_get_port(link->link_codec, mc);
}
static int
@@ -164,7 +161,7 @@ ausoc_query_devinfo(void *priv, mixer_de
{
struct ausoc_link * const link = priv;
- return audio_dai_query_devinfo(AUSOC_MIXER_DAI(link), di);
+ return audio_dai_query_devinfo(link->link_codec, di);
}
static void *