GitHub/moto-9609/android_kernel_motorola_exynos9610.git
8 years agogpio: set up initial state from .get_direction()
Linus Walleij [Thu, 28 Apr 2016 11:33:59 +0000 (13:33 +0200)]
gpio: set up initial state from .get_direction()

If the gpiochip supports the .get_direction() callback, then
the initial state of the descriptor flags should be set up
as output accordingly. Also put in comments explaining what is
going on.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: rename gpio-generic.c into gpio-mmio.c
Christian Lamparter [Thu, 28 Apr 2016 09:05:12 +0000 (11:05 +0200)]
gpio: rename gpio-generic.c into gpio-mmio.c

This patch renames the gpio-generic.c into gpio-mmio.c.
This is because currently the file only contains code
for a memory-mapped GPIO driver. There isn't any support
for ioports or other resource type.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: generic: fix GPIO_GENERIC_PLATFORM is set to module case
Christian Lamparter [Fri, 29 Apr 2016 00:53:14 +0000 (02:53 +0200)]
gpio: generic: fix GPIO_GENERIC_PLATFORM is set to module case

GPIO_GENERIC_PLATFORM is a tristate. If the module option is
selected the resulting gpio-generic.ko will lack most of the
module initialzation and probe code.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: dwapb: add gpio-signaled acpi event support
Jiang Qiu [Thu, 28 Apr 2016 09:32:03 +0000 (17:32 +0800)]
gpio: dwapb: add gpio-signaled acpi event support

This patch adds gpio-signaled acpi event support. It is used for
power button on hisilicon D02 board, an arm64 platform.

The corresponding DSDT file is defined as follows:
Device(GPI0) {
Name(_HID, "HISI0181")
Name(_ADR, 0)
Name(_UID, 0)

Name (_CRS, ResourceTemplate ()  {
Memory32Fixed (ReadWrite, 0x802e0000, 0x10000)
Interrupt (ResourceConsumer, Level, ActiveHigh,
Exclusive,,,)  {344}
})

Device(PRTa) {
Name (_DSD, Package () {
Package () {
Package () {"reg",0},
Package () {"snps,nr-gpios",32},
}
})
}

Name (_AEI, ResourceTemplate () {
GpioInt(Edge, ActiveLow, ExclusiveAndWake,
PullUp, , " \\_SB.GPI0") {8}
})

Method (_E08, 0x0, NotSerialized) {
Notify (\_SB.PWRB, 0x80)
}
}

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jiang Qiu <qiujiang@huawei.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: dwapb: convert device node to fwnode
Jiang Qiu [Thu, 28 Apr 2016 09:32:02 +0000 (17:32 +0800)]
gpio: dwapb: convert device node to fwnode

This patch converts device node to fwnode for dwapb driver, so
as to provide a unified fwnode for DT and ACPI bindings.

Tested-by: Alan Tull <delicious.quinoa@gmail.com>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jiang Qiu <qiujiang@huawei.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: dwapb: remove name from dwapb_port_property
Jiang Qiu [Thu, 28 Apr 2016 09:32:01 +0000 (17:32 +0800)]
gpio: dwapb: remove name from dwapb_port_property

This patch removed the name property from dwapb_port_property.
The name property is redundant, since we can get this info
from dwapb_gpio dev node.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jiang Qiu <qiujiang@huawei.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio/qoriq: select IRQ_DOMAIN
Arnd Bergmann [Tue, 19 Apr 2016 12:10:08 +0000 (14:10 +0200)]
gpio/qoriq: select IRQ_DOMAIN

The gpio-mpc8xxx driver requires IRQ domains but can be built
without them, resulting on a failure to build certain randconfigs
on ARM:

drivers/gpio/gpio-mpc8xxx.c: In function 'mpc8xxx_gpio_to_irq':
drivers/gpio/gpio-mpc8xxx.c:92:10: error: implicit declaration of function 'irq_create_mapping' [-Werror=implicit-function-declaration]
   return irq_create_mapping(mpc8xxx_gc->irq, offset);

This selects IRQ_DOMAIN from the driver to ensure we can build it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 5df7fd46b70b ("gpio/qoriq: Add qoriq platforms support")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: tegra: Add support for gpio debounce
Laxman Dewangan [Mon, 25 Apr 2016 10:38:34 +0000 (16:08 +0530)]
gpio: tegra: Add support for gpio debounce

NVIDIA's Tegra210 support the HW debounce in the GPIO controller
for all its GPIO pins.

Add support for setting debounce timing by implementing the
set_debounce callback of gpiochip.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: tegra: Get rid of all file scoped global variables
Laxman Dewangan [Mon, 25 Apr 2016 10:38:33 +0000 (16:08 +0530)]
gpio: tegra: Get rid of all file scoped global variables

Move the file scoped multiple global variable from Tegra GPIO
driver to the structure and make this as gpiochip data which
can be referred from GPIO chip callbacks.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: tegra: Make of_device_id compatible data to constant
Laxman Dewangan [Mon, 25 Apr 2016 10:38:32 +0000 (16:08 +0530)]
gpio: tegra: Make of_device_id compatible data to constant

The data member of the of_device_id is the constant type
and hence all static structure which is used for this
initialisation as static.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Suggested-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: tegra: Don't open code of_device_get_match_data()
Laxman Dewangan [Mon, 25 Apr 2016 10:38:31 +0000 (16:08 +0530)]
gpio: tegra: Don't open code of_device_get_match_data()

Use of_device_get_match_data() for getting matched data
instead of implementing this locally.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: pl061: implement .get_direction()
Linus Walleij [Thu, 28 Apr 2016 11:18:59 +0000 (13:18 +0200)]
gpio: pl061: implement .get_direction()

Implement this callback so that the driver reports correctly
the direction setting of each line.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: pl061: remove range check
Linus Walleij [Thu, 28 Apr 2016 11:18:11 +0000 (13:18 +0200)]
gpio: pl061: remove range check

The gpiochip calls are already checking that the GPIO line
offsets are in range.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: clarify open drain/source docs
Linus Walleij [Wed, 27 Apr 2016 08:23:44 +0000 (10:23 +0200)]
gpio: clarify open drain/source docs

Make the text clearer, remove reference to confusing "positive"
and "negative" and elaborate a bit.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: omap: fix irq triggering in smart-idle wakeup mode
Grygorii Strashko [Tue, 12 Apr 2016 10:52:31 +0000 (13:52 +0300)]
gpio: omap: fix irq triggering in smart-idle wakeup mode

Now GPIO IRQ loss is observed on dra7-evm after suspend/resume cycle
in the following case:
  extcon_usb1(id_irq) ->  pcf8575.gpio1 -> omapgpio6.gpio11 -> gic

the extcon_usb1 is wake up source and it enables IRQ wake up for
id_irq by calling enable/disable_irq_wake() during suspend/resume
which, in turn, causes execution of omap_gpio_wake_enable(). And
omap_gpio_wake_enable() will set/clear corresponding bit in
GPIO_IRQWAKEN_x register.

omapgpio6 configuration after boot - wakeup is enabled for GPIO IRQs
by default from  omap_gpio_irq_type:
GPIO_IRQSTATUS_SET_0    | 0x00000400
GPIO_IRQSTATUS_CLR_0    | 0x00000400
GPIO_IRQWAKEN_0         | 0x00000400
GPIO_RISINGDETECT       | 0x00000000
GPIO_FALLINGDETECT      | 0x00000400

omapgpio6 configuration after after suspend/resume cycle:
GPIO_IRQSTATUS_SET_0    | 0x00000400
GPIO_IRQSTATUS_CLR_0    | 0x00000400
GPIO_IRQWAKEN_0         | 0x00000000 <---
GPIO_RISINGDETECT       | 0x00000000
GPIO_FALLINGDETECT      | 0x00000400

As result, system will start to lose interrupts from pcf8575 GPIO
expander, because when OMAP GPIO IP is in smart-idle wakeup mode, there
is no guarantee that transition(s) on input non wake up GPIO pin will
trigger asynchronous wake-up request to PRCM and then IRQ generation.
IRQ will be generated when GPIO is in active mode - for example, some
time after accessing GPIO bank registers IRQs will be generated
normally, but issue will happen again once PRCM will put GPIO in low
power smart-idle wakeup mode.

Note 1. Issue is not reproduced if debounce clk is enabled for GPIO
bank.

Note 2. Issue hardly reproducible if GPIO pins group contains both
wakeup/non-wakeup gpios - for example, it will be hard to reproduce
issue with pin2 if GPIO_IRQWAKEN_0=0x1 GPIO_IRQSTATUS_SET_0=0x3
GPIO_FALLINGDETECT = 0x3 (TRM "Power Saving by Grouping the Edge/Level
Detection").

Note 3. There nothing common bitween System wake up and OMAP GPIO bank
IP wake up logic - the last one defines how the GPIO bank ON-IDLE-ON
transition will happen inside SoC under control of PRCM.

Hence, fix the problem by removing omap_set_gpio_wakeup() function
completely and so keeping always in sync GPIO IRQ mask/unmask
(IRQSTATUS_SET) and wake up enable (GPIO_IRQWAKEN) bits; and adding
IRQCHIP_MASK_ON_SUSPEND flag in OMAP GPIO irqchip. That way non wakeup
GPIO IRQs will be properly masked/unmask by IRQ PM core during
suspend/resume cycle.

Cc: Roger Quadros <rogerq@ti.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoASoC: ac97: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 22:48:29 +0000 (23:48 +0100)]
ASoC: ac97: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoASoC: wm8996: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 22:44:39 +0000 (23:44 +0100)]
ASoC: wm8996: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoASoC: wm8962: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 22:41:55 +0000 (23:41 +0100)]
ASoC: wm8962: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoASoC: wm8903: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 22:38:20 +0000 (23:38 +0100)]
ASoC: wm8903: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoASoC: wm5100: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 22:31:28 +0000 (23:31 +0100)]
ASoC: wm5100: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoASoC: rt5677: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 22:27:09 +0000 (23:27 +0100)]
ASoC: rt5677: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Bard Liao <bardliao@realtek.com>
Cc: Oder Chiou <oder_chiou@realtek.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoserial: sc16is7xx: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 22:15:53 +0000 (23:15 +0100)]
serial: sc16is7xx: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Jiri Slaby <jslaby@suse.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoserial: max310x: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 22:11:05 +0000 (23:11 +0100)]
serial: max310x: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Jiri Slaby <jslaby@suse.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agostaging: vme: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 22:06:50 +0000 (23:06 +0100)]
staging: vme: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Manohar Vanga <manohar.vanga@gmail.com>
Cc: devel@driverdev.osuosl.org
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agossb: gpio_driver: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 22:00:46 +0000 (23:00 +0100)]
ssb: gpio_driver: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Michael Buesch <m@bues.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoplatform: x86: intel-pmic: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 21:54:20 +0000 (22:54 +0100)]
platform: x86: intel-pmic: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Feng Tang <feng.tang@intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoinput: adp5588-keys: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 15:29:50 +0000 (16:29 +0100)]
input: adp5588-keys: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoarc: select GPIOLIB directly
Linus Walleij [Tue, 19 Apr 2016 08:45:14 +0000 (10:45 +0200)]
arc: select GPIOLIB directly

Instead of indirectly selecting GPIOLIB via the
ARCH_REQUIRE_GPIOLIB symbol, just select GPIOLIB.

Cc: Michael Büsch <m@bues.ch>
Cc: linux-snps-arc@lists.infradead.org
Acked-by: Vineet Gupta <vgupt@synopsys.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agosparc: remove ARCH_WANT_OPTIONAL_GPIOLIB
Linus Walleij [Tue, 19 Apr 2016 11:34:34 +0000 (13:34 +0200)]
sparc: remove ARCH_WANT_OPTIONAL_GPIOLIB

This symbols is not needed to get access to selecting the
GPIOLIB anymore: any arch can select GPIOLIB.

Cc: Michael Büsch <m@bues.ch>
Cc: sparclinux@vger.kernel.org
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agocris: do away with ARCH_REQUIRE_GPIOLIB
Linus Walleij [Tue, 19 Apr 2016 09:13:38 +0000 (11:13 +0200)]
cris: do away with ARCH_REQUIRE_GPIOLIB

Replace "select ARCH_REQUIRE_GPIOLIB" with "select GPIOLIB"
as this can now be selected directly.

Cc: Michael Büsch <m@bues.ch>
Cc: Mikael Starvik <starvik@axis.com>
Cc: linux-cris-kernel@axis.com
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agonios2: remove ARCH_WANT_OPTIONAL_GPIOLIB
Linus Walleij [Tue, 19 Apr 2016 11:33:48 +0000 (13:33 +0200)]
nios2: remove ARCH_WANT_OPTIONAL_GPIOLIB

This symbols is not needed to get access to selecting the
GPIOLIB anymore: any arch can select GPIOLIB.

Cc: Michael Büsch <m@bues.ch>
Cc: nios2-dev@lists.rocketboards.org
Acked-by: Ley Foon Tan <lftan@altera.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agom68k: do away with ARCH_REQUIRE_GPIOLIB
Linus Walleij [Tue, 19 Apr 2016 09:17:49 +0000 (11:17 +0200)]
m68k: do away with ARCH_REQUIRE_GPIOLIB

Replace "select ARCH_REQUIRE_GPIOLIB" with "select GPIOLIB"
as this can now be selected directly.

Cc: Michael Büsch <m@bues.ch>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Acked-by: Greg Ungerer <gerg@linux-m68k.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoxtensa: remove ARCH_WANT_OPTIONAL_GPIOLIB
Linus Walleij [Tue, 19 Apr 2016 11:35:14 +0000 (13:35 +0200)]
xtensa: remove ARCH_WANT_OPTIONAL_GPIOLIB

This symbols is not needed to get access to selecting the
GPIOLIB anymore: any arch can select GPIOLIB.

Cc: Michael Büsch <m@bues.ch>
Cc: Chris Zankel <chris@zankel.net>
Cc: linux-xtensa@linux-xtensa.org
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoalpha: remove ARCH_WANT_OPTIONAL_GPIOLIB
Linus Walleij [Tue, 19 Apr 2016 11:30:21 +0000 (13:30 +0200)]
alpha: remove ARCH_WANT_OPTIONAL_GPIOLIB

This symbols is not needed to get access to selecting the
GPIOLIB anymore: any arch can select GPIOLIB.

Cc: Michael Büsch <m@bues.ch>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: linux-alpha@vger.kernel.org
Acked-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agometag: remove ARCH_WANT_OPTIONAL_GPIOLIB
Linus Walleij [Tue, 19 Apr 2016 11:32:21 +0000 (13:32 +0200)]
metag: remove ARCH_WANT_OPTIONAL_GPIOLIB

This symbols is not needed to get access to selecting the
GPIOLIB anymore: any arch can select GPIOLIB.

Cc: Michael Büsch <m@bues.ch>
Cc: linux-metag@vger.kernel.org
Acked-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoavr32: do away with ARCH_REQUIRE_GPIOLIB
Linus Walleij [Tue, 19 Apr 2016 09:10:42 +0000 (11:10 +0200)]
avr32: do away with ARCH_REQUIRE_GPIOLIB

Replace "select ARCH_REQUIRE_GPIOLIB" with "select GPIOLIB"
as this can now be selected directly.

Cc: Michael Büsch <m@bues.ch>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Acked-by: Acked-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: remove deps on ARCH_[WANT_OPTIONAL|REQUIRE]_GPIOLIB
Linus Walleij [Tue, 19 Apr 2016 08:39:21 +0000 (10:39 +0200)]
gpio: remove deps on ARCH_[WANT_OPTIONAL|REQUIRE]_GPIOLIB

The GPIOLIB symbol currently require that
ARCH_WANT_OPTIONAL_GPIOLIB or ARCH_REQUIRE_GPIOLIB is selected
to be selectable.

The ARCH_REQUIRE_GPIOLIB does only one thing: select GPIOLIB.

This is just confusing: architectures that want GPIOLIB should
be able to configure it in no matter what, and those who
require it should just select GPIOLIB.

It also creates problems for drivers that need to state
"select GPIOLIB" to get dependencies: those depend on the
selected architecture to select
ARCH_[WANT_OPTIONAL|REQUIRE]_GPIOLIB first, and will cause
compile errors for the few archs that state neither.

These intermediary symbols need to go.

As a first step, remove the dependencies so that:

- ARCH_WANT_OPTIONAL_GPIOLIB becomes a noop (GPIOLIB will be
  available for everyone) and

- "select ARCH_REQUIRE_GPIOLIB" can be replaced by just
  "select GPIOLIB"

After this patch we can follow up with patches cleaning up the
architectures one-by one and eventually remove the
ARCH_[WANT_OPTIONAL|REQUIRE]_GPIOLIB symbols altogether.

Reported-by: Michael Hennerich <michael.hennerich@analog.com>
Cc: Michael Büsch <m@bues.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: revert bank bindings
Linus Walleij [Tue, 19 Apr 2016 12:47:50 +0000 (14:47 +0200)]
gpio: revert bank bindings

Keep the words talking about what a GPIO bank is, but remove the
binding. We have not agreed that this is something we want to have.

Acked-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: move gpiod_set_array_value_priv()
Linus Walleij [Sun, 24 Apr 2016 09:36:59 +0000 (11:36 +0200)]
gpio: move gpiod_set_array_value_priv()

This renames gpiod_set_array_value_priv() to
gpiod_set_array_value_complex() and moves it to the gpiolib.h
private header file so we can reuse it in the subsystem.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: f7188x: fix edit mistake
Linus Walleij [Mon, 18 Apr 2016 11:30:29 +0000 (13:30 +0200)]
gpio: f7188x: fix edit mistake

Fix a typo causing a build regression.

Fixes: f90c6bdb690b ("gpio: f7188x: use the new open drain callback")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio/reset: move gpio-{poweroff|restart} DT doc to proper place
Wolfram Sang [Tue, 12 Apr 2016 16:00:53 +0000 (18:00 +0200)]
gpio/reset: move gpio-{poweroff|restart} DT doc to proper place

I did only find them after a fuzzy search, so let them be where one
would expect them.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: brcmstb: Return proper error if bank width is invalid
Axel Lin [Sun, 10 Apr 2016 10:15:15 +0000 (18:15 +0800)]
gpio: brcmstb: Return proper error if bank width is invalid

Return proper error in brcmstb_gpio_probe if bank width is invalid.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: gpiolib: Print error number if gpio hog failed
Laxman Dewangan [Fri, 11 Mar 2016 13:43:21 +0000 (19:13 +0530)]
gpio: gpiolib: Print error number if gpio hog failed

Print the error number of GPIO hog failed during its configurations.
This helps in identifying the failure without instrumenting the code.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: of: Scan available child node for gpio-hog
Laxman Dewangan [Fri, 11 Mar 2016 13:43:20 +0000 (19:13 +0530)]
gpio: of: Scan available child node for gpio-hog

Look for child node which are available when iterating for
gpio hog node for request/set GPIO initial configuration
during OF gpio chip registration.

All it really does is make it possible to set
status = "disabled"; in the hog nodes, and then they will
not be applied.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: tegra: Allow compile test
Alexander Stein [Wed, 24 Feb 2016 19:54:32 +0000 (20:54 +0100)]
gpio: tegra: Allow compile test

Allow compile testing this driver by adding a new config option which
is enabled by default and depends on the old symbol or COMPILE_TEST.

Signed-off-by: Alexander Stein <alexanders83@web.de>
8 years agogpio: gpiolib-of: Allow compile testing
Alexander Stein [Wed, 24 Feb 2016 21:05:19 +0000 (22:05 +0100)]
gpio: gpiolib-of: Allow compile testing

Lower dependencies for compile testing.

Signed-off-by: Alexander Stein <alexanders83@web.de>
8 years agogpio: wm8994: use the new open drain callback
Linus Walleij [Sun, 10 Apr 2016 13:07:23 +0000 (15:07 +0200)]
gpio: wm8994: use the new open drain callback

The WM8994 GPIOs clearly have a dedicated open drain control
register. Implement support for controlling this from GPIO
descriptor tables or other hardware descriptions such as
device tree by implementing the .set_single_ended() callback.

Before this patch, lines requesting open drain will just be
switched to input mode by the framework, thus emulating open
drain. But the hardware can do the real thing, so let's
support that.

As part of this, rename the debugfs string for output mode
from "CMOS" to "push-pull" because it is the term used in
the framework to signify a tomem-pole CMOS output.

Cc: patches@opensource.wolfsonmicro.com
Cc: Mark Brown <broonie@kernel.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: wm831x: use the new open drain callback
Linus Walleij [Sun, 10 Apr 2016 12:52:33 +0000 (14:52 +0200)]
gpio: wm831x: use the new open drain callback

The WM831x GPIOs clearly have a dedicated open drain control
register. Implement support for controlling this from GPIO
descriptor tables or other hardware descriptions such as
device tree by implementing the .set_single_ended() callback.

Before this patch, lines requesting open drain will just be
switched to input mode by the framework, thus emulating open
drain. But the hardware can do the real thing, so let's
support that.

As part of this, rename the debugfs string for output mode
from "CMOS" to "push-pull" because it is the term used in
the framework to signify a tomem-pole CMOS output.

Cc: patches@opensource.wolfsonmicro.com
Cc: Mark Brown <broonie@kernel.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: vx855: use the new open drain callback
Linus Walleij [Sun, 10 Apr 2016 10:26:08 +0000 (12:26 +0200)]
gpio: vx855: use the new open drain callback

The vx855 driver clearly states it has three groups of lines:
GPI, GPO and GPIO. The GPO are assumedly push-pull. The GPIO
are implicit open drain, but if the GPIO subsystem ask for them
to be explicitly open drain (i.e. set the flag on a machine table
that we want open drain) it will currently misbehave: it will
switch the GPIOs to input mode (emulate open drain). Instead:
indicate in the .set_single_ended() callback that we support
open drain and open drain only.

Cc: Daniel Drake <drake@endlessm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: menz127: use the new open drain callback
Linus Walleij [Sat, 9 Apr 2016 19:53:39 +0000 (21:53 +0200)]
gpio: menz127: use the new open drain callback

The menz127 driver tries to support open drain by detecting it
at request time. However: without the new callbacks from the
gpiolib it is not really working: the core will still just emulate
the open drain mode by switching the line to an input.

By adding a hook into the new .set_single_ended() call rather than
trying to autodetect at request() time, proper open drain can be
supported.

Cc: Andreas Werner <andy@wernerandy.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: f7188x: use the new open drain callback
Linus Walleij [Sat, 9 Apr 2016 14:11:37 +0000 (16:11 +0200)]
gpio: f7188x: use the new open drain callback

The F7188x chips supports setting the pins in open drain mode.
Activate the new .set_single_ended() callback.

Cc: Peter Hung <hpeter@gmail.com>
Cc: Andreas Bofjall <andreas@gazonk.org>
Cc: Simon Guinot <simon.guinot@sequanux.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: f7188x: use BIT() macro
Linus Walleij [Sat, 9 Apr 2016 13:59:41 +0000 (15:59 +0200)]
gpio: f7188x: use BIT() macro

Align to how we handle bitmasks in most drivers in the
subsystem: using the BIT(n) macro over (1 << n).

Cc: Peter Hung <hpeter@gmail.com>
Cc: Andreas Bofjall <andreas@gazonk.org>
Cc: Simon Guinot <simon.guinot@sequanux.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: sx150x: use the new open drain callback
Linus Walleij [Sat, 9 Apr 2016 11:13:36 +0000 (13:13 +0200)]
gpio: sx150x: use the new open drain callback

One variant of the SX150X GPIO chip supports setting the pins in
open drain mode. This is currently available to set from platform
data, but completely unused in the kernel.

Activate the new .set_single_ended() callback so users can set
this up from e.g. device tree or board files using the new
GPIO descriptors.

As part of this, delete the platform data open drain setting
method.

Cc: Wei Chen <Wei.Chen@csr.com>
Cc: Peter Rosin <peda@axentia.se>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: sx150x: move platform data into driver
Linus Walleij [Sat, 9 Apr 2016 08:52:26 +0000 (10:52 +0200)]
gpio: sx150x: move platform data into driver

The sx150x has some platform data definition in <linux/i2c/sx150x.h>
but this file is only included from the driver in the whole kernel
so move its contents into the driver.

Cc: Wei Chen <Wei.Chen@csr.com>
Cc: Peter Rosin <peda@axentia.se>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: tps65218: use the new open drain callback
Linus Walleij [Fri, 8 Apr 2016 12:13:53 +0000 (14:13 +0200)]
gpio: tps65218: use the new open drain callback

The TPS65218 supports open drain mode on its three pins,
with one of them configurable also as push-pull. Use the
new .set_single_ended() callback to set this up properly
from the core, so the core actually see it can drive the
pin(s) as open drain, and does not attempt to emulate
open drain by switching the pin to an input.

Acked-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: of: Return error if gpio hog configuration failed
Laxman Dewangan [Fri, 11 Mar 2016 13:43:22 +0000 (19:13 +0530)]
gpio: of: Return error if gpio hog configuration failed

If GPIO hog configuration failed while adding OF based
gpiochip() then return the error instead of ignoring it.

This helps of properly handling the gpio driver dependency.

When adding the gpio hog nodes for NVIDIA's Tegra210 platforms,
the gpio_hogd() fails with EPROBE_DEFER because pinctrl is not
ready at this time and gpio_request() for Tegra GPIO driver
returns error. The error was not causing the Tegra GPIO driver
to fail as the error was getting ignored.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Benoit Parrot <bparrot@ti.com>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoMAINTAINERS: gpio: add DT bindings directory
Wolfram Sang [Tue, 12 Apr 2016 15:57:53 +0000 (17:57 +0200)]
MAINTAINERS: gpio: add DT bindings directory

Helps get_maintainer.pl to find the right people.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: pca953x: add PCAL9535 interrupt support for Galileo Gen2
Yong Li [Thu, 7 Apr 2016 04:56:32 +0000 (12:56 +0800)]
gpio: pca953x: add PCAL9535 interrupt support for Galileo Gen2

Galileo Gen2 board uses the PCAL9535 as the GPIO expansion,
it is different from PCA9535 and includes interrupt mask/status registers,
The current driver does not support the interrupt registers configuration,
it causes some gpio pins cannot trigger interrupt events,
this patch fix this issue.

The original patch was submitted by
Josef Ahmad <josef.ahmad@linux.intel.com>
http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-quark/tree/recipes-kernel/linux/files/0015-Quark-GPIO-1-2-quark.patch

Signed-off-by: Yong Li <yong.b.li@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: zynq: Fix the error path
Shubhrajyoti Datta [Mon, 4 Apr 2016 18:14:06 +0000 (23:44 +0530)]
gpio: zynq: Fix the error path

pm_runtime_disable is called only in remove it is missed
out in the error path.
Fix the same.

Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: Loongson1: add Loongson1 GPIO driver
Kelvin Cheung [Wed, 6 Apr 2016 12:34:53 +0000 (20:34 +0800)]
gpio: Loongson1: add Loongson1 GPIO driver

This patch adds GPIO driver for Loongson1B.

Signed-off-by: Kelvin Cheung <keguang.zhang@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: document open drain/source behaviour
Linus Walleij [Tue, 5 Apr 2016 14:49:57 +0000 (16:49 +0200)]
gpio: document open drain/source behaviour

This has been a totally undocumented feature for years so add some
generic concepts and documentation about open drain/source, include
some facts on how we now support for hardware.

Cc: Michael Hennerich <michael.hennerich@analog.com>
Cc: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>
Cc: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: tps6586x: make explicitly non-modular
Paul Gortmaker [Fri, 1 Apr 2016 18:49:38 +0000 (14:49 -0400)]
gpio: tps6586x: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/gpio/Kconfig:config GPIO_TPS6586X
drivers/gpio/Kconfig:   bool "TPS6586X GPIO"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: tps65910: make explicitly non-modular
Paul Gortmaker [Fri, 1 Apr 2016 18:49:37 +0000 (14:49 -0400)]
gpio: tps65910: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/gpio/Kconfig:config GPIO_TPS65910
drivers/gpio/Kconfig:   bool "TPS65910 GPIO"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: palmas: make explicitly non-modular
Paul Gortmaker [Fri, 1 Apr 2016 18:49:36 +0000 (14:49 -0400)]
gpio: palmas: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/gpio/Kconfig:config GPIO_PALMAS
drivers/gpio/Kconfig:   bool "TI PALMAS series PMICs GPIO"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: sx150x: make explicitly non-modular
Paul Gortmaker [Fri, 1 Apr 2016 18:49:35 +0000 (14:49 -0400)]
gpio: sx150x: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/gpio/Kconfig:config GPIO_SX150X
drivers/gpio/Kconfig:   bool "Semtech SX150x I2C GPIO expander"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Gregory Bean <gbean@codeaurora.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: tc3589x: make explicitly non-modular
Paul Gortmaker [Fri, 1 Apr 2016 18:49:34 +0000 (14:49 -0400)]
gpio: tc3589x: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/gpio/Kconfig:config GPIO_TC3589X
drivers/gpio/Kconfig:   bool "TC3589X GPIOs"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Rabin Vincent <rabin.vincent@stericsson.com>
Cc: Hanumath Prasad <hanumath.prasad@stericsson.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: rc5t583: make explicitly non-modular
Paul Gortmaker [Fri, 1 Apr 2016 18:49:33 +0000 (14:49 -0400)]
gpio: rc5t583: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/gpio/Kconfig:config GPIO_RC5T583
drivers/gpio/Kconfig:   bool "RICOH RC5T583 GPIO"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: tc3589x: implement open drain/source callback
Linus Walleij [Tue, 5 Apr 2016 13:11:11 +0000 (15:11 +0200)]
gpio: tc3589x: implement open drain/source callback

This makes use of the new .set_single_ended() callback to
set the GPIO line as open drain/open source using hardware.
The TC3589x can do this by either disabling the N-MOS
transistor (open drain) or the P-MOS transistor (open source)
of the output driver stage, in the first case making the signal
drive actively low and high impedance as "high" and in the second
case actively high and high impedance, which is as close to native
open drain support as we come.

Cc: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: tc3589x: use BIT() macro
Linus Walleij [Tue, 5 Apr 2016 13:09:09 +0000 (15:09 +0200)]
gpio: tc3589x: use BIT() macro

This switch to use BIT(n) instead of (1 << n) which is less
to the point. Most GPIO drivers do this to avoid mistakes.
Also switch from using <linux/gpio.h> to the apropriate
<linux/gpio/driver.h> include.

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: support native single-ended hardware drivers
Linus Walleij [Tue, 22 Mar 2016 09:51:16 +0000 (10:51 +0100)]
gpio: support native single-ended hardware drivers

Some GPIO controllers has a special hardware bit we can flip
to support open drain / source. This means that on these hardwares
we do not need to emulate OD/OS by setting the line to input
instead of actively driving it high/low. Add an optional vtable
callback to the driver set_single_ended() so that driver can
implement this in hardware if they have it.

We may need a pinctrl_gpio_set_config() call at some point to
propagate this down to a backing pin control device on systems
with split GPIO/pin control.

Reported-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: tpic2810: Make sure cached buffer has consistent status with h/w status
Axel Lin [Wed, 23 Mar 2016 11:49:41 +0000 (19:49 +0800)]
gpio: tpic2810: Make sure cached buffer has consistent status with h/w status

i2c_smbus_write_byte_data() can fail. To ensure the
cached buffer has consistent status with h/w status, don't
update the cached gpio->buffer if write fails.

Also refactor the code a bit by adding a tpic2810_set_mask_bits()
helper and use it to simplify the code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: zx: make explicitly non-modular
Paul Gortmaker [Sun, 27 Mar 2016 15:44:49 +0000 (11:44 -0400)]
gpio: zx: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

config GPIO_ZX
        bool "ZTE ZX GPIO support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modularity so that when reading the
driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Jun Nie <jun.nie@linaro.org>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: xgene: make explicitly non-modular
Paul Gortmaker [Sun, 27 Mar 2016 15:44:48 +0000 (11:44 -0400)]
gpio: xgene: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/gpio/Kconfig:config GPIO_XGENE
drivers/gpio/Kconfig:   bool "APM X-Gene GPIO controller support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Feng Kan <fkan@apm.com>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: sta2x11: make explicitly non-modular
Paul Gortmaker [Sun, 27 Mar 2016 15:44:47 +0000 (11:44 -0400)]
gpio: sta2x11: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/gpio/Kconfig:config GPIO_STA2X11
drivers/gpio/Kconfig:   bool "STA2x11/ConneXt GPIO support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modularity, so that when reading
the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: pl061: make explicitly non-modular
Paul Gortmaker [Sun, 27 Mar 2016 15:44:46 +0000 (11:44 -0400)]
gpio: pl061: make explicitly non-modular

The Kconfig for this driver is currently:

config GPIO_PL061
        bool "PrimeCell PL061 GPIO support"

...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity, so that when reading the
driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: mvebu: make explicitly non-modular
Paul Gortmaker [Sun, 27 Mar 2016 15:44:45 +0000 (11:44 -0400)]
gpio: mvebu: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/gpio/Kconfig:config GPIO_MVEBU
drivers/gpio/Kconfig:   def_bool y

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modularity so that when reading the
driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: moxart: make explicitly non-modular
Paul Gortmaker [Sun, 27 Mar 2016 15:44:44 +0000 (11:44 -0400)]
gpio: moxart: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/gpio/Kconfig:config GPIO_MOXART
drivers/gpio/Kconfig:   bool "MOXART GPIO support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular references so that when reading
the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We don't replace module.h with init.h since the file already has that.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: mc9s08dz60: make explicitly non-modular
Paul Gortmaker [Sun, 27 Mar 2016 15:44:43 +0000 (11:44 -0400)]
gpio: mc9s08dz60: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/gpio/Kconfig:config GPIO_MC9S08DZ60
drivers/gpio/Kconfig:   bool "MX35 3DS BOARD MC9S08DZ60 GPIO functions"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_i2c_driver() uses the same init level priority as
builtin_i2c_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Wu Guoxing <b39297@freescale.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: mb86s7x: make explicitly non-modular
Paul Gortmaker [Sun, 27 Mar 2016 15:44:42 +0000 (11:44 -0400)]
gpio: mb86s7x: make explicitly non-modular

The Kconfig for this driver is currently:

config GPIO_MB86S7X
        bool "GPIO support for Fujitsu MB86S7x Platforms"

...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity, so that when reading the
driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: bcm-kona: make explicitly non-modular
Paul Gortmaker [Sun, 27 Mar 2016 15:44:41 +0000 (11:44 -0400)]
gpio: bcm-kona: make explicitly non-modular

The Kconfig currently controlling compilation of this code is:

config GPIO_BCM_KONA
        bool "Broadcom Kona GPIO"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modularity so that when reading the
driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Ray Jui <rjui@broadcom.com>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: gpio-it87: Add support for IT8620 and IT8628
Martin Blumenstingl [Sun, 27 Mar 2016 15:43:02 +0000 (17:43 +0200)]
gpio: gpio-it87: Add support for IT8620 and IT8628

These chips seem to have a 9th GPIO block (thus supporting 72 GPIOs)
which is configured through SuperIO register 0xd2 (output enable) and
0xd3 (simple I/O). This is also the reason why io_size is larger than
on IT8728 / IT8732. Unfortunately I don't have hardware to test this 9th
GPIO block.

I am also not sure about not configuring the Simple I/O registers as the
hardware I have only uses GPIO block 8. Reading back the values of
0xc0-0xc7 (as configured by the BIOS/EFI on my board) shows that all
have 0xff set.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agotools/gpio: Add missing initialization of device_name
Geert Uytterhoeven [Fri, 25 Mar 2016 12:36:30 +0000 (13:36 +0100)]
tools/gpio: Add missing initialization of device_name

lsgpio.c: In function ‘main’:
lsgpio.c:166:7: warning: ‘device_name’ may be used uninitialized in this functio
n [-Wmaybe-uninitialized]
   ret = list_device(device_name);
       ^

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agotools/gpio: Enable compiler optimization to catch more bugs
Geert Uytterhoeven [Fri, 25 Mar 2016 12:36:29 +0000 (13:36 +0100)]
tools/gpio: Enable compiler optimization to catch more bugs

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: dt-bindings: document the concept of GPIO banks
Linus Walleij [Thu, 31 Mar 2016 09:09:11 +0000 (11:09 +0200)]
gpio: dt-bindings: document the concept of GPIO banks

Cc: devicetree@vger.kernel.org
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: xlp: Add GPIO driver support for Broadcom Vulcan ARM64
Kamlakant Patel [Thu, 24 Mar 2016 09:31:40 +0000 (15:01 +0530)]
gpio: xlp: Add GPIO driver support for Broadcom Vulcan ARM64

- Add GPIO support for Broadcom Vulcan ARM64.
- Add depends on ARCH_VULCAN to Kconfig to enable gpio controller
  driver for Broadcom Vulcan ARM64 SoCs.

Signed-off-by: Kamlakant Patel <kamlakant.patel@broadcom.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: mcp23s08: Add support for level triggered interrupts
Alexander Stein [Wed, 23 Mar 2016 17:01:27 +0000 (18:01 +0100)]
gpio: mcp23s08: Add support for level triggered interrupts

The interrupt for the corresponding pin is configured to trigger when the
pin state changes compared to a preconfigured state (Bit set in INTCON).
This state is set by setting/clearing the bit in DEFVAL.
In the interrupt handler we need also to check if the bit in INTCON is set
for level triggered interrupts.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: mpc8xxx: Add new platforms GPIO DT node description
Liu Gang [Wed, 23 Mar 2016 09:47:19 +0000 (17:47 +0800)]
gpio: mpc8xxx: Add new platforms GPIO DT node description

Update the NXP GPIO node dt-binding file for QorIQ and
Layerscape platforms, and add one more example with
ls2080a GPIO node.

Signed-off-by: Liu Gang <Gang.Liu@nxp.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: 74x164: add dt support for nxp's 74x594
Nicolas Saenz Julienne [Mon, 14 Mar 2016 23:32:10 +0000 (23:32 +0000)]
gpio: 74x164: add dt support for nxp's 74x594

The chip is also an 8 bit shift register which works out of the box as a GPO
expander with this patch

Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agogpio: xgene-sb: Use irq_domain_free_irqs_common()
Axel Lin [Thu, 17 Mar 2016 04:01:43 +0000 (12:01 +0800)]
gpio: xgene-sb: Use irq_domain_free_irqs_common()

Current code calls irq_domain_alloc_irqs_parent() in .alloc,
so it should call irq_domain_free_irqs_parent() accordingly in .free.
Fix it by switching to use irq_domain_free_irqs_common() instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoirqdomain: Export irq_domain_free_irqs_common
Axel Lin [Thu, 17 Mar 2016 04:00:31 +0000 (12:00 +0800)]
irqdomain: Export irq_domain_free_irqs_common

Export irq_domain_free_irqs_common so it can be used by modules.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agopowerpc: ppc4xx: drop unused variable
Linus Walleij [Thu, 31 Mar 2016 07:09:12 +0000 (09:09 +0200)]
powerpc: ppc4xx: drop unused variable

commit 0d36fe65f58391712e11a6621075f373216e5f00
"powerpc: ppc4xx: use gpiochip data pointer"
made the mm_gc local variable in ppc4xx_gpio_set()
redundant, and when GCC treats warnings as errors this
happens:

arch/powerpc/sysdev/ppc4xx_gpio.c: In function 'ppc4xx_gpio_set':
arch/powerpc/sysdev/ppc4xx_gpio.c:93:26: error:
  unused variable 'mm_gc' [-Werror=unused-variable]
     struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
                             ^
   cc1: all warnings being treated as errors

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoinput: ad7879: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 15:35:27 +0000 (16:35 +0100)]
input: ad7879: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agoinput: adp5589-keys: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 15:32:08 +0000 (16:32 +0100)]
input: adp5589-keys: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agounicore32: gpio: switch to gpiochip_add_data()
Linus Walleij [Tue, 8 Dec 2015 15:07:09 +0000 (16:07 +0100)]
unicore32: gpio: switch to gpiochip_add_data()

We're planning to remove the gpiochip_add() function to swith
to gpiochip_add_data() with NULL for data argument.

Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agosh: x3proto-gpio: switch to gpiochip_add_data()
Linus Walleij [Tue, 8 Dec 2015 15:02:00 +0000 (16:02 +0100)]
sh: x3proto-gpio: switch to gpiochip_add_data()

We're planning to remove the gpiochip_add() function to swith
to gpiochip_add_data() with NULL for data argument.

Cc: Paul Mundt <lethal@linux-sh.org>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agosh: sdk7786-gpio: switch to gpiochip_add_data()
Linus Walleij [Tue, 8 Dec 2015 14:58:33 +0000 (15:58 +0100)]
sh: sdk7786-gpio: switch to gpiochip_add_data()

We're planning to remove the gpiochip_add() function to swith
to gpiochip_add_data() with NULL for data argument.

Cc: Paul Mundt <lethal@linux-sh.org>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agopowerpc: simple-gpio: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 14:53:29 +0000 (15:53 +0100)]
powerpc: simple-gpio: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agopowerpc: qe_lib-gpio: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 14:49:10 +0000 (15:49 +0100)]
powerpc: qe_lib-gpio: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Anatolij Gustschin <agust@denx.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agopowerpc: ppc4xx: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 14:34:12 +0000 (15:34 +0100)]
powerpc: ppc4xx: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Anatolij Gustschin <agust@denx.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 years agopowerpc: cpm_common: use gpiochip data pointer
Linus Walleij [Tue, 8 Dec 2015 14:05:43 +0000 (15:05 +0100)]
powerpc: cpm_common: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Anatolij Gustschin <agust@denx.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>