[PATCH 68/72] imx-drm: imx-ldb: Use DDC probe as connection detect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a ddc node was specified in the device tree, use it in
imx_ldb_connector_detect() to probe the ddc with drm_probe_ddc(), if
the result is success, we know there is a display connected so return
connected status. Otherwise (no ddc specified in DT) we just have to
assume connected status.

Signed-off-by: Steve Longerbeam <steve_longerbeam@xxxxxxxxxx>
---
 drivers/staging/imx-drm/imx-ldb.c |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c
index 615e090..319eedb 100644
--- a/drivers/staging/imx-drm/imx-ldb.c
+++ b/drivers/staging/imx-drm/imx-ldb.c
@@ -92,10 +92,32 @@ struct imx_ldb {
 #define imx_ldb_entry_dbg(ch)			\
 	imx_ldb_dbg((ch), "%s\n", __func__)
 
+/*
+ * Use the result of ddc probe to detect LVDS display presence
+ * if a ddc DT node was specified.
+ */
 static enum drm_connector_status imx_ldb_connector_detect(
 		struct drm_connector *connector, bool force)
 {
-	return connector_status_connected;
+	struct imx_ldb_channel *imx_ldb_ch = con_to_imx_ldb_ch(connector);
+	enum drm_connector_status status;
+
+	if (imx_ldb_ch->ddc) {
+		if (drm_probe_ddc(imx_ldb_ch->ddc)) {
+			status = connector_status_connected;
+			imx_ldb_dbg(imx_ldb_ch,
+				    "ddc probe success, connected\n");
+		} else {
+			status = connector_status_disconnected;
+			imx_ldb_dbg(imx_ldb_ch,
+				    "ddc probe failed, disconnected\n");
+		}
+	} else {
+		status = connector_status_connected;
+		imx_ldb_dbg(imx_ldb_ch, "no ddc, assuming connected\n");
+	}
+
+	return status;
 }
 
 static int imx_ldb_connector_get_modes(struct drm_connector *connector)
-- 
1.7.9.5

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux