[PATCH v4 0/3] gpio: gpio-regmap: Support few custom operations

From: Matti Vaittinen
Date: Wed May 26 2021 - 02:03:04 EST

Support providing some IC specific operations at gpio_regmap registration.

Implementation of few GPIO related functionalities are likely to be
very IC specific. For example the pin-configuration registers and the
pin validity checks. Allow IC driver to provide IC specific functions
which gpio-regmap can utilize for these IC specific configurations.
This should help broaden the gpio-regmap IC coverage without the need
of exposing the registered gpio_chip or struct gpio_regmap to IC drivers.

The set_config and init_valid_mask are used by ROHM BD71815 GPIO driver.
Convert the BD71815 GPIO driver to use gpio-regmap and get rid of some
code. Rest of the ROHM GPIO drivers are to be reworked after the
mechanism of adding IC specific functions is settled.

Some preliminary discussion can be seen here:

I did also prepare change where the getters for drvdata and regmap
are used. It can also work - but it does not scale quite as well
if (when) IC drivers need some register information to do custom
operations. Interested people can see the:
for comparison.

Changelog v4:
- Convert also the existing users.

Changelog v3:
- divide gpio_regmap into private part and part which contains
user-visible configurations. This should allow keeping the internal
data internal to gpio_regmap - while allowing the IC driver to re-use
configurations it has provided to gpio-regmap without a need of
storing them to private-data. Furthermore avoid implementing dummy
'getter-functions' for regmap, driver-data, register details,
firmware node etc.
- change devm_add_action() to devm_add_action_or_reset()
- the bd71815 GPIO driver, completely drop private-data.

Changelog v2:
- Add cover-letter
- Drop unnecessary checks for callback function validity
- drop driver_data setting function as it is likely to be a


Matti Vaittinen (3):
gpio: regmap: Support few IC specific operations
gpio: gpio-regmap: Use devm_add_action_or_reset()
gpio: bd71815: Use gpio-regmap

drivers/gpio/Kconfig | 1 +
drivers/gpio/gpio-bd71815.c | 121 ++++-----------
drivers/gpio/gpio-regmap.c | 212 +++++++++++++++-----------
drivers/gpio/gpio-sl28cpld.c | 3 +-
drivers/pinctrl/bcm/pinctrl-bcm63xx.c | 8 +-
include/linux/gpio/regmap.h | 51 +++++--
6 files changed, 194 insertions(+), 202 deletions(-)

base-commit: c4681547bcce777daf576925a966ffa824edd09d

Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]

Attachment: signature.asc
Description: PGP signature