arm: regulator: gpio_switch: Registering gpio rails as sub devices.
[linux-2.6.git] / arch / arm / mach-tegra / board-cardhu-power.c
1 /*
2  * arch/arm/mach-tegra/board-cardhu-power.c
3  *
4  * Copyright (C) 2011 NVIDIA, Inc.
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
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18  * 02111-1307, USA
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/regulator/machine.h>
25 #include <linux/mfd/tps6591x.h>
26 #include <linux/gpio.h>
27 #include <mach/suspend.h>
28 #include <linux/io.h>
29 #include <linux/gpio-switch-regulator.h>
30
31 #include <mach/iomap.h>
32 #include <mach/irqs.h>
33 #include <mach/pinmux.h>
34
35 #include "gpio-names.h"
36 #include "board-cardhu.h"
37 #include "power.h"
38 #include "wakeups-t3.h"
39
40 #ifdef CONFIG_MFD_TPS6591X
41 static struct regulator_consumer_supply tps6591x_vdd1_supply[] = {
42         REGULATOR_SUPPLY("vdd_core", NULL),
43         REGULATOR_SUPPLY("en_vddio_ddr_1v2", NULL),
44 };
45
46 static struct regulator_consumer_supply tps6591x_vdd2_supply[] = {
47         REGULATOR_SUPPLY("vdd_gen1v5", NULL),
48         REGULATOR_SUPPLY("vcore_lcd", NULL),
49         REGULATOR_SUPPLY("track_ldo1", NULL),
50         REGULATOR_SUPPLY("external_ldo_1v2", NULL),
51         REGULATOR_SUPPLY("vcore_cam1", NULL),
52         REGULATOR_SUPPLY("vcore_cam2", NULL),
53 };
54
55 static struct regulator_consumer_supply tps6591x_vddctrl_supply[] = {
56         REGULATOR_SUPPLY("vdd_cpu_pmu", NULL),
57         REGULATOR_SUPPLY("vdd_cpu", NULL),
58         REGULATOR_SUPPLY("vdd_sys", NULL),
59 };
60
61 static struct regulator_consumer_supply tps6591x_vio_supply[] = {
62         REGULATOR_SUPPLY("vdd_gen1v8", NULL),
63         REGULATOR_SUPPLY("avdd_hdmi_pll", NULL),
64         REGULATOR_SUPPLY("avdd_usb_pll", NULL),
65         REGULATOR_SUPPLY("avdd_osc", NULL),
66         REGULATOR_SUPPLY("vddio_sys", NULL),
67         REGULATOR_SUPPLY("vddio_sdmmc4", NULL),
68         REGULATOR_SUPPLY("vdd1v8_satelite", NULL),
69         REGULATOR_SUPPLY("vddio_uart", NULL),
70         REGULATOR_SUPPLY("vddio_audio", NULL),
71         REGULATOR_SUPPLY("vddio_bb", NULL),
72         REGULATOR_SUPPLY("vddio_lcd_pmu", NULL),
73         REGULATOR_SUPPLY("vddio_cam", NULL),
74         REGULATOR_SUPPLY("vddio_vi", NULL),
75         REGULATOR_SUPPLY("ldo6", NULL),
76         REGULATOR_SUPPLY("ldo7", NULL),
77         REGULATOR_SUPPLY("ldo8", NULL),
78         REGULATOR_SUPPLY("vcore_audio", NULL),
79         REGULATOR_SUPPLY("avcore_audio", NULL),
80         REGULATOR_SUPPLY("vddio_sdmmc3", NULL),
81         REGULATOR_SUPPLY("vcore1_lpddr2", NULL),
82         REGULATOR_SUPPLY("vcom_1v8", NULL),
83         REGULATOR_SUPPLY("pmuio_1v8", NULL),
84         REGULATOR_SUPPLY("avdd_ic_usb", NULL),
85 };
86
87 static struct regulator_consumer_supply tps6591x_ldo1_supply[] = {
88         REGULATOR_SUPPLY("avdd_pexb", NULL),
89         REGULATOR_SUPPLY("vdd_pexb", NULL),
90         REGULATOR_SUPPLY("avdd_pex_pll", NULL),
91         REGULATOR_SUPPLY("avdd_pexa", NULL),
92         REGULATOR_SUPPLY("vdd_pexa", NULL),
93 };
94
95 static struct regulator_consumer_supply tps6591x_ldo2_supply[] = {
96         REGULATOR_SUPPLY("avdd_sata", NULL),
97         REGULATOR_SUPPLY("vdd_sata", NULL),
98         REGULATOR_SUPPLY("avdd_sata_pll", NULL),
99         REGULATOR_SUPPLY("avdd_plle", NULL),
100 };
101
102 #if defined(CONFIG_TEGRA_VERBIER_E1187)
103 static struct regulator_consumer_supply tps6591x_ldo3_supply[] = {
104         REGULATOR_SUPPLY("vddio_sdmmc1", NULL),
105 };
106 #else
107 static struct regulator_consumer_supply tps6591x_ldo3_supply[] = {
108         REGULATOR_SUPPLY("unused_rail_ldo3", NULL),
109 };
110 #endif
111
112 static struct regulator_consumer_supply tps6591x_ldo4_supply[] = {
113         REGULATOR_SUPPLY("vdd_rtc", NULL),
114 };
115
116 static struct regulator_consumer_supply tps6591x_ldo5_supply[] = {
117         REGULATOR_SUPPLY("avdd_vdac", NULL),
118 #if !defined(CONFIG_TEGRA_VERBIER_E1187)
119         REGULATOR_SUPPLY("vddio_sdmmc1", NULL),
120 #endif
121 };
122 static struct regulator_consumer_supply tps6591x_ldo6_supply[] = {
123         REGULATOR_SUPPLY("avdd_dsi_csi", NULL),
124 };
125 static struct regulator_consumer_supply tps6591x_ldo7_supply[] = {
126         REGULATOR_SUPPLY("avdd_plla_p_c_s", NULL),
127         REGULATOR_SUPPLY("avdd_pllm", NULL),
128         REGULATOR_SUPPLY("avdd_pllu_d", NULL),
129         REGULATOR_SUPPLY("avdd_pllu_d2", NULL),
130         REGULATOR_SUPPLY("avdd_pllx", NULL),
131 };
132
133 static struct regulator_consumer_supply tps6591x_ldo8_supply[] = {
134         REGULATOR_SUPPLY("vdd_ddr_hs", NULL),
135 };
136
137 #define REGULATOR_INIT(_id, _minmv, _maxmv)                             \
138         {                                                               \
139                 .constraints = {                                        \
140                         .min_uV = (_minmv)*1000,                        \
141                         .max_uV = (_maxmv)*1000,                        \
142                         .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
143                                              REGULATOR_MODE_STANDBY),   \
144                         .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
145                                            REGULATOR_CHANGE_STATUS |    \
146                                            REGULATOR_CHANGE_VOLTAGE),   \
147                 },                                                      \
148                 .num_consumer_supplies = ARRAY_SIZE(tps6591x_##_id##_supply),\
149                 .consumer_supplies = tps6591x_##_id##_supply,           \
150         }
151
152 #define REGULATOR_INIT_SUPPLY(_id, _minmv, _maxmv, _supply_reg)         \
153         {                                                               \
154                 .constraints = {                                        \
155                         .min_uV = (_minmv)*1000,                        \
156                         .max_uV = (_maxmv)*1000,                        \
157                         .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
158                                              REGULATOR_MODE_STANDBY),   \
159                         .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
160                                            REGULATOR_CHANGE_STATUS |    \
161                                            REGULATOR_CHANGE_VOLTAGE),   \
162                 },                                                      \
163                 .num_consumer_supplies = ARRAY_SIZE(tps6591x_##_id##_supply),\
164                 .consumer_supplies = tps6591x_##_id##_supply,           \
165                 .supply_regulator = tps6591x_rails(_supply_reg),        \
166         }
167
168 static struct regulator_init_data vdd1_data = REGULATOR_INIT(vdd1, 600, 1500);
169 static struct regulator_init_data vdd2_data = REGULATOR_INIT(vdd2, 600, 1500);
170 static struct regulator_init_data vddctrl_data = REGULATOR_INIT(vddctrl, 600,
171                                                 1400);
172 static struct regulator_init_data vio_data = REGULATOR_INIT(vio, 1500, 3300);
173 static struct regulator_init_data ldo1_data = REGULATOR_INIT_SUPPLY(ldo1,
174                                                 1000, 3300, VDD_2);
175 static struct regulator_init_data ldo2_data = REGULATOR_INIT_SUPPLY(ldo2,
176                                                 1000, 3300, VDD_2);
177 static struct regulator_init_data ldo3_data = REGULATOR_INIT(ldo3, 1000, 3300);
178 static struct regulator_init_data ldo4_data = REGULATOR_INIT(ldo4, 1000, 3300);
179 static struct regulator_init_data ldo5_data = REGULATOR_INIT(ldo5, 1000, 3300);
180 static struct regulator_init_data ldo6_data = REGULATOR_INIT_SUPPLY(ldo6,
181                                                 1000, 3300, VIO);
182 static struct regulator_init_data ldo7_data = REGULATOR_INIT_SUPPLY(ldo7,
183                                                 1000, 3300, VIO);
184 static struct regulator_init_data ldo8_data = REGULATOR_INIT_SUPPLY(ldo8,
185                                                 1000, 3300, VIO);
186
187 static struct tps6591x_rtc_platform_data rtc_data = {
188         .irq = TEGRA_NR_IRQS + TPS6591X_INT_RTC_ALARM,
189 };
190
191 #define TPS_REG(_id, _data)                     \
192         {                                       \
193                 .id     = TPS6591X_ID_##_id,    \
194                 .name   = "tps6591x-regulator", \
195                 .platform_data  = _data,        \
196         }
197
198 static struct tps6591x_subdev_info tps_devs[] = {
199         TPS_REG(VIO, &vio_data),
200         TPS_REG(VDD_1, &vdd1_data),
201         TPS_REG(VDD_2, &vdd2_data),
202         TPS_REG(VDDCTRL, &vddctrl_data),
203         TPS_REG(LDO_1, &ldo1_data),
204         TPS_REG(LDO_2, &ldo2_data),
205         TPS_REG(LDO_3, &ldo3_data),
206         TPS_REG(LDO_4, &ldo4_data),
207         TPS_REG(LDO_5, &ldo5_data),
208         TPS_REG(LDO_6, &ldo6_data),
209         TPS_REG(LDO_7, &ldo7_data),
210         TPS_REG(LDO_8, &ldo8_data),
211         {
212                 .id     = 0,
213                 .name   = "tps6591x-rtc",
214                 .platform_data = &rtc_data,
215         },
216 };
217
218 static struct tps6591x_platform_data tps_platform = {
219         .irq_base       = TEGRA_NR_IRQS,
220         .num_subdevs    = ARRAY_SIZE(tps_devs),
221         .subdevs        = tps_devs,
222         .gpio_base      = TPS6591X_GPIO_BASE,
223 };
224
225 static struct i2c_board_info __initdata cardhu_regulators[] = {
226         {
227                 I2C_BOARD_INFO("tps6591x", 0x2D),
228                 .irq            = INT_EXTERNAL_PMU,
229                 .platform_data  = &tps_platform,
230         },
231 };
232
233 int __init cardhu_regulator_init(void)
234 {
235         i2c_register_board_info(4, cardhu_regulators, 1);
236         return 0;
237 }
238 #else
239 int __init cardhu_regulator_init(void)
240 {
241         return 0;
242 }
243 #endif
244
245 #ifdef CONFIG_REGULATOR_GPIO_SWITCH
246
247 /* EN_5V_CP from PMU GP0 */
248 static struct regulator_consumer_supply gpio_switch_en_5v_cp_supply[] = {
249         REGULATOR_SUPPLY("vdd_5v0_sby", NULL),
250         REGULATOR_SUPPLY("vdd_hall", NULL),
251         REGULATOR_SUPPLY("vterm_ddr", NULL),
252         REGULATOR_SUPPLY("v2ref_ddr", NULL),
253 };
254 static int gpio_switch_en_5v_cp_voltages[] = { 5000};
255
256 /* EN_5V0 From PMU GP2 */
257 static struct regulator_consumer_supply gpio_switch_en_5v0_supply[] = {
258         REGULATOR_SUPPLY("vdd_5v0_sys", NULL),
259 };
260 static int gpio_switch_en_5v0_voltages[] = { 5000};
261
262 /* EN_DDR From PMU GP6 */
263 static struct regulator_consumer_supply gpio_switch_en_ddr_supply[] = {
264         REGULATOR_SUPPLY("mem_vddio_ddr", NULL),
265         REGULATOR_SUPPLY("t30_vddio_ddr", NULL),
266 };
267 static int gpio_switch_en_ddr_voltages[] = { 1500};
268
269 /* EN_3V3_SYS From PMU GP7 */
270 static struct regulator_consumer_supply gpio_switch_en_3v3_sys_supply[] = {
271         REGULATOR_SUPPLY("vdd_lvds", NULL),
272         REGULATOR_SUPPLY("vdd_pnl", NULL),
273         REGULATOR_SUPPLY("vcom_3v3", NULL),
274         REGULATOR_SUPPLY("vdd_3v3", NULL),
275         REGULATOR_SUPPLY("vcore_mmc", NULL),
276         REGULATOR_SUPPLY("vddo_pex_ctl", NULL),
277         REGULATOR_SUPPLY("hvdd_pex", NULL),
278         REGULATOR_SUPPLY("avdd_hdmi", NULL),
279         REGULATOR_SUPPLY("vpp_fuse", NULL),
280         REGULATOR_SUPPLY("avdd_usb", NULL),
281         REGULATOR_SUPPLY("vdd_ddr_rx", NULL),
282         REGULATOR_SUPPLY("vcore_nand", NULL),
283         REGULATOR_SUPPLY("hvdd_sata", NULL),
284         REGULATOR_SUPPLY("vddio_gmi_pmu", NULL),
285         REGULATOR_SUPPLY("avdd_cam1", NULL),
286         REGULATOR_SUPPLY("vdd_af", NULL),
287         REGULATOR_SUPPLY("avdd_cam2", NULL),
288         REGULATOR_SUPPLY("vdd_acc", NULL),
289         REGULATOR_SUPPLY("vdd_phtl", NULL),
290         REGULATOR_SUPPLY("vddio_tp", NULL),
291         REGULATOR_SUPPLY("vdd_led", NULL),
292         REGULATOR_SUPPLY("vddio_cec", NULL),
293         REGULATOR_SUPPLY("vdd_cmps", NULL),
294         REGULATOR_SUPPLY("vdd_temp", NULL),
295         REGULATOR_SUPPLY("vpp_kfuse", NULL),
296         REGULATOR_SUPPLY("vddio_ts", NULL),
297         REGULATOR_SUPPLY("vdd_ir_led", NULL),
298         REGULATOR_SUPPLY("vddio_1wire", NULL),
299         REGULATOR_SUPPLY("avddio_audio", NULL),
300         REGULATOR_SUPPLY("vdd_ec", NULL),
301         REGULATOR_SUPPLY("vcom_pa", NULL),
302         REGULATOR_SUPPLY("vdd_3v3_devices", NULL),
303         REGULATOR_SUPPLY("vdd_3v3_dock", NULL),
304         REGULATOR_SUPPLY("debug_cons", NULL),
305 };
306 static int gpio_switch_en_3v3_sys_voltages[] = { 3300};
307
308 /* DIS_5V_SWITCH from AP SPI2_SCK X02 */
309 static struct regulator_consumer_supply gpio_switch_dis_5v_switch_supply[] = {
310         REGULATOR_SUPPLY("master_5v_switch", NULL),
311 };
312 static int gpio_switch_dis_5v_switch_voltages[] = { 5000};
313
314 /* EN_VDD_BL from AP GPIO GMI_CS2  K03 */
315 static struct regulator_consumer_supply gpio_switch_en_vdd_bl_supply[] = {
316         REGULATOR_SUPPLY("vdd_backlight", NULL),
317 };
318 static int gpio_switch_en_vdd_bl_voltages[] = { 5000};
319
320 /* EN_3V3_MODEM from AP GPIO VI_VSYNCH D06*/
321 static struct regulator_consumer_supply gpio_switch_en_3v3_modem_supply[] = {
322         REGULATOR_SUPPLY("vdd_3v3_mini_card", NULL),
323         REGULATOR_SUPPLY("vdd_mini_card", NULL),
324 };
325 static int gpio_switch_en_3v3_modem_voltages[] = { 3300};
326
327 /* EN_USB1_VBUS_OC from AP GPIO GMI_RST I04*/
328 static struct regulator_consumer_supply gpio_switch_en_usb1_vbus_oc_supply[] = {
329         REGULATOR_SUPPLY("vdd_vbus_micro_usb", NULL),
330 };
331 static int gpio_switch_en_usb1_vbus_oc_voltages[] = { 5000};
332
333 /*EN_USB3_VBUS_OC from AP GPIO GMI_AD15 H07*/
334 static struct regulator_consumer_supply gpio_switch_en_usb3_vbus_oc_supply[] = {
335         REGULATOR_SUPPLY("vdd_vbus_typea_usb", NULL),
336 };
337 static int gpio_switch_en_usb3_vbus_oc_voltages[] = { 5000};
338
339 /* EN_VDDIO_VID_OC from AP GPIO VI_PCLK T00*/
340 static struct regulator_consumer_supply gpio_switch_en_vddio_vid_oc_supply[] = {
341         REGULATOR_SUPPLY("vdd_hdmi_con", NULL),
342 };
343 static int gpio_switch_en_vddio_vid_oc_voltages[] = { 5000};
344
345 /* EN_VDD_PNL1 from AP GPIO VI_D6 L04*/
346 static struct regulator_consumer_supply gpio_switch_en_vdd_pnl1_supply[] = {
347         REGULATOR_SUPPLY("vdd_lcd_panel", NULL),
348 };
349 static int gpio_switch_en_vdd_pnl1_voltages[] = { 3300};
350
351 /* CAM3_LDO_EN from AP GPIO KB_ROW8 S00*/
352 static struct regulator_consumer_supply gpio_switch_cam3_ldo_en_supply[] = {
353         REGULATOR_SUPPLY("vdd_cam3", NULL),
354 };
355 static int gpio_switch_cam3_ldo_en_voltages[] = { 3300};
356
357 /* EN_VDD_COM from AP GPIO SDMMC3_DAT5 D00*/
358 static struct regulator_consumer_supply gpio_switch_en_vdd_com_supply[] = {
359         REGULATOR_SUPPLY("vdd_com_bd", NULL),
360 };
361 static int gpio_switch_en_vdd_com_voltages[] = { 3300};
362
363 /* EN_VDD_SDMMC1 from AP GPIO VI_HSYNC D07*/
364 static struct regulator_consumer_supply gpio_switch_en_vdd_sdmmc1_supply[] = {
365         REGULATOR_SUPPLY("vddio_sd_slot", NULL),
366 };
367 static int gpio_switch_en_vdd_sdmmc1_voltages[] = { 3300};
368
369 /* EN_3V3_EMMC from AP GPIO SDMMC3_DAT4 D01*/
370 static struct regulator_consumer_supply gpio_switch_en_3v3_emmc_supply[] = {
371         REGULATOR_SUPPLY("vdd_emmc_core", NULL),
372 };
373 static int gpio_switch_en_3v3_emmc_voltages[] = { 3300};
374
375 /* EN_3V3_PEX_HVDD from AP GPIO VI_D09 L07*/
376 static struct regulator_consumer_supply gpio_switch_en_3v3_pex_hvdd_supply[] = {
377         REGULATOR_SUPPLY("hvdd_pex_3v3", NULL),
378 };
379 static int gpio_switch_en_3v3_pex_hvdd_voltages[] = { 3300};
380
381 /* EN_3v3_FUSE from AP GPIO VI_D08 L06*/
382 static struct regulator_consumer_supply gpio_switch_en_3v3_fuse_supply[] = {
383         REGULATOR_SUPPLY("vpp_fuse_pg", NULL),
384 };
385 static int gpio_switch_en_3v3_fuse_voltages[] = { 3300};
386
387 /* EN_1V8_CAM from AP GPIO GPIO_PBB4 PBB04*/
388 static struct regulator_consumer_supply gpio_switch_en_1v8_cam_supply[] = {
389         REGULATOR_SUPPLY("vdd_1v8_cam1", NULL),
390         REGULATOR_SUPPLY("vdd_1v8_cam2", NULL),
391         REGULATOR_SUPPLY("vdd_1v8_cam3", NULL),
392 };
393 static int gpio_switch_en_1v8_cam_voltages[] = { 1800};
394
395 static int enable_load_switch_rail(
396                 struct gpio_switch_regulator_subdev_data *psubdev_data)
397 {
398         int ret;
399
400         if (psubdev_data->pin_group <= 0)
401                 return -EINVAL;
402
403         /* Tristate and make pin as input*/
404         ret = tegra_pinmux_set_tristate(psubdev_data->pin_group,
405                                                 TEGRA_TRI_TRISTATE);
406         if (ret < 0)
407                 return ret;
408         return gpio_direction_input(psubdev_data->gpio_nr);
409 }
410
411 static int disable_load_switch_rail(
412                 struct gpio_switch_regulator_subdev_data *psubdev_data)
413 {
414         int ret;
415
416         if (psubdev_data->pin_group <= 0)
417                 return -EINVAL;
418
419         /* Un-tristate and driver low */
420         ret = tegra_pinmux_set_tristate(psubdev_data->pin_group,
421                                                 TEGRA_TRI_NORMAL);
422         if (ret < 0)
423                 return ret;
424         return gpio_direction_output(psubdev_data->gpio_nr, 0);
425 }
426
427 /* Macro for defining gpio switch regulator sub device data */
428 #define GREG_INIT(_id, _name, _input_supply, _gpio_nr, _active_low,     \
429                         _init_state, _pg, _enable, _disable)            \
430         [_id] = {                                                       \
431                 .regulator_name = "gpio-switch-"#_name,                 \
432                 .input_supply   = _input_supply,                        \
433                 .id             = _id,                                  \
434                 .gpio_nr        = _gpio_nr,                             \
435                 .pin_group      = _pg,                                  \
436                 .active_low     = _active_low,                          \
437                 .init_state     = _init_state,                          \
438                 .voltages       = gpio_switch_##_name##_voltages,       \
439                 .n_voltages     = ARRAY_SIZE(gpio_switch_##_name##_voltages), \
440                 .num_consumer_supplies =                                \
441                                 ARRAY_SIZE(gpio_switch_##_name##_supply), \
442                 .consumer_supplies = gpio_switch_##_name##_supply,      \
443                 .constraints = {                                        \
444                         .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
445                                              REGULATOR_MODE_STANDBY),   \
446                         .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
447                                            REGULATOR_CHANGE_STATUS |    \
448                                            REGULATOR_CHANGE_VOLTAGE),   \
449                 },                                                      \
450                 .enable_rail = _enable,                                 \
451                 .disable_rail = _disable,                               \
452         },
453
454 static __initdata struct gpio_switch_regulator_subdev_data gswitch_subdevs[] =
455 {
456 /* Gpio switch regulator platform data */
457 GREG_INIT(0, en_5v_cp,   NULL, TPS6591X_GPIO_GP0, false, 0, 0, 0, 0)
458 GREG_INIT(1, en_5v0,     NULL, TPS6591X_GPIO_GP2, false, 0, 0, 0, 0)
459 GREG_INIT(2, en_ddr,     NULL, TPS6591X_GPIO_GP6, false, 0, 0, 0, 0)
460 GREG_INIT(3, en_3v3_sys, NULL, TPS6591X_GPIO_GP7, false, 0, 0, 0, 0)
461
462 GREG_INIT(4, dis_5v_switch,   "vdd_5v0_sys", TEGRA_GPIO_PX2,
463                         true, 0, 0, 0, 0)
464 GREG_INIT(5, en_vdd_bl,       NULL,          TEGRA_GPIO_PK3,
465                         false, 1, 0, 0, 0)
466 GREG_INIT(6, en_3v3_modem,    NULL,          TEGRA_GPIO_PD6,
467                         false, 0, 0, 0, 0)
468 GREG_INIT(7, en_usb1_vbus_oc, "master_5v_switch", TEGRA_GPIO_PI4,
469                         false, 0, TEGRA_PINGROUP_GMI_RST_N,
470                         enable_load_switch_rail, disable_load_switch_rail)
471 GREG_INIT(8, en_usb3_vbus_oc, "master_5v_switch", TEGRA_GPIO_PH7,
472                         false, 0, TEGRA_PINGROUP_GMI_AD15,
473                         enable_load_switch_rail, disable_load_switch_rail)
474 GREG_INIT(9, en_vddio_vid_oc, "master_5v_switch", TEGRA_GPIO_PT0,
475                         false, 0, TEGRA_PINGROUP_VI_PCLK,
476                         enable_load_switch_rail, disable_load_switch_rail)
477
478 GREG_INIT(10, en_vdd_pnl1, "vdd_3v3_devices", TEGRA_GPIO_PL4,
479                         false, 1, 0, 0, 0)
480 GREG_INIT(11, cam3_ldo_en, "vdd_3v3_devices", TEGRA_GPIO_PS0,
481                         false, 0, 0, 0, 0)
482 GREG_INIT(12, en_vdd_com,  "vdd_3v3_devices", TEGRA_GPIO_PD0,
483                         false, 1, 0, 0, 0)
484 GREG_INIT(13, en_3v3_fuse, "vdd_3v3_devices", TEGRA_GPIO_PL6,
485                         false, 0, 0, 0, 0)
486 GREG_INIT(14, en_3v3_emmc, "vdd_3v3_devices", TEGRA_GPIO_PD1,
487                         false, 1, 0, 0, 0)
488 GREG_INIT(15, en_vdd_sdmmc1, "vdd_3v3_devices", TEGRA_GPIO_PD7,
489                         false, 1, 0, 0, 0)
490 GREG_INIT(16, en_3v3_pex_hvdd, "vdd_3v3_devices", TEGRA_GPIO_PL7,
491                         false, 0, 0, 0, 0)
492
493 GREG_INIT(17, en_1v8_cam,  "vdd_gen1v8", TEGRA_GPIO_PBB4,
494                         false, 0, 0, 0, 0)
495 };
496
497 static __initdata struct gpio_switch_regulator_platform_data  gswitch_pdata = {
498         .num_subdevs = ARRAY_SIZE(gswitch_subdevs),
499         .subdevs = gswitch_subdevs,
500 };
501
502 static struct platform_device gswitch_regulator_pdata = {       \
503         .name = "gpio-switch-regulator",                        \
504         .id   = -1,                                             \
505         .dev  = {                                               \
506              .platform_data = &gswitch_pdata,                   \
507         },                                                      \
508 };
509 int __init cardhu_gpio_switch_regulator_init(void)
510 {
511         int i;
512         for (i = 0; i < ARRAY_SIZE(gswitch_subdevs); ++i) {
513                 if (gswitch_subdevs[i].gpio_nr <= TEGRA_NR_GPIOS)
514                         tegra_gpio_enable(gswitch_subdevs[i].gpio_nr);
515         }
516
517         return platform_device_register(&gswitch_regulator_pdata);
518 }
519 #else
520 int __init cardhu_gpio_switch_regulator_init(void)
521 {
522         return 0;
523 }
524 #endif
525
526 static struct tegra_suspend_platform_data cardhu_suspend_data = {
527         .cpu_timer      = 2000,
528         .cpu_off_timer  = 0,
529         .suspend_mode   = TEGRA_SUSPEND_NONE,
530         .core_timer     = 0x7e7e,
531         .core_off_timer = 0,
532         .separate_req   = true,
533         .corereq_high   = false,
534         .sysclkreq_high = true,
535         .wake_enb       = 0,
536         .wake_high      = 0,
537         .wake_low       = 0,
538         .wake_any       = 0,
539 };
540
541 int __init cardhu_suspend_init(void)
542 {
543         tegra_init_suspend(&cardhu_suspend_data);
544         return 0;
545
546 }