diff options
Diffstat (limited to 'sound/aoa/core/gpio-feature.c')
-rw-r--r-- | sound/aoa/core/gpio-feature.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sound/aoa/core/gpio-feature.c b/sound/aoa/core/gpio-feature.c index c93ad5dec66b..de8e03afa97b 100644 --- a/sound/aoa/core/gpio-feature.c +++ b/sound/aoa/core/gpio-feature.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include "../aoa.h" | 15 | #include "../aoa.h" |
16 | 16 | ||
17 | /* TODO: these are 20 global variables | 17 | /* TODO: these are lots of global variables |
18 | * that aren't used on most machines... | 18 | * that aren't used on most machines... |
19 | * Move them into a dynamically allocated | 19 | * Move them into a dynamically allocated |
20 | * structure and use that. | 20 | * structure and use that. |
@@ -23,6 +23,7 @@ | |||
23 | /* these are the GPIO numbers (register addresses as offsets into | 23 | /* these are the GPIO numbers (register addresses as offsets into |
24 | * the GPIO space) */ | 24 | * the GPIO space) */ |
25 | static int headphone_mute_gpio; | 25 | static int headphone_mute_gpio; |
26 | static int master_mute_gpio; | ||
26 | static int amp_mute_gpio; | 27 | static int amp_mute_gpio; |
27 | static int lineout_mute_gpio; | 28 | static int lineout_mute_gpio; |
28 | static int hw_reset_gpio; | 29 | static int hw_reset_gpio; |
@@ -32,6 +33,7 @@ static int linein_detect_gpio; | |||
32 | 33 | ||
33 | /* see the SWITCH_GPIO macro */ | 34 | /* see the SWITCH_GPIO macro */ |
34 | static int headphone_mute_gpio_activestate; | 35 | static int headphone_mute_gpio_activestate; |
36 | static int master_mute_gpio_activestate; | ||
35 | static int amp_mute_gpio_activestate; | 37 | static int amp_mute_gpio_activestate; |
36 | static int lineout_mute_gpio_activestate; | 38 | static int lineout_mute_gpio_activestate; |
37 | static int hw_reset_gpio_activestate; | 39 | static int hw_reset_gpio_activestate; |
@@ -156,6 +158,7 @@ static int ftr_gpio_get_##name(struct gpio_runtime *rt) \ | |||
156 | FTR_GPIO(headphone, 0); | 158 | FTR_GPIO(headphone, 0); |
157 | FTR_GPIO(amp, 1); | 159 | FTR_GPIO(amp, 1); |
158 | FTR_GPIO(lineout, 2); | 160 | FTR_GPIO(lineout, 2); |
161 | FTR_GPIO(master, 3); | ||
159 | 162 | ||
160 | static void ftr_gpio_set_hw_reset(struct gpio_runtime *rt, int on) | 163 | static void ftr_gpio_set_hw_reset(struct gpio_runtime *rt, int on) |
161 | { | 164 | { |
@@ -172,6 +175,8 @@ static void ftr_gpio_set_hw_reset(struct gpio_runtime *rt, int on) | |||
172 | hw_reset_gpio, v); | 175 | hw_reset_gpio, v); |
173 | } | 176 | } |
174 | 177 | ||
178 | static struct gpio_methods methods; | ||
179 | |||
175 | static void ftr_gpio_all_amps_off(struct gpio_runtime *rt) | 180 | static void ftr_gpio_all_amps_off(struct gpio_runtime *rt) |
176 | { | 181 | { |
177 | int saved; | 182 | int saved; |
@@ -181,6 +186,8 @@ static void ftr_gpio_all_amps_off(struct gpio_runtime *rt) | |||
181 | ftr_gpio_set_headphone(rt, 0); | 186 | ftr_gpio_set_headphone(rt, 0); |
182 | ftr_gpio_set_amp(rt, 0); | 187 | ftr_gpio_set_amp(rt, 0); |
183 | ftr_gpio_set_lineout(rt, 0); | 188 | ftr_gpio_set_lineout(rt, 0); |
189 | if (methods.set_master) | ||
190 | ftr_gpio_set_master(rt, 0); | ||
184 | rt->implementation_private = saved; | 191 | rt->implementation_private = saved; |
185 | } | 192 | } |
186 | 193 | ||
@@ -193,6 +200,8 @@ static void ftr_gpio_all_amps_restore(struct gpio_runtime *rt) | |||
193 | ftr_gpio_set_headphone(rt, (s>>0)&1); | 200 | ftr_gpio_set_headphone(rt, (s>>0)&1); |
194 | ftr_gpio_set_amp(rt, (s>>1)&1); | 201 | ftr_gpio_set_amp(rt, (s>>1)&1); |
195 | ftr_gpio_set_lineout(rt, (s>>2)&1); | 202 | ftr_gpio_set_lineout(rt, (s>>2)&1); |
203 | if (methods.set_master) | ||
204 | ftr_gpio_set_master(rt, (s>>3)&1); | ||
196 | } | 205 | } |
197 | 206 | ||
198 | static void ftr_handle_notify(struct work_struct *work) | 207 | static void ftr_handle_notify(struct work_struct *work) |
@@ -231,6 +240,12 @@ static void ftr_gpio_init(struct gpio_runtime *rt) | |||
231 | get_gpio("hw-reset", "audio-hw-reset", | 240 | get_gpio("hw-reset", "audio-hw-reset", |
232 | &hw_reset_gpio, | 241 | &hw_reset_gpio, |
233 | &hw_reset_gpio_activestate); | 242 | &hw_reset_gpio_activestate); |
243 | if (get_gpio("master-mute", NULL, | ||
244 | &master_mute_gpio, | ||
245 | &master_mute_gpio_activestate)) { | ||
246 | methods.set_master = ftr_gpio_set_master; | ||
247 | methods.get_master = ftr_gpio_get_master; | ||
248 | } | ||
234 | 249 | ||
235 | headphone_detect_node = get_gpio("headphone-detect", NULL, | 250 | headphone_detect_node = get_gpio("headphone-detect", NULL, |
236 | &headphone_detect_gpio, | 251 | &headphone_detect_gpio, |