From patchwork Tue Jun 24 22:12:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Previte X-Patchwork-Id: 4414411 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E2626BEEAA for ; Tue, 24 Jun 2014 22:13:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 16B7220272 for ; Tue, 24 Jun 2014 22:13:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3063020263 for ; Tue, 24 Jun 2014 22:13:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C539D6E5B8; Tue, 24 Jun 2014 15:13:36 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by gabe.freedesktop.org (Postfix) with ESMTP id 845376E5BC for ; Tue, 24 Jun 2014 15:13:34 -0700 (PDT) Received: by mail-pa0-f51.google.com with SMTP id hz1so813078pad.24 for ; Tue, 24 Jun 2014 15:13:34 -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=FTmDEnggQY4r32VfRWnDALfFnDFri3Bf9h+khBRLafc=; b=bZy64dxvU3vUOflUzCi+n4tJ+HjbTdsIDIwgRtHWKG+eoe/5uhbumohiO+0cr8y/QI 4czRxIt52LkBvnpViyeZcDKyems92H2BfQZ/jSIchntfB+Y94qwnH0lFnBlvF3xTmM3w lmDKhaSLgnoiMBaYevsOJXKKwQgtdm+e9aG2JqTZMhnhqWUVhdmVf3Hh9IU6kXzTweRD 6VH9OrC6WH/t6jx61GYxFAQCF1UzV9AkE3qAr6OEkfMZGaXXRX3c3ziO/ufLQgDtUVsL dKjl26LpIanayuQBAVjmtTNJgeRqlh/hLFTv3wXtno7fM2k3p9wPylcUruXK+GiixAqV pTag== X-Received: by 10.66.189.169 with SMTP id gj9mr5247184pac.149.1403648014331; Tue, 24 Jun 2014 15:13:34 -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 bc4sm2023698pbb.2.2014.06.24.15.13.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jun 2014 15:13:33 -0700 (PDT) From: Todd Previte To: intel-gfx@lists.freedesktop.org Date: Tue, 24 Jun 2014 15:12:51 -0700 Message-Id: <1403647974-42377-4-git-send-email-tprevite@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1403647974-42377-1-git-send-email-tprevite@gmail.com> References: <1403647974-42377-1-git-send-email-tprevite@gmail.com> Subject: [Intel-gfx] [PATCH 3/6] drm/i915: Implement basic Displayport automated testing function for EDID operations 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, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Implements some of the basic EDID tests for Displayport compliance. These tests include reading the EDID, verifying the checksum and writing the test responses back to the sink device. Signed-off-by: Todd Previte --- drivers/gpu/drm/i915/intel_dp.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 43fcabe..d060853 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -3352,8 +3352,42 @@ intel_dp_autotest_video_pattern(struct intel_dp *intel_dp) static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp) { + struct drm_connector *connector = &intel_dp->attached_connector->base; + struct i2c_adapter *adapter = &intel_dp->aux.ddc; + struct edid *edid_read = NULL; + uint8_t *edid_data = NULL; uint8_t test_result = DP_TEST_NAK; - return test_result; + uint32_t i = 0, ret = 0, checksum = 0; + struct drm_display_mode *use_mode = NULL; + dp_compliance_mode comp_mode_type = DP_COMPLIANCE_MODE_PREFERRED; + int mode_count = 0; + + edid_read = drm_get_edid(connector, adapter); + + DRM_DEBUG_KMS("Displayport: EDID automated test\n"); + + if (edid_read) { + test_result = true; + edid_data = (uint8_t*) edid_read; + // Compute checksum + for (i = 0; i < 128; i++) + checksum += edid_data[i]; + + DRM_DEBUG_KMS("Displayport: EDID test - computed byte sum = %02x\n", checksum); + // Verify EDID checksum + if (checksum % 256 == 0) { + /* Write the checksum to EDID checksum register */ + ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TEST_EDID_CHECKSUM, &edid_read->checksum, 1); + // Reponse is ACK and and checksum written + test_result = DP_TEST_ACK | DP_TEST_EDID_CHECKSUM_WRITE; + DRM_DEBUG_KMS("Displayport: EDID test - checksum = %02x\n", edid_read->checksum); + } + else { + // Invalid checksum, set for failsafe mode + comp_mode_type = DP_COMPLIANCE_MODE_FAILSAFE; + } + } + return test_result; } /* Displayport compliance testing - PHY pattern testing */