Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Add APIs for linking dai devices and ja...



details:   https://anonhg.NetBSD.org/src/rev/e8326a6d56d9
branches:  trunk
changeset: 318990:e8326a6d56d9
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri May 11 22:48:55 2018 +0000
description:
Add APIs for linking dai devices and jack detection

diffstat:

 sys/dev/audio_dai.h |  25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diffs (49 lines):

diff -r f258110b15ca -r e8326a6d56d9 sys/dev/audio_dai.h
--- a/sys/dev/audio_dai.h       Fri May 11 22:48:38 2018 +0000
+++ b/sys/dev/audio_dai.h       Fri May 11 22:48:55 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audio_dai.h,v 1.1 2018/05/09 23:57:58 jmcneill Exp $ */
+/* $NetBSD: audio_dai.h,v 1.2 2018/05/11 22:48:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -57,9 +57,14 @@
 #define        AUDIO_DAI_CLOCK_IN              0
 #define        AUDIO_DAI_CLOCK_OUT             1
 
+#define        AUDIO_DAI_JACK_HP               0
+#define        AUDIO_DAI_JACK_MIC              1
+
 typedef struct audio_dai_device {
        int     (*dai_set_sysclk)(struct audio_dai_device *, u_int, int);
        int     (*dai_set_format)(struct audio_dai_device *, u_int);
+       int     (*dai_add_device)(struct audio_dai_device *, struct audio_dai_device *);
+       int     (*dai_jack_detect)(struct audio_dai_device *, u_int, int);
 
        const struct audio_hw_if *dai_hw_if;            /* audio driver callbacks */
 
@@ -98,6 +103,24 @@
 }
 
 static inline int
+audio_dai_add_device(audio_dai_tag_t dai, audio_dai_tag_t aux)
+{
+       if (!dai->dai_add_device)
+               return 0;
+
+       return dai->dai_add_device(dai, aux);
+}
+
+static inline int
+audio_dai_jack_detect(audio_dai_tag_t dai, u_int jack, bool present)
+{
+       if (!dai->dai_jack_detect)
+               return 0;
+
+       return dai->dai_jack_detect(dai, jack, present);
+}
+
+static inline int
 audio_dai_open(audio_dai_tag_t dai, int flags)
 {
        if (!dai->dai_hw_if->open)



Home | Main Index | Thread Index | Old Index