aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/panel-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/panel-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/panel-uclass.c')
-rw-r--r--drivers/video/panel-uclass.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/video/panel-uclass.c b/drivers/video/panel-uclass.c
index aec44a8..246d1b2 100644
--- a/drivers/video/panel-uclass.c
+++ b/drivers/video/panel-uclass.c
@@ -18,6 +18,24 @@ int panel_enable_backlight(struct udevice *dev)
return ops->enable_backlight(dev);
}
+/**
+ * panel_set_backlight - Set brightness for the panel backlight
+ *
+ * @dev: Panel device containing the backlight to update
+ * @percent: Brightness value (0=off, 1=min brightness,
+ * 100=full brightness)
+ * @return 0 if OK, -ve on error
+ */
+int panel_set_backlight(struct udevice *dev, int percent)
+{
+ struct panel_ops *ops = panel_get_ops(dev);
+
+ if (!ops->set_backlight)
+ return -ENOSYS;
+
+ return ops->set_backlight(dev, percent);
+}
+
int panel_get_display_timing(struct udevice *dev,
struct display_timing *timings)
{