Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/audio Make audio_device information available to drv...



details:   https://anonhg.NetBSD.org/src/rev/6465b875fd0f
branches:  trunk
changeset: 374443:6465b875fd0f
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Apr 23 06:28:34 2023 +0000

description:
Make audio_device information available to drvctl and devpubd.

diffstat:

 sys/dev/audio/audio.c |  30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diffs (65 lines):

diff -r de9022868f0c -r 6465b875fd0f sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c     Sun Apr 23 06:13:35 2023 +0000
+++ b/sys/dev/audio/audio.c     Sun Apr 23 06:28:34 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.137 2023/04/17 20:33:45 mlelstv Exp $      */
+/*     $NetBSD: audio.c,v 1.138 2023/04/23 06:28:34 mlelstv Exp $      */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.137 2023/04/17 20:33:45 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.138 2023/04/23 06:28:34 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -561,6 +561,7 @@ static void audio_mixer_restore(struct a
 static void audio_softintr_rd(void *);
 static void audio_softintr_wr(void *);
 
+static int audio_properties(struct audio_softc *);
 static void audio_printf(struct audio_softc *, const char *, ...)
        __printflike(2, 3);
 static int audio_exlock_mutex_enter(struct audio_softc *);
@@ -1063,6 +1064,10 @@ audioattach(device_t parent, device_t se
                        rhwfmt = phwfmt;
        }
 
+       /* Make device id available */
+       if (audio_properties(sc))
+               aprint_error_dev(self, "audio_properties failed\n");
+
        /* Init hardware. */
        /* hw_probe() also validates [pr]hwfmt.  */
        error = audio_hw_set_format(sc, mode, &phwfmt, &rhwfmt, &pfil, &rfil);
@@ -1179,6 +1184,27 @@ bad:
        return;
 }
 
+ /*
+ * Identify audio backend device for drvctl.
+ */
+static int
+audio_properties(struct audio_softc *sc)
+{
+       prop_dictionary_t dict = device_properties(sc->sc_dev);
+       audio_device_t adev;
+       int error;
+
+       error = sc->hw_if->getdev(sc->hw_hdl, &adev);
+       if (error)
+              return error;
+
+       prop_dictionary_set_string(dict, "name", adev.name);
+       prop_dictionary_set_string(dict, "version", adev.version);
+       prop_dictionary_set_string(dict, "config", adev.config);
+
+       return 0;
+}
+
 /*
  * Initialize hardware mixer.
  * This function is called from audioattach().



Home | Main Index | Thread Index | Old Index