diff mbox

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

Message ID 1414796095-10107-69-git-send-email-steve_longerbeam@mentor.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Longerbeam Oct. 31, 2014, 10:54 p.m. UTC
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@mentor.com>
---
 drivers/staging/imx-drm/imx-ldb.c |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

Comments

Philipp Zabel Nov. 4, 2014, 5:57 p.m. UTC | #1
Am Freitag, den 31.10.2014, 15:54 -0700 schrieb Steve Longerbeam:
> 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.

This is a nice trick, unless of course you have a board with multiple
possible panels, not all of them including the EDID EEPROM. In that case
I guess ddc channel property + fallback timing in DT could always report
a connected panel.

regards
Philipp
diff mbox

Patch

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)