diff options
Diffstat (limited to 'drivers/gpio/gpio-tegra.c')
-rw-r--r-- | drivers/gpio/gpio-tegra.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index d5d79727c55d..47dbd19751d0 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/irq.h> | 22 | #include <linux/irq.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/gpio.h> | 25 | #include <linux/gpio/driver.h> |
26 | #include <linux/of_device.h> | 26 | #include <linux/of_device.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
@@ -207,7 +207,7 @@ static int tegra_gpio_get_direction(struct gpio_chip *chip, | |||
207 | 207 | ||
208 | oe = tegra_gpio_readl(tgi, GPIO_OE(tgi, offset)); | 208 | oe = tegra_gpio_readl(tgi, GPIO_OE(tgi, offset)); |
209 | 209 | ||
210 | return (oe & pin_mask) ? GPIOF_DIR_OUT : GPIOF_DIR_IN; | 210 | return !(oe & pin_mask); |
211 | } | 211 | } |
212 | 212 | ||
213 | static int tegra_gpio_set_debounce(struct gpio_chip *chip, unsigned int offset, | 213 | static int tegra_gpio_set_debounce(struct gpio_chip *chip, unsigned int offset, |
@@ -323,13 +323,6 @@ static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type) | |||
323 | return -EINVAL; | 323 | return -EINVAL; |
324 | } | 324 | } |
325 | 325 | ||
326 | ret = gpiochip_lock_as_irq(&tgi->gc, gpio); | ||
327 | if (ret) { | ||
328 | dev_err(tgi->dev, | ||
329 | "unable to lock Tegra GPIO %u as IRQ\n", gpio); | ||
330 | return ret; | ||
331 | } | ||
332 | |||
333 | spin_lock_irqsave(&bank->lvl_lock[port], flags); | 326 | spin_lock_irqsave(&bank->lvl_lock[port], flags); |
334 | 327 | ||
335 | val = tegra_gpio_readl(tgi, GPIO_INT_LVL(tgi, gpio)); | 328 | val = tegra_gpio_readl(tgi, GPIO_INT_LVL(tgi, gpio)); |
@@ -342,6 +335,14 @@ static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type) | |||
342 | tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, gpio), gpio, 0); | 335 | tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, gpio), gpio, 0); |
343 | tegra_gpio_enable(tgi, gpio); | 336 | tegra_gpio_enable(tgi, gpio); |
344 | 337 | ||
338 | ret = gpiochip_lock_as_irq(&tgi->gc, gpio); | ||
339 | if (ret) { | ||
340 | dev_err(tgi->dev, | ||
341 | "unable to lock Tegra GPIO %u as IRQ\n", gpio); | ||
342 | tegra_gpio_disable(tgi, gpio); | ||
343 | return ret; | ||
344 | } | ||
345 | |||
345 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) | 346 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) |
346 | irq_set_handler_locked(d, handle_level_irq); | 347 | irq_set_handler_locked(d, handle_level_irq); |
347 | else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) | 348 | else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) |
@@ -550,13 +551,6 @@ static const struct dev_pm_ops tegra_gpio_pm_ops = { | |||
550 | SET_SYSTEM_SLEEP_PM_OPS(tegra_gpio_suspend, tegra_gpio_resume) | 551 | SET_SYSTEM_SLEEP_PM_OPS(tegra_gpio_suspend, tegra_gpio_resume) |
551 | }; | 552 | }; |
552 | 553 | ||
553 | /* | ||
554 | * This lock class tells lockdep that GPIO irqs are in a different category | ||
555 | * than their parents, so it won't report false recursion. | ||
556 | */ | ||
557 | static struct lock_class_key gpio_lock_class; | ||
558 | static struct lock_class_key gpio_request_class; | ||
559 | |||
560 | static int tegra_gpio_probe(struct platform_device *pdev) | 554 | static int tegra_gpio_probe(struct platform_device *pdev) |
561 | { | 555 | { |
562 | struct tegra_gpio_info *tgi; | 556 | struct tegra_gpio_info *tgi; |
@@ -661,8 +655,6 @@ static int tegra_gpio_probe(struct platform_device *pdev) | |||
661 | 655 | ||
662 | bank = &tgi->bank_info[GPIO_BANK(gpio)]; | 656 | bank = &tgi->bank_info[GPIO_BANK(gpio)]; |
663 | 657 | ||
664 | irq_set_lockdep_class(irq, &gpio_lock_class, | ||
665 | &gpio_request_class); | ||
666 | irq_set_chip_data(irq, bank); | 658 | irq_set_chip_data(irq, bank); |
667 | irq_set_chip_and_handler(irq, &tgi->ic, handle_simple_irq); | 659 | irq_set_chip_and_handler(irq, &tgi->ic, handle_simple_irq); |
668 | } | 660 | } |