]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/twl4030-generic-scripts.c
Merge current mainline tree into linux-omap tree
[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 #include <linux/kernel.h>
27 #include <linux/device.h>
28 #include <linux/init.h>
29 #include <linux/i2c/twl4030.h>
30
31 /*
32  * This script instructs twl4030 to first put the Reset and Control (RC)
33  * resources to sleep and then all the other resources.
34  */
35
36 static struct twl4030_ins sleep_on_seq[] __initdata = {
37         {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_RC, RES_TYPE_ALL, RES_TYPE2_R0,
38                         RES_STATE_SLEEP), 4},
39         {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE2_R0,
40                         RES_STATE_SLEEP), 4},
41 };
42
43 static struct twl4030_script sleep_on_script __initdata = {
44         .script = sleep_on_seq,
45         .size   = ARRAY_SIZE(sleep_on_seq),
46         .flags  = TRITON_SLEEP_SCRIPT,
47 };
48
49 /*
50  * This script instructs twl4030 to first enable CLKEN, then wakeup the
51  * regulators and then all other resources.
52  */
53
54 static struct twl4030_ins wakeup_seq[] __initdata = {
55         {MSG_SINGULAR(DEV_GRP_NULL, 0x17, RES_STATE_ACTIVE), 0x30},
56         {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP_PR, RES_TYPE_ALL, RES_TYPE2_R0,
57                         RES_STATE_ACTIVE), 0x37},
58         {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL, RES_TYPE2_R0,
59                         RES_STATE_ACTIVE), 0x2},
60 };
61
62 static struct twl4030_script wakeup_script __initdata = {
63         .script = wakeup_seq,
64         .size   = ARRAY_SIZE(wakeup_seq),
65         .flags  = TRITON_WAKEUP12_SCRIPT | TRITON_WAKEUP3_SCRIPT,
66 };
67
68 static struct twl4030_script *twl4030_scripts[] __initdata = {
69         &sleep_on_script,
70         &wakeup_script,
71 };
72
73 struct twl4030_power_data generic3430_t2scripts_data __initdata = {
74         .scripts        = twl4030_scripts,
75         .size           = ARRAY_SIZE(twl4030_scripts),
76 };
77
78