aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/gpio-omap.c50
1 files changed, 16 insertions, 34 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 857ec3939fdd..dbe0cf36e909 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -525,42 +525,24 @@ static inline void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int ena
525 */ 525 */
526static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) 526static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
527{ 527{
528 unsigned long uninitialized_var(flags); 528 u32 gpio_bit = GPIO_BIT(bank, gpio);
529 unsigned long flags;
529 530
530 switch (bank->method) { 531 if (bank->non_wakeup_gpios & gpio_bit) {
531#ifdef CONFIG_ARCH_OMAP16XX 532 dev_err(bank->dev,
532 case METHOD_MPUIO: 533 "Unable to modify wakeup on non-wakeup GPIO%d\n", gpio);
533 case METHOD_GPIO_1610:
534 spin_lock_irqsave(&bank->lock, flags);
535 if (enable)
536 bank->suspend_wakeup |= (1 << gpio);
537 else
538 bank->suspend_wakeup &= ~(1 << gpio);
539 spin_unlock_irqrestore(&bank->lock, flags);
540 return 0;
541#endif
542#ifdef CONFIG_ARCH_OMAP2PLUS
543 case METHOD_GPIO_24XX:
544 case METHOD_GPIO_44XX:
545 if (bank->non_wakeup_gpios & (1 << gpio)) {
546 printk(KERN_ERR "Unable to modify wakeup on "
547 "non-wakeup GPIO%d\n",
548 (bank - gpio_bank) * bank->width + gpio);
549 return -EINVAL;
550 }
551 spin_lock_irqsave(&bank->lock, flags);
552 if (enable)
553 bank->suspend_wakeup |= (1 << gpio);
554 else
555 bank->suspend_wakeup &= ~(1 << gpio);
556 spin_unlock_irqrestore(&bank->lock, flags);
557 return 0;
558#endif
559 default:
560 printk(KERN_ERR "Can't enable GPIO wakeup for method %i\n",
561 bank->method);
562 return -EINVAL; 534 return -EINVAL;
563 } 535 }
536
537 spin_lock_irqsave(&bank->lock, flags);
538 if (enable)
539 bank->suspend_wakeup |= gpio_bit;
540 else
541 bank->suspend_wakeup &= ~gpio_bit;
542
543 spin_unlock_irqrestore(&bank->lock, flags);
544
545 return 0;
564} 546}
565 547
566static void _reset_gpio(struct gpio_bank *bank, int gpio) 548static void _reset_gpio(struct gpio_bank *bank, int gpio)
@@ -579,7 +561,7 @@ static int gpio_wake_enable(struct irq_data *d, unsigned int enable)
579 int retval; 561 int retval;
580 562
581 bank = irq_data_get_irq_chip_data(d); 563 bank = irq_data_get_irq_chip_data(d);
582 retval = _set_gpio_wakeup(bank, GPIO_INDEX(bank, gpio), enable); 564 retval = _set_gpio_wakeup(bank, gpio, enable);
583 565
584 return retval; 566 return retval;
585} 567}