From patchwork Thu Feb 14 11:15:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 2141281 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 9C963DF283 for ; Thu, 14 Feb 2013 11:18:47 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U5wnR-0002JY-3G; Thu, 14 Feb 2013 11:16:09 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U5wnM-0002Id-BS for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2013 11:16:04 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r1EBG3CI004427; Thu, 14 Feb 2013 05:16:03 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r1EBG3Hc029865; Thu, 14 Feb 2013 05:16:03 -0600 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Thu, 14 Feb 2013 05:16:02 -0600 Received: from localhost (h79-8.vpn.ti.com [172.24.79.8]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r1EBG1t2000924; Thu, 14 Feb 2013 05:16:02 -0600 From: Felipe Balbi To: Linux OMAP Mailing List Subject: [RFC/NOT FOR MERGING 1/3] arm: omap: use generic implementation if !od Date: Thu, 14 Feb 2013 13:15:52 +0200 Message-ID: <1360840554-26901-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.8.1.rc1.5.g7e0651a MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130214_061604_472858_5F94312C X-CRM114-Status: GOOD ( 12.98 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.41 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Tony Lindgren , Felipe Balbi , Linux ARM Kernel Mailing List X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Eventually, we need to be able to remove ti,hwmods DT attribute (or at a minimum ignore it). For new platforms, this patch could enable the transition by not relying on ti,hwmods to have functioning PM and Idle implementation. Notice that this poses no differences for platforms which are already supported, it just gives us means of dropping the relyance on hwmod for new platforms. NYET-Signed-off-by: Felipe Balbi --- arch/arm/mach-omap2/omap_device.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index e065daa..305eeb4 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c @@ -796,13 +796,18 @@ static int __init omap_early_device_register(struct platform_device *pdev) static int _od_runtime_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); + struct omap_device *od = to_omap_device(pdev); int ret; ret = pm_generic_runtime_suspend(dev); + if (!od) + goto out; + if (!ret) omap_device_idle(pdev); +out: return ret; } @@ -814,9 +819,14 @@ static int _od_runtime_idle(struct device *dev) static int _od_runtime_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); + struct omap_device *od = to_omap_device(pdev); + + if (!od) + goto out; omap_device_enable(pdev); +out: return pm_generic_runtime_resume(dev); } #endif @@ -828,6 +838,9 @@ static int _od_suspend_noirq(struct device *dev) struct omap_device *od = to_omap_device(pdev); int ret; + if (!od) + return pm_generic_suspend_noirq(dev); + /* Don't attempt late suspend on a driver that is not bound */ if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) return 0; @@ -850,6 +863,9 @@ static int _od_resume_noirq(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct omap_device *od = to_omap_device(pdev); + if (!od) + goto out; + if ((od->flags & OMAP_DEVICE_SUSPENDED) && !pm_runtime_status_suspended(dev)) { od->flags &= ~OMAP_DEVICE_SUSPENDED; @@ -858,6 +874,7 @@ static int _od_resume_noirq(struct device *dev) pm_generic_runtime_resume(dev); } +out: return pm_generic_resume_noirq(dev); } #else