Module Name: src
Committed By: jmcneill
Date: Fri May 11 22:48:55 UTC 2018
Modified Files:
src/sys/dev: audio_dai.h
Log Message:
Add APIs for linking dai devices and jack detection
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/audio_dai.h
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/audio_dai.h
diff -u src/sys/dev/audio_dai.h:1.1 src/sys/dev/audio_dai.h:1.2
--- src/sys/dev/audio_dai.h:1.1 Wed May 9 23:57:58 2018
+++ src/sys/dev/audio_dai.h Fri May 11 22:48:55 2018
@@ -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 <[email protected]>
@@ -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 @@ audio_dai_set_format(audio_dai_tag_t dai
}
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)