1#ifndef __SOUND_JACK_H
2#define __SOUND_JACK_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#include <sound/core.h>
27
28struct input_dev;
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52enum snd_jack_types {
53 SND_JACK_HEADPHONE = 0x0001,
54 SND_JACK_MICROPHONE = 0x0002,
55 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
56 SND_JACK_LINEOUT = 0x0004,
57 SND_JACK_MECHANICAL = 0x0008,
58 SND_JACK_VIDEOOUT = 0x0010,
59 SND_JACK_AVOUT = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT,
60 SND_JACK_LINEIN = 0x0020,
61
62
63 SND_JACK_BTN_0 = 0x4000,
64 SND_JACK_BTN_1 = 0x2000,
65 SND_JACK_BTN_2 = 0x1000,
66 SND_JACK_BTN_3 = 0x0800,
67 SND_JACK_BTN_4 = 0x0400,
68 SND_JACK_BTN_5 = 0x0200,
69};
70
71
72#define SND_JACK_SWITCH_TYPES 6
73
74struct snd_jack {
75 struct list_head kctl_list;
76 struct snd_card *card;
77 const char *id;
78#ifdef CONFIG_SND_JACK_INPUT_DEV
79 struct input_dev *input_dev;
80 int registered;
81 int type;
82 char name[100];
83 unsigned int key[6];
84#endif
85 void *private_data;
86 void (*private_free)(struct snd_jack *);
87};
88
89#ifdef CONFIG_SND_JACK
90
91int snd_jack_new(struct snd_card *card, const char *id, int type,
92 struct snd_jack **jack, bool initial_kctl, bool phantom_jack);
93int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask);
94#ifdef CONFIG_SND_JACK_INPUT_DEV
95void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
96int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type,
97 int keytype);
98#endif
99void snd_jack_report(struct snd_jack *jack, int status);
100
101#else
102static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
103 struct snd_jack **jack, bool initial_kctl, bool phantom_jack)
104{
105 return 0;
106}
107
108static inline int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask)
109{
110 return 0;
111}
112
113static inline void snd_jack_report(struct snd_jack *jack, int status)
114{
115}
116
117#endif
118
119#if !defined(CONFIG_SND_JACK) || !defined(CONFIG_SND_JACK_INPUT_DEV)
120static inline void snd_jack_set_parent(struct snd_jack *jack,
121 struct device *parent)
122{
123}
124
125static inline int snd_jack_set_key(struct snd_jack *jack,
126 enum snd_jack_types type,
127 int keytype)
128{
129 return 0;
130}
131#endif
132
133#endif
134