diff --git a/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt b/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt index 267251fd816d9b..2869cc3fd1caae 100644 --- a/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt +++ b/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt @@ -21,6 +21,10 @@ Optional properties: - pwm-off-delay-ms: Delay in ms between disabling the backlight using GPIO (and setting PWM value to 0 at the same time) and switching off the enable-display-gpio. + - display-hold-off-ms: Time in ms which the display enable gpio is forced off + even if the backlight is switched on immediately after + it has been turned off. This can be used if the + display is not able to cope with fast on-off-on cycles. - brightness-levels: Array of distinct brightness levels. Typically these are in the range from 0 to 255, but any range starting at 0 will do. The actual brightness level (PWM duty cycle) @@ -52,6 +56,7 @@ Example: enable-backlight-gpios = <&gpio 60 0>; post-pwm-on-delay-ms = <10>; pwm-off-delay-ms = <10>; + display-hold-off-ms = <20>; }; Example using num-interpolation-steps: diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index a102e653348bb7..2c0deb33ca1bb2 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -39,6 +39,7 @@ struct pwm_bl_data { bool legacy; unsigned int pwm_on_delay; unsigned int pwm_off_delay; + unsigned int hold_off_delay; int (*notify)(struct device *, int brightness); void (*notify_after)(struct device *, @@ -91,6 +92,9 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb) regulator_disable(pb->power_supply); pb->enabled = false; + + if (pb->hold_off_delay) + msleep(pb->hold_off_delay); } static int compute_duty_cycle(struct pwm_bl_data *pb, int brightness) @@ -388,6 +392,7 @@ static int pwm_backlight_parse_dt(struct device *dev, of_property_read_u32(node, "pwm-on-delay-ms", &data->pwm_on_delay); of_property_read_u32(node, "pwm-off-delay-ms", &data->pwm_off_delay); + of_property_read_u32(node, "display-hold-off-ms", &data->hold_off_delay); data->dp_enable_gpio = -EINVAL; data->bl_enable_gpio = -EINVAL; @@ -493,6 +498,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->enabled = false; pb->pwm_on_delay = data->pwm_on_delay; pb->pwm_off_delay = data->pwm_off_delay; + pb->hold_off_delay = data->hold_off_delay; pb->dp_enable_gpio = devm_gpiod_get_optional(&pdev->dev, "display-enable", GPIOD_ASIS); diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h index dc0459432a5a3b..42164f72e62970 100644 --- a/include/linux/pwm_backlight.h +++ b/include/linux/pwm_backlight.h @@ -16,6 +16,7 @@ struct platform_pwm_backlight_data { unsigned int *levels; unsigned int pwm_on_delay; unsigned int pwm_off_delay; + unsigned int hold_off_delay; /* TODO remove once all users are switched to gpiod_* API */ int dp_enable_gpio; int bl_enable_gpio;