]> asedeno.scripts.mit.edu Git - linux.git/log
linux.git
5 years agoMerge branch 'ib-array-bitmaps' into devel
Linus Walleij [Thu, 20 Sep 2018 15:36:36 +0000 (08:36 -0700)]
Merge branch 'ib-array-bitmaps' into devel

5 years agogpio: OF: Remove bad practice examples
Linus Walleij [Thu, 13 Sep 2018 07:44:21 +0000 (09:44 +0200)]
gpio: OF: Remove bad practice examples

We remove the references to anything but two-cell GPIO specifiers
and just mention that controllers need to specify their bindings
and that we strongly recommend two-cell bindings.

Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: OF: Cut painful BNF experiments from bindings
Linus Walleij [Thu, 13 Sep 2018 07:28:13 +0000 (09:28 +0200)]
gpio: OF: Cut painful BNF experiments from bindings

In 2011 the commit bf859f84a19f
("gpio/dt: Refine GPIO device tree binding") introduced an
experimental BNF notation for defining a regular grammar for
the GPIO phandles used by different devices.

This was an interesting approach, and shows that we have long
nutured the idea to formally verify device tree files using
regular grammar.

Most if not all other bindings use natural language to define
the bindings, and the recent thinking for verifying device
tree files is to use JSON schemas in separate definitions.

Cut the BNF business and replace it with natural language
so that it becomes more human-readable for now.

Cc: devicetree@vger.kernel.org
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Kumar Gala <galak@kernel.crashing.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: davinci: Move driver local definitions to driver
Andrew F. Davis [Fri, 31 Aug 2018 19:13:26 +0000 (14:13 -0500)]
gpio: davinci: Move driver local definitions to driver

These defines, structs and inline functions are used only internally by
the driver, they do not belong in platform_data. Move them.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Tested-by: Keerthy <j-keerthy@ti.com>
Acked-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: davinci: Remove unneeded GPIO macro
Andrew F. Davis [Fri, 31 Aug 2018 19:13:25 +0000 (14:13 -0500)]
gpio: davinci: Remove unneeded GPIO macro

This macro does nothing and has only one user, remove it.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Tested-by: Keerthy <j-keerthy@ti.com>
Acked-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: davinci: Allocate the correct amount of memory for controller
Andrew F. Davis [Fri, 31 Aug 2018 19:13:24 +0000 (14:13 -0500)]
gpio: davinci: Allocate the correct amount of memory for controller

Previously we created a controller structure per bank of GPIO pins. This
has since been changed to one per controller, but the allocation size
was not changed. Fix this here.

This also leaves the variable 'nbank' unused, instead of removing it,
move it down and use it to clean up a loop. For loops with multiple
initializers and/or iteration expressions, especially ones that don't
use those loop counters are quite hard to follow, fix this.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Tested-by: Keerthy <j-keerthy@ti.com>
Acked-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: davinci: Use dev name for label and automatic base selection
Andrew F. Davis [Fri, 31 Aug 2018 19:13:23 +0000 (14:13 -0500)]
gpio: davinci: Use dev name for label and automatic base selection

Use dev_name to get a unique label and use -1 for a base to get our
selection automatically. We pull in all GPIOs per chip now so this
does not have the effect of out of order labels like before.

We do these both together so we can drop all the static data in one
patch. This also lets us normalize the return paths as we don't need
any cleanup after this change.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Tested-by: Keerthy <j-keerthy@ti.com>
Acked-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: davinci: Remove unused member of davinci_gpio_controller
Andrew F. Davis [Fri, 31 Aug 2018 19:13:22 +0000 (14:13 -0500)]
gpio: davinci: Remove unused member of davinci_gpio_controller

This was added as part of the patch in the fixes below, but was
not needed or used, remove this here.

Fixes: 8e11047b8f3c ("gpio: davinci: Add support for multiple GPIO controllers")
Tested-by: Keerthy <j-keerthy@ti.com>
Acked-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: Get rid of legacy header
Linus Walleij [Thu, 13 Sep 2018 12:05:26 +0000 (14:05 +0200)]
gpio: Get rid of legacy header

A bunch of core gpiolib files still include the <linux/gpio.h>
legacy API header for no good reason. After this only the
gpiolib-legacy.c file includes it, which is fine.

The sysfs ABI code has a pointless wrapper function around
gpio_to_desc() we can just loose.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: wm8xxx: Cut down on boilerplate
Linus Walleij [Thu, 13 Sep 2018 11:28:13 +0000 (13:28 +0200)]
gpio: wm8xxx: Cut down on boilerplate

Just use the SPDX license tag for these drivers.

Cc: patches@opensource.cirrus.com
Cc: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Mark Brown <broonie@kernel.org>
Acked-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: wm8xxx: Use the right header
Linus Walleij [Thu, 13 Sep 2018 11:25:58 +0000 (13:25 +0200)]
gpio: wm8xxx: Use the right header

These are GPIO drivers so just include <linux/gpio/driver.h>.

Cc: patches@opensource.cirrus.com
Cc: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Mark Brown <broonie@kernel.org>
Acked-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: xlp: Cut down on boilerplate
Linus Walleij [Wed, 12 Sep 2018 12:32:07 +0000 (14:32 +0200)]
gpio: xlp: Cut down on boilerplate

Just use the SPDX license tag for this file.

Cc: Kamlakant Patel <kamlakant.patel@cavium.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: xlp: Include the right header
Linus Walleij [Wed, 12 Sep 2018 12:30:59 +0000 (14:30 +0200)]
gpio: xlp: Include the right header

This is a GPIO driver so include only <linux/gpio/driver.h>.

Cc: Kamlakant Patel <kamlakant.patel@cavium.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: vx855: Cut down on boilerplate
Linus Walleij [Wed, 12 Sep 2018 12:13:17 +0000 (14:13 +0200)]
gpio: vx855: Cut down on boilerplate

Just use the SPDX header for the license.

Cc: Daniel Drake <drake@endlessm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: vx855: Include the right header
Linus Walleij [Wed, 12 Sep 2018 12:11:59 +0000 (14:11 +0200)]
gpio: vx855: Include the right header

This is a GPIO driver so include only <linux/gpio/driver.h>.

Cc: Daniel Drake <drake@endlessm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: viperboard: Cut down on boilerplate
Linus Walleij [Wed, 12 Sep 2018 11:49:13 +0000 (13:49 +0200)]
gpio: viperboard: Cut down on boilerplate

Just use the SPDX header for the license.

Cc: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: viperboard: Include the right header
Linus Walleij [Wed, 12 Sep 2018 11:47:35 +0000 (13:47 +0200)]
gpio: viperboard: Include the right header

This is a GPIO driver so include only <linux/gpio/driver.h>.

Cc: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: xtensa: Cut down on boilerplate
Linus Walleij [Wed, 12 Sep 2018 11:36:08 +0000 (13:36 +0200)]
gpio: xtensa: Cut down on boilerplate

Just use the SPDX header for the license.

Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: xtensa: Include the right header
Linus Walleij [Wed, 12 Sep 2018 11:34:40 +0000 (13:34 +0200)]
gpio: xtensa: Include the right header

This is a GPIO driver so include only <linux/gpio/driver.h>.

Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: vr41xx: Delete vr41xx_gpio_pullupdown() callback
Linus Walleij [Wed, 12 Sep 2018 11:22:15 +0000 (13:22 +0200)]
gpio: vr41xx: Delete vr41xx_gpio_pullupdown() callback

This API is not used anywhere in the kernel and has remained
unused for years after being introduced.

Over time, we have developed a subsystem to deal with pin
control and this now managed pull up/down.

Delete the old and unused API. If this platform needs it,
we should implement a proper pin controller for it instead.

Cc: Yoichi Yuasa <yuasa@linux-mips.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Paul Burton <paul.burton@mips.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: vr41xx: Cut down on boilerplate
Linus Walleij [Wed, 12 Sep 2018 11:15:50 +0000 (13:15 +0200)]
gpio: vr41xx: Cut down on boilerplate

This switches this file to use the SPDX license tag.

Cc: Yoichi Yuasa <yuasa@linux-mips.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: vr41xx: Include the right header
Linus Walleij [Wed, 12 Sep 2018 11:14:33 +0000 (13:14 +0200)]
gpio: vr41xx: Include the right header

This is a GPIO driver so include only <linux/gpio/driver.h>.

Cc: Yoichi Yuasa <yuasa@linux-mips.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: check if irqchip already has the irq hook replacements
Hans Verkuil [Fri, 14 Sep 2018 08:36:39 +0000 (10:36 +0200)]
gpiolib: check if irqchip already has the irq hook replacements

Some drivers use a single irqchip for multiple gpiochips. As a result the
irqchip hooks are overridden for the first gpiochip that was added, but
for the other gpiochip instances this should not happen again, otherwise
we would go into an infinite recursion.

Check for this, but also log a message that the driver should be fixed
since this is bad practice.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: use better errno if get_direction is not available
Wolfram Sang [Wed, 11 Jul 2018 16:33:19 +0000 (18:33 +0200)]
gpiolib: use better errno if get_direction is not available

EINVAL is very generic, use ENOTSUPP in case the gpiochip does not
provide this function. While removing the assignment from the 'status'
variable, use better indentation in the declaration block.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: Implement fast processing path in get/set array
Janusz Krzysztofik [Wed, 5 Sep 2018 21:50:08 +0000 (23:50 +0200)]
gpiolib: Implement fast processing path in get/set array

Certain GPIO descriptor arrays returned by gpio_get_array() may contain
information on direct mapping of array members to pins of a single GPIO
chip in hardware order.  In such cases, bitmaps of values can be passed
directly from/to the chip's .get/set_multiple() callbacks without
wasting time on iterations.

Add respective code to gpiod_get/set_array_bitmap_complex() functions.
Pins not applicable for fast path are processed as before, skipping
over the 'fast' ones.

Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: Pass array info to get/set array functions
Janusz Krzysztofik [Wed, 5 Sep 2018 21:50:07 +0000 (23:50 +0200)]
gpiolib: Pass array info to get/set array functions

In order to make use of array info obtained from gpiod_get_array() and
speed up processing of arrays matching single GPIO chip layout, that
information must be passed to get/set array functions.  Extend the
functions' API with that additional parameter and update all users.
Pass NULL if a user builds an array itself from single GPIOs.

Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Peter Korsgaard <peter.korsgaard@barco.com>
Cc: Peter Rosin <peda@axentia.se>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Rojhalat Ibrahim <imr@rtschenk.de>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Yegor Yefremov <yegorslists@googlemail.com>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: Identify arrays matching GPIO hardware
Janusz Krzysztofik [Wed, 5 Sep 2018 21:50:06 +0000 (23:50 +0200)]
gpiolib: Identify arrays matching GPIO hardware

Certain GPIO array lookup results may map directly to GPIO pins of a
single GPIO chip in hardware order.  If that condition is recognized
and handled efficiently, significant performance gain of get/set array
functions may be possible.

While processing a request for an array of GPIO descriptors, identify
those which represent corresponding pins of a single GPIO chip.  Skip
over pins which require open source or open drain special processing.
Moreover, identify pins which require inversion.  Pass a pointer to
that information with the array to the caller so it can benefit from
enhanced performance as soon as get/set array functions can accept and
make efficient use of it.

Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: Pass bitmaps, not integer arrays, to get/set array
Janusz Krzysztofik [Wed, 5 Sep 2018 21:50:05 +0000 (23:50 +0200)]
gpiolib: Pass bitmaps, not integer arrays, to get/set array

Most users of get/set array functions iterate consecutive bits of data,
usually a single integer, while processing array of results obtained
from, or building an array of values to be passed to those functions.
Save time wasted on those iterations by changing the functions' API to
accept bitmaps.

All current users are updated as well.

More benefits from the change are expected as soon as planned support
for accepting/passing those bitmaps directly from/to respective GPIO
chip callbacks if applicable is implemented.

Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>
Cc: Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Peter Korsgaard <peter.korsgaard@barco.com>
Cc: Peter Rosin <peda@axentia.se>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Rojhalat Ibrahim <imr@rtschenk.de>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Yegor Yefremov <yegorslists@googlemail.com>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: Don't support irq sharing for userspace
Uwe Kleine-König [Mon, 20 Aug 2018 06:32:53 +0000 (08:32 +0200)]
gpiolib: Don't support irq sharing for userspace

This concerns gpio edge detection for GPIO IRQs used from
userspace for GPIO event listeners.

Trying to work out the right event if it's not sure that the
examined gpio actually moved is impossible.

Consider two gpios "gpioA" and "gpioB" that share an interrupt.
gpioA's irq should trigger on any edge, gpioB's on a falling edge.
If now the common irq fires and both gpio lines are high, there
are several possibilities that could have happend:

 a) gpioA just had a low-to-high edge
 b) gpioB just had a high-to-low-to-high spike
 c) a combination of both a) and b)

While c) is unlikely (in most setups) a) and b) alone are bad
enough. Currently the code assumes case a) unconditionally and
doesn't report an event for gpioB. Note that even if there is no
irq sharing involved a spike for a gpio might not result in an
event if it's configured to trigger for a single edge only.

The only way to improve this is to drop support for interrupt
sharing. This way a spike results in an event for the right gpio
at least. Note that apart from dropping IRQF_SHARED this
effectively undoes commit df1e76f28ffe
("gpiolib: skip unwanted events, don't convert them to opposite edge").

This obviously breaks setups that rely on interrupt sharing,
but given that this cannot be reliable, this is probably an
acceptable trade-off.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
[Assuming there are no users of interrupt sharing yet]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: uapi: Grammar s/array/array of/
Geert Uytterhoeven [Tue, 11 Sep 2018 14:32:43 +0000 (16:32 +0200)]
gpio: uapi: Grammar s/array/array of/

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: vf610: Cut down on boilerplate
Linus Walleij [Fri, 7 Sep 2018 20:04:50 +0000 (22:04 +0200)]
gpio: vf610: Cut down on boilerplate

Just use the SPDX identifier for the license.

Acked-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: vf610: Include the right header
Linus Walleij [Fri, 7 Sep 2018 20:03:07 +0000 (22:03 +0200)]
gpio: vf610: Include the right header

This is a GPIO driver so only include <linux/gpio/driver.h>.

Acked-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: of: make example syntactically correct
Wolfram Sang [Sun, 21 Jan 2018 12:12:43 +0000 (13:12 +0100)]
gpio: of: make example syntactically correct

The ';' was missing. And cosmetic: there was a space too much.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: of: Handle SPI chipselect legacy bindings
Linus Walleij [Tue, 4 Sep 2018 09:01:58 +0000 (11:01 +0200)]
gpio: of: Handle SPI chipselect legacy bindings

The SPI chipselects are assumed to be active low in the current
binding, so when we want to use GPIO descriptors and handle
the active low/high semantics in gpiolib, we need a special
parsing quirk to deal with this.

We check for the property "spi-cs-high" and if that is
NOT present we assume the CS line is active low.

If the line is tagged as active low in the device tree and
has no "spi-cs-high" property all is fine, the device
tree and the SPI bindings are in agreement.

If the line is tagged as active high in the device tree with
the second cell flag and has no "spi-cs-high" property we
enforce active low semantics (as this is the exception we can
just tag on the flag).

If the line is tagged as active low with the second cell flag
AND tagged with "spi-cs-high" the SPI active high property
takes precedence and we print a warning.

Cc: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio-bcm-kona: use new req/relres and dis/enable_irq funcs
Hans Verkuil [Sat, 8 Sep 2018 09:23:19 +0000 (11:23 +0200)]
gpio-bcm-kona: use new req/relres and dis/enable_irq funcs

Since this driver does not use the gpiolib irqchip helpers it will have to
allocate the irq resources and irq_en/disable itself.

Use the new gpiochip_req/relres_irq helpers to request/release all the
resources.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Ray Jui <rjui@broadcom.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio/driver.rst: document gpiochip_disable/enable_irq()
Hans Verkuil [Sat, 8 Sep 2018 09:23:18 +0000 (11:23 +0200)]
gpio/driver.rst: document gpiochip_disable/enable_irq()

Document these new functions.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: override irq_enable/disable
Hans Verkuil [Sat, 8 Sep 2018 09:23:17 +0000 (11:23 +0200)]
gpiolib: override irq_enable/disable

When using the gpiolib irqchip helpers install irq_enable/disable
hooks for the irqchip to ensure that gpiolib knows when the irq
is enabled or disabled, allowing drivers to disable the irq and then
use it as an output pin, and later switch the direction to input and
re-enable the irq.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: add flag to indicate if the irq is disabled
Hans Verkuil [Sat, 8 Sep 2018 09:23:16 +0000 (11:23 +0200)]
gpiolib: add flag to indicate if the irq is disabled

GPIO drivers call gpiochip_(un)lock_as_irq whenever they want to use a gpio
as an interrupt. This is done when the irq is requested and it marks the
gpio as in use by an interrupt.

This is problematic for cases where a gpio pin is used as an interrupt
pin, then, after the irq is disabled, is used as a regular gpio pin.
Currently it is not possible to do this other than by first freeing
the interrupt so gpiochip_unlock_as_irq is called, since an attempt to
switch the gpio direction for output will fail since gpiolib believes
that the gpio is in use for an interrupt and it does not know that it
the irq is actually disabled.

There are currently two drivers that would like to be able to do this:
the tda998x_drv.c driver where a regular gpio pin needs to be temporarily
reconfigured as an interrupt pin during CEC calibration, and the cec-gpio
driver where you want to configure the gpio pin as an interrupt while
waiting for traffic over the CEC bus, or as a regular pin when receiving or
transmitting a CEC message.

The solution is to add a new flag that is set when the irq is enabled,
and have gpiod_direction_output check for that flag.

We also add functions that drivers that do not use GPIOLIB_IRQCHIP
can call when they enable/disable the irq.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogliolib: set hooks in gpiochip_set_irq_hooks()
Hans Verkuil [Sat, 8 Sep 2018 09:23:15 +0000 (11:23 +0200)]
gliolib: set hooks in gpiochip_set_irq_hooks()

Centralize setting the irq_request/release_resources callbacks
in one function since we'll be adding more callbacks to that.

Also fix the removal of the callback overrides: this should
only be done if we actually installed our own callback there.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpiolib: export gpiochip_irq_reqres/relres()
Hans Verkuil [Sat, 8 Sep 2018 09:23:14 +0000 (11:23 +0200)]
gpiolib: export gpiochip_irq_reqres/relres()

GPIO drivers that do not use GPIOLIB_IRQCHIP can hook these into
the irq_request_resource and irq_release_resource callbacks of the
irq_chip so they correctly 'get' the module and lock the gpio line
for IRQ use.

This will simplify driver code.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: fix test for end of loop
Dan Carpenter [Thu, 6 Sep 2018 13:33:48 +0000 (16:33 +0300)]
gpio: ep93xx: fix test for end of loop

The problem is that if port == ARRAY_SIZE() and "gc == &epg->gc[port]"
then that should be treated as invalid.

Fixes: fd935fc421e7 ("gpio: ep93xx: Do not pingpong irq numbers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: fix incorrect array element size check
Colin Ian King [Thu, 6 Sep 2018 11:58:30 +0000 (12:58 +0100)]
gpio: ep93xx: fix incorrect array element size check

Currently the while loop checks for the end of the array using
the size of egp->gc rather that the number of elements in the array,
so fix this. Also, perform the array size check first as stylistically
it is always good to bounds check on an array first before referencing
the array (in this case, we're just computing the address of an
element in an array so this is a moot point).

Fixes: fd935fc421e7 ("gpio: ep93xx: Do not pingpong irq numbers")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: fix kernel-doc notation warning for 'request_key'
Randy Dunlap [Mon, 3 Sep 2018 19:55:30 +0000 (12:55 -0700)]
gpio: fix kernel-doc notation warning for 'request_key'

Fix kernel-doc warning for missing struct member 'request_key':

../include/linux/gpio/driver.h:142: warning: Function parameter or member 'request_key' not described in 'gpio_irq_chip'

Fixes: 39c3fd58952d ("kernel/irq: Extend lockdep class for request mutex")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: twl6040: Implement .get_direction()
Linus Walleij [Mon, 3 Sep 2018 08:04:01 +0000 (10:04 +0200)]
gpio: twl6040: Implement .get_direction()

The gpiolib cannot deduce the fact that every line is output
by itself, implement a .get_direction() callback so we can
inspect this.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: twl6040: Use bitops
Linus Walleij [Mon, 3 Sep 2018 07:59:57 +0000 (09:59 +0200)]
gpio: twl6040: Use bitops

It's nice to use BIT() macros rather than open coding the same.
It's good practice as sometimes people use BIT(31) and forget
that the constant must be cast unsigned long.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: twl6040: Cut down boilerplate
Linus Walleij [Mon, 3 Sep 2018 07:55:50 +0000 (09:55 +0200)]
gpio: twl6040: Cut down boilerplate

Use the SPDX header to indicate the license for this driver.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: twl6040: Include the right header
Linus Walleij [Mon, 3 Sep 2018 07:54:55 +0000 (09:54 +0200)]
gpio: twl6040: Include the right header

This is a GPIO driver so include only <linux/gpio/driver.h>.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: twl4030: Implement .get_direction()
Linus Walleij [Mon, 3 Sep 2018 07:52:10 +0000 (09:52 +0200)]
gpio: twl4030: Implement .get_direction()

It's nice to be able to read back the direction of the GPIO
line from the hardware so implement .get_direction() for
twl4030.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: twl4030: Cut down boilerplate
Linus Walleij [Mon, 3 Sep 2018 06:20:59 +0000 (08:20 +0200)]
gpio: twl4030: Cut down boilerplate

Use the SPDX header to indicate the license for this driver.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: twl4030: Include the right header
Linus Walleij [Mon, 3 Sep 2018 06:15:50 +0000 (08:15 +0200)]
gpio: twl4030: Include the right header

This is a GPIO driver so include only <linux/gpio/driver.h>.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: zevio: Include the right header
Linus Walleij [Sun, 2 Sep 2018 22:18:51 +0000 (00:18 +0200)]
gpio: zevio: Include the right header

This is a driver so include only <linux/gpio/driver.h>.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ts5500: Delete platform data handling
Linus Walleij [Wed, 29 Aug 2018 15:16:18 +0000 (17:16 +0200)]
gpio: ts5500: Delete platform data handling

The TS5500 GPIO driver apparently supports platform data
without making any use of it whatsoever. Delete this code,
last chance to speak up if you think it is needed.

Cc: kernel@savoirfairelinux.com
Cc: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: Jerome Oufella <jerome.oufella@savoirfairelinux.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ts5500: Use SPDX header
Linus Walleij [Wed, 29 Aug 2018 15:08:53 +0000 (17:08 +0200)]
gpio: ts5500: Use SPDX header

Cut some boilerplate, use the SPDX license identifier.

Cc: kernel@savoirfairelinux.com
Cc: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: Jerome Oufella <jerome.oufella@savoirfairelinux.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ts5500: Include the right header
Linus Walleij [Wed, 29 Aug 2018 15:07:29 +0000 (17:07 +0200)]
gpio: ts5500: Include the right header

This is a GPIO driver so include only <linux/gpio/driver.h>.

Cc: kernel@savoirfairelinux.com
Cc: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: Jerome Oufella <jerome.oufella@savoirfairelinux.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: mxs: Get rid of external API call
Linus Walleij [Wed, 29 Aug 2018 15:02:16 +0000 (17:02 +0200)]
gpio: mxs: Get rid of external API call

The MXS driver was calling back into the GPIO API from
its irqchip. This is not very elegant, as we are a driver,
let's just shortcut back into the gpio_chip .get() function
instead.

This is a tricky case since the .get() callback is not in
this file, instead assigned by bgpio_init(). Calling the
function direcly in the gpio_chip is however the lesser
evil.

Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Janusz Uzycki <j.uzycki@elproma.com.pl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: tps65xxx: Use SPDX license tag
Linus Walleij [Wed, 29 Aug 2018 14:49:14 +0000 (16:49 +0200)]
gpio: tps65xxx: Use SPDX license tag

I'm tired of boilerplate, use the SPDX tag.

Acked-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: tpx65xxx: Include the right header
Linus Walleij [Wed, 29 Aug 2018 14:45:30 +0000 (16:45 +0200)]
gpio: tpx65xxx: Include the right header

These are drivers so include only <linux/gpio/driver.h>.

Acked-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoMAINTAINERS: Add myself as designated reviewer of Intel PMIC GPIO
Andy Shevchenko [Thu, 30 Aug 2018 16:49:35 +0000 (19:49 +0300)]
MAINTAINERS: Add myself as designated reviewer of Intel PMIC GPIO

There are few Intel PMIC GPIO device drivers which I would like
to review.

Note, Intel MSIC is old system controller that based mostly on PMIC
integrated in it. Thus, I included it as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: brcmstb: allow 0 width GPIO banks
Justin Chen [Fri, 17 Aug 2018 23:47:39 +0000 (16:47 -0700)]
gpio: brcmstb: allow 0 width GPIO banks

Sometimes we have empty banks within the GPIO block. This commit allows
proper handling of 0 width GPIO banks. We handle 0 width GPIO banks by
incrementing the bank and number of GPIOs, but not initializing them.
This will mean a call into the non-existent GPIOs will return an error.

Also remove "GPIO registered" dev print. This information is misleading
since the incremented banks and gpio_base do not reflect the actual GPIOs
that get initialized. We leave this information out since it is already
printed with dev_dbg.

Signed-off-by: Justin Chen <justinpopo6@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ftgpio: Support debounce timer
Linus Walleij [Mon, 27 Aug 2018 20:15:51 +0000 (22:15 +0200)]
gpio: ftgpio: Support debounce timer

The FTGPIO010 has a debounce timer or rather prescaler that
will affect interrupts fireing off the block. We can support
this to get proper debounce on e.g. keypresses.

Since the same prescaler is used across all GPIO lines of
the silicon block, we need to bail out if the prescaler is
already set and in use by another line.

If the prescaler is already set to what we need, fine, we
reuse it. This happens more often than not when the same
debounce time is set for several GPIO keys, so we support
that usecase easily with this code.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ftgpio: Support optional silicon clock
Linus Walleij [Mon, 27 Aug 2018 20:15:40 +0000 (22:15 +0200)]
gpio: ftgpio: Support optional silicon clock

The GPIO silicon is clocked with a PCLK (peripheral clock)
on all systems, however not all platforms model it and include
it in e.g. the device tree, so add clock handling but make it
optional so we bail out safely if it is e.g. always on.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoMerge branch 'ib-ingenic' of ../linux-pinctrl into devel
Linus Walleij [Wed, 29 Aug 2018 12:10:57 +0000 (14:10 +0200)]
Merge branch 'ib-ingenic' of ../linux-pinctrl into devel

5 years agogpio: Convert to using %pOFn instead of device_node.name
Rob Herring [Tue, 28 Aug 2018 01:52:19 +0000 (20:52 -0500)]
gpio: Convert to using %pOFn instead of device_node.name

In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: pxa: handle corner case of unprobed device
Robert Jarzmik [Sat, 25 Aug 2018 08:44:17 +0000 (10:44 +0200)]
gpio: pxa: handle corner case of unprobed device

In the corner case where the gpio driver probe fails, for whatever
reason, the suspend and resume handlers will still be called as they
have to be registered as syscore operations. This applies as well when
no probe was called while the driver has been built in the kernel.

Nicolas tracked this in :
https://bugzilla.kernel.org/show_bug.cgi?id=200905

Therefore, add a failsafe in these function, and test if a proper probe
succeeded and the driver is functional.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Reported-by: Nicolas Chauvet <kwizart@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodt-bindings: gpio: rcar: Add r8a774a1 (RZ/G2M) support
Fabrizio Castro [Tue, 14 Aug 2018 12:32:37 +0000 (13:32 +0100)]
dt-bindings: gpio: rcar: Add r8a774a1 (RZ/G2M) support

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

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Include the right header
Linus Walleij [Wed, 29 Aug 2018 11:39:54 +0000 (13:39 +0200)]
pinctrl: ingenic: Include the right header

This is a GPIO driver so only include <linux/gpio/driver.h>

Cc: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ingenic: Remove driver
Paul Cercueil [Tue, 21 Aug 2018 16:42:36 +0000 (18:42 +0200)]
gpio: ingenic: Remove driver

The pinctrl-ingenic driver is now handling the GPIO chips directly.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Drop dependency on MACH_INGENIC
Paul Cercueil [Tue, 21 Aug 2018 16:42:35 +0000 (18:42 +0200)]
pinctrl: ingenic: Drop dependency on MACH_INGENIC

Depending on MACH_INGENIC prevent us from creating a generic kernel that
works on more than one MIPS board. Instead, we just depend on MIPS being
set.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Add support for the JZ4725B
Paul Cercueil [Tue, 21 Aug 2018 16:42:34 +0000 (18:42 +0200)]
pinctrl: ingenic: Add support for the JZ4725B

Add support for the JZ4725B and compatible SoCs from Ingenic.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Implement .get_direction for GPIO chips
Paul Cercueil [Tue, 21 Aug 2018 16:42:33 +0000 (18:42 +0200)]
pinctrl: ingenic: Implement .get_direction for GPIO chips

This allows to read from debugfs whether the GPIOs requested are set as
input or output.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Merge GPIO functionality
Paul Cercueil [Tue, 21 Aug 2018 16:42:32 +0000 (18:42 +0200)]
pinctrl: ingenic: Merge GPIO functionality

Merge the code of the gpio-ingenic driver into the pinctrl-ingenic
driver.

The reason behind this, is that the same hardware block handles both pin
config / muxing and GPIO.

ingenic_gpio_probe() have been marked as __init, but for the most part,
the code is the exact same as what it was in the gpio-ingenic driver.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Mark probe function as __init
Paul Cercueil [Tue, 21 Aug 2018 16:42:31 +0000 (18:42 +0200)]
pinctrl: ingenic: Mark probe function as __init

By using platform_driver_probe() instead of platform_driver_register(),
we can mark the ingenic_pinctrl_probe() function as __init.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Probe driver at subsys_initcall
Paul Cercueil [Tue, 21 Aug 2018 16:42:30 +0000 (18:42 +0200)]
pinctrl: ingenic: Probe driver at subsys_initcall

Using postcore_initcall() makes the driver try to initialize way too
early.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodt-bindings: pinctrl: Update pinctrl-ingenic for JZ4725B and GPIO merge
Paul Cercueil [Tue, 21 Aug 2018 16:42:29 +0000 (18:42 +0200)]
dt-bindings: pinctrl: Update pinctrl-ingenic for JZ4725B and GPIO merge

The pinctrl-ingenic driver now supports the JZ4725B SoC.

Furthermore, the gpio-ingenic driver was dropped and the pinctrl-ingenic
driver is now responsible for providing the GPIO functionality.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodrivers: gpio: Update MODULE AUTHOR email address
Michael Hennerich [Tue, 14 Aug 2018 11:29:18 +0000 (13:29 +0200)]
drivers: gpio: Update MODULE AUTHOR email address

no functional changes

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodt-bindings: gpio: rcar: Add gpio-reserved-ranges support
Biju Das [Tue, 7 Aug 2018 07:57:03 +0000 (08:57 +0100)]
dt-bindings: gpio: rcar: Add gpio-reserved-ranges support

Update the DT bindings documentation with the optional gpio-reserved-ranges
properties.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: rcar: Add GPIO hole support
Biju Das [Tue, 7 Aug 2018 07:57:02 +0000 (08:57 +0100)]
gpio: rcar: Add GPIO hole support

GPIO hole is present in RZ/G1C SoC. Valid GPIO pins on bank3 are in the
range GP3_0 to GP3_16 and GP3_27 to GP3_29. The GPIO pins between GP3_17
to GP3_26 are unused. Add support for handling unused GPIO's.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: Switch A and B to use GPIOLIB_IRQCHIP
Linus Walleij [Wed, 22 Aug 2018 20:41:11 +0000 (22:41 +0200)]
gpio: ep93xx: Switch A and B to use GPIOLIB_IRQCHIP

We can quite easily switch banks/ports A and B to use
GPIOLIB_IRQCHIP which is code that will be more careful
about handling interrupt descriptors and use a proper
irqdomain for translating the IRQs. This cuts down some
code in favor of using the implementation inside
gpiolib.

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: Cut gpio_to_irq() usage
Linus Walleij [Wed, 22 Aug 2018 20:41:10 +0000 (22:41 +0200)]
gpio: ep93xx: Cut gpio_to_irq() usage

This removes the callback into the gpiolib creating a
circular call to convert between GPIO numbers and IRQs
and pushes the whole business into the driver, just
using an array of IRQ bases for the three IRQ capable
ports.

This way we get rid of including <linux/gpio.h> that
no driver should include.

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: Use for_each_set_bit() in IRQ handler
Linus Walleij [Wed, 22 Aug 2018 20:41:09 +0000 (22:41 +0200)]
gpio: ep93xx: 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.

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: Use the hwirq and port
Linus Walleij [Wed, 22 Aug 2018 20:41:08 +0000 (22:41 +0200)]
gpio: ep93xx: Use the hwirq and port

In the IRQ-related functions, switch to using the hwirq
and port number found from the current struct gpio_chip *

As the lower 3 bits of the IRQ number is identical to the
lower 3 bits of the GPIO number we can cut some corners.

Call directly into the gpiochip to set up the direction
and read the input instead of using the consumer API.

This enabled us to cut the confusing irq_to_gpio() macro
that is a remnant of the old generic GPIO API as well.

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: Do not pingpong irq numbers
Linus Walleij [Wed, 22 Aug 2018 20:41:07 +0000 (22:41 +0200)]
gpio: ep93xx: Do not pingpong irq numbers

For setting debounce config we want to write an offset in
a per-gpiochip register, and we know which gpiochip we are
on. Instead of a roundtrip over the IRQ number, figure out
what port we are on for this GPIO chip, then index to the
right register and write the value.

This adds the ep93xx_gpio_port() that finds the port index
from a struct gpio_chip * that we can later exploit to
simplify more code.

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: Properly call the chained IRQ handler
Linus Walleij [Wed, 22 Aug 2018 20:41:06 +0000 (22:41 +0200)]
gpio: ep93xx: Properly call the chained IRQ handler

The chained irq handler should call chained_irq_enter()
and chained_irq_exit() before/after handling the chained
IRQ.

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: Rename has_debounce to has_irq
Linus Walleij [Wed, 22 Aug 2018 20:41:05 +0000 (22:41 +0200)]
gpio: ep93xx: Rename has_debounce to has_irq

This is closer to what the variable (per bank) actually
means. We have the .gpio_to_irq() hook registered only
when this is true.

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: Pass around struct gpio_chip
Linus Walleij [Wed, 22 Aug 2018 20:41:04 +0000 (22:41 +0200)]
gpio: ep93xx: Pass around struct gpio_chip

Instead of using a global variable, pass around the
struct gpio_chip * pointer and dereference to the state
container struct ep93xx_gpio as needed, like all other
drivers do.

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: Switch to SPDX license tag
Linus Walleij [Wed, 22 Aug 2018 20:41:03 +0000 (22:41 +0200)]
gpio: ep93xx: Switch to SPDX license tag

The subject says it all. Cut down on boilerplate.

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ep93xx: Cut down variable names
Linus Walleij [Wed, 22 Aug 2018 20:41:02 +0000 (22:41 +0200)]
gpio: ep93xx: Cut down variable names

In order to clean up the driver I need to cut a few trees,
sorry, variable names, so I can see the forest, sorry driver
properly.

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoARM/gpio: ep93xx: build standalone
Arnd Bergmann [Wed, 22 Aug 2018 20:41:01 +0000 (22:41 +0200)]
ARM/gpio: ep93xx: build standalone

As a preparation for multiplatform support, this ensures
that the ep93xx gpio driver can be built without any of
the platform specific header files. We pass the IRQ numbers
as a resource now, and use the virtual mmio base from the
already existing resource, rather than relying on the
hardwired virtual address from the header file.

Some numbers are now hardcoded that came from macros
in the past, but for all I can tell, the driver already
relied on the specific values.

Cc: arm@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Olof Johansson <olof@lixom.net>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: tb10x: Use GENERIC_GPIO
Linus Walleij [Mon, 6 Aug 2018 14:59:42 +0000 (16:59 +0200)]
gpio: tb10x: Use GENERIC_GPIO

Instead of open coding logic for reading and writing GPIO lines,
use the generic GPIO library. Also switch to using the spinlock
from the generic GPIO to protect the registers.

Cc: linux-snps-arc@lists.infradead.org
Acked-by: Christian Ruppert <christian.ruppert@alitech.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: tb10x: Create local helper variables
Linus Walleij [Mon, 6 Aug 2018 14:30:12 +0000 (16:30 +0200)]
gpio: tb10x: Create local helper variables

Create a local struct device *dev helper variable to make the code
easier to read.

Most GPIO drivers use "np" (node pointer) rather than "dn" (device node)
to point to the device tree node. Let's follow this convention.

Cc: linux-snps-arc@lists.infradead.org
Acked-by: Christian Ruppert <christian.ruppert@alitech.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoLinux 4.19-rc1 v4.19-rc1
Linus Torvalds [Sun, 26 Aug 2018 21:11:59 +0000 (14:11 -0700)]
Linux 4.19-rc1

5 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 26 Aug 2018 20:39:05 +0000 (13:39 -0700)]
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer update from Thomas Gleixner:
 "New defines for the compat time* types so they can be shared between
  32bit and 64bit builds. Not used yet, but merging them now allows the
  actual conversions to be merged through different maintainer trees
  without dependencies

  We still have compat interfaces for 32bit on 64bit even with the new
  2038 safe timespec/val variants because pointer size is different. And
  for the old style timespec/val interfaces we need yet another 'compat'
  interface for both 32bit native and 32bit on 64bit"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  y2038: Provide aliases for compat helpers

5 years agoMerge branch 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax
Linus Torvalds [Sun, 26 Aug 2018 18:48:42 +0000 (11:48 -0700)]
Merge branch 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax

Pull IDA updates from Matthew Wilcox:
 "A better IDA API:

      id = ida_alloc(ida, GFP_xxx);
      ida_free(ida, id);

  rather than the cumbersome ida_simple_get(), ida_simple_remove().

  The new IDA API is similar to ida_simple_get() but better named.  The
  internal restructuring of the IDA code removes the bitmap
  preallocation nonsense.

  I hope the net -200 lines of code is convincing"

* 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax: (29 commits)
  ida: Change ida_get_new_above to return the id
  ida: Remove old API
  test_ida: check_ida_destroy and check_ida_alloc
  test_ida: Convert check_ida_conv to new API
  test_ida: Move ida_check_max
  test_ida: Move ida_check_leaf
  idr-test: Convert ida_check_nomem to new API
  ida: Start new test_ida module
  target/iscsi: Allocate session IDs from an IDA
  iscsi target: fix session creation failure handling
  drm/vmwgfx: Convert to new IDA API
  dmaengine: Convert to new IDA API
  ppc: Convert vas ID allocation to new IDA API
  media: Convert entity ID allocation to new IDA API
  ppc: Convert mmu context allocation to new IDA API
  Convert net_namespace to new IDA API
  cb710: Convert to new IDA API
  rsxx: Convert to new IDA API
  osd: Convert to new IDA API
  sd: Convert to new IDA API
  ...

5 years agoMerge tag 'gcc-plugins-v4.19-rc1-fix' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 26 Aug 2018 18:41:08 +0000 (11:41 -0700)]
Merge tag 'gcc-plugins-v4.19-rc1-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Pull gcc plugin fix from Kees Cook:
 "Lift gcc test into Kconfig. This is for better behavior when the
  kernel is built with Clang, reported by Stefan Agner"

* tag 'gcc-plugins-v4.19-rc1-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  gcc-plugins: Disable when building under Clang

5 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 26 Aug 2018 18:25:21 +0000 (11:25 -0700)]
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf updates from Thomas Gleixner:
 "Kernel:
   - Improve kallsyms coverage
   - Add x86 entry trampolines to kcore
   - Fix ARM SPE handling
   - Correct PPC event post processing

  Tools:
   - Make the build system more robust
   - Small fixes and enhancements all over the place
   - Update kernel ABI header copies
   - Preparatory work for converting libtraceevnt to a shared library
   - License cleanups"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (100 commits)
  tools arch: Update arch/x86/lib/memcpy_64.S copy used in 'perf bench mem memcpy'
  tools arch x86: Update tools's copy of cpufeatures.h
  perf python: Fix pyrf_evlist__read_on_cpu() interface
  perf mmap: Store real cpu number in 'struct perf_mmap'
  perf tools: Remove ext from struct kmod_path
  perf tools: Add gzip_is_compressed function
  perf tools: Add lzma_is_compressed function
  perf tools: Add is_compressed callback to compressions array
  perf tools: Move the temp file processing into decompress_kmodule
  perf tools: Use compression id in decompress_kmodule()
  perf tools: Store compression id into struct dso
  perf tools: Add compression id into 'struct kmod_path'
  perf tools: Make is_supported_compression() static
  perf tools: Make decompress_to_file() function static
  perf tools: Get rid of dso__needs_decompress() call in __open_dso()
  perf tools: Get rid of dso__needs_decompress() call in symbol__disassemble()
  perf tools: Get rid of dso__needs_decompress() call in read_object_code()
  tools lib traceevent: Change to SPDX License format
  perf llvm: Allow passing options to llc in addition to clang
  perf parser: Improve error message for PMU address filters
  ...

5 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 26 Aug 2018 17:13:21 +0000 (10:13 -0700)]
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:

 - Correct the L1TF fallout on 32bit and the off by one in the 'too much
   RAM for protection' calculation.

 - Add a helpful kernel message for the 'too much RAM' case

 - Unbreak the VDSO in case that the compiler desides to use indirect
   jumps/calls and emits retpolines which cannot be resolved because the
   kernel uses its own thunks, which does not work for the VDSO. Make it
   use the builtin thunks.

 - Re-export start_thread() which was unexported when the 32/64bit
   implementation was unified. start_thread() is required by modular
   binfmt handlers.

 - Trivial cleanups

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/speculation/l1tf: Suggest what to do on systems with too much RAM
  x86/speculation/l1tf: Fix off-by-one error when warning that system has too much RAM
  x86/kvm/vmx: Remove duplicate l1d flush definitions
  x86/speculation/l1tf: Fix overflow in l1tf_pfn_limit() on 32bit
  x86/process: Re-export start_thread()
  x86/mce: Add notifier_block forward declaration
  x86/vdso: Fix vDSO build if a retpoline is emitted

5 years agoMerge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 26 Aug 2018 16:55:28 +0000 (09:55 -0700)]
Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq update from Thomas Gleixner:
 "A small set of updats/fixes for the irq subsystem:

   - Allow GICv3 interrupts to be configured as wake-up sources to
     enable wakeup from suspend

   - Make the error handling of the STM32 irqchip init function work

   - A set of small cleanups and improvements"

* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip/gic-v3: Allow interrupt to be configured as wake-up sources
  irqchip/tango: Set irq handler and data in one go
  dt-bindings: irqchip: renesas-irqc: Document r8a774a1 support
  irqchip/s3c24xx: Remove unneeded comparison of unsigned long to 0
  irqchip/stm32: Fix init error handling
  irqchip/bcm7038-l1: Hide cpu offline callback when building for !SMP

5 years agoMerge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 26 Aug 2018 16:47:00 +0000 (09:47 -0700)]
Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull licking update from Thomas Gleixner:
 "Mark the switch cases which fall through to the next case with the
  proper comment so the fallthrough compiler checks can be enabled"

* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  futex: Mark expected switch fall-throughs

5 years agoMerge tag 'libnvdimm-for-4.19_dax-memory-failure' of gitolite.kernel.org:pub/scm...
Linus Torvalds [Sun, 26 Aug 2018 01:43:59 +0000 (18:43 -0700)]
Merge tag 'libnvdimm-for-4.19_dax-memory-failure' of gitolite.kernel.org:pub/scm/linux/kernel/git/nvdimm/nvdimm

Pull libnvdimm memory-failure update from Dave Jiang:
 "As it stands, memory_failure() gets thoroughly confused by dev_pagemap
  backed mappings. The recovery code has specific enabling for several
  possible page states and needs new enabling to handle poison in dax
  mappings.

  In order to support reliable reverse mapping of user space addresses:

   1/ Add new locking in the memory_failure() rmap path to prevent races
      that would typically be handled by the page lock.

   2/ Since dev_pagemap pages are hidden from the page allocator and the
      "compound page" accounting machinery, add a mechanism to determine
      the size of the mapping that encompasses a given poisoned pfn.

   3/ Given pmem errors can be repaired, change the speculatively
      accessed poison protection, mce_unmap_kpfn(), to be reversible and
      otherwise allow ongoing access from the kernel.

  A side effect of this enabling is that MADV_HWPOISON becomes usable
  for dax mappings, however the primary motivation is to allow the
  system to survive userspace consumption of hardware-poison via dax.
  Specifically the current behavior is:

     mce: Uncorrected hardware memory error in user-access at af34214200
     {1}[Hardware Error]: It has been corrected by h/w and requires no further action
     mce: [Hardware Error]: Machine check events logged
     {1}[Hardware Error]: event severity: corrected
     Memory failure: 0xaf34214: reserved kernel page still referenced by 1 users
     [..]
     Memory failure: 0xaf34214: recovery action for reserved kernel page: Failed
     mce: Memory error not recovered
     <reboot>

  ...and with these changes:

     Injecting memory failure for pfn 0x20cb00 at process virtual address 0x7f763dd00000
     Memory failure: 0x20cb00: Killing dax-pmd:5421 due to hardware memory corruption
     Memory failure: 0x20cb00: recovery action for dax page: Recovered

  Given all the cross dependencies I propose taking this through
  nvdimm.git with acks from Naoya, x86/core, x86/RAS, and of course dax
  folks"

* tag 'libnvdimm-for-4.19_dax-memory-failure' of gitolite.kernel.org:pub/scm/linux/kernel/git/nvdimm/nvdimm:
  libnvdimm, pmem: Restore page attributes when clearing errors
  x86/memory_failure: Introduce {set, clear}_mce_nospec()
  x86/mm/pat: Prepare {reserve, free}_memtype() for "decoy" addresses
  mm, memory_failure: Teach memory_failure() about dev_pagemap pages
  filesystem-dax: Introduce dax_lock_mapping_entry()
  mm, memory_failure: Collect mapping size in collect_procs()
  mm, madvise_inject_error: Let memory_failure() optionally take a page reference
  mm, dev_pagemap: Do not clear ->mapping on final put
  mm, madvise_inject_error: Disable MADV_SOFT_OFFLINE for ZONE_DEVICE pages
  filesystem-dax: Set page->index
  device-dax: Set page->index
  device-dax: Enable page_mapping()
  device-dax: Convert to vmf_insert_mixed and vm_fault_t

5 years agoMerge tag 'libnvdimm-for-4.19_misc' of gitolite.kernel.org:pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 26 Aug 2018 01:13:10 +0000 (18:13 -0700)]
Merge tag 'libnvdimm-for-4.19_misc' of gitolite.kernel.org:pub/scm/linux/kernel/git/nvdimm/nvdimm

Pull libnvdimm updates from Dave Jiang:
 "Collection of misc libnvdimm patches for 4.19 submission:

   - Adding support to read locked nvdimm capacity.

   - Change test code to make DSM failure code injection an override.

   - Add support for calculate maximum contiguous area for namespace.

   - Add support for queueing a short ARS when there is on going ARS for
     nvdimm.

   - Allow NULL to be passed in to ->direct_access() for kaddr and pfn
     params.

   - Improve smart injection support for nvdimm emulation testing.

   - Fix test code that supports for emulating controller temperature.

   - Fix hang on error before devm_memremap_pages()

   - Fix a bug that causes user memory corruption when data returned to
     user for ars_status.

   - Maintainer updates for Ross Zwisler emails and adding Jan Kara to
     fsdax"

* tag 'libnvdimm-for-4.19_misc' of gitolite.kernel.org:pub/scm/linux/kernel/git/nvdimm/nvdimm:
  libnvdimm: fix ars_status output length calculation
  device-dax: avoid hang on error before devm_memremap_pages()
  tools/testing/nvdimm: improve emulation of smart injection
  filesystem-dax: Do not request kaddr and pfn when not required
  md/dm-writecache: Don't request pointer dummy_addr when not required
  dax/super: Do not request a pointer kaddr when not required
  tools/testing/nvdimm: kaddr and pfn can be NULL to ->direct_access()
  s390, dcssblk: kaddr and pfn can be NULL to ->direct_access()
  libnvdimm, pmem: kaddr and pfn can be NULL to ->direct_access()
  acpi/nfit: queue issuing of ars when an uc error notification comes in
  libnvdimm: Export max available extent
  libnvdimm: Use max contiguous area for namespace size
  MAINTAINERS: Add Jan Kara for filesystem DAX
  MAINTAINERS: update Ross Zwisler's email address
  tools/testing/nvdimm: Fix support for emulating controller temperature
  tools/testing/nvdimm: Make DSM failure code injection an override
  acpi, nfit: Prefer _DSM over _LSR for namespace label reads
  libnvdimm: Introduce locked DIMM capacity support