From patchwork Fri Mar 7 23:08:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 3795131 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 C255FBF540 for ; Fri, 7 Mar 2014 23:08:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF17E202E9 for ; Fri, 7 Mar 2014 23:08:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 04364202BE for ; Fri, 7 Mar 2014 23:08:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 98634FB614; Fri, 7 Mar 2014 15:08:39 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-yk0-f173.google.com (mail-yk0-f173.google.com [209.85.160.173]) by gabe.freedesktop.org (Postfix) with ESMTP id 632B8FB614 for ; Fri, 7 Mar 2014 15:08:37 -0800 (PST) Received: by mail-yk0-f173.google.com with SMTP id 10so12525975ykt.4 for ; Fri, 07 Mar 2014 15:08:37 -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=Whmrt4ElBPcffnTo++CCj5EuQenwIl4O7SEGelGvNY0=; b=Gd3NxRXnFa1zkqX6zofUC4dGY4jmWmXAha2rhSBIsXGx911gYA3VdYIWmRsJDxPeeP 5ionXCyUVXw5gA2bWWXcHn9oDANOYxjThaK/H0H05KrhE8f9eXvwtkQLuFKm3nhjLPCS JGM5o9qjJNJeMYT7k5UozBSOYBa/l3pexK8jeoPAFfdj1DWdXiVMd/jB7TbXqlmgWGUb rfYZqgvOqrbD4/yW+TzUMnXy5lqCKrqqkAUmioXBJcqKX3J1iobtRJJ23Muc7Q2aE+4d ZgnSvkHYrWG7rnYO5K/V9SmXkdTBicxv1UrOtiIpqwwo6sMextyseavhFhji4WOwPhbQ ogQg== X-Received: by 10.236.159.165 with SMTP id s25mr24197945yhk.24.1394233717036; Fri, 07 Mar 2014 15:08:37 -0800 (PST) Received: from localhost.localdomain ([177.132.70.215]) by mx.google.com with ESMTPSA id d32sm32572865yhq.27.2014.03.07.15.08.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Mar 2014 15:08:35 -0800 (PST) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Fri, 7 Mar 2014 20:08:04 -0300 Message-Id: <1394233699-3741-2-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1394233699-3741-1-git-send-email-przanoni@gmail.com> References: <1394233699-3741-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH 01/16] drm/i915: extract __hsw_do_{en, dis}able_package_c8 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.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 From: Paulo Zanoni When we merge PC8 and runtime PM, these new functions are going to be called by the runtime suspend/resume functions, and their callers are going to be removed. v2: - Rebase Reviewed-by: Imre Deak (v1) Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/i915/intel_display.c | 64 +++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index dc2b377..9c3e2c5 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -6772,19 +6772,11 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv) gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL); } -void hsw_enable_pc8_work(struct work_struct *__work) +static void __hsw_do_enable_pc8(struct drm_i915_private *dev_priv) { - struct drm_i915_private *dev_priv = - container_of(to_delayed_work(__work), struct drm_i915_private, - pc8.enable_work); struct drm_device *dev = dev_priv->dev; uint32_t val; - WARN_ON(!HAS_PC8(dev)); - - if (dev_priv->pc8.enabled) - return; - DRM_DEBUG_KMS("Enabling package C8+\n"); dev_priv->pc8.enabled = true; @@ -6798,7 +6790,21 @@ void hsw_enable_pc8_work(struct work_struct *__work) lpt_disable_clkout_dp(dev); hsw_pc8_disable_interrupts(dev); hsw_disable_lcpll(dev_priv, true, true); +} + +void hsw_enable_pc8_work(struct work_struct *__work) +{ + struct drm_i915_private *dev_priv = + container_of(to_delayed_work(__work), struct drm_i915_private, + pc8.enable_work); + struct drm_device *dev = dev_priv->dev; + + WARN_ON(!HAS_PC8(dev)); + if (dev_priv->pc8.enabled) + return; + + __hsw_do_enable_pc8(dev_priv); intel_runtime_pm_put(dev_priv); } @@ -6816,29 +6822,13 @@ static void __hsw_enable_package_c8(struct drm_i915_private *dev_priv) msecs_to_jiffies(i915.pc8_timeout)); } -static void __hsw_disable_package_c8(struct drm_i915_private *dev_priv) +static void __hsw_do_disable_package_c8(struct drm_i915_private *dev_priv) { struct drm_device *dev = dev_priv->dev; uint32_t val; - WARN_ON(!mutex_is_locked(&dev_priv->pc8.lock)); - WARN(dev_priv->pc8.disable_count < 0, - "pc8.disable_count: %d\n", dev_priv->pc8.disable_count); - - dev_priv->pc8.disable_count++; - if (dev_priv->pc8.disable_count != 1) - return; - - WARN_ON(!HAS_PC8(dev)); - - cancel_delayed_work_sync(&dev_priv->pc8.enable_work); - if (!dev_priv->pc8.enabled) - return; - DRM_DEBUG_KMS("Disabling package C8+\n"); - intel_runtime_pm_get(dev_priv); - hsw_restore_lcpll(dev_priv); hsw_pc8_restore_interrupts(dev); lpt_init_pch_refclk(dev); @@ -6857,6 +6847,28 @@ static void __hsw_disable_package_c8(struct drm_i915_private *dev_priv) dev_priv->pc8.enabled = false; } +static void __hsw_disable_package_c8(struct drm_i915_private *dev_priv) +{ + struct drm_device *dev = dev_priv->dev; + + WARN_ON(!mutex_is_locked(&dev_priv->pc8.lock)); + WARN(dev_priv->pc8.disable_count < 0, + "pc8.disable_count: %d\n", dev_priv->pc8.disable_count); + + dev_priv->pc8.disable_count++; + if (dev_priv->pc8.disable_count != 1) + return; + + WARN_ON(!HAS_PC8(dev)); + + cancel_delayed_work_sync(&dev_priv->pc8.enable_work); + if (!dev_priv->pc8.enabled) + return; + + intel_runtime_pm_get(dev_priv); + __hsw_do_disable_package_c8(dev_priv); +} + void hsw_enable_package_c8(struct drm_i915_private *dev_priv) { if (!HAS_PC8(dev_priv->dev))