From patchwork Tue Aug 3 13:49:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Basak, Partha" X-Patchwork-Id: 116772 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o73DnpQm031083 for ; Tue, 3 Aug 2010 13:49:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756725Ab0HCNtu (ORCPT ); Tue, 3 Aug 2010 09:49:50 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:34888 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755867Ab0HCNts convert rfc822-to-8bit (ORCPT ); Tue, 3 Aug 2010 09:49:48 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o73DniE5030930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 3 Aug 2010 08:49:46 -0500 Received: from dbde71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id o73DngMp015970; Tue, 3 Aug 2010 19:19:42 +0530 (IST) Received: from dbde02.ent.ti.com ([172.24.170.145]) by dbde71.ent.ti.com ([172.24.170.149]) with mapi; Tue, 3 Aug 2010 19:19:42 +0530 From: "Basak, Partha" To: "Basak, Partha" , Kevin Hilman CC: Paul Walmsley , "linux-omap@vger.kernel.org" , "Kalliguddi, Hema" , "Raja, Govindraj" , "Varadarajan, Charulatha" , "Nayak, Rajendra" , "Cousson, Benoit" Date: Tue, 3 Aug 2010 19:19:40 +0530 Subject: Issues with calling pm_runtime functions in platform_pm_suspend_noirq/IRQ disabled context. Thread-Topic: Issues with calling pm_runtime functions in platform_pm_suspend_noirq/IRQ disabled context. Thread-Index: AcszBKFQdmIr2IusRju0mNvXcq/jCgADa1NA Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 03 Aug 2010 13:49:52 +0000 (UTC) diff --git a/arch/arm/mach-omap2/pm_bus.c b/arch/arm/mach-omap2/pm_bus.c index 9719a9f..5e453dc 100644 (file) --- a/arch/arm/mach-omap2/pm_bus.c +++ b/arch/arm/mach-omap2/pm_bus.c @@ -68,3 +68,51 @@ int platform_pm_runtime_idle(struct device *dev) }; #endif /* CONFIG_PM_RUNTIME */ +#ifdef CONFIG_SUSPEND +int platform_pm_suspend_noirq(struct device *dev) +{ + struct device_driver *drv = dev->driver; + int ret = 0; + + if (!drv) + return 0; + + if (drv->pm) { + if (drv->pm->suspend_noirq) + ret = drv->pm->suspend_noirq(dev); + } + + /* + * The DPM core has done a 'get' to prevent runtime PM + * transitions during system PM. This put is to balance + * out that get so that this device can now be runtime + * suspended. + */ + pm_runtime_put_sync(dev); + + return ret; +} + +int platform_pm_resume_noirq(struct device *dev) +{ + struct device_driver *drv = dev->driver; + int ret = 0; + + /* + * This 'get' is to balance the 'put' in the above suspend_noirq + * method so that the runtime PM usage counting is in the same + * state it was when suspend was called. + */ + pm_runtime_get_sync(dev); + + if (!drv) + return 0; + + if (drv->pm) { + if (drv->pm->resume_noirq) + ret = drv->pm->resume_noirq(dev); + } + + return ret; +} +#endif /* CONFIG_SUSPEND */