From: Michael Walle <michael@walle.cc>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Sahin, Okan" <Okan.Sahin@analog.com>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] gpio: ds4520: Add ADI DS4520 Regulator Support
Date: Wed, 05 Apr 2023 15:57:05 +0200 [thread overview]
Message-ID: <25e1fda4b6df2d10444d7eca3cd0e387@walle.cc> (raw)
In-Reply-To: <CACRpkdZJA0DyzgLxm9HFeHO03rqNUff=avuV=VrGuJkkOg6wNQ@mail.gmail.com>
Am 2023-04-05 15:20, schrieb Linus Walleij:
> On Tue, Apr 4, 2023 at 4:36 PM Sahin, Okan <Okan.Sahin@analog.com>
> wrote:
>
>> >The driver is pretty straight-forward, but I think this can use the generic
>> >GPIO_REGMAP helpers in drivers/gpio/gpio-regmap.c check other drivers selecting
>> >this helper library for inspiration.
> (..)
>> Thank you for your contribution. Should I add select GPIO_REGMAP into
>> Kconfig?
>
> Yes but that is not all, you also need to make use of the library
> helpers
> provided in include/linux/gpio/regmap.h.
>
> Find examples of other drivers doing this by e.g.:
> git grep gpio_regmap_register
>
> drivers/gpio/gpio-sl28cpld.c: return
> PTR_ERR_OR_ZERO(devm_gpio_regmap_register(&pdev->dev, &config));
> drivers/gpio/gpio-tn48m.c: return
> PTR_ERR_OR_ZERO(devm_gpio_regmap_register(&pdev->dev, &config));
> drivers/pinctrl/bcm/pinctrl-bcm63xx.c: return
> PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &grc));
>
> ^Look what these are doing
This driver is doing two register writes/reads for setting the
direction, that's something which isn't supported in GPIO_REGMAP.
OTOH I'm not sure the driver is doing it correctly, because it also
seems to switch the pullup resisters together with the direction.
I'm not sure that is correct. So there might be just one register
involved after all and the GPIO_REGMAP should work again.
Also, according to the datasheet this has some nv memory (to set the
initial state of the GPIOs [?]). So it should really be a multi-function
device. I'm not sure if this has to be considered right from the
beginning or if the device support can start with GPIO only and later
be transitioned to a full featured MFD (probably with nvmem support).
-michael
next prev parent reply other threads:[~2023-04-05 13:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-27 13:00 [PATCH v1 0/2] Add DS4520 GPIO Expander Support Okan Sahin
2023-03-27 13:00 ` [PATCH v1 1/2] dt-bindings: gpio: ds4520: Add ADI DS4520 Okan Sahin
2023-03-27 15:37 ` Rob Herring
2023-03-27 19:05 ` Krzysztof Kozlowski
2023-03-27 13:00 ` [PATCH v1 2/2] gpio: ds4520: Add ADI DS4520 Regulator Support Okan Sahin
2023-03-31 9:41 ` Linus Walleij
2023-04-04 14:35 ` Sahin, Okan
2023-04-05 13:20 ` Linus Walleij
2023-04-05 13:57 ` Michael Walle [this message]
2023-04-07 13:48 ` Linus Walleij
2023-04-07 18:36 ` andy.shevchenko
2023-04-09 14:25 ` Sahin, Okan
2023-04-11 13:42 ` Michael Walle
2023-04-24 15:39 ` Sahin, Okan
2023-04-25 7:05 ` Michael Walle
2023-04-26 11:28 ` Sahin, Okan
2023-04-26 11:53 ` Michael Walle
2023-04-26 13:39 ` Sahin, Okan
2023-04-11 14:11 ` Andy Shevchenko
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=25e1fda4b6df2d10444d7eca3cd0e387@walle.cc \
--to=michael@walle.cc \
--cc=Okan.Sahin@analog.com \
--cc=brgl@bgdev.pl \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).