]> 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 menelaus: %u\n", ret);
31                 return ret;
32         }
33         return 0;
34 }
35
36 static int n800_auto_voltage_scale(void)
37 {
38         int ret;
39
40         ret = menelaus_set_vcore_hw(1400, 1050);
41         if (ret < 0) {
42                 printk(KERN_ERR "Could not set VCORE voltage on menelaus: %u\n", ret);
43                 return ret;
44         }
45         return 0;
46 }
47
48 static int n800_menelaus_init(struct device *dev)
49 {
50         int ret;
51
52         ret = n800_auto_voltage_scale();
53         if (ret < 0)
54                 return ret;
55         ret = n800_auto_sleep_regulators();
56         if (ret < 0)
57                 return ret;
58         return 0;
59 }
60
61 static struct menelaus_platform_data n800_menelaus_platform_data = {
62         .late_init = n800_menelaus_init,
63 };
64
65 void __init n800_pm_init(void)
66 {
67         menelaus_set_platform_data(&n800_menelaus_platform_data);
68 }
69
70 #else
71
72 void __init n800_pm_init(void)
73 {
74 }
75
76 #endif
77