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: 3620361 Return-Path: X-Original-To: patchwork-linux-pm@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 5748F9F382 for ; Mon, 10 Feb 2014 16:18:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C57D2010F for ; Mon, 10 Feb 2014 16:18:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0DB9A201D3 for ; Mon, 10 Feb 2014 16:18:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752586AbaBJQSt (ORCPT ); Mon, 10 Feb 2014 11:18:49 -0500 Received: from qmta15.emeryville.ca.mail.comcast.net ([76.96.27.228]:47576 "EHLO qmta15.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752190AbaBJQSs (ORCPT ); Mon, 10 Feb 2014 11:18:48 -0500 Received: from omta16.emeryville.ca.mail.comcast.net ([76.96.30.72]) by qmta15.emeryville.ca.mail.comcast.net with comcast id QexN1n0051ZMdJ4AFgCXNX; Mon, 10 Feb 2014 16:12:31 +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 Cc: Shuah Khan , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, shuahkhan@gmail.com 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=1392048751; bh=dxI6O+0sERV7BmillIahEvxKNzOWR1GkKwPC2N+vw/U=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=TvkLrDII1BqHUJXAvYt4pCC9MlTfwJ4Ma/AELljPQE+hq40TreFc2cmREDXTeFqXY qB62OmjBnZHnbEjZCaT7+KegZdC2/Q9bJwqCJUVKZXhudajE+BEgQ0gPPQFA9y26tc pf+4NZ/HT3E0Y2YEGDMqavFeyw48vtcpDVO4ckAjpHBYc/Rj9hpia2efz+nssSAj8I o17qYcaoEPnKOjKEnbigtcnAdcCkxSaX5KLkJY/BtojYFWGAAi/sKvEUK71sTHfxb4 YxJKpVfF/YMUWZ8Cc/GpfJHJicq1gbdRl2C3ZF/LZipvGvpUkoKPLtxtpanAZ+WKxG 4eqMuLwyOtg8w== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 }, };