From patchwork Tue Sep 16 23:19:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 4921641 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 B7460BEEA5 for ; Tue, 16 Sep 2014 23:19:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 067922015A for ; Tue, 16 Sep 2014 23:19:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1DAF120142 for ; Tue, 16 Sep 2014 23:19:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A0256E273; Tue, 16 Sep 2014 16:19:20 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FEFC6E301 for ; Tue, 16 Sep 2014 16:19:19 -0700 (PDT) Received: by mail-pa0-f52.google.com with SMTP id kq14so760723pab.11 for ; Tue, 16 Sep 2014 16:19:19 -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:in-reply-to:references; bh=sP5j//3o631zCdP10R0VANJV5JkGQRVEn5iMmvbDkX0=; b=KfsJd0z9d0tGkvY55RnXPMHgS5yCtAdYnMIOM7EyVpm6CZWSyjX1MyfghqiQD2+YgW QcDaREsrCAGBRABKCBRdqyJ5fzQUqTg8UuajbTjwsDZ74+6nOuOBqp1TIR4l9lIyS6SD BwJhqtWB8ZL8JHsT9C0GVZk7B5V69HfnrzWPpAV7U3lGP56hB94zYi2CUow846fMYjxd YL2wgkC3kiCKMZEk/eteH0JQ7JXMBZNeyQK+ssYBr+rR+orbgjTFNW936X1nlhsCM09y Q5oWpkKUxyD9dKM6dWxjQjbTAptYm/3d9I5eJZGti8f991lBriJ6lLTAIG/WrNJGOahP sLKg== X-Received: by 10.68.239.201 with SMTP id vu9mr55251965pbc.35.1410909559011; Tue, 16 Sep 2014 16:19:19 -0700 (PDT) Received: from rdvivi-bratislava.home (static-50-43-14-60.bvtn.or.frontiernet.net. [50.43.14.60]) by mx.google.com with ESMTPSA id v1sm15068998pdp.76.2014.09.16.16.19.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Sep 2014 16:19:18 -0700 (PDT) From: Rodrigo Vivi X-Google-Original-From: Rodrigo Vivi To: intel-gfx@lists.freedesktop.org Date: Tue, 16 Sep 2014 19:19:08 -0400 Message-Id: <1410909548-4945-4-git-send-email-rodrigo.vivi@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1410909548-4945-1-git-send-email-rodrigo.vivi@intel.com> References: <1410909548-4945-1-git-send-email-rodrigo.vivi@intel.com> Cc: Rodrigo Vivi Subject: [Intel-gfx] [PATCH 4/4] drm/i915: Make sure PSR is ready for been re-enabled. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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.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 Let's make sure PSR is propperly disabled before to re-enabled it. According to Spec, after disabled PSR CTL, the Idle state might occur up to 24ms, that is one full frame time (1/refresh rate), plus SRD exit training time (max of 6ms), plus SRD aux channel handshake (max of 1.5ms). So if something went wrong PSR will be disabled until next full enable/disable setup. Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/i915/intel_dp.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 2f0eee5..658a911 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1885,6 +1885,17 @@ static void intel_edp_psr_do_enable(struct intel_dp *intel_dp) WARN_ON(dev_priv->psr.active); lockdep_assert_held(&dev_priv->psr.lock); + /* We have to make sure PSR is ready for re-enable + * otherwise it keeps disabled until next full enable/disable cycle. + * PSR might take up to 24 ms to get fully disabled + * and be ready for re-enable. + */ + if (wait_for((I915_READ(EDP_PSR_STATUS_CTL(dev)) & + EDP_PSR_STATUS_STATE_MASK) == 0, 24)) { + DRM_ERROR("Timed out waiting for PSR Idle for re-enable\n"); + return; + } + /* Enable/Re-enable PSR on the host */ intel_edp_psr_enable_source(intel_dp);