Re: [PATCH v2 21/21] gpio: add GPIO controller found on Waveshare DSI TOUCH panels
From: Dmitry Baryshkov
Date: Wed Apr 22 2026 - 14:49:29 EST
On Wed, Apr 22, 2026 at 03:20:26PM +0200, Linus Walleij wrote:
> Hi Dmitry,
>
> On Sat, Apr 11, 2026 at 2:11 PM Dmitry Baryshkov
> <dmitry.baryshkov@xxxxxxxxxxxxxxxx> wrote:
>
> > The Waveshare DSI TOUCH family of panels has separate on-board GPIO
> > controller, which controls power supplies to the panel and the touch
> > screen and provides reset pins for both the panel and the touchscreen.
> > Also it provides a simple PWM controller for panel backlight. Add
> > support for this GPIO controller.
> >
> > Tested-by: Riccardo Mereu <r.mereu@xxxxxxxxxx>
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
> (...)
>
> > +static int waveshare_gpio_get(struct waveshare_gpio *state, unsigned int offset)
> > +{
> > + u16 pwr_state;
> > +
> > + guard(mutex)(&state->pwr_lock);
> > + pwr_state = state->poweron_state & BIT(offset);
>
> Why is this not just flagging the same register as write-only
> in the regmap and just re-reading that same register from the
> regmap cache?
>
> > +
> > + return !!pwr_state;
> > +}
>
> OK so it's write-only.
>
> > +static int waveshare_gpio_set(struct waveshare_gpio *state, unsigned int offset, int value)
>
> This looks like it can be replaced with a few lines of
> select GPIO_REGMAP
> #include <linux/gpio/regmap.h>
> helpers.
>
> Has this not been discussed earlier?
Yes, it was. Using gpio-regmap would complicate BL code since it
wouldn't be easy to directly toggle the BL GPIO.
>
> Yours,
> Linus Walleij
--
With best wishes
Dmitry