[Intel-gfx] [PATCH 02/12] drm/i915: Add a function to compute the EDID checksum for Displayport compliance
Todd Previte
tprevite at gmail.com
Mon Jul 14 21:10:37 CEST 2014
This function computes the EDID checksum for a block of EDID data. This function
is necessary for Displayport compliance testing as it does not not require the
complete EDID checking functionality provided by the DRM layer functions.
Signed-off-by: Todd Previte <tprevite at gmail.com>
---
drivers/gpu/drm/i915/intel_dp.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 0d11145..f61502e 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3328,6 +3328,29 @@ intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
sink_irq_vector, 1) == 1;
}
+static bool intel_dp_compute_edid_checksum(uint8_t *edid_data, uint8_t *edid_checksum)
+{
+ uint32_t byte_total = 0;
+ uint8_t i = 0;
+ bool edid_ok = true;
+
+ /* Compute byte total w/o the checksum value*/
+ for (i = 0; i < EDID_LENGTH - 2; i++)
+ byte_total += edid_data[i];
+
+ DRM_DEBUG_KMS("Displayport: EDID total = %d, EDID checksum = %d\n", byte_total, edid_data[EDID_LENGTH - 1]);
+
+ /* Compute the checksum */
+ *edid_checksum = 256 - (byte_total % 256);
+
+ if (*edid_checksum != edid_data[EDID_LENGTH - 1]) {
+ DRM_DEBUG_KMS("Displayport: Invalid EDID checksum %d, should be %d\n", edid_data[EDID_LENGTH - 1], *edid_checksum);
+ edid_ok = false;
+ }
+
+ return edid_ok;
+}
+
/* Displayport compliance testing - Link training */
static uint8_t
intel_dp_autotest_link_training(struct intel_dp *intel_dp)
--
1.9.1
More information about the Intel-gfx
mailing list