aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/Kconfig9
-rw-r--r--drivers/gpio/gpio-104-dio-48e.c4
-rw-r--r--drivers/gpio/gpio-bcm-kona.c4
-rw-r--r--drivers/gpio/gpio-zynq.c7
-rw-r--r--drivers/gpio/gpiolib-of.c1
-rw-r--r--drivers/gpio/gpiolib.c6
6 files changed, 20 insertions, 11 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 48da857f4774..cebcb405812e 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -33,6 +33,7 @@ config ARCH_REQUIRE_GPIOLIB
33 33
34menuconfig GPIOLIB 34menuconfig GPIOLIB
35 bool "GPIO Support" 35 bool "GPIO Support"
36 select ANON_INODES
36 help 37 help
37 This enables GPIO support through the generic GPIO library. 38 This enables GPIO support through the generic GPIO library.
38 You only need to enable this, if you also want to enable 39 You only need to enable this, if you also want to enable
@@ -530,7 +531,7 @@ menu "Port-mapped I/O GPIO drivers"
530 531
531config GPIO_104_DIO_48E 532config GPIO_104_DIO_48E
532 tristate "ACCES 104-DIO-48E GPIO support" 533 tristate "ACCES 104-DIO-48E GPIO support"
533 depends on ISA 534 depends on ISA_BUS_API
534 select GPIOLIB_IRQCHIP 535 select GPIOLIB_IRQCHIP
535 help 536 help
536 Enables GPIO support for the ACCES 104-DIO-48E series (104-DIO-48E, 537 Enables GPIO support for the ACCES 104-DIO-48E series (104-DIO-48E,
@@ -540,7 +541,7 @@ config GPIO_104_DIO_48E
540 541
541config GPIO_104_IDIO_16 542config GPIO_104_IDIO_16
542 tristate "ACCES 104-IDIO-16 GPIO support" 543 tristate "ACCES 104-IDIO-16 GPIO support"
543 depends on ISA 544 depends on ISA_BUS_API
544 select GPIOLIB_IRQCHIP 545 select GPIOLIB_IRQCHIP
545 help 546 help
546 Enables GPIO support for the ACCES 104-IDIO-16 family (104-IDIO-16, 547 Enables GPIO support for the ACCES 104-IDIO-16 family (104-IDIO-16,
@@ -551,7 +552,7 @@ config GPIO_104_IDIO_16
551 552
552config GPIO_104_IDI_48 553config GPIO_104_IDI_48
553 tristate "ACCES 104-IDI-48 GPIO support" 554 tristate "ACCES 104-IDI-48 GPIO support"
554 depends on ISA 555 depends on ISA_BUS_API
555 select GPIOLIB_IRQCHIP 556 select GPIOLIB_IRQCHIP
556 help 557 help
557 Enables GPIO support for the ACCES 104-IDI-48 family (104-IDI-48A, 558 Enables GPIO support for the ACCES 104-IDI-48 family (104-IDI-48A,
@@ -627,7 +628,7 @@ config GPIO_TS5500
627 628
628config GPIO_WS16C48 629config GPIO_WS16C48
629 tristate "WinSystems WS16C48 GPIO support" 630 tristate "WinSystems WS16C48 GPIO support"
630 depends on ISA 631 depends on ISA_BUS_API
631 select GPIOLIB_IRQCHIP 632 select GPIOLIB_IRQCHIP
632 help 633 help
633 Enables GPIO support for the WinSystems WS16C48. The base port 634 Enables GPIO support for the WinSystems WS16C48. The base port
diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
index 1a647c07be67..fcf776971ca9 100644
--- a/drivers/gpio/gpio-104-dio-48e.c
+++ b/drivers/gpio/gpio-104-dio-48e.c
@@ -75,7 +75,7 @@ static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
75{ 75{
76 struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); 76 struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
77 const unsigned io_port = offset / 8; 77 const unsigned io_port = offset / 8;
78 const unsigned control_port = io_port / 2; 78 const unsigned int control_port = io_port / 3;
79 const unsigned control_addr = dio48egpio->base + 3 + control_port*4; 79 const unsigned control_addr = dio48egpio->base + 3 + control_port*4;
80 unsigned long flags; 80 unsigned long flags;
81 unsigned control; 81 unsigned control;
@@ -115,7 +115,7 @@ static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
115{ 115{
116 struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); 116 struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
117 const unsigned io_port = offset / 8; 117 const unsigned io_port = offset / 8;
118 const unsigned control_port = io_port / 2; 118 const unsigned int control_port = io_port / 3;
119 const unsigned mask = BIT(offset % 8); 119 const unsigned mask = BIT(offset % 8);
120 const unsigned control_addr = dio48egpio->base + 3 + control_port*4; 120 const unsigned control_addr = dio48egpio->base + 3 + control_port*4;
121 const unsigned out_port = (io_port > 2) ? io_port + 1 : io_port; 121 const unsigned out_port = (io_port > 2) ? io_port + 1 : io_port;
diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c
index 9aabc48ff5de..953e4b829e32 100644
--- a/drivers/gpio/gpio-bcm-kona.c
+++ b/drivers/gpio/gpio-bcm-kona.c
@@ -547,11 +547,11 @@ static void bcm_kona_gpio_reset(struct bcm_kona_gpio *kona_gpio)
547 /* disable interrupts and clear status */ 547 /* disable interrupts and clear status */
548 for (i = 0; i < kona_gpio->num_bank; i++) { 548 for (i = 0; i < kona_gpio->num_bank; i++) {
549 /* Unlock the entire bank first */ 549 /* Unlock the entire bank first */
550 bcm_kona_gpio_write_lock_regs(kona_gpio, i, UNLOCK_CODE); 550 bcm_kona_gpio_write_lock_regs(reg_base, i, UNLOCK_CODE);
551 writel(0xffffffff, reg_base + GPIO_INT_MASK(i)); 551 writel(0xffffffff, reg_base + GPIO_INT_MASK(i));
552 writel(0xffffffff, reg_base + GPIO_INT_STATUS(i)); 552 writel(0xffffffff, reg_base + GPIO_INT_STATUS(i));
553 /* Now re-lock the bank */ 553 /* Now re-lock the bank */
554 bcm_kona_gpio_write_lock_regs(kona_gpio, i, LOCK_CODE); 554 bcm_kona_gpio_write_lock_regs(reg_base, i, LOCK_CODE);
555 } 555 }
556} 556}
557 557
diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
index 75c6355b018d..e72794e463aa 100644
--- a/drivers/gpio/gpio-zynq.c
+++ b/drivers/gpio/gpio-zynq.c
@@ -709,7 +709,13 @@ static int zynq_gpio_probe(struct platform_device *pdev)
709 dev_err(&pdev->dev, "input clock not found.\n"); 709 dev_err(&pdev->dev, "input clock not found.\n");
710 return PTR_ERR(gpio->clk); 710 return PTR_ERR(gpio->clk);
711 } 711 }
712 ret = clk_prepare_enable(gpio->clk);
713 if (ret) {
714 dev_err(&pdev->dev, "Unable to enable clock.\n");
715 return ret;
716 }
712 717
718 pm_runtime_set_active(&pdev->dev);
713 pm_runtime_enable(&pdev->dev); 719 pm_runtime_enable(&pdev->dev);
714 ret = pm_runtime_get_sync(&pdev->dev); 720 ret = pm_runtime_get_sync(&pdev->dev);
715 if (ret < 0) 721 if (ret < 0)
@@ -747,6 +753,7 @@ err_pm_put:
747 pm_runtime_put(&pdev->dev); 753 pm_runtime_put(&pdev->dev);
748err_pm_dis: 754err_pm_dis:
749 pm_runtime_disable(&pdev->dev); 755 pm_runtime_disable(&pdev->dev);
756 clk_disable_unprepare(gpio->clk);
750 757
751 return ret; 758 return ret;
752} 759}
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index d22dcc38179d..4aabddb38b59 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -16,6 +16,7 @@
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/io-mapping.h>
19#include <linux/gpio/consumer.h> 20#include <linux/gpio/consumer.h>
20#include <linux/of.h> 21#include <linux/of.h>
21#include <linux/of_address.h> 22#include <linux/of_address.h>
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 24f60d28f0c0..58d822d7e8da 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -449,7 +449,6 @@ static void gpiodevice_release(struct device *dev)
449{ 449{
450 struct gpio_device *gdev = dev_get_drvdata(dev); 450 struct gpio_device *gdev = dev_get_drvdata(dev);
451 451
452 cdev_del(&gdev->chrdev);
453 list_del(&gdev->list); 452 list_del(&gdev->list);
454 ida_simple_remove(&gpio_ida, gdev->id); 453 ida_simple_remove(&gpio_ida, gdev->id);
455 kfree(gdev->label); 454 kfree(gdev->label);
@@ -482,7 +481,6 @@ static int gpiochip_setup_dev(struct gpio_device *gdev)
482 481
483 /* From this point, the .release() function cleans up gpio_device */ 482 /* From this point, the .release() function cleans up gpio_device */
484 gdev->dev.release = gpiodevice_release; 483 gdev->dev.release = gpiodevice_release;
485 get_device(&gdev->dev);
486 pr_debug("%s: registered GPIOs %d to %d on device: %s (%s)\n", 484 pr_debug("%s: registered GPIOs %d to %d on device: %s (%s)\n",
487 __func__, gdev->base, gdev->base + gdev->ngpio - 1, 485 __func__, gdev->base, gdev->base + gdev->ngpio - 1,
488 dev_name(&gdev->dev), gdev->chip->label ? : "generic"); 486 dev_name(&gdev->dev), gdev->chip->label ? : "generic");
@@ -770,6 +768,8 @@ void gpiochip_remove(struct gpio_chip *chip)
770 * be removed, else it will be dangling until the last user is 768 * be removed, else it will be dangling until the last user is
771 * gone. 769 * gone.
772 */ 770 */
771 cdev_del(&gdev->chrdev);
772 device_del(&gdev->dev);
773 put_device(&gdev->dev); 773 put_device(&gdev->dev);
774} 774}
775EXPORT_SYMBOL_GPL(gpiochip_remove); 775EXPORT_SYMBOL_GPL(gpiochip_remove);
@@ -869,7 +869,7 @@ struct gpio_chip *gpiochip_find(void *data,
869 869
870 spin_lock_irqsave(&gpio_lock, flags); 870 spin_lock_irqsave(&gpio_lock, flags);
871 list_for_each_entry(gdev, &gpio_devices, list) 871 list_for_each_entry(gdev, &gpio_devices, list)
872 if (match(gdev->chip, data)) 872 if (gdev->chip && match(gdev->chip, data))
873 break; 873 break;
874 874
875 /* No match? */ 875 /* No match? */