summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-01-10 14:13:39 +0530
committerRohan Somvanshi <rsomvanshi@nvidia.com>2012-01-19 10:28:17 -0800
commit4b793fa3143f667254b516b07ba57e1f5b87637f (patch)
tree4f3fcf6857c8c5ce7f7de2bcb675751a93f5eb26 /arch
parent0ed0002d76096a629f077b50bd31b4894b9ea528 (diff)
arm: tegra: enterprise: Use fixed regulator
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. bug 923713 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Change-Id: Ib51874e4ba90750234d8c80735e9230669a0dee8 Reviewed-on: http://git-master/r/74249 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com> Reviewed-on: http://git-master/r/75545 Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-tegra/board-enterprise-power.c148
1 files changed, 73 insertions, 75 deletions
diff --git a/arch/arm/mach-tegra/board-enterprise-power.c b/arch/arm/mach-tegra/board-enterprise-power.c
index ef8115b40f05..fbdfa5b37961 100644
--- a/arch/arm/mach-tegra/board-enterprise-power.c
+++ b/arch/arm/mach-tegra/board-enterprise-power.c
@@ -22,7 +22,7 @@
#include <linux/platform_device.h>
#include <linux/resource.h>
#include <linux/regulator/machine.h>
-#include <linux/regulator/gpio-switch-regulator.h>
+#include <linux/regulator/fixed.h>
#include <linux/mfd/tps80031.h>
#include <linux/regulator/tps80031-regulator.h>
#include <linux/tps80031-charger.h>
@@ -49,6 +49,8 @@
#define PMC_DPD_PADS_ORIDE 0x01c
#define PMC_DPD_PADS_ORIDE_BLINK (1 << 20)
+static bool is_enterprise_machine = false;
+
/************************ TPS80031 based regulator ****************/
static struct regulator_consumer_supply tps80031_vio_supply[] = {
REGULATOR_SUPPLY("vio_1v8", NULL),
@@ -329,43 +331,37 @@ static struct i2c_board_info __initdata enterprise_regulators[] = {
},
};
-/************************ GPIO based switch regulator ****************/
-
+/************************ GPIO based fixed regulator ****************/
/* REGEN1 from PMU*/
-static struct regulator_consumer_supply gpio_switch_pmu_5v15_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_pmu_5v15_en_supply[] = {
REGULATOR_SUPPLY("vdd_5v15", NULL),
};
-static int gpio_switch_pmu_5v15_en_voltages[] = {5000};
/* REGEN2 from PMU*/
-static struct regulator_consumer_supply gpio_switch_pmu_3v3_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_pmu_3v3_en_supply[] = {
REGULATOR_SUPPLY("avdd_usb_hdmi_3v3", NULL),
REGULATOR_SUPPLY("avdd_usb", NULL),
REGULATOR_SUPPLY("avdd_hdmi", NULL),
REGULATOR_SUPPLY("vdd", "4-004c"),
};
-static int gpio_switch_pmu_3v3_en_voltages[] = {3300};
/* SYSEN from PMU*/
-static struct regulator_consumer_supply gpio_switch_pmu_hdmi_5v0_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_pmu_hdmi_5v0_en_supply[] = {
REGULATOR_SUPPLY("hdmi_5v0", NULL),
};
-static int gpio_switch_pmu_hdmi_5v0_en_voltages[] = {5000};
/* LCD-D16 (GPIO M0) from T30*/
-static struct regulator_consumer_supply gpio_switch_vdd_fuse_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_vdd_fuse_en_supply[] = {
REGULATOR_SUPPLY("vdd_fuse", NULL),
};
-static int gpio_switch_vdd_fuse_en_voltages[] = {3300};
/* LCD-D17 (GPIO M1) from T30*/
-static struct regulator_consumer_supply gpio_switch_sdmmc3_vdd_sel_supply[] = {
+static struct regulator_consumer_supply fixed_reg_sdmmc3_vdd_sel_supply[] = {
REGULATOR_SUPPLY("vddio_sdmmc3_2v85_1v8", NULL),
REGULATOR_SUPPLY("sdmmc3_compu_pu", NULL),
REGULATOR_SUPPLY("vddio_sdmmc3", NULL),
REGULATOR_SUPPLY("vsys_3v7", NULL),
};
-static int gpio_switch_sdmmc3_vdd_sel_voltages[] = {2850};
/* LCD-D23 (GPIO M7) from T30*/
/* 2-0036 is dev_name of ar0832 in Enterprise A01*/
@@ -374,7 +370,7 @@ static int gpio_switch_sdmmc3_vdd_sel_voltages[] = {2850};
/* 2-0070 is dev_name of PCA9546 in Enterprise A02*/
/* 6-0036 is dev_name of ar0832 in Enterprise A02 */
/* 7-0036 is dev_name of ar0832 in Enterprise A02 */
-static struct regulator_consumer_supply gpio_switch_cam_ldo_2v8_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_cam_ldo_2v8_en_supply[] = {
REGULATOR_SUPPLY("vaa", "2-0036"),
REGULATOR_SUPPLY("vaa", "2-0032"),
REGULATOR_SUPPLY("avdd", "2-0010"),
@@ -383,7 +379,6 @@ static struct regulator_consumer_supply gpio_switch_cam_ldo_2v8_en_supply[] = {
REGULATOR_SUPPLY("vaa", "6-0036"),
REGULATOR_SUPPLY("vaa", "7-0036"),
};
-static int gpio_switch_cam_ldo_2v8_en_voltages[] = {2800};
/* LCD-D9 (GPIO F1) from T30*/
/* 2-0036 is dev_name of ar0832 in Enterprise A01*/
@@ -393,7 +388,7 @@ static int gpio_switch_cam_ldo_2v8_en_voltages[] = {2800};
/* 2-0070 is dev_name of PCA9546 in Enterprise A02*/
/* 6-0036 is dev_name of ar0832 in Enterprise A02 */
/* 7-0036 is dev_name of ar0832 in Enterprise A02 */
-static struct regulator_consumer_supply gpio_switch_cam_ldo_1v8_en_supply[] = {
+static struct regulator_consumer_supply fixed_reg_cam_ldo_1v8_en_supply[] = {
REGULATOR_SUPPLY("vdd", "2-0036"),
REGULATOR_SUPPLY("vdd", "2-0032"),
REGULATOR_SUPPLY("dovdd", "2-0010"),
@@ -403,25 +398,16 @@ static struct regulator_consumer_supply gpio_switch_cam_ldo_1v8_en_supply[] = {
REGULATOR_SUPPLY("vdd", "6-0036"),
REGULATOR_SUPPLY("vdd", "7-0036"),
};
-static int gpio_switch_cam_ldo_1v8_en_voltages[] = {1800};
-/* Macro for defining gpio switch regulator sub device data */
-#define GREG_INIT(_id, _name, _input_supply, _gpio_nr, _active_low, \
- _init_state, _pg, _enable, _disable) \
- static struct gpio_switch_regulator_subdev_data gpio_pdata_##_name = \
+/* Macro for defining fixed regulator sub device data */
+#define FIXED_REG(_id, _name, _input_supply, _gpio_nr, _active_high, \
+ _millivolts, _boot_state) \
+ static struct regulator_init_data ri_data_##_name = \
{ \
- .regulator_name = "gpio-switch-"#_name, \
- .input_supply = _input_supply, \
- .id = _id, \
- .gpio_nr = _gpio_nr, \
- .pin_group = _pg, \
- .active_low = _active_low, \
- .init_state = _init_state, \
- .voltages = gpio_switch_##_name##_voltages, \
- .n_voltages = ARRAY_SIZE(gpio_switch_##_name##_voltages), \
+ .supply_regulator = _input_supply, \
.num_consumer_supplies = \
- ARRAY_SIZE(gpio_switch_##_name##_supply), \
- .consumer_supplies = gpio_switch_##_name##_supply, \
+ ARRAY_SIZE(fixed_reg_##_name##_supply), \
+ .consumer_supplies = fixed_reg_##_name##_supply, \
.constraints = { \
.valid_modes_mask = (REGULATOR_MODE_NORMAL | \
REGULATOR_MODE_STANDBY), \
@@ -429,54 +415,66 @@ static int gpio_switch_cam_ldo_1v8_en_voltages[] = {1800};
REGULATOR_CHANGE_STATUS | \
REGULATOR_CHANGE_VOLTAGE), \
}, \
- .enable_rail = _enable, \
- .disable_rail = _disable, \
+ }; \
+ static struct fixed_voltage_config fixed_reg_##_name##_pdata = \
+ { \
+ .supply_name = "fixed_reg_"#_name, \
+ .microvolts = _millivolts * 1000, \
+ .gpio = _gpio_nr, \
+ .enable_high = _active_high, \
+ .enabled_at_boot = _boot_state, \
+ .init_data = &ri_data_##_name, \
+ }; \
+ static struct platform_device fixed_reg_##_name##_dev = { \
+ .name = "reg-fixed-voltage", \
+ .id = _id, \
+ .dev = { \
+ .platform_data = &fixed_reg_##_name##_pdata, \
+ }, \
}
-GREG_INIT(0, pmu_5v15_en, NULL, ENT_TPS80031_GPIO_REGEN1, false, 0, 0, 0, 0);
-GREG_INIT(1, pmu_3v3_en, "vdd_5v15", ENT_TPS80031_GPIO_REGEN2, false, 0, 0, 0, 0);
-GREG_INIT(2, pmu_hdmi_5v0_en, "vdd_5v15", ENT_TPS80031_GPIO_SYSEN, false, 0, 0, 0, 0);
-
-GREG_INIT(3, vdd_fuse_en, "avdd_usb_hdmi_3v3", TEGRA_GPIO_PM0, false, 0, 0, 0, 0);
-GREG_INIT(4, sdmmc3_vdd_sel, "vddio_sdmmc_2v85", TEGRA_GPIO_PM1, false, 0, 0, 0, 0);
-GREG_INIT(5, cam_ldo_2v8_en, NULL, TEGRA_GPIO_PM7, false, 0, 0, 0, 0);
-GREG_INIT(6, cam_ldo_1v8_en, NULL, TEGRA_GPIO_PF1, false, 0, 0, 0, 0);
-
-#define ADD_GPIO_REG(_name) (&gpio_pdata_##_name)
-static struct gpio_switch_regulator_subdev_data *gswitch_subdevs[] = {
- ADD_GPIO_REG(pmu_5v15_en),
- ADD_GPIO_REG(pmu_3v3_en),
- ADD_GPIO_REG(pmu_hdmi_5v0_en),
- ADD_GPIO_REG(vdd_fuse_en),
- ADD_GPIO_REG(sdmmc3_vdd_sel),
- ADD_GPIO_REG(cam_ldo_2v8_en),
- ADD_GPIO_REG(cam_ldo_1v8_en),
-};
-
-static struct gpio_switch_regulator_platform_data gswitch_pdata = {
- .num_subdevs = ARRAY_SIZE(gswitch_subdevs),
- .subdevs = gswitch_subdevs,
-};
-
-static struct platform_device gswitch_regulator_pdata = {
- .name = "gpio-switch-regulator",
- .id = -1,
- .dev = {
- .platform_data = &gswitch_pdata,
- },
-};
-
-static int __init enterprise_gpio_switch_regulator_init(void)
+FIXED_REG(0, pmu_5v15_en, NULL,
+ ENT_TPS80031_GPIO_REGEN1, true, 5000, 0 );
+FIXED_REG(1, pmu_3v3_en, "fixed_reg_pmu_5v15_en",
+ ENT_TPS80031_GPIO_REGEN2, true, 3300, 0);
+FIXED_REG(2, pmu_hdmi_5v0_en, "fixed_reg_pmu_5v15_en",
+ ENT_TPS80031_GPIO_SYSEN, true, 5000, 0);
+FIXED_REG(3, vdd_fuse_en, "fixed_reg_pmu_3v3_en",
+ TEGRA_GPIO_PM0, true, 3300, 0);
+FIXED_REG(4, sdmmc3_vdd_sel, tps80031_rails(SMPS4),
+ TEGRA_GPIO_PM1, true, 2850, 0);
+FIXED_REG(5, cam_ldo_2v8_en, NULL,
+ TEGRA_GPIO_PM7, true, 2800, 0);
+FIXED_REG(6, cam_ldo_1v8_en, NULL,
+ TEGRA_GPIO_PF1, true, 1800, 0);
+
+#define ADD_FIXED_REG(_name) (&fixed_reg_##_name##_dev)
+static struct platform_device *fixed_regs_devices[] = {
+ ADD_FIXED_REG(pmu_5v15_en),
+ ADD_FIXED_REG(pmu_3v3_en),
+ ADD_FIXED_REG(pmu_hdmi_5v0_en),
+ ADD_FIXED_REG(vdd_fuse_en),
+ ADD_FIXED_REG(sdmmc3_vdd_sel),
+ ADD_FIXED_REG(cam_ldo_2v8_en),
+ ADD_FIXED_REG(cam_ldo_1v8_en),
+};
+
+static int __init enterprise_fixed_regulator_init(void)
{
int i;
- 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);
+ if (!is_enterprise_machine)
+ return 0;
+
+ for (i = 0; i < ARRAY_SIZE(fixed_regs_devices); ++i) {
+ struct fixed_voltage_config *fixed_reg_pdata =
+ fixed_regs_devices[i]->dev.platform_data;
+ if (fixed_reg_pdata->gpio < TEGRA_NR_GPIOS)
+ tegra_gpio_enable(fixed_reg_pdata->gpio);
}
- return platform_device_register(&gswitch_regulator_pdata);
+ return platform_add_devices(fixed_regs_devices,
+ ARRAY_SIZE(fixed_regs_devices));
}
+subsys_initcall_sync(enterprise_fixed_regulator_init);
static void enterprise_power_off(void)
{
@@ -516,8 +514,8 @@ int __init enterprise_regulator_init(void)
}
i2c_register_board_info(4, enterprise_regulators, 1);
- enterprise_gpio_switch_regulator_init();
pm_power_off = enterprise_power_off;
+ is_enterprise_machine = true;
return 0;
}