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 input_dev *input_dev;
76 struct list_head kctl_list;
77 struct snd_card *card;
78 int registered;
79 int type;
80 const char *id;
81 char name[100];
82 unsigned int key[6];
83 void *private_data;
84 void (*private_free)(struct snd_jack *);
85};
86
87#ifdef CONFIG_SND_JACK
88
89int snd_jack_new(struct snd_card *card, const char *id, int type,
90 struct snd_jack **jack, bool initial_kctl, bool phantom_jack);
91int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask);
92void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
93int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type,
94 int keytype);
95
96void snd_jack_report(struct snd_jack *jack, int status);
97
98#else
99static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
100 struct snd_jack **jack, bool initial_kctl, bool phantom_jack)
101{
102 return 0;
103}
104
105static inline int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask)
106{
107 return 0;
108}
109
110static inline void snd_jack_set_parent(struct snd_jack *jack,
111 struct device *parent)
112{
113}
114
115static inline int snd_jack_set_key(struct snd_jack *jack,
116 enum snd_jack_types type,
117 int keytype)
118{
119 return 0;
120}
121
122static inline void snd_jack_report(struct snd_jack *jack, int status)
123{
124}
125
126#endif
127
128#endif
129