Re: [PATCH v3 4/7] gpio: tps6594x: add GPIO support for TPS6594x PMIC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Am 2022-11-11 09:58, schrieb Matt Ranostay:
On Thu, Nov 10, 2022 at 11:15:22AM +0100, Linus Walleij wrote:
On Thu, Nov 10, 2022 at 11:12 AM Matt Ranostay <mranostay@xxxxxx> wrote:
> On Wed, Nov 09, 2022 at 10:59:08AM +0100, Linus Walleij wrote:
> > On Wed, Nov 9, 2022 at 7:56 AM Matt Ranostay <mranostay@xxxxxx> wrote:
> >
> > > Add support for TPS6594X PMICs GPIO interface that has 11 that can be
> > > configured as input or outputs.
> > >
> > > Tested-by: Keerthy <j-keerthy@xxxxxx>
> > > Signed-off-by: Matt Ranostay <mranostay@xxxxxx>
> >
> > (...)
> > > +config GPIO_TPS6594X
> > > +       tristate "TI TPS6594X GPIO driver"
> > > +       depends on MFD_TPS6594X
> > > +       help
> > > +         Select this option to enable GPIO driver for the TPS6954X
> > > +         PMIC chip family. There are 11 GPIOs that can be configured.
> >
> > select GPIO_REGMAP
> >
> > This driver is an archetypical example of a driver that can make great
> > use of GPIO_REGMAP helpers, so rewrite it to use them.
> > Look in drivers/gpio/gpio-sl28cpld.c for an example.
>
> Linus,
>
> Those helpers look great for this usecase on the surface but however I think there could be some issues.
> For GPIO direction it isn't configured by a bitmap on a register(s) but by a bit on a range of
> registers (with a register for each GPIOx).

As long as there is only one register to be changed per pin/action,
.reg_mask_xlate should work, as you've already found out.

> For set/get values the gpio helper would work though.

Isn't is possible to just use parts of the GPIO_REGMAP
helpers? I thought it's designed like such.

No, you can't use them as they are kept private, along with
the needed struct gpio_regmap. Which was intentional back then
as it should be easier to change the implementation or add features
without its use being spread all over the gpio drivers.

We could change that though - or just add the needed feature to
gpio-regmap if it looks generic enough.


Michael Walle will know what to do with your usecase, and
whether to use it or not, let's page him!


So after looking around a bit and digging into the helper code I found this drivers/pinctrl/bcm/pinctrl-bcm63xx.c which has a example on how to override
the reg_mask_xlate function which could be used for changing the
stride, and mask
based on the base address.

Currently have coded up using the gpio regmap helper. Will run through
some testing
first and then submit for review.

Sounds promising.

-michael



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux