Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Pass mixer requests to the codec. It is the...



details:   https://anonhg.NetBSD.org/src/rev/2ae22eb73590
branches:  trunk
changeset: 319006:2ae22eb73590
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat May 12 23:51:06 2018 +0000
description:
Pass mixer requests to the codec. It is the responsibility of the codec
to decide whether or not to dispatch to an aux device.

diffstat:

 sys/arch/arm/sunxi/sun8i_codec.c |  40 ++++++++++++++++++++++++++++++++++++++--
 sys/dev/fdt/ausoc.c              |  13 +++++--------
 2 files changed, 43 insertions(+), 10 deletions(-)

diffs (118 lines):

diff -r 64c34b3d6df9 -r 2ae22eb73590 sys/arch/arm/sunxi/sun8i_codec.c
--- a/sys/arch/arm/sunxi/sun8i_codec.c  Sat May 12 18:17:04 2018 +0000
+++ b/sys/arch/arm/sunxi/sun8i_codec.c  Sat May 12 23:51:06 2018 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
        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
diff -r 64c34b3d6df9 -r 2ae22eb73590 sys/dev/fdt/ausoc.c
--- a/sys/dev/fdt/ausoc.c       Sat May 12 18:17:04 2018 +0000
+++ b/sys/dev/fdt/ausoc.c       Sat May 12 23:51:06 2018 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
 
 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 @@
 {
        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 @@
 {
        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 @@
 {
        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 *



Home | Main Index | Thread Index | Old Index