regulator: gpio: Convert to use descriptors

This converts the GPIO regulator driver to use decriptors only.

We have to let go of the array gpio handling: the fetched descriptors
are handled individually anyway, and the array retrieveal function
does not make it possible to retrieve each GPIO descriptor with
unique flags. Instead get them one by one.

We request the "enable" GPIO separately as before, and make sure
that this line is requested as nonexclusive since enable lines can
be shared and the regulator core expects this.

Most users of the GPIO regulator are using device tree.

There are two boards in the kernel using the gpio regulator from a
non-devicetree path: PXA hx4700 and magician. Make sure to switch
these over to use descriptors as well.

Cc: Philipp Zabel <p.zabel@pengutronix.de> # Magician
Cc: Petr Cvek <petr.cvek@tul.cz> # Magician
Cc: Robert Jarzmik <robert.jarzmik@free.fr> # PXA
Cc: Paul Parsons <lost.distance@yahoo.com> # hx4700
Cc: Kevin Hilman <khilman@baylibre.com> # Meson
Cc: Neil Armstrong <narmstrong@baylibre.com> # Meson
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Linus Walleij
2019-01-29 11:31:52 +01:00
committed by Mark Brown
parent 4f297062b2
commit d6cd33ad71
4 changed files with 95 additions and 113 deletions

View File

@@ -21,6 +21,8 @@
#ifndef __REGULATOR_GPIO_H
#define __REGULATOR_GPIO_H
#include <linux/gpio/consumer.h>
struct regulator_init_data;
enum regulator_type;
@@ -53,9 +55,9 @@ struct gpio_regulator_state {
* This is used to keep the regulator at
* the default state
* @startup_delay: Start-up time in microseconds
* @gpios: Array containing the gpios needed to control
* the setting of the regulator
* @nr_gpios: Number of gpios
* @gflags: Array of GPIO configuration flags for initial
* states
* @ngpios: Number of GPIOs and configurations available
* @states: Array of gpio_regulator_state entries describing
* the gpio state for specific voltages
* @nr_states: Number of states available
@@ -74,8 +76,8 @@ struct gpio_regulator_config {
unsigned enabled_at_boot:1;
unsigned startup_delay;
struct gpio *gpios;
int nr_gpios;
enum gpiod_flags *gflags;
int ngpios;
struct gpio_regulator_state *states;
int nr_states;