]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-n800-pm.c
ARM: OMAP: Merge board specific files from N800 tree
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-n800-pm.c
1 /*
2  * Nokia N800 PM code
3  *
4  * Copyright (C) 2006 Nokia Corporation
5  * Author: Amit Kucheria <amit.kucheria@nokia.com>
6  *
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.
10  */
11
12 #include <linux/kernel.h>
13 #include <linux/module.h>
14 #include <asm/arch/menelaus.h>
15
16 #ifdef CONFIG_MENELAUS
17
18 static int n800_auto_sleep_regulators(void)
19 {
20         u32 val;
21         int ret;
22
23         val = EN_VPLL_SLEEP | EN_VMMC_SLEEP    \
24                 | EN_VAUX_SLEEP | EN_VIO_SLEEP \
25                 | EN_VMEM_SLEEP | EN_DC3_SLEEP \
26                 | EN_VC_SLEEP | EN_DC2_SLEEP;
27
28         ret = menelaus_set_regulator_sleep(1, val);
29         if (ret < 0) {
30                 printk(KERN_ERR "Could not set regulators to sleep on "
31                         "menelaus: %u\n", ret);
32                 return ret;
33         }
34         return 0;
35 }
36
37 static int n800_auto_voltage_scale(void)
38 {
39         int ret;
40
41         ret = menelaus_set_vcore_hw(1400, 1050);
42         if (ret < 0) {
43                 printk(KERN_ERR "Could not set VCORE voltage on "
44                         "menelaus: %u\n", ret);
45                 return ret;
46         }
47         return 0;
48 }
49
50 static int n800_menelaus_init(struct device *dev)
51 {
52         int ret;
53
54         ret = n800_auto_voltage_scale();
55         if (ret < 0)
56                 return ret;
57         ret = n800_auto_sleep_regulators();
58         if (ret < 0)
59                 return ret;
60         return 0;
61 }
62
63 static struct menelaus_platform_data n800_menelaus_platform_data = {
64         .late_init = n800_menelaus_init,
65 };
66
67 void __init n800_pm_init(void)
68 {
69         menelaus_set_platform_data(&n800_menelaus_platform_data);
70 }
71
72 #else
73
74 void __init n800_pm_init(void)
75 {
76 }
77
78 #endif
79