From patchwork Fri Mar 7 23:12:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 3795541 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 9C2CFBF540 for ; Fri, 7 Mar 2014 23:13:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C9F73202E9 for ; Fri, 7 Mar 2014 23:13:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E79D5202F2 for ; Fri, 7 Mar 2014 23:13:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B4139FB6A0; Fri, 7 Mar 2014 15:13:06 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-yh0-f47.google.com (mail-yh0-f47.google.com [209.85.213.47]) by gabe.freedesktop.org (Postfix) with ESMTP id 23DD2FB68F for ; Fri, 7 Mar 2014 15:12:49 -0800 (PST) Received: by mail-yh0-f47.google.com with SMTP id c41so5030837yho.34 for ; Fri, 07 Mar 2014 15:12:48 -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=g/sTYDvu8w0ykqvPgiKd35T7EH6LCYzW02ZTvtBecSc=; b=R9ZiKRgYT0ImDTtAZZNwI3Oao0N17IudCUAq+V5JdS/QPMN/2mrMidV9IRv4HKH43d Q962DciB9tEYhyxbIARmjMoleQwtOUn6rgZvZJtOjX1T2uDa1LepQuIrDcuh2HraUvge 025eN6yhcG386pNwmpwVsaNka0cX2Z8Uzm6RCZpSkMy1a9wi2PC4UfK+EHmZ00Ja/lJU 4IwNVXNdGrWQip+SLfPJQ+unyc+733dfhidtISzS2x91GbmX5ay6rQnUYyFzLExhfkz9 T2Eebn1dDM16Ce+tOt8XseNeUhgKC4y4B+t05RDdwV8AjGJbtPLCyHhlEcMjptdqsIqu m8sQ== X-Received: by 10.236.32.36 with SMTP id n24mr5075554yha.116.1394233968852; Fri, 07 Mar 2014 15:12:48 -0800 (PST) Received: from localhost.localdomain ([177.132.70.215]) by mx.google.com with ESMTPSA id t58sm32569759yho.20.2014.03.07.15.12.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Mar 2014 15:12:48 -0800 (PST) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Fri, 7 Mar 2014 20:12:33 -0300 Message-Id: <1394233957-3904-3-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1394233957-3904-1-git-send-email-przanoni@gmail.com> References: <1394233957-3904-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH 2/6] drm/i915: add gen-specific runtime suspend/resume functions 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 We're adding runtime suspend support to more platforms, so organize the code in a way that all a new platform needs to do is to add its own gen-specific functions. Also rename the i915_ functions to intel_ to make it clear that it's the top level one, not something that just runs on i915 platforms. Signed-off-by: Paulo Zanoni Reviewed-by: Imre Deak --- drivers/gpu/drm/i915/i915_drv.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 74f7a91..f75d776 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -832,7 +832,23 @@ static int i915_pm_poweroff(struct device *dev) return i915_drm_freeze(drm_dev); } -static int i915_runtime_suspend(struct device *device) +static void hsw_runtime_suspend(struct drm_i915_private *dev_priv) +{ + struct drm_device *dev = dev_priv->dev; + + if (HAS_PC8(dev)) + hsw_enable_pc8(dev_priv); +} + +static void hsw_runtime_resume(struct drm_i915_private *dev_priv) +{ + struct drm_device *dev = dev_priv->dev; + + if (HAS_PC8(dev)) + hsw_disable_pc8(dev_priv); +} + +static int intel_runtime_suspend(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); struct drm_device *dev = pci_get_drvdata(pdev); @@ -843,8 +859,8 @@ static int i915_runtime_suspend(struct device *device) DRM_DEBUG_KMS("Suspending device\n"); - if (HAS_PC8(dev)) - hsw_enable_pc8(dev_priv); + if (IS_HASWELL(dev)) + hsw_runtime_suspend(dev_priv); i915_gem_release_all_mmaps(dev_priv); @@ -864,7 +880,7 @@ static int i915_runtime_suspend(struct device *device) return 0; } -static int i915_runtime_resume(struct device *device) +static int intel_runtime_resume(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); struct drm_device *dev = pci_get_drvdata(pdev); @@ -877,8 +893,8 @@ static int i915_runtime_resume(struct device *device) intel_opregion_notify_adapter(dev, PCI_D0); dev_priv->pm.suspended = false; - if (HAS_PC8(dev)) - hsw_disable_pc8(dev_priv); + if (IS_HASWELL(dev)) + hsw_runtime_resume(dev_priv); DRM_DEBUG_KMS("Device resumed\n"); return 0; @@ -891,8 +907,8 @@ static const struct dev_pm_ops i915_pm_ops = { .thaw = i915_pm_thaw, .poweroff = i915_pm_poweroff, .restore = i915_pm_resume, - .runtime_suspend = i915_runtime_suspend, - .runtime_resume = i915_runtime_resume, + .runtime_suspend = intel_runtime_suspend, + .runtime_resume = intel_runtime_resume, }; static const struct vm_operations_struct i915_gem_vm_ops = {