Re: [PATCH] backlight: gpio_backlight: Drop output gpio direction check for initial power state

From: Andy Shevchenko
Date: Fri Jul 21 2023 - 02:33:42 EST


On Fri, Jul 21, 2023 at 8:17 AM Ying Liu <victor.liu@xxxxxxx> wrote:
> On Thursday, July 20, 2023 7:28 PM Daniel Thompson <daniel.thompson@xxxxxxxxxx> wrote:
> > On Thu, Jul 20, 2023 at 06:06:27AM +0000, Ying Liu wrote:
> > > Bootloader may leave gpio direction as input and gpio value as logical low.
> > > It hints that initial backlight power state should be
> > FB_BLANK_POWERDOWN
> > > since the gpio value is literally logical low.
> >
> > To be honest this probably "hints" that the bootloader simply didn't
> > consider the backlight at all :-) . I'd rather the patch description
> > focus on what circumstances lead to the current code making a bad
> > decision. More like:
> >
> > If the GPIO pin is in the input state but the backlight is currently
> > off due to default pull downs then ...
>
> How about this patch description?
>
> ---------------------------------8<-------------------------------------------
> Without this patch, if gpio pin is in input state but backlight is currently

s/Without this patch, if/If/

> off due to default pull downs, then initial power state is set to
> FB_BLANK_UNBLANK in DT boot mode with phandle link and the backlight is
> effectively turned on in gpio_backlight_probe(), which is undesirable
> according to patch description of commit ec665b756e6f ("backlight:
> gpio-backlight: Correct initial power state handling").
>
> Quote:
> ---
> If in DT boot we have phandle link then leave the GPIO in a state which the
> bootloader left it and let the user of the backlight to configure it further.
> ---
>
> So, let's drop output gpio direction check and only check gpio value to set
> the initial power state.
> ---------------------------------8<-------------------------------------------

--
With Best Regards,
Andy Shevchenko