]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
backlight: pwm_bl: Enable PWM before switching regulator on
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 7 Sep 2017 13:11:09 +0000 (15:11 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 7 Sep 2017 13:11:09 +0000 (15:11 +0200)
When the PWM is re-enabled after being switched off, the backlight may
flicker due to the backlight power being switched on while the PWM is
still unconfigured. This is especially true if the PWM output is
active low (assuming that the PWM output is low when the PWM is not
enabled).
Configure the PWM before switching backlight power on to prevent this.

drivers/video/backlight/pwm_bl.c

index 002f1ce22bd02032062924b19d645ebc25302c93..921f322dd2877eb7c2a78bab0cfcaca37862d98f 100644 (file)
@@ -50,6 +50,8 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness)
        if (pb->enabled)
                return;
 
+       pwm_enable(pb->pwm);
+
        err = regulator_enable(pb->power_supply);
        if (err < 0)
                dev_err(pb->dev, "failed to enable power supply\n");
@@ -57,7 +59,6 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness)
        if (pb->enable_gpio)
                gpiod_set_value_cansleep(pb->enable_gpio, 1);
 
-       pwm_enable(pb->pwm);
        pb->enabled = true;
 }