aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2006-06-28 08:00:58 -0400
committerJaroslav Kysela <perex@suse.cz>2006-06-28 13:31:35 -0400
commitbd66f3bbc369191279d18c21f305341c8bc9cafe (patch)
treef429ea96daa3e120e547af01dda5b18534b0ea6d
parentc6feefd03ed12d89af591345fb9c26de7098764d (diff)
[ALSA] snd-aoa: enable dual-edge in GPIOs
Apparently some firmware versions forget enabling the dual-edge bit, snd-powermac did that too and even OSX does sometimes. This should fix headphone plug detection on those machines. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r--sound/aoa/core/snd-aoa-gpio-feature.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sound/aoa/core/snd-aoa-gpio-feature.c b/sound/aoa/core/snd-aoa-gpio-feature.c
index 2c6eb7784cc9..bab97547a052 100644
--- a/sound/aoa/core/snd-aoa-gpio-feature.c
+++ b/sound/aoa/core/snd-aoa-gpio-feature.c
@@ -207,6 +207,17 @@ static void ftr_handle_notify(void *data)
207 mutex_unlock(&notif->mutex); 207 mutex_unlock(&notif->mutex);
208} 208}
209 209
210static void gpio_enable_dual_edge(int gpio)
211{
212 int v;
213
214 if (gpio == -1)
215 return;
216 v = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, gpio, 0);
217 v |= 0x80; /* enable dual edge */
218 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, gpio, v);
219}
220
210static void ftr_gpio_init(struct gpio_runtime *rt) 221static void ftr_gpio_init(struct gpio_runtime *rt)
211{ 222{
212 get_gpio("headphone-mute", NULL, 223 get_gpio("headphone-mute", NULL,
@@ -234,6 +245,10 @@ static void ftr_gpio_init(struct gpio_runtime *rt)
234 &linein_detect_gpio, 245 &linein_detect_gpio,
235 &linein_detect_gpio_activestate); 246 &linein_detect_gpio_activestate);
236 247
248 gpio_enable_dual_edge(headphone_detect_gpio);
249 gpio_enable_dual_edge(lineout_detect_gpio);
250 gpio_enable_dual_edge(linein_detect_gpio);
251
237 get_irq(headphone_detect_node, &headphone_detect_irq); 252 get_irq(headphone_detect_node, &headphone_detect_irq);
238 get_irq(lineout_detect_node, &lineout_detect_irq); 253 get_irq(lineout_detect_node, &lineout_detect_irq);
239 get_irq(linein_detect_node, &linein_detect_irq); 254 get_irq(linein_detect_node, &linein_detect_irq);