Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4bac97b authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'backlight-for-v4.11' of git://git.linaro.org/people/daniel.thompson/linux

Pull backlight fix from Daniel Thompson:
 "Normally pull requests for backlight come from Lee Jones (and will
  continue to do so) but the bug fixed here is annoying for few people
  so I'm providing a little holiday cover.

  Fix a single bug in the PWM backlight driver and make it play nice
  with a wider range of GPIO devices. This bug is a regression and was
  independently discovered by Geert Uytterhoevan and Paul Kocialkowski
  (and is tested by both)"

* tag 'backlight-for-v4.11' of git://git.linaro.org/people/daniel.thompson/linux:
  backlight: pwm_bl: Fix GPIO out for unimplemented .get_direction()
parents 005882e5 892c7788
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -297,14 +297,15 @@ static int pwm_backlight_probe(struct platform_device *pdev)
	}

	/*
	 * If the GPIO is configured as input, change the direction to output
	 * and set the GPIO as active.
	 * If the GPIO is not known to be already configured as output, that
	 * is, if gpiod_get_direction returns either GPIOF_DIR_IN or -EINVAL,
	 * change the direction to output and set the GPIO as active.
	 * Do not force the GPIO to active when it was already output as it
	 * could cause backlight flickering or we would enable the backlight too
	 * early. Leave the decision of the initial backlight state for later.
	 */
	if (pb->enable_gpio &&
	    gpiod_get_direction(pb->enable_gpio) == GPIOF_DIR_IN)
	    gpiod_get_direction(pb->enable_gpio) != GPIOF_DIR_OUT)
		gpiod_direction_output(pb->enable_gpio, 1);

	pb->power_supply = devm_regulator_get(&pdev->dev, "power");