aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/backlight/pwm_bl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index d7efcb632f7d..002f1ce22bd0 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -297,14 +297,15 @@ static int pwm_backlight_probe(struct platform_device *pdev)
297 } 297 }
298 298
299 /* 299 /*
300 * If the GPIO is configured as input, change the direction to output 300 * If the GPIO is not known to be already configured as output, that
301 * and set the GPIO as active. 301 * is, if gpiod_get_direction returns either GPIOF_DIR_IN or -EINVAL,
302 * change the direction to output and set the GPIO as active.
302 * Do not force the GPIO to active when it was already output as it 303 * Do not force the GPIO to active when it was already output as it
303 * could cause backlight flickering or we would enable the backlight too 304 * could cause backlight flickering or we would enable the backlight too
304 * early. Leave the decision of the initial backlight state for later. 305 * early. Leave the decision of the initial backlight state for later.
305 */ 306 */
306 if (pb->enable_gpio && 307 if (pb->enable_gpio &&
307 gpiod_get_direction(pb->enable_gpio) == GPIOF_DIR_IN) 308 gpiod_get_direction(pb->enable_gpio) != GPIOF_DIR_OUT)
308 gpiod_direction_output(pb->enable_gpio, 1); 309 gpiod_direction_output(pb->enable_gpio, 1);
309 310
310 pb->power_supply = devm_regulator_get(&pdev->dev, "power"); 311 pb->power_supply = devm_regulator_get(&pdev->dev, "power");