lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CSCM20VPW7QB.RQD36XO6634I@burritosblues>
Date:   Wed, 03 May 2023 13:37:04 +0200
From:   "Esteban Blanc" <eblanc@...libre.com>
To:     "Linus Walleij" <linus.walleij@...aro.org>
Cc:     <lgirdwood@...il.com>, <broonie@...nel.org>,
        <a.zummo@...ertech.it>, <alexandre.belloni@...tlin.com>,
        <linux-kernel@...r.kernel.org>, <linux-gpio@...r.kernel.org>,
        <linux-rtc@...r.kernel.org>, <jpanis@...libre.com>,
        <jneanne@...libre.com>, <aseketeli@...libre.com>, <sterzik@...com>,
        <u-kumar1@...com>
Subject: Re: [PATCH v3 2/3] pinctrl: tps6594: add for TPS6594 PMIC

On Fri Apr 21, 2023 at 10:34 AM CEST, Linus Walleij wrote:
> Hi Esteban,
>
> thanks for your patch!
>
> On Fri, Apr 14, 2023 at 12:12 PM Esteban Blanc <eblanc@...libre.com> wrote:
>
> > TI TPS6594 PMIC has 11 GPIOs which can be used for different
> > functions.
> >
> > This add a pinctrl and pinmux drivers in order to use those functions.
> >
> > Signed-off-by: Esteban Blanc <eblanc@...libre.com>
> (...)
> > +config PINCTRL_TPS6594
> > +       tristate "Pinctrl and GPIO driver for TI TPS6594 PMIC"
> > +       depends on MFD_TPS6594
> > +       default MFD_TPS6594
> > +       select PINMUX
> > +       select GPIOLIB
>
> select GPIO_REGMAP
> ?
>
> I think this driver can use the GPIO_REGMAP helper library.
>
> Please look into other drivers using this, such as
> drivers/gpio/gpio-sl28cpld.c

I had a look at this driver and gpio-regmap.c. I think I understood
what's going on, but I'm not sure how to handle the
gpio_regmap_set_direction case. It is using the same reg_mask_xlate to
determine the register and value to write as gpio_regmap_set or
gpio_regmap_read. The problem is that this PMIC has 1 register per GPIO
for the configuration (GPIOX_CONF registers with a bit for direction),
while the in and out register are used for 8 pins (GPIO_OUT_1,
GPIO_OUT_2 and GPIO_IN_1, GPIO_IN_2). This means that the register and
mask returned by reg_mask_xlate will be erroneous in one or the other
case.

I noticed that I could override reg_mask_xlate, so I should be able to
"just" match on the base address given as argument to perform a
different computation depending on whether we are using reg_mask_xlate in
a "direction change" or not, but somehow this feels a bit wrong.

Is this the correct solution?
Am I missing something?

Thanks again for your time. Best regards,

-- 
Esteban Blanc
BayLibre

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ