From patchwork Wed Dec 10 23:53:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Previte X-Patchwork-Id: 5473311 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 28DEDBEEA8 for ; Wed, 10 Dec 2014 23:54:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C9A1200DF for ; Wed, 10 Dec 2014 23:54:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6BED020172 for ; Wed, 10 Dec 2014 23:54:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB1976E707; Wed, 10 Dec 2014 15:54:06 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by gabe.freedesktop.org (Postfix) with ESMTP id CD3506E707 for ; Wed, 10 Dec 2014 15:54:05 -0800 (PST) Received: by mail-pa0-f43.google.com with SMTP id kx10so3806257pab.16 for ; Wed, 10 Dec 2014 15:54:05 -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=45rBX4AwbO3YlXGrfTeqNj3BaeRxrScTDXg/ZCNXVRE=; b=ZXAduwkpWs7Bmi/adxVPpIAwMZ7MUyn0mZEDSHg5v9S83M0nyks/BgyRv45rDR1yYJ okwwqTWrtw18sl9xDRO+heIPQ6f1YdW8DgCRYcvObGqh+zghdJHWGJ9pvCNSwZC4q9o0 4p6MUbh5iEa9hCc3Tr6drqMR1dRjkLS2x69jAnPaivahjYQOEbIf4yz3fS9D4/rMtGEy LO2hgfz5YTvd6V+HHp6KQS+dehdbTLH62VH3koGEeIF9J5OQuDiVAeXaph+RD+HSX2PG JZNHrAOpInBcUNDACNRN/uyz+szSYU9UpDTOuimMcfJdkNDhEfJMHHz5Z/HRa1jNe6Eq 6aoQ== X-Received: by 10.68.220.137 with SMTP id pw9mr11924063pbc.146.1418255645736; Wed, 10 Dec 2014 15:54:05 -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.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Dec 2014 15:54:04 -0800 (PST) From: Todd Previte To: intel-gfx@lists.freedesktop.org Date: Wed, 10 Dec 2014 16:53:06 -0700 Message-Id: <1418255597-4716-7-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 06/17] drm/i915: Add support functions in debugfs for handling Displayport compliance configuration 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 This patch was previously part of "[PATCH 05/10] drm/i915: Add debugfs interface for Displayport debug and compliance testing". Adds two support functions for handling Displayport configuration parameters that are used for compliance testing. Signed-off-by: Todd Previte --- drivers/gpu/drm/i915/i915_debugfs.c | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index feae100..ce091c1 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -3694,6 +3694,54 @@ static const struct file_operations i915_display_crc_ctl_fops = { .write = display_crc_ctl_write }; +enum dp_config_param displayport_get_config_param_type(char *input_string) +{ + enum dp_config_param param_type = DP_CONFIG_PARAM_INVALID; + int i = 0; + + for (i = 0; i < DP_PARAMETER_COUNT; i++) { + if (strncmp(input_string, dp_conf_tokens[i], + strlen(dp_conf_tokens[i])) == 0) { + param_type = (enum dp_config_param) i; + break; + } + } + return param_type; +} + +int value_for_config_param(enum dp_config_param param, + char *input_string, + void *output_value) +{ + int status = 0; + unsigned int *out_ptr = (unsigned int *)output_value; + char *index = input_string; + + switch (param) { + case DP_CONFIG_PARAM_CONNECTOR: + output_value = (char *)index; + break; + case DP_CONFIG_PARAM_LINK_RATE: + case DP_CONFIG_PARAM_LANE_COUNT: + case DP_CONFIG_PARAM_VOLTAGE_SWING: + case DP_CONFIG_PARAM_PREEMPHASIS: + status = kstrtol(index, 16, (long *)out_ptr); + break; + case DP_CONFIG_PARAM_HRES: + case DP_CONFIG_PARAM_VRES: + case DP_CONFIG_PARAM_BPP: + status = kstrtol(index, 10, (long *)out_ptr); + break; + default: + /* Unhandled case */ + status = -EINVAL; + *out_ptr = 0; + break; + } + + return status; +} + static int displayport_config_ctl_open(struct inode *inode, struct file *file) {