ARM: tegra: loki: fix build error due to warning
[linux-3.10.git] / arch / arm / mach-tegra / board-pmu-defines.h
1 /*
2  * board-pmu-defines.h: Most of macro definition used in board-xxx-power files.
3  *
4  * Copyright (c) 2013, 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, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * 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 #ifndef _MACH_TEGRA_BOARD_PMU_DEFINES_H
21 #define _MACH_TEGRA_BOARD_PMU_DEFINES_H
22
23 #define REGULATOR_MODE_0        0
24 #define PALMAS_PDATA_INIT(_name, _minmv, _maxmv, _supply_reg,           \
25         _always_on, _boot_on, _apply_uv, _init_mode)                    \
26         static struct regulator_init_data reg_idata_##_name = {         \
27                 .constraints = {                                        \
28                         .name = palmas_rails(_name),                    \
29                         .min_uV = (_minmv)*1000,                        \
30                         .max_uV = (_maxmv)*1000,                        \
31                         .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
32                                         REGULATOR_MODE_STANDBY),        \
33                         .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
34                                         REGULATOR_CHANGE_STATUS |       \
35                                         REGULATOR_CHANGE_VOLTAGE),      \
36                         .always_on = _always_on,                        \
37                         .boot_on = _boot_on,                            \
38                         .apply_uV = _apply_uv,                          \
39                         .initial_mode = REGULATOR_MODE_##_init_mode,    \
40                 },                                                      \
41                 .num_consumer_supplies =                                \
42                         ARRAY_SIZE(palmas_##_name##_supply),            \
43                 .consumer_supplies = palmas_##_name##_supply,           \
44                 .supply_regulator = _supply_reg,                        \
45         }
46
47
48 #define PALMAS_PINMUX(_pin, _mux, _pud, _od)                            \
49 {                                                                       \
50         .pin = _pin,                                                    \
51         .function = _mux,                                               \
52         .prop_bias_pull = _pud,                                         \
53         .prop_open_drain = _od,                                         \
54 }
55
56 #define PALMAS_REGS_PDATA(_name, _minmv, _maxmv, _supply_reg,           \
57         _always_on, _boot_on, _apply_uv, _init_mode,                    \
58         _warm_reset, _roof_floor, _mode_sleep, _ramp_us, _vsel)         \
59         static struct regulator_init_data reg_idata_##_name = {         \
60                 .constraints = {                                        \
61                         .name = palmas_rails(_name),                    \
62                         .min_uV = (_minmv)*1000,                        \
63                         .max_uV = (_maxmv)*1000,                        \
64                         .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
65                                         REGULATOR_MODE_STANDBY),        \
66                         .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
67                                         REGULATOR_CHANGE_STATUS |       \
68                                         REGULATOR_CHANGE_VOLTAGE),      \
69                         .always_on = _always_on | (_roof_floor != 0),   \
70                         .boot_on = _boot_on | (_roof_floor != 0),       \
71                         .apply_uV = _apply_uv,                          \
72                         .initial_mode = REGULATOR_MODE_##_init_mode,    \
73                         .ramp_delay = _ramp_us,                         \
74                 },                                                      \
75                 .num_consumer_supplies =                                \
76                         ARRAY_SIZE(palmas_##_name##_supply),            \
77                 .consumer_supplies = palmas_##_name##_supply,           \
78                 .supply_regulator = _supply_reg,                        \
79         };                                                              \
80         static struct palmas_reg_init reg_init_data_##_name = {         \
81                 .warm_reset = _warm_reset,                              \
82                 .roof_floor = _roof_floor,                              \
83                 .mode_sleep = _mode_sleep,                              \
84                 .enable_gpio = -EINVAL,                                 \
85                 .vsel = _vsel,                                          \
86         }
87
88 #define AS3722_SUPPLY(_name) "as3722_"#_name
89 #define AMS_PDATA_INIT(_name, _supply_reg, _min_uV, _max_uV, _always_on,\
90                          _boot_on, _apply_uV, _ext_cntrl)               \
91 static struct regulator_init_data as3722_##_name##_reg_idata =          \
92 {                                                                       \
93         .supply_regulator = _supply_reg,                                \
94         .constraints = {                                                \
95                 .name = AS3722_SUPPLY(_name),                           \
96                 .min_uV = _min_uV,                                      \
97                 .max_uV = _max_uV,                                      \
98                 .valid_modes_mask = (REGULATOR_MODE_NORMAL |            \
99                                      REGULATOR_MODE_STANDBY),           \
100                 .valid_ops_mask = (REGULATOR_CHANGE_MODE |              \
101                                    REGULATOR_CHANGE_STATUS |            \
102                                    REGULATOR_CHANGE_VOLTAGE),           \
103                 .always_on = _always_on,                                \
104                 .boot_on = _boot_on,                                    \
105                 .apply_uV = _apply_uV,                                  \
106         },                                                              \
107         .num_consumer_supplies =                                        \
108                 ARRAY_SIZE(as3722_##_name##_supply),                    \
109         .consumer_supplies = as3722_##_name##_supply,                   \
110 };                                                                      \
111 static struct as3722_regulator_platform_data as3722_##_name##_reg_pdata =       \
112 {                                                                       \
113         .reg_init = &as3722_##_name##_reg_idata,                        \
114         .ext_control = _ext_cntrl                                       \
115 }                                                                       \
116
117
118 /* Macro for defining fixed regulator sub device data */
119 #define fixed_sync_supply(_name) "fixed_reg_en_"#_name
120
121 #define FIXED_REG_DRV(_id, _drv, _var, _name, _in_supply,               \
122         _always_on, _boot_on, _gpio_nr, _open_drain,                    \
123         _active_high, _boot_state, _millivolts, _sdelay)                \
124 static struct regulator_init_data ri_data_##_var =                      \
125 {                                                                       \
126         .supply_regulator = _in_supply,                                 \
127         .num_consumer_supplies =                                        \
128                         ARRAY_SIZE(fixed_reg_en_##_name##_supply),      \
129         .consumer_supplies = fixed_reg_en_##_name##_supply,             \
130         .constraints = {                                                \
131                 .valid_modes_mask = (REGULATOR_MODE_NORMAL |            \
132                                         REGULATOR_MODE_STANDBY),        \
133                 .valid_ops_mask = (REGULATOR_CHANGE_MODE |              \
134                                         REGULATOR_CHANGE_STATUS |       \
135                                         REGULATOR_CHANGE_VOLTAGE),      \
136                 .always_on = _always_on,                                \
137                 .boot_on = _boot_on,                                    \
138         },                                                              \
139 };                                                                      \
140 static struct fixed_voltage_config fixed_reg_en_##_var##_pdata =        \
141 {                                                                       \
142         .supply_name = fixed_sync_supply(_name),                        \
143         .microvolts = _millivolts * 1000,                               \
144         .gpio = _gpio_nr,                                               \
145         .gpio_is_open_drain = _open_drain,                              \
146         .enable_high = _active_high,                                    \
147         .enabled_at_boot = _boot_state,                                 \
148         .init_data = &ri_data_##_var,                                   \
149         .startup_delay = _sdelay                                        \
150 };                                                                      \
151 static struct platform_device fixed_reg_en_##_var##_dev = {             \
152         .name = #_drv,                                                  \
153         .id = _id,                                                      \
154         .dev = {                                                        \
155                 .platform_data = &fixed_reg_en_##_var##_pdata,          \
156         },                                                              \
157 }
158
159 #define FIXED_SYNC_REG(_id, _var, _name, _in_supply,                    \
160         _always_on, _boot_on, _gpio_nr, _open_drain,                    \
161         _active_high, _boot_state, _millivolts, _sdelay)                \
162         FIXED_REG_DRV(_id, reg-fixed-sync-voltage, _var, _name,         \
163         _in_supply, _always_on, _boot_on, _gpio_nr, _open_drain,        \
164         _active_high, _boot_state, _millivolts, _sdelay)
165
166 #endif