From patchwork Thu Nov 21 15:14:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 3219231 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 209199F461 for ; Thu, 21 Nov 2013 15:15:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 499CA206EB for ; Thu, 21 Nov 2013 15:15:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A52A0206D7 for ; Thu, 21 Nov 2013 15:14:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 619C0F9DF9; Thu, 21 Nov 2013 07:14:56 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id D3F4CF9DF9 for ; Thu, 21 Nov 2013 07:14:54 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 21 Nov 2013 07:14:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,745,1378882800"; d="scan'208";a="439258410" Received: from intelbox.fi.intel.com (HELO localhost) ([10.237.72.105]) by orsmga002.jf.intel.com with ESMTP; 21 Nov 2013 07:14:50 -0800 From: Imre Deak To: intel-gfx@lists.freedesktop.org Date: Thu, 21 Nov 2013 17:14:49 +0200 Message-Id: <1385046889-14115-1-git-send-email-imre.deak@intel.com> X-Mailer: git-send-email 1.8.4 Cc: joonas.lahtinen@linux.intel.com Subject: [Intel-gfx] [PATCH] drm/i915: vlv: W/a for hotplug/manual VGA detection X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 At least on my VLV stepping VGA detection doesn't work in certain cases. One such case is when all pipes are off and VGA is plugged in. Another case reported by Joonas Lahtinen (also on the same stepping) is booting with VGA disconnected where we incorrectly report that VGA is connected. At least in the first case writing the FORCE bit in the ADPA reg will get stuck, i.e. the detection never completes. Both cases seem to be solved by disabling DPIO clock gating based on the PSR state. As I haven't found any trace that this would be a known issue, I can only speculate that both the DPIO HW block and the HW block responsible for VGA detection uses the same clock source which gets gated even though PSR is inactive. I haven't measured if and how this change affects our power savings. Reported-by: Joonas Lahtinen Signed-off-by: Imre Deak --- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_pm.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 849e595..9981d21 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -1447,6 +1447,9 @@ # define I965_FT_CLOCK_GATE_DISABLE (1 << 1) # define I965_DM_CLOCK_GATE_DISABLE (1 << 0) +#define DPPSR_CGDIS_VLV (dev_priv->info->display_mmio_offset + 0x6204) +# define DPIOUNIT_PSR_CLOCK_GATING_DISABLE (1 << 6) + #define RENCLK_GATE_D2 0x6208 #define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9) #define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7) diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 365545f..7f373e9 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5430,6 +5430,11 @@ static void valleyview_init_clock_gating(struct drm_device *dev) I915_WRITE(DSPCLK_GATE_D, VRHUNIT_CLOCK_GATE_DISABLE); + /* Wa to make VGA hotplug and manual detection work. */ + val = I915_READ(DPPSR_CGDIS_VLV); + val |= DPIOUNIT_PSR_CLOCK_GATING_DISABLE; + I915_WRITE(DPIOUNIT_PSR_CLOCK_GATING_DISABLE, val); + /* WaDisableEarlyCull:vlv */ I915_WRITE(_3D_CHICKEN3, _MASKED_BIT_ENABLE(_3D_CHICKEN_SF_DISABLE_OBJEND_CULL));