1
2
3
4
5
6
7
8#ifndef __SOC_JACK_H
9#define __SOC_JACK_H
10
11
12
13
14
15
16
17
18
19struct snd_soc_jack_pin {
20 struct list_head list;
21 const char *pin;
22 int mask;
23 bool invert;
24};
25
26
27
28
29
30
31
32
33
34
35
36struct snd_soc_jack_zone {
37 unsigned int min_mv;
38 unsigned int max_mv;
39 unsigned int jack_type;
40 unsigned int debounce_time;
41 struct list_head list;
42};
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61struct snd_soc_jack_gpio {
62 unsigned int gpio;
63 unsigned int idx;
64 struct device *gpiod_dev;
65 const char *name;
66 int report;
67 int invert;
68 int debounce_time;
69 bool wake;
70
71
72 struct snd_soc_jack *jack;
73 struct delayed_work work;
74 struct notifier_block pm_notifier;
75 struct gpio_desc *desc;
76
77 void *data;
78
79 int (*jack_status_check)(void *data);
80};
81
82struct snd_soc_jack {
83 struct mutex mutex;
84 struct snd_jack *jack;
85 struct snd_soc_card *card;
86 struct list_head pins;
87 int status;
88 struct blocking_notifier_head notifier;
89 struct list_head jack_zones;
90};
91
92
93void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
94int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
95 struct snd_soc_jack_pin *pins);
96void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
97 struct notifier_block *nb);
98void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
99 struct notifier_block *nb);
100int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count,
101 struct snd_soc_jack_zone *zones);
102int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage);
103#ifdef CONFIG_GPIOLIB
104int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
105 struct snd_soc_jack_gpio *gpios);
106int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
107 struct snd_soc_jack *jack,
108 int count, struct snd_soc_jack_gpio *gpios);
109void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
110 struct snd_soc_jack_gpio *gpios);
111#else
112static inline int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
113 struct snd_soc_jack_gpio *gpios)
114{
115 return 0;
116}
117
118static inline int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
119 struct snd_soc_jack *jack,
120 int count,
121 struct snd_soc_jack_gpio *gpios)
122{
123 return 0;
124}
125
126static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
127 struct snd_soc_jack_gpio *gpios)
128{
129}
130#endif
131
132#endif
133