From patchwork Mon Jul 14 19:10:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Previte X-Patchwork-Id: 4548681 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 91D639F295 for ; Mon, 14 Jul 2014 19:11:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B48C72011E for ; Mon, 14 Jul 2014 19:11:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E6C9E20158 for ; Mon, 14 Jul 2014 19:11:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 89F2B6E463; Mon, 14 Jul 2014 12:11:21 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by gabe.freedesktop.org (Postfix) with ESMTP id 37D716E463 for ; Mon, 14 Jul 2014 12:11:20 -0700 (PDT) Received: by mail-pd0-f171.google.com with SMTP id z10so3435350pdj.2 for ; Mon, 14 Jul 2014 12:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oH16wnDByy17UDIEqNiXKntCw77uy//3csllJk+4hqI=; b=AC6EOwJZd8VQaL7SKHVDsyFNwFLXv2/4wMNjRKbFQcZ7P16prEv5QU26NH2z05Yngf cKIZD0FVREVyZbI36kdN64wvLTvdEneQgZY5HtzGsQOJavgfolY0MbM8d88O9roruCkK Lrms5Gu0ahjZrclROdBmGg44epOYbTM97LmQ4WmrHKFbMXhfWConAgYH2AAN/KM3oUit eEUhKja6dkgp4i2dL2MhcVEBKYq77KQ1B7AHGvehnBQgZ+cw6TXgyahUoAirWW5dBs0x uoQy9VktKwHGZg1d3Zd4AmVHYjyQEETtQ72dYG7qd+2HV901/eB4Y6OwKAgIuocLRPGN jegw== X-Received: by 10.70.53.169 with SMTP id c9mr42023pdp.148.1405365080111; Mon, 14 Jul 2014 12:11:20 -0700 (PDT) Received: from localhost.localdomain (ip72-201-95-47.ph.ph.cox.net. [72.201.95.47]) by mx.google.com with ESMTPSA id z5sm8049888pbt.81.2014.07.14.12.11.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Jul 2014 12:11:19 -0700 (PDT) From: Todd Previte To: intel-gfx@lists.freedesktop.org Date: Mon, 14 Jul 2014 12:10:37 -0700 Message-Id: <1405365047-6866-3-git-send-email-tprevite@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1405365047-6866-1-git-send-email-tprevite@gmail.com> References: <1405365047-6866-1-git-send-email-tprevite@gmail.com> Subject: [Intel-gfx] [PATCH 02/12] drm/i915: Add a function to compute the EDID checksum for Displayport compliance X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)