pinctrl / gpio: Introduce .set_config() callback for GPIO chips
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 23 Jan 2017 12:34:34 +0000 (15:34 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 26 Jan 2017 14:27:37 +0000 (15:27 +0100)
commit2956b5d94a76b596fa5057c2b3ca915cb27d7652
tree3a1dbce1201ef4923a4124f63eb209026e8fba7e
parent15381bc7c7f52d56f87c56dd7c948ad78704b852
pinctrl / gpio: Introduce .set_config() callback for GPIO chips

Currently we already have two pin configuration related callbacks
available for GPIO chips .set_single_ended() and .set_debounce(). In
future we expect to have even more, which does not scale well if we need
to add yet another callback to the GPIO chip structure for each possible
configuration parameter.

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

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

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

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

Suggested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
26 files changed:
Documentation/gpio/driver.txt
drivers/gpio/gpio-bcm-kona.c
drivers/gpio/gpio-dln2.c
drivers/gpio/gpio-dwapb.c
drivers/gpio/gpio-ep93xx.c
drivers/gpio/gpio-f7188x.c
drivers/gpio/gpio-lp873x.c
drivers/gpio/gpio-max77620.c
drivers/gpio/gpio-menz127.c
drivers/gpio/gpio-merrifield.c
drivers/gpio/gpio-omap.c
drivers/gpio/gpio-tc3589x.c
drivers/gpio/gpio-tegra.c
drivers/gpio/gpio-tps65218.c
drivers/gpio/gpio-vx855.c
drivers/gpio/gpio-wcove.c
drivers/gpio/gpio-wm831x.c
drivers/gpio/gpio-wm8994.c
drivers/gpio/gpiolib.c
drivers/pinctrl/mediatek/pinctrl-mtk-common.c
drivers/pinctrl/pinctrl-amd.c
drivers/pinctrl/pinctrl-sx150x.c
drivers/staging/greybus/gpio.c
drivers/usb/serial/cp210x.c
include/linux/gpio/driver.h
include/linux/pinctrl/pinconf-generic.h