All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Bartosz Golaszewski" <bgolaszewski@baylibre.com>,
	"GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	"Álvaro Fernández Rojas" <noltari@gmail.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Michael Walle" <michael@walle.cc>
Subject: regmap-gpio: Support set_config and other not quite so standard ICs?
Date: Mon, 10 May 2021 15:58:13 +0300	[thread overview]
Message-ID: <c4faac648d3e0c7f3dcb50f7e24c8b322e8c6974.camel@fi.rohmeurope.com> (raw)
In-Reply-To: <c5a4ef7341b5b0b56d1ad950867828463cfdb7fc.camel@fi.rohmeurope.com>

[-- Attachment #1: Type: text/plain, Size: 2950 bytes --]

Hi Linus, All,

On Thu, 2021-03-25 at 12:32 +0200, Matti Vaittinen wrote:
> On Thu, 2021-03-25 at 10:35 +0100, Linus Walleij wrote:

snip

> > It could potentially (like the other Rohm GPIO MFD PMIC drivers)
> > make some use of the gpio regmap library, but we have some
> > pending changes for that so look into it after the next merge
> > window.
> > 
> > I.e. for your TODO: look at the GPIO_REGMAP helper.
> 
> I just took a quick peek at gpio_regmap and it looks pretty good to
> me!
> 
> Any particular reason why gpio_regmap is not just part of gpio_chip?
> I
> guess providing the 'gpio_regmap_direction_*()', 'gpio_regmap_get()',
> 'gpio_regmap_set()' as exported helpers and leaving calling the
> (devm_)gpiochip_add_data() to IC driver would have allowed more
> flexibility. Drivers could then use the gpio_regamap features which
> fit
> the IC (by providing pointers to helper functions in gpio_chip) - and
> handle potential oddball-features by using pointers to some
> customized
> functions in gpio_chip.

So, v5.13-rc1 is out. I started wondering the gpio_regamap - and same
question persists. Why hiding the gpio_chip from gpio_regmap users?

Current IF makes it very hard (impossible?) for driver to override any
of the regmap_gpio functions (or provide own alternatives) for cases
which do not fit the generic regmap_gpio model.

My first obstacle is providing gpio_chip.set_config for BD71815.

1) I guess the method fitting current design would be adding drive-mode 
register/mask(s) to the gpio_regmap_config. Certainly doable - but I
have a bad feeling of this approach. I am afraid this leads to bloating
the gpio_regmap_config with all kinds of IC specific workarounds (when
HW designers have invented new cool control registers setups) - or then
just not using the regmap_gpio for any ICs which have any quirks - even
if 90% of regmap_gpio logic would fit...

2) Other possibility is allowing IC driver to provide function pointers
for some operations (in my case for example for the set_config) - if
the default operation the regmap_gpio provides does not fit the IC.
This would require the regmap_gpio to be visible to IC drivers so that
IC drivers can access the regmap, device & register information - or
some way to convert the gpio_chip pointer to IC specific private data
pointer. Doable but still slightly bloat.

3) The last option would be adding pointer to regmap_gpio to gpio_chip
- and exporting the regmap_gpio functions as helpers - leaving the gpio
registration to be done by the IC driver. That would allow IC driver to
use the regmap_gpio helpers which suit the IC and write own functions
for rest of the stuff.

I'd like to hear opinions - should I draft some changes according to
these proposals (which one, 1,2,3 or something else?) - or as this all
been already discussed and am I just missing something?

Best Regards
	Matti Vaittinen

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-05-10 13:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24  7:21 [PATCH v4 00/16] Support ROHM BD71815 PMIC Matti Vaittinen
2021-03-24  7:22 ` [PATCH v4 01/16] rtc: bd70528: Do not require parent data Matti Vaittinen
2021-03-24  7:22 ` [PATCH v4 02/16] mfd: bd718x7: simplify by cleaning unnecessary device data Matti Vaittinen
2021-03-24  7:23 ` [PATCH v4 03/16] dt_bindings: bd71828: Add clock output mode Matti Vaittinen
2021-03-24  7:23 ` [PATCH v4 04/16] dt_bindings: regulator: Add ROHM BD71815 PMIC regulators Matti Vaittinen
2021-03-24  7:23 ` [PATCH v4 05/16] dt_bindings: mfd: Add ROHM BD71815 PMIC Matti Vaittinen
2021-03-24  7:25 ` [PATCH v4 06/16] mfd: Add ROHM BD71815 ID Matti Vaittinen
2021-03-24  7:26 ` [PATCH v4 07/16] mfd: Sort ROHM chip ID list for better readability Matti Vaittinen
2021-03-24  7:26 ` [PATCH v4 08/16] mfd: Support for ROHM BD71815 PMIC core Matti Vaittinen
2021-03-24  7:29 ` [PATCH v4 09/16] gpio: support ROHM BD71815 GPOs Matti Vaittinen
2021-03-25  9:35   ` Linus Walleij
2021-03-25 10:32     ` Matti Vaittinen
2021-05-10 12:58       ` Matti Vaittinen [this message]
2021-05-10 16:54         ` regmap-gpio: Support set_config and other not quite so standard ICs? Andy Shevchenko
2021-05-11  3:59           ` Matti Vaittinen
2021-05-14 20:34             ` Michael Walle
2021-05-17  4:46               ` Vaittinen, Matti
2021-03-26 11:26   ` [PATCH v4 09/16] gpio: support ROHM BD71815 GPOs Andy Shevchenko
2021-03-26 11:27     ` Andy Shevchenko
2021-03-26 13:33     ` Matti Vaittinen
2021-03-26 17:51       ` Andy Shevchenko
2021-03-28 16:59         ` Matti Vaittinen
2021-03-24  7:29 ` [PATCH v4 10/16] regulator: helpers: Export helper voltage listing Matti Vaittinen
2021-03-24  7:30 ` [PATCH v4 12/16] regulator: rohm-regulator: Support SNVS HW state Matti Vaittinen
2021-03-24  7:30 ` [PATCH v4 13/16] regulator: Support ROHM BD71815 regulators Matti Vaittinen
2021-03-24  7:30 ` [PATCH v4 14/16] clk: bd718x7: Add support for clk gate on ROHM BD71815 PMIC Matti Vaittinen
2021-03-24  7:31 ` [PATCH v4 15/16] rtc: bd70528: Support RTC on ROHM BD71815 Matti Vaittinen
2021-03-24  7:31 ` [PATCH v4 16/16] MAINTAINERS: Add ROHM BD71815AGW Matti Vaittinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4faac648d3e0c7f3dcb50f7e24c8b322e8c6974.camel@fi.rohmeurope.com \
    --to=matti.vaittinen@fi.rohmeurope.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=noltari@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.