Skip to content

Commit 5f982c7

Browse files
Grygorii Strashkolinusw
Grygorii Strashko
authored andcommitted
gpio: omap: fix omap_gpio_free to not clean up irq configuration
This patch fixes following issue: - GPIOn is used as IRQ by some dev, for example PCF8575.INT -> gpio6.11 - PCFx driver knows nothing about type of IRQ line (GPIO or not) so it doesn't request gpio and just do request_irq() - If gpio6.11 will be exported through the sysfs and then un-xeported then IRQs from PCFx will not be received any more, because IRQ configuration for gpio6.11 will be cleaned up unconditionally in omap_gpio_free. Fix this by removing all GPIO IRQ specific code from omap_gpio_free() and also do GPIO clean up (change direction to 'in' and disable debounce) only if corresponding GPIO is not used as IRQ too. GPIO IRQ will be properly cleaned up by GPIO irqchip code. Signed-off-by: Grygorii Strashko <[email protected]> Tested-by: Tony Lindgren <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 501ef0f commit 5f982c7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/gpio/gpio-omap.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,11 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)
690690

691691
spin_lock_irqsave(&bank->lock, flags);
692692
bank->mod_usage &= ~(BIT(offset));
693+
if (!LINE_USED(bank->irq_usage, offset)) {
694+
omap_set_gpio_direction(bank, offset, 1);
695+
omap_clear_gpio_debounce(bank, offset);
696+
}
693697
omap_disable_gpio_module(bank, offset);
694-
omap_reset_gpio(bank, offset);
695698
spin_unlock_irqrestore(&bank->lock, flags);
696699

697700
/*

0 commit comments

Comments
 (0)