From patchwork Mon Feb 10 16:12:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3620421 Return-Path: X-Original-To: patchwork-linux-arm@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 70B6D9F382 for ; Mon, 10 Feb 2014 16:19:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61F8C201B6 for ; Mon, 10 Feb 2014 16:19:04 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D46A2010F for ; Mon, 10 Feb 2014 16:19:03 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WCtYz-000496-1B; Mon, 10 Feb 2014 16:18:29 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WCtU5-0001WJ-V2; Mon, 10 Feb 2014 16:13:25 +0000 Received: from qmta10.emeryville.ca.mail.comcast.net ([2001:558:fe2d:43:76:96:30:17]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WCtTm-0001SM-CA for linux-arm-kernel@lists.infradead.org; Mon, 10 Feb 2014 16:13:09 +0000 Received: from omta16.emeryville.ca.mail.comcast.net ([76.96.30.72]) by qmta10.emeryville.ca.mail.comcast.net with comcast id QdzK1n0031ZMdJ4AAgCj2S; Mon, 10 Feb 2014 16:12:43 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta16.emeryville.ca.mail.comcast.net with comcast id QgCh1n00J0MU7Qa8cgCh9V; Mon, 10 Feb 2014 16:12:42 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 30E1B40BC5; Mon, 10 Feb 2014 09:12:41 -0700 (MST) From: Shuah Khan To: rjw@rjwysocki.net, linux@arm.linux.org.uk Subject: [RFT][PATCH 03/12] arm: change scoop platform power management to use dev_pm_ops Date: Mon, 10 Feb 2014 09:12:26 -0700 Message-Id: <8b18981d7719af5ecf2ab093f5f41d2b79c33197.1392040067.git.shuah.kh@samsung.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: In-Reply-To: References: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1392048763; bh=dxI6O+0sERV7BmillIahEvxKNzOWR1GkKwPC2N+vw/U=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=aKD90wyi1BLWkr+tszM4LAgp5hmpU8EuvVlezScdgZFRJCw+3K+Deq1qOoQARq1Zy ApoGM549CB4QeJigQ9mhKWiIUQn0M07Z/DvqFoihs44zNf89x8MdFXjxQs6AqxNQ1A tFrPJiUICpX6wyVuw7zDAKaS6xqiIYGmLDGhzL/vEtIn6f3vHLrWFtk8hTI/PQXLdH XhTrogKYOyuhWXl9QB8hSTN+ZiHCqj+Td1i0oO1/Pn+B5s+qe1AslORHXR/iYY9FSr Yj8Ba3YA7Mik0EINirz5eFWrvQeMtK/VUcfPDlThCb0UcqjP25piiRgIDaSSEQSw62 qNZfLitmeksbw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140210_111306_654616_FD176704 X-CRM114-Status: GOOD ( 11.89 ) X-Spam-Score: -1.9 (-) Cc: shuahkhan@gmail.com, Shuah Khan , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 Change scoop platform driver to register pm ops using dev_pm_ops instead of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces by passing in the right pm state. Signed-off-by: Shuah Khan --- arch/arm/common/scoop.c | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c index a5c3dc3..260a60b 100644 --- a/arch/arm/common/scoop.c +++ b/arch/arm/common/scoop.c @@ -151,7 +151,7 @@ static void check_scoop_reg(struct scoop_dev *sdev) iowrite16(0x0101, sdev->base + SCOOP_MCR); } -static int scoop_suspend(struct platform_device *dev, pm_message_t state) +static int __scoop_suspend(struct platform_device *dev, pm_message_t state) { struct scoop_dev *sdev = platform_get_drvdata(dev); @@ -162,7 +162,22 @@ static int scoop_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int scoop_resume(struct platform_device *dev) +static int scoop_suspend(struct device *dev) +{ + return __scoop_suspend(to_platform_device(dev), PMSG_SUSPEND); +} + +static int scoop_freeze(struct device *dev) +{ + return __scoop_suspend(to_platform_device(dev), PMSG_FREEZE); +} + +static int scoop_poweroff(struct device *dev) +{ + return __scoop_suspend(to_platform_device(dev), PMSG_HIBERNATE); +} + +static int __scoop_resume(struct platform_device *dev) { struct scoop_dev *sdev = platform_get_drvdata(dev); @@ -171,9 +186,11 @@ static int scoop_resume(struct platform_device *dev) return 0; } -#else -#define scoop_suspend NULL -#define scoop_resume NULL + +static int scoop_resume(struct device *dev) +{ + return __scoop_resume(to_platform_device(dev)); +} #endif static int scoop_probe(struct platform_device *pdev) @@ -266,13 +283,26 @@ static int scoop_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM +static const struct dev_pm_ops scoop_dev_pm_ops = { + .suspend = scoop_suspend, + .resume = scoop_resume, + /* Hibernate hooks */ + .freeze = scoop_freeze, + .thaw = scoop_resume, + .poweroff = scoop_poweroff, + .restore = scoop_resume, +}; +#endif + static struct platform_driver scoop_driver = { .probe = scoop_probe, .remove = scoop_remove, - .suspend = scoop_suspend, - .resume = scoop_resume, .driver = { .name = "sharp-scoop", +#ifdef CONFIG_PM + .pm = &scoop_dev_pm_ops, +#endif }, };