From patchwork Fri Oct 4 10:32:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Previte X-Patchwork-Id: 2987791 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 83B569F288 for ; Fri, 4 Oct 2013 10:30:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D1DE20459 for ; Fri, 4 Oct 2013 10:30:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9F88520444 for ; Fri, 4 Oct 2013 10:30:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A9B5AE5C3E for ; Fri, 4 Oct 2013 03:30:49 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by gabe.freedesktop.org (Postfix) with ESMTP id E5A69E6279 for ; Fri, 4 Oct 2013 03:30:36 -0700 (PDT) Received: by mail-pa0-f49.google.com with SMTP id ld10so3943274pab.36 for ; Fri, 04 Oct 2013 03:30:36 -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; bh=DoWtKM9+Y2H4tmITXID7PFa+KinlVa4Gl29uz7/qK2w=; b=eIyHy/zwnJ4OIOf34I/hYwznsgKRg1rWCHM57l383lpId/tFepLCorbrXVVAVHOq/F R5snIoezZOIHM0jl0yaEeDzoMTqwpBCON25o/NjGuwFE02F9D/7apTwNV3paVUtafcsV qkXURG2dw01u5mYXkeKv18njM2z1GC5C+QHUkxabX/2pggRSuynskWeFp0To3rtJbpef 9wiExAr9l1Ia2t0NMMKmTgGHuzZ2aazFVQJmG4+DZNDRUJ2iOtCOlJxOcf5ZtjEW88EO pHCgFOPz0nledBzewY7iyEaHTjWp4jp9ujI/YYb0p8/DDXIkQLLwg5buRVZcR8BAg63X xbyw== X-Received: by 10.68.172.66 with SMTP id ba2mr13818927pbc.92.1380882636524; Fri, 04 Oct 2013 03:30:36 -0700 (PDT) Received: from localhost.localdomain (udp116074uds.hawaiiantel.net. [72.235.203.227]) by mx.google.com with ESMTPSA id ef10sm17110031pac.1.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Oct 2013 03:30:35 -0700 (PDT) From: Todd Previte To: intel-gfx@lists.freedesktop.org Date: Fri, 4 Oct 2013 03:32:10 -0700 Message-Id: <1380882730-32207-1-git-send-email-tprevite@gmail.com> X-Mailer: git-send-email 1.8.1.2 Subject: [Intel-gfx] [PATCH] drm/i915: Implement Displayport automated testing X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.7 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 This initial patch adds support for automated testing of the source device to the i915 driver. Most of this patch is infrastructure for the tests; follow up patches will add support for the individual tests with updates to ACK the tests that are supported (or NAK if the test fails/is unsupported). Signed-off-by: Todd Previte --- drivers/gpu/drm/i915/intel_dp.c | 108 +++++++++++++++++++++++++++++++++++++++- include/drm/drm_dp_helper.h | 3 +- 2 files changed, 108 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 9770160..a042d59 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -64,6 +64,26 @@ static const struct dp_link_dpll vlv_dpll[] = { { .p1 = 2, .p2 = 2, .n = 1, .m1 = 2, .m2 = 27 } } }; +/****************************************************************************** +******** Displayport automated testing ******** +******************************************************************************/ +/* Automated testing function - link training */ +static bool +intel_dp_autotest_link_training(struct intel_dp *intel_dp); +/* Automated testing function - video test pattern */ +static bool +intel_dp_autotest_video_pattern(struct intel_dp *intel_dp); +/* Automated testing function - EDID read */ +static bool +intel_dp_autotest_edid(struct intel_dp *intel_dp); +/* Automated testing function - PHY pattern */ +static bool +intel_dp_autotest_phy_pattern(struct intel_dp *intel_dp); +/* Automated testing function - faux pattern */ +static bool +intel_dp_autotest_faux_pattern(struct intel_dp *intel_dp); +/*****************************************************************************/ + /** * is_edp - is the given port attached to an eDP panel (either CPU or PCH) * @intel_dp: DP struct @@ -2732,9 +2752,93 @@ intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector) static void intel_dp_handle_test_request(struct intel_dp *intel_dp) +{ + uint8_t response = DP_TEST_NAK; + bool result = false; + uint8_t rxdata = 0; + + printk(KERN_DEBUG "Displayport: Recvd automated test request\n"); + /* Read DP_TEST_REQUEST register to identify the requested test */ + intel_dp_aux_native_read_retry(intel_dp, DP_TEST_REQUEST, &rxdata, 1); + /* Determine which test has been requested */ + switch (rxdata) { + /* Supported tests handled below */ + case DP_TEST_LINK_TRAINING: + printk(KERN_DEBUG "Displayport: Executing LINK_TRAINING request\n"); + result = intel_dp_autotest_link_training(intel_dp); + break; + case DP_TEST_LINK_VIDEO_PATTERN: + printk(KERN_DEBUG "Displayport: Executing TEST_PATTERN request\n"); + result = intel_dp_autotest_video_pattern(intel_dp); + break; + case DP_TEST_LINK_EDID_READ: + printk(KERN_DEBUG "Displayport: Executing EDID request\n"); + result = intel_dp_autotest_edid(intel_dp); + break; + case DP_TEST_LINK_PHY_TEST_PATTERN: + printk(KERN_DEBUG "Displayport: Executing PHY_PATTERN request\n"); + result = intel_dp_autotest_phy_pattern(intel_dp); + break; + case DP_TEST_LINK_FAUX_TEST_PATTERN: + printk(KERN_DEBUG "Displayport: Executing FAUX_PATTERN request \n"); + result = intel_dp_autotest_faux_pattern(intel_dp); + break; + /* Unsupported test case or something went wrong */ + default: + /* Log error here for unhandled test request */ + printk(KERN_DEBUG "Displayport: Error - unhandled automated test type\n"); + break; + } + /* Check for a valid test execution */ + if (result == true) + response = DP_TEST_ACK; + /* Send ACK/NAK based on action taken above */ + intel_dp_aux_native_write_1(intel_dp, DP_TEST_RESPONSE, response); +} + +/* Automated testing function - link training */ +static bool +intel_dp_autotest_link_training(struct intel_dp *intel_dp) +{ + /* Automated test function hook */ + bool test_result = false; + return test_result; +} + +/* Automated testing function - video test pattern */ +static bool +intel_dp_autotest_video_pattern(struct intel_dp *intel_dp) +{ + /* Automated test function hook */ + bool test_result = false; + return test_result; +} + +/* Automated testing function - EDID read */ +static bool +intel_dp_autotest_edid(struct intel_dp *intel_dp) +{ + /* Automated test function hook */ + bool test_result = false; + return test_result; +} + +/* Automated testing function - PHY pattern */ +static bool +intel_dp_autotest_phy_pattern(struct intel_dp *intel_dp) +{ + /* Automated test function hook */ + bool test_result = false; + return test_result; +} + +/* Automated testing function - faux pattern */ +static bool +intel_dp_autotest_faux_pattern(struct intel_dp *intel_dp) { - /* NAK by default */ - intel_dp_aux_native_write_1(intel_dp, DP_TEST_RESPONSE, DP_TEST_NAK); + /* Automated test function hook */ + bool test_result = false; + return test_result; } /* diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index ae8dbfb..9fa544b 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -266,9 +266,10 @@ #define DP_TEST_REQUEST 0x218 # define DP_TEST_LINK_TRAINING (1 << 0) -# define DP_TEST_LINK_PATTERN (1 << 1) +# define DP_TEST_LINK_VIDEO_PATTERN (1 << 1) # define DP_TEST_LINK_EDID_READ (1 << 2) # define DP_TEST_LINK_PHY_TEST_PATTERN (1 << 3) /* DPCD >= 1.1 */ +# define DP_TEST_LINK_FAUX_TEST_PATTERN (1 << 4) /* DPCD >= 1.2 */ #define DP_TEST_LINK_RATE 0x219 # define DP_LINK_RATE_162 (0x6)