diff options
| -rw-r--r-- | drivers/gpio/gpio-omap.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 94cbc842fbc3..d335af1d4d85 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
| @@ -251,6 +251,40 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio, | |||
| 251 | } | 251 | } |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | /** | ||
| 255 | * _clear_gpio_debounce - clear debounce settings for a gpio | ||
| 256 | * @bank: the gpio bank we're acting upon | ||
| 257 | * @gpio: the gpio number on this @gpio | ||
| 258 | * | ||
| 259 | * If a gpio is using debounce, then clear the debounce enable bit and if | ||
| 260 | * this is the only gpio in this bank using debounce, then clear the debounce | ||
| 261 | * time too. The debounce clock will also be disabled when calling this function | ||
| 262 | * if this is the only gpio in the bank using debounce. | ||
| 263 | */ | ||
| 264 | static void _clear_gpio_debounce(struct gpio_bank *bank, unsigned gpio) | ||
| 265 | { | ||
| 266 | u32 gpio_bit = GPIO_BIT(bank, gpio); | ||
| 267 | |||
| 268 | if (!bank->dbck_flag) | ||
| 269 | return; | ||
| 270 | |||
| 271 | if (!(bank->dbck_enable_mask & gpio_bit)) | ||
| 272 | return; | ||
| 273 | |||
| 274 | bank->dbck_enable_mask &= ~gpio_bit; | ||
| 275 | bank->context.debounce_en &= ~gpio_bit; | ||
| 276 | __raw_writel(bank->context.debounce_en, | ||
| 277 | bank->base + bank->regs->debounce_en); | ||
| 278 | |||
| 279 | if (!bank->dbck_enable_mask) { | ||
| 280 | bank->context.debounce = 0; | ||
| 281 | __raw_writel(bank->context.debounce, bank->base + | ||
| 282 | bank->regs->debounce); | ||
| 283 | clk_disable(bank->dbck); | ||
| 284 | bank->dbck_enabled = false; | ||
| 285 | } | ||
| 286 | } | ||
| 287 | |||
| 254 | static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio, | 288 | static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio, |
| 255 | unsigned trigger) | 289 | unsigned trigger) |
| 256 | { | 290 | { |
| @@ -539,6 +573,7 @@ static void _reset_gpio(struct gpio_bank *bank, int gpio) | |||
| 539 | _set_gpio_irqenable(bank, gpio, 0); | 573 | _set_gpio_irqenable(bank, gpio, 0); |
| 540 | _clear_gpio_irqstatus(bank, gpio); | 574 | _clear_gpio_irqstatus(bank, gpio); |
| 541 | _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE); | 575 | _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE); |
| 576 | _clear_gpio_debounce(bank, gpio); | ||
| 542 | } | 577 | } |
| 543 | 578 | ||
| 544 | /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ | 579 | /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ |
