ARM: dalmore: Enable tps51632 cpu regulator
[linux-3.10.git] / arch / arm / mach-tegra / board-dalmore-power.c
1 /*
2  * arch/arm/mach-tegra/board-dalmore-power.c
3  *
4  * Copyright (C) 2012 NVIDIA Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #include <linux/i2c.h>
21 #include <linux/pda_power.h>
22 #include <linux/platform_device.h>
23 #include <linux/resource.h>
24 #include <linux/io.h>
25 #include <linux/regulator/tps51632-regulator.h>
26 #include <linux/regulator/machine.h>
27 #include <linux/regulator/driver.h>
28
29 #include <mach/iomap.h>
30 #include <mach/irqs.h>
31
32 #include "pm.h"
33 #include "board.h"
34 #include "board-dalmore.h"
35
36
37 /* TPS51632 DC-DC converter */
38 static struct regulator_consumer_supply tps51632_dcdc_supply[] = {
39         REGULATOR_SUPPLY("vdd_cpu", NULL),
40 };
41
42 static struct regulator_init_data tps51632_init_data = {
43         .constraints = {                                                \
44                 .min_uV = 500000,                                       \
45                         .max_uV = 1520000,                              \
46                         .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
47                                         REGULATOR_MODE_STANDBY),        \
48                         .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
49                                         REGULATOR_CHANGE_STATUS |       \
50                                         REGULATOR_CHANGE_VOLTAGE),      \
51                         .always_on = 1,                                 \
52                         .boot_on =  1,                                  \
53                         .apply_uV = 0,                                  \
54         },                                                              \
55         .num_consumer_supplies = ARRAY_SIZE(tps51632_dcdc_supply),      \
56                 .consumer_supplies = tps51632_dcdc_supply,              \
57 };
58
59 static struct tps51632_regulator_platform_data tps51632_pdata = {
60         .reg_init_data = &tps51632_init_data,           \
61         .enable_pwm = false,                            \
62         .max_voltage_uV = 1520000,                      \
63         .base_voltage_uV = 500000,                      \
64         .slew_rate_uv_per_us = 6000,                    \
65 };
66
67 static struct i2c_board_info __initdata tps51632_boardinfo[] = {
68         {
69                 I2C_BOARD_INFO("tps51632", 0x43),
70                 .platform_data  = &tps51632_pdata,
71         },
72 };
73
74 static int ac_online(void)
75 {
76         return 1;
77 }
78
79 static struct resource dalmore_pda_resources[] = {
80         [0] = {
81                 .name   = "ac",
82         },
83 };
84
85 static struct pda_power_pdata dalmore_pda_data = {
86         .is_ac_online   = ac_online,
87 };
88
89 static struct platform_device dalmore_pda_power_device = {
90         .name           = "pda-power",
91         .id             = -1,
92         .resource       = dalmore_pda_resources,
93         .num_resources  = ARRAY_SIZE(dalmore_pda_resources),
94         .dev    = {
95                 .platform_data  = &dalmore_pda_data,
96         },
97 };
98
99 static struct tegra_suspend_platform_data dalmore_suspend_data = {
100         .cpu_timer      = 2000,
101         .cpu_off_timer  = 0,
102         .suspend_mode   = TEGRA_SUSPEND_NONE,
103         .core_timer     = 0x7e7e,
104         .core_off_timer = 0,
105         .corereq_high   = false,
106         .sysclkreq_high = true,
107 };
108
109
110 int __init dalmore_regulator_init(void)
111 {
112         i2c_register_board_info(4, tps51632_boardinfo, 1);
113         platform_device_register(&dalmore_pda_power_device);
114         return 0;
115 }
116
117 int __init dalmore_suspend_init(void)
118 {
119         tegra_init_suspend(&dalmore_suspend_data);
120         return 0;
121 }
122