Fri, Apr 07, 2023 at 03:48:25PM +0200, Linus Walleij kirjoitti:
On Wed, Apr 5, 2023 at 3:57 PM Michael Walle <michael@xxxxxxxx> wrote:support).
> 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.
I'm pretty sure that should be in the .set_config() callback.
> 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
That's a bit of a soft definition.
If the chip is *only* doing GPIO and nvram it can be a GPIO-only
device I think.
The precedent is a ton of ethernet drivers with nvram for storing e.g.
the MAC address. We don't make all of those into MFDs, as the nvram is
closely tied to the one and only function of the block.
I agree with Linus. This should be part of the actual (main) driver for the chip as many
do (like USB to serial adapters that have GPIO capability).
I think gpio_regmap is not suitable for this driver as Michael stated.
https://www.analog.com/media/en/technical-documentation/data-sheets/ds4520.pdf
Please check block diagram. There are two input registers that control
gpio state
so gpio_regmap does not look ok for this. Am I missing something?
Also, at this point I am not planning to add nvmem support.