Commit bd66f3bb authored by Johannes Berg's avatar Johannes Berg Committed by Jaroslav Kysela

[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: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent c6feefd0
...@@ -207,6 +207,17 @@ static void ftr_handle_notify(void *data) ...@@ -207,6 +207,17 @@ static void ftr_handle_notify(void *data)
mutex_unlock(&notif->mutex); mutex_unlock(&notif->mutex);
} }
static void gpio_enable_dual_edge(int gpio)
{
int v;
if (gpio == -1)
return;
v = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, gpio, 0);
v |= 0x80; /* enable dual edge */
pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, gpio, v);
}
static void ftr_gpio_init(struct gpio_runtime *rt) static void ftr_gpio_init(struct gpio_runtime *rt)
{ {
get_gpio("headphone-mute", NULL, get_gpio("headphone-mute", NULL,
...@@ -234,6 +245,10 @@ static void ftr_gpio_init(struct gpio_runtime *rt) ...@@ -234,6 +245,10 @@ static void ftr_gpio_init(struct gpio_runtime *rt)
&linein_detect_gpio, &linein_detect_gpio,
&linein_detect_gpio_activestate); &linein_detect_gpio_activestate);
gpio_enable_dual_edge(headphone_detect_gpio);
gpio_enable_dual_edge(lineout_detect_gpio);
gpio_enable_dual_edge(linein_detect_gpio);
get_irq(headphone_detect_node, &headphone_detect_irq); get_irq(headphone_detect_node, &headphone_detect_irq);
get_irq(lineout_detect_node, &lineout_detect_irq); get_irq(lineout_detect_node, &lineout_detect_irq);
get_irq(linein_detect_node, &linein_detect_irq); get_irq(linein_detect_node, &linein_detect_irq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment