summaryrefslogtreecommitdiff
path: root/drivers/video/display-uclass.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-11-13 14:22:07 -0700
committerSimon Glass <sjg@chromium.org>2016-11-25 17:59:31 -0700
commit1b68283b64a7a1847410eff20886bd7bbfd8f9a6 (patch)
tree223069f02f6b0612d54217498c596c8e1bc3f1ce /drivers/video/display-uclass.c
parent7981394e550094bbbb2eb5e62065fa14c2ca77b0 (diff)
downloadu-boot-imx-1b68283b64a7a1847410eff20886bd7bbfd8f9a6.zip
u-boot-imx-1b68283b64a7a1847410eff20886bd7bbfd8f9a6.tar.gz
u-boot-imx-1b68283b64a7a1847410eff20886bd7bbfd8f9a6.tar.bz2
video: Track whether a display is in use
Mark a display as in use when display_enable() is called. This can avoid a display being used by multiple video-output devices. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/video/display-uclass.c')
-rw-r--r--drivers/video/display-uclass.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/video/display-uclass.c b/drivers/video/display-uclass.c
index e4763de..e752eb0 100644
--- a/drivers/video/display-uclass.c
+++ b/drivers/video/display-uclass.c
@@ -23,10 +23,19 @@ int display_enable(struct udevice *dev, int panel_bpp,
const struct display_timing *timing)
{
struct dm_display_ops *ops = display_get_ops(dev);
+ struct display_plat *disp_uc_plat;
+ int ret;
if (!ops || !ops->enable)
return -ENOSYS;
- return ops->enable(dev, panel_bpp, timing);
+ ret = ops->enable(dev, panel_bpp, timing);
+ if (ret)
+ return ret;
+
+ disp_uc_plat = dev_get_uclass_platdata(dev);
+ disp_uc_plat->in_use = true;
+
+ return 0;
}
int display_read_timing(struct udevice *dev, struct display_timing *timing)
@@ -48,6 +57,13 @@ int display_read_timing(struct udevice *dev, struct display_timing *timing)
return edid_get_timing(buf, ret, timing, &panel_bits_per_colour);
}
+bool display_in_use(struct udevice *dev)
+{
+ struct display_plat *disp_uc_plat = dev_get_uclass_platdata(dev);
+
+ return disp_uc_plat->in_use;
+}
+
UCLASS_DRIVER(display) = {
.id = UCLASS_DISPLAY,
.name = "display",