Message ID | 20230721090332.1528569-1-victor.liu@nxp.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [v3] backlight: gpio_backlight: Drop output gpio direction check for initial power state | expand |
On Fri, Jul 21, 2023 at 11:58 AM Ying Liu <victor.liu@nxp.com> wrote: > > If gpio pin is in input state but backlight is currently off due to GPIO > 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. > --- Just use ---8<--- or drop these completely, as your (commit message of the) patch is broken now. > > So, let's drop output gpio direction check and only check gpio value to set GPIO GPIO > the initial power state. > > Fixes: 706dc68102bc ("backlight: gpio: Explicitly set the direction of the GPIO") > Signed-off-by: Liu Ying <victor.liu@nxp.com>
diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 6f78d928f054..38c46936fdcd 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -87,8 +87,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) /* Not booted with device tree or no phandle link to the node */ bl->props.power = def_value ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; - else if (gpiod_get_direction(gbl->gpiod) == 0 && - gpiod_get_value_cansleep(gbl->gpiod) == 0) + else if (gpiod_get_value_cansleep(gbl->gpiod) == 0) bl->props.power = FB_BLANK_POWERDOWN; else bl->props.power = FB_BLANK_UNBLANK;
If gpio pin is in input state but backlight is currently 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. Fixes: 706dc68102bc ("backlight: gpio: Explicitly set the direction of the GPIO") Signed-off-by: Liu Ying <victor.liu@nxp.com> --- v2->v3: * Add Fixes tag. (Daniel) v1->v2: * Improve patch description. (Daniel, Bartosz, Andy) drivers/video/backlight/gpio_backlight.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)