Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: at91: use gpiolib API to mark a GPIO used as an IRQ

When an IRQ is started on a GPIO line, mark this GPIO as IRQ in
the gpiolib so we can keep track of the usage centrally.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Jean-Jacques Hiblot and committed by
Linus Walleij
94e69207 2d0c386f

+27
+27
drivers/pinctrl/pinctrl-at91.c
··· 1325 1325 return 0; 1326 1326 } 1327 1327 1328 + static unsigned int gpio_irq_startup(struct irq_data *d) 1329 + { 1330 + struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); 1331 + unsigned pin = d->hwirq; 1332 + int ret; 1333 + 1334 + ret = gpio_lock_as_irq(&at91_gpio->chip, pin); 1335 + if (ret) { 1336 + dev_err(at91_gpio->chip.dev, "unable to lock pind %lu IRQ\n", 1337 + d->hwirq); 1338 + return ret; 1339 + } 1340 + gpio_irq_unmask(d); 1341 + return 0; 1342 + } 1343 + 1344 + static void gpio_irq_shutdown(struct irq_data *d) 1345 + { 1346 + struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); 1347 + unsigned pin = d->hwirq; 1348 + 1349 + gpio_irq_mask(d); 1350 + gpio_unlock_as_irq(&at91_gpio->chip, pin); 1351 + } 1352 + 1328 1353 #ifdef CONFIG_PM 1329 1354 1330 1355 static u32 wakeups[MAX_GPIO_BANKS]; ··· 1424 1399 1425 1400 static struct irq_chip gpio_irqchip = { 1426 1401 .name = "GPIO", 1402 + .irq_startup = gpio_irq_startup, 1403 + .irq_shutdown = gpio_irq_shutdown, 1427 1404 .irq_disable = gpio_irq_mask, 1428 1405 .irq_mask = gpio_irq_mask, 1429 1406 .irq_unmask = gpio_irq_unmask,