aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-11-20 09:36:53 -0500
committerLinus Walleij <linus.walleij@linaro.org>2013-12-04 08:47:03 -0500
commiteb7cce1ea96b6399672abce787598f6e7a4352c3 (patch)
tree06ffee452edcb13e05c536a84ae6ecfd3c314b7c
parentaa6baa7e374dccbec619dcdd1291bc529a008051 (diff)
gpio: lynxpoint: lock IRQs when starting them
This uses the new API for tagging GPIO lines as in use by IRQs. This enforces a few semantic checks on how the underlying GPIO line is used. Cc: Mathias Nyman <mathias.nyman@linux.intel.com> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpio-lynxpoint.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
index a0804740a0b7..70831e4b2c8b 100644
--- a/drivers/gpio/gpio-lynxpoint.c
+++ b/drivers/gpio/gpio-lynxpoint.c
@@ -301,6 +301,26 @@ static void lp_irq_disable(struct irq_data *d)
301 spin_unlock_irqrestore(&lg->lock, flags); 301 spin_unlock_irqrestore(&lg->lock, flags);
302} 302}
303 303
304static unsigned int lp_irq_startup(struct irq_data *d)
305{
306 struct lp_gpio *lg = irq_data_get_irq_chip_data(d);
307
308 if (gpio_lock_as_irq(&lg->chip, irqd_to_hwirq(d)))
309 dev_err(lg->chip.dev,
310 "unable to lock HW IRQ %lu for IRQ\n",
311 irqd_to_hwirq(d));
312 lp_irq_enable(d);
313 return 0;
314}
315
316static void lp_irq_shutdown(struct irq_data *d)
317{
318 struct lp_gpio *lg = irq_data_get_irq_chip_data(d);
319
320 lp_irq_disable(d);
321 gpio_unlock_as_irq(&lg->chip, irqd_to_hwirq(d));
322}
323
304static struct irq_chip lp_irqchip = { 324static struct irq_chip lp_irqchip = {
305 .name = "LP-GPIO", 325 .name = "LP-GPIO",
306 .irq_mask = lp_irq_mask, 326 .irq_mask = lp_irq_mask,
@@ -308,6 +328,8 @@ static struct irq_chip lp_irqchip = {
308 .irq_enable = lp_irq_enable, 328 .irq_enable = lp_irq_enable,
309 .irq_disable = lp_irq_disable, 329 .irq_disable = lp_irq_disable,
310 .irq_set_type = lp_irq_type, 330 .irq_set_type = lp_irq_type,
331 .irq_startup = lp_irq_startup,
332 .irq_shutdown = lp_irq_shutdown,
311 .flags = IRQCHIP_SKIP_SET_WAKE, 333 .flags = IRQCHIP_SKIP_SET_WAKE,
312}; 334};
313 335