All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 13/20] video: Track whether a display is in use
Date: Mon, 31 Oct 2016 14:39:29 -0600	[thread overview]
Message-ID: <1477946376-29471-14-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1477946376-29471-1-git-send-email-sjg@chromium.org>

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>
---

 drivers/video/display-uclass.c | 18 +++++++++++++++++-
 include/display.h              | 10 ++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

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",
diff --git a/include/display.h b/include/display.h
index b1c4766..d0a08d4 100644
--- a/include/display.h
+++ b/include/display.h
@@ -16,10 +16,12 @@ struct display_timing;
  * @source_id:	ID for the source of the display data, typically a video
  * controller
  * @src_dev:	Source device providing the video
+ * @in_use:	Display is being used
  */
 struct display_plat {
 	int source_id;
 	struct udevice *src_dev;
+	bool in_use;
 };
 
 /**
@@ -41,6 +43,14 @@ int display_read_timing(struct udevice *dev, struct display_timing *timing);
 int display_enable(struct udevice *dev, int panel_bpp,
 		   const struct display_timing *timing);
 
+/**
+ * display_in_use() - Check if a display is in use by any device
+ *
+ * @return true if the device is in use (display_enable() has been called
+ * successfully), else false
+ */
+bool display_in_use(struct udevice *dev);
+
 struct dm_display_ops {
 	/**
 	 * read_timing() - Read information directly
-- 
2.8.0.rc3.226.g39d4020

  parent reply	other threads:[~2016-10-31 20:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-31 20:39 [U-Boot] [PATCH 00/20] rockchip: Add support for Asus Chromebit Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 01/20] rockchip: video: Correct HDMI data source selection Simon Glass
2016-10-31 20:57   ` Andrew F. Davis
2016-10-31 20:39 ` [U-Boot] [PATCH 02/20] rockchip: video: Correct VOP clock selection Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 03/20] rockchip: Allow jerry to use of-platdata Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 04/20] dm: core: Handle global_data moving in SPL Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 05/20] stdio: Correct code style nits Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 06/20] stdio: Correct numbering logic in stdio_probe_device() Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 07/20] spi: Add of-platdata support to SPI and SPI flash Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 08/20] rockchip: spi: Add support for of-platdata Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 09/20] rockchip: spi: Honour the deactivation delay Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 10/20] spi: Add error checking for invalid bus widths Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 11/20] spi: Add a debug() on bind failure Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 12/20] video: Use cache-alignment in video_sync() Simon Glass
2016-10-31 20:39 ` Simon Glass [this message]
2016-10-31 20:39 ` [U-Boot] [PATCH 14/20] rockchip: video: Check for device in use Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 15/20] rockchip: Move jerry to use of-platdata Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 16/20] rockchip: Rename jerry files to veyron Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 17/20] rockchip: Move jerry SDRAM settings into its own .dts file Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 18/20] rockchip: clk: Support setting ACLK Simon Glass
2016-11-04  1:05   ` Kever Yang
2016-10-31 20:39 ` [U-Boot] [PATCH 19/20] rockchip: veyron: Adjust ARM clock after relocation Simon Glass
2016-10-31 20:39 ` [U-Boot] [PATCH 20/20] rockchip: Add support for veyron-mickey (Chromebit) Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477946376-29471-14-git-send-email-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.