aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/plat-nomadik/gpio.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c
index 6436ba597c12..1b402a8e9031 100644
--- a/arch/arm/plat-nomadik/gpio.c
+++ b/arch/arm/plat-nomadik/gpio.c
@@ -54,6 +54,7 @@ struct nmk_gpio_chip {
54 u32 rwimsc; 54 u32 rwimsc;
55 u32 fwimsc; 55 u32 fwimsc;
56 u32 slpm; 56 u32 slpm;
57 u32 enabled;
57}; 58};
58 59
59static struct nmk_gpio_chip * 60static struct nmk_gpio_chip *
@@ -557,6 +558,11 @@ static int nmk_gpio_irq_maskunmask(struct irq_data *d, bool enable)
557 if (!nmk_chip) 558 if (!nmk_chip)
558 return -EINVAL; 559 return -EINVAL;
559 560
561 if (enable)
562 nmk_chip->enabled |= bitmask;
563 else
564 nmk_chip->enabled &= ~bitmask;
565
560 spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); 566 spin_lock_irqsave(&nmk_gpio_slpm_lock, flags);
561 spin_lock(&nmk_chip->lock); 567 spin_lock(&nmk_chip->lock);
562 568
@@ -583,8 +589,6 @@ static void nmk_gpio_irq_unmask(struct irq_data *d)
583 589
584static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on) 590static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
585{ 591{
586 struct irq_desc *desc = irq_to_desc(d->irq);
587 bool enabled = !(desc->status & IRQ_DISABLED);
588 struct nmk_gpio_chip *nmk_chip; 592 struct nmk_gpio_chip *nmk_chip;
589 unsigned long flags; 593 unsigned long flags;
590 u32 bitmask; 594 u32 bitmask;
@@ -599,7 +603,7 @@ static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
599 spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); 603 spin_lock_irqsave(&nmk_gpio_slpm_lock, flags);
600 spin_lock(&nmk_chip->lock); 604 spin_lock(&nmk_chip->lock);
601 605
602 if (!enabled) 606 if (!(nmk_chip->enabled & bitmask))
603 __nmk_gpio_set_wake(nmk_chip, gpio, on); 607 __nmk_gpio_set_wake(nmk_chip, gpio, on);
604 608
605 if (on) 609 if (on)
@@ -615,9 +619,7 @@ static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
615 619
616static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type) 620static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type)
617{ 621{
618 struct irq_desc *desc = irq_to_desc(d->irq); 622 bool enabled, wake = irqd_is_wakeup_set(d);
619 bool enabled = !(desc->status & IRQ_DISABLED);
620 bool wake = desc->wake_depth;
621 int gpio; 623 int gpio;
622 struct nmk_gpio_chip *nmk_chip; 624 struct nmk_gpio_chip *nmk_chip;
623 unsigned long flags; 625 unsigned long flags;
@@ -634,6 +636,8 @@ static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type)
634 if (type & IRQ_TYPE_LEVEL_LOW) 636 if (type & IRQ_TYPE_LEVEL_LOW)
635 return -EINVAL; 637 return -EINVAL;
636 638
639 enabled = nmk_chip->enabled & bitmask;
640
637 spin_lock_irqsave(&nmk_chip->lock, flags); 641 spin_lock_irqsave(&nmk_chip->lock, flags);
638 642
639 if (enabled) 643 if (enabled)