From patchwork Thu Jul 19 06:59:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 10533679 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BA7E9600F4 for ; Thu, 19 Jul 2018 06:59:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA632296F0 for ; Thu, 19 Jul 2018 06:59:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C222296FB; Thu, 19 Jul 2018 06:59:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4D26E296F0 for ; Thu, 19 Jul 2018 06:59:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 42A986E1DD; Thu, 19 Jul 2018 06:59:12 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 12D246E1DD for ; Thu, 19 Jul 2018 06:59:10 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jul 2018 23:59:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,373,1526367600"; d="scan'208";a="56143936" Received: from usonix-mobl.amr.corp.intel.com (HELO rdvivi-vienna.intel.com) ([10.254.71.221]) by fmsmga008.fm.intel.com with ESMTP; 18 Jul 2018 23:59:08 -0700 From: Rodrigo Vivi To: intel-gfx@lists.freedesktop.org Date: Wed, 18 Jul 2018 23:59:07 -0700 Message-Id: <20180719065907.4618-1-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915: Fix psr sink status report. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dhinakaran Pandiyan , Rodrigo Vivi Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP First of all don't try to read dpcd if PSR is not even supported. But also, if read failed return -EIO instead of reporting via a backchannel. Fixes: 5b7b30864d1d ("drm/i915/psr: Split sink status into a separate debugfs node") Cc: Chris Wilson Cc: Dhinakaran Pandiyan Cc: José Roberto de Souza Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/i915/i915_debugfs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index b3aefd623557..401aca53169d 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2594,6 +2594,7 @@ static const struct file_operations i915_guc_log_relay_fops = { static int i915_psr_sink_status_show(struct seq_file *m, void *data) { + struct drm_i915_private *dev_priv = node_to_i915(m->private); u8 val; static const char * const sink_status[] = { "inactive", @@ -2609,6 +2610,11 @@ static int i915_psr_sink_status_show(struct seq_file *m, void *data) struct intel_dp *intel_dp = enc_to_intel_dp(&intel_attached_encoder(connector)->base); + if (!CAN_PSR(dev_priv)) { + seq_puts(m, "PSR Unsupported\n"); + return -ENODEV; + } + if (connector->status != connector_status_connected) return -ENODEV; @@ -2620,7 +2626,7 @@ static int i915_psr_sink_status_show(struct seq_file *m, void *data) str = sink_status[val]; seq_printf(m, "Sink PSR status: 0x%x [%s]\n", val, str); } else { - DRM_ERROR("dpcd read (at %u) failed\n", DP_PSR_STATUS); + return -EIO; } return 0;