Re: [PATCH v2 0/3] pinctrl / gpio: Allow GPIO chips to use generic pinconfig

From: Andy Shevchenko
Date: Mon Jan 23 2017 - 09:24:46 EST


On Mon, 2017-01-23 at 15:34 +0300, Mika Westerberg wrote:
> This series makes it possible to configure pins from GPIO chip drivers
> by
> implementing a new callback .set_config(). This callback replaces the
> existing .set_single_ended() and .set_debounce() simply because adding
> new
> callbacks for each possible configuration type does not scale. So
> instead
> we re-use the existing generic pinconf types and the packed format.
>
> This is a follow up of discussion on:
>
> Â https://patchwork.ozlabs.org/patch/713289/
>
> While doing that, it was found out that the current packed format does
> not
> support all realistic debounce time values. The limit is ~64ms which
> does
> not cover mechanical switches connected to GPIOs that migh require
> values
> up to hundreths of milliseconds.
>
> To solve that we change the packed format so that the value takes 24
> bits
> instead of 16, and change the callers to use 32-bit integer instead.
>
> We also make it possible for GPIO chip driver to call pinctrl directly
> by
> providing a new functions gpiochip_generic_config() and
> pinctrl_gpio_set_config().
>
> I've tested this on Intel Gemini Lake SoC. Non-Intel drivers are
> compile
> tested only because I do not have the hardware.
>

Looks pretty nice to me!

FWIW:
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

> Changes from v1:
>
> Â * Change pinconf_to_config_argument() to cast the result to u32
> instead
> ÂÂÂÂof enum pin_config_param (which was probably due to copy-paste).
> ÂÂ
> Â * Re-format PCONFDUMP() macro.
>
> Â * Add gpiochip_generic_config() so that GPIO drivers can just assign
> ÂÂÂÂthat to their struct gpio_chip if they would just pass the
> ÂÂÂÂ.set_config() directly to their backing pinctrl driver.
> ÂÂ
> Â * Rename gpio_set_drive_mode() to gpio_set_drive_single_ended().
>
> Â * Correct _gpiod_direction_output_raw() to jump to
> set_output_value()
> ÂÂÂÂwhen gpio_set_drive_single_ended() succeeds.
>
> Mika Westerberg (3):
> Â pinctrl: Widen the generic pinconf argument from 16 to 24 bits
> Â pinctrl: Allow configuration of pins from gpiolib based drivers
> Â pinctrl / gpio: Introduce .set_config() callback for GPIO chips
>
> ÂDocumentation/gpio/driver.txtÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ9 ++--
> Âdrivers/gpio/gpio-bcm-kona.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 14 +++++-
> Âdrivers/gpio/gpio-dln2.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 12 +++--
> Âdrivers/gpio/gpio-dwapb.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 14 +++++-
> Âdrivers/gpio/gpio-ep93xx.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 11 +++--
> Âdrivers/gpio/gpio-f7188x.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 19 ++++----
> Âdrivers/gpio/gpio-lp873x.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 14 +++---
> Âdrivers/gpio/gpio-max77620.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 20 ++++-----
> Âdrivers/gpio/gpio-menz127.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 34 ++++++++++----
> Âdrivers/gpio/gpio-merrifield.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 14 +++++-
> Âdrivers/gpio/gpio-omap.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 14 +++++-
> Âdrivers/gpio/gpio-tc3589x.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 15 +++----
> Âdrivers/gpio/gpio-tegra.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 14 +++++-
> Âdrivers/gpio/gpio-tps65218.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 14 +++---
> Âdrivers/gpio/gpio-vx855.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 13 +++---
> Âdrivers/gpio/gpio-wcove.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 13 +++---
> Âdrivers/gpio/gpio-wm831x.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 21 +++++----
> Âdrivers/gpio/gpio-wm8994.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 13 +++---
> Âdrivers/gpio/gpiolib.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 56
> +++++++++++++++---------
> Âdrivers/pinctrl/bcm/pinctrl-bcm281xx.cÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ6 +--
> Âdrivers/pinctrl/bcm/pinctrl-iproc-gpio.cÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> Âdrivers/pinctrl/bcm/pinctrl-ns2-mux.cÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ6 +--
> Âdrivers/pinctrl/bcm/pinctrl-nsp-gpio.cÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ6 +--
> Âdrivers/pinctrl/core.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 29 ++++++++++++
> Âdrivers/pinctrl/intel/pinctrl-cherryview.cÂÂÂÂÂÂÂ|ÂÂ4 +-
> Âdrivers/pinctrl/mediatek/pinctrl-mtk-common.cÂÂÂÂ| 14 +++++-
> Âdrivers/pinctrl/meson/pinctrl-meson.cÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 -
> Âdrivers/pinctrl/pinconf.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 12 +++++
> Âdrivers/pinctrl/pinconf.hÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ9 ++++
> Âdrivers/pinctrl/pinctrl-amd.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 14 +++++-
> Âdrivers/pinctrl/pinctrl-da850-pupd.cÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 -
> Âdrivers/pinctrl/pinctrl-lpc18xx.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 10 ++---
> Âdrivers/pinctrl/pinctrl-max77620.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> Âdrivers/pinctrl/pinctrl-palmas.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> Âdrivers/pinctrl/pinctrl-rockchip.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> Âdrivers/pinctrl/pinctrl-single.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> Âdrivers/pinctrl/pinctrl-sx150x.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 55 +++++++------
> ----------
> Âdrivers/pinctrl/sirf/pinctrl-atlas7.cÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ3 +-
> Âdrivers/pinctrl/sunxi/pinctrl-sunxi.cÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> Âdrivers/pinctrl/uniphier/pinctrl-uniphier-core.c |ÂÂ4 +-
> Âdrivers/pinctrl/vt8500/pinctrl-wmt.cÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> Âdrivers/rtc/rtc-omap.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> Âdrivers/staging/greybus/gpio.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 15 ++++---
> Âdrivers/usb/serial/cp210x.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 13 +++---
> Âinclude/linux/gpio/driver.hÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 37 ++++-----------
> -
> Âinclude/linux/pinctrl/consumer.hÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ6 +++
> Âinclude/linux/pinctrl/pinconf-generic.hÂÂÂÂÂÂÂÂÂÂ| 52 +++++++++++--
> ---------
> Â47 files changed, 392 insertions(+), 257 deletions(-)
>

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy