aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/backlight-uclass.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-10-01 12:22:41 -0600
committerSimon Glass <sjg@chromium.org>2018-10-09 04:40:27 -0600
commita4f737a9c39abb45a5bde47f313df48e645331f7 (patch)
treeb491944bdc102e4bd9f7009ccead12ed5256d214 /drivers/video/backlight-uclass.c
parent5d9a88f44a93daf623906fee7ca20fa396460ae2 (diff)
downloadu-boot-a4f737a9c39abb45a5bde47f313df48e645331f7.zip
u-boot-a4f737a9c39abb45a5bde47f313df48e645331f7.tar.gz
u-boot-a4f737a9c39abb45a5bde47f313df48e645331f7.tar.bz2
panel: Expand the backlight support
At present the panel can be turned on but not off, and the brightness cannot be controlled at run-time. Add a new API function to both the panel and backlight uclasses to handle this. Enhance the PWM backlight driver to deal with custom levels properly and allow the backlight to be turned on and off. Update the test to cover thes new features. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/video/backlight-uclass.c')
-rw-r--r--drivers/video/backlight-uclass.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/video/backlight-uclass.c b/drivers/video/backlight-uclass.c
index 92715e2..0aadf8a 100644
--- a/drivers/video/backlight-uclass.c
+++ b/drivers/video/backlight-uclass.c
@@ -18,6 +18,16 @@ int backlight_enable(struct udevice *dev)
return ops->enable(dev);
}
+int backlight_set_brightness(struct udevice *dev, int percent)
+{
+ const struct backlight_ops *ops = backlight_get_ops(dev);
+
+ if (!ops->set_brightness)
+ return -ENOSYS;
+
+ return ops->set_brightness(dev, percent);
+}
+
UCLASS_DRIVER(backlight) = {
.id = UCLASS_PANEL_BACKLIGHT,
.name = "backlight",