From patchwork Mon Jul 14 19:10:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Previte X-Patchwork-Id: 4548711 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 80827C0514 for ; Mon, 14 Jul 2014 19:11:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE79920158 for ; Mon, 14 Jul 2014 19:11:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E2F2A2011E for ; Mon, 14 Jul 2014 19:11:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B4246E176; Mon, 14 Jul 2014 12:11:27 -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 12EA16E464 for ; Mon, 14 Jul 2014 12:11:26 -0700 (PDT) Received: by mail-pa0-f45.google.com with SMTP id rd3so5874235pab.4 for ; Mon, 14 Jul 2014 12:11:25 -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=BF9lcSVzp7dXVE5QXg6mI5ywv2Ej+LjHntQs1oAnmso=; b=ngfgbB83344S4q0le+M3Q1wIGIISwFfTb6IhDBRtpLEbhtfhIA+JeyWxlpiLOjQvch vNRS3yXrPTsjw/QvCVHvl/dT0/wj09cPwG6fNnCuFZ5/frWRLsMOJxA1TsugPBzJIbLx FaC9ncei0TvQFVI8sq5Xlptiu98fu4/6zCktciHnpyh/ITaNTGKTNpNFrd+kJK9tO0Bh xJmcyDiCtFFIKdSOVcGb+ejqdXbVSwL22kVoje7lD01hlZM0R7S2cMzz0TeEsc/E7HCw tCnLkBDpB5iemRwVPQBYma4nu6DYZ0ZQFTt69wBs5IjmtgXKq6H41Wce2NfdbNN7FljE 7K9Q== X-Received: by 10.66.251.98 with SMTP id zj2mr4471461pac.115.1405365085890; Mon, 14 Jul 2014 12:11:25 -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.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Jul 2014 12:11:24 -0700 (PDT) From: Todd Previte To: intel-gfx@lists.freedesktop.org Date: Mon, 14 Jul 2014 12:10:40 -0700 Message-Id: <1405365047-6866-6-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 05/12] drm/i915: Add a function to get the EDID preferred mode for Displayport compliance testing 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 Add a simple function to pull the preferred mode out of an EDID block. This function is designed for use during Displayport compliance testing. Signed-off-by: Todd Previte --- drivers/gpu/drm/i915/intel_dp.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f61502e..6c8f222 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -3351,6 +3351,31 @@ static bool intel_dp_compute_edid_checksum(uint8_t *edid_data, uint8_t *edid_che return edid_ok; } +static struct drm_display_mode* +intel_dp_get_edid_preferred_mode(struct intel_dp *intel_dp) +{ + struct drm_display_mode *found_mode = NULL; + struct drm_connector *connector = &intel_dp->attached_connector->base; + int mode_count = 0; + + list_for_each_entry(found_mode, &connector->probed_modes, head) { + /* Check for a preferred mode */ + if (found_mode->type & DRM_MODE_TYPE_PREFERRED) { + /* Found the preferred mode, return it */ + DRM_DEBUG_KMS("Displayport: Found preferred mode '%s'\n", + found_mode->name); + goto exit_with_mode; + } + mode_count++; + } + /* No mode found, report the error */ + DRM_DEBUG_KMS("Displayport: Preferred mode not found in %d probed modes\n", + mode_count); + +exit_with_mode: + return found_mode; +} + /* Displayport compliance testing - Link training */ static uint8_t intel_dp_autotest_link_training(struct intel_dp *intel_dp)