[PATCH 03/10] drm/i915: Add EDID read in intel_dp_check_link_status() for Link CTS 4.2.2.1

Todd Previte
2015-04-15T15:39:05Z

Adds in an EDID read after the DPCD read to accommodate test 4.2.2.1 in the
Displayport Link CTS Core 1.2 rev1.1. This test requires an EDID read for
all HPD plug events. To reduce the amount of code, this EDID read is also
used for Link CTS tests 4.2.2.3, 4.2.2.4, 4.2.2.5 and 4.2.2.6. Actual
support for these tests is implemented in later patches in this series.

V2:
- Fixed compilation error introduced during rework
V3:
- Plugged a memory leak where the EDID data wasn't being freed
after allocation in this function
V4:
- Fixed whitespace problems
- Cleaned up formatting

Signed-off-by: Todd Previte <tprevite@gmail.com>
---
drivers/gpu/drm/i915/intel_dp.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 1352c00..c112359 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4114,11 +4114,24 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
{
struct drm_device *dev = intel_dp_to_dev(intel_dp);
struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
+ struct drm_connector *connector = &intel_dp->attached_connector->base;
+ struct i2c_adapter *adapter = &intel_dp->aux.ddc;
+ struct edid *edid_read = NULL;
u8 sink_irq_vector;
u8 link_status[DP_LINK_STATUS_SIZE];

WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));

+ /* Displayport Link CTS Core 1.2 rev1.1 EDID testing
+ * 4.2.2.1 - EDID read required for all HPD events
+ */
+ edid_read = drm_get_edid(connector, adapter);
+ if (!edid_read) {
+ DRM_DEBUG_DRIVER("Invalid EDID detected\n");
+ } else {
+ kfree(edid_read);
+ }
+
/* Try to read the source of the interrupt */
if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
intel_dp_get_sink_irq(intel_dp, &sink_irq_vector)) {