Commit 4196dd6b authored by Tony Lindgren's avatar Tony Lindgren

ARM: OMAP: Reset GPIO irq state after free_irq()

This is needed to reset GPIO after free_irq().
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent eaca33df
...@@ -662,6 +662,14 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) ...@@ -662,6 +662,14 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
} }
} }
static void _reset_gpio(struct gpio_bank *bank, int gpio)
{
_set_gpio_direction(bank, get_gpio_index(gpio), 1);
_set_gpio_irqenable(bank, gpio, 0);
_clear_gpio_irqstatus(bank, gpio);
_set_gpio_triggering(bank, get_gpio_index(gpio), IRQT_NOEDGE);
}
/* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */
static int gpio_wake_enable(unsigned int irq, unsigned int enable) static int gpio_wake_enable(unsigned int irq, unsigned int enable)
{ {
...@@ -696,7 +704,9 @@ int omap_request_gpio(int gpio) ...@@ -696,7 +704,9 @@ int omap_request_gpio(int gpio)
} }
bank->reserved_map |= (1 << get_gpio_index(gpio)); bank->reserved_map |= (1 << get_gpio_index(gpio));
/* Set trigger to none. You need to enable the trigger after request_irq */ /* Set trigger to none. You need to enable the desired trigger with
* request_irq() or set_irq_type().
*/
_set_gpio_triggering(bank, get_gpio_index(gpio), IRQT_NOEDGE); _set_gpio_triggering(bank, get_gpio_index(gpio), IRQT_NOEDGE);
#ifdef CONFIG_ARCH_OMAP15XX #ifdef CONFIG_ARCH_OMAP15XX
...@@ -756,9 +766,7 @@ void omap_free_gpio(int gpio) ...@@ -756,9 +766,7 @@ void omap_free_gpio(int gpio)
} }
#endif #endif
bank->reserved_map &= ~(1 << get_gpio_index(gpio)); bank->reserved_map &= ~(1 << get_gpio_index(gpio));
_set_gpio_direction(bank, get_gpio_index(gpio), 1); _reset_gpio(bank, gpio);
_set_gpio_irqenable(bank, gpio, 0);
_clear_gpio_irqstatus(bank, gpio);
spin_unlock(&bank->lock); spin_unlock(&bank->lock);
} }
...@@ -898,6 +906,14 @@ static void gpio_irq_handler(unsigned int irq, struct irqdesc *desc, ...@@ -898,6 +906,14 @@ static void gpio_irq_handler(unsigned int irq, struct irqdesc *desc,
} }
static void gpio_irq_shutdown(unsigned int irq)
{
unsigned int gpio = irq - IH_GPIO_BASE;
struct gpio_bank *bank = get_gpio_bank(gpio);
_reset_gpio(bank, gpio);
}
static void gpio_ack_irq(unsigned int irq) static void gpio_ack_irq(unsigned int irq)
{ {
unsigned int gpio = irq - IH_GPIO_BASE; unsigned int gpio = irq - IH_GPIO_BASE;
...@@ -946,6 +962,7 @@ static void mpuio_unmask_irq(unsigned int irq) ...@@ -946,6 +962,7 @@ static void mpuio_unmask_irq(unsigned int irq)
static struct irq_chip gpio_irq_chip = { static struct irq_chip gpio_irq_chip = {
.name = "GPIO", .name = "GPIO",
.shutdown = gpio_irq_shutdown,
.ack = gpio_ack_irq, .ack = gpio_ack_irq,
.mask = gpio_mask_irq, .mask = gpio_mask_irq,
.unmask = gpio_unmask_irq, .unmask = gpio_unmask_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