2 * OMAP4 Power Management Routines
4 * Copyright (C) 2010 Texas Instruments, Inc.
5 * Rajendra Nayak <rnayak@ti.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
13 #include <linux/suspend.h>
14 #include <linux/module.h>
15 #include <linux/list.h>
16 #include <linux/err.h>
17 #include <linux/slab.h>
19 #include <plat/powerdomain.h>
20 #include <mach/omap4-common.h>
23 struct powerdomain
*pwrdm
;
28 struct list_head node
;
31 static LIST_HEAD(pwrst_list
);
34 static int omap4_pm_prepare(void)
40 static int omap4_pm_suspend(void)
46 static int omap4_pm_enter(suspend_state_t suspend_state
)
50 switch (suspend_state
) {
51 case PM_SUSPEND_STANDBY
:
53 ret
= omap4_pm_suspend();
62 static void omap4_pm_finish(void)
68 static int omap4_pm_begin(suspend_state_t state
)
73 static void omap4_pm_end(void)
78 static struct platform_suspend_ops omap_pm_ops
= {
79 .begin
= omap4_pm_begin
,
81 .prepare
= omap4_pm_prepare
,
82 .enter
= omap4_pm_enter
,
83 .finish
= omap4_pm_finish
,
84 .valid
= suspend_valid_only_mem
,
86 #endif /* CONFIG_SUSPEND */
88 static int __init
pwrdms_setup(struct powerdomain
*pwrdm
, void *unused
)
90 struct power_state
*pwrst
;
95 pwrst
= kmalloc(sizeof(struct power_state
), GFP_ATOMIC
);
99 pwrst
->next_state
= PWRDM_POWER_ON
;
100 list_add(&pwrst
->node
, &pwrst_list
);
102 return pwrdm_set_next_pwrst(pwrst
->pwrdm
, pwrst
->next_state
);
106 * omap4_pm_init - Init routine for OMAP4 PM
108 * Initializes all powerdomain and clockdomain target states
109 * and all PRCM settings.
111 static int __init
omap4_pm_init(void)
115 if (!cpu_is_omap44xx())
118 pr_err("Power Management for TI OMAP4.\n");
121 ret
= pwrdm_for_each(pwrdms_setup
, NULL
);
123 pr_err("Failed to setup powerdomains\n");
128 #ifdef CONFIG_SUSPEND
129 suspend_set_ops(&omap_pm_ops
);
130 #endif /* CONFIG_SUSPEND */
135 late_initcall(omap4_pm_init
);