From patchwork Wed Dec 10 23:53:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Previte X-Patchwork-Id: 5473411 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 0984E9F1D4 for ; Wed, 10 Dec 2014 23:54:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1BA8420172 for ; Wed, 10 Dec 2014 23:54:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2465C2016C for ; Wed, 10 Dec 2014 23:54:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 87E9D7A03B; Wed, 10 Dec 2014 15:54:26 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pd0-f182.google.com (mail-pd0-f182.google.com [209.85.192.182]) by gabe.freedesktop.org (Postfix) with ESMTP id 19CA97A03E for ; Wed, 10 Dec 2014 15:54:25 -0800 (PST) Received: by mail-pd0-f182.google.com with SMTP id p10so3785228pdj.13 for ; Wed, 10 Dec 2014 15:54:24 -0800 (PST) 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=TsZinMqQzTATAN+ivOzAdVtaod2VrJlYfr3T77wkDNI=; b=umDBmUwv7BWL7vi1Yxg7s9niRxhqxOODKUaLLIru7NTpW64nZ8LuD968B7GSP0Tm3h Y5tAufRKXccqsXlQZAq+jr1OWMlB07ZZt3JOTHhLzQ5FtUrZm1G0FfIYv3esH0Y3zWCl cAm4lGo7kFKyxFeOrsiDpQ+hf1FVKYiX/vasDz379FCdFzshpMdWZapMJmrA5wBnvJt7 4nQ6aJUpB91NGKUPfI/+WQZWj0fpT7uzM44541BYUM/35UQk7CCxHKdaAdMOXzV3i+sZ b/D4Ib6eXabzwJqSuQyxkgI1xVwmZzSvbFws2FigYh0B9Fo43Gma7gOsCnlx85CC0224 lZPQ== X-Received: by 10.66.156.197 with SMTP id wg5mr11339290pab.145.1418255664909; Wed, 10 Dec 2014 15:54:24 -0800 (PST) Received: from localhost.localdomain (ip68-3-234-27.ph.ph.cox.net. [68.3.234.27]) by mx.google.com with ESMTPSA id gy10sm5164958pbd.67.2014.12.10.15.54.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Dec 2014 15:54:23 -0800 (PST) From: Todd Previte To: intel-gfx@lists.freedesktop.org Date: Wed, 10 Dec 2014 16:53:16 -0700 Message-Id: <1418255597-4716-17-git-send-email-tprevite@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1418255597-4716-1-git-send-email-tprevite@gmail.com> References: <1418255597-4716-1-git-send-email-tprevite@gmail.com> Subject: [Intel-gfx] [PATCH 16/17] drm/i915: Add new debugfs file for Displaypor compliance test control X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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 Adds a new file for controlling Displayport compliance testing via the debugfs interface. Adds two functions, 'open' and 'show', as well as the file operations structure to support reading the file from userspace. The new file is called 'i915_dp_test_ctl' and contains 4 fields: - Connector name - Test data - Test active flag - Test response These four fields are used to control communication and operation between the userspace application and the kernel during compliance testing. A new variable is also added to the intel_dp struct to hold the response code from the user application. This response code is then sent to the sink device upon completion of the test. Signed-off-by: Todd Previte --- drivers/gpu/drm/i915/i915_debugfs.c | 66 ++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 846b2fb..d2cd684 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -54,6 +54,7 @@ static const char *yesno(int v) #define DP_PARAMETER_COUNT 8 #define MAX_DP_CONFIG_LINE_COUNT 64 +#define DP_TEST_CTRL_LINE_COUNT 4 enum dp_config_param { DP_CONFIG_PARAM_INVALID = -1, @@ -67,6 +68,14 @@ enum dp_config_param { DP_CONFIG_PARAM_BPP }; +enum dp_ctrl_param { + DP_CTRL_PARAM_INVALID = -1, + DP_CTRL_PARAM_CONNECTOR = 0, + DP_CTRL_PARAM_TEST_DATA = 1, + DP_CTRL_PARAM_TEST_ACTIVE = 2, + DP_CTRL_PARAM_TEST_RESPONSE = 3 +}; + struct dp_config { enum dp_config_param type; unsigned long value; @@ -4054,6 +4063,60 @@ static const struct file_operations i915_displayport_config_ctl_fops = { .write = displayport_config_ctl_write }; +static int displayport_test_ctl_show(struct seq_file *m, void *data) +{ + struct drm_device *dev = m->private; + struct drm_connector *connector; + struct intel_encoder *intel_encoder; + struct intel_connector *intel_connector; + struct intel_dp *intel_dp; + + if (!dev) + return -ENODEV; + + list_for_each_entry(connector, &dev->mode_config.connector_list, head) { + intel_connector = to_intel_connector(connector); + intel_encoder = intel_connector->encoder; + + seq_printf(m, DP_CONF_STR_CONNECTOR, + intel_connector->base.name); + + if (dp_connector_is_valid(connector, 1)) { + intel_encoder = intel_connector->encoder; + intel_dp = enc_to_intel_dp(&intel_encoder->base); + /* Compliance test data informs userspace about current + request + */ + seq_printf(m, "Test Data : %08lx\n", + intel_dp->compliance_test_data); + seq_printf(m, "Test Active: %02x\n", + intel_dp->compliance_testing_active); + seq_printf(m, "Test Response: %02lx\n", + intel_dp->compliance_test_response); + } else { + seq_puts(m, "disconnected\n"); + } + } + + return 0; +} + +static int displayport_test_ctl_open(struct inode *inode, + struct file *file) +{ + struct drm_device *dev = inode->i_private; + + return single_open(file, displayport_test_ctl_show, dev); +} + +static const struct file_operations i915_dp_test_ctl_fops = { + .owner = THIS_MODULE, + .open = displayport_test_ctl_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static void wm_latency_show(struct seq_file *m, const uint16_t wm[8]) { struct drm_device *dev = m->private; @@ -4806,7 +4869,8 @@ static const struct i915_debugfs_files { {"i915_spr_wm_latency", &i915_spr_wm_latency_fops}, {"i915_cur_wm_latency", &i915_cur_wm_latency_fops}, {"i915_fbc_false_color", &i915_fbc_fc_fops}, - {"i915_displayport_config_ctl", &i915_displayport_config_ctl_fops} + {"i915_displayport_config_ctl", &i915_displayport_config_ctl_fops}, + {"i915_dp_test_ctl", &i915_dp_test_ctl_fops} }; void intel_display_crc_init(struct drm_device *dev) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 5a8b1d6..eff3a14 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -653,6 +653,7 @@ struct intel_dp { /* Displayport compliance testing */ unsigned long compliance_test_data; bool compliance_testing_active; + unsigned long compliance_test_response; struct intel_dp_link_config compliance_config; struct intel_dp_link_config saved_config;