[PATCH v4 03/11] drm: Helper to read DP branch device type

Mika Kahola mika.kahola at intel.com
Mon Jun 6 13:29:05 UTC 2016


Helper routine to read out DisplayPort branch device type. The spec
defines these type as following

	0   DisplayPort
	1   Analog VGA
	2   DVI
	3   HDMI
	4   Others without EDID support
	5   DP++
	6   Wireless
	7   Reserved

Signed-off-by: Mika Kahola <mika.kahola at intel.com>
---
 drivers/gpu/drm/drm_dp_helper.c | 14 ++++++++++++++
 include/drm/drm_dp_helper.h     |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index c4149fd..7d3b245 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -465,6 +465,20 @@ int drm_dp_downstream_port_cap(struct drm_dp_aux *aux,
 }
 EXPORT_SYMBOL(drm_dp_downstream_port_cap);
 
+/**
+ * drm_dp_downstream_type() - extract downstream port type
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
+ *
+ * Returns type in success or negative error code on failure
+ */
+int drm_dp_downstream_type(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+			   const u8 port_cap[4])
+{
+	return port_cap[0] & DP_DS_PORT_TYPE_MASK;
+}
+EXPORT_SYMBOL(drm_dp_downstream_type);
+
 /*
  * I2C-over-AUX implementation
  */
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index db8d3d47..f290829 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -809,6 +809,7 @@ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_downstream_port_cap(struct drm_dp_aux *aux,
 			       const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 			       u8 port_cap[4]);
+int drm_dp_downstream_type(const u8 dpcd[DP_RECEIVER_CAP_SIZE], const u8 port_cap[4]);
 
 int drm_dp_aux_register(struct drm_dp_aux *aux);
 void drm_dp_aux_unregister(struct drm_dp_aux *aux);
-- 
1.9.1



More information about the dri-devel mailing list