Commit Graph

3001 Commits

Author SHA1 Message Date
Julia Cartwright 3906e8089a gpio: 104-idio-16: make use of raw_spinlock variants
The 104-idio-16 gpio driver currently implements an irq_chip for handling
interrupts; due to how irq_chip handling is done, it's necessary for the
irq_chip methods to be invoked from hardirq context, even on a a
real-time kernel.  Because the spinlock_t type becomes a "sleeping"
spinlock w/ RT kernels, it is not suitable to be used with irq_chips.

A quick audit of the operations under the lock reveal that they do only
minimal, bounded work, and are therefore safe to do under a raw spinlock.

Signed-off-by: Julia Cartwright <julia@ni.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-28 11:12:36 +02:00
Greg Kroah-Hartman 57c0eabbd5 Merge 4.11-rc4 into char-misc-next
We want the char-misc fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-27 09:13:04 +02:00
Russell King 0e3cb6ee38 gpio: gpio-reg: add irq mapping for gpio-reg users
Add support for mapping gpio-reg gpios to interrupts.  This may be a
non-linear mapping - some gpios in the register may not even have
corresponding interrupts associated with them, so we need to pass an
array.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-24 14:05:00 +01:00
Russell King 380639c7cc gpio: add generic single-register fixed-direction GPIO driver
Add a simple, generic, single register fixed-direction GPIO driver.
This is able to support a single register with a mixture of inputs
and outputs.

This is different from gpio-mmio and gpio-74xx-mmio:
* gpio-mmio doesn't allow a fixed direction, it assumes there is always
  a direction register.
* gpio-74xx-mmio only supports all-in or all-out setups
* gpio-74xx-mmio is DT only, this needs to support legacy too
* they don't double-read when getting the GPIO value, as required by
  some implementations that this driver supports
* we need to always do 32-bit reads, which bgpio doesn't guarantee
* the current output state may not be readable from the hardware
  register - reading may reflect input status but not output status.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-24 14:04:46 +01:00
Russell King c65d1fd350 gpio: sa1100: implement get_direction method
Allow gpiolib to read back the current IO direction configuration by
implementing the .get_direction callback.  This, in part, allows
debugfs to report the complete true hardware state rather than the
software state.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-24 14:04:37 +01:00
Russell King 07242b2481 gpio: sa1100: convert to use IO accessors
Use IO accessors to access the SA1100 registers rather than accessing
them directly.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-24 14:04:26 +01:00
Russell King 9dd4819ed5 gpio: sa1100: use sa11x0_gpio_set_wake()
Use sa11x0_gpio_set_wake() to set the PWER register, as provided by
Dmitry some time back.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-24 14:04:13 +01:00
Andy Shevchenko 7477e137dc gpio: merrifield: Don't use GPIOF_DIR_IN / GPIOF_DIR_OUT
The mentioned flags are dedicated solely for consumer API.
Replace them by explicit values.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[Made a !bang clamp to (0,1) instead of infix ? operator]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-23 14:06:46 +01:00
Charles Keepax 9674a8dc5b gpio: wm831x: Add basic device tree support
Now the wm831x-core has basic DT support we can update this driver to
allow use of the GPIOs within a device tree system.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-23 11:45:55 +00:00
Andy Shevchenko 96530b3777 gpio: pca953x: Expand comment for "reset" GPIO in ACPI case
GPIO ACPI library is going to be stricter about resources, thus, expand
comment regarding "reset" GPIO resource in this driver to clarify its
usage in ACPI case.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-23 10:42:44 +01:00
Andy Shevchenko b413d7a01c gpio: pca953x: Sort headers alphabetically
For sake of better maintenance sort the headers by alphabetical order.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-23 10:41:17 +01:00
Andy Shevchenko 66e5719231 gpio: pca953x: Introduce a long awaited ->get_direction()
Introduce ->get_direction() callback for the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[Removed use of GPIOF_DIR* flags]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-23 10:40:13 +01:00
Ralph Sennhauser d2cabc4a23 gpio: mvebu: use BIT macro instead of bit shifting
Use the BIT macro instead of explicitly shifting bits for some added
clarity.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-23 10:21:39 +01:00
Nathan Sullivan b8c90199b5 gpio: mmio: add support for NI 169445 NAND GPIO
The GPIO-based NAND controller on National Instruments 169445 hardware
exposes a set of simple lines for the control signals.

Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-23 09:49:06 +01:00
Linus Walleij d8307c0920 gpio: moxart: Switch to using the FTGPIO010 driver
This just deletes the Moxa ART driver and replaces it with the
more versatile Faraday FTGPIO010 driver.

Make this default on for ARCH_GEMINI and ARCH_MOXART so we do
not get Kconfig glitches.

Tested-by: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-22 09:45:02 +01:00
Linus Walleij 9d3a15aaae gpio: gemini: rename to match Faraday IP
The Gemini driver is actually a driver for the Faraday Technology
FTGPIO010 IP block. We rename the driver and the Kconfig symbol and
put in a a new compatible string for the Moxa ART SoC that is also
using this IP block.

Tested-by: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-22 09:40:55 +01:00
Logan Gunthorpe 111379dccc gpiolib: utilize new cdev_device_add helper function
Replace the open coded registration of the cdev and dev with the
new device_add_cdev() helper. The helper replaces a common pattern by
taking the proper reference against the parent device and adding both
the cdev and the device.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-21 06:44:33 +01:00
Robert Middleton 2cd29f2387 gpio:mcp23s08 Fixed missing interrupts
When an interrupt occurs on an MCP23S08 chip, the INTF register will only
contain one bit as causing the interrupt.  If more than two pins change at
the same time on the chip, this causes one of the pins to not be reported.
This patch fixes the logic for checking if a pin has changed, so that
multiple pins will always cause more than one change.

Cc: stable@vger.kernel.org
Signed-off-by: Robert Middleton <robert.middleton@rm5248.com>
Tested-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-17 09:20:28 +01:00
Ralph Sennhauser f07708c43b gpio: mvebu: let the compiler inline
A modern compiler should know better when to inline, so drop the inline
keywords.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:16 +01:00
Ralph Sennhauser f4c240ca4b gpio: mvebu: extra whitespace fixes
Fix whitespace errors missed by checkpatch.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:15 +01:00
Ralph Sennhauser 163ad364cc gpio: mvebu: checkpatch: whitespace fixes
Fix whitespace errors reported by checkpatch.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:15 +01:00
Ralph Sennhauser d276de70d2 gpio: mvebu: checkpatch: unsigned int fixes
Use unsigned int instead of plain unsigned as reported by checkpatch.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:14 +01:00
Ralph Sennhauser 899c37edfe gpio: mvebu: start multiline block comments with blank line
While this isn't an issue according to checkpatch two styles are used.
Add a blank line to the block comments missing a blank line at the start
so multiline block comments look the same across the file.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:14 +01:00
Ralph Sennhauser 7077f4cc1e gpio: mvebu: checkpatch: block comment fixes
Fix issues in block comments reported by checkpatch.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:13 +01:00
Hans de Goede 6798d7271c gpio: acpi: Ignore -EPROBE_DEFER for unselected gpioints
When acpi_dev_gpio_irq_get gets called with an index of say 2, it should
not care if acpi_get_gpiod for index 0 or 1 returns -EPROBE_DEFER.

This allows drivers which request a gpioint with index > 0 to function
if there is no gpiochip driver (loaded) for gpioints with a lower index.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:13 +01:00
Andy Shevchenko 4033d4a4f5 gpio: of: Don't return 0 on dt_gpio_count()
It's unusual to have error checking like (ret <= 0) in cases when
counting GPIO resources. In case when it's mandatory we propagate the
error (-ENOENT), otherwise we don't use the result.

This makes consistent behaviour across all possible variants called in
gpiod_count().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:11 +01:00
Andy Shevchenko 4ed55016d7 gpio: acpi: Don't return 0 on acpi_gpio_count()
It's unusual to have error checking like (ret <= 0) in cases when
counting GPIO resources. In case when it's mandatory we propagate the
error (-ENOENT), otherwise we don't use the result.

This makes consistent behaviour across all possible variants called in
gpiod_count().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:11 +01:00
Jayachandran C 529f75d8ca gpio: xlp: Update for ARCH_THUNDER2
ARCH_VULCAN arm64 platform (for Broadcom Vulcan ARM64 processors) has
been discontinued. Cavium's ThunderX2 CN99XX (ARCH_THUNDER2) will be
the next revision of this platform.

Update compile dependencies and ACPI ID to reflect this change.

Signed-off-by: Jayachandran C <jnair@caviumnetworks.com>
[Drop depreciation of ARCH_VULCAN]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:10 +01:00
Julia Cartwright 8c41ab4f05 gpio: zx: make use of raw_spinlock variants
The zx gpio driver currently implements an irq_chip for handling
interrupts; due to how irq_chip handling is done, it's necessary for the
irq_chip methods to be invoked from hardirq context, even on a a
real-time kernel.  Because the spinlock_t type becomes a "sleeping"
spinlock w/ RT kernels, it is not suitable to be used with irq_chips.

A quick audit of the operations under the lock reveal that they do only
minimal, bounded work, and are therefore safe to do under a raw spinlock.

Signed-off-by: Julia Cartwright <julia@ni.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:10 +01:00
Julia Cartwright a0a584f0e9 gpio: ws16c48: make use of raw_spinlock variants
The ws16c48 gpio driver currently implements an irq_chip for handling
interrupts; due to how irq_chip handling is done, it's necessary for the
irq_chip methods to be invoked from hardirq context, even on a a
real-time kernel.  Because the spinlock_t type becomes a "sleeping"
spinlock w/ RT kernels, it is not suitable to be used with irq_chips.

A quick audit of the operations under the lock reveal that they do only
minimal, bounded work, and are therefore safe to do under a raw spinlock.

Signed-off-by: Julia Cartwright <julia@ni.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:09 +01:00
Julia Cartwright 99b9b45de8 gpio: pl061: make use of raw_spinlock variants
The pl061 gpio driver currently implements an irq_chip for handling
interrupts; due to how irq_chip handling is done, it's necessary for the
irq_chip methods to be invoked from hardirq context, even on a a
real-time kernel.  Because the spinlock_t type becomes a "sleeping"
spinlock w/ RT kernels, it is not suitable to be used with irq_chips.

A quick audit of the operations under the lock reveal that they do only
minimal, bounded work, and are therefore safe to do under a raw spinlock.

Signed-off-by: Julia Cartwright <julia@ni.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:09 +01:00
Julia Cartwright f9c56536d5 gpio: etraxfs: make use of raw_spinlock variants
The etraxfs gpio driver currently implements an irq_chip for handling
interrupts; due to how irq_chip handling is done, it's necessary for the
irq_chip methods to be invoked from hardirq context, even on a a
real-time kernel.  Because the spinlock_t type becomes a "sleeping"
spinlock w/ RT kernels, it is not suitable to be used with irq_chips.

A quick audit of the operations under the lock reveal that they do only
minimal, bounded work, and are therefore safe to do under a raw spinlock.

Signed-off-by: Julia Cartwright <julia@ni.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:08 +01:00
Julia Cartwright a080ce53ee gpio: ath79: make use of raw_spinlock variants
The ath79 gpio driver currently implements an irq_chip for handling
interrupts; due to how irq_chip handling is done, it's necessary for the
irq_chip methods to be invoked from hardirq context, even on a a
real-time kernel.  Because the spinlock_t type becomes a "sleeping"
spinlock w/ RT kernels, it is not suitable to be used with irq_chips.

A quick audit of the operations under the lock reveal that they do only
minimal, bounded work, and are therefore safe to do under a raw spinlock.

Signed-off-by: Julia Cartwright <julia@ni.com>
Acked-by: Aban Bedel <albeu@free.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:08 +01:00
Julia Cartwright c69fcea57e gpio: bcm-kona: make use of raw_spinlock variants
The bcm-kona gpio driver currently implements an irq_chip for handling
interrupts; due to how irq_chip handling is done, it's necessary for the
irq_chip methods to be invoked from hardirq context, even on a a
real-time kernel.  Because the spinlock_t type becomes a "sleeping"
spinlock w/ RT kernels, it is not suitable to be used with irq_chips.

A quick audit of the operations under the lock reveal that they do only
minimal, bounded work, and are therefore safe to do under a raw spinlock.

Signed-off-by: Julia Cartwright <julia@ni.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:07 +01:00
Julia Cartwright 45897809d5 gpio: 104-dio-48e: make use of raw_spinlock variants
The 104-dio-48e gpio driver currently implements an irq_chip for
handling interrupts; due to how irq_chip handling is done, it's
necessary for the irq_chip methods to be invoked from hardirq context,
even on a a real-time kernel.  Because the spinlock_t type becomes a
"sleeping" spinlock w/ RT kernels, it is not suitable to be used with
irq_chips.

A quick audit of the operations under the lock reveal that they do only
minimal, bounded work, and are therefore safe to do under a raw spinlock.

Signed-off-by: Julia Cartwright <julia@ni.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:07 +01:00
Julia Cartwright 21d01c9c08 gpio: altera: make use of raw_spinlock variants
The altera gpio driver currently implements an irq_chip for handling
interrupts; due to how irq_chip handling is done, it's necessary for the
irq_chip methods to be invoked from hardirq context, even on a a real-time
kernel.  Because the spinlock_t type becomes a "sleeping" spinlock w/ RT
kernels, it is not suitable to be used with irq_chips.

A quick audit of the operations under the lock reveal that they do only
minimal, bounded work, and are therefore safe to do under a raw spinlock.

Signed-off-by: Julia Cartwright <julia@ni.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-16 21:52:06 +01:00
William Breathitt Gray 660549e05d gpio: pc104: Mask PC/104 drivers via PC104 Kconfig option
PC/104 drivers should be hidden on machines which do not support PC/104
devices. This patch adds the PC104 Kconfig option as a dependency for
the relevant PC/104 device driver Kconfig options.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:38 +01:00
Bartosz Golaszewski 7ad63c790b gpio: sta2x11: use resource management for irqs
Use device resource managed variants of irq_alloc_descs() and
request_irq() and remove the code manually freeing irq resources.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:38 +01:00
Bartosz Golaszewski 8514b5439c gpio: mxs: use devm_irq_alloc_descs()
This driver never frees the interrupt descriptors it allocates. Fix
it by using the resource managed version of irq_alloc_descs().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:37 +01:00
Bartosz Golaszewski c553c3c478 gpio: mxc: use devm_irq_alloc_descs()
This driver never frees the interrupt descriptors it allocates. Fix
it by using the resource managed version of irq_alloc_descs().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:37 +01:00
Bartosz Golaszewski 74dd9ebfff gpio: sodaville: use resource management for irqs
Use device resource managed variants of irq_alloc_descs() and
request_irq() and remove the code manually freeing irq resources.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:36 +01:00
Bartosz Golaszewski a1a3c2d551 gpio: davinci: use devm_irq_alloc_descs()
This driver never frees the interrupt descriptors it allocates. Fix
it by using the resource managed version of irq_alloc_descs().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:36 +01:00
Bartosz Golaszewski bda61a192a gpio: pxa: use devm_irq_alloc_descs()
This driver never frees the interrupt descriptors it allocates. Fix
it by using the resource managed version of irq_alloc_descs().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:35 +01:00
Bartosz Golaszewski 31bd86d983 gpio: xlp: use resource management for irqs
Use the resource managed variant of irq_alloc_descs() and remove the
code manually freeing allocated interrupt descriptors.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:35 +01:00
Bartosz Golaszewski e971ac9a56 gpio: ml-ioh: use resource management for irqs
Use device resource managed variants of irq_alloc_descs() and
request_irq() and remove the code manually freeing irq resources.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:34 +01:00
Bartosz Golaszewski f57f3e6003 gpio: pch: use resource management for irqs
Use device resource managed variants of irq_alloc_descs() and
request_irq() and remove the code manually freeing irq resources.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:33 +01:00
Bartosz Golaszewski 2ed36f3013 gpio: omap: use devm_irq_alloc_descs()
This driver never frees the allocated interrupt descriptors. Fix it by
using a resource managed variant of irq_alloc_descs().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:33 +01:00
Bartosz Golaszewski 9bc81137e8 gpio: twl4030: use devm_irq_alloc_descs()
This driver never frees the irq descriptors it allocates. Fix it by
using a resource managed variant of irq_alloc_descs().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:32 +01:00
Bartosz Golaszewski 62a7ca0735 gpio: mockup: use devm_irq_alloc_descs()
Use the resource managed variant of irq_alloc_descs(). This allows us
to remove gpio_mockup_remove().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:32 +01:00
Axel Lin eddeae0737 gpio: exar: Set proper output level in exar_direction_output
Current code does not set output level in exar_direction_output, fix it.
Also move the direction_output/direction_input code block to avoid forward
declaration for exar_set_value().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:31 +01:00
Andy Shevchenko 85c73d50e5 gpio: acpi: Add managed variant of acpi_dev_add_driver_gpios()
Introduce device managed variant of acpi_dev_add_driver_gpios() and its
counterpart acpi_dev_remove_driver_gpios().

The functions in most cases are used in driver's ->probe() and
->remove() callbacks, that's why it's useful to have managed variant of
them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Rafael J. Wysocki <rjw@rjwysocki.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-15 11:16:29 +01:00
Andy Shevchenko ff21378a32 gpiolib: Fix spelling of 'successful'
Remove extra 'l' in "successfull".

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-14 10:51:28 +01:00
Phil Reid f759921cfb gpio: altera: Use handle_level_irq when configured as a level_high
When a threaded irq handler is chained attached to one of the gpio
pins when configure for level irq the altera_gpio_irq_leveL_high_handler
does not mask the interrupt while being handled by the chained irq.
This resulting in the threaded irq not getting enough cycles to complete
quickly enough before the irq was disabled as faulty. handle_level_irq
should be used in this situation instead of handle_simple_irq.

In gpiochip_irqchip_add set default handler to handle_bad_irq as
per Documentation/gpio/driver.txt. Then set the correct handler in
the set_type callback.

Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-06 14:35:22 +01:00
Arnd Bergmann b115bebc07 gpio: xgene: mark PM functions as __maybe_unused
When CONFIG_PM_SLEEP is disabled, we get a warning about unused functions:

drivers/gpio/gpio-xgene.c:155:12: warning: 'xgene_gpio_resume' defined but not used [-Wunused-function]
 static int xgene_gpio_resume(struct device *dev)
            ^~~~~~~~~~~~~~~~~
drivers/gpio/gpio-xgene.c:142:12: warning: 'xgene_gpio_suspend' defined but not used [-Wunused-function]
 static int xgene_gpio_suspend(struct device *dev)

The warnings are harmless and can be avoided by simplifying the code and marking
the functions as __maybe_unused.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-06 14:35:22 +01:00
Dan Carpenter fa6256db03 gpio: mockup: return -EFAULT if copy_from_user() fails
copy_from_user() returns the number of bytes remaining to be copied but
we want to return negative error codes on failue.

Fixes: 9202ba2397 ("gpio: mockup: implement event injecting over debugfs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-06 14:35:21 +01:00
Thor Thayer 9ce9f79997 gpio: altera-a10sr: Set gpio_chip parent property
Set the gpio_chip parent property since some recent functions
such as devprop_gpiochip_set_names() can use it.

Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-06 14:35:21 +01:00
Hoan Tran a72b8c4a63 gpio: dwapb: Add support for next generation of X-Gene SoC
Next generation of X-Gene SoC's GPIO hardware register map is very
similar to DW GPIO. It only differs by a few register addresses.
This patch modifies DW GPIO driver to accommodate the difference
in a few register addresses.

Signed-off-by: Hoan Tran <hotran@apm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-03-06 14:34:53 +01:00
Linus Torvalds 1ec5c1867a This is the bulk of GPIO changes for the v4.11 cycle
Core changes:
 
 - Augment fwnode_get_named_gpiod() to configure the GPIO pin
   immediately after requesting it like all other APIs do.
   This is a treewide change also updating all users.
 
 - Pass a GPIO label down to gpiod_request() from
   fwnode_get_named_gpiod(). This makes debugfs and the userspace
   ABI correctly reflect the current in-kernel consumer of a pin
   taken using this abstraction. This is a treewide change also
   updating all users.
 
 - Rename devm_get_gpiod_from_child() to
   devm_fwnode_get_gpiod_from_child() to reflect the fact that this
   function is operating on a fwnode object. This is a treewide
   change also updating all users.
 
 - Make it possible to take multiple GPIOs in a single hog of device
   tree hogs.
 
 - The refactorings switching GPIO chips to use the .set_config()
   callback using standard pin control properties and providing
   a backend into the pin control subsystem that were also merged
   into the pin control tree naturally appear here too.
 
 Testing instrumentation:
 
 - A whole slew of cleanups and improvements to the mockup GPIO
   driver. We now have an extended userspace test exercising the
   subsystem, and we can inject interrupts etc from userspace
   to fully test the core GPIO functionality.
 
 New drivers:
 
 - New driver for the Cortina Systems Gemini GPIO controller.
 
 - New driver for the Exar XR17V352/354/358 chips.
 
 - New driver for the ACCES PCI-IDIO-16 PCI GPIO card.
 
 Driver changes:
 
 - RCAR: set the irqchip parent device, add fine-grained runtime
   PM support.
 
 - pca953x: support optional RESET control line on the chip.
 
 - DaVinci: cleanups and simplifications. Add support for multiple
   instances.
 
 - .set_multiple() and naming of lines on more or less all of the
   ISA/PCI GPIO controllers.
 
 - mcp23s08: refactored to use regmap as a first step to further
   rewrites and modernizations.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJYrqvqAAoJEEEQszewGV1zoHsP/i1iZBEywR9+yIx/p2/F2mJu
 nriuYFlp0V3FjHQAQ//YCA9+Catri+ZqT5l+BmG/EYdqqikHbziTyS0YArlfrMHv
 OOBfDmfftexvRI/jQAl+X/nIW531ZjYo6ZApFy/2TirTwfkI7DIMi6ujm09fcG5D
 BgCT1KuszbVtyrmhrQvbeEdVKw0qLAgwnn5eOOCQE4KuDB3s7eyal0rJaDEXhpMF
 kH/y6eySs4FChEhAEmCkM6205F5T4c2YFjL1bo5Fkh/WPrVPaKI0Ny16qbaDWU9K
 W9RaJUzf92KIW0MgcRl+r8Lxn+GekN6/jvrxddQ/Ajs/Dkh5r2JCrm7RIC9tBPcJ
 VbLfjL+cMehlSEu9eyxRQcAIeuUYCqkN8ghuVoj9xt/tDtNYsQIcJZtfW1yjmONq
 mFsd5KhfBFgspQkwF4IX3hthaqj8MH4zefQdWzAGPZMGEA1rrx2kVSEdZD3EV4VN
 84qt5Cx9hLllafthJOGjEIZFCjPIpbMRwTQ+fmc+1IB1DgN8Kc5E1FMssKbUEoOK
 2eLquLvd7iNDMidTjoi87YAisW9qnrPeRDywsqeXdQf7fzpB97gX4MQfJ5fJWEYr
 3uHCfu2u4J4cff9ygg8c4ut7ePEjz+ld/sBh9EHicbbryR4I5ZG7Ne1aQhsmb2M5
 dHZSRfQYEQ4Nl7cMJQuh
 =O81I
 -----END PGP SIGNATURE-----

Merge tag 'gpio-v4.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO updates from Linus Walleij:
 "This is the bulk of GPIO changes for the v4.11 cycle

  Core changes:

   - Augment fwnode_get_named_gpiod() to configure the GPIO pin
     immediately after requesting it like all other APIs do. This is a
     treewide change also updating all users.

   - Pass a GPIO label down to gpiod_request() from
     fwnode_get_named_gpiod(). This makes debugfs and the userspace ABI
     correctly reflect the current in-kernel consumer of a pin taken
     using this abstraction. This is a treewide change also updating all
     users.

   - Rename devm_get_gpiod_from_child() to
     devm_fwnode_get_gpiod_from_child() to reflect the fact that this
     function is operating on a fwnode object. This is a treewide change
     also updating all users.

   - Make it possible to take multiple GPIOs in a single hog of device
     tree hogs.

   - The refactorings switching GPIO chips to use the .set_config()
     callback using standard pin control properties and providing a
     backend into the pin control subsystem that were also merged into
     the pin control tree naturally appear here too.

  Testing instrumentation:

   - A whole slew of cleanups and improvements to the mockup GPIO
     driver. We now have an extended userspace test exercising the
     subsystem, and we can inject interrupts etc from userspace to fully
     test the core GPIO functionality.

  New drivers:

   - New driver for the Cortina Systems Gemini GPIO controller.

   - New driver for the Exar XR17V352/354/358 chips.

   - New driver for the ACCES PCI-IDIO-16 PCI GPIO card.

  Driver changes:

   - RCAR: set the irqchip parent device, add fine-grained runtime PM
     support.

   - pca953x: support optional RESET control line on the chip.

   - DaVinci: cleanups and simplifications. Add support for multiple
     instances.

   - .set_multiple() and naming of lines on more or less all of the
     ISA/PCI GPIO controllers.

   - mcp23s08: refactored to use regmap as a first step to further
     rewrites and modernizations"

* tag 'gpio-v4.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (61 commits)
  gpio: reintroduce devm_get_gpiod_from_child()
  gpio: pci-idio-16: Fix PCI BAR index
  gpio: pci-idio-16: Fix PCI device ID code
  gpio: mockup: implement event injecting over debugfs
  gpio: mockup: add a dummy irqchip
  gpio: mockup: implement naming the lines
  gpio: mockup: code shrink
  gpio: mockup: readability tweaks
  gpio: Add GPIO support for the ACCES PCI-IDIO-16
  gpio: Add the devm_fwnode_get_index_gpiod_from_child() helper
  gpio: Rename devm_get_gpiod_from_child()
  gpio: mcp23s08: Select REGMAP/REGMAP_I2C to fix build error
  gpio: ws16c48: Add support for GPIO names
  gpio: gpio-mm: Add support for GPIO names
  gpio: 104-idio-16: Add support for GPIO names
  gpio: 104-idi-48: Add support for GPIO names
  gpio: 104-dio-48e: Add support for GPIO names
  gpio: ws16c48: Remove unnecessary driver_data set
  gpio: gpio-mm: Remove unnecessary driver_data set
  gpio: 104-idio-16: Remove unnecessary driver_data set
  ...
2017-02-23 08:46:04 -08:00
William Breathitt Gray deab2b0524 gpio: pci-idio-16: Fix PCI BAR index
The PCI BAR0 and BAR1 for the PCI-IDIO-16 hold information for the PLX
9052 bridge chip on the device. The PCI BAR2 holds the necessary base
address for I/O control of the PCI-IDIO-16. This patch corrects the PCI
BAR index mismatch for the PCI-IDIO-16 GPIO driver.

Fixes: 02e74fc040 ("gpio: Add GPIO support for the ACCES PCI-IDIO-16")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-13 16:19:10 +01:00
William Breathitt Gray fd254a23ca gpio: pci-idio-16: Fix PCI device ID code
The ACCES PCI-IDIO-16 has a PCI device ID code of 0x0DC8. It is
incorrect to use the PCI device ID code of the ACCES PCI-IIRO-8
(0x0F00). This patch fixes the said PCI device ID code mismatch.

Fixes: 02e74fc040 ("gpio: Add GPIO support for the ACCES PCI-IDIO-16")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-13 15:46:13 +01:00
Bartosz Golaszewski 9202ba2397 gpio: mockup: implement event injecting over debugfs
Create a debugfs directory for every mockup chip and a single file
for every line. Writing (0 or 1) to these files allows the user to
inject line events (falling or rising edge respectively).

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-13 08:36:47 +01:00
Bartosz Golaszewski e2ff740895 gpio: mockup: add a dummy irqchip
Setup a dummy irqchip that will allow us to inject line events for
testing purposes.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-13 08:35:33 +01:00
Bartosz Golaszewski 8a68ea00a6 gpio: mockup: implement naming the lines
In order to allow testing line lookup by name from user space, add
a new boolean parameter that indicates whether we want the lines to
be named. The name is created by concatenating the chip name and the
line offset value.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-06 14:22:11 +01:00
Bartosz Golaszewski e4ba07bf8d gpio: mockup: code shrink
Moving a couple of lines around allows us to shrink the code a bit
while keeping the same functionality.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-06 14:21:13 +01:00
Bartosz Golaszewski ca40916078 gpio: mockup: readability tweaks
The following patch tries to improve the readability of the mockup
driver.

The driver is called gpio-mockup, so add the same prefix to all
functions and structures.

Add some newlines and use a temporary pointer in gpio_mockup_add().

Drop the name of the direction enum and rename the enum values to
better reflect their purpose.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-06 14:20:12 +01:00
William Breathitt Gray 02e74fc040 gpio: Add GPIO support for the ACCES PCI-IDIO-16
The ACCES PCI-IDIO-16 device provides 32 lines of digital I/O (16 lines
of optically-isolated digital inputs for AC and DC control signals, and
16 lines of solid state switch digital outputs). An interrupt is
generated when any of the inputs change state (low to high or high to
low). Input filter control is not supported by this driver, and input
filters are deactivated by this driver.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-06 11:01:06 +01:00
Linus Walleij e4df1ebdfe Merge branch 'ib-gpiod-flags' into devel 2017-02-05 23:14:23 +01:00
Andrew Jeffery 619e96f4bf gpio: aspeed: Remove dependence on GPIOF_* macros
1736f75d35 is a (v2) patch which had
unresolved review comments[1]. Address the comments by removing the use
of macros from the consumer header (this patch represents the diff
between v2 and v3[2]).

[1] https://lkml.org/lkml/2017/1/26/337
[2] https://lkml.org/lkml/2017/1/26/786

Fixes: 1736f75d35 ("gpio: aspeed: Add banks Y, Z, AA, AB and AC")
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-04 21:34:55 +01:00
Boris Brezillon 537b94dafc gpio: Add the devm_fwnode_get_index_gpiod_from_child() helper
devm_fwnode_get_gpiod_from_child() currently allows GPIO users to
request a GPIO that is defined in a child fwnode instead of directly in
the device fwnode.
Extend this API by adding the devm_fwnode_get_index_gpiod_from_child()
helper which does the same except you can also specify an index in case
the 'xx-gpios' property describe several GPIOs.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-04 21:28:51 +01:00
Boris Brezillon 4b0947974e gpio: Rename devm_get_gpiod_from_child()
Rename devm_get_gpiod_from_child() into
devm_fwnode_get_gpiod_from_child() to reflect the fact that this
function is operating on a fwnode object.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-04 21:27:26 +01:00
Axel Lin e8e1a5b567 gpio: mcp23s08: Select REGMAP/REGMAP_I2C to fix build error
This driver now using devm_regmap_init/devm_regmap_init_i2c, so it needs
to select REGMAP/REGMAP_I2C accordingly.

Fixes: ("3d84fdb3f0b5 gpio: mcp23s08: use regmap")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-04 21:25:28 +01:00
William Breathitt Gray 5238f60feb gpio: ws16c48: Add support for GPIO names
This patch sets the gpio_chip names option with an array of GPIO line
names that match the manual documentation for the WinSystems WS16C48.
This should make it easier for users to identify which GPIO line
corresponds to a respective GPIO pin on the device.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-01 16:06:17 +01:00
William Breathitt Gray 210b4bde5f gpio: gpio-mm: Add support for GPIO names
This patch sets the gpio_chip names option with an array of GPIO line
names that match the manual documentation for the Diamond Systems
GPIO-MM. This should make it easier for users to identify which GPIO
line corresponds to a respective GPIO pin on the device.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-01 16:05:28 +01:00
William Breathitt Gray e0af4b5e24 gpio: 104-idio-16: Add support for GPIO names
This patch sets the gpio_chip names option with an array of GPIO line
names that match the manual documentation for the ACCES 104-IDIO-16.
This should make it easier for users to identify which GPIO line
corresponds to a respective GPIO pin on the device.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-01 16:04:44 +01:00
William Breathitt Gray a71dc2537a gpio: 104-idi-48: Add support for GPIO names
This patch sets the gpio_chip names option with an array of GPIO line
names that match the manual documentation for the ACCES 104-IDI-48.
This should make it easier for users to identify which GPIO line
corresponds to a respective GPIO pin on the device.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-01 16:03:55 +01:00
William Breathitt Gray 7bdba73eff gpio: 104-dio-48e: Add support for GPIO names
This patch sets the gpio_chip names option with an array of GPIO line
names that match the manual documentation for the ACCES 104-DIO-48E.
This should make it easier for users to identify which GPIO line
corresponds to a respective GPIO pin on the device.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-01 16:02:50 +01:00
William Breathitt Gray 9e1b487bb4 gpio: ws16c48: Remove unnecessary driver_data set
Setting driver_data was necessary to access private data in the
ws16c48_remove function. Now that the ws16c48_remove function is gone,
driver_data is no longer used. This patch removes the relevant code.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-01 15:59:21 +01:00
William Breathitt Gray 232a448706 gpio: gpio-mm: Remove unnecessary driver_data set
Setting driver_data was necessary to access private data in the
gpiomm_remove function. Now that the gpiomm_remove function is gone,
driver_data is no longer used. This patch removes the relevant code.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-01 15:59:20 +01:00
William Breathitt Gray c74f04d4b5 gpio: 104-idio-16: Remove unnecessary driver_data set
Setting driver_data was necessary to access private data in the
idio_16_remove function. Now that the idio_16_remove function is gone,
driver_data is no longer used. This patch removes the relevant code.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-01 15:59:19 +01:00
William Breathitt Gray b4e73edee5 gpio: 104-idi-48: Remove unnecessary driver_data set
Setting driver_data was necessary to access private data in the
idi_48_remove function. Now that the idi_48_remove function is gone,
driver_data is no longer used. This patch removes the relevant code.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-01 15:59:19 +01:00
William Breathitt Gray 3547f1405d gpio: 104-dio-48e: Remove unnecessary driver_data set
Setting driver_data was necessary to access private data in the
dio48e_remove function. Now that the dio48e_remove function is gone,
driver_data is no longer used. This patch removes the relevant code.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-02-01 15:59:18 +01:00
Christophe JAILLET 3988d663c0 gpiolib: Fix a WARN_ON that can never trigger
"if (!x) WARN_ON(x)" can never trigger.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-31 15:44:16 +01:00
Sebastian Reichel 3d84fdb3f0 gpio: mcp23s08: use regmap
Use regmap API to save some lines of codes and have
debugfs support for all of the MCP's registers.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-30 15:57:46 +01:00
Linus Walleij 7f36f5d11c Linux 4.10-rc6
-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJYjmvUAAoJEHm+PkMAQRiGHIoH/3VaTj7cCJZDnWZ2Wi2enWip
 f17zj0oAkFxuSx8XEVD5BKqMfGBCBjPNPwURysfcFVoSHNtHjbEr44VxiPfQj5s2
 N+znVm5P9qlFuRA+7dgYUyEKOqcTgyT9jFNpvPF6bgMZDfJoB/wo53UU4lo3drcx
 cRe6OT4fEpAbtgbl73kIjOreBRr7oxlMPVEjCVRdL7ssCg+iqow0MEHcSoO7jmtj
 tu8hwwBMNh5B0yJRCJKV7Edc1+GHK57ju6rnGr5S2rwnR31omLpvnHJx0Ya6NVCZ
 yV3KGQeWm13ifbumMddEnAL61x2hOIzX//BqaZKdy258YPohkNtD8oacnjHnLMc=
 =5Rs+
 -----END PGP SIGNATURE-----

Merge tag 'v4.10-rc6' into devel

Linux 4.10-rc6

Resolved conflicts in:
	drivers/pinctrl/pinctrl-amd.c
	drivers/pinctrl/samsung/pinctrl-exynos.c
2017-01-30 14:39:20 +01:00
William Breathitt Gray b4cad1bc5f gpio: ws16c48: Utilize devm_ functions in driver probe callback
The devm_ resource manager functions allow memory to be automatically
released when a device is unbound. This patch takes advantage of the
resource manager functions and replaces the gpiochip_add_data call and
request_irq call with the devm_gpiochip_add_data call and
devm_request_irq call respectively. In addition, the ws16c48_remove
function has been removed as no longer necessary due to the use of the
relevant devm_ resource manager functions.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 15:56:30 +01:00
William Breathitt Gray 2141b0a1d7 gpio: gpio-mm: Utilize devm_ functions in driver probe callback
The devm_ resource manager functions allow memory to be automatically
released when a device is unbound. This patch takes advantage of the
resource manager functions and replaces the gpiochip_add_data call with
the devm_gpiochip_add_data call. In addition, the gpiomm_remove function
has been removed as no longer necessary due to the use of the relevant
devm_ resource manager functions.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 15:55:25 +01:00
William Breathitt Gray 837143d356 gpio: 104-idio-16: Utilize devm_ functions in driver probe callback
The devm_ resource manager functions allow memory to be automatically
released when a device is unbound. This patch takes advantage of the
resource manager functions and replaces the gpiochip_add_data call and
request_irq call with the devm_gpiochip_add_data call and
devm_request_irq call respectively. In addition, the idio_16_remove
function has been removed as no longer necessary due to the use of the
relevant devm_ resource manager functions.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 15:54:28 +01:00
William Breathitt Gray e43fee6034 gpio: 104-idi-48: Utilize devm_ functions in driver probe callback
The devm_ resource manager functions allow memory to be automatically
released when a device is unbound. This patch takes advantage of the
resource manager functions and replaces the gpiochip_add_data call and
request_irq call with the devm_gpiochip_add_data call and
devm_request_irq call respectively. In addition, the idi_48_remove
function has been removed as no longer necessary due to the use of the
relevant devm_ resource manager functions.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 15:53:24 +01:00
William Breathitt Gray 00de1a518a gpio: 104-dio-48e: Utilize devm_ functions in driver probe callback
The devm_ resource manager functions allow memory to be automatically
released when a device is unbound. This patch takes advantage of the
resource manager functions and replaces the gpiochip_add_data call and
request_irq call with the devm_gpiochip_add_data call and
devm_request_irq call respectively. In addition, the dio48e_remove
function has been removed as no longer necessary due to the use of the
relevant devm_ resource manager functions.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 15:52:38 +01:00
Linus Walleij 283a981387 Merge branch 'ib-pinctrl-genprops' of /home/linus/linux-pinctrl into devel 2017-01-26 15:28:02 +01:00
Linus Walleij 27a2873617 Merge branch 'ib-pinctrl-genprops' into devel 2017-01-26 15:27:54 +01:00
Mika Westerberg 2956b5d94a pinctrl / gpio: Introduce .set_config() callback for GPIO chips
Currently we already have two pin configuration related callbacks
available for GPIO chips .set_single_ended() and .set_debounce(). In
future we expect to have even more, which does not scale well if we need
to add yet another callback to the GPIO chip structure for each possible
configuration parameter.

Better solution is to reuse what we already have available in the
generic pinconf.

To support this, we introduce a new .set_config() callback for GPIO
chips. The callback takes a single packed pin configuration value as
parameter. This can then be extended easily beyond what is currently
supported by just adding new types to the generic pinconf enum.

If the GPIO driver is backed up by a pinctrl driver the GPIO driver can
just assign gpiochip_generic_config() (introduced in this patch) to
.set_config and that will take care configuration requests are directed
to the pinctrl driver.

We then convert the existing drivers over .set_config() and finally
remove the .set_single_ended() and .set_debounce() callbacks.

Suggested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 15:27:37 +01:00
Andrew Jeffery 1736f75d35 gpio: aspeed: Add banks Y, Z, AA, AB and AC
This is less straight-forward than one would hope, as some banks only
have 4 pins rather than 8, others are output only, yet more (W and
X, already supported) are input-only, and in the case of the g4 SoC bank
AC doesn't exist.

Add some structs to describe the varying properties of different banks
and integrate mechanisms to deny requests for unsupported
configurations.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 14:45:43 +01:00
Joel Stanley 7153f8ef67 gpio: aspeed: Make bank names strings
The Aspeed SoCs have more GPIOs than can be represented with A-Z. The
documentation uses two letter names such as AA and AB, so make the names
a three-character array in the bank struct to accommodate this.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 14:31:48 +01:00
Sudip Mukherjee 6596e59e63 gpio: exar: add gpio for exar cards
Exar XR17V352/354/358 chips have 16 multi-purpose inputs/outputs which
can be controlled using gpio interface.

Add the gpio specific code.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 11:11:40 +01:00
William Breathitt Gray 99c8ac957e gpio: ws16c48: Add set_multiple callback function support
The WinSystems WS16C48 provides registers where 8 lines of GPIO may be
set at a time. This patch add support for the set_multiple callback
function, thus allowing multiple GPIO output lines to be set more
efficiently in groups.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 10:57:39 +01:00
William Breathitt Gray 65502a12ad gpio: gpio-mm: Add set_multiple callback function support
The Diamond Systems GPIO-MM series provides registers where 8 lines of
GPIO may be set at a time. This patch add support for the set_multiple
callback function, thus allowing multiple GPIO output lines to be set
more efficiently in groups.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 10:56:37 +01:00
William Breathitt Gray 9d7ae8127f gpio: 104-idio-16: Add set_multiple callback function support
The ACCES 104-IDIO-16 series provides registers where 8 lines of GPIO
may be set at a time. This patch add support for the set_multiple
callback function, thus allowing multiple GPIO output lines to be set
more efficiently in groups.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 10:55:48 +01:00
William Breathitt Gray be18320222 gpio: 104-dio-48e: Add set_multiple callback function support
The ACCES 104-DIO-48E series provides registers where 8 lines of GPIO
may be set at a time. This patch add support for the set_multiple
callback function, thus allowing multiple GPIO output lines to be set
more efficiently in groups.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 10:54:33 +01:00
Linus Walleij 8c541b1148 Merge branch 'ib-gpiod-flags' into devel 2017-01-26 10:00:31 +01:00
Linus Walleij 49cec4d832 gpio: Add a driver for Cortina Systems Gemini GPIO
This is a heavy edit/rewrite of the GPIO driver for the Gemini
SoC from arch/arm/mach-gemini/gpio.c.

This rewrite uses all the best-in-class helper like generic
GPIO and GPIOLIB_IRQCHIP and has been tested on ITian Square One
Gemini-based NAS/router.

Cc: Janos Laube <janos.dev@gmail.com>
Cc: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Cc: Hans Ulli Kroll <ulli.kroll@googlemail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 10:00:24 +01:00
Keerthy 035a86b857 gpio: davinci: Remove custom .xlate
With the current redesign of driver it's not necessary to have
custom .xlate() as the gpiolib will assign default of_gpio_simple_xlate().

Suggested-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 10:00:23 +01:00
Keerthy 8e11047b8f gpio: davinci: Add support for multiple GPIO controllers
Update GPIO driver to support Multiple GPIO controllers by updating
the base of subsequent GPIO chips with total of previous chips
gpio count so that gpio_add_chip gets unique numbers.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 10:00:22 +01:00
Keerthy b5cf3fd827 gpio: davinci: Redesign driver to accommodate ngpios in one gpio chip
The Davinci GPIO driver is implemented to work with one monolithic
Davinci GPIO platform device which may have up to Y(144) gpios.
The Davinci GPIO driver instantiates number of GPIO chips with
max 32 gpio pins per each during initialization and one IRQ domain.
So, the current GPIO's  opjects structure is:

<platform device> Davinci GPIO controller
 |- <gpio0_chip0> ------|
 ...                    |--- irq_domain (hwirq [0..143])
 |- <gpio0_chipN> ------|

Current driver creates one chip for every 32 GPIOs in a controller.
This was a limitation earlier now there is no need for that. Hence
redesigning the driver to create one gpio chip for all the ngpio
in the controller.

|- <gpio0_chip0> ------|--- irq_domain (hwirq [0..143]).

The previous discussion on this can be found here:
https://www.spinics.net/lists/linux-omap/msg132869.html

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 10:00:21 +01:00
Keerthy 8f7cf8c657 gpio: davinci: Remove gpio2regs function
gpio2regs is written making an assumption that driver supports only
one instance of gpio controller. Removing this and adding a generic
array so as to support multiple instances of gpio controllers.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 10:00:20 +01:00
Augusto Mecking Caringi fbc2a294f2 gpio: intel-mid: Fix build warning when !CONFIG_PM
The only usage of function intel_gpio_runtime_idle() is here (in the
same file):

static const struct dev_pm_ops intel_gpio_pm_ops = {
	SET_RUNTIME_PM_OPS(NULL, NULL, intel_gpio_runtime_idle)
};

And when CONFIG_PM is not set, the macro SET_RUNTIME_PM_OPS expands to
nothing, causing the following compiler warning:

drivers/gpio/gpio-intel-mid.c:324:12: warning: ‘intel_gpio_runtime_idle’
defined but not used [-Wunused-function]
static int intel_gpio_runtime_idle(struct device *dev)

Fix it by annotating the function with __maybe_unused.

Signed-off-by: Augusto Mecking Caringi <augustocaringi@gmail.com>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 10:00:20 +01:00
Alexander Stein b2987d7438 gpio: Pass GPIO label down to gpiod_request
Currently all users of fwnode_get_named_gpiod() have no way to
specify a label for the GPIO. So GPIOs listed in debugfs are shown
with label "?". With this change a proper label is used.

Also adjust all users so they can pass a label, properly retrieved
from device tree properties.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 09:59:52 +01:00
Andy Shevchenko a264d10ff4 gpiolib: Convert fwnode_get_named_gpiod() to configure GPIO
Make fwnode_get_named_gpiod() consistent with the rest of
gpiod_get() like API, i.e. configure GPIO pin immediately after
request.

Besides obvious clean up it will help to configure pins based
on firmware provided resources.

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-26 09:59:32 +01:00
Linus Walleij 739e6f5945 gpio: provide lockdep keys for nested/unnested irqchips
The helper function for adding a GPIO chip compiles in a lockdep
key for debugging, the same key is needed for nested chips as
well.

The macro construction is unreadable, replace this with two
static inlines instead.

The _gpiochip_irqchip_add prefixed function is not helpful,
rename it with gpiochip_irqchip_add_key() that tell us what the
function is actually doing.

Fixes: d245b3f9bd ("gpio: simplify adding threaded interrupts")
Cc: Roger Quadros <rogerq@ti.com>
Reported-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Reported-by: Roger Quadros <rogerq@ti.com>
Reported-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Tested-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-19 09:57:20 +01:00
Russell King f0d5046075 gpio: mvebu: fix warning when building on 64-bit
Casting a pointer to an int is not portable, and provokes a compiler
warning.  Cast to unsigned long instead to avoid the warning.

drivers/gpio/gpio-mvebu.c: In function 'mvebu_gpio_probe':
drivers/gpio/gpio-mvebu.c:662:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   soc_variant = (int) match->data;
                 ^

This will be needed when building gpio-mvebu for Armada 7k/8k ARM64
SoCs.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-11 16:47:04 +01:00
Steve Longerbeam 054ccdef8b gpio: pca953x: Add optional reset gpio control
Add optional reset-gpios pin control. If present, de-assert the
specified reset gpio pin to bring the chip out of reset.

v2:
- Specify that reset signal to PCA953x chip is active low, in
  binding doc.
- reorder includes in gpio-pca953x.c.
- remove dev_err() on devm_gpiod_get_optional() error return.

Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-11 16:35:23 +01:00
Stephen Boyd fb505747c0 gpio: Remove impossible checks on container_of() result
container_of() does pointer math on the pointer that's passed in.
If it were to return a NULL pointer the value passed in would
need to be perfectly offset from 0 to make that so. Remove these
checks because they don't make sense.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-11 16:01:27 +01:00
Andy Shevchenko e567c35f49 gpiolib: Update documentation of struct acpi_gpio_info
It seems the code had been changed, but description left untouched.

Update description of the struct acpi_gpio_info and relative comments
accordingly.

Fixes: commit 52044723cd ("ACPI / gpio: Add irq_type when a GPIO is used as an interrupt")
Cc: Christophe RICARD <christophe.ricard@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-11 12:09:36 +01:00
Andy Shevchenko 5e4e6fb3ff gpiolib: Switch to for_each_set_bit()
The macro for_each_set_bit() effectively looks up to the next
set bit in array of bits.

Instead of open coding that switch to for_each_set_bit() in
gpio_chip_set_multiple().

While here, make gpio_chip_set_multiple() non-destructive
against its parameters. We are safe since all callers, i.e.
gpiod_set_array_value_complex(), handle that already.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-11 12:07:17 +01:00
Keerthy bb5b06750f gpio: davinci: Remove redundant members davinci_gpio_controller stuct
davinci_gpio_controller struct has set_data, in_data, clr_data
members that are assigned and never used.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-11 11:59:43 +01:00
Andy Shevchenko 200d0177b4 gpio: devres: Use global array of gpio suffixes
We have already a global array of possible GPIO suffixes. Use it here instead
of another copy of them.

Unfortunately this will not reduce the memory footprint, though allows to easy
maintain list in only one place.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-09 19:56:58 +01:00
Geert Uytterhoeven a79fead50f gpio: of: Add support for multiple GPIOs in a single GPIO hog
When listing multiple GPIOs in the "gpios" property of a GPIO hog, only
the first GPIO is affected.  The user is left clueless about the
dysfunctioning of the other GPIOs specified.

Fix this by adding and documenting support for specifying multiple
GPIOs in a single GPIO hog.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-30 09:26:54 +01:00
John Crispin baddc7ca44 gpio: update my email address
This patch updates my email address as I no longer have access to the old
one.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-30 09:18:10 +01:00
Geert Uytterhoeven 5018ada69a gpio: Move freeing of GPIO hogs before numbing of the device
When removing a gpiochip that uses GPIO hogging (e.g. by unloading the
chip's DT overlay), a warning is printed:

    gpio gpiochip8: REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED

This happens because gpiochip_free_hogs() is called after the gdev->chip
pointer is reset to NULL. Hence __gpiod_free() cannot determine the
chip in use, and cannot clear flags nor call the optional chip-specific
.free() callback.

Move the call to gpiochip_free_hogs() up to fix this.

Cc: stable@vger.kernel.org
Fixes: ff2b135922 ("gpio: make the gpiochip a real device")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-30 09:11:21 +01:00
Arnd Bergmann abc8d5832f gpio: mxs: remove __init annotation
Building with an old toolchain, I ran into this warning:

WARNING: vmlinux.o(.text+0x63eef0): Section mismatch in reference
  from the function mxs_gpio_probe() to the function
  .init.text:mxs_gpio_init_gc()

Clearly the annotation is wrong, since the function is called from the
non-init probe, so let's remove it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-30 09:02:51 +01:00
Bartosz Golaszewski 364ac45655 gpio: mockup: coding style fixes
Fix whitespace errors and arrange local variables for better
readability.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-28 14:13:38 +01:00
Bartosz Golaszewski ad6d8004fa gpio: mockup: dynamically allocate memory for chip name
Currently the chip name buffer is allocated on the stack and the
address of the buffer is passed to the gpio framework. It's invalid
after probe() returns, so the sysfs label attribute displays garbage.

Use devm_kasprintf() for each string instead.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-28 14:12:51 +01:00
Bartosz Golaszewski e53c60289d gpio: mockup: make pins_name_start static
This variable is not used outside this module. Make it static.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-28 14:11:57 +01:00
Geert Uytterhoeven 2d65472bcb gpio: rcar: Fine-grained Runtime PM support
Currently gpio modules are runtime-resumed at probe time. This means the
gpio module will be active all the time (except during system suspend,
if not configured as a wake-up source).

While an R-Car Gen2 gpio module retains pins configured for output at
the requested level while put in standby mode, gpio register cannot be
accessed while suspended.  Unfortunately pm_runtime_get_sync() cannot be
called from all contexts where gpio register access is needed. Hence
move the Runtime PM handling from probe/remove time to gpio request/free
time, which is probably the best we can do.

On r8a7791/koelsch, gpio modules 0, 1, 3, and 4 are now suspended during
normal use (gpio2 is used for LEDs and regulators, gpio5 for keys, gpio6
for SD-Card CD & WP, gpio7 for keys and regulators).

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
[Niklas: s/gpio_to_priv(chip)/gpiochip_get_data(chip)/]
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-28 01:33:02 +01:00
Niklas Söderlund 47bd38a31a gpio: rcar: set IRQ chip parent_device
This enables Runtime PM handling for interrupts.

By setting the parent_device in struct irq_chip genirq will call the
pm_runtime_get/put APIs when an IRQ is requested/freed.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-28 01:31:09 +01:00
Linus Torvalds ac5a28b0d3 - New Device Support
- Add support for Ricoh RC5T619 PMIC to rn5t618
    - Add support for PM8821 PMIC to qcom-pm8xxx
 
 - New Functionality
    - Add support for GPIO to lpc_ich
    - Add support for GPADC to sun4i
    - Add ability for rk808 to shutdown
 
  - Fix-ups
    - Simplify/strip unnecessary code; tps65218, palmas, tps65217
    - Device Tree binding updates; tps65218, altera-a10sr
    - Provide/export device ID info; tps65218, axp20x-i2c, hi655x-pmic, fsl-imx25-tsadc, intel_soc_pmic_bxtwc
    - Use MFD API instead of of_platform_populate(); tps65218
    - Generalise name-space; pm8xxx
    - Supply/edit regmap configuration; axp20x, cs47l24-tables, axp20x
    - Enable compile testing; max77620,  max77686, exynos-lpass, abx500-core
    - Coding style issues; wm8994-core, wm5102-tables
    - Supply endian support; syscon
    - Remove module support; ab3100-core, ab8500-debugfs, ab8500-gpadc, abx500-core
 
 - Bug Fixes
    - Fix ordering issues; wm8994
    - Fix dependencies (build-time/run-time); exynos_lpass, sun4i-gpadc
    - Fix compiler warnings; sun4i-gpadc
    - Fix leaks; mfd-core
    - Fix page fault during module unload; tps65217
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAlhXxxcACgkQUa+KL4f8
 d2HDnxAAhYdrm6+4jYUDzXpKuKPDO4GNakvXY2aTk8dHobca8ySLcDZZ1s0KLLWa
 iOgOGmVQjL04vraiHiqGYW8kPONeslgFqhhqHmVvMZtLka3ZRXb9BWE6mLa7JBDg
 LONQFfpiDlbBChiuDSqBKYj0p0Wp65uFF/jtJxGTXe+vUTO94Lbrgo6tCmuAgBf/
 k2JS4+/Ufa3QuXuvPm8cVleWhhyEqkWGLJqv5PaDxjNQwP78PzXMYvfOEcCyUpNR
 hUoG2xJl+aPilVr0I9rsWIqgmDgRHlX67oMneoZkMiVQj20+Yi8YojDgGOpcaOZX
 Oh/YpdAEqaZh98EX5dKnuM8NQERltl/fTDpe3JNTPl42QYLMDzyBBb810xNzrB7W
 irJLzmfjEsPH7oYA63/EU3an6yXGXcB1lZ8wTPqFXOpGqw2/3SDSlTjonTxW1nnX
 yUXVV3VUS0xlHg0GHDuCbUvkJQSi2W6x/A/mzL8QBaKO7iUzv0P/oTZIZZe4Y06f
 LUCx4vb6W9i+9Me/z1aieXgXqC842U66OTmz1AmNRcntFspAeR3Rg3wGLP6+L/A+
 51Lumjn1IsHwgyd+/uQ3vsb35W/ZNYxTuc61HbWRPSX984sIdtI2+DL4+c8WBPLw
 MQgTy6ULb5bCt2HQ6DbwMZRpM6hIY2ed/QnJN2q2c3VBA1YgzzQ=
 =Lkoz
 -----END PGP SIGNATURE-----

Merge tag 'mfd-for-linus-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "New Device Support
   - Add support for Ricoh RC5T619 PMIC to rn5t618
   - Add support for PM8821 PMIC to qcom-pm8xxx

  New Functionality:
   - Add support for GPIO to lpc_ich
   - Add support for GPADC to sun4i
   - Add ability for rk808 to shutdown

  Fix-ups:
   - Simplify/strip unnecessary code; tps65218, palmas, tps65217
   - Device Tree binding updates; tps65218, altera-a10sr
   - Provide/export device ID info; tps65218, axp20x-i2c, hi655x-pmic,
     fsl-imx25-tsadc, intel_soc_pmic_bxtwc
   - Use MFD API instead of of_platform_populate(); tps65218
   - Generalise name-space; pm8xxx
   - Supply/edit regmap configuration; axp20x, cs47l24-tables, axp20x
   - Enable compile testing; max77620, max77686, exynos-lpass,
     abx500-core
   - Coding style issues; wm8994-core, wm5102-tables
   - Supply endian support; syscon
   - Remove module support; ab3100-core, ab8500-debugfs, ab8500-gpadc,
     abx500-core

  Bug Fixes:
   - Fix ordering issues; wm8994
   - Fix dependencies (build-time/run-time); exynos_lpass, sun4i-gpadc
   - Fix compiler warnings; sun4i-gpadc
   - Fix leaks; mfd-core
   - Fix page fault during module unload; tps65217"

* tag 'mfd-for-linus-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (49 commits)
  mfd: tps65217: Support an interrupt pin as the system wakeup
  mfd: tps65217: Make an interrupt handler simpler
  mfd: tps65217: Update register interrupt mask bits instead of writing operation
  mfd: tps65217: Specify the IRQ name
  mfd: tps65217: Fix page fault on unloading modules
  mfd: palmas: Remove redundant check in palmas_power_off
  mfd: arizona: Disable IRQs during driver remove
  mfd: pm8xxx: add support to pm8821
  mfd: intel-lpss: Try to enable Memory-Write-Invalidate
  mfd: rn5t618: Add Ricoh RC5T619 PMIC support
  mfd: axp20x: Add address extension registers for AXP806 regmap
  mfd: intel_soc_pmic_bxtwc: Fix a typo in MODULE_DEVICE_TABLE()
  mfd: core: Fix device reference leak in mfd_clone_cell
  mfd: bcm590xx: Simplify a test
  mfd: sun4i-gpadc: Select regmap-irq
  mfd: abx500-core: drop unused MODULE_ tags from non-modular code
  mfd: ab8500: make sysctrl explicitly non-modular
  mfd: ab8500-gpadc: Make it explicitly non-modular
  mfd: ab8500-debugfs: Make it explicitly non-modular
  mfd: ab8500-core: Make it explicitly non-modular
  ...
2016-12-19 08:16:26 -08:00
Linus Torvalds 061ad5038c Bulk GPIO changes for the v4.10 kernel cycle:
Core changes:
 
 - Simplify threaded interrupt handling: instead of passing
   numbed parameters to gpiochip_irqchip_add_chained() we
   create a new call: gpiochip_irqchip_add_nested() so the two
   types are clearly semantically different. Also make sure
   that all nested chips call gpiochip_set_nested_irqchip()
   which is necessary for IRQ resend to work properly if
   it happens.
 
 - Return error on seek operations for the chardev.
 
 - Clamp values set as part of gpio[d]_direction_output() so
   that anything != 0 will be send down to the driver as "1"
   not the value passed in.
 
 - ACPI can now support naming of GPIO lines, hogs and holes
   in the GPIO lists.
 
 New drivers:
 
 - The SX150x driver was deemed unfit for the GPIO subsystem
   and was moved over to a combined GPIO+pinctrl driver in the
   pinctrl subsystem.
 
 New features:
 
 - Various cleanups to various drivers.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJYTnG4AAoJEEEQszewGV1zbbsQAIxxsAobyQDnBaWyAJtVP33R
 mzoR5iBuWrN02rvWmYw8k3euj+2pH2Mxnl0FeezRQ5KomNLKeOghWM4VuMLPE+Mf
 hz/twZvMH3biTxWDzP5C6xsmqiCZbvqnHo0dClgGOphxwcxtRJd7nCVGssqBSVJ+
 FNoTvWhyEbF49fF1tPpKXSsjdYNNO8k119hu7QxwGQBde6zy2QbZd9fAZdjLGk1N
 nzn7Jah895nX95rUx37wwp2H8O6G3+ns1/uLzfnJRJ37+wWCxrr9Xx1peOErxpG9
 dwYYI3aNwR1/xYdMjAhJGDNqK7Jjt2w4c8vku/H5JDRoARCSfdFiTTvVBvEvU/Mq
 IQCMW8D0/cCp6wFGrjyX7lzrfZMh5byWeVID6GKi1wDUop+ed/MX7Et1fFKRuDPC
 s0FXE3onW9BJlT0zUANrt9fQRK+54g8VsUlHmZX1cu0VNCkCb51lqnc6WE5AMeqH
 1t2bB5U96pcebNKe0yJsOj2JdvBL/EEZVuJua5fEMIdwmEidZqthBV+rMqAfJhza
 t4G86q8qcyo98EgPVwVYILOOiOhXjk90SERh7MN/tiHmGVzJvoBmlQ+TYAxCTjFh
 X7s4DLGZWyT5duDBodZvkIqoz/yYNF6mPfyCok18yQkz/a0Zptr1dIxN1Vu3A8yl
 CEUfW/uTUtpTmmJd7jqI
 =2UpT
 -----END PGP SIGNATURE-----

Merge tag 'gpio-v4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO updates from Luinus Walleij:
 "Bulk GPIO changes for the v4.10 kernel cycle:

  Core changes:

   - Simplify threaded interrupt handling: instead of passing numbed
     parameters to gpiochip_irqchip_add_chained() we create a new call:
     gpiochip_irqchip_add_nested() so the two types are clearly
     semantically different. Also make sure that all nested chips call
     gpiochip_set_nested_irqchip() which is necessary for IRQ resend to
     work properly if it happens.

   - Return error on seek operations for the chardev.

   - Clamp values set as part of gpio[d]_direction_output() so that
     anything != 0 will be send down to the driver as "1" not the value
     passed in.

   - ACPI can now support naming of GPIO lines, hogs and holes in the
     GPIO lists.

  New drivers:

   - The SX150x driver was deemed unfit for the GPIO subsystem and was
     moved over to a combined GPIO+pinctrl driver in the pinctrl
     subsystem.

  New features:

   - Various cleanups to various drivers"

* tag 'gpio-v4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (49 commits)
  gpio: merrifield: Implement gpio_get_direction callback
  gpio: merrifield: Add support for hardware debouncer
  gpio: chardev: Return error for seek operations
  gpio: arizona: Tidy up probe error path
  gpio: arizona: Remove pointless set of platform drvdata
  gpio: pl061: delete platform data handling
  gpio: pl061: move platform data into driver
  gpio: pl061: rename variable from chip to pl061
  gpio: pl061: rename state container struct
  gpio: pl061: use local state for parent IRQ storage
  gpio: set explicit nesting on drivers
  gpio: simplify adding threaded interrupts
  gpio: vf610: use builtin_platform_driver
  gpio: axp209: use correct register for GPIO input status
  gpio: stmpe: fix interrupt handling bug
  gpio: em: depnd on ARCH_SHMOBILE
  gpio: zx: depend on ARCH_ZX
  gpio: x86: update config dependencies for x86 specific hardware
  gpio: mb86s7x: use builtin_platform_driver
  gpio: etraxfs: use builtin_platform_driver
  ...
2016-12-13 07:54:57 -08:00
Linus Walleij acf1fcf772 Merge branch 'thread-irq-simpler' into devel 2016-12-07 15:24:12 +01:00
Linus Walleij eb485c7d9e Merge branch 'pl061' into devel 2016-12-07 15:23:45 +01:00
Andy Shevchenko 46a5c112a4 gpio: merrifield: Implement gpio_get_direction callback
Implement gpio_get_direction() callback for Intel Merrifield GPIO.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-07 15:23:40 +01:00
Andy Shevchenko e7a718f9b1 gpio: merrifield: Add support for hardware debouncer
By default all pins are configured to use a glitch filter. Writing 1 to the
certain bit of the specific register might be useful in case someone needs to
bypass the glitch filter completely for a given GPIO pin.

This patch adds support for that in the Intel Merrifield GPIO driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-07 15:23:39 +01:00
Lars-Peter Clausen f4e81c5297 gpio: chardev: Return error for seek operations
The GPIO chardev is used for management tasks (allocating line and event
handles) and does neither support read() nor write() operations. Hence it
does not make much sense to allow seek operations.

Currently the chardev uses noop_llseek() for its seek implementation. This
function does not move the pointer and simply returns the current position
(always 0 for the GPIO chardev). noop_llseek() is primarily meant for
devices that can not support seek, but where there might be a user that
depends on the seek() operation succeeding. For newly added devices that
can not support seek operations it is recommended to use no_llseek(), which
will return an error. For more information see commit 6038f373a3
("llseek: automatically add .llseek fop").

Unfortunately this was overlooked when the GPIO chardev ABI was introduced.
But it is highly unlikely that since then userspace applications have
appeared that rely on being able to perform non-failing seek operations on
a GPIO chardev file descriptor. So it should be safe to change from
noop_llseel() to no_seek(). Also use nonseekable_open() in the chardev
open() callback to clear the FMODE_SEEK, FMODE_PREAD and FMODE_PWRITE flags
from the file. Neither of these should be set on a file that does not
support seek operations.

Cc: stable@vger.kernel.org
Fixes: 3c702e9987 ("gpio: add a userspace chardev ABI for GPIOs")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-07 15:23:39 +01:00
Charles Keepax 975acebbbc gpio: arizona: Tidy up probe error path
There is some unnecessary complexity in the error path which now things
are converted to devm is actually very simple. This patch simplifies
things.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-07 15:23:38 +01:00
Charles Keepax a3ee78ec6a gpio: arizona: Remove pointless set of platform drvdata
We use the gpio chip private data in all the callbacks so remove this
redundant line of code.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-07 15:23:38 +01:00
Linus Walleij 6da7b0dd51 gpio: pl061: delete platform data handling
Platform data is a remnant of board files and all boards using
the PL061 have been migrated to use device tree or ACPI instead.
The custom mechanism to set line by default as inputs/outputs has
been superceded by the GPIO-internal hogging mechanism.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-07 15:22:50 +01:00
Linus Walleij 562b488443 gpio: pl061: move platform data into driver
No boardfile defines any PL061 platform data anymore: the
Integrator IM/PD-1 includes the file but is not making use
of the struct. Let's delete the include and all references,
then move the platform data into the driver for later
consolidation into the driver state container.

The only resource defined by the IM/PD-1 is the IRQ which
is passed through the AMBA PrimeCell bus abstraction
struct amba_device.

Cc: arm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-07 15:22:50 +01:00
Linus Walleij 2796325ffa gpio: pl061: rename variable from chip to pl061
Rename the local variable "chip" referring to the struct pl061
state container to "pl061": we already have gpio_chip and irq_chip
in the driver, we are needlessly adding yet another "chip" to
the confusion.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-07 15:22:49 +01:00
Linus Walleij 538f76c566 gpio: pl061: rename state container struct
The PL061 state container is named "pl061_gpio", let's rename it
to simply pl061. Less is more.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-07 15:22:49 +01:00
Linus Walleij 9c18be8e93 gpio: pl061: use local state for parent IRQ storage
The driver is poking around in the struct gpio_chip internals,
which is a no-no. Use a variable in the local state container.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-12-07 15:22:49 +01:00
Linus Walleij 35ca3f6161 gpio: set explicit nesting on drivers
The ADNP, CrystalCove and WhiskeyCove are all nested GPIO
irqchips, but were avoiding to connect the parent IRQ to
the gpiochip. This works, but is kind of sloppy as the
child IRQs are not marked as having the parent IRQ as
parent.

Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Ajay Thomas <ajay.thomas.david.rajamanickam@intel.com>
Cc: Bin Gao <bin.gao@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-11-25 15:12:27 +01:00
Linus Walleij d245b3f9bd gpio: simplify adding threaded interrupts
This tries to simplify the use of CONFIG_GPIOLIB_IRQCHIP when
using threaded interrupts: add a new call
gpiochip_irqchip_add_nested() to indicate that we're dealing
with a nested rather than a chained irqchip, then create a
separate gpiochip_set_nested_irqchip() to mirror
the gpiochip_set_chained_irqchip() call to connect the
parent and child interrupts.

In the nested case gpiochip_set_nested_irqchip() does nothing
more than call irq_set_parent() on each valid child interrupt,
which has little semantic effect in the kernel, but this is
probably still formally correct.

Update all drivers using nested interrupts to use
gpiochip_irqchip_add_nested() so we can now see clearly
which these users are.

The DLN2 driver can drop its specific hack with
.irq_not_threaded as we now recognize whether a chip is
threaded or not from its use of gpiochip_irqchip_add_nested()
signature rather than from inspecting .can_sleep.

We rename the .irq_parent to .irq_chained_parent since this
parent IRQ is only really kept around for the chained
interrupt handlers.

Cc: Lars Poeschel <poeschel@lemonage.de>
Cc: Octavian Purdila <octavian.purdila@intel.com>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Cc: Bin Gao <bin.gao@linux.intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Ajay Thomas <ajay.thomas.david.rajamanickam@intel.com>
Cc: Semen Protsenko <semen.protsenko@globallogic.com>
Cc: Alexander Stein <alexander.stein@systec-electronic.com>
Cc: Phil Reid <preid@electromag.com.au>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-11-25 15:12:27 +01:00
Geliang Tang df950da188 gpio: vf610: use builtin_platform_driver
Use builtin_platform_driver() helper to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-11-24 16:19:02 +01:00
Quentin Schulz 1d2b2ac05a gpio: axp209: use correct register for GPIO input status
The GPIO input status was read from control register
(AXP20X_GPIO[210]_CTRL) instead of status register (AXP20X_GPIO20_SS).

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-11-24 16:19:02 +01:00
Linus Walleij 1516c6350a gpio: stmpe: fix interrupt handling bug
commit 43db289d00 ("gpio: stmpe: Rework registers access")
reworked the STMPE register access so as to use
[STMPE_IDX_*_LSB + i] to access the 8bit register for a
certain bank, assuming the CSB and MSB will follow after
the enumerator. For this to work the index needs to go from
(size-1) to 0 not 0 to (size-1).

However for the GPIO IRQ handler, the status registers we read
register MSB + 3 bytes ahead for the 24 bit GPIOs and index
registers from MSB upwards and run an index i over the
registers UNLESS we are STMPE1600.

This is not working when we get to clearing the interrupt
EDGE status register STMPE_IDX_GPEDR_[LCM]SB: it is indexed
like all other registers [STMPE_IDX_*_LSB + i] but in this
loop we index from 0 to get the right bank index for the
calculations, and we need to just add i to the MSB.

Before this, interrupts on the STMPE2401 were broken, this
patch fixes it so it works again.

Cc: stable@vger.kernel.org
Cc: Patrice Chotard <patrice.chotard@st.com>
Fixes: 43db289d00 ("gpio: stmpe: Rework registers access")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-11-24 16:19:01 +01:00
Peter Robinson 22eaf13c7f gpio: em: depnd on ARCH_SHMOBILE
The GPIO_EM is part of the Renesas SoCs so depend on the arch.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
[Changed to depend on ARCH_EMEV2]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-11-24 16:18:42 +01:00
Peter Robinson 752fda89f5 gpio: zx: depend on ARCH_ZX
Set GPIO_ZX to depend on ARCH_ZX as it's SOC specific.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-11-22 10:21:37 +01:00
Peter Robinson 72aba2e25e gpio: x86: update config dependencies for x86 specific hardware
The devices here are specific to x86 so lets depend on x86.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-11-22 10:20:29 +01:00
Geliang Tang d65aa4b67b gpio: mb86s7x: use builtin_platform_driver
Use builtin_platform_driver() helper to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-11-22 10:16:17 +01:00
Geliang Tang 6f1bd54ca4 gpio: etraxfs: use builtin_platform_driver
Use builtin_platform_driver() helper to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-11-22 10:14:22 +01:00
Venkat Reddy Talla 3107d57234 gpio: max77620: add compatible string to device id list
Adding max20024 compatible string to the device id list
to support both max77620 and max20024 devices.

Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-11-16 20:52:13 +01:00