[PATCH v4 02/11] drm: Read DP downstream port capabilities

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


Read DisplayPort downstream port capabilities. Depending on
the DP port the capabilities are defined in length of 1 byte
or 4 bytes depending if the detailed capability information is
available.

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

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index eeaf5a7..c4149fd 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -438,6 +438,33 @@ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link)
 }
 EXPORT_SYMBOL(drm_dp_link_configure);
 
+/**
+ * drm_dp_downstream_port_cap() - read downstream port capabilities
+ * @dpcd: DisplayPort configuration data
+ * @port_cap: port capabilities
+ *
+ * returns size of the port capabilites
+ */
+int drm_dp_downstream_port_cap(struct drm_dp_aux *aux,
+			       const u8 dpcd[DP_RECEIVER_CAP_SIZE],
+			       u8 port_cap[4])
+{
+	int size;
+	bool detailed_cap_info = dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+		DP_DETAILED_CAP_INFO_AVAILABLE;
+
+	if (detailed_cap_info) {
+		size = 4;
+		drm_dp_dpcd_read(aux, DP_DOWNSTREAM_PORT_0, port_cap, size);
+	} else {
+		size = 1;
+		drm_dp_dpcd_read(aux, DP_DOWNSTREAM_PORT_0, &port_cap[0], size);
+	}
+
+	return size;
+}
+EXPORT_SYMBOL(drm_dp_downstream_port_cap);
+
 /*
  * I2C-over-AUX implementation
  */
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index e384c7f..db8d3d47 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -806,6 +806,9 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link);
 int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link);
 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_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