From patchwork Wed Dec 10 23:53:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Previte X-Patchwork-Id: 5473321 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 1C7FCBEEA8 for ; Wed, 10 Dec 2014 23:54:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41C3C2018E for ; Wed, 10 Dec 2014 23:54:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5DB08200DF for ; Wed, 10 Dec 2014 23:54:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D42176E70D; Wed, 10 Dec 2014 15:54:08 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by gabe.freedesktop.org (Postfix) with ESMTP id B4EB16E706 for ; Wed, 10 Dec 2014 15:54:07 -0800 (PST) Received: by mail-pd0-f179.google.com with SMTP id fp1so3730816pdb.24 for ; Wed, 10 Dec 2014 15:54:07 -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=T0sRu1LF0nxObVHbtvCULpcgIiMkF+NkMKsnCFgAy4c=; b=R/GGYj0uRWSxnx06Rc8NRzsn+ehHL4bonM5lsJ2w1VIZt/2Hcf60njCxG9ZqIOGMgR NyU+zYfSSKvpdUGAZbrTdvPnO0067QmHjvNTggzqRk7Soxg8UjVhj7FEiP+8Qc86IR6u tjUIe0hFBf7xTyulYeDa5S9cqM/6HqEmZgn1NMQgQJvqzLwaUUtJmDHJqjkITQ00pk6c qUtvJghFzS6m3cMEdKZHeGEUFnVUu4HHhzkJYx6pTOE46YQxpIH4i8f5sN6k+Aa2/02d 5NQV5+QQdDxaQuVb3iC3IRYUzmTtxnnbMo0qUMplOtV5xn64Lpzt8FemWrYn9cuf1XMs 7pLg== X-Received: by 10.70.48.166 with SMTP id m6mr12237004pdn.22.1418255647610; Wed, 10 Dec 2014 15:54:07 -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.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Dec 2014 15:54:06 -0800 (PST) From: Todd Previte To: intel-gfx@lists.freedesktop.org Date: Wed, 10 Dec 2014 16:53:07 -0700 Message-Id: <1418255597-4716-8-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 07/17] drm/i915: Add and implement the debugfs 'show' functions for Displayport compliance 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". This patch implements the 'show' functions for the debugfs interface for Displayport compliance testing. Signed-off-by: Todd Previte --- drivers/gpu/drm/i915/i915_debugfs.c | 85 +++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index ce091c1..184797d 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -3694,6 +3694,56 @@ static const struct file_operations i915_display_crc_ctl_fops = { .write = display_crc_ctl_write }; +static void displayport_show_config_info(struct seq_file *m, + struct intel_connector *intel_connector) +{ + struct intel_encoder *intel_encoder = intel_connector->encoder; + struct intel_dp *intel_dp; + struct intel_crtc *icrtc; + struct intel_crtc_config *crtc_config; + char *conn_name = intel_connector->base.name; + int pipe_bpp, hres, vres; + uint8_t vs[4], pe[4]; + struct drm_display_mode *mode; + int i = 0; + + if (intel_encoder) { + intel_dp = enc_to_intel_dp(&intel_encoder->base); + for (i = 0; i < intel_dp->lane_count; i++) { + vs[i] = intel_dp->train_set[i] + & DP_TRAIN_VOLTAGE_SWING_MASK; + pe[i] = (intel_dp->train_set[i] + & DP_TRAIN_PRE_EMPHASIS_MASK) >> 3; + } + if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT) { + if (intel_encoder->new_crtc) { + crtc_config = &intel_encoder->new_crtc->config; + pipe_bpp = crtc_config->pipe_bpp; + mode = &crtc_config->adjusted_mode; + hres = mode->hdisplay; + vres = mode->vdisplay; + } else if (intel_encoder->base.crtc) { + icrtc = to_intel_crtc(intel_encoder->base.crtc); + pipe_bpp = icrtc->config.pipe_bpp; + mode = &icrtc->config.adjusted_mode; + hres = mode->hdisplay; + vres = mode->vdisplay; + } else { + pipe_bpp = 0; + hres = vres = 0; + } + seq_printf(m, DP_CONF_STR_CONNECTOR, conn_name); + seq_printf(m, DP_CONF_STR_LINKRATE, intel_dp->link_bw); + seq_printf(m, DP_CONF_STR_LANES, intel_dp->lane_count); + seq_printf(m, DP_CONF_STR_VSWING, vs[0]); + seq_printf(m, DP_CONF_STR_PREEMP, pe[0]); + seq_printf(m, DP_CONF_STR_HRES, hres); + seq_printf(m, DP_CONF_STR_VRES, vres); + seq_printf(m, DP_CONF_STR_BPP, pipe_bpp); + } + } +} + enum dp_config_param displayport_get_config_param_type(char *input_string) { enum dp_config_param param_type = DP_CONFIG_PARAM_INVALID; @@ -3742,6 +3792,41 @@ int value_for_config_param(enum dp_config_param param, return status; } +static int displayport_config_ctl_show(struct seq_file *m, void *data) +{ + struct drm_device *dev = m->private; + struct drm_connector *drm_connector; + struct intel_encoder *encoder; + struct intel_connector *connector; + + if (!dev) + return -ENODEV; + + list_for_each_entry(drm_connector, + &dev->mode_config.connector_list, + head) { + connector = to_intel_connector(drm_connector); + encoder = connector->encoder; + if (drm_connector->connector_type == + DRM_MODE_CONNECTOR_DisplayPort) { + if (encoder->type == INTEL_OUTPUT_DISPLAYPORT || + encoder->type == INTEL_OUTPUT_UNKNOWN) { + if (drm_connector->status == + connector_status_connected) { + displayport_show_config_info(m, + connector); + } else { + seq_printf(m, DP_CONF_STR_CONNECTOR, + encoder->base.name); + seq_puts(m, "disconnected\n"); + } + } + } + } + + return 0; +} + static int displayport_config_ctl_open(struct inode *inode, struct file *file) {