From patchwork Mon Jul 14 19:10:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Previte X-Patchwork-Id: 4548731 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 DA6189F2F4 for ; Mon, 14 Jul 2014 19:11:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A83F2011E for ; Mon, 14 Jul 2014 19:11:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1E07A2015E for ; Mon, 14 Jul 2014 19:11:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A86086E464; Mon, 14 Jul 2014 12:11:30 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by gabe.freedesktop.org (Postfix) with ESMTP id 903A96E468 for ; Mon, 14 Jul 2014 12:11:29 -0700 (PDT) Received: by mail-pa0-f45.google.com with SMTP id rd3so5881437pab.32 for ; Mon, 14 Jul 2014 12:11:29 -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=4uKlGWj/rn9AoqGqvLe435qE/OgsiK1a4Ue7bri1qYY=; b=O2abp3XxG1dqQKyL+e+Uyqyo5JWN/TNS2yYBtWzIdIVvaROR0Y217m8RGddXlmElqV 0IyQSlr2LymPT1IzH9hL6d+jIuvSFv+Em3Cx22dI+gVQ3r0qe6DVdmwb01fgjI/TLIuH sduPq2YnnlIvO9X1xV+9u4qYy2sVMFfMbODI0pU1TbJq7wsba8NwFCpmZnaQIFgOn3KU DDojrHESwbv21DH8wSGhRER7R/FtkVN0I4IUJAndOLw+8DTFda19SBDLs7SH/8Sz/G6v ajyQBuJthwbrUkikF40G3PL7WrtG8UEXP3LQKD4b1OibN6xE2aBg8cHJW7W5W1x98rxT Kgwg== X-Received: by 10.68.190.231 with SMTP id gt7mr26873pbc.148.1405365089482; Mon, 14 Jul 2014 12:11:29 -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.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Jul 2014 12:11:28 -0700 (PDT) From: Todd Previte To: intel-gfx@lists.freedesktop.org Date: Mon, 14 Jul 2014 12:10:42 -0700 Message-Id: <1405365047-6866-8-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 07/12] drm/i915: Update EDID automated test function 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=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 an updated version of the automated testing function that handles Displayport compliance for EDID operations. Signed-off-by: Todd Previte --- drivers/gpu/drm/i915/intel_dp.c | 77 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 33b6dc9..88f1bbe 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -3408,7 +3408,82 @@ intel_dp_autotest_video_pattern(struct intel_dp *intel_dp) static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp) { - uint8_t test_result = DP_TEST_NAK; + 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, checksum = 0; + uint32_t i = 0, ret = 0; + struct drm_display_mode *use_mode = NULL; + int mode_count = 0; + struct drm_mode_set modeset; + + DRM_DEBUG_KMS("Displayport: EDID automated test\n"); + + /* Reset the NACK/DEFER counters */ + intel_dp->aux.i2c_nack_count = 0; + intel_dp->aux.i2c_defer_count = 0; + /* Now read out the EDID */ + edid_read = drm_get_edid(connector, adapter); + + if (edid_read == NULL) { + /* Check for NACKs/DEFERs, goto failsafe if detected + (DP CTS 1.2 Core Rev 1.1, 4.2.2.4, 4.2.2.5) */ + if (intel_dp->aux.i2c_nack_count > 0 || + intel_dp->aux.i2c_defer_count > 0) + DRM_DEBUG_KMS("Displayport: EDID read generated %d I2C NACKs, %d DEFERs\n", + intel_dp->aux.i2c_nack_count, + intel_dp->aux.i2c_defer_count); + goto failsafe; + } + + /* FIXME: Need to determine how to detect E-DDC here (4.2.2.9) */ + edid_data = (uint8_t *) edid_read; + + if (intel_dp_compute_edid_checksum(edid_data, &checksum)) { + /* 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; + } else { + /* Invalid checksum - EDID corruption detection test */ + goto failsafe; + } + + /* Update EDID modes */ + mode_count = intel_connector_update_modes(connector, edid_read); + if (!mode_count) { + DRM_DEBUG_KMS("Displayport: Mode update failed\n"); + goto failsafe; + } + + /* Get the EDID preferred mode if available */ + use_mode = intel_dp_get_edid_preferred_mode(intel_dp); + if (use_mode == NULL) + goto failsafe; + else + goto set_mode; + +failsafe: + DRM_DEBUG_KMS("Displayport: Setting failsafe display mode\n"); + use_mode = intel_dp_get_failsafe_mode(); + /* FIXME: Need to set DP to 6bpc here as well */ + intel_dp->attached_connector->encoder->new_crtc->config.pipe_bpp = 18; + +set_mode: + /* Configure the display mode necessary */ + modeset.connectors = &connector; + modeset.num_connectors = 1; + modeset.crtc = connector->encoder->crtc; + modeset.fb = modeset.crtc->primary->fb; + modeset.x = 0; + modeset.y = 0; + modeset.mode = use_mode; + /* Set the config */ + intel_dp_set_config(&modeset); + return test_result; }