aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-nomadik/gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-nomadik/gpio.c')
-rw-r--r--arch/arm/plat-nomadik/gpio.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c
index a8ac545ddadc..b877d76878f9 100644
--- a/arch/arm/plat-nomadik/gpio.c
+++ b/arch/arm/plat-nomadik/gpio.c
@@ -162,6 +162,7 @@ static void nmk_gpio_irq_unmask(unsigned int irq)
162 162
163static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type) 163static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type)
164{ 164{
165 bool enabled = !(irq_to_desc(irq)->status & IRQ_DISABLED);
165 int gpio; 166 int gpio;
166 struct nmk_gpio_chip *nmk_chip; 167 struct nmk_gpio_chip *nmk_chip;
167 unsigned long flags; 168 unsigned long flags;
@@ -180,19 +181,21 @@ static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type)
180 181
181 spin_lock_irqsave(&nmk_chip->lock, flags); 182 spin_lock_irqsave(&nmk_chip->lock, flags);
182 183
184 if (enabled)
185 __nmk_gpio_irq_modify(nmk_chip, gpio, false);
186
183 nmk_chip->edge_rising &= ~bitmask; 187 nmk_chip->edge_rising &= ~bitmask;
184 if (type & IRQ_TYPE_EDGE_RISING) 188 if (type & IRQ_TYPE_EDGE_RISING)
185 nmk_chip->edge_rising |= bitmask; 189 nmk_chip->edge_rising |= bitmask;
186 writel(nmk_chip->edge_rising, nmk_chip->addr + NMK_GPIO_RIMSC);
187 190
188 nmk_chip->edge_falling &= ~bitmask; 191 nmk_chip->edge_falling &= ~bitmask;
189 if (type & IRQ_TYPE_EDGE_FALLING) 192 if (type & IRQ_TYPE_EDGE_FALLING)
190 nmk_chip->edge_falling |= bitmask; 193 nmk_chip->edge_falling |= bitmask;
191 writel(nmk_chip->edge_falling, nmk_chip->addr + NMK_GPIO_FIMSC);
192 194
193 spin_unlock_irqrestore(&nmk_chip->lock, flags); 195 if (enabled)
196 __nmk_gpio_irq_modify(nmk_chip, gpio, true);
194 197
195 nmk_gpio_irq_unmask(irq); 198 spin_unlock_irqrestore(&nmk_chip->lock, flags);
196 199
197 return 0; 200 return 0;
198} 201}