]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/twl4030-generic-scripts.c
Merge branch 'omap-fixes'
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / twl4030-generic-scripts.c
1 /*
2  * arch/arm/mach-omap2/twl4030-generic-scripts.c
3  *
4  * Generic power control scripts for TWL4030
5  *
6  * Copyright (C) 2008 Nokia Corporation
7  * Copyright (C) 2006 Texas Instruments, Inc
8  *
9  * Written by   Kalle Jokiniemi
10  *              Peter De Schrijver <peter.de-schrijver@nokia.com>
11  *
12  * This file is subject to the terms and conditions of the GNU General
13  * Public License. See the file "COPYING" in the main directory of this
14  * archive for more details.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24  */
25
26 #ifdef CONFIG_TWL4030_POWER
27
28 #include <linux/kernel.h>
29 #include <linux/device.h>
30 #include <linux/init.h>
31 #include <linux/i2c/twl4030.h>
32
33 /*
34  * This script instructs twl4030 to first put the Reset and Control (RC)
35  * resources to sleep and then all the other resources.
36  */
37
38 static struct twl4030_ins sleep_on_seq[] __initdata = {
39         {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_RC, RES_TYPE_ALL, RES_TYPE2_R0,
40                         RES_STATE_SLEEP), 4},
41         {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE2_R0,
42                         RES_STATE_SLEEP), 4},
43 };
44
45 static struct twl4030_script sleep_on_script __initdata = {
46         .script = sleep_on_seq,
47         .size   = ARRAY_SIZE(sleep_on_seq),
48         .flags  = TRITON_SLEEP_SCRIPT,
49 };
50
51 /*
52  * This script instructs twl4030 to first enable CLKEN, then wakeup the
53  * regulators and then all other resources.
54  */
55
56 static struct twl4030_ins wakeup_seq[] __initdata = {
57         {MSG_SINGULAR(DEV_GRP_NULL, 0x17, RES_STATE_ACTIVE), 0x30},
58         {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP_PR, RES_TYPE_ALL, RES_TYPE2_R0,
59                         RES_STATE_ACTIVE), 0x37},
60         {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE2_R0,
61                         RES_STATE_ACTIVE), 0x2},
62 };
63
64 static struct twl4030_script wakeup_script __initdata = {
65         .script = wakeup_seq,
66         .size   = ARRAY_SIZE(wakeup_seq),
67         .flags  = TRITON_WAKEUP12_SCRIPT | TRITON_WAKEUP3_SCRIPT,
68 };
69
70 static struct twl4030_script *twl4030_scripts[] __initdata = {
71         &sleep_on_script,
72         &wakeup_script,
73 };
74
75 struct twl4030_power_data generic3430_t2scripts_data __initdata = {
76         .scripts        = twl4030_scripts,
77         .size           = ARRAY_SIZE(twl4030_scripts),
78 };
79
80
81 #endif /* CONFIG_TWL4030_POWER */