[U-Boot] [PATCH 6/7] video_display: Add power_on function

Mario Six mario.six at gdsys.cc
Wed Mar 28 12:40:20 UTC 2018


Add a power_on function to the display uclass to allow devices to be
probed and powered-on separately.

Signed-off-by: Mario Six <mario.six at gdsys.cc>
---
 drivers/video/display-uclass.c | 10 ++++++++++
 include/display.h              | 18 ++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/drivers/video/display-uclass.c b/drivers/video/display-uclass.c
index e752eb07c4..4865057e94 100644
--- a/drivers/video/display-uclass.c
+++ b/drivers/video/display-uclass.c
@@ -57,6 +57,16 @@ int display_read_timing(struct udevice *dev, struct display_timing *timing)
 	return edid_get_timing(buf, ret, timing, &panel_bits_per_colour);
 }
 
+int display_power_on(struct udevice *dev, void *data)
+{
+	struct dm_display_ops *ops = display_get_ops(dev);
+
+	if (!ops || !ops->power_on)
+		return -ENOSYS;
+
+	return ops->power_on(dev, data);
+}
+
 bool display_in_use(struct udevice *dev)
 {
 	struct display_plat *disp_uc_plat = dev_get_uclass_platdata(dev);
diff --git a/include/display.h b/include/display.h
index d0a08d4aaa..bb263be246 100644
--- a/include/display.h
+++ b/include/display.h
@@ -51,6 +51,15 @@ int display_enable(struct udevice *dev, int panel_bpp,
  */
 bool display_in_use(struct udevice *dev);
 
+/**
+ * display_power_on() - Power on display port device
+ *
+ * @dev:	Device to power on
+ * @data:	Optional data needed to power on the display correctly
+ * @return 0 if OK, -ve on error
+ */
+int display_power_on(struct udevice *dev, void *data);
+
 struct dm_display_ops {
 	/**
 	 * read_timing() - Read information directly
@@ -81,6 +90,15 @@ struct dm_display_ops {
 	 */
 	int (*enable)(struct udevice *dev, int panel_bpp,
 		      const struct display_timing *timing);
+
+	/**
+	 * power_on() - Power on display port device
+	 *
+	 * @dev:	Device to power on
+	 * @data:	Optional data needed to power on the display correctly
+	 * @return 0 if OK, -ve on error
+	 */
+	int (*power_on)(struct udevice *dev, void *data);
 };
 
 #define display_get_ops(dev)	((struct dm_display_ops *)(dev)->driver->ops)
-- 
2.16.1



More information about the U-Boot mailing list