]> Git Repo - linux.git/commitdiff
Merge tag 'gpio-v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux...
authorLinus Torvalds <[email protected]>
Mon, 2 Nov 2015 20:59:12 +0000 (12:59 -0800)
committerLinus Torvalds <[email protected]>
Mon, 2 Nov 2015 20:59:12 +0000 (12:59 -0800)
Pull GPIO updates from Linus Walleij:
 "Here is the bulk of GPIO changes for the v4.4 development cycle.

  The only changes hitting outside drivers/gpio are in the pin control
  subsystem and these seem to have settled nicely in linux-next.

  Development mistakes and catfights are nicely documented in the
  reverts as you can see.  The outcome of the ABI fight is that we're
  working on a chardev ABI for GPIO now, where hope to show results for
  the v4.5 kernel.

  Summary of changes:

  GPIO core:
   - Define and handle flags for open drain/open collector and open
     source/open emitter, also know as "single-ended" configurations.
   - Generic request/free operations that handle calling out to the
     (optional) pin control backend.
   - Some refactoring related to an ABI change that did not happen, yet
     provide useful.
   - Added a real-time compliance checklist.  Many GPIO chips have
     irqchips, and need to think this over with the RT patches going
     upstream.
   - Restructure, fix and clean up Kconfig menus a bit.

  New drivers:
   - New driver for AMD Promony.
   - New driver for ACCES 104-IDIO-16, a port-mapped I/O card,
     ISA-style.  Very retro.

  Subdriver changes:
   - OMAP changes to handle real time requirements.
   - Handle trigger types for edge and level IRQs on PL061 properly.  As
     this hardware is very common it needs to set a proper example for
     others to follow.
   - Some container_of() cleanups.
   - Delete the unused MSM driver in favor of the driver that is
     embedded inside the pin control driver.
   - Cleanup of the ath79 GPIO driver used by many, many OpenWRT router
     targets.
   - A consolidated IT87xx driver replacing the earlier very specific
     IT8761e driver.
   - Handle the TI TCA9539 in the PCA953x driver.  Also handle ACPI
     devices in this subdriver.
   - Drop xilinx arch dependencies as these FPGAs seem to profilate over
     a few different architectures.  MIPS and ARM come to mind"

* tag 'gpio-v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (57 commits)
  gpio: fix up SPI submenu
  gpio: drop surplus I2C dependencies
  gpio: drop surplus X86 dependencies
  gpio: dt-bindings: document the official use of "ngpios"
  gpio: MAINTAINERS: Add an entry for the ATH79 GPIO driver
  gpio / ACPI: Allow shared GPIO event to be read via operation region
  gpio: group port-mapped I/O drivers in a menu
  gpio: Add ACCES 104-IDIO-16 driver maintainer entry
  gpio: zynq: Document interrupt-controller DT binding
  gpio: xilinx: Drop architecture dependencies
  gpio: generic: Revert to old error handling in bgpio_map
  gpio: add a real time compliance notes
  Revert "gpio: add a real time compliance checklist"
  gpio: Add GPIO support for the ACCES 104-IDIO-16
  gpio: driver for AMD Promontory
  gpio: xlp: Convert to use gpiolib irqchip helpers
  gpio: add a real time compliance checklist
  gpio/xilinx: enable for MIPS
  gpiolib: Add and use OF_GPIO_SINGLE_ENDED flag
  gpiolib: Split GPIO flags parsing and GPIO configuration
  ...

1  2 
Documentation/devicetree/bindings/gpio/gpio.txt
MAINTAINERS
drivers/pinctrl/intel/pinctrl-intel.c
drivers/pinctrl/mediatek/pinctrl-mtk-common.c
drivers/pinctrl/pinctrl-at91.c
drivers/pinctrl/pinctrl-rockchip.c
drivers/pinctrl/sunxi/pinctrl-sunxi.c

index 82d40e2505f641be635dd8769b0051508bcf0120,e9c49dc4e89587aacf38bf5a5c1ff4a121f522b4..069cdf6f9dace228fe8fd97dc63c2d861273fc03
@@@ -16,9 -16,7 +16,9 @@@ properties, each containing a 'gpio-lis
  GPIO properties should be named "[<name>-]gpios", with <name> being the purpose
  of this GPIO for the device. While a non-existent <name> is considered valid
  for compatibility reasons (resolving to the "gpios" property), it is not allowed
 -for new bindings.
 +for new bindings. Also, GPIO properties named "[<name>-]gpio" are valid and old
 +bindings use it, but are only supported for compatibility reasons and should not
 +be used for newer bindings since it has been deprecated.
  
  GPIO properties can contain one or more GPIO phandles, but only in exceptional
  cases should they contain more than one. If your device uses several GPIOs with
@@@ -54,9 -52,13 +54,13 @@@ only uses one
  
  gpio-specifier may encode: bank, pin position inside the bank,
  whether pin is open-drain and whether pin is logically inverted.
  Exact meaning of each specifier cell is controller specific, and must
- be documented in the device tree binding for the device. Use the macros
- defined in include/dt-bindings/gpio/gpio.h whenever possible:
+ be documented in the device tree binding for the device.
+ Most controllers are however specifying a generic flag bitfield
+ in the last cell, so for these, use the macros defined in
+ include/dt-bindings/gpio/gpio.h whenever possible:
  
  Example of a node using GPIOs:
  
  GPIO_ACTIVE_HIGH is 0, so in this example gpio-specifier is "18 0" and encodes
  GPIO pin number, and GPIO flags as accepted by the "qe_pio_e" gpio-controller.
  
+ Optional standard bitfield specifiers for the last cell:
+ - Bit 0: 0 means active high, 1 means active low
+ - Bit 1: 1 means single-ended wiring, see:
+            https://en.wikipedia.org/wiki/Single-ended_triode
+          When used with active-low, this means open drain/collector, see:
+            https://en.wikipedia.org/wiki/Open_collector
+          When used with active-high, this means open source/emitter
  1.1) GPIO specifier best practices
  ----------------------------------
  
@@@ -118,6 -129,30 +131,30 @@@ Every GPIO controller node must contai
  property, and a #gpio-cells integer property, which indicates the number of
  cells in a gpio-specifier.
  
+ Optionally, a GPIO controller may have a "ngpios" property. This property
+ indicates the number of in-use slots of available slots for GPIOs. The
+ typical example is something like this: the hardware register is 32 bits
+ wide, but only 18 of the bits have a physical counterpart. The driver is
+ generally written so that all 32 bits can be used, but the IP block is reused
+ in a lot of designs, some using all 32 bits, some using 18 and some using
+ 12. In this case, setting "ngpios = <18>;" informs the driver that only the
+ first 18 GPIOs, at local offset 0 .. 17, are in use.
+ If these GPIOs do not happen to be the first N GPIOs at offset 0...N-1, an
+ additional bitmask is needed to specify which GPIOs are actually in use,
+ and which are dummies. The bindings for this case has not yet been
+ specified, but should be specified if/when such hardware appears.
+ Example:
+ gpio-controller@00000000 {
+       compatible = "foo";
+       reg = <0x00000000 0x1000>;
+       gpio-controller;
+       #gpio-cells = <2>;
+       ngpios = <18>;
+ }
  The GPIO chip may contain GPIO hog definitions. GPIO hogging is a mechanism
  providing automatic GPIO request and configuration as part of the
  gpio-controller's driver probe function.
diff --combined MAINTAINERS
index c9c6052b995166373ada1bbc928592c23c221239,6ad9d5c784c9fc3f397e9ee4e25b384b8fd492d3..77ed3a028625888c7c191e774b10be12091ffdf3
@@@ -240,6 -240,12 +240,12 @@@ L:       [email protected]
  S:    Maintained
  F:    drivers/hwmon/abituguru3.c
  
+ ACCES 104-IDIO-16 GPIO DRIVER
+ M:    "William Breathitt Gray" <[email protected]>
+ L:    [email protected]
+ S:    Maintained
+ F:    drivers/gpio/gpio-104-idio-16.c
  ACENIC DRIVER
  M:    Jes Sorensen <[email protected]>
  L:    [email protected]
@@@ -615,8 -621,9 +621,8 @@@ F: Documentation/hwmon/fam15h_powe
  F:    drivers/hwmon/fam15h_power.c
  
  AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER
 -M:    Thomas Dahlmann <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
 -S:    Supported
 +S:    Orphan
  F:    drivers/usb/gadget/udc/amd5536udc.*
  
  AMD GEODE PROCESSOR/CHIPSET SUPPORT
@@@ -807,13 -814,6 +813,13 @@@ S:       Maintaine
  F:    drivers/video/fbdev/arcfb.c
  F:    drivers/video/fbdev/core/fb_defio.c
  
 +ARCNET NETWORK LAYER
 +M:    Michael Grzeschik <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/net/arcnet/
 +F:    include/uapi/linux/if_arcnet.h
 +
  ARM MFM AND FLOPPY DRIVERS
  M:    Ian Molton <[email protected]>
  S:    Maintained
@@@ -894,12 -894,11 +900,12 @@@ M:      Lennert Buytenhek <kernel@wantstofly
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
  
 -ARM/Allwinner A1X SoC support
 +ARM/Allwinner sunXi SoC support
  M:    Maxime Ripard <[email protected]>
 +M:    Chen-Yu Tsai <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
 -N:    sun[x4567]i
 +N:    sun[x456789]i
  
  ARM/Allwinner SoC Clock Support
  M:    Emilio López <[email protected]>
@@@ -1780,6 -1779,14 +1786,14 @@@ S:    Supporte
  F:    Documentation/aoe/
  F:    drivers/block/aoe/
  
+ ATHEROS 71XX/9XXX GPIO DRIVER
+ M:    Alban Bedel <[email protected]>
+ W:    https://github.com/AlbanBedel/linux
+ T:    git git://github.com/AlbanBedel/linux
+ S:    Maintained
+ F:    drivers/gpio/gpio-ath79.c
+ F:    Documentation/devicetree/bindings/gpio/gpio-ath79.txt
  ATHEROS ATH GENERIC UTILITIES
  M:    "Luis R. Rodriguez" <[email protected]>
  L:    [email protected]
@@@ -3401,6 -3408,7 +3415,6 @@@ F:      drivers/staging/dgnc
  
  DIGI EPCA PCI PRODUCTS
  M:    Lidza Louina <[email protected]>
 -M:    Mark Hounschell <[email protected]>
  M:    Daeseok Youn <[email protected]>
  L:    [email protected]
  S:    Maintained
@@@ -3592,13 -3600,6 +3606,13 @@@ F:    drivers/gpu/drm/i915
  F:    include/drm/i915*
  F:    include/uapi/drm/i915*
  
 +DRM DRIVERS FOR ATMEL HLCDC
 +M:    Boris Brezillon <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    drivers/gpu/drm/atmel-hlcdc/
 +F:    Documentation/devicetree/bindings/drm/atmel/
 +
  DRM DRIVERS FOR EXYNOS
  M:    Inki Dae <[email protected]>
  M:    Joonyoung Shim <[email protected]>
@@@ -3627,14 -3628,6 +3641,14 @@@ S:    Maintaine
  F:    drivers/gpu/drm/imx/
  F:    Documentation/devicetree/bindings/drm/imx/
  
 +DRM DRIVERS FOR GMA500 (Poulsbo, Moorestown and derivative chipsets)
 +M:    Patrik Jakobsson <[email protected]>
 +L:    [email protected]
 +T:    git git://github.com/patjak/drm-gma500
 +S:    Maintained
 +F:    drivers/gpu/drm/gma500
 +F:    include/drm/gma500*
 +
  DRM DRIVERS FOR NVIDIA TEGRA
  M:    Thierry Reding <[email protected]>
  M:    Terje Bergström <[email protected]>
@@@ -4019,7 -4012,7 +4033,7 @@@ S:      Maintaine
  F:    sound/usb/misc/ua101.c
  
  EXTENSIBLE FIRMWARE INTERFACE (EFI)
 -M:    Matt Fleming <matt[email protected]>
 +M:    Matt Fleming <matt@codeblueprint.co.uk>
  L:    [email protected]
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git
  S:    Maintained
@@@ -4034,7 -4027,7 +4048,7 @@@ F:      include/linux/efi*.
  EFI VARIABLE FILESYSTEM
  M:    Matthew Garrett <[email protected]>
  M:    Jeremy Kerr <[email protected]>
 -M:    Matt Fleming <matt[email protected]>
 +M:    Matt Fleming <matt@codeblueprint.co.uk>
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git
  L:    [email protected]
  S:    Maintained
  S:    Maintained
  F:    drivers/net/ethernet/freescale/ucc_geth*
  
 +FREESCALE eTSEC ETHERNET DRIVER (GIANFAR)
 +M:    Claudiu Manoil <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/net/ethernet/freescale/gianfar*
 +X:    drivers/net/ethernet/freescale/gianfar_ptp.c
 +F:    Documentation/devicetree/bindings/net/fsl-tsec-phy.txt
 +
  FREESCALE QUICC ENGINE UCC UART DRIVER
  M:    Timur Tabi <[email protected]>
  L:    [email protected]
@@@ -5981,7 -5966,7 +5995,7 @@@ F:      virt/kvm
  KERNEL VIRTUAL MACHINE (KVM) FOR AMD-V
  M:    Joerg Roedel <[email protected]>
  L:    [email protected]
 -W:    http://kvm.qumranet.com
 +W:    http://www.linux-kvm.org/
  S:    Maintained
  F:    arch/x86/include/asm/svm.h
  F:    arch/x86/kvm/svm.c
  KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC
  M:    Alexander Graf <[email protected]>
  L:    [email protected]
 -W:    http://kvm.qumranet.com
 +W:    http://www.linux-kvm.org/
  T:    git git://github.com/agraf/linux-2.6.git
  S:    Supported
  F:    arch/powerpc/include/asm/kvm*
@@@ -6802,6 -6787,7 +6816,6 @@@ F:      drivers/scsi/megaraid
  
  MELLANOX ETHERNET DRIVER (mlx4_en)
  M:    Amir Vadai <[email protected]>
 -M:    Ido Shamay <[email protected]>
  L:    [email protected]
  S:    Supported
  W:    http://www.mellanox.com
  S:    Maintained
  F:    drivers/pinctrl/pinctrl-at91.*
  
 +PIN CONTROLLER - ATMEL AT91 PIO4
 +M:    Ludovic Desroches <[email protected]>
 +L:    [email protected] (moderated for non-subscribers)
 +L:    [email protected]
 +S:    Supported
 +F:    drivers/pinctrl/pinctrl-at91-pio4.*
 +
  PIN CONTROLLER - INTEL
  M:    Mika Westerberg <[email protected]>
  M:    Heikki Krogerus <[email protected]>
@@@ -8535,6 -8514,7 +8549,6 @@@ F:      Documentation/networking/LICENSE.qla
  F:    drivers/net/ethernet/qlogic/qla3xxx.*
  
  QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER
 -M:    Shahed Shaikh <[email protected]>
  M:    [email protected]
  L:    [email protected]
  S:    Supported
@@@ -9131,15 -9111,6 +9145,15 @@@ S: Supporte
  F: Documentation/devicetree/bindings/net/snps,dwc-qos-ethernet.txt
  F: drivers/net/ethernet/synopsys/dwc_eth_qos.c
  
 +SYNOPSYS DESIGNWARE I2C DRIVER
 +M:    Andy Shevchenko <[email protected]>
 +M:    Jarkko Nikula <[email protected]>
 +M:    Mika Westerberg <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/i2c/busses/i2c-designware-*
 +F:    include/linux/platform_data/i2c-designware.h
 +
  SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER
  M:    Seungwon Jeon <[email protected]>
  M:    Jaehoon Chung <[email protected]>
@@@ -9947,12 -9918,13 +9961,12 @@@ F:   drivers/staging/media/lirc
  STAGING - LUSTRE PARALLEL FILESYSTEM
  M:    Oleg Drokin <[email protected]>
  M:    Andreas Dilger <[email protected]>
 -L:    [email protected].org (moderated for non-subscribers)
 -W:    http://lustre.opensfs.org/
 +L:    [email protected].org (moderated for non-subscribers)
 +W:    http://wiki.lustre.org/
  S:    Maintained
  F:    drivers/staging/lustre
  
  STAGING - NVIDIA COMPLIANT EMBEDDED CONTROLLER INTERFACE (nvec)
 -M:    Julian Andres Klode <[email protected]>
  M:    Marc Dietrich <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  L:    [email protected]
@@@ -10380,16 -10352,6 +10394,16 @@@ F: include/uapi/linux/thermal.
  F:    include/linux/cpu_cooling.h
  F:    Documentation/devicetree/bindings/thermal/
  
 +THERMAL/CPU_COOLING
 +M:    Amit Daniel Kachhap <[email protected]>
 +M:    Viresh Kumar <[email protected]>
 +M:    Javi Merino <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    Documentation/thermal/cpu-cooling-api.txt
 +F:    drivers/thermal/cpu_cooling.c
 +F:    include/linux/cpu_cooling.h
 +
  THINGM BLINK(1) USB RGB LED DRIVER
  M:    Vivien Didelot <[email protected]>
  S:    Maintained
@@@ -11239,7 -11201,7 +11253,7 @@@ F:   drivers/vlynq/vlynq.
  F:    include/linux/vlynq.h
  
  VME SUBSYSTEM
 -M:    Martyn Welch <martyn[email protected]>
 +M:    Martyn Welch <martyn@welchs.me.uk>
  M:    Manohar Vanga <[email protected]>
  M:    Greg Kroah-Hartman <[email protected]>
  L:    [email protected]
@@@ -11291,6 -11253,7 +11305,6 @@@ VOLTAGE AND CURRENT REGULATOR FRAMEWOR
  M:    Liam Girdwood <[email protected]>
  M:    Mark Brown <[email protected]>
  L:    [email protected]
 -W:    http://opensource.wolfsonmicro.com/node/15
  W:    http://www.slimlogic.co.uk/?p=48
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git
  S:    Supported
  S:    Maintained
  F:    drivers/net/vrf.c
  F:    include/net/vrf.h
 +F:    Documentation/networking/vrf.txt
  
  VT1211 HARDWARE MONITOR DRIVER
  M:    Juerg Haefliger <[email protected]>
@@@ -11416,10 -11378,21 +11430,10 @@@ W:        http://oops.ghostprotocols.net:81/bl
  S:    Maintained
  F:    drivers/net/wireless/wl3501*
  
 -WM97XX TOUCHSCREEN DRIVERS
 -M:    Mark Brown <[email protected]>
 -M:    Liam Girdwood <[email protected]>
 -L:    [email protected]
 -T:    git git://opensource.wolfsonmicro.com/linux-2.6-touch
 -W:    http://opensource.wolfsonmicro.com/node/7
 -S:    Supported
 -F:    drivers/input/touchscreen/*wm97*
 -F:    include/linux/wm97xx.h
 -
  WOLFSON MICROELECTRONICS DRIVERS
  L:    [email protected]
 -T:    git git://opensource.wolfsonmicro.com/linux-2.6-asoc
 -T:    git git://opensource.wolfsonmicro.com/linux-2.6-audioplus
 -W:    http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices
 +T:    git https://github.com/CirrusLogic/linux-drivers.git
 +W:    https://github.com/CirrusLogic/linux-drivers/wiki
  S:    Supported
  F:    Documentation/hwmon/wm83??
  F:    arch/arm/mach-s3c64xx/mach-crag6410*
@@@ -11690,7 -11663,6 +11704,7 @@@ F:   drivers/tty/serial/zs.
  ZSMALLOC COMPRESSED SLAB MEMORY ALLOCATOR
  M:    Minchan Kim <[email protected]>
  M:    Nitin Gupta <[email protected]>
 +R:    Sergey Senozhatsky <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    mm/zsmalloc.c
index c4274542a5a02aad4e1dca14e5969cebf744a212,928a00b48d501e34390873569573d9297d49c527..392e28d3f48d0bee1a4087154e904c7dfdc0faa7
@@@ -12,7 -12,6 +12,7 @@@
  
  #include <linux/module.h>
  #include <linux/init.h>
 +#include <linux/interrupt.h>
  #include <linux/acpi.h>
  #include <linux/gpio.h>
  #include <linux/gpio/driver.h>
@@@ -160,7 -159,8 +160,7 @@@ static bool intel_pad_owned_by_host(str
        return !(readl(padown) & PADOWN_MASK(padno));
  }
  
 -static bool intel_pad_reserved_for_acpi(struct intel_pinctrl *pctrl,
 -                                      unsigned pin)
 +static bool intel_pad_acpi_mode(struct intel_pinctrl *pctrl, unsigned pin)
  {
        const struct intel_community *community;
        unsigned padno, gpp, offset;
@@@ -216,6 -216,7 +216,6 @@@ static bool intel_pad_locked(struct int
  static bool intel_pad_usable(struct intel_pinctrl *pctrl, unsigned pin)
  {
        return intel_pad_owned_by_host(pctrl, pin) &&
 -              !intel_pad_reserved_for_acpi(pctrl, pin) &&
                !intel_pad_locked(pctrl, pin);
  }
  
@@@ -268,7 -269,7 +268,7 @@@ static void intel_pin_dbg_show(struct p
        seq_printf(s, "0x%08x 0x%08x", cfg0, cfg1);
  
        locked = intel_pad_locked(pctrl, pin);
 -      acpi = intel_pad_reserved_for_acpi(pctrl, pin);
 +      acpi = intel_pad_acpi_mode(pctrl, pin);
  
        if (locked || acpi) {
                seq_puts(s, " [");
@@@ -596,16 -597,6 +596,6 @@@ static const struct pinctrl_desc intel_
        .owner = THIS_MODULE,
  };
  
- static int intel_gpio_request(struct gpio_chip *chip, unsigned offset)
- {
-       return pinctrl_request_gpio(chip->base + offset);
- }
- static void intel_gpio_free(struct gpio_chip *chip, unsigned offset)
- {
-       pinctrl_free_gpio(chip->base + offset);
- }
  static int intel_gpio_get(struct gpio_chip *chip, unsigned offset)
  {
        struct intel_pinctrl *pctrl = gpiochip_to_pinctrl(chip);
@@@ -653,8 -644,8 +643,8 @@@ static int intel_gpio_direction_output(
  
  static const struct gpio_chip intel_gpio_chip = {
        .owner = THIS_MODULE,
-       .request = intel_gpio_request,
-       .free = intel_gpio_free,
+       .request = gpiochip_generic_request,
+       .free = gpiochip_generic_free,
        .direction_input = intel_gpio_direction_input,
        .direction_output = intel_gpio_direction_output,
        .get = intel_gpio_get,
@@@ -735,16 -726,6 +725,16 @@@ static int intel_gpio_irq_type(struct i
        if (!reg)
                return -EINVAL;
  
 +      /*
 +       * If the pin is in ACPI mode it is still usable as a GPIO but it
 +       * cannot be used as IRQ because GPI_IS status bit will not be
 +       * updated by the host controller hardware.
 +       */
 +      if (intel_pad_acpi_mode(pctrl, pin)) {
 +              dev_warn(pctrl->dev, "pin %u cannot be used as IRQ\n", pin);
 +              return -EPERM;
 +      }
 +
        spin_lock_irqsave(&pctrl->lock, flags);
  
        value = readl(reg);
@@@ -812,11 -793,9 +802,11 @@@ static int intel_gpio_irq_wake(struct i
        return 0;
  }
  
 -static void intel_gpio_community_irq_handler(struct gpio_chip *gc,
 +static irqreturn_t intel_gpio_community_irq_handler(struct intel_pinctrl *pctrl,
        const struct intel_community *community)
  {
 +      struct gpio_chip *gc = &pctrl->chip;
 +      irqreturn_t ret = IRQ_NONE;
        int gpp;
  
        for (gpp = 0; gpp < community->ngpps; gpp++) {
                        irq = irq_find_mapping(gc->irqdomain,
                                               community->pin_base + padno);
                        generic_handle_irq(irq);
 +
 +                      ret |= IRQ_HANDLED;
                }
        }
 +
 +      return ret;
  }
  
 -static void intel_gpio_irq_handler(struct irq_desc *desc)
 +static irqreturn_t intel_gpio_irq(int irq, void *data)
  {
 -      struct gpio_chip *gc = irq_desc_get_handler_data(desc);
 -      struct intel_pinctrl *pctrl = gpiochip_to_pinctrl(gc);
 -      struct irq_chip *chip = irq_desc_get_chip(desc);
 +      const struct intel_community *community;
 +      struct intel_pinctrl *pctrl = data;
 +      irqreturn_t ret = IRQ_NONE;
        int i;
  
 -      chained_irq_enter(chip, desc);
 -
        /* Need to check all communities for pending interrupts */
 -      for (i = 0; i < pctrl->ncommunities; i++)
 -              intel_gpio_community_irq_handler(gc, &pctrl->communities[i]);
 +      for (i = 0; i < pctrl->ncommunities; i++) {
 +              community = &pctrl->communities[i];
 +              ret |= intel_gpio_community_irq_handler(pctrl, community);
 +      }
  
 -      chained_irq_exit(chip, desc);
 +      return ret;
  }
  
  static struct irq_chip intel_gpio_irqchip = {
        .irq_set_wake = intel_gpio_irq_wake,
  };
  
 -static void intel_gpio_irq_init(struct intel_pinctrl *pctrl)
 -{
 -      size_t i;
 -
 -      for (i = 0; i < pctrl->ncommunities; i++) {
 -              const struct intel_community *community;
 -              void __iomem *base;
 -              unsigned gpp;
 -
 -              community = &pctrl->communities[i];
 -              base = community->regs;
 -
 -              for (gpp = 0; gpp < community->ngpps; gpp++) {
 -                      /* Mask and clear all interrupts */
 -                      writel(0, base + community->ie_offset + gpp * 4);
 -                      writel(0xffff, base + GPI_IS + gpp * 4);
 -              }
 -      }
 -}
 -
  static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
  {
        int ret;
                                     0, 0, pctrl->soc->npins);
        if (ret) {
                dev_err(pctrl->dev, "failed to add GPIO pin range\n");
 -              gpiochip_remove(&pctrl->chip);
 -              return ret;
 +              goto fail;
 +      }
 +
 +      /*
 +       * We need to request the interrupt here (instead of providing chip
 +       * to the irq directly) because on some platforms several GPIO
 +       * controllers share the same interrupt line.
 +       */
 +      ret = devm_request_irq(pctrl->dev, irq, intel_gpio_irq, IRQF_SHARED,
 +                             dev_name(pctrl->dev), pctrl);
 +      if (ret) {
 +              dev_err(pctrl->dev, "failed to request interrupt\n");
 +              goto fail;
        }
  
        ret = gpiochip_irqchip_add(&pctrl->chip, &intel_gpio_irqchip, 0,
                                   handle_simple_irq, IRQ_TYPE_NONE);
        if (ret) {
                dev_err(pctrl->dev, "failed to add irqchip\n");
 -              gpiochip_remove(&pctrl->chip);
 -              return ret;
 +              goto fail;
        }
  
        gpiochip_set_chained_irqchip(&pctrl->chip, &intel_gpio_irqchip, irq,
 -                                   intel_gpio_irq_handler);
 +                                   NULL);
        return 0;
 +
 +fail:
 +      gpiochip_remove(&pctrl->chip);
 +
 +      return ret;
  }
  
  static int intel_pinctrl_pm_init(struct intel_pinctrl *pctrl)
@@@ -1097,26 -1077,6 +1087,26 @@@ int intel_pinctrl_suspend(struct devic
  }
  EXPORT_SYMBOL_GPL(intel_pinctrl_suspend);
  
 +static void intel_gpio_irq_init(struct intel_pinctrl *pctrl)
 +{
 +      size_t i;
 +
 +      for (i = 0; i < pctrl->ncommunities; i++) {
 +              const struct intel_community *community;
 +              void __iomem *base;
 +              unsigned gpp;
 +
 +              community = &pctrl->communities[i];
 +              base = community->regs;
 +
 +              for (gpp = 0; gpp < community->ngpps; gpp++) {
 +                      /* Mask and clear all interrupts */
 +                      writel(0, base + community->ie_offset + gpp * 4);
 +                      writel(0xffff, base + GPI_IS + gpp * 4);
 +              }
 +      }
 +}
 +
  int intel_pinctrl_resume(struct device *dev)
  {
        struct platform_device *pdev = to_platform_device(dev);
index 5279e230e1b5e156a575e011b039c600f32c90b8,f8fafc18d49acfec32e2048a958b70902e8d49f9..f307f1d27d646fcd3954a9d497528fffbf16dc2b
@@@ -723,16 -723,6 +723,6 @@@ static const struct pinmux_ops mtk_pmx_
        .gpio_set_direction     = mtk_pmx_gpio_set_direction,
  };
  
- static int mtk_gpio_request(struct gpio_chip *chip, unsigned offset)
- {
-       return pinctrl_request_gpio(chip->base + offset);
- }
- static void mtk_gpio_free(struct gpio_chip *chip, unsigned offset)
- {
-       pinctrl_free_gpio(chip->base + offset);
- }
  static int mtk_gpio_direction_input(struct gpio_chip *chip,
                                        unsigned offset)
  {
@@@ -899,7 -889,7 +889,7 @@@ static int mtk_eint_flip_edge(struct mt
        int start_level, curr_level;
        unsigned int reg_offset;
        const struct mtk_eint_offsets *eint_offsets = &(pctl->devdata->eint_offsets);
 -      u32 mask = 1 << (hwirq & 0x1f);
 +      u32 mask = BIT(hwirq & 0x1f);
        u32 port = (hwirq >> 5) & eint_offsets->port_mask;
        void __iomem *reg = pctl->eint_reg_base + (port << 2);
        const struct mtk_desc_pin *pin;
@@@ -1005,8 -995,8 +995,8 @@@ static int mtk_gpio_set_debounce(struc
  
  static struct gpio_chip mtk_gpio_chip = {
        .owner                  = THIS_MODULE,
-       .request                = mtk_gpio_request,
-       .free                   = mtk_gpio_free,
+       .request                = gpiochip_generic_request,
+       .free                   = gpiochip_generic_free,
        .direction_input        = mtk_gpio_direction_input,
        .direction_output       = mtk_gpio_direction_output,
        .get                    = mtk_gpio_get,
@@@ -1436,7 -1426,7 +1426,7 @@@ int mtk_pctrl_init(struct platform_devi
                irq_set_chip_and_handler(virq, &mtk_pinctrl_irq_chip,
                        handle_level_irq);
                irq_set_chip_data(virq, pctl);
 -      };
 +      }
  
        irq_set_chained_handler_and_data(irq, mtk_eint_irq_handler, pctl);
        return 0;
index 7a828ae6716ba4602c0da3e9537c9ba5945af14c,ce6e589f6433e6515437d53c001495eb516dd5d5..0d2fc0cff35ee6216ef5e62a77376e63cb2675e7
@@@ -1122,10 -1122,8 +1122,10 @@@ static int at91_pinctrl_parse_functions
                func->groups[i] = child->name;
                grp = &info->groups[grp_index++];
                ret = at91_pinctrl_parse_groups(child, grp, info, i++);
 -              if (ret)
 +              if (ret) {
 +                      of_node_put(child);
                        return ret;
 +              }
        }
  
        return 0;
@@@ -1198,7 -1196,6 +1198,7 @@@ static int at91_pinctrl_probe_dt(struc
                ret = at91_pinctrl_parse_functions(child, info, i++);
                if (ret) {
                        dev_err(&pdev->dev, "failed to parse function\n");
 +                      of_node_put(child);
                        return ret;
                }
        }
@@@ -1280,28 -1277,6 +1280,6 @@@ static int at91_pinctrl_remove(struct p
        return 0;
  }
  
- static int at91_gpio_request(struct gpio_chip *chip, unsigned offset)
- {
-       /*
-        * Map back to global GPIO space and request muxing, the direction
-        * parameter does not matter for this controller.
-        */
-       int gpio = chip->base + offset;
-       int bank = chip->base / chip->ngpio;
-       dev_dbg(chip->dev, "%s:%d pio%c%d(%d)\n", __func__, __LINE__,
-                'A' + bank, offset, gpio);
-       return pinctrl_request_gpio(gpio);
- }
- static void at91_gpio_free(struct gpio_chip *chip, unsigned offset)
- {
-       int gpio = chip->base + offset;
-       pinctrl_free_gpio(gpio);
- }
  static int at91_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
  {
        struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
@@@ -1687,8 -1662,8 +1665,8 @@@ static int at91_gpio_of_irq_setup(struc
  
  /* This structure is replicated for each GPIO block allocated at probe time */
  static struct gpio_chip at91_gpio_template = {
-       .request                = at91_gpio_request,
-       .free                   = at91_gpio_free,
+       .request                = gpiochip_generic_request,
+       .free                   = gpiochip_generic_free,
        .get_direction          = at91_gpio_get_direction,
        .direction_input        = at91_gpio_direction_input,
        .get                    = at91_gpio_get,
index 3d020fdc7bb6db617ee4a8e18d7688575a0b8e20,d79889a9d5d7f4eeed6c3a8601ebf596837d79d5..a0651128e23acc68fbe139dc10da3e859da2b9a1
@@@ -1374,16 -1374,6 +1374,6 @@@ static int rockchip_pinctrl_register(st
   * GPIO handling
   */
  
- static int rockchip_gpio_request(struct gpio_chip *chip, unsigned offset)
- {
-       return pinctrl_request_gpio(chip->base + offset);
- }
- static void rockchip_gpio_free(struct gpio_chip *chip, unsigned offset)
- {
-       pinctrl_free_gpio(chip->base + offset);
- }
  static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
  {
        struct rockchip_pin_bank *bank = gc_to_pin_bank(gc);
@@@ -1461,8 -1451,8 +1451,8 @@@ static int rockchip_gpio_to_irq(struct 
  }
  
  static const struct gpio_chip rockchip_gpiolib_chip = {
-       .request = rockchip_gpio_request,
-       .free = rockchip_gpio_free,
+       .request = gpiochip_generic_request,
+       .free = gpiochip_generic_free,
        .set = rockchip_gpio_set,
        .get = rockchip_gpio_get,
        .direction_input = rockchip_gpio_direction_input,
@@@ -2089,21 -2079,6 +2079,21 @@@ static struct rockchip_pin_ctrl rk2928_
                .pull_calc_reg          = rk2928_calc_pull_reg_and_bit,
  };
  
 +static struct rockchip_pin_bank rk3036_pin_banks[] = {
 +      PIN_BANK(0, 32, "gpio0"),
 +      PIN_BANK(1, 32, "gpio1"),
 +      PIN_BANK(2, 32, "gpio2"),
 +};
 +
 +static struct rockchip_pin_ctrl rk3036_pin_ctrl = {
 +              .pin_banks              = rk3036_pin_banks,
 +              .nr_banks               = ARRAY_SIZE(rk3036_pin_banks),
 +              .label                  = "RK3036-GPIO",
 +              .type                   = RK2928,
 +              .grf_mux_offset         = 0xa8,
 +              .pull_calc_reg          = rk2928_calc_pull_reg_and_bit,
 +};
 +
  static struct rockchip_pin_bank rk3066a_pin_banks[] = {
        PIN_BANK(0, 32, "gpio0"),
        PIN_BANK(1, 32, "gpio1"),
@@@ -2222,8 -2197,6 +2212,8 @@@ static struct rockchip_pin_ctrl rk3368_
  static const struct of_device_id rockchip_pinctrl_dt_match[] = {
        { .compatible = "rockchip,rk2928-pinctrl",
                .data = (void *)&rk2928_pin_ctrl },
 +      { .compatible = "rockchip,rk3036-pinctrl",
 +              .data = (void *)&rk3036_pin_ctrl },
        { .compatible = "rockchip,rk3066a-pinctrl",
                .data = (void *)&rk3066a_pin_ctrl },
        { .compatible = "rockchip,rk3066b-pinctrl",
index 21fd638171f92d7070cb9dc724e2b2b9bbc1e651,f9c7a05541d814f7fc12ae4c09e9583fee81828d..dead97daca35fe2e59a0e81f7898b4e66f27b0cb
@@@ -446,16 -446,6 +446,6 @@@ static const struct pinmux_ops sunxi_pm
        .gpio_set_direction     = sunxi_pmx_gpio_set_direction,
  };
  
- static int sunxi_pinctrl_gpio_request(struct gpio_chip *chip, unsigned offset)
- {
-       return pinctrl_request_gpio(chip->base + offset);
- }
- static void sunxi_pinctrl_gpio_free(struct gpio_chip *chip, unsigned offset)
- {
-       pinctrl_free_gpio(chip->base + offset);
- }
  static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,
                                        unsigned offset)
  {
@@@ -716,7 -706,6 +706,7 @@@ static int sunxi_pinctrl_irq_of_xlate(s
                                      unsigned long *out_hwirq,
                                      unsigned int *out_type)
  {
 +      struct sunxi_pinctrl *pctl = d->host_data;
        struct sunxi_desc_function *desc;
        int pin, base;
  
                return -EINVAL;
  
        base = PINS_PER_BANK * intspec[0];
 -      pin = base + intspec[1];
 +      pin = pctl->desc->pin_base + base + intspec[1];
  
 -      desc = sunxi_pinctrl_desc_find_function_by_pin(d->host_data,
 -                                                     pin, "irq");
 +      desc = sunxi_pinctrl_desc_find_function_by_pin(pctl, pin, "irq");
        if (!desc)
                return -EINVAL;
  
@@@ -956,8 -946,8 +946,8 @@@ int sunxi_pinctrl_init(struct platform_
  
        last_pin = pctl->desc->pins[pctl->desc->npins - 1].pin.number;
        pctl->chip->owner = THIS_MODULE;
-       pctl->chip->request = sunxi_pinctrl_gpio_request,
-       pctl->chip->free = sunxi_pinctrl_gpio_free,
+       pctl->chip->request = gpiochip_generic_request,
+       pctl->chip->free = gpiochip_generic_free,
        pctl->chip->direction_input = sunxi_pinctrl_gpio_direction_input,
        pctl->chip->direction_output = sunxi_pinctrl_gpio_direction_output,
        pctl->chip->get = sunxi_pinctrl_gpio_get,
                irq_set_chip_and_handler(irqno, &sunxi_pinctrl_edge_irq_chip,
                                         handle_edge_irq);
                irq_set_chip_data(irqno, pctl);
 -      };
 +      }
  
        for (i = 0; i < pctl->desc->irq_banks; i++) {
                /* Mask and clear all IRQs before registering a handler */
This page took 0.105486 seconds and 4 git commands to generate.