arm: tegra: cardhu: Use fixed regulator
Laxman Dewangan [Wed, 11 Jan 2012 10:25:27 +0000 (15:25 +0530)]
Using fixed regulator in place of gpio-switch regulator.
Fixed regulator is very similar to gpio-switch regulator
and it is available by default in linux kernel.

gpio-switch-regulator will be used only for the open
collector load switches.

bug 923713

Change-Id: I42480cb314135d475b4d4b56bb5e8e73eba2f77e
Reviewed-on: http://git-master/r/74536
Reviewed-by: Simone Willett <swillett@nvidia.com>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/76465
Reviewed-by: Automatic_Commit_Validation_User

Rebase-Id: Rf6810be0f702b017083ac1c88d45b481ea2b2eb7

arch/arm/mach-tegra/board-cardhu-pm298-power-rails.c
arch/arm/mach-tegra/board-cardhu-pm299-power-rails.c
arch/arm/mach-tegra/board-cardhu-power.c
arch/arm/mach-tegra/board-cardhu.c
arch/arm/mach-tegra/board-cardhu.h

index 50e10fc..32a8da2 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/gpio.h>
 #include <linux/io.h>
 #include <linux/regulator/gpio-switch-regulator.h>
+#include <linux/regulator/fixed.h>
 #include <linux/mfd/max77663-core.h>
 #include <linux/regulator/max77663-regulator.h>
 
@@ -368,30 +369,27 @@ int __init cardhu_pm298_regulator_init(void)
        return 0;
 }
 
-static struct regulator_consumer_supply gpio_switch_en_track_ldo2_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_track_ldo2_supply[] = {
        REGULATOR_SUPPLY("avdd_sata", NULL),
        REGULATOR_SUPPLY("vdd_sata", NULL),
        REGULATOR_SUPPLY("avdd_sata_pll", NULL),
        REGULATOR_SUPPLY("avdd_plle", NULL),
 };
-static int gpio_switch_en_track_ldo2_voltages[] = { 3300};
 
-static struct regulator_consumer_supply gpio_switch_en_5v0_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_5v0_supply[] = {
        REGULATOR_SUPPLY("vdd_5v0_sys", NULL),
        REGULATOR_SUPPLY("vdd_5v0_sby", NULL),
        REGULATOR_SUPPLY("vdd_hall", NULL),
        REGULATOR_SUPPLY("vterm_ddr", NULL),
        REGULATOR_SUPPLY("v2ref_ddr", NULL),
 };
-static int gpio_switch_en_5v0_voltages[] = { 5000};
 
-static struct regulator_consumer_supply gpio_switch_en_ddr_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_ddr_supply[] = {
        REGULATOR_SUPPLY("mem_vddio_ddr", NULL),
        REGULATOR_SUPPLY("t30_vddio_ddr", NULL),
 };
-static int gpio_switch_en_ddr_voltages[] = { 1500};
 
-static struct regulator_consumer_supply gpio_switch_en_3v3_sys_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_sys_supply[] = {
        REGULATOR_SUPPLY("avdd_vdac", NULL),
        REGULATOR_SUPPLY("vdd_lvds", NULL),
        REGULATOR_SUPPLY("vdd_pnl", NULL),
@@ -437,104 +435,72 @@ static struct regulator_consumer_supply gpio_switch_en_3v3_sys_supply[] = {
        REGULATOR_SUPPLY("debug_cons", NULL),
        REGULATOR_SUPPLY("vdd", "4-004c"),
 };
-static int gpio_switch_en_3v3_sys_voltages[] = { 3300};
 
 /* DIS_5V_SWITCH from AP SPI2_SCK X02 */
-static struct regulator_consumer_supply gpio_switch_dis_5v_switch_supply[] = {
+static struct regulator_consumer_supply fixed_reg_dis_5v_switch_supply[] = {
        REGULATOR_SUPPLY("master_5v_switch", NULL),
 };
-static int gpio_switch_dis_5v_switch_voltages[] = { 5000};
 
 /* EN_VDD_BL */
-static struct regulator_consumer_supply gpio_switch_en_vdd_bl_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_bl_supply[] = {
        REGULATOR_SUPPLY("vdd_backlight", NULL),
        REGULATOR_SUPPLY("vdd_backlight1", NULL),
 };
-static int gpio_switch_en_vdd_bl_voltages[] = { 5000};
 
 /* EN_3V3_MODEM from AP GPIO VI_VSYNCH D06*/
-static struct regulator_consumer_supply gpio_switch_en_3v3_modem_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_modem_supply[] = {
        REGULATOR_SUPPLY("vdd_3v3_mini_card", NULL),
        REGULATOR_SUPPLY("vdd_mini_card", NULL),
 };
-static int gpio_switch_en_3v3_modem_voltages[] = { 3300};
-
-/* EN_USB1_VBUS_OC*/
-static struct regulator_consumer_supply gpio_switch_en_usb1_vbus_oc_supply[] = {
-       REGULATOR_SUPPLY("vdd_vbus_micro_usb", NULL),
-};
-static int gpio_switch_en_usb1_vbus_oc_voltages[] = { 5000};
-
-/*EN_USB3_VBUS_OC*/
-static struct regulator_consumer_supply gpio_switch_en_usb3_vbus_oc_supply[] = {
-       REGULATOR_SUPPLY("vdd_vbus_typea_usb", NULL),
-};
-static int gpio_switch_en_usb3_vbus_oc_voltages[] = { 5000};
-
-/* EN_VDDIO_VID_OC from AP GPIO VI_PCLK T00*/
-static struct regulator_consumer_supply gpio_switch_en_vddio_vid_oc_supply[] = {
-       REGULATOR_SUPPLY("vdd_hdmi_con", NULL),
-};
-static int gpio_switch_en_vddio_vid_oc_voltages[] = { 5000};
-
 /* EN_VDD_PNL1 from AP GPIO VI_D6 L04*/
-static struct regulator_consumer_supply gpio_switch_en_vdd_pnl1_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_pnl1_supply[] = {
        REGULATOR_SUPPLY("vdd_lcd_panel", NULL),
 };
-static int gpio_switch_en_vdd_pnl1_voltages[] = { 3300};
 
 /* CAM1_LDO_EN from AP GPIO KB_ROW6 R06*/
-static struct regulator_consumer_supply gpio_switch_cam1_ldo_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_cam1_ldo_en_supply[] = {
        REGULATOR_SUPPLY("vdd_2v8_cam1", NULL),
        REGULATOR_SUPPLY("vdd", "6-0072"),
 };
-static int gpio_switch_cam1_ldo_en_voltages[] = { 2800};
 
 /* CAM2_LDO_EN from AP GPIO KB_ROW7 R07*/
-static struct regulator_consumer_supply gpio_switch_cam2_ldo_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_cam2_ldo_en_supply[] = {
        REGULATOR_SUPPLY("vdd_2v8_cam2", NULL),
        REGULATOR_SUPPLY("vdd", "7-0072"),
 };
-static int gpio_switch_cam2_ldo_en_voltages[] = { 2800};
 
 /* CAM3_LDO_EN from AP GPIO KB_ROW8 S00*/
-static struct regulator_consumer_supply gpio_switch_cam3_ldo_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_cam3_ldo_en_supply[] = {
        REGULATOR_SUPPLY("vdd_cam3", NULL),
 };
-static int gpio_switch_cam3_ldo_en_voltages[] = { 3300};
 
 /* EN_VDD_COM from AP GPIO SDMMC3_DAT5 D00*/
-static struct regulator_consumer_supply gpio_switch_en_vdd_com_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_com_supply[] = {
        REGULATOR_SUPPLY("vdd_com_bd", NULL),
 };
-static int gpio_switch_en_vdd_com_voltages[] = { 3300};
 
 /* EN_VDD_SDMMC1 from AP GPIO VI_HSYNC D07*/
-static struct regulator_consumer_supply gpio_switch_en_vdd_sdmmc1_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_sdmmc1_supply[] = {
        REGULATOR_SUPPLY("vddio_sd_slot", "sdhci-tegra.0"),
 };
-static int gpio_switch_en_vdd_sdmmc1_voltages[] = { 3300};
 
 /* EN_3V3_EMMC from AP GPIO SDMMC3_DAT4 D01*/
-static struct regulator_consumer_supply gpio_switch_en_3v3_emmc_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_emmc_supply[] = {
        REGULATOR_SUPPLY("vdd_emmc_core", NULL),
 };
-static int gpio_switch_en_3v3_emmc_voltages[] = { 3300};
 
 /* EN_3V3_PEX_HVDD from AP GPIO VI_D09 L07*/
-static struct regulator_consumer_supply gpio_switch_en_3v3_pex_hvdd_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_pex_hvdd_supply[] = {
        REGULATOR_SUPPLY("hvdd_pex", NULL),
 };
-static int gpio_switch_en_3v3_pex_hvdd_voltages[] = { 3300};
 
 /* EN_3v3_FUSE from AP GPIO VI_D08 L06*/
-static struct regulator_consumer_supply gpio_switch_en_3v3_fuse_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_fuse_supply[] = {
        REGULATOR_SUPPLY("vdd_fuse", NULL),
 };
-static int gpio_switch_en_3v3_fuse_voltages[] = { 3300};
 
 /* EN_1V8_CAM from AP GPIO GPIO_PBB4 PBB04*/
-static struct regulator_consumer_supply gpio_switch_en_1v8_cam_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_1v8_cam_supply[] = {
        REGULATOR_SUPPLY("vdd_1v8_cam1", NULL),
        REGULATOR_SUPPLY("vdd_1v8_cam2", NULL),
        REGULATOR_SUPPLY("vdd_1v8_cam3", NULL),
@@ -542,12 +508,30 @@ static struct regulator_consumer_supply gpio_switch_en_1v8_cam_supply[] = {
        REGULATOR_SUPPLY("vdd_i2c", "7-0072"),
        REGULATOR_SUPPLY("vdd_i2c", "2-0033"),
 };
-static int gpio_switch_en_1v8_cam_voltages[] = { 1800};
 
-static struct regulator_consumer_supply gpio_switch_en_vbrtr_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vbrtr_supply[] = {
        REGULATOR_SUPPLY("vdd_vbrtr", NULL),
 };
-static int gpio_switch_en_vbrtr_voltages[] = { 3300};
+
+
+/* EN_USB1_VBUS_OC*/
+static struct regulator_consumer_supply gpio_switch_en_usb1_vbus_oc_supply[] = {
+       REGULATOR_SUPPLY("vdd_vbus_micro_usb", NULL),
+};
+static int gpio_switch_en_usb1_vbus_oc_voltages[] = { 5000};
+
+/*EN_USB3_VBUS_OC*/
+static struct regulator_consumer_supply gpio_switch_en_usb3_vbus_oc_supply[] = {
+       REGULATOR_SUPPLY("vdd_vbus_typea_usb", NULL),
+};
+static int gpio_switch_en_usb3_vbus_oc_voltages[] = { 5000};
+
+/* EN_VDDIO_VID_OC from AP GPIO VI_PCLK T00*/
+static struct regulator_consumer_supply gpio_switch_en_vddio_vid_oc_supply[] = {
+       REGULATOR_SUPPLY("vdd_hdmi_con", NULL),
+};
+static int gpio_switch_en_vddio_vid_oc_voltages[] = { 5000};
+
 
 static int enable_load_switch_rail(
                struct gpio_switch_regulator_subdev_data *psubdev_data)
@@ -581,7 +565,6 @@ static int disable_load_switch_rail(
        return gpio_direction_output(psubdev_data->gpio_nr, 0);
 }
 
-
 /* Macro for defining gpio switch regulator sub device data */
 #define GREG_INIT(_id, _var, _name, _input_supply, _always_on, _boot_on, \
        _gpio_nr, _active_low, _init_state, _pg, _enable, _disable)      \
@@ -610,40 +593,98 @@ static int disable_load_switch_rail(
                },                                                      \
                .enable_rail = _enable,                                 \
                .disable_rail = _disable,                               \
+       };                                                              \
+       static struct gpio_switch_regulator_subdev_data                 \
+                               *gpio_pdata_##_var##_list[] = { \
+               &gpio_pdata_##_var,                                     \
+       };                                                              \
+       static struct gpio_switch_regulator_platform_data gs_##_var##_pdata = \
+       {                                                               \
+               .num_subdevs = 1,                                       \
+               .subdevs = gpio_pdata_##_var##_list,                    \
+       };                                                              \
+       static struct platform_device gswitch_reg_##_var##_dev = {      \
+               .name = "gpio-switch-regulator",                        \
+               .id   = _id,                                            \
+               .dev  = {                                               \
+                    .platform_data = &gs_##_var##_pdata,               \
+               },                                                      \
+       }
+
+/* Macro for defining fixed regulator sub device data */
+#define FIXED_SUPPLY(_name) "fixed_reg_"#_name
+#define FIXED_REG(_id, _var, _name, _in_supply, _always_on, _boot_on,  \
+                _gpio_nr, _active_high, _boot_state, _millivolts)      \
+       static struct regulator_init_data ri_data_##_var =              \
+       {                                                               \
+               .supply_regulator = _in_supply,                         \
+               .num_consumer_supplies =                                \
+                       ARRAY_SIZE(fixed_reg_##_name##_supply),         \
+               .consumer_supplies = fixed_reg_##_name##_supply,        \
+               .constraints = {                                        \
+                       .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
+                                       REGULATOR_MODE_STANDBY),        \
+                       .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
+                                       REGULATOR_CHANGE_STATUS |       \
+                                       REGULATOR_CHANGE_VOLTAGE),      \
+                       .always_on = _always_on,                        \
+                       .boot_on = _boot_on,                            \
+               },                                                      \
+       };                                                              \
+       static struct fixed_voltage_config fixed_reg_##_var##_pdata =   \
+       {                                                               \
+               .supply_name = FIXED_SUPPLY(_name),                     \
+               .microvolts = _millivolts * 1000,                       \
+               .gpio = _gpio_nr,                                       \
+               .enable_high = _active_high,                            \
+               .enabled_at_boot = _boot_state,                         \
+               .init_data = &ri_data_##_var,                           \
+       };                                                              \
+       static struct platform_device fixed_reg_##_var##_dev = {        \
+               .name   = "reg-fixed-voltage",                          \
+               .id     = _id,                                          \
+               .dev    = {                                             \
+                       .platform_data = &fixed_reg_##_var##_pdata,     \
+               },                                                      \
        }
 
 /* common to most of boards*/
-GREG_INIT(0, en_track_ldo2,    en_track_ldo2,  NULL,                   0,      0,      MAX77663_GPIO_BASE + MAX77663_GPIO0,    false,  0,      0,      0,      0);
-GREG_INIT(1, en_5v0,           en_5v0,         NULL,                   1,      0,      MAX77663_GPIO_BASE + MAX77663_GPIO2,    false,  1,      0,      0,      0);
-GREG_INIT(2, en_ddr,           en_ddr,         NULL,                   1,      0,      MAX77663_GPIO_BASE + MAX77663_GPIO3,    false,  1,      0,      0,      0);
-GREG_INIT(3, en_3v3_sys,       en_3v3_sys,     NULL,                   1,      0,      MAX77663_GPIO_BASE + MAX77663_GPIO1,    false,  1,      0,      0,      0);
-GREG_INIT(4, en_vdd_bl,                en_vdd_bl,      NULL,                   0,      0,      TEGRA_GPIO_PK3,         false,  1,      0,      0,      0);
-GREG_INIT(5, en_3v3_modem,     en_3v3_modem,   NULL,                   1,      0,      TEGRA_GPIO_PD6,         false,  1,      0,      0,      0);
-GREG_INIT(6, en_vdd_pnl1,      en_vdd_pnl1,    "vdd_3v3_devices",      0,      0,      TEGRA_GPIO_PL4,         false,  1,      0,      0,      0);
-GREG_INIT(7, cam3_ldo_en,      cam3_ldo_en,    "vdd_3v3_devices",      0,      0,      TEGRA_GPIO_PS0,         false,  0,      0,      0,      0);
-GREG_INIT(8, en_vdd_com,       en_vdd_com,     "vdd_3v3_devices",      1,      0,      TEGRA_GPIO_PD0,         false,  1,      0,      0,      0);
-GREG_INIT(9, en_3v3_fuse,      en_3v3_fuse,    "vdd_3v3_devices",      0,      0,      TEGRA_GPIO_PL6,         false,  0,      0,      0,      0);
-GREG_INIT(10, en_3v3_emmc,     en_3v3_emmc,    "vdd_3v3_devices",      1,      0,      TEGRA_GPIO_PD1,         false,  1,      0,      0,      0);
-GREG_INIT(11, en_vdd_sdmmc1,   en_vdd_sdmmc1,  "vdd_3v3_devices",      0,      0,      TEGRA_GPIO_PD7,         false,  1,      0,      0,      0);
-GREG_INIT(12, en_3v3_pex_hvdd, en_3v3_pex_hvdd, "hvdd_pex_pmu",        0,      0,      TEGRA_GPIO_PL7,         false,  0,      0,      0,      0);
-GREG_INIT(13, en_1v8_cam,      en_1v8_cam,     "vdd_gen1v8",           0,      0,      TEGRA_GPIO_PBB4,        false,  0,      0,      0,      0);
+FIXED_REG(0, en_track_ldo2,    en_track_ldo2,  NULL,                           0,      0,      MAX77663_GPIO_BASE + MAX77663_GPIO0,    true,   0, 3300);
+FIXED_REG(1, en_5v0,           en_5v0,         NULL,                           1,      0,      MAX77663_GPIO_BASE + MAX77663_GPIO2,    true,   1, 5000);
+FIXED_REG(2, en_ddr,           en_ddr,         NULL,                           1,      0,      MAX77663_GPIO_BASE + MAX77663_GPIO3,    true,   1, 1500);
+FIXED_REG(3, en_3v3_sys,       en_3v3_sys,     NULL,                           1,      0,      MAX77663_GPIO_BASE + MAX77663_GPIO1,    true,   1, 3300);
+FIXED_REG(4, en_vdd_bl,                en_vdd_bl,      NULL,                           0,      0,      TEGRA_GPIO_PK3,         true,   1, 5000);
+FIXED_REG(5, en_3v3_modem,     en_3v3_modem,   NULL,                           1,      0,      TEGRA_GPIO_PD6,         true,   1, 3300);
+FIXED_REG(6, en_vdd_pnl1,      en_vdd_pnl1,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PL4,         true,   1, 3300);
+FIXED_REG(7, cam3_ldo_en,      cam3_ldo_en,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PS0,         true,   0, 3300);
+FIXED_REG(8, en_vdd_com,       en_vdd_com,     FIXED_SUPPLY(en_3v3_sys),       1,      0,      TEGRA_GPIO_PD0,         true,   1, 3300);
+FIXED_REG(9, en_3v3_fuse,      en_3v3_fuse,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PL6,         true,   0, 3300);
+FIXED_REG(10, en_3v3_emmc,     en_3v3_emmc,    FIXED_SUPPLY(en_3v3_sys),       1,      0,      TEGRA_GPIO_PD1,         true,   1, 3300);
+FIXED_REG(11, en_vdd_sdmmc1,   en_vdd_sdmmc1,  FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PD7,         true,   1, 3300);
+FIXED_REG(12, en_3v3_pex_hvdd, en_3v3_pex_hvdd, FIXED_SUPPLY(en_3v3_sys),      0,      0,      TEGRA_GPIO_PL7,         true,   0, 3300);
+FIXED_REG(13, en_1v8_cam,      en_1v8_cam,     max77663_rails(sd2),            0,      0,      TEGRA_GPIO_PBB4,        true,   0, 1800);
+
+/*Specific to pm269*/
+FIXED_REG(4, en_vdd_bl_pm269,          en_vdd_bl,              NULL,                           0,      0,      TEGRA_GPIO_PH3, true,   1, 5000);
+FIXED_REG(6, en_vdd_pnl1_pm269,                en_vdd_pnl1,            FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PW1, true,   0, 3300);
+FIXED_REG(9, en_3v3_fuse_pm269,                en_3v3_fuse,            FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PC1, true,   0, 3300);
+FIXED_REG(12, en_3v3_pex_hvdd_pm269,   en_3v3_pex_hvdd,        FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PC6, true,   0, 3300);
+
+/* Specific to E1187/E1186/E1256 */
+FIXED_REG(14, dis_5v_switch_e118x,     dis_5v_switch,          FIXED_SUPPLY(en_5v0), 0,      0,      TEGRA_GPIO_PX2,           false,  0, 5000);
+
+/* E1198/E1291 specific*/
+FIXED_REG(18, cam1_ldo_en,     cam1_ldo_en,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PR6,         true,   0, 2800);
+FIXED_REG(19, cam2_ldo_en,     cam2_ldo_en,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PR7,         true,   0, 2800);
+FIXED_REG(22, en_vbrtr,                en_vbrtr,       FIXED_SUPPLY(en_3v3_sys),       0,      0,      PMU_TCA6416_GPIO_PORT12,        true,   0, 3300);
 
+/**** Open collector Load switches ****/
 /*Specific to pm269*/
-GREG_INIT(4, en_vdd_bl_pm269,          en_vdd_bl,              NULL,
-       0,      0,      TEGRA_GPIO_PH3, false,  1,      0,      0,      0);
-GREG_INIT(6, en_vdd_pnl1_pm269,                en_vdd_pnl1,            "vdd_3v3_devices",
-       0,      0,      TEGRA_GPIO_PW1, false,  1,      0,      0,      0);
-GREG_INIT(9, en_3v3_fuse_pm269,                en_3v3_fuse,            "vdd_3v3_devices",
-       0,      0,      TEGRA_GPIO_PC1, false,  0,      0,      0,      0);
-GREG_INIT(12, en_3v3_pex_hvdd_pm269,   en_3v3_pex_hvdd,        "hvdd_pex_pmu",
-       0,      0,      TEGRA_GPIO_PC6, false,  0,      0,      0,      0);
 GREG_INIT(17, en_vddio_vid_oc_pm269,   en_vddio_vid_oc,        "master_5v_switch",
        0,      0,      TEGRA_GPIO_PP2, false,  0,      TEGRA_PINGROUP_DAP3_DOUT,
        enable_load_switch_rail, disable_load_switch_rail);
 
 /* Specific to E1187/E1186/E1256 */
-GREG_INIT(14, dis_5v_switch_e118x,     dis_5v_switch,          "vdd_5v0_sys",
-               0,      0,      TEGRA_GPIO_PX2,         true,   0,      0,      0,      0);
 GREG_INIT(15, en_usb1_vbus_oc_e118x,   en_usb1_vbus_oc,        "master_5v_switch",
                0,      0,      TEGRA_GPIO_PI4,         false,  0,      TEGRA_PINGROUP_GMI_RST_N,
                enable_load_switch_rail, disable_load_switch_rail);
@@ -654,84 +695,76 @@ GREG_INIT(17, en_vddio_vid_oc_e118x,      en_vddio_vid_oc,        "master_5v_switch",
                0,      0,      TEGRA_GPIO_PT0,         false,  0,      TEGRA_PINGROUP_VI_PCLK,
                enable_load_switch_rail, disable_load_switch_rail);
 
-/* E1198/E1291 specific*/
-GREG_INIT(18, cam1_ldo_en,     cam1_ldo_en,    "vdd_3v3_cam",  0,      0,      TEGRA_GPIO_PR6,         false,  0,      0,      0,      0);
-GREG_INIT(19, cam2_ldo_en,     cam2_ldo_en,    "vdd_3v3_cam",  0,      0,      TEGRA_GPIO_PR7,         false,  0,      0,      0,      0);
-
-GREG_INIT(22, en_vbrtr,                en_vbrtr,       "vdd_3v3_devices",      0,      0,      PMU_TCA6416_GPIO_PORT12,        false,  0,      0,      0,      0);
-
-#define ADD_GPIO_REG(_name) &gpio_pdata_##_name
-
-#define COMMON_GPIO_REG \
-       ADD_GPIO_REG(en_track_ldo2),            \
-       ADD_GPIO_REG(en_5v0),                   \
-       ADD_GPIO_REG(en_ddr),                   \
-       ADD_GPIO_REG(en_3v3_sys),               \
-       ADD_GPIO_REG(en_3v3_modem),             \
-       ADD_GPIO_REG(en_vdd_pnl1),              \
-       ADD_GPIO_REG(cam1_ldo_en),              \
-       ADD_GPIO_REG(cam2_ldo_en),              \
-       ADD_GPIO_REG(cam3_ldo_en),              \
-       ADD_GPIO_REG(en_vdd_com),               \
-       ADD_GPIO_REG(en_3v3_fuse),              \
-       ADD_GPIO_REG(en_3v3_emmc),              \
-       ADD_GPIO_REG(en_vdd_sdmmc1),            \
-       ADD_GPIO_REG(en_3v3_pex_hvdd),          \
-       ADD_GPIO_REG(en_1v8_cam),
-
-#define PM269_GPIO_REG \
-       ADD_GPIO_REG(en_track_ldo2),            \
-       ADD_GPIO_REG(en_5v0),                   \
-       ADD_GPIO_REG(en_ddr),                   \
-       ADD_GPIO_REG(en_vdd_bl_pm269),          \
-       ADD_GPIO_REG(en_3v3_sys),               \
-       ADD_GPIO_REG(en_3v3_modem),             \
-       ADD_GPIO_REG(en_vdd_pnl1_pm269),        \
-       ADD_GPIO_REG(cam1_ldo_en),              \
-       ADD_GPIO_REG(cam2_ldo_en),              \
-       ADD_GPIO_REG(cam3_ldo_en),              \
-       ADD_GPIO_REG(en_vdd_com),               \
-       ADD_GPIO_REG(en_3v3_fuse_pm269),        \
-       ADD_GPIO_REG(en_3v3_emmc),              \
-       ADD_GPIO_REG(en_3v3_pex_hvdd_pm269),    \
-       ADD_GPIO_REG(en_1v8_cam),               \
-       ADD_GPIO_REG(dis_5v_switch_e118x),      \
+/*
+ * Creating the fixed/gpio-switch regulator device tables for different boards
+ */
+#define ADD_FIXED_REG(_name)   (&fixed_reg_##_name##_dev)
+#define ADD_GPIO_REG(_name)    (&gswitch_reg_##_name##_dev)
+
+#define COMMON_FIXED_REG \
+       ADD_FIXED_REG(en_track_ldo2),           \
+       ADD_FIXED_REG(en_5v0),                  \
+       ADD_FIXED_REG(en_ddr),                  \
+       ADD_FIXED_REG(en_3v3_sys),              \
+       ADD_FIXED_REG(en_3v3_modem),            \
+       ADD_FIXED_REG(en_vdd_pnl1),             \
+       ADD_FIXED_REG(cam1_ldo_en),             \
+       ADD_FIXED_REG(cam2_ldo_en),             \
+       ADD_FIXED_REG(cam3_ldo_en),             \
+       ADD_FIXED_REG(en_vdd_com),              \
+       ADD_FIXED_REG(en_3v3_fuse),             \
+       ADD_FIXED_REG(en_3v3_emmc),             \
+       ADD_FIXED_REG(en_vdd_sdmmc1),           \
+       ADD_FIXED_REG(en_3v3_pex_hvdd),         \
+       ADD_FIXED_REG(en_1v8_cam),
+
+#define PM269_FIXED_REG \
+       ADD_FIXED_REG(en_track_ldo2),           \
+       ADD_FIXED_REG(en_5v0),                  \
+       ADD_FIXED_REG(en_ddr),                  \
+       ADD_FIXED_REG(en_vdd_bl_pm269),         \
+       ADD_FIXED_REG(en_3v3_sys),              \
+       ADD_FIXED_REG(en_3v3_modem),            \
+       ADD_FIXED_REG(en_vdd_pnl1_pm269),       \
+       ADD_FIXED_REG(cam1_ldo_en),             \
+       ADD_FIXED_REG(cam2_ldo_en),             \
+       ADD_FIXED_REG(cam3_ldo_en),             \
+       ADD_FIXED_REG(en_vdd_com),              \
+       ADD_FIXED_REG(en_3v3_fuse_pm269),       \
+       ADD_FIXED_REG(en_3v3_emmc),             \
+       ADD_FIXED_REG(en_3v3_pex_hvdd_pm269),   \
+       ADD_FIXED_REG(en_1v8_cam),              \
+       ADD_FIXED_REG(dis_5v_switch_e118x),     \
        ADD_GPIO_REG(en_usb1_vbus_oc_e118x),    \
        ADD_GPIO_REG(en_usb3_vbus_oc_e118x),    \
        ADD_GPIO_REG(en_vddio_vid_oc_pm269),
 
-#define E118x_GPIO_REG \
-       ADD_GPIO_REG(en_vdd_bl),                \
-       ADD_GPIO_REG(dis_5v_switch_e118x),      \
+#define E118x_FIXED_REG        \
+       ADD_FIXED_REG(en_vdd_bl),               \
+       ADD_FIXED_REG(dis_5v_switch_e118x),     \
+       ADD_FIXED_REG(en_vbrtr),                \
        ADD_GPIO_REG(en_usb1_vbus_oc_e118x),    \
        ADD_GPIO_REG(en_usb3_vbus_oc_e118x),    \
        ADD_GPIO_REG(en_vddio_vid_oc_e118x),    \
-       ADD_GPIO_REG(en_vbrtr),
 
 /* Gpio switch regulator platform data  for E1186/E1187/E1256*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_e118x[] = {
-       COMMON_GPIO_REG
-       E118x_GPIO_REG
+static struct platform_device *fixed_reg_devs_e118x[] = {
+       COMMON_FIXED_REG
+       E118x_FIXED_REG
 };
 
 /* Gpio switch regulator platform data for PM269*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_pm269[] = {
-       PM269_GPIO_REG
-};
-
-static struct gpio_switch_regulator_platform_data  gswitch_pdata;
-static struct platform_device gswitch_regulator_pdata = {
-       .name = "gpio-switch-regulator",
-       .id   = -1,
-       .dev  = {
-            .platform_data = &gswitch_pdata,
-       },
+static struct platform_device *fixed_reg_devs_pm269[] = {
+       PM269_FIXED_REG
 };
 
 int __init cardhu_pm298_gpio_switch_regulator_init(void)
 {
        int i;
        struct board_info board_info;
+       struct platform_device **fixed_reg_devs;
+       int    nfixreg_devs;
+
        tegra_get_board_info(&board_info);
 
        switch (board_info.board_id) {
@@ -739,22 +772,30 @@ int __init cardhu_pm298_gpio_switch_regulator_init(void)
        case BOARD_PM305:
        case BOARD_PM311:
        case BOARD_E1257:
-               gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_pm269);
-               gswitch_pdata.subdevs = gswitch_subdevs_pm269;
+               nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_pm269);
+               fixed_reg_devs = fixed_reg_devs_pm269;
                break;
 
        default:
-               gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_e118x);
-               gswitch_pdata.subdevs = gswitch_subdevs_e118x;
+               nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_e118x);
+               fixed_reg_devs = fixed_reg_devs_e118x;
                break;
        }
 
-       for (i = 0; i < gswitch_pdata.num_subdevs; ++i) {
-               struct gpio_switch_regulator_subdev_data *gswitch_data =
-                                               gswitch_pdata.subdevs[i];
-               if (gswitch_data->gpio_nr <= TEGRA_NR_GPIOS)
-                       tegra_gpio_enable(gswitch_data->gpio_nr);
+       for (i = 0; i < nfixreg_devs; ++i) {
+               int gpio_nr;
+               if (!strncmp(fixed_reg_devs[i]->name, "gpio", 4)) {
+                       struct gpio_switch_regulator_platform_data *gs_pdata =
+                               fixed_reg_devs[i]->dev.platform_data;
+                       gpio_nr = gs_pdata->subdevs[0]->gpio_nr;
+               } else {
+                       struct fixed_voltage_config *fixed_reg_pdata =
+                               fixed_reg_devs[i]->dev.platform_data;
+                       gpio_nr = fixed_reg_pdata->gpio;
+               }
+
+               if (gpio_nr < TEGRA_NR_GPIOS)
+                       tegra_gpio_enable(gpio_nr);
        }
-
-       return platform_device_register(&gswitch_regulator_pdata);
+       return platform_add_devices(fixed_reg_devs, nfixreg_devs);
 }
index 0b79534..82d9e5f 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/gpio.h>
 #include <linux/io.h>
 #include <linux/regulator/gpio-switch-regulator.h>
+#include <linux/regulator/fixed.h>
 #include <linux/regulator/ricoh583-regulator.h>
 #include <linux/regulator/tps6236x-regulator.h>
 
@@ -357,29 +358,26 @@ int __init cardhu_pm299_regulator_init(void)
 }
 
 /* EN_5V_CP from PMU GP0 */
-static struct regulator_consumer_supply gpio_switch_en_5v_cp_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_5v_cp_supply[] = {
        REGULATOR_SUPPLY("vdd_5v0_sby", NULL),
        REGULATOR_SUPPLY("vdd_hall", NULL),
        REGULATOR_SUPPLY("vterm_ddr", NULL),
        REGULATOR_SUPPLY("v2ref_ddr", NULL),
 };
-static int gpio_switch_en_5v_cp_voltages[] = { 5000};
 
 /* EN_5V0 From PMU GP2 */
-static struct regulator_consumer_supply gpio_switch_en_5v0_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_5v0_supply[] = {
        REGULATOR_SUPPLY("vdd_5v0_sys", NULL),
 };
-static int gpio_switch_en_5v0_voltages[] = { 5000};
 
 /* EN_DDR From PMU GP6 */
-static struct regulator_consumer_supply gpio_switch_en_ddr_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_ddr_supply[] = {
        REGULATOR_SUPPLY("mem_vddio_ddr", NULL),
        REGULATOR_SUPPLY("t30_vddio_ddr", NULL),
 };
-static int gpio_switch_en_ddr_voltages[] = { 1500};
 
 /* EN_3V3_SYS From PMU GP7 */
-static struct regulator_consumer_supply gpio_switch_en_3v3_sys_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_sys_supply[] = {
        REGULATOR_SUPPLY("vdd_lvds", NULL),
        REGULATOR_SUPPLY("vdd_pnl", NULL),
        REGULATOR_SUPPLY("vcom_3v3", NULL),
@@ -424,104 +422,73 @@ static struct regulator_consumer_supply gpio_switch_en_3v3_sys_supply[] = {
        REGULATOR_SUPPLY("vdd_3v3_als", NULL),
        REGULATOR_SUPPLY("debug_cons", NULL),
 };
-static int gpio_switch_en_3v3_sys_voltages[] = { 3300};
 
 /* DIS_5V_SWITCH from AP SPI2_SCK X02 */
-static struct regulator_consumer_supply gpio_switch_dis_5v_switch_supply[] = {
+static struct regulator_consumer_supply fixed_reg_dis_5v_switch_supply[] = {
        REGULATOR_SUPPLY("master_5v_switch", NULL),
 };
-static int gpio_switch_dis_5v_switch_voltages[] = { 5000};
 
 /* EN_VDD_BL */
-static struct regulator_consumer_supply gpio_switch_en_vdd_bl_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_bl_supply[] = {
        REGULATOR_SUPPLY("vdd_backlight", NULL),
        REGULATOR_SUPPLY("vdd_backlight1", NULL),
 };
-static int gpio_switch_en_vdd_bl_voltages[] = { 5000};
 
 /* EN_3V3_MODEM from AP GPIO VI_VSYNCH D06*/
-static struct regulator_consumer_supply gpio_switch_en_3v3_modem_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_modem_supply[] = {
        REGULATOR_SUPPLY("vdd_3v3_mini_card", NULL),
        REGULATOR_SUPPLY("vdd_mini_card", NULL),
 };
-static int gpio_switch_en_3v3_modem_voltages[] = { 3300};
-
-/* EN_USB1_VBUS_OC*/
-static struct regulator_consumer_supply gpio_switch_en_usb1_vbus_oc_supply[] = {
-       REGULATOR_SUPPLY("vdd_vbus_micro_usb", NULL),
-};
-static int gpio_switch_en_usb1_vbus_oc_voltages[] = { 5000};
-
-/*EN_USB3_VBUS_OC*/
-static struct regulator_consumer_supply gpio_switch_en_usb3_vbus_oc_supply[] = {
-       REGULATOR_SUPPLY("vdd_vbus_typea_usb", NULL),
-};
-static int gpio_switch_en_usb3_vbus_oc_voltages[] = { 5000};
-
-/* EN_VDDIO_VID_OC from AP GPIO VI_PCLK T00*/
-static struct regulator_consumer_supply gpio_switch_en_vddio_vid_oc_supply[] = {
-       REGULATOR_SUPPLY("vdd_hdmi_con", NULL),
-};
-static int gpio_switch_en_vddio_vid_oc_voltages[] = { 5000};
 
 /* EN_VDD_PNL1 from AP GPIO VI_D6 L04*/
-static struct regulator_consumer_supply gpio_switch_en_vdd_pnl1_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_pnl1_supply[] = {
        REGULATOR_SUPPLY("vdd_lcd_panel", NULL),
 };
-static int gpio_switch_en_vdd_pnl1_voltages[] = { 3300};
 
 /* CAM1_LDO_EN from AP GPIO KB_ROW6 R06*/
-static struct regulator_consumer_supply gpio_switch_cam1_ldo_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_cam1_ldo_en_supply[] = {
        REGULATOR_SUPPLY("vdd_2v8_cam1", NULL),
        REGULATOR_SUPPLY("vdd", "6-0072"),
 };
-static int gpio_switch_cam1_ldo_en_voltages[] = { 2800};
 
 /* CAM2_LDO_EN from AP GPIO KB_ROW7 R07*/
-static struct regulator_consumer_supply gpio_switch_cam2_ldo_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_cam2_ldo_en_supply[] = {
        REGULATOR_SUPPLY("vdd_2v8_cam2", NULL),
        REGULATOR_SUPPLY("vdd", "7-0072"),
 };
-static int gpio_switch_cam2_ldo_en_voltages[] = { 2800};
 
 /* CAM3_LDO_EN from AP GPIO KB_ROW8 S00*/
-static struct regulator_consumer_supply gpio_switch_cam3_ldo_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_cam3_ldo_en_supply[] = {
        REGULATOR_SUPPLY("vdd_cam3", NULL),
 };
-static int gpio_switch_cam3_ldo_en_voltages[] = { 3300};
 
 /* EN_VDD_COM from AP GPIO SDMMC3_DAT5 D00*/
-static struct regulator_consumer_supply gpio_switch_en_vdd_com_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_com_supply[] = {
        REGULATOR_SUPPLY("vdd_com_bd", NULL),
 };
-static int gpio_switch_en_vdd_com_voltages[] = { 3300};
 
 /* EN_VDD_SDMMC1 from AP GPIO VI_HSYNC D07*/
-static struct regulator_consumer_supply gpio_switch_en_vdd_sdmmc1_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_sdmmc1_supply[] = {
        REGULATOR_SUPPLY("vddio_sd_slot", "sdhci-tegra.0"),
 };
-static int gpio_switch_en_vdd_sdmmc1_voltages[] = { 3300};
 
 /* EN_3V3_EMMC from AP GPIO SDMMC3_DAT4 D01*/
-static struct regulator_consumer_supply gpio_switch_en_3v3_emmc_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_emmc_supply[] = {
        REGULATOR_SUPPLY("vdd_emmc_core", NULL),
 };
-static int gpio_switch_en_3v3_emmc_voltages[] = { 3300};
 
 /* EN_3V3_PEX_HVDD from AP GPIO VI_D09 L07*/
-static struct regulator_consumer_supply gpio_switch_en_3v3_pex_hvdd_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_pex_hvdd_supply[] = {
        REGULATOR_SUPPLY("hvdd_pex", NULL),
 };
-static int gpio_switch_en_3v3_pex_hvdd_voltages[] = { 3300};
 
 /* EN_3v3_FUSE from AP GPIO VI_D08 L06*/
-static struct regulator_consumer_supply gpio_switch_en_3v3_fuse_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_fuse_supply[] = {
        REGULATOR_SUPPLY("vdd_fuse", NULL),
 };
-static int gpio_switch_en_3v3_fuse_voltages[] = { 3300};
 
 /* EN_1V8_CAM from AP GPIO GPIO_PBB4 PBB04*/
-static struct regulator_consumer_supply gpio_switch_en_1v8_cam_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_1v8_cam_supply[] = {
        REGULATOR_SUPPLY("vdd_1v8_cam1", NULL),
        REGULATOR_SUPPLY("vdd_1v8_cam2", NULL),
        REGULATOR_SUPPLY("vdd_1v8_cam3", NULL),
@@ -529,12 +496,29 @@ static struct regulator_consumer_supply gpio_switch_en_1v8_cam_supply[] = {
        REGULATOR_SUPPLY("vdd_i2c", "7-0072"),
        REGULATOR_SUPPLY("vdd_i2c", "2-0033"),
 };
-static int gpio_switch_en_1v8_cam_voltages[] = { 1800};
 
-static struct regulator_consumer_supply gpio_switch_en_vbrtr_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vbrtr_supply[] = {
        REGULATOR_SUPPLY("vdd_vbrtr", NULL),
 };
-static int gpio_switch_en_vbrtr_voltages[] = { 3300};
+
+
+/* EN_USB1_VBUS_OC*/
+static struct regulator_consumer_supply gpio_switch_en_usb1_vbus_oc_supply[] = {
+       REGULATOR_SUPPLY("vdd_vbus_micro_usb", NULL),
+};
+static int gpio_switch_en_usb1_vbus_oc_voltages[] = { 5000};
+
+/*EN_USB3_VBUS_OC*/
+static struct regulator_consumer_supply gpio_switch_en_usb3_vbus_oc_supply[] = {
+       REGULATOR_SUPPLY("vdd_vbus_typea_usb", NULL),
+};
+static int gpio_switch_en_usb3_vbus_oc_voltages[] = { 5000};
+
+/* EN_VDDIO_VID_OC from AP GPIO VI_PCLK T00*/
+static struct regulator_consumer_supply gpio_switch_en_vddio_vid_oc_supply[] = {
+       REGULATOR_SUPPLY("vdd_hdmi_con", NULL),
+};
+static int gpio_switch_en_vddio_vid_oc_voltages[] = { 5000};
 
 static int enable_load_switch_rail(
                struct gpio_switch_regulator_subdev_data *psubdev_data)
@@ -568,7 +552,6 @@ static int disable_load_switch_rail(
        return gpio_direction_output(psubdev_data->gpio_nr, 0);
 }
 
-
 /* Macro for defining gpio switch regulator sub device data */
 #define GREG_INIT(_id, _var, _name, _input_supply, _always_on, _boot_on, \
        _gpio_nr, _active_low, _init_state, _pg, _enable, _disable)      \
@@ -597,42 +580,99 @@ static int disable_load_switch_rail(
                },                                                      \
                .enable_rail = _enable,                                 \
                .disable_rail = _disable,                               \
+       };                                                              \
+       static struct gpio_switch_regulator_subdev_data                 \
+                               *gpio_pdata_##_var##_list[] = { \
+               &gpio_pdata_##_var,                                     \
+       };                                                              \
+       static struct gpio_switch_regulator_platform_data gs_##_var##_pdata = \
+       {                                                               \
+               .num_subdevs = 1,                                       \
+               .subdevs = gpio_pdata_##_var##_list,                    \
+       };                                                              \
+       static struct platform_device gswitch_reg_##_var##_dev = {      \
+               .name = "gpio-switch-regulator",                        \
+               .id   = _id,                                            \
+               .dev  = {                                               \
+                    .platform_data = &gs_##_var##_pdata,               \
+               },                                                      \
+       }
+
+/* Macro for defining fixed regulator sub device data */
+#define FIXED_SUPPLY(_name) "fixed_reg_"#_name
+#define FIXED_REG(_id, _var, _name, _in_supply, _always_on, _boot_on,  \
+                _gpio_nr, _active_high, _boot_state, _millivolts)      \
+       static struct regulator_init_data ri_data_##_var =              \
+       {                                                               \
+               .supply_regulator = _in_supply,                         \
+               .num_consumer_supplies =                                \
+                       ARRAY_SIZE(fixed_reg_##_name##_supply),         \
+               .consumer_supplies = fixed_reg_##_name##_supply,        \
+               .constraints = {                                        \
+                       .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
+                                       REGULATOR_MODE_STANDBY),        \
+                       .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
+                                       REGULATOR_CHANGE_STATUS |       \
+                                       REGULATOR_CHANGE_VOLTAGE),      \
+                       .always_on = _always_on,                        \
+                       .boot_on = _boot_on,                            \
+               },                                                      \
+       };                                                              \
+       static struct fixed_voltage_config fixed_reg_##_var##_pdata =   \
+       {                                                               \
+               .supply_name = FIXED_SUPPLY(_name),                     \
+               .microvolts = _millivolts * 1000,                       \
+               .gpio = _gpio_nr,                                       \
+               .enable_high = _active_high,                            \
+               .enabled_at_boot = _boot_state,                         \
+               .init_data = &ri_data_##_var,                           \
+       };                                                              \
+       static struct platform_device fixed_reg_##_var##_dev = {        \
+               .name   = "reg-fixed-voltage",                          \
+               .id     = _id,                                          \
+               .dev    = {                                             \
+                       .platform_data = &fixed_reg_##_var##_pdata,     \
+               },                                                      \
        }
 
 /* common to most of boards*/
-GREG_INIT(0, en_5v_cp,         en_5v_cp,       NULL,                   1,      0,      TPS6591X_GPIO_0,        false,  1,      0,      0,      0);
-GREG_INIT(1, en_5v0,           en_5v0,         NULL,                   0,      0,      TPS6591X_GPIO_4,        false,  0,      0,      0,      0);
-GREG_INIT(2, en_ddr,           en_ddr,         NULL,                   0,      0,      TPS6591X_GPIO_3,        false,  1,      0,      0,      0);
-GREG_INIT(3, en_3v3_sys,       en_3v3_sys,     NULL,                   0,      0,      TPS6591X_GPIO_1,        false,  0,      0,      0,      0);
-GREG_INIT(4, en_vdd_bl,                en_vdd_bl,      NULL,                   0,      0,      TEGRA_GPIO_PK3,         false,  1,      0,      0,      0);
-GREG_INIT(5, en_3v3_modem,     en_3v3_modem,   NULL,                   1,      0,      TEGRA_GPIO_PD6,         false,  1,      0,      0,      0);
-GREG_INIT(6, en_vdd_pnl1,      en_vdd_pnl1,    "vdd_3v3_devices",      0,      0,      TEGRA_GPIO_PL4,         false,  1,      0,      0,      0);
-GREG_INIT(7, cam3_ldo_en,      cam3_ldo_en,    "vdd_3v3_devices",      0,      0,      TEGRA_GPIO_PS0,         false,  0,      0,      0,      0);
-GREG_INIT(8, en_vdd_com,       en_vdd_com,     "vdd_3v3_devices",      1,      0,      TEGRA_GPIO_PD0,         false,  1,      0,      0,      0);
-GREG_INIT(9, en_3v3_fuse,      en_3v3_fuse,    "vdd_3v3_devices",      0,      0,      TEGRA_GPIO_PL6,         false,  0,      0,      0,      0);
-GREG_INIT(10, en_3v3_emmc,     en_3v3_emmc,    "vdd_3v3_devices",      1,      0,      TEGRA_GPIO_PD1,         false,  1,      0,      0,      0);
-GREG_INIT(11, en_vdd_sdmmc1,   en_vdd_sdmmc1,  "vdd_3v3_devices",      0,      0,      TEGRA_GPIO_PD7,         false,  1,      0,      0,      0);
-GREG_INIT(12, en_3v3_pex_hvdd, en_3v3_pex_hvdd, "hvdd_pex_pmu",        0,      0,      TEGRA_GPIO_PL7,         false,  0,      0,      0,      0);
-GREG_INIT(13, en_1v8_cam,      en_1v8_cam,     "vdd_gen1v8",           0,      0,      TEGRA_GPIO_PBB4,        false,  0,      0,      0,      0);
+FIXED_REG(0, en_5v_cp,         en_5v_cp,       NULL,                   1,      0,      TPS6591X_GPIO_0,        true,   1, 5000);
+FIXED_REG(1, en_5v0,           en_5v0,         NULL,                   0,      0,      TPS6591X_GPIO_4,        true,   0, 5000);
+FIXED_REG(2, en_ddr,           en_ddr,         NULL,                   0,      0,      TPS6591X_GPIO_3,        true,   1, 1500);
+FIXED_REG(3, en_3v3_sys,       en_3v3_sys,     NULL,                   0,      0,      TPS6591X_GPIO_1,        true,   0, 3300);
+FIXED_REG(4, en_vdd_bl,                en_vdd_bl,      NULL,                   0,      0,      TEGRA_GPIO_PK3,         true,   1, 5000);
+FIXED_REG(5, en_3v3_modem,     en_3v3_modem,   NULL,                   1,      0,      TEGRA_GPIO_PD6,         true,   1, 3300);
+FIXED_REG(6, en_vdd_pnl1,      en_vdd_pnl1,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PL4,         true,   1, 3300);
+FIXED_REG(7, cam3_ldo_en,      cam3_ldo_en,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PS0,         true,   0, 3300);
+FIXED_REG(8, en_vdd_com,       en_vdd_com,     FIXED_SUPPLY(en_3v3_sys),       1,      0,      TEGRA_GPIO_PD0,         true,   1, 3300);
+FIXED_REG(9, en_3v3_fuse,      en_3v3_fuse,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PL6,         true,   0, 3300);
+FIXED_REG(10, en_3v3_emmc,     en_3v3_emmc,    FIXED_SUPPLY(en_3v3_sys),       1,      0,      TEGRA_GPIO_PD1,         true,   1, 3300);
+FIXED_REG(11, en_vdd_sdmmc1,   en_vdd_sdmmc1,  FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PD7,         true,   1, 3300);
+FIXED_REG(12, en_3v3_pex_hvdd, en_3v3_pex_hvdd, FIXED_SUPPLY(en_3v3_sys),      0,      0,      TEGRA_GPIO_PL7,         true,   0, 3300);
+FIXED_REG(13, en_1v8_cam,      en_1v8_cam,     ricoh583_rails(DC2),            0,      0,      TEGRA_GPIO_PBB4,        true,   0, 1800);
+
+/* E1198/E1291 specific*/
+FIXED_REG(18, cam1_ldo_en,     cam1_ldo_en,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PR6,         true,   0, 2800);
+FIXED_REG(19, cam2_ldo_en,     cam2_ldo_en,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PR7,         true,   0, 2800);
+FIXED_REG(22, en_vbrtr,                en_vbrtr,       FIXED_SUPPLY(en_3v3_sys),       0,      0,      PMU_TCA6416_GPIO_PORT12,true,   0, 3300);
+
+/*Specific to pm269*/
+FIXED_REG(4, en_vdd_bl_pm269,          en_vdd_bl,              NULL,                           0,      0,      TEGRA_GPIO_PH3, true,   1, 5000);
+FIXED_REG(6, en_vdd_pnl1_pm269,                en_vdd_pnl1,            FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PW1, true,   1, 3300);
+FIXED_REG(9, en_3v3_fuse_pm269,                en_3v3_fuse,            FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PC1, true,   0, 3300);
+FIXED_REG(11, en_vdd_sdmmc1_pm269,     en_vdd_sdmmc1,          FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PP1, true,   1, 3300);
+FIXED_REG(12, en_3v3_pex_hvdd_pm269,   en_3v3_pex_hvdd,        FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PC6, true,   0, 3300);
+
+/* Specific to E1187/E1186/E1256 */
+FIXED_REG(14, dis_5v_switch_e118x,     dis_5v_switch,          FIXED_SUPPLY(en_5v0),           0,      0,      TEGRA_GPIO_PX2, false,  0, 5000);
 
+/*** Open collector load switches ************/
 /*Specific to pm269*/
-GREG_INIT(4, en_vdd_bl_pm269,          en_vdd_bl,              NULL,
-       0,      0,      TEGRA_GPIO_PH3, false,  1,      0,      0,      0);
-GREG_INIT(6, en_vdd_pnl1_pm269,                en_vdd_pnl1,            "vdd_3v3_devices",
-       0,      0,      TEGRA_GPIO_PW1, false,  1,      0,      0,      0);
-GREG_INIT(9, en_3v3_fuse_pm269,                en_3v3_fuse,            "vdd_3v3_devices",
-       0,      0,      TEGRA_GPIO_PC1, false,  0,      0,      0,      0);
-GREG_INIT(11, en_vdd_sdmmc1_pm269,     en_vdd_sdmmc1,          "vdd_3v3_devices",
-       0,      0,      TEGRA_GPIO_PP1, false,  1,      0,      0,      0);
-GREG_INIT(12, en_3v3_pex_hvdd_pm269,   en_3v3_pex_hvdd,        "hvdd_pex_pmu",
-       0,      0,      TEGRA_GPIO_PC6, false,  0,      0,      0,      0);
 GREG_INIT(17, en_vddio_vid_oc_pm269,   en_vddio_vid_oc,        "master_5v_switch",
        0,      0,      TEGRA_GPIO_PP2, false,  0,      TEGRA_PINGROUP_DAP3_DOUT,
        enable_load_switch_rail, disable_load_switch_rail);
 
 /* Specific to E1187/E1186/E1256 */
-GREG_INIT(14, dis_5v_switch_e118x,     dis_5v_switch,          "vdd_5v0_sys",
-               0,      0,      TEGRA_GPIO_PX2,         true,   0,      0,      0,      0);
 GREG_INIT(15, en_usb1_vbus_oc_e118x,   en_usb1_vbus_oc,        "master_5v_switch",
                0,      0,      TEGRA_GPIO_PI4,         false,  0,      TEGRA_PINGROUP_GMI_RST_N,
                enable_load_switch_rail, disable_load_switch_rail);
@@ -643,85 +683,77 @@ GREG_INIT(17, en_vddio_vid_oc_e118x,      en_vddio_vid_oc,        "master_5v_switch",
                0,      0,      TEGRA_GPIO_PT0,         false,  0,      TEGRA_PINGROUP_VI_PCLK,
                enable_load_switch_rail, disable_load_switch_rail);
 
-/* E1198/E1291 specific*/
-GREG_INIT(18, cam1_ldo_en,     cam1_ldo_en,    "vdd_3v3_cam",  0,      0,      TEGRA_GPIO_PR6,         false,  0,      0,      0,      0);
-GREG_INIT(19, cam2_ldo_en,     cam2_ldo_en,    "vdd_3v3_cam",  0,      0,      TEGRA_GPIO_PR7,         false,  0,      0,      0,      0);
-
-GREG_INIT(22, en_vbrtr,                en_vbrtr,       "vdd_3v3_devices",      0,      0,      PMU_TCA6416_GPIO_PORT12,        false,  0,      0,      0,      0);
-
-#define ADD_GPIO_REG(_name) &gpio_pdata_##_name
-
-#define COMMON_GPIO_REG \
-       ADD_GPIO_REG(en_5v_cp),                 \
-       ADD_GPIO_REG(en_5v0),                   \
-       ADD_GPIO_REG(en_ddr),                   \
-       ADD_GPIO_REG(en_3v3_sys),               \
-       ADD_GPIO_REG(en_3v3_modem),             \
-       ADD_GPIO_REG(en_vdd_pnl1),              \
-       ADD_GPIO_REG(cam1_ldo_en),              \
-       ADD_GPIO_REG(cam2_ldo_en),              \
-       ADD_GPIO_REG(cam3_ldo_en),              \
-       ADD_GPIO_REG(en_vdd_com),               \
-       ADD_GPIO_REG(en_3v3_fuse),              \
-       ADD_GPIO_REG(en_3v3_emmc),              \
-       ADD_GPIO_REG(en_vdd_sdmmc1),            \
-       ADD_GPIO_REG(en_3v3_pex_hvdd),          \
-       ADD_GPIO_REG(en_1v8_cam),
-
-#define PM269_GPIO_REG \
-       ADD_GPIO_REG(en_5v_cp),                 \
-       ADD_GPIO_REG(en_5v0),                   \
-       ADD_GPIO_REG(en_ddr),                   \
-       ADD_GPIO_REG(en_vdd_bl_pm269),          \
-       ADD_GPIO_REG(en_3v3_sys),               \
-       ADD_GPIO_REG(en_3v3_modem),             \
-       ADD_GPIO_REG(en_vdd_pnl1_pm269),        \
-       ADD_GPIO_REG(cam1_ldo_en),              \
-       ADD_GPIO_REG(cam2_ldo_en),              \
-       ADD_GPIO_REG(cam3_ldo_en),              \
-       ADD_GPIO_REG(en_vdd_com),               \
-       ADD_GPIO_REG(en_3v3_fuse_pm269),        \
-       ADD_GPIO_REG(en_3v3_emmc),              \
-       ADD_GPIO_REG(en_vdd_sdmmc1_pm269),      \
-       ADD_GPIO_REG(en_3v3_pex_hvdd_pm269),    \
-       ADD_GPIO_REG(en_1v8_cam),               \
-       ADD_GPIO_REG(dis_5v_switch_e118x),      \
+/*
+ * Creating the fixed/gpio-switch regulator device tables for different boards
+ */
+#define ADD_FIXED_REG(_name)   (&fixed_reg_##_name##_dev)
+#define ADD_GPIO_REG(_name)    (&gswitch_reg_##_name##_dev)
+
+#define COMMON_FIXED_REG                       \
+       ADD_FIXED_REG(en_5v_cp),                \
+       ADD_FIXED_REG(en_5v0),                  \
+       ADD_FIXED_REG(en_ddr),                  \
+       ADD_FIXED_REG(en_3v3_sys),              \
+       ADD_FIXED_REG(en_3v3_modem),            \
+       ADD_FIXED_REG(en_vdd_pnl1),             \
+       ADD_FIXED_REG(cam1_ldo_en),             \
+       ADD_FIXED_REG(cam2_ldo_en),             \
+       ADD_FIXED_REG(cam3_ldo_en),             \
+       ADD_FIXED_REG(en_vdd_com),              \
+       ADD_FIXED_REG(en_3v3_fuse),             \
+       ADD_FIXED_REG(en_3v3_emmc),             \
+       ADD_FIXED_REG(en_vdd_sdmmc1),           \
+       ADD_FIXED_REG(en_3v3_pex_hvdd),         \
+       ADD_FIXED_REG(en_1v8_cam),
+
+#define PM269_FIXED_REG                                \
+       ADD_FIXED_REG(en_5v_cp),                \
+       ADD_FIXED_REG(en_5v0),                  \
+       ADD_FIXED_REG(en_ddr),                  \
+       ADD_FIXED_REG(en_vdd_bl_pm269),         \
+       ADD_FIXED_REG(en_3v3_sys),              \
+       ADD_FIXED_REG(en_3v3_modem),            \
+       ADD_FIXED_REG(en_vdd_pnl1_pm269),       \
+       ADD_FIXED_REG(cam1_ldo_en),             \
+       ADD_FIXED_REG(cam2_ldo_en),             \
+       ADD_FIXED_REG(cam3_ldo_en),             \
+       ADD_FIXED_REG(en_vdd_com),              \
+       ADD_FIXED_REG(en_3v3_fuse_pm269),       \
+       ADD_FIXED_REG(en_3v3_emmc),             \
+       ADD_FIXED_REG(en_vdd_sdmmc1_pm269),     \
+       ADD_FIXED_REG(en_3v3_pex_hvdd_pm269),   \
+       ADD_FIXED_REG(en_1v8_cam),              \
+       ADD_FIXED_REG(dis_5v_switch_e118x),     \
        ADD_GPIO_REG(en_usb1_vbus_oc_e118x),    \
        ADD_GPIO_REG(en_usb3_vbus_oc_e118x),    \
        ADD_GPIO_REG(en_vddio_vid_oc_pm269),
 
-#define E118x_GPIO_REG \
-       ADD_GPIO_REG(en_vdd_bl),                \
-       ADD_GPIO_REG(dis_5v_switch_e118x),      \
+#define E118x_FIXED_REG                                \
+       ADD_FIXED_REG(en_vdd_bl),               \
+       ADD_FIXED_REG(dis_5v_switch_e118x),     \
+       ADD_FIXED_REG(en_vbrtr),                \
        ADD_GPIO_REG(en_usb1_vbus_oc_e118x),    \
        ADD_GPIO_REG(en_usb3_vbus_oc_e118x),    \
        ADD_GPIO_REG(en_vddio_vid_oc_e118x),    \
-       ADD_GPIO_REG(en_vbrtr),
 
 /* Gpio switch regulator platform data  for E1186/E1187/E1256*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_e118x[] = {
-       COMMON_GPIO_REG
-       E118x_GPIO_REG
+static struct platform_device *fixed_reg_devs_e118x[] = {
+       COMMON_FIXED_REG
+       E118x_FIXED_REG
 };
 
 /* Gpio switch regulator platform data for PM269*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_pm269[] = {
-       PM269_GPIO_REG
-};
-
-static struct gpio_switch_regulator_platform_data  gswitch_pdata;
-static struct platform_device gswitch_regulator_pdata = {
-       .name = "gpio-switch-regulator",
-       .id   = -1,
-       .dev  = {
-            .platform_data = &gswitch_pdata,
-       },
+static struct platform_device *fixed_reg_devs_pm269[] = {
+       PM269_FIXED_REG
 };
 
 int __init cardhu_pm299_gpio_switch_regulator_init(void)
 {
        int i;
        struct board_info board_info;
+       struct platform_device **fixed_reg_devs;
+       int    nfixreg_devs;
+
        tegra_get_board_info(&board_info);
 
        switch (board_info.board_id) {
@@ -729,22 +761,30 @@ int __init cardhu_pm299_gpio_switch_regulator_init(void)
        case BOARD_PM305:
        case BOARD_PM311:
        case BOARD_E1257:
-               gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_pm269);
-               gswitch_pdata.subdevs = gswitch_subdevs_pm269;
+               nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_pm269);
+               fixed_reg_devs = fixed_reg_devs_pm269;
                break;
 
        default:
-               gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_e118x);
-               gswitch_pdata.subdevs = gswitch_subdevs_e118x;
+               nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_e118x);
+               fixed_reg_devs = fixed_reg_devs_e118x;
                break;
        }
 
-       for (i = 0; i < gswitch_pdata.num_subdevs; ++i) {
-               struct gpio_switch_regulator_subdev_data *gswitch_data =
-                                               gswitch_pdata.subdevs[i];
-               if (gswitch_data->gpio_nr <= TEGRA_NR_GPIOS)
-                       tegra_gpio_enable(gswitch_data->gpio_nr);
+       for (i = 0; i < nfixreg_devs; ++i) {
+               int gpio_nr;
+               if (!strncmp(fixed_reg_devs[i]->name, "gpio", 4)) {
+                       struct gpio_switch_regulator_platform_data *gs_pdata =
+                               fixed_reg_devs[i]->dev.platform_data;
+                       gpio_nr = gs_pdata->subdevs[0]->gpio_nr;
+               } else {
+                       struct fixed_voltage_config *fixed_reg_pdata =
+                               fixed_reg_devs[i]->dev.platform_data;
+                       gpio_nr = fixed_reg_pdata->gpio;
+               }
+
+               if (gpio_nr < TEGRA_NR_GPIOS)
+                       tegra_gpio_enable(gpio_nr);
        }
-
-       return platform_device_register(&gswitch_regulator_pdata);
+       return platform_add_devices(fixed_reg_devs, nfixreg_devs);
 }
index 6dd6767..97b168e 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/gpio.h>
 #include <linux/io.h>
 #include <linux/regulator/gpio-switch-regulator.h>
+#include <linux/regulator/fixed.h>
 #include <linux/regulator/tps6591x-regulator.h>
 #include <linux/regulator/tps6236x-regulator.h>
 #include <linux/power/gpio-charger.h>
@@ -48,6 +49,8 @@
 #define PMC_CTRL               0x0
 #define PMC_CTRL_INTR_LOW      (1 << 17)
 
+static bool is_cardhu_machine = false;
+
 static struct regulator_consumer_supply tps6591x_vdd1_supply_skubit0_0[] = {
        REGULATOR_SUPPLY("vdd_core", NULL),
        REGULATOR_SUPPLY("en_vddio_ddr_1v2", NULL),
@@ -444,33 +447,33 @@ int __init cardhu_regulator_init(void)
                pr_info("Registering the device TPS62361B\n");
                i2c_register_board_info(4, tps6236x_boardinfo, 1);
        }
+       is_cardhu_machine = true;
        return 0;
 }
 
+
+/**************** GPIO based fixed regulator *****************/
 /* EN_5V_CP from PMU GP0 */
-static struct regulator_consumer_supply gpio_switch_en_5v_cp_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_5v_cp_supply[] = {
        REGULATOR_SUPPLY("vdd_5v0_sby", NULL),
        REGULATOR_SUPPLY("vdd_hall", NULL),
        REGULATOR_SUPPLY("vterm_ddr", NULL),
        REGULATOR_SUPPLY("v2ref_ddr", NULL),
 };
-static int gpio_switch_en_5v_cp_voltages[] = { 5000};
 
 /* EN_5V0 From PMU GP2 */
-static struct regulator_consumer_supply gpio_switch_en_5v0_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_5v0_supply[] = {
        REGULATOR_SUPPLY("vdd_5v0_sys", NULL),
 };
-static int gpio_switch_en_5v0_voltages[] = { 5000};
 
 /* EN_DDR From PMU GP6 */
-static struct regulator_consumer_supply gpio_switch_en_ddr_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_ddr_supply[] = {
        REGULATOR_SUPPLY("mem_vddio_ddr", NULL),
        REGULATOR_SUPPLY("t30_vddio_ddr", NULL),
 };
-static int gpio_switch_en_ddr_voltages[] = { 1500};
 
 /* EN_3V3_SYS From PMU GP7 */
-static struct regulator_consumer_supply gpio_switch_en_3v3_sys_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_sys_supply[] = {
        REGULATOR_SUPPLY("vdd_lvds", NULL),
        REGULATOR_SUPPLY("vdd_pnl", NULL),
        REGULATOR_SUPPLY("vcom_3v3", NULL),
@@ -516,110 +519,78 @@ static struct regulator_consumer_supply gpio_switch_en_3v3_sys_supply[] = {
        REGULATOR_SUPPLY("debug_cons", NULL),
        REGULATOR_SUPPLY("vdd", "4-004c"),
 };
-static int gpio_switch_en_3v3_sys_voltages[] = { 3300};
 
 /* DIS_5V_SWITCH from AP SPI2_SCK X02 */
-static struct regulator_consumer_supply gpio_switch_dis_5v_switch_supply[] = {
+static struct regulator_consumer_supply fixed_reg_dis_5v_switch_supply[] = {
        REGULATOR_SUPPLY("master_5v_switch", NULL),
 };
-static int gpio_switch_dis_5v_switch_voltages[] = { 5000};
 
 /* EN_VDD_BL */
-static struct regulator_consumer_supply gpio_switch_en_vdd_bl_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_bl_supply[] = {
        REGULATOR_SUPPLY("vdd_backlight", NULL),
        REGULATOR_SUPPLY("vdd_backlight1", NULL),
 };
-static int gpio_switch_en_vdd_bl_voltages[] = { 5000};
 
 /* EN_VDD_BL2 (E1291-A03) from AP PEX_L0_PRSNT_N DD.00 */
-static struct regulator_consumer_supply gpio_switch_en_vdd_bl2_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_bl2_supply[] = {
        REGULATOR_SUPPLY("vdd_backlight2", NULL),
 };
-static int gpio_switch_en_vdd_bl2_voltages[] = { 5000};
 
 /* EN_3V3_MODEM from AP GPIO VI_VSYNCH D06*/
-static struct regulator_consumer_supply gpio_switch_en_3v3_modem_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_modem_supply[] = {
        REGULATOR_SUPPLY("vdd_3v3_mini_card", NULL),
        REGULATOR_SUPPLY("vdd_mini_card", NULL),
 };
-static int gpio_switch_en_3v3_modem_voltages[] = { 3300};
-
-/* EN_USB1_VBUS_OC*/
-static struct regulator_consumer_supply gpio_switch_en_usb1_vbus_oc_supply[] = {
-       REGULATOR_SUPPLY("vdd_vbus_micro_usb", NULL),
-};
-static int gpio_switch_en_usb1_vbus_oc_voltages[] = { 5000};
-
-/*EN_USB3_VBUS_OC*/
-static struct regulator_consumer_supply gpio_switch_en_usb3_vbus_oc_supply[] = {
-       REGULATOR_SUPPLY("vdd_vbus_typea_usb", NULL),
-};
-static int gpio_switch_en_usb3_vbus_oc_voltages[] = { 5000};
-
-/* EN_VDDIO_VID_OC from AP GPIO VI_PCLK T00*/
-static struct regulator_consumer_supply gpio_switch_en_vddio_vid_oc_supply[] = {
-       REGULATOR_SUPPLY("vdd_hdmi_con", NULL),
-};
-static int gpio_switch_en_vddio_vid_oc_voltages[] = { 5000};
 
 /* EN_VDD_PNL1 from AP GPIO VI_D6 L04*/
-static struct regulator_consumer_supply gpio_switch_en_vdd_pnl1_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_pnl1_supply[] = {
        REGULATOR_SUPPLY("vdd_lcd_panel", NULL),
 };
-static int gpio_switch_en_vdd_pnl1_voltages[] = { 3300};
 
 /* CAM1_LDO_EN from AP GPIO KB_ROW6 R06*/
-static struct regulator_consumer_supply gpio_switch_cam1_ldo_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_cam1_ldo_en_supply[] = {
        REGULATOR_SUPPLY("vdd_2v8_cam1", NULL),
        REGULATOR_SUPPLY("vdd", "6-0072"),
 };
-static int gpio_switch_cam1_ldo_en_voltages[] = { 2800};
 
 /* CAM2_LDO_EN from AP GPIO KB_ROW7 R07*/
-static struct regulator_consumer_supply gpio_switch_cam2_ldo_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_cam2_ldo_en_supply[] = {
        REGULATOR_SUPPLY("vdd_2v8_cam2", NULL),
        REGULATOR_SUPPLY("vdd", "7-0072"),
 };
-static int gpio_switch_cam2_ldo_en_voltages[] = { 2800};
 
 /* CAM3_LDO_EN from AP GPIO KB_ROW8 S00*/
-static struct regulator_consumer_supply gpio_switch_cam3_ldo_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_cam3_ldo_en_supply[] = {
        REGULATOR_SUPPLY("vdd_cam3", NULL),
 };
-static int gpio_switch_cam3_ldo_en_voltages[] = { 3300};
 
 /* EN_VDD_COM from AP GPIO SDMMC3_DAT5 D00*/
-static struct regulator_consumer_supply gpio_switch_en_vdd_com_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_com_supply[] = {
        REGULATOR_SUPPLY("vdd_com_bd", NULL),
 };
-static int gpio_switch_en_vdd_com_voltages[] = { 3300};
 
 /* EN_VDD_SDMMC1 from AP GPIO VI_HSYNC D07*/
-static struct regulator_consumer_supply gpio_switch_en_vdd_sdmmc1_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vdd_sdmmc1_supply[] = {
        REGULATOR_SUPPLY("vddio_sd_slot", "sdhci-tegra.0"),
 };
-static int gpio_switch_en_vdd_sdmmc1_voltages[] = { 3300};
 
 /* EN_3V3_EMMC from AP GPIO SDMMC3_DAT4 D01*/
-static struct regulator_consumer_supply gpio_switch_en_3v3_emmc_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_emmc_supply[] = {
        REGULATOR_SUPPLY("vdd_emmc_core", NULL),
 };
-static int gpio_switch_en_3v3_emmc_voltages[] = { 3300};
 
 /* EN_3V3_PEX_HVDD from AP GPIO VI_D09 L07*/
-static struct regulator_consumer_supply gpio_switch_en_3v3_pex_hvdd_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_pex_hvdd_supply[] = {
        REGULATOR_SUPPLY("hvdd_pex", NULL),
 };
-static int gpio_switch_en_3v3_pex_hvdd_voltages[] = { 3300};
 
 /* EN_3v3_FUSE from AP GPIO VI_D08 L06*/
-static struct regulator_consumer_supply gpio_switch_en_3v3_fuse_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_3v3_fuse_supply[] = {
        REGULATOR_SUPPLY("vdd_fuse", NULL),
 };
-static int gpio_switch_en_3v3_fuse_voltages[] = { 3300};
 
 /* EN_1V8_CAM from AP GPIO GPIO_PBB4 PBB04*/
-static struct regulator_consumer_supply gpio_switch_en_1v8_cam_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_1v8_cam_supply[] = {
        REGULATOR_SUPPLY("vdd_1v8_cam1", NULL),
        REGULATOR_SUPPLY("vdd_1v8_cam2", NULL),
        REGULATOR_SUPPLY("vdd_1v8_cam3", NULL),
@@ -627,12 +598,28 @@ static struct regulator_consumer_supply gpio_switch_en_1v8_cam_supply[] = {
        REGULATOR_SUPPLY("vdd_i2c", "7-0072"),
        REGULATOR_SUPPLY("vdd_i2c", "2-0033"),
 };
-static int gpio_switch_en_1v8_cam_voltages[] = { 1800};
 
-static struct regulator_consumer_supply gpio_switch_en_vbrtr_supply[] = {
+static struct regulator_consumer_supply fixed_reg_en_vbrtr_supply[] = {
        REGULATOR_SUPPLY("vdd_vbrtr", NULL),
 };
-static int gpio_switch_en_vbrtr_voltages[] = { 3300};
+
+/* EN_USB1_VBUS_OC*/
+static struct regulator_consumer_supply gpio_switch_en_usb1_vbus_oc_supply[] = {
+       REGULATOR_SUPPLY("vdd_vbus_micro_usb", NULL),
+};
+static int gpio_switch_en_usb1_vbus_oc_voltages[] = { 5000};
+
+/*EN_USB3_VBUS_OC*/
+static struct regulator_consumer_supply gpio_switch_en_usb3_vbus_oc_supply[] = {
+       REGULATOR_SUPPLY("vdd_vbus_typea_usb", NULL),
+};
+static int gpio_switch_en_usb3_vbus_oc_voltages[] = { 5000};
+
+/* EN_VDDIO_VID_OC from AP GPIO VI_PCLK T00*/
+static struct regulator_consumer_supply gpio_switch_en_vddio_vid_oc_supply[] = {
+       REGULATOR_SUPPLY("vdd_hdmi_con", NULL),
+};
+static int gpio_switch_en_vddio_vid_oc_voltages[] = { 5000};
 
 static int enable_load_switch_rail(
                struct gpio_switch_regulator_subdev_data *psubdev_data)
@@ -666,7 +653,6 @@ static int disable_load_switch_rail(
        return gpio_direction_output(psubdev_data->gpio_nr, 0);
 }
 
-
 /* Macro for defining gpio switch regulator sub device data */
 #define GREG_INIT(_id, _var, _name, _input_supply, _always_on, _boot_on, \
        _gpio_nr, _active_low, _init_state, _pg, _enable, _disable)      \
@@ -695,310 +681,349 @@ static int disable_load_switch_rail(
                },                                                      \
                .enable_rail = _enable,                                 \
                .disable_rail = _disable,                               \
+       };                                                              \
+       static struct gpio_switch_regulator_subdev_data                 \
+                               *gpio_pdata_##_var##_list[] = { \
+               &gpio_pdata_##_var,                                     \
+       };                                                              \
+       static struct gpio_switch_regulator_platform_data gs_##_var##_pdata = \
+       {                                                               \
+               .num_subdevs = 1,                                       \
+               .subdevs = gpio_pdata_##_var##_list,                    \
+       };                                                              \
+       static struct platform_device gswitch_reg_##_var##_dev = {      \
+               .name = "gpio-switch-regulator",                        \
+               .id   = _id,                                            \
+               .dev  = {                                               \
+                    .platform_data = &gs_##_var##_pdata,               \
+               },                                                      \
+       }
+
+/* Macro for defining fixed regulator sub device data */
+#define FIXED_SUPPLY(_name) "fixed_reg_"#_name
+#define FIXED_REG(_id, _var, _name, _in_supply, _always_on, _boot_on,  \
+                _gpio_nr, _active_high, _boot_state, _millivolts)      \
+       static struct regulator_init_data ri_data_##_var =              \
+       {                                                               \
+               .supply_regulator = _in_supply,                         \
+               .num_consumer_supplies =                                \
+                       ARRAY_SIZE(fixed_reg_##_name##_supply),         \
+               .consumer_supplies = fixed_reg_##_name##_supply,        \
+               .constraints = {                                        \
+                       .valid_modes_mask = (REGULATOR_MODE_NORMAL |    \
+                                       REGULATOR_MODE_STANDBY),        \
+                       .valid_ops_mask = (REGULATOR_CHANGE_MODE |      \
+                                       REGULATOR_CHANGE_STATUS |       \
+                                       REGULATOR_CHANGE_VOLTAGE),      \
+                       .always_on = _always_on,                        \
+                       .boot_on = _boot_on,                            \
+               },                                                      \
+       };                                                              \
+       static struct fixed_voltage_config fixed_reg_##_var##_pdata =   \
+       {                                                               \
+               .supply_name = FIXED_SUPPLY(_name),                     \
+               .microvolts = _millivolts * 1000,                       \
+               .gpio = _gpio_nr,                                       \
+               .enable_high = _active_high,                            \
+               .enabled_at_boot = _boot_state,                         \
+               .init_data = &ri_data_##_var,                           \
+       };                                                              \
+       static struct platform_device fixed_reg_##_var##_dev = {        \
+               .name   = "reg-fixed-voltage",                          \
+               .id     = _id,                                          \
+               .dev    = {                                             \
+                       .platform_data = &fixed_reg_##_var##_pdata,     \
+               },                                                      \
        }
 
 /* common to most of boards*/
-GREG_INIT(0, en_5v_cp,         en_5v_cp,       NULL,                   1,      0,      TPS6591X_GPIO_0,        false,  1,      0,      0,      0);
-GREG_INIT(1, en_5v0,           en_5v0,         NULL,                   0,      0,      TPS6591X_GPIO_2,        false,  0,      0,      0,      0);
-GREG_INIT(2, en_ddr,           en_ddr,         NULL,                   1,      0,      TPS6591X_GPIO_6,        false,  1,      0,      0,      0);
-GREG_INIT(3, en_3v3_sys,       en_3v3_sys,     NULL,                   0,      0,      TPS6591X_GPIO_7,        false,  1,      0,      0,      0);
-GREG_INIT(4, en_vdd_bl,                en_vdd_bl,      NULL,                   0,      0,      TEGRA_GPIO_PK3,         false,  1,      0,      0,      0);
-GREG_INIT(5, en_3v3_modem,     en_3v3_modem,   NULL,                   1,      0,      TEGRA_GPIO_PD6,         false,  1,      0,      0,      0);
-GREG_INIT(6, en_vdd_pnl1,      en_vdd_pnl1,    "vdd_3v3_devices",      0,      0,      TEGRA_GPIO_PL4,         false,  1,      0,      0,      0);
-GREG_INIT(7, cam3_ldo_en,      cam3_ldo_en,    "vdd_3v3_devices",      0,      0,      TEGRA_GPIO_PS0,         false,  0,      0,      0,      0);
-GREG_INIT(8, en_vdd_com,       en_vdd_com,     "vdd_3v3_devices",      1,      0,      TEGRA_GPIO_PD0,         false,  1,      0,      0,      0);
-GREG_INIT(9, en_3v3_fuse,      en_3v3_fuse,    "vdd_3v3_devices",      0,      0,      TEGRA_GPIO_PL6,         false,  0,      0,      0,      0);
-GREG_INIT(10, en_3v3_emmc,     en_3v3_emmc,    "vdd_3v3_devices",      1,      0,      TEGRA_GPIO_PD1,         false,  1,      0,      0,      0);
-GREG_INIT(11, en_vdd_sdmmc1,   en_vdd_sdmmc1,  "vdd_3v3_devices",      0,      0,      TEGRA_GPIO_PD7,         false,  1,      0,      0,      0);
-GREG_INIT(12, en_3v3_pex_hvdd, en_3v3_pex_hvdd, "hvdd_pex_pmu",        0,      0,      TEGRA_GPIO_PL7,         false,  0,      0,      0,      0);
-GREG_INIT(13, en_1v8_cam,      en_1v8_cam,     "vdd_gen1v8",           0,      0,      TEGRA_GPIO_PBB4,        false,  0,      0,      0,      0);
+FIXED_REG(0, en_5v_cp,         en_5v_cp,       NULL,                           1,      0,      TPS6591X_GPIO_0,        true,   1, 5000);
+FIXED_REG(1, en_5v0,           en_5v0,         NULL,                           0,      0,      TPS6591X_GPIO_2,        true,   0, 5000);
+FIXED_REG(2, en_ddr,           en_ddr,         NULL,                           1,      0,      TPS6591X_GPIO_6,        true,   1, 1500);
+FIXED_REG(3, en_3v3_sys,       en_3v3_sys,     NULL,                           0,      0,      TPS6591X_GPIO_7,        true,   1, 3300);
+FIXED_REG(4, en_vdd_bl,                en_vdd_bl,      NULL,                           0,      0,      TEGRA_GPIO_PK3,         true,   1, 5000);
+FIXED_REG(5, en_3v3_modem,     en_3v3_modem,   NULL,                           1,      0,      TEGRA_GPIO_PD6,         true,   1, 3300);
+FIXED_REG(6, en_vdd_pnl1,      en_vdd_pnl1,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PL4,         true,   1, 3300);
+FIXED_REG(7, cam3_ldo_en,      cam3_ldo_en,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PS0,         true,   0, 3300);
+FIXED_REG(8, en_vdd_com,       en_vdd_com,     FIXED_SUPPLY(en_3v3_sys),       1,      0,      TEGRA_GPIO_PD0,         true,   1, 3300);
+FIXED_REG(9, en_3v3_fuse,      en_3v3_fuse,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PL6,         true,   0, 3300);
+FIXED_REG(10, en_3v3_emmc,     en_3v3_emmc,    FIXED_SUPPLY(en_3v3_sys),       1,      0,      TEGRA_GPIO_PD1,         true,   1, 3300);
+FIXED_REG(11, en_vdd_sdmmc1,   en_vdd_sdmmc1,  FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PD7,         true,   1, 3300);
+FIXED_REG(12, en_3v3_pex_hvdd, en_3v3_pex_hvdd, FIXED_SUPPLY(en_3v3_sys),      0,      0,      TEGRA_GPIO_PL7,         true,   0, 3300);
+FIXED_REG(13, en_1v8_cam,      en_1v8_cam,     tps6591x_rails(VIO),            0,      0,      TEGRA_GPIO_PBB4,        true,   0, 1800);
+
+/* Specific to E1187/E1186/E1256 */
+FIXED_REG(14, dis_5v_switch_e118x,     dis_5v_switch,  FIXED_SUPPLY(en_5v0),   0,      0,      TEGRA_GPIO_PX2,         false,  0, 5000);
 
 /* E1291-A04/A05 specific */
-GREG_INIT(1, en_5v0_a04,       en_5v0,         NULL,                   0,      0,      TPS6591X_GPIO_8,        false,  0,      0,      0,      0);
-GREG_INIT(2, en_ddr_a04,       en_ddr,         NULL,                   1,      0,      TPS6591X_GPIO_7,        false,  1,      0,      0,      0);
-GREG_INIT(3, en_3v3_sys_a04,   en_3v3_sys,     NULL,                   0,      0,      TPS6591X_GPIO_6,        false,  1,      0,      0,      0);
+FIXED_REG(1, en_5v0_a04,       en_5v0,         NULL,                           0,      0,      TPS6591X_GPIO_8,        true,   0, 5000);
+FIXED_REG(2, en_ddr_a04,       en_ddr,         NULL,                           1,      0,      TPS6591X_GPIO_7,        true,   1, 1500);
+FIXED_REG(3, en_3v3_sys_a04,   en_3v3_sys,     NULL,                           0,      0,      TPS6591X_GPIO_6,        true,   1, 3300);
 
+/* Specific to pm269 */
+FIXED_REG(4, en_vdd_bl_pm269,          en_vdd_bl,              NULL,                           0,      0,      TEGRA_GPIO_PH3, true,   1, 5000);
+FIXED_REG(6, en_vdd_pnl1_pm269,                en_vdd_pnl1,            FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PW1, true,   1, 3300);
+FIXED_REG(9, en_3v3_fuse_pm269,                en_3v3_fuse,            FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PC1, true,   0, 3300);
+FIXED_REG(12, en_3v3_pex_hvdd_pm269,   en_3v3_pex_hvdd,        FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PC6, true,   0, 3300);
 
+/* E1198/E1291 specific*/
+FIXED_REG(18, cam1_ldo_en,     cam1_ldo_en,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PR6,         true,   0, 2800);
+FIXED_REG(19, cam2_ldo_en,     cam2_ldo_en,    FIXED_SUPPLY(en_3v3_sys),       0,      0,      TEGRA_GPIO_PR7,         true,   0, 2800);
+
+/* E1291 A03 specific */
+FIXED_REG(20, en_vdd_bl1_a03,  en_vdd_bl,      NULL,                           0,      0,      TEGRA_GPIO_PDD2,        true,   1, 5000);
+FIXED_REG(21, en_vdd_bl2_a03,  en_vdd_bl2,     NULL,                           0,      0,      TEGRA_GPIO_PDD0,        true,   1, 5000);
+FIXED_REG(22, en_vbrtr,                en_vbrtr,       FIXED_SUPPLY(en_3v3_sys),       0,      0,      PMU_TCA6416_GPIO_PORT12,true,   0, 3300);
+
+/* PM313 display board specific */
+FIXED_REG(4, en_vdd_bl_pm313,   en_vdd_bl,      NULL,                          0,      0,      TEGRA_GPIO_PK3,         true,  1, 5000);
+FIXED_REG(6, en_vdd_pnl1_pm313, en_vdd_pnl1,    FIXED_SUPPLY(en_3v3_sys),      0,      0,      TEGRA_GPIO_PH3,         true,  1, 3300);
+
+
+/****************** Open collector Load switches *******/
 /*Specific to pm269*/
-GREG_INIT(4, en_vdd_bl_pm269,          en_vdd_bl,              NULL,
-       0,      0,      TEGRA_GPIO_PH3, false,  1,      0,      0,      0);
-GREG_INIT(6, en_vdd_pnl1_pm269,                en_vdd_pnl1,            "vdd_3v3_devices",
-       0,      0,      TEGRA_GPIO_PW1, false,  1,      0,      0,      0);
-GREG_INIT(9, en_3v3_fuse_pm269,                en_3v3_fuse,            "vdd_3v3_devices",
-       0,      0,      TEGRA_GPIO_PC1, false,  0,      0,      0,      0);
-GREG_INIT(12, en_3v3_pex_hvdd_pm269,   en_3v3_pex_hvdd,        "hvdd_pex_pmu",
-       0,      0,      TEGRA_GPIO_PC6, false,  0,      0,      0,      0);
-GREG_INIT(17, en_vddio_vid_oc_pm269,   en_vddio_vid_oc,        "master_5v_switch",
-       0,      0,      TEGRA_GPIO_PP2, false,  0,      TEGRA_PINGROUP_DAP3_DOUT,
+GREG_INIT(17, en_vddio_vid_oc_pm269,   en_vddio_vid_oc,        "master_5v_switch", 0,      0,      TEGRA_GPIO_PP2,     false,  0,      TEGRA_PINGROUP_DAP3_DOUT,
        enable_load_switch_rail, disable_load_switch_rail);
 
 /* Specific to pm311 */
-GREG_INIT(15, en_usb1_vbus_oc_pm311,   en_usb1_vbus_oc,        "master_5v_switch",
-               0,      0,      TEGRA_GPIO_PCC7,                false,  0,      TEGRA_PINGROUP_GMI_RST_N,
+GREG_INIT(15, en_usb1_vbus_oc_pm311,   en_usb1_vbus_oc,        "master_5v_switch", 0,      0,      TEGRA_GPIO_PCC7,            false,  0,      TEGRA_PINGROUP_GMI_RST_N,
                enable_load_switch_rail, disable_load_switch_rail);
-GREG_INIT(16, en_usb3_vbus_oc_pm311,   en_usb3_vbus_oc,        "master_5v_switch",
-               0,      0,      TEGRA_GPIO_PCC6,                false,  0,      TEGRA_PINGROUP_GMI_AD15,
+GREG_INIT(16, en_usb3_vbus_oc_pm311,   en_usb3_vbus_oc,        "master_5v_switch", 0,      0,      TEGRA_GPIO_PCC6,            false,  0,      TEGRA_PINGROUP_GMI_AD15,
                enable_load_switch_rail, disable_load_switch_rail);
 
 /* Specific to E1187/E1186/E1256 */
-GREG_INIT(14, dis_5v_switch_e118x,     dis_5v_switch,          "vdd_5v0_sys",
-               0,      0,      TEGRA_GPIO_PX2,         true,   0,      0,      0,      0);
-GREG_INIT(15, en_usb1_vbus_oc_e118x,   en_usb1_vbus_oc,        "master_5v_switch",
-               0,      0,      TEGRA_GPIO_PI4,         false,  0,      TEGRA_PINGROUP_GMI_RST_N,
+GREG_INIT(15, en_usb1_vbus_oc_e118x,   en_usb1_vbus_oc,        "master_5v_switch", 0,      0,      TEGRA_GPIO_PI4,             false,  0,      TEGRA_PINGROUP_GMI_RST_N,
                enable_load_switch_rail, disable_load_switch_rail);
-GREG_INIT(16, en_usb3_vbus_oc_e118x,   en_usb3_vbus_oc,        "master_5v_switch",
-               0,      0,      TEGRA_GPIO_PH7,         false,  0,      TEGRA_PINGROUP_GMI_AD15,
+GREG_INIT(16, en_usb3_vbus_oc_e118x,   en_usb3_vbus_oc,        "master_5v_switch", 0,      0,      TEGRA_GPIO_PH7,             false,  0,      TEGRA_PINGROUP_GMI_AD15,
                enable_load_switch_rail, disable_load_switch_rail);
-GREG_INIT(17, en_vddio_vid_oc_e118x,   en_vddio_vid_oc,        "master_5v_switch",
-               0,      0,      TEGRA_GPIO_PT0,         false,  0,      TEGRA_PINGROUP_VI_PCLK,
+GREG_INIT(17, en_vddio_vid_oc_e118x,   en_vddio_vid_oc,        "master_5v_switch", 0,      0,      TEGRA_GPIO_PT0,             false,  0,      TEGRA_PINGROUP_VI_PCLK,
                enable_load_switch_rail, disable_load_switch_rail);
 
 /* E1198/E1291 specific  fab < A03 */
-GREG_INIT(15, en_usb1_vbus_oc,         en_usb1_vbus_oc,        "vdd_5v0_sys",
-               0,      0,      TEGRA_GPIO_PI4,         false,  0,      TEGRA_PINGROUP_GMI_RST_N,
+GREG_INIT(15, en_usb1_vbus_oc,         en_usb1_vbus_oc,        "vdd_5v0_sys", 0,      0,      TEGRA_GPIO_PI4,          false,  0,      TEGRA_PINGROUP_GMI_RST_N,
                enable_load_switch_rail, disable_load_switch_rail);
-GREG_INIT(16, en_usb3_vbus_oc,         en_usb3_vbus_oc,        "vdd_5v0_sys",
-               0,      0,      TEGRA_GPIO_PH7,         false,  0,      TEGRA_PINGROUP_GMI_AD15,
+GREG_INIT(16, en_usb3_vbus_oc,         en_usb3_vbus_oc,        "vdd_5v0_sys", 0,      0,      TEGRA_GPIO_PH7,          false,  0,      TEGRA_PINGROUP_GMI_AD15,
                enable_load_switch_rail, disable_load_switch_rail);
 
 /* E1198/E1291 specific  fab >= A03 */
-GREG_INIT(15, en_usb1_vbus_oc_a03,     en_usb1_vbus_oc,        "vdd_5v0_sys",
-               0,      0,      TEGRA_GPIO_PDD6,                false,  0,      TEGRA_PINGROUP_PEX_L1_CLKREQ_N,
+GREG_INIT(15, en_usb1_vbus_oc_a03,     en_usb1_vbus_oc,        "vdd_5v0_sys", 0,      0,      TEGRA_GPIO_PDD6,         false,  0,      TEGRA_PINGROUP_PEX_L1_CLKREQ_N,
                enable_load_switch_rail, disable_load_switch_rail);
-GREG_INIT(16, en_usb3_vbus_oc_a03,             en_usb3_vbus_oc,        "vdd_5v0_sys",
-               0,      0,      TEGRA_GPIO_PDD4,                false,  0,      TEGRA_PINGROUP_PEX_L1_PRSNT_N,
+GREG_INIT(16, en_usb3_vbus_oc_a03,     en_usb3_vbus_oc,        "vdd_5v0_sys", 0,      0,      TEGRA_GPIO_PDD4,         false,  0,      TEGRA_PINGROUP_PEX_L1_PRSNT_N,
                enable_load_switch_rail, disable_load_switch_rail);
 
 /* E1198/E1291 specific */
-GREG_INIT(17, en_vddio_vid_oc,         en_vddio_vid_oc,        "vdd_5v0_sys",
-               0,      0,      TEGRA_GPIO_PT0,         false,  0,      TEGRA_PINGROUP_VI_PCLK,
+GREG_INIT(17, en_vddio_vid_oc,         en_vddio_vid_oc,        "vdd_5v0_sys", 0,      0,      TEGRA_GPIO_PT0,          false,  0,      TEGRA_PINGROUP_VI_PCLK,
                enable_load_switch_rail, disable_load_switch_rail);
 
-/* E1198/E1291 specific*/
-GREG_INIT(18, cam1_ldo_en,     cam1_ldo_en,    "vdd_3v3_cam",  0,      0,      TEGRA_GPIO_PR6,         false,  0,      0,      0,      0);
-GREG_INIT(19, cam2_ldo_en,     cam2_ldo_en,    "vdd_3v3_cam",  0,      0,      TEGRA_GPIO_PR7,         false,  0,      0,      0,      0);
-
-/* E1291 A03 specific */
-GREG_INIT(20, en_vdd_bl1_a03,  en_vdd_bl,      NULL,           0,      0,      TEGRA_GPIO_PDD2,        false,  1,      0,      0,      0);
-GREG_INIT(21, en_vdd_bl2_a03,  en_vdd_bl2,     NULL,           0,      0,      TEGRA_GPIO_PDD0,        false,  1,      0,      0,      0);
-
-GREG_INIT(22, en_vbrtr,                en_vbrtr,       "vdd_3v3_devices",      0,      0,      PMU_TCA6416_GPIO_PORT12,        false,  0,      0,      0,      0);
-
-/* PM313 display board specific */
-GREG_INIT(4, en_vdd_bl_pm313,       en_vdd_bl,      NULL,
-               0,      0,      TEGRA_GPIO_PK3, false,  1,  0,  0,  0);
-GREG_INIT(6, en_vdd_pnl1_pm313,     en_vdd_pnl1,        "vdd_3v3_devices",
-               0,      0,      TEGRA_GPIO_PH3, false,  1,  0,  0,  0);
-
-#define ADD_GPIO_REG(_name) &gpio_pdata_##_name
-
-#define COMMON_GPIO_REG \
-       ADD_GPIO_REG(en_5v_cp),                 \
-       ADD_GPIO_REG(en_5v0),                   \
-       ADD_GPIO_REG(en_ddr),                   \
-       ADD_GPIO_REG(en_3v3_sys),               \
-       ADD_GPIO_REG(en_3v3_modem),             \
-       ADD_GPIO_REG(en_vdd_pnl1),              \
-       ADD_GPIO_REG(cam3_ldo_en),              \
-       ADD_GPIO_REG(en_vdd_com),               \
-       ADD_GPIO_REG(en_3v3_fuse),              \
-       ADD_GPIO_REG(en_3v3_emmc),              \
-       ADD_GPIO_REG(en_vdd_sdmmc1),            \
-       ADD_GPIO_REG(en_3v3_pex_hvdd),          \
-       ADD_GPIO_REG(en_1v8_cam),
-
-#define COMMON_GPIO_REG_E1291_A04 \
-       ADD_GPIO_REG(en_5v_cp),                 \
-       ADD_GPIO_REG(en_5v0_a04),               \
-       ADD_GPIO_REG(en_ddr_a04),               \
-       ADD_GPIO_REG(en_3v3_sys_a04),           \
-       ADD_GPIO_REG(en_3v3_modem),             \
-       ADD_GPIO_REG(en_vdd_pnl1),              \
-       ADD_GPIO_REG(cam3_ldo_en),              \
-       ADD_GPIO_REG(en_vdd_com),               \
-       ADD_GPIO_REG(en_3v3_fuse),              \
-       ADD_GPIO_REG(en_3v3_emmc),              \
-       ADD_GPIO_REG(en_vdd_sdmmc1),            \
-       ADD_GPIO_REG(en_3v3_pex_hvdd),          \
-       ADD_GPIO_REG(en_1v8_cam),
-
-#define PM269_GPIO_REG \
-       ADD_GPIO_REG(en_5v_cp),                 \
-       ADD_GPIO_REG(en_5v0),                   \
-       ADD_GPIO_REG(en_ddr),                   \
-       ADD_GPIO_REG(en_3v3_sys),               \
-       ADD_GPIO_REG(en_3v3_modem),             \
-       ADD_GPIO_REG(cam1_ldo_en),              \
-       ADD_GPIO_REG(cam2_ldo_en),              \
-       ADD_GPIO_REG(cam3_ldo_en),              \
-       ADD_GPIO_REG(en_vdd_com),               \
-       ADD_GPIO_REG(en_3v3_fuse_pm269),        \
-       ADD_GPIO_REG(en_3v3_emmc),              \
-       ADD_GPIO_REG(en_3v3_pex_hvdd_pm269),    \
-       ADD_GPIO_REG(en_1v8_cam),               \
-       ADD_GPIO_REG(dis_5v_switch_e118x),      \
+/*
+ * Creating the fixed/gpio-switch regulator device tables for different boards
+ */
+#define ADD_FIXED_REG(_name)   (&fixed_reg_##_name##_dev)
+#define ADD_GPIO_REG(_name)    (&gswitch_reg_##_name##_dev)
+
+#define COMMON_FIXED_REG                       \
+       ADD_FIXED_REG(en_5v_cp),                \
+       ADD_FIXED_REG(en_5v0),                  \
+       ADD_FIXED_REG(en_ddr),                  \
+       ADD_FIXED_REG(en_3v3_sys),              \
+       ADD_FIXED_REG(en_3v3_modem),            \
+       ADD_FIXED_REG(en_vdd_pnl1),             \
+       ADD_FIXED_REG(cam3_ldo_en),             \
+       ADD_FIXED_REG(en_vdd_com),              \
+       ADD_FIXED_REG(en_3v3_fuse),             \
+       ADD_FIXED_REG(en_3v3_emmc),             \
+       ADD_FIXED_REG(en_vdd_sdmmc1),           \
+       ADD_FIXED_REG(en_3v3_pex_hvdd),         \
+       ADD_FIXED_REG(en_1v8_cam),
+
+#define COMMON_FIXED_REG_E1291_A04             \
+       ADD_FIXED_REG(en_5v_cp),                \
+       ADD_FIXED_REG(en_5v0_a04),              \
+       ADD_FIXED_REG(en_ddr_a04),              \
+       ADD_FIXED_REG(en_3v3_sys_a04),          \
+       ADD_FIXED_REG(en_3v3_modem),            \
+       ADD_FIXED_REG(en_vdd_pnl1),             \
+       ADD_FIXED_REG(cam3_ldo_en),             \
+       ADD_FIXED_REG(en_vdd_com),              \
+       ADD_FIXED_REG(en_3v3_fuse),             \
+       ADD_FIXED_REG(en_3v3_emmc),             \
+       ADD_FIXED_REG(en_vdd_sdmmc1),           \
+       ADD_FIXED_REG(en_3v3_pex_hvdd),         \
+       ADD_FIXED_REG(en_1v8_cam),
+
+#define PM269_FIXED_REG                                \
+       ADD_FIXED_REG(en_5v_cp),                \
+       ADD_FIXED_REG(en_5v0),                  \
+       ADD_FIXED_REG(en_ddr),                  \
+       ADD_FIXED_REG(en_3v3_sys),              \
+       ADD_FIXED_REG(en_3v3_modem),            \
+       ADD_FIXED_REG(cam1_ldo_en),             \
+       ADD_FIXED_REG(cam2_ldo_en),             \
+       ADD_FIXED_REG(cam3_ldo_en),             \
+       ADD_FIXED_REG(en_vdd_com),              \
+       ADD_FIXED_REG(en_3v3_fuse_pm269),       \
+       ADD_FIXED_REG(en_3v3_emmc),             \
+       ADD_FIXED_REG(en_3v3_pex_hvdd_pm269),   \
+       ADD_FIXED_REG(en_1v8_cam),              \
+       ADD_FIXED_REG(dis_5v_switch_e118x),     \
        ADD_GPIO_REG(en_usb1_vbus_oc_e118x),    \
        ADD_GPIO_REG(en_usb3_vbus_oc_e118x),    \
        ADD_GPIO_REG(en_vddio_vid_oc_pm269),
 
-#define PM311_GPIO_REG \
-       ADD_GPIO_REG(en_5v_cp),                 \
-       ADD_GPIO_REG(en_5v0),                   \
-       ADD_GPIO_REG(en_ddr),                   \
-       ADD_GPIO_REG(en_3v3_sys),               \
-       ADD_GPIO_REG(en_3v3_modem),             \
-       ADD_GPIO_REG(cam1_ldo_en),              \
-       ADD_GPIO_REG(cam2_ldo_en),              \
-       ADD_GPIO_REG(cam3_ldo_en),              \
-       ADD_GPIO_REG(en_vdd_com),               \
-       ADD_GPIO_REG(en_3v3_fuse_pm269),        \
-       ADD_GPIO_REG(en_3v3_emmc),              \
-       ADD_GPIO_REG(en_3v3_pex_hvdd_pm269),    \
-       ADD_GPIO_REG(en_1v8_cam),               \
-       ADD_GPIO_REG(dis_5v_switch_e118x),      \
+#define PM311_FIXED_REG                                \
+       ADD_FIXED_REG(en_5v_cp),                \
+       ADD_FIXED_REG(en_5v0),                  \
+       ADD_FIXED_REG(en_ddr),                  \
+       ADD_FIXED_REG(en_3v3_sys),              \
+       ADD_FIXED_REG(en_3v3_modem),            \
+       ADD_FIXED_REG(cam1_ldo_en),             \
+       ADD_FIXED_REG(cam2_ldo_en),             \
+       ADD_FIXED_REG(cam3_ldo_en),             \
+       ADD_FIXED_REG(en_vdd_com),              \
+       ADD_FIXED_REG(en_3v3_fuse_pm269),       \
+       ADD_FIXED_REG(en_3v3_emmc),             \
+       ADD_FIXED_REG(en_3v3_pex_hvdd_pm269),   \
+       ADD_FIXED_REG(en_1v8_cam),              \
+       ADD_FIXED_REG(dis_5v_switch_e118x),     \
        ADD_GPIO_REG(en_usb1_vbus_oc_pm311),    \
        ADD_GPIO_REG(en_usb3_vbus_oc_pm311),    \
        ADD_GPIO_REG(en_vddio_vid_oc_pm269),
 
-#define E1247_DISPLAY_GPIO_REG         \
-       ADD_GPIO_REG(en_vdd_bl_pm269),  \
-       ADD_GPIO_REG(en_vdd_pnl1_pm269),
-
-#define PM313_DISPLAY_GPIO_REG         \
-       ADD_GPIO_REG(en_vdd_bl_pm313),  \
-       ADD_GPIO_REG(en_vdd_pnl1_pm313),
-
-#define E118x_GPIO_REG                         \
-       ADD_GPIO_REG(en_5v_cp),                 \
-       ADD_GPIO_REG(en_5v0),                   \
-       ADD_GPIO_REG(en_ddr),                   \
-       ADD_GPIO_REG(en_3v3_sys),               \
-       ADD_GPIO_REG(en_3v3_modem),             \
-       ADD_GPIO_REG(cam3_ldo_en),              \
-       ADD_GPIO_REG(en_vdd_com),               \
-       ADD_GPIO_REG(en_3v3_fuse),              \
-       ADD_GPIO_REG(en_3v3_emmc),              \
-       ADD_GPIO_REG(en_vdd_sdmmc1),            \
-       ADD_GPIO_REG(en_3v3_pex_hvdd),          \
-       ADD_GPIO_REG(en_1v8_cam),               \
-       ADD_GPIO_REG(dis_5v_switch_e118x),      \
+
+#define E1247_DISPLAY_FIXED_REG                        \
+       ADD_FIXED_REG(en_vdd_bl_pm269),         \
+       ADD_FIXED_REG(en_vdd_pnl1_pm269),
+
+#define PM313_DISPLAY_FIXED_REG                        \
+       ADD_FIXED_REG(en_vdd_bl_pm313),         \
+       ADD_FIXED_REG(en_vdd_pnl1_pm313),
+
+#define E118x_FIXED_REG                                \
+       ADD_FIXED_REG(en_5v_cp),                \
+       ADD_FIXED_REG(en_5v0),                  \
+       ADD_FIXED_REG(en_ddr),                  \
+       ADD_FIXED_REG(en_3v3_sys),              \
+       ADD_FIXED_REG(en_3v3_modem),            \
+       ADD_FIXED_REG(cam3_ldo_en),             \
+       ADD_FIXED_REG(en_vdd_com),              \
+       ADD_FIXED_REG(en_3v3_fuse),             \
+       ADD_FIXED_REG(en_3v3_emmc),             \
+       ADD_FIXED_REG(en_vdd_sdmmc1),           \
+       ADD_FIXED_REG(en_3v3_pex_hvdd),         \
+       ADD_FIXED_REG(en_1v8_cam),              \
+       ADD_FIXED_REG(dis_5v_switch_e118x),     \
+       ADD_FIXED_REG(en_vbrtr),                \
        ADD_GPIO_REG(en_usb1_vbus_oc_e118x),    \
        ADD_GPIO_REG(en_usb3_vbus_oc_e118x),    \
-       ADD_GPIO_REG(en_vddio_vid_oc_e118x),    \
-       ADD_GPIO_REG(en_vbrtr),
+       ADD_GPIO_REG(en_vddio_vid_oc_e118x),
 
-#define E1198_GPIO_REG                 \
-       ADD_GPIO_REG(en_vddio_vid_oc),  \
-       ADD_GPIO_REG(cam1_ldo_en),      \
-       ADD_GPIO_REG(cam2_ldo_en),
+#define E1198_FIXED_REG                                \
+       ADD_FIXED_REG(cam1_ldo_en),             \
+       ADD_FIXED_REG(cam2_ldo_en),             \
+       ADD_GPIO_REG(en_vddio_vid_oc),
 
-#define E1291_1198_A00_GPIO_REG        \
+#define E1291_1198_A00_FIXED_REG               \
+       ADD_FIXED_REG(en_vdd_bl),               \
        ADD_GPIO_REG(en_usb1_vbus_oc),          \
-       ADD_GPIO_REG(en_usb3_vbus_oc),          \
-       ADD_GPIO_REG(en_vdd_bl),
-
-#define E1291_A03_GPIO_REG     \
-       ADD_GPIO_REG(en_usb1_vbus_oc_a03),              \
-       ADD_GPIO_REG(en_usb3_vbus_oc_a03),              \
-       ADD_GPIO_REG(en_vdd_bl1_a03), \
-       ADD_GPIO_REG(en_vdd_bl2_a03),
-
-/* Gpio switch regulator platform data  for E1186/E1187/E1256*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_e118x[] = {
-       E118x_GPIO_REG
-       E1247_DISPLAY_GPIO_REG
-};
-
-/* Gpio switch regulator platform data  for E1186/E1187/E1256*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_e118x_pm313[] = {
-       E118x_GPIO_REG
-       PM313_DISPLAY_GPIO_REG
-};
-
-/* Gpio switch regulator platform data for E1198 and E1291*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_e1198_base[] = {
-       COMMON_GPIO_REG
-       E1291_1198_A00_GPIO_REG
-       E1198_GPIO_REG
-};
-
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_e1198_a02[] = {
-       ADD_GPIO_REG(en_5v_cp),
-       ADD_GPIO_REG(en_5v0),
-       ADD_GPIO_REG(en_ddr_a04),
-       ADD_GPIO_REG(en_3v3_sys_a04),
-       ADD_GPIO_REG(en_3v3_modem),
-       ADD_GPIO_REG(en_vdd_pnl1),
-       ADD_GPIO_REG(cam3_ldo_en),
-       ADD_GPIO_REG(en_vdd_com),
-       ADD_GPIO_REG(en_3v3_fuse),
-       ADD_GPIO_REG(en_3v3_emmc),
-       ADD_GPIO_REG(en_vdd_sdmmc1),
-       ADD_GPIO_REG(en_3v3_pex_hvdd),
-       ADD_GPIO_REG(en_1v8_cam),
+       ADD_GPIO_REG(en_usb3_vbus_oc),
+
+#define E1291_A03_FIXED_REG                    \
+       ADD_FIXED_REG(en_vdd_bl1_a03),          \
+       ADD_FIXED_REG(en_vdd_bl2_a03),          \
+       ADD_GPIO_REG(en_usb1_vbus_oc_a03),      \
+       ADD_GPIO_REG(en_usb3_vbus_oc_a03),
+
+/* Fixed regulator devices for E1186/E1187/E1256 */
+static struct platform_device *fixed_reg_devs_e118x[] = {
+       E118x_FIXED_REG
+       E1247_DISPLAY_FIXED_REG
+};
+
+/* Fixed regulator devices for E1186/E1187/E1256 */
+static struct platform_device *fixed_reg_devs_e118x_pm313[] = {
+       E118x_FIXED_REG
+       PM313_DISPLAY_FIXED_REG
+};
+
+/* Fixed regulator devices for E1198 and E1291 */
+static struct platform_device *fixed_reg_devs_e1198_base[] = {
+       COMMON_FIXED_REG
+       E1291_1198_A00_FIXED_REG
+       E1198_FIXED_REG
+};
+
+static struct platform_device *fixed_reg_devs_e1198_a02[] = {
+       ADD_FIXED_REG(en_5v_cp),
+       ADD_FIXED_REG(en_5v0),
+       ADD_FIXED_REG(en_ddr_a04),
+       ADD_FIXED_REG(en_3v3_sys_a04),
+       ADD_FIXED_REG(en_3v3_modem),
+       ADD_FIXED_REG(en_vdd_pnl1),
+       ADD_FIXED_REG(cam3_ldo_en),
+       ADD_FIXED_REG(en_vdd_com),
+       ADD_FIXED_REG(en_3v3_fuse),
+       ADD_FIXED_REG(en_3v3_emmc),
+       ADD_FIXED_REG(en_vdd_sdmmc1),
+       ADD_FIXED_REG(en_3v3_pex_hvdd),
+       ADD_FIXED_REG(en_1v8_cam),
+       ADD_FIXED_REG(en_vdd_bl1_a03),
+       ADD_FIXED_REG(en_vdd_bl2_a03),
+       ADD_FIXED_REG(cam1_ldo_en),
+       ADD_FIXED_REG(cam2_ldo_en),
        ADD_GPIO_REG(en_usb1_vbus_oc_a03),
        ADD_GPIO_REG(en_usb3_vbus_oc_a03),
-       ADD_GPIO_REG(en_vdd_bl1_a03),
-       ADD_GPIO_REG(en_vdd_bl2_a03),
        ADD_GPIO_REG(en_vddio_vid_oc),
-       ADD_GPIO_REG(cam1_ldo_en),
-       ADD_GPIO_REG(cam2_ldo_en),
 };
 
-/* Gpio switch regulator platform data for PM269*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_pm269[] = {
-       PM269_GPIO_REG
-       E1247_DISPLAY_GPIO_REG
+/* Fixed regulator devices for PM269 */
+static struct platform_device *fixed_reg_devs_pm269[] = {
+       PM269_FIXED_REG
+       E1247_DISPLAY_FIXED_REG
 };
 
-/* Gpio switch regulator platform data for PM269*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_pm269_pm313[] = {
-       PM269_GPIO_REG
-       PM313_DISPLAY_GPIO_REG
+/* Fixed regulator devices for PM269 */
+static struct platform_device *fixed_reg_devs_pm269_pm313[] = {
+       PM269_FIXED_REG
+       PM313_DISPLAY_FIXED_REG
 };
 
-/* Gpio switch regulator platform data for PM311*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_pm311[] = {
-       PM311_GPIO_REG
-       E1247_DISPLAY_GPIO_REG
+/* Fixed regulator devices for PM311 */
+static struct platform_device *fixed_reg_devs_pm311[] = {
+       PM311_FIXED_REG
+       E1247_DISPLAY_FIXED_REG
 };
 
-/* Gpio switch regulator platform data for PM11*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_pm311_pm313[] = {
-       PM311_GPIO_REG
-       PM313_DISPLAY_GPIO_REG
+/* Fixed regulator devices for PM11 */
+static struct platform_device *fixed_reg_devs_pm311_pm313[] = {
+       PM311_FIXED_REG
+       PM313_DISPLAY_FIXED_REG
 };
 
-/* Gpio switch regulator platform data for E1291 A03*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_e1291_a03[] = {
-       COMMON_GPIO_REG
-       E1291_A03_GPIO_REG
-       E1198_GPIO_REG
+/* Fixed regulator devices for E1291 A03 */
+static struct platform_device *fixed_reg_devs_e1291_a03[] = {
+       COMMON_FIXED_REG
+       E1291_A03_FIXED_REG
+       E1198_FIXED_REG
 };
 
-/* Gpio switch regulator platform data for E1291 A04/A05*/
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs_e1291_a04[] = {
-       COMMON_GPIO_REG_E1291_A04
-       E1291_A03_GPIO_REG
-       E1198_GPIO_REG
+/* Fixed regulator devices for E1291 A04/A05 */
+static struct platform_device *fixed_reg_devs_e1291_a04[] = {
+       COMMON_FIXED_REG_E1291_A04
+       E1291_A03_FIXED_REG
+       E1198_FIXED_REG
 };
 
-
-static struct gpio_switch_regulator_platform_data  gswitch_pdata;
-static struct platform_device gswitch_regulator_pdata = {
-       .name = "gpio-switch-regulator",
-       .id   = -1,
-       .dev  = {
-            .platform_data = &gswitch_pdata,
-       },
-};
-
-int __init cardhu_gpio_switch_regulator_init(void)
+int __init cardhu_fixed_regulator_init(void)
 {
        int i;
        struct board_info board_info;
        struct board_info pmu_board_info;
        struct board_info display_board_info;
+       struct platform_device **fixed_reg_devs;
+       int    nfixreg_devs;
+
+       if (!is_cardhu_machine)
+               return 0;
 
        tegra_get_board_info(&board_info);
        tegra_get_pmu_board_info(&pmu_board_info);
@@ -1013,72 +1038,80 @@ int __init cardhu_gpio_switch_regulator_init(void)
        switch (board_info.board_id) {
        case BOARD_E1198:
                if (board_info.fab <= BOARD_FAB_A01) {
-                       gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_e1198_base);
-                       gswitch_pdata.subdevs = gswitch_subdevs_e1198_base;
+                       nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_e1198_base);
+                       fixed_reg_devs = fixed_reg_devs_e1198_base;
                } else {
-                       gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_e1198_a02);
-                       gswitch_pdata.subdevs = gswitch_subdevs_e1198_a02;
+                       nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_e1198_a02);
+                       fixed_reg_devs = fixed_reg_devs_e1198_a02;
                }
                break;
 
        case BOARD_E1291:
                if (board_info.fab == BOARD_FAB_A03) {
-                       gswitch_pdata.num_subdevs =
-                                       ARRAY_SIZE(gswitch_subdevs_e1291_a03);
-                       gswitch_pdata.subdevs = gswitch_subdevs_e1291_a03;
+                       nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_e1291_a03);
+                       fixed_reg_devs = fixed_reg_devs_e1291_a03;
                } else if ((board_info.fab == BOARD_FAB_A04) ||
                                (board_info.fab == BOARD_FAB_A05)) {
-                       gswitch_pdata.num_subdevs =
-                                       ARRAY_SIZE(gswitch_subdevs_e1291_a04);
-                       gswitch_pdata.subdevs = gswitch_subdevs_e1291_a04;
+                       nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_e1291_a04);
+                       fixed_reg_devs = fixed_reg_devs_e1291_a04;
                } else {
-                       gswitch_pdata.num_subdevs =
-                                       ARRAY_SIZE(gswitch_subdevs_e1198_base);
-                       gswitch_pdata.subdevs = gswitch_subdevs_e1198_base;
+                       nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_e1198_base);
+                       fixed_reg_devs = fixed_reg_devs_e1198_base;
                }
                break;
 
        case BOARD_PM311:
        case BOARD_PM305:
-               gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_pm311);
-               gswitch_pdata.subdevs = gswitch_subdevs_pm311;
+               nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_pm311);
+               fixed_reg_devs = fixed_reg_devs_pm311;
                if (display_board_info.board_id == BOARD_DISPLAY_PM313) {
-                       gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_pm311_pm313);
-                       gswitch_pdata.subdevs = gswitch_subdevs_pm311_pm313;
+                       nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_pm311_pm313);
+                       fixed_reg_devs = fixed_reg_devs_pm311_pm313;
                }
                break;
 
        case BOARD_PM269:
        case BOARD_E1257:
-               gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_pm269);
-               gswitch_pdata.subdevs = gswitch_subdevs_pm269;
+               nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_pm269);
+               fixed_reg_devs = fixed_reg_devs_pm269;
                if (display_board_info.board_id == BOARD_DISPLAY_PM313) {
-                       gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_pm269_pm313);
-                       gswitch_pdata.subdevs = gswitch_subdevs_pm269_pm313;
+                       nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_pm269_pm313);
+                       fixed_reg_devs = fixed_reg_devs_pm269_pm313;
                } else {
-                       gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_pm269);
-                       gswitch_pdata.subdevs = gswitch_subdevs_pm269;
+                       nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_pm269);
+                       fixed_reg_devs = fixed_reg_devs_pm269;
                }
                break;
+
        default:
                if (display_board_info.board_id == BOARD_DISPLAY_PM313) {
-                       gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_e118x_pm313);
-                       gswitch_pdata.subdevs = gswitch_subdevs_e118x_pm313;
+                       nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_e118x_pm313);
+                       fixed_reg_devs = fixed_reg_devs_e118x_pm313;
                } else {
-                       gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_e118x);
-                       gswitch_pdata.subdevs = gswitch_subdevs_e118x;
+                       nfixreg_devs = ARRAY_SIZE(fixed_reg_devs_e118x);
+                       fixed_reg_devs = fixed_reg_devs_e118x;
                }
                break;
        }
 
-       for (i = 0; i < gswitch_pdata.num_subdevs; ++i) {
-               struct gpio_switch_regulator_subdev_data *gswitch_data = gswitch_pdata.subdevs[i];
-               if (gswitch_data->gpio_nr < TEGRA_NR_GPIOS)
-                       tegra_gpio_enable(gswitch_data->gpio_nr);
-       }
+       for (i = 0; i < nfixreg_devs; ++i) {
+               int gpio_nr;
+               if (!strncmp(fixed_reg_devs[i]->name, "gpio", 4)) {
+                       struct gpio_switch_regulator_platform_data *gs_pdata =
+                               fixed_reg_devs[i]->dev.platform_data;
+                       gpio_nr = gs_pdata->subdevs[0]->gpio_nr;
+               } else {
+                       struct fixed_voltage_config *fixed_reg_pdata =
+                               fixed_reg_devs[i]->dev.platform_data;
+                       gpio_nr = fixed_reg_pdata->gpio;
+               }
 
-       return platform_device_register(&gswitch_regulator_pdata);
+               if (gpio_nr < TEGRA_NR_GPIOS)
+                       tegra_gpio_enable(gpio_nr);
+       }
+       return platform_add_devices(fixed_reg_devs, nfixreg_devs);
 }
+subsys_initcall_sync(cardhu_fixed_regulator_init);
 
 static void cardhu_board_suspend(int lp_state, enum suspend_stage stg)
 {
@@ -1249,4 +1282,3 @@ static int __init cardhu_charger_late_init(void)
 }
 
 late_initcall(cardhu_charger_late_init);
-
index 32dac7b..ba18c97 100644 (file)
@@ -978,7 +978,6 @@ static void __init tegra_cardhu_init(void)
        cardhu_sdhci_init();
        cardhu_regulator_init();
        cardhu_dtv_init();
-       cardhu_gpio_switch_regulator_init();
        cardhu_suspend_init();
        cardhu_power_off_init();
        cardhu_touch_init();
index 29bc227..f3a402c 100644 (file)
@@ -205,7 +205,6 @@ int cardhu_sensors_init(void);
 int cardhu_kbc_init(void);
 int cardhu_scroll_init(void);
 int cardhu_keys_init(void);
-int cardhu_gpio_switch_regulator_init(void);
 int cardhu_pins_state_init(void);
 int cardhu_emc_init(void);
 int cardhu_power_off_init(void);