platform/kernel/linux-rpi.git
5 years agogpio: sama5d2-piobu: Depend on OF_GPIO
Linus Walleij [Sat, 22 Dec 2018 10:04:55 +0000 (11:04 +0100)]
gpio: sama5d2-piobu: Depend on OF_GPIO

This driver clearly needs OF_GPIO so depend on it.
Fixes a build error.

Cc: Andrei Stefanescu <Andrei.Stefanescu@microchip.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: Add Cadence GPIO driver
Jan Kotas [Tue, 18 Dec 2018 16:10:42 +0000 (16:10 +0000)]
gpio: Add Cadence GPIO driver

This patch adds a driver for Cadence GPIO controller.

It can be enabled with GPIO_CADENCE Kconfig option.
It uses generic GPIO infrastructure and works
as an interrupt controller.
At the moment it only supports level sensitive irqs.

Signed-off-by: Jan Kotas <jank@cadence.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodt-bindings: gpio: Add bindings for Cadence GPIO
Jan Kotas [Tue, 18 Dec 2018 16:10:41 +0000 (16:10 +0000)]
dt-bindings: gpio: Add bindings for Cadence GPIO

This patch adds a DT binding documentation for
Cadence GPIO controller.

Signed-off-by: Jan Kotas <jank@cadence.com>
Reviewed-by: Rob Herring <robh@kernel.org>
[Removed interrupt-parent]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib-acpi: remove unused variable 'err', cleans up build warning
Colin Ian King [Tue, 18 Dec 2018 12:28:02 +0000 (12:28 +0000)]
gpiolib-acpi: remove unused variable 'err', cleans up build warning

Variable err is defined but never used. Remove it. Cleans up warning:

warning: unused variable ‘err’ [-Wunused-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: mxs: read pin level directly instead of using .get
Uwe Kleine-König [Tue, 18 Dec 2018 08:47:57 +0000 (09:47 +0100)]
gpio: mxs: read pin level directly instead of using .get

Calling readl directly instead of going through another function that
results in the same result to remove some overhead. I didn't try to
measure the performance gain, but IMHO there is little benefit from
abstracting a GPIO register access in the GPIO driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: aspeed: remove duplicated statement
Tao Ren [Wed, 12 Dec 2018 21:53:05 +0000 (13:53 -0800)]
gpio: aspeed: remove duplicated statement

Remove duplicated assignment statement from aspeed_gpio_probe() function.

Signed-off-by: Tao Ren <taoren@fb.com>
Acked-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: add driver for SAMA5D2 PIOBU pins
Andrei.Stefanescu@microchip.com [Wed, 12 Dec 2018 11:57:15 +0000 (11:57 +0000)]
gpio: add driver for SAMA5D2 PIOBU pins

PIOBU pins do not lose their voltage during Backup/Self-refresh.
This patch adds a simple GPIO controller for them and a
maintainer for the driver.

This driver adds support for using the pins as GPIO
offering the possibility to read/set the voltage.

Signed-off-by: Andrei Stefanescu <andrei.stefanescu@microchip.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodt-bindings: arm: atmel: describe SECUMOD usage as a GPIO controller
Andrei.Stefanescu@microchip.com [Wed, 12 Dec 2018 11:57:11 +0000 (11:57 +0000)]
dt-bindings: arm: atmel: describe SECUMOD usage as a GPIO controller

This patch describes the Security Module's usage as a GPIO
controller for its PIOBU pins. These pins have the special
property of maintaining their voltage during suspend-to-mem.

Signed-off-by: Andrei Stefanescu <andrei.stefanescu@microchip.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio/mmc/of: Respect polarity in the device tree
Linus Walleij [Mon, 17 Dec 2018 21:36:25 +0000 (22:36 +0100)]
gpio/mmc/of: Respect polarity in the device tree

The device tree bindings for the MMC card detect and
write protect lines specify that these should be active
low unless "cd-inverted" or "wp-inverted" has been
specified.

However that is not how the kernel code has worked. It
has always respected the flags passed to the phandle in
the device tree, but respected the "cd-inverted" and
"wp-inverted" flags such that if those are set, the
polarity will be the inverse of that specified in the
device tree.

Switch to behaving like the old code did and fix the
regression.

Fixes: 81c85ec15a19 ("gpio: OF: Parse MMC-specific CD and WP properties")
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodt-bindings: gpio: rcar: Add r8a774c0 (RZ/G2E) support
Fabrizio Castro [Thu, 13 Dec 2018 20:18:14 +0000 (20:18 +0000)]
dt-bindings: gpio: rcar: Add r8a774c0 (RZ/G2E) support

Document Renesas' RZ/G2E (R8A774C0) GPIO blocks compatibility within the
relevant dt-bindings.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agomemory: omap-gpmc: Get the header of the enum
Linus Walleij [Mon, 17 Dec 2018 13:11:08 +0000 (14:11 +0100)]
memory: omap-gpmc: Get the header of the enum

Commit 21abf103818a
("gpio: Pass a flag to gpiochip_request_own_desc()")
started to pass an enum gpiod_flags but this file is
not including the header file that defines that enum
and the compiler spits:

drivers/memory/omap-gpmc.c: In function
    'gpmc_probe_generic_child':
drivers/memory/omap-gpmc.c:2174:9: error: type of formal
   parameter 4 is incomplete
         0);
         ^

Cc: Ladislav Michl <ladis@linux-mips.org>
Cc: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: 21abf103818a ("gpio: Pass a flag to gpiochip_request_own_desc()")
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoARM: omap1: Fix new user of gpiochip_request_own_desc()
Linus Walleij [Sat, 15 Dec 2018 11:50:59 +0000 (12:50 +0100)]
ARM: omap1: Fix new user of gpiochip_request_own_desc()

This fixes up a new user of gpiochip_request_own_desc() in
the AMS Delta board that appeared after the patch that was
applied recently.

Fixes: 21abf103818a ("gpio: Pass a flag to gpiochip_request_own_desc()")
Reviewed-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Add regmap dependency for PCA953x driver
Marek Vasut [Sun, 16 Dec 2018 17:38:58 +0000 (18:38 +0100)]
gpio: pca953x: Add regmap dependency for PCA953x driver

Select REGMAP_I2C in Kconfig, since the driver now depends on regmap
and this was missing, thus breaking build on various systems.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: raspberrypi-exp: decrease refcount on firmware dt node
Nicolas Saenz Julienne [Mon, 10 Dec 2018 16:50:05 +0000 (17:50 +0100)]
gpio: raspberrypi-exp: decrease refcount on firmware dt node

We're getting a reference RPi's firmware node in order to be able to
communicate with it's driver. We should decrease the reference count on
the dt node after being done with it.

Fixes: a98d90e7d588 ("gpio: raspberrypi-exp: Driver for RPi3 GPIO expander via mailbox service")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoMerge branch 'ib-pca953x' into devel
Linus Walleij [Fri, 14 Dec 2018 21:51:05 +0000 (22:51 +0100)]
Merge branch 'ib-pca953x' into devel

5 years agogpiolib: Fix return value of gpio_to_desc() stub if !GPIOLIB
Krzysztof Kozlowski [Thu, 6 Dec 2018 09:45:49 +0000 (10:45 +0100)]
gpiolib: Fix return value of gpio_to_desc() stub if !GPIOLIB

If CONFIG_GPOILIB is not set, the stub of gpio_to_desc() should return
the same type of error as regular version: NULL.  All the callers
compare the return value of gpio_to_desc() against NULL, so returned
ERR_PTR would be treated as non-error case leading to dereferencing of
error value.

Fixes: 79a9becda894 ("gpiolib: export descriptor-based GPIO interface")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Restore registers after suspend/resume cycle
Marek Vasut [Wed, 12 Dec 2018 01:40:02 +0000 (02:40 +0100)]
gpio: pca953x: Restore registers after suspend/resume cycle

It is possible that the PCA953x is powered down during suspend.
Use regmap cache to assure the registers in the PCA953x are in
line with the driver state after resume.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Zap single use of pca953x_read_single()
Marek Vasut [Wed, 12 Dec 2018 01:40:01 +0000 (02:40 +0100)]
gpio: pca953x: Zap single use of pca953x_read_single()

Drop pca953x_write_single() which is used in one place.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Zap ad-hoc reg_output cache
Marek Vasut [Wed, 12 Dec 2018 01:40:00 +0000 (02:40 +0100)]
gpio: pca953x: Zap ad-hoc reg_output cache

Replace the ad-hoc reg_output output register caching with generic
regcache cache. Drop pca953x_write_single() which is no longer used.
This reduces code duplication.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Zap ad-hoc reg_direction cache
Marek Vasut [Wed, 12 Dec 2018 01:39:59 +0000 (02:39 +0100)]
gpio: pca953x: Zap ad-hoc reg_direction cache

Replace the ad-hoc reg_direction direction register caching with generic
regcache cache. This reduces code duplication.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Perform basic regmap conversion
Marek Vasut [Wed, 12 Dec 2018 01:39:58 +0000 (02:39 +0100)]
gpio: pca953x: Perform basic regmap conversion

Convert the driver to use regmap to access the chips. Due to the convoluted
register mapping scheme, implement read/write/volatile check functions that
untangle the mess and perform check accordingly. This patch does not zap the
internal register cache of the PCA953x driver, nor does it push the regmap
access down into the gpiochip accessors to simplify the review. All that is
in subsequent patches.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Extract the register address mangling to single function
Marek Vasut [Wed, 12 Dec 2018 01:39:57 +0000 (02:39 +0100)]
gpio: pca953x: Extract the register address mangling to single function

Instead of having the I2C register calculation function spread across
multiple accessor functions, pull it out into a single function which
returns the adjusted register address.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Zap ad-hoc I2C block write in multi GPIO set
Marek Vasut [Wed, 12 Dec 2018 01:39:56 +0000 (02:39 +0100)]
gpio: pca953x: Zap ad-hoc I2C block write in multi GPIO set

The ad-hoc i2c block write can be replaced by standard register accessor
function, which correctly handles all the chip details and differences.
Do so to simplify the code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Factor out common code from device_pca95xx_init()
Marek Vasut [Wed, 12 Dec 2018 01:39:55 +0000 (02:39 +0100)]
gpio: pca953x: Factor out common code from device_pca95xx_init()

The PCA957x and PCA953x init functions are almost the same, except for
the different register mapping and one extra write to BKEN register in
case of PCA957x. Factor out the common code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Unify pca953x_{read,write}_regs_{8,mul}()
Marek Vasut [Wed, 12 Dec 2018 01:39:54 +0000 (02:39 +0100)]
gpio: pca953x: Unify pca953x_{read,write}_regs_{8,mul}()

At this point, the pca953x_{read,write}_regs_mul() can read single bank
PCA953x GPIO chips as well. Merge the _8 and _mul functions together to
simplify the code a bit.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Unify pca953x_{read,write}_regs_{16,24}()
Marek Vasut [Wed, 12 Dec 2018 01:39:53 +0000 (02:39 +0100)]
gpio: pca953x: Unify pca953x_{read,write}_regs_{16,24}()

At this point, these two functions only differ in whether they do or do not
set the address increment bit. The 16 GPIO case does not need to set the AI
bit, except for PCA9575 on write, while the 24 GPIO and more case does set
the AI bit always. Merge these two functions together to simplify the code
a bit.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Unify pca95{3,7}x_write_regs_16()
Marek Vasut [Wed, 12 Dec 2018 01:39:52 +0000 (02:39 +0100)]
gpio: pca953x: Unify pca95{3,7}x_write_regs_16()

At this point, these two functions only differ in whether they do or do not
set the address increment bit on PCA9575. Merge these two functions together
to simplify the code a bit.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Repair multi-byte IO address increment on PCA9575
Marek Vasut [Wed, 12 Dec 2018 01:39:51 +0000 (02:39 +0100)]
gpio: pca953x: Repair multi-byte IO address increment on PCA9575

The multi-byte IO on various pca953x chips requires the auto-increment bit,
while other chips toggle the LSbit automatically. Note that LSbit toggling
only alternates between two registers during the IO, it is not the same as
address auto-increment. The driver currently assumes that #gpios > 16 implies
auto-increment, while #gpios <= 16 implies LSbit toggling. This is incorrect
at there are chips with 16 GPIOs which require the auto-increment bit.

The PCA9575, according to NXP datasheet rev. 4.2 from 16 April 2015, section
7.3 Command Register, the bit 7 in command register is the auto-increment
bit, which allows programming multiple registers sequentially.

Set this bit both in pca953x_gpio_set_multiple(), where it fixes the multi
register programming, and in pca957x_write_regs_16(), where is simplifies
the function. In fact, the pca957x_write_regs_16() now looks rather similar
to pca953x_write_regs_24() and pca953x_write_regs_16(), which is intended
for subsequent patches.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Fix AI overflow on PCAL6524
Marek Vasut [Wed, 12 Dec 2018 01:39:50 +0000 (02:39 +0100)]
gpio: pca953x: Fix AI overflow on PCAL6524

The PCAL_PINCTRL_MASK is too large. The extended register block on
PCAL6524, which is the largest chip with this block, has the block
limited to address range 0x40..0x7f. This is because the bit 7 in
the command register is used for the Address Increment functionality.

Trim the mask to 0x60 to match the datasheet and to prevent accidental
overwrite of the AI bit.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pca953x: Deduplicate the bank_shift
Marek Vasut [Wed, 12 Dec 2018 01:39:49 +0000 (02:39 +0100)]
gpio: pca953x: Deduplicate the bank_shift

The bank_shift = fls(...) code was duplicated in the driver 5 times,
pull it into separate function.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: tegra186: Rename flow variable to type
Thierry Reding [Thu, 29 Nov 2018 17:03:10 +0000 (18:03 +0100)]
gpio: tegra186: Rename flow variable to type

The IRQ core code refers to the interrupt type by that name, whereas the
term flow is almost never used. Some GPIO controllers use the term
flow_type, but it is most consistent to just go with the IRQ core
terminology.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoMerge tag 'intel-gpio-v4.21-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy...
Linus Walleij [Fri, 14 Dec 2018 13:27:41 +0000 (14:27 +0100)]
Merge tag 'intel-gpio-v4.21-1' of git://git./linux/kernel/git/andy/linux-gpio-intel into devel

intel-gpio for v4.21-1

Use managed resource allocation in pch and sodaville drivers.
Switch to use for_each_set_bit() in IRQ handlers.
Headers clean up.
Sort headers in inclusion block alphabetically for better maintenance.
Convert to SPDX identifier and fixing MODULE_LICENSE() when appropriate.
Additional format fixes to rectify debug and message printing.

There is a commit which had been applied to v4.20-rc4, that's why dup.

c3bc3ff9e8019fba74ce62bfb501d710c2fca9d3 MAINTAINERS: Do maintain Intel GPIO drivers via separate tree

The following is an automated git shortlog grouped by driver:

ich:
 -  Convert to use SPDX identifier
 -  Sort headers alphabetically
 -  Join string literals back
 -  Convert pr_<level> to dev_<level>
 -  Switch to use struct device instead of platform_device
 -  Simplify error handling in ichx_write_bit()

intel-mid:
 -  Convert to use SPDX identifier
 -  Remove linux/module.h and sort headers

lynxpoint:
 -  Convert to use SPDX identifier
 -  Remove linux/init.h and sort headers
 -  Use for_each_set_bit() in IRQ handler

MAINTAINERS:
 -  Do maintain Intel GPIO drivers via separate tree

merrifield:
 -  Convert to use SPDX identifier
 -  Remove linux/init.h

pch:
 -  Convert to use SPDX identifier
 -  Sort headers alphabetically
 -  Remove duplicate assignments
 -  Remove redundant __func__ from debug print
 -  Use for_each_set_bit() in IRQ handler
 -  Convert to dev_pm_ops
 -  Convert to use managed functions pcim_* and devm_*

sch:
 -  Convert to use SPDX identifier
 -  Remove linux/init.h and sort headers

sodaville:
 -  Convert to use SPDX identifier
 -  Sort headers alphabetically
 -  Use for_each_set_bit() in IRQ handler
 -  Convert to use managed functions pcim_* and devm_*

5 years agogpio: Pass a flag to gpiochip_request_own_desc()
Linus Walleij [Tue, 4 Sep 2018 11:31:45 +0000 (13:31 +0200)]
gpio: Pass a flag to gpiochip_request_own_desc()

Before things go out of hand, make it possible to pass
flags when requesting "own" descriptors from a gpio_chip.
This is necessary if the chip wants to request a GPIO with
active low semantics, for example.

Cc: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Roger Quadros <rogerq@ti.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: lpc18xx: fix GPIO controller driver build as a module
Vladimir Zapolskiy [Sat, 8 Dec 2018 14:38:41 +0000 (16:38 +0200)]
gpio: lpc18xx: fix GPIO controller driver build as a module

The problem is reported for allmodconfig build setup:

  ERROR: "irq_chip_retrigger_hierarchy" [drivers/gpio/gpio-lpc18xx.ko] undefined!
  make[2]: *** [scripts/Makefile.modpost:92: __modpost] Error 1
  make[1]: *** [Makefile:1271: modules] Error 2

My testing in runtime shows that it is sufficient to remove .irq_retrigger
callback, which is assigned to unexported irq_chip_retrigger_hierarchy()
function, I did't observe any regressions, and thus apparently it is a
better fix rather than exporting the function defined in kernel/irq/chip.c
(see commit 52b2a05fa7c8 ("genirq: Export IRQ functions for module use"))
or sticking the GPIO controller driver build to built-in option only.

Reported-by: kbuild test robot <lkp@intel.com>
Fixes: 5ddabfe8d3de ("gpio: lpc18xx: add GPIO pin interrupt controller support")
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: sodaville: Convert to use SPDX identifier
Andy Shevchenko [Tue, 6 Nov 2018 12:11:42 +0000 (14:11 +0200)]
gpio: sodaville: Convert to use SPDX identifier

Reduce size of duplicated comments by switching to use SPDX identifier.

No functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: sch: Convert to use SPDX identifier
Andy Shevchenko [Tue, 6 Nov 2018 12:11:42 +0000 (14:11 +0200)]
gpio: sch: Convert to use SPDX identifier

Reduce size of duplicated comments by switching to use SPDX identifier.

No functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: pch: Convert to use SPDX identifier
Andy Shevchenko [Tue, 6 Nov 2018 12:11:42 +0000 (14:11 +0200)]
gpio: pch: Convert to use SPDX identifier

Reduce size of duplicated comments by switching to use SPDX identifier.

No functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: merrifield: Convert to use SPDX identifier
Andy Shevchenko [Tue, 6 Nov 2018 12:11:42 +0000 (14:11 +0200)]
gpio: merrifield: Convert to use SPDX identifier

Reduce size of duplicated comments by switching to use SPDX identifier.

No functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: lynxpoint: Convert to use SPDX identifier
Andy Shevchenko [Tue, 6 Nov 2018 12:11:42 +0000 (14:11 +0200)]
gpio: lynxpoint: Convert to use SPDX identifier

Reduce size of duplicated comments by switching to use SPDX identifier.

No functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: intel-mid: Convert to use SPDX identifier
Andy Shevchenko [Tue, 6 Nov 2018 12:11:42 +0000 (14:11 +0200)]
gpio: intel-mid: Convert to use SPDX identifier

Reduce size of duplicated comments by switching to use SPDX identifier.

No functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: ich: Convert to use SPDX identifier
Andy Shevchenko [Tue, 6 Nov 2018 12:11:42 +0000 (14:11 +0200)]
gpio: ich: Convert to use SPDX identifier

Reduce size of duplicated comments by switching to use SPDX identifier.

No functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: sodaville: Sort headers alphabetically
Andy Shevchenko [Tue, 4 Sep 2018 11:26:25 +0000 (14:26 +0300)]
gpio: sodaville: Sort headers alphabetically

Sort header block alphabetically for easy maintenance.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: pch: Sort headers alphabetically
Andy Shevchenko [Tue, 4 Sep 2018 11:26:25 +0000 (14:26 +0300)]
gpio: pch: Sort headers alphabetically

Sort header block alphabetically for easy maintenance.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: ich: Sort headers alphabetically
Andy Shevchenko [Tue, 4 Sep 2018 11:26:25 +0000 (14:26 +0300)]
gpio: ich: Sort headers alphabetically

Sort header block alphabetically for easy maintenance.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: sch: Remove linux/init.h and sort headers
Andy Shevchenko [Tue, 4 Sep 2018 11:26:25 +0000 (14:26 +0300)]
gpio: sch: Remove linux/init.h and sort headers

There is no need to include linux/init.h when at the same time
we include linux/module.h.

Remove redundant inclusion.

While here, sort header block alphabetically for easy maintenance.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: merrifield: Remove linux/init.h
Andy Shevchenko [Tue, 4 Sep 2018 11:26:25 +0000 (14:26 +0300)]
gpio: merrifield: Remove linux/init.h

There is no need to include linux/init.h when at the same time
we include linux/module.h.

Remove redundant inclusion.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: lynxpoint: Remove linux/init.h and sort headers
Andy Shevchenko [Tue, 4 Sep 2018 11:26:25 +0000 (14:26 +0300)]
gpio: lynxpoint: Remove linux/init.h and sort headers

There is no need to include linux/init.h when at the same time
we include linux/module.h.

Remove redundant inclusion.

While here, sort header block alphabetically for easy maintenance.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: intel-mid: Remove linux/module.h and sort headers
Andy Shevchenko [Tue, 4 Sep 2018 11:26:25 +0000 (14:26 +0300)]
gpio: intel-mid: Remove linux/module.h and sort headers

There is no need to include linux/module.h when at the same time
we include linux/init.h.

Remove redundant inclusion.

While here, remove no-op macro and sort header block alphabetically
for easy maintenance.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: pch: Remove duplicate assignments
Andy Shevchenko [Wed, 7 Nov 2018 19:29:53 +0000 (21:29 +0200)]
gpio: pch: Remove duplicate assignments

There is no need to assign the same values which core does for us anyway.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: pch: Remove redundant __func__ from debug print
Andy Shevchenko [Fri, 7 Dec 2018 15:33:07 +0000 (17:33 +0200)]
gpio: pch: Remove redundant __func__ from debug print

dev_dbg includes the function name & line number by default when dynamic
debugging is enabled. Hence __func__ is redundant here and removed.

Do the same for any messages in ->probe() since it doesn't make sense.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: ich: Join string literals back
Andy Shevchenko [Tue, 3 Jul 2018 00:39:03 +0000 (03:39 +0300)]
gpio: ich: Join string literals back

For easy grepping on debug purposes join string literals back in the
messages.

While here, fix spelling typo.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: ich: Convert pr_<level> to dev_<level>
Andy Shevchenko [Thu, 8 Nov 2018 15:48:14 +0000 (17:48 +0200)]
gpio: ich: Convert pr_<level> to dev_<level>

Instead of customized pr_<level> format use unified dev_<level> output.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: ich: Switch to use struct device instead of platform_device
Andy Shevchenko [Thu, 8 Nov 2018 15:37:07 +0000 (17:37 +0200)]
gpio: ich: Switch to use struct device instead of platform_device

There is no need to have a pointer to struct platform_device.
Instead, switch to use struct device one.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: ich: Simplify error handling in ichx_write_bit()
Andy Shevchenko [Wed, 7 Nov 2018 21:29:41 +0000 (23:29 +0200)]
gpio: ich: Simplify error handling in ichx_write_bit()

Simplify error handling in ichx_write_bit() and propagate its error code
to the caller.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: sodaville: Use for_each_set_bit() in IRQ handler
Andy Shevchenko [Tue, 6 Nov 2018 12:38:55 +0000 (14:38 +0200)]
gpio: sodaville: Use for_each_set_bit() in IRQ handler

This simplifies and standardizes the AB IRQ handler by using
the for_each_set_bit() library function.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: pch: Use for_each_set_bit() in IRQ handler
Andy Shevchenko [Tue, 6 Nov 2018 12:38:55 +0000 (14:38 +0200)]
gpio: pch: Use for_each_set_bit() in IRQ handler

This simplifies and standardizes the AB IRQ handler by using
the for_each_set_bit() library function.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: uniphier: convert to SPDX License Identifier
Masahiro Yamada [Wed, 5 Dec 2018 12:54:09 +0000 (21:54 +0900)]
gpio: uniphier: convert to SPDX License Identifier

checkpatch.pl suggests to use SPDX license tag. I am happy to
follow it.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: zynq: Report gpio direction at boot
Brandon Maier [Wed, 28 Nov 2018 17:14:17 +0000 (11:14 -0600)]
gpio: zynq: Report gpio direction at boot

The Zynq's gpios can be configured by the bootloader. But Linux will
erroneously report all gpios as inputs unless we implement
get_direction().

Signed-off-by: Brandon Maier <Brandon.Maier@collins.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ks8695: Change to use DEFINE_SHOW_ATTRIBUTE macro
Yangtao Li [Fri, 30 Nov 2018 16:22:46 +0000 (11:22 -0500)]
gpio: ks8695: Change to use DEFINE_SHOW_ATTRIBUTE macro

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodt-bindings: tegra186-gpio: Add Tegra186 specific prefix
Thierry Reding [Fri, 23 Nov 2018 12:43:41 +0000 (13:43 +0100)]
dt-bindings: tegra186-gpio: Add Tegra186 specific prefix

Subsequent generations of Tegra, such as Tegra194, contain a completely
different set of GPIOs. In order to clarify that the Tegra186 defines
are indeed specific to Tegra186, change the prefix from TEGRA_ to
TEGRA186_.

Note that for now we need to keep the old definitions in place to avoid
breaking compilation in file that use this header. Once all users have
been converted to use the new defines, the old ones can be removed.

Also note that this is only a naming change and doesn't affect device
tree ABI.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodt-bindings: gpio: lpc18xx: describe interrupt controllers of GPIO controller
Vladimir Zapolskiy [Wed, 28 Nov 2018 22:48:40 +0000 (00:48 +0200)]
dt-bindings: gpio: lpc18xx: describe interrupt controllers of GPIO controller

From LPC18xx and LPC43xx User Manuals the GPIO controller consists of
the following weakly connected blocks:
* GPIO pin interrupt block at 0x40087000,
* GPIO GROUP0 interrupt block at 0x40088000,
* GPIO GROUP1 interrupt block at 0x40089000,
* GPIO port block at 0x400F4000.

While all 4 sub-controller blocks have their own I/O addresses, moreover
all 3 interrupt blocks are APB0 peripherals and high-speed GPIO block is
an AHB slave, according to the hardware manual interrupt controllers and
GPIO controller block are seen as a single device, all 4 sub-controllers
have the shared reset signal RGU #28 and the same shared clock to access
registers CLK_Mx_GPIO on CCU1.

The change adds descriptions of the currently missing interrupt controller
blocks found on GPIO controller, new added properties are 'reg-names',
'resets', 'interrupt-controller' and '#interrupt-cells', also the example
is updated to reflect the changes in device tree binding description.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: lpc18xx: add GPIO pin interrupt controller support
Vladimir Zapolskiy [Wed, 28 Nov 2018 22:48:41 +0000 (00:48 +0200)]
gpio: lpc18xx: add GPIO pin interrupt controller support

The change adds support of LPC18xx/LPC43xx GPIO pin interrupt controller
block within SoC GPIO controller. The new interrupt controller driver
allows to configure and capture edge or level interrupts on 8 arbitrary
selectedinput GPIO pins, and lift the signals to be reported as NVIC rising
edge interrupts. Configuration of a particular GPIO pin to serve as
interrupt and its mapping to an interrupt on NVIC is done by SCU pin
controller, for more details see description of 'nxp,gpio-pin-interrupt'
device tree property of a GPIO pin [1].

From LPC18xx and LPC43xx User Manuals the GPIO controller consists of
the following blocks:
* GPIO pin interrupt block at 0x40087000, this change adds its support,
* GPIO GROUP0 interrupt block at 0x40088000,
* GPIO GROUP1 interrupt block at 0x40089000,
* GPIO port block at 0x400F4000, it is supported by the original driver.

While all 4 sub-controller blocks have their own I/O addresses, moreover
all 3 interrupt blocks are APB0 peripherals and high-speed GPIO block is
an AHB slave, according to the hardware manual the GPIO controller is
seen as a single block, and 4 sub-controllers have the shared reset signal
RGU #28 and clock to register interface CLK_CPU_GPIO on CCU1.

Likely support of two GPIO group interrupt blocks won't be added in short
term, because the mechanism to mask several interrupt sources is not well
defined.

[1] Documentation/devicetree/bindings/pinctrl/nxp,lpc1850-scu.txt

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: lpc18xx: use resource managed interface to register GPIO controller
Vladimir Zapolskiy [Wed, 28 Nov 2018 22:28:48 +0000 (00:28 +0200)]
gpio: lpc18xx: use resource managed interface to register GPIO controller

Slightly simplify deregistration of the GPIO controller driver.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: lpc18xx: add struct device local variable
Vladimir Zapolskiy [Wed, 28 Nov 2018 22:28:47 +0000 (00:28 +0200)]
gpio: lpc18xx: add struct device local variable

This is a non-functional change, it simplifies multiple access to
'struct device' pointer derived from a platform device pointer,
the new local variable will also be used in the following changes.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: lpc18xx: use SPDX license identifier
Vladimir Zapolskiy [Wed, 28 Nov 2018 22:28:46 +0000 (00:28 +0200)]
gpio: lpc18xx: use SPDX license identifier

Replace GPLv2 header with the SPDX identifier.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: mt7621: pass mediatek_gpio_bank_probe() failure up the stack
Nicholas Mc Guire [Tue, 27 Nov 2018 17:00:18 +0000 (18:00 +0100)]
gpio: mt7621: pass mediatek_gpio_bank_probe() failure up the stack

The error cases of mediatek_gpio_bank_probe() would go unnoticed (except
for the dev_err() messages). The probe function should return an error
if one of the banks failed to initialize properly indicated by
not returning non-0.

Fixes: 4ba9c3afda41 ("gpio: mt7621: Add a driver for MT7621")
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Acked-by: Sean Wang <sean.wang@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: mt7621: report failure of devm_kasprintf()
Nicholas Mc Guire [Wed, 21 Nov 2018 18:06:12 +0000 (19:06 +0100)]
gpio: mt7621: report failure of devm_kasprintf()

kasprintf() may return NULL on failure of internal allocation thus the
assigned  label  is not safe if not explicitly checked. On error
mediatek_gpio_bank_probe() returns negative values so -ENOMEM in the
(unlikely) failure case should be fine here.

Fixes: 4ba9c3afda41 ("gpio: mt7621: Add a driver for MT7621")
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: Sean Wang <sean.wang@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoMAINTAINERS: remove a duplicate entry for gpio-mockup
Bartosz Golaszewski [Mon, 26 Nov 2018 08:15:58 +0000 (09:15 +0100)]
MAINTAINERS: remove a duplicate entry for gpio-mockup

I'll be getting all GPIO e-mail now, so remove my name from reviewers
of gpio-mockup.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: rcar: reference device instead of platform device
Vladimir Zapolskiy [Thu, 22 Nov 2018 20:19:41 +0000 (22:19 +0200)]
gpio: rcar: reference device instead of platform device

The change simplifies dereferences to the mediated struct device, also
it allows to limit the scope of the platform device usage to probe and
remove functions only.

Non-functional change.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: lynxpoint: Use for_each_set_bit() in IRQ handler
Andy Shevchenko [Tue, 6 Nov 2018 12:38:55 +0000 (14:38 +0200)]
gpio: lynxpoint: Use for_each_set_bit() in IRQ handler

This simplifies and standardizes the AB IRQ handler by using
the for_each_set_bit() library function.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: pch: Convert to dev_pm_ops
Andy Shevchenko [Wed, 7 Nov 2018 19:19:45 +0000 (21:19 +0200)]
gpio: pch: Convert to dev_pm_ops

Convert the legacy system PM callbacks to new ones. Meanwhile, remove the
redundant calls to the PCI for changing a power state since it's done by bus
code.

While here, remove weird indentation with backslash in use.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: sodaville: Convert to use managed functions pcim_* and devm_*
Andy Shevchenko [Wed, 7 Nov 2018 19:18:04 +0000 (21:18 +0200)]
gpio: sodaville: Convert to use managed functions pcim_* and devm_*

This makes the error handling much more simpler than open-coding everything
and in addition makes the probe function smaller an tidier.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: pch: Convert to use managed functions pcim_* and devm_*
Andy Shevchenko [Wed, 7 Nov 2018 19:18:04 +0000 (21:18 +0200)]
gpio: pch: Convert to use managed functions pcim_* and devm_*

This makes the error handling much more simpler than open-coding everything
and in addition makes the probe function smaller an tidier.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agogpio: OF: Parse MMC-specific CD and WP properties
Linus Walleij [Mon, 26 Nov 2018 13:51:23 +0000 (14:51 +0100)]
gpio: OF: Parse MMC-specific CD and WP properties

When retrieveing CD (card detect) and WP (write protect)
GPIO handles from the device tree, make sure to assign
them active low by default unless the "cd-inverted" or
"wp-inverted" properties are set. These properties mean
that respective signal is active HIGH since the SDHCI
specification stipulates that this kind of signals
should be treated as active LOW.

If the twocell GPIO flag is also specified as active
low, well that's nice and we will silently ignore the
tautological specification.

If however the GPIO line is specified as active low
in the GPIO flasg cell and "cd-inverted" or "wp-inverted"
is also specified, the latter takes precedence and we
print a warning.

The current effect on the MMC slot-gpio core are as
follows:

For CD GPIOs: no effect. The current code in
mmc/core/host.c calls mmc_gpiod_request_cd() with
the "override_active_level" argument set to true,
which means that whatever the GPIO descriptor
thinks about active low/high will be ignored, the
core will use the MMC_CAP2_CD_ACTIVE_HIGH to keep
track of this and reads the raw value from the
GPIO descriptor, totally bypassing gpiolibs inversion
semantics. I plan to clean this up at a later point
passing the handling of inversion semantics over
to gpiolib, so this patch prepares the ground for
that.

Fow WP GPIOs: this is probably fixing a bug, because
the code in mmc/core/host.c calls mmc_gpiod_request_ro()
with the "override_active_level" argument set to false,
which means it will respect the inversion semantics of
the gpiolib and ignore the MMC_CAP2_RO_ACTIVE_HIGH
flag for everyone using this through device tree.
However the code in host.c confusingly goes to great
lengths setting up the MMC_CAP2_RO_ACTIVE_HIGH flag
from the GPIO descriptor and by reading the "wp-inverted"
property of the node. As far as I can tell this is all
in vain and the inversion is broken: device trees that
use "wp-inverted" do not work as intended, instead the
only way to actually get inversion on a line is by
setting the second cell flag to GPIO_ACTIVE_HIGH (which
will be the default) or GPIO_ACTIVE_LOW if they want
the proper MMC semantics. Presumably all device trees do
this right but we need to parse and handle this properly.

Cc: linux-mmc@vger.kernel.org
Cc: linux-gpio@vger.kernel.org
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: dwapb: Correct the DT node name in the example
Phil Edworthy [Tue, 20 Nov 2018 11:17:09 +0000 (11:17 +0000)]
gpio: dwapb: Correct the DT node name in the example

The sub-nodes should not be called gpio-controller, but simply gpio.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: restore original GPLv2+ license of gpiolib-of.c sources
Vladimir Zapolskiy [Thu, 22 Nov 2018 13:59:01 +0000 (15:59 +0200)]
gpio: restore original GPLv2+ license of gpiolib-of.c sources

It's easy to verify that the change of drivers/gpio/gpiolib-of.c license
header to SPDX standard changes the license from GPLv2+ to GPLv2, and
this change corrects it.

Fixes: dae5f0afcfc3 ("gpio: Use SPDX header for core library")
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodrivers/gpio/gpio-grgpio.c: Remove duplicate header
Brajeswar Ghosh [Fri, 16 Nov 2018 10:49:10 +0000 (16:19 +0530)]
drivers/gpio/gpio-grgpio.c: Remove duplicate header

Remove linux/gpio/driver.h which is included more than once

Signed-off-by: Brajeswar Ghosh <brajeswar.linux@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: vf610: add optional clock support
A.s. Dong [Sat, 10 Nov 2018 14:21:18 +0000 (14:21 +0000)]
gpio: vf610: add optional clock support

Some SoCs need the gpio clock to be enabled before accessing
HW registers. This patch add the optional clock handling.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Stefan Agner <stefan@agner.ch>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: mxc: move gpio noirq suspend/resume to syscore phase
Anson Huang [Fri, 9 Nov 2018 04:56:56 +0000 (04:56 +0000)]
gpio: mxc: move gpio noirq suspend/resume to syscore phase

During noirq suspend/resume phase, GPIO irq could arrive
and its registers like IMR will be changed by irq handle
process, to make the GPIO registers exactly when it is
powered ON after resume, move the GPIO noirq suspend/resume
callback to syscore suspend/resume phase, local irq is
disabled at this phase so GPIO registers are atomic.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: drop broken to_gpio_irq_chip() helper
Johan Hovold [Mon, 12 Nov 2018 14:10:28 +0000 (15:10 +0100)]
gpio: drop broken to_gpio_irq_chip() helper

Drop the broken to_gpio_irq_chip() container_of() helper, which would
break the build for anyone who tries to use it.

Specifically, struct gpio_irq_chip only holds a pointer to a struct
irq_chip so using container_of() on an irq-chip pointer makes no sense.

Fixes: da80ff81a8f5 ("gpio: Move irqchip into struct gpio_irq_chip")
Cc: Thierry Reding <treding@nvidia.com>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: rcar: convert to SPDX identifiers
Kuninori Morimoto [Thu, 8 Nov 2018 06:35:16 +0000 (06:35 +0000)]
gpio: rcar: convert to SPDX identifiers

This patch updates license to use SPDX-License-Identifier
instead of verbose license text.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: drop devm_gpio_chip_match()
Laurent Pinchart [Wed, 7 Nov 2018 23:15:07 +0000 (01:15 +0200)]
gpio: drop devm_gpio_chip_match()

Commit 48207d7595d2 ("gpio: drop devm_gpiochip_remove()") dropped the
last user of drop devm_gpio_chip_match(), causing a defined but not used
compilation warning. Fix it by removing the function.

Fixes: 48207d7595d2 ("gpio: drop devm_gpiochip_remove()")
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoMAINTAINERS: Do maintain Intel GPIO drivers via separate tree
Andy Shevchenko [Tue, 6 Nov 2018 11:49:43 +0000 (13:49 +0200)]
MAINTAINERS: Do maintain Intel GPIO drivers via separate tree

We would like to consolidate Intel pure GPIO drivers, including PMICs and
some old x86 platforms, in one tree which is maintained by Intel.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5 years agodt-bindings: gpio: vf610: add optional clocks property
A.s. Dong [Wed, 31 Oct 2018 14:43:04 +0000 (14:43 +0000)]
dt-bindings: gpio: vf610: add optional clocks property

On some SoCs(e.g. MX7ULP), GPIO clock is gatable and maybe
disabled by default. Users have to make sure it's enabled before
being able to access controller registers, otherwise an external
abort error may occur. Let's add the optional clocks property to
handle this case.

For ULP GPIO clock, it includes two separate clocks: one is for
GPIO controller Input/Output function clock while another is
GPIO port control clock for interrupt function.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Stefan Agner <stefan@agner.ch>
Cc: linux-gpio@vger.kernel.org
Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: Fix possible use after free on label
Muchun Song [Thu, 1 Nov 2018 13:12:50 +0000 (21:12 +0800)]
gpiolib: Fix possible use after free on label

gpiod_request_commit() copies the pointer to the label passed as
an argument only to be used later. But there's a chance the caller
could immediately free the passed string(e.g., local variable).
This could trigger a use after free when we use gpio label(e.g.,
gpiochip_unlock_as_irq(), gpiochip_is_requested()).

To be on the safe side: duplicate the string with kstrdup_const()
so that if an unaware user passes an address to a stack-allocated
buffer, we won't get the arbitrary label.

Also fix gpiod_set_consumer_name().

Signed-off-by: Muchun Song <smuchun@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: sch311x: clean an indentation issue, remove extraneous space
Colin Ian King [Tue, 30 Oct 2018 14:07:22 +0000 (14:07 +0000)]
gpio: sch311x: clean an indentation issue, remove extraneous space

Trivial fix to clean up an indentation issue, remove space

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pl061: Move irq_chip definition inside struct pl061
Manivannan Sadhasivam [Wed, 24 Oct 2018 17:29:15 +0000 (22:59 +0530)]
gpio: pl061: Move irq_chip definition inside struct pl061

Keeping the irq_chip definition static will make it shared with multiple
giochips in the system. This practice is considered to be bad and now we
will get the below warning from gpiolib core:

"detected irqchip that is shared with multiple gpiochips: please fix the
driver."

Hence, move the irq_chip definition from static to `struct pl061` for
using a unique irq_chip for each gpiochip.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: drop devm_gpiochip_remove()
Uwe Kleine-König [Fri, 5 Oct 2018 19:42:06 +0000 (21:42 +0200)]
gpio: drop devm_gpiochip_remove()

There is hardly any reason to call devm_gpiochip_remove() because the
driver core handles calling gpiochip_remove() automatically.

To make it harder to introduce new (and probably unneeded) callers, drop
the function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pcie-idio-24: Mask read inputs for get_multiple
William Breathitt Gray [Mon, 22 Oct 2018 12:10:20 +0000 (21:10 +0900)]
gpio: pcie-idio-24: Mask read inputs for get_multiple

This patch masks the read inputs with the word mask in order to ensure
only requested input states are returned in the bits array.

Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pci-idio-16: Mask read inputs for get_multiple
William Breathitt Gray [Mon, 22 Oct 2018 12:10:06 +0000 (21:10 +0900)]
gpio: pci-idio-16: Mask read inputs for get_multiple

This patch masks the read inputs with the word mask in order to ensure
only requested input states are returned in the bits array.

Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ws16c48: Mask read inputs for get_multiple
William Breathitt Gray [Mon, 22 Oct 2018 12:09:49 +0000 (21:09 +0900)]
gpio: ws16c48: Mask read inputs for get_multiple

This patch masks the read inputs with the word mask in order to ensure
only requested input states are returned in the bits array.

Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: gpio-mm: Mask read inputs for get_multiple
William Breathitt Gray [Mon, 22 Oct 2018 12:09:31 +0000 (21:09 +0900)]
gpio: gpio-mm: Mask read inputs for get_multiple

This patch masks the read inputs with the word mask in order to ensure
only requested input states are returned in the bits array.

Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: 104-idi-48e: Mask the read inputs for get_multiple
William Breathitt Gray [Mon, 22 Oct 2018 12:09:16 +0000 (21:09 +0900)]
gpio: 104-idi-48e: Mask the read inputs for get_multiple

This patch masks the read inputs with the word mask in order to ensure
only requested input states are returned in the bits array.

Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: 104-dio-48e: Mask read inputs for get_multiple
William Breathitt Gray [Mon, 22 Oct 2018 12:08:59 +0000 (21:08 +0900)]
gpio: 104-dio-48e: Mask read inputs for get_multiple

This patch masks the read inputs with the word mask in order to ensure
only requested input states are returned in the bits array.

Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: gpio-tegra: simplify getting .driver_data
Wolfram Sang [Sun, 21 Oct 2018 20:00:00 +0000 (22:00 +0200)]
gpio: gpio-tegra: simplify getting .driver_data

We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: gpio-zynq: simplify getting .driver_data
Wolfram Sang [Sun, 21 Oct 2018 20:00:01 +0000 (22:00 +0200)]
gpio: gpio-zynq: simplify getting .driver_data

We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: gpio-omap: simplify getting .driver_data
Wolfram Sang [Sun, 21 Oct 2018 19:59:59 +0000 (21:59 +0200)]
gpio: gpio-omap: simplify getting .driver_data

We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: gpio-mxc: simplify getting .driver_data
Wolfram Sang [Sun, 21 Oct 2018 19:59:58 +0000 (21:59 +0200)]
gpio: gpio-mxc: simplify getting .driver_data

We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: gpio-lynxpoint: simplify getting .driver_data
Wolfram Sang [Sun, 21 Oct 2018 19:59:57 +0000 (21:59 +0200)]
gpio: gpio-lynxpoint: simplify getting .driver_data

We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: gpio-dwapb: simplify getting .driver_data
Wolfram Sang [Sun, 21 Oct 2018 19:59:56 +0000 (21:59 +0200)]
gpio: gpio-dwapb: simplify getting .driver_data

We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>