aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/pm.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2012-02-02 04:30:50 -0500
committerKevin Hilman <khilman@ti.com>2012-03-05 19:01:19 -0500
commit1416408d31236dc2a80d269aa23ffa93aa01e833 (patch)
treefb77d8bad2e21597ed5d0b34fdd040044999e2c2 /arch/arm/mach-omap2/pm.c
parentb7c39a3f59ae55aa49ebf670e9329bc7da6d3c65 (diff)
ARM: OMAP2+: PM: share some suspend-related functions across OMAP2, 3, 4
The platform_suspend_ops can be shared across OMAP2, 3, and 4, along with all of the functions referenced in that structure. This patch shares them. It also removes the suspend_state file-scoped variable in the OMAP2 and 3 PM code; it does not appear to be actually needed by anything. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com> Cc: Rajendra Nayak <rnayak@ti.com> Reviewed-by: Kevin Hilman <khilman@ti.com> [khilman@ti.com: minor rework needed due to rebase/merge with conflicting changes] Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/pm.c')
-rw-r--r--arch/arm/mach-omap2/pm.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index f9e807958f3e..28706696a341 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -15,11 +15,13 @@
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/opp.h> 16#include <linux/opp.h>
17#include <linux/export.h> 17#include <linux/export.h>
18#include <linux/suspend.h>
18 19
19#include <plat/omap-pm.h> 20#include <plat/omap-pm.h>
20#include <plat/omap_device.h> 21#include <plat/omap_device.h>
21#include "common.h" 22#include "common.h"
22 23
24#include "prcm-common.h"
23#include "voltage.h" 25#include "voltage.h"
24#include "powerdomain.h" 26#include "powerdomain.h"
25#include "clockdomain.h" 27#include "clockdomain.h"
@@ -28,6 +30,12 @@
28 30
29static struct omap_device_pm_latency *pm_lats; 31static struct omap_device_pm_latency *pm_lats;
30 32
33/*
34 * omap_pm_suspend: points to a function that does the SoC-specific
35 * suspend work
36 */
37int (*omap_pm_suspend)(void);
38
31static int __init _init_omap_device(char *name) 39static int __init _init_omap_device(char *name)
32{ 40{
33 struct omap_hwmod *oh; 41 struct omap_hwmod *oh;
@@ -134,6 +142,8 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 pwrst)
134 return ret; 142 return ret;
135} 143}
136 144
145
146
137/* 147/*
138 * This API is to be called during init to set the various voltage 148 * This API is to be called during init to set the various voltage
139 * domains to the voltage as per the opp table. Typically we boot up 149 * domains to the voltage as per the opp table. Typically we boot up
@@ -201,6 +211,56 @@ exit:
201 return -EINVAL; 211 return -EINVAL;
202} 212}
203 213
214#ifdef CONFIG_SUSPEND
215static int omap_pm_enter(suspend_state_t suspend_state)
216{
217 int ret = 0;
218
219 if (!omap_pm_suspend)
220 return -ENOENT; /* XXX doublecheck */
221
222 switch (suspend_state) {
223 case PM_SUSPEND_STANDBY:
224 case PM_SUSPEND_MEM:
225 ret = omap_pm_suspend();
226 break;
227 default:
228 ret = -EINVAL;
229 }
230
231 return ret;
232}
233
234static int omap_pm_begin(suspend_state_t state)
235{
236 disable_hlt();
237 if (cpu_is_omap34xx())
238 omap_prcm_irq_prepare();
239 return 0;
240}
241
242static void omap_pm_end(void)
243{
244 enable_hlt();
245 return;
246}
247
248static void omap_pm_finish(void)
249{
250 if (cpu_is_omap34xx())
251 omap_prcm_irq_complete();
252}
253
254static const struct platform_suspend_ops omap_pm_ops = {
255 .begin = omap_pm_begin,
256 .end = omap_pm_end,
257 .enter = omap_pm_enter,
258 .finish = omap_pm_finish,
259 .valid = suspend_valid_only_mem,
260};
261
262#endif /* CONFIG_SUSPEND */
263
204static void __init omap3_init_voltages(void) 264static void __init omap3_init_voltages(void)
205{ 265{
206 if (!cpu_is_omap34xx()) 266 if (!cpu_is_omap34xx())
@@ -243,6 +303,10 @@ static int __init omap2_common_pm_late_init(void)
243 /* Smartreflex device init */ 303 /* Smartreflex device init */
244 omap_devinit_smartreflex(); 304 omap_devinit_smartreflex();
245 305
306#ifdef CONFIG_SUSPEND
307 suspend_set_ops(&omap_pm_ops);
308#endif
309
246 return 0; 310 return 0;
247} 311}
248late_initcall(omap2_common_pm_late_init); 312late_initcall(omap2_common_pm_late_init);