pwm_bl: Add mandatory backlight enable regulator
Subsystems (3)
PATCH v6 1/1 pwm_bl: Add mandatory backlight enable regulator
Many backlights need to be explicitly enabled. Typically, this is done with a GPIO. For flexibility, we generalize the enable mechanism to a regulator.
If an enable regulator is not needed, then a dummy regulator can be given to the backlight driver. If a GPIO is used to enable the backlight, then a fixed regulator can be instantiated to control the GPIO.
The backlight enable regulator can be specified in the device tree node for the backlight, or can be done with legacy board setup code in the usual way.
---
Removed "pb->enable_supply = NULL;" per Alex's suggestion, since probe fails in this case anyway, and on next probe (if probe is deferred) will assign to pb->enable_supply before accessing it.
Updated the commit message to provide a description of the purpose of the new mandatory regulator, and tweaked verbiage to not be device tree specific.
I intend to follow up with patches to fix all existing machines that use the pwm_bl driver.
.../bindings/video/backlight/pwm-backlight.txt | 14 +++++ drivers/video/backlight/pwm_bl.c | 55 ++++++++++++++++---- 2 files changed, 59 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt +14 -0
@@ -10,6 +10,11 @@ Required properties: last value in the array represents a 100% duty cycle (brightest). - default-brightness-level: the default brightness level (index into the array defined by the "brightness-levels" property) + - enable-supply: A phandle to the regulator device tree node. This + regulator will be turned on and off as the pwm is enabled and disabled. + Many backlights are enabled via a GPIO. In this case, we instantiate + a fixed regulator and give that to enable-supply. If a regulator + is not needed, then provide a dummy fixed regulator. Optional properties: - pwm-names: a list of names for the PWM devices specified in the
@@ -19,10 +24,19 @@ Optional properties: Example: + bl_en: fixed-regulator { + compatible = "regulator-fixed"; + regulator-name = "bl-en-supply"; + regulator-boot-on; + gpio = <&some_gpio>; + enable-active-high; + }; + backlight { compatible = "pwm-backlight"; pwms = <&pwm 0 5000000>; brightness-levels = <0 4 8 16 32 64 128 255>; default-brightness-level = <6>; + enable-supply = <&bl_en>; };
drivers/video/backlight/pwm_bl.c +45 -10
107 lines not on this page · raw message
Signature · 1 line
1.7.9.5