[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeZkLSTw8OFmDMYb+im0qK0NQRHpndzBM7fMHm=HZCzeA@mail.gmail.com>
Date: Wed, 7 Jun 2023 19:30:58 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: "Hawkins, Nick" <nick.hawkins@....com>
Cc: "Verdun, Jean-Marie" <verdun@....com>,
"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
"brgl@...ev.pl" <brgl@...ev.pl>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"krzysztof.kozlowski+dt@...aro.org"
<krzysztof.kozlowski+dt@...aro.org>,
"jdelvare@...e.com" <jdelvare@...e.com>,
"linux@...ck-us.net" <linux@...ck-us.net>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-hwmon@...r.kernel.org" <linux-hwmon@...r.kernel.org>
Subject: Re: [PATCH v3 2/5] gpio: gxp: Add HPE GXP GPIO
On Wed, Jun 7, 2023 at 7:07 PM Hawkins, Nick <nick.hawkins@....com> wrote:
...
> > > > Why are you not using gpio-regmap?
> > >
> > > Is there are good example or previous commit you would recommend
> > > looking at that shows how to convert from regmap to gpio-regmap?
> > > Later in the code I am using regmap_read and regmap_update_bits
> > > with large differences in offset registers, and not so much a
> > > contiguous block.
>
>
> > I don't know how good these are, but that's what we have currently as
> > most prominent use of gpio-regmap
>
>
> > 1) (ongoing) https://lore.kernel.org/linux-gpio/20230606092107.764621-6-jiawenwu@trustnetic.com <mailto:20230606092107.764621-6-jiawenwu@...stnetic.com>/
> > 2) (in the repo)
> > https://elixir.bootlin.com/linux/v6.4-rc4/source/drivers/gpio/gpio-i8255.c <https://elixir.bootlin.com/linux/v6.4-rc4/source/drivers/gpio/gpio-i8255.c>
> > 3) (in the repo)
> > https://elixir.bootlin.com/linux/v6.4-rc4/source/drivers/gpio/gpio-104-idi-48.c <https://elixir.bootlin.com/linux/v6.4-rc4/source/drivers/gpio/gpio-104-idi-48.c>
>
>
> > 2) & 3) were converted, so you may see by executing respective `git
> > log -p -- drivers/gpio/...`.
>
> Greetings Andy,
>
> Thank you for those links, I have observed the gpio_regmap code
> they have implemented in that case. It appears that the regmap
> code is opening the entire range of memory to be read. For my
> particular purpose I am not wanting to expose all the 0-0xff byte
> range of the GPIOs.
This is also supported by regmap (and regmap has caches for the sparse
registers as well).
> In my case is it still necessary to use the
> gpio_regmap code?
It does care about things the average GPIO controller driver needs to
repeat. So at least you may try and see how it will look.
> If gpio_regmap is required, how do I create a direct correlation
> between a specific gpio-line and a register offset? For example, in
> gpio-gxp-pl.c. Gpio-line at offset 0 (IOPLED) is at register 0x04. The
> gpio-line at offset 8 (FAN_INST) is at register 0x27.
You may remap registers. See, for example, gpio-pca953x, where some of
the registers (with high bit set) are actually virtual rather than
real offsets. Similar idea can be used in your case.
> Additionally, is it required to remove gpio_chip if gpio_regmap is
> used?
I don't think gpio_chip will be needed.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists