summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2011-05-26 13:55:49 +0530
committerNiket Sirsi <nsirsi@nvidia.com>2011-05-26 19:05:33 -0700
commita7d4574504f033f6662a0d6d43acb6a821180c52 (patch)
tree996b2131be939f507a954de57ce11d5aba84d8f3
parent6f0578d704fa1f2326dfd73b18d39332f56268fb (diff)
arm: tegra: enterprise: Updating power rail info for TPS80031
There is independent driver for the pmu tps80031 and so updating the power rail information based on this driver. Also registering the tps80031 device. bug 830904 Change-Id: I98b6ed382dd8b849bd44015f2a2e39e7326cd4a9 Reviewed-on: http://git-master/r/32958 Reviewed-by: Niket Sirsi <nsirsi@nvidia.com> Tested-by: Niket Sirsi <nsirsi@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/board-enterprise-power.c252
-rw-r--r--arch/arm/mach-tegra/board-enterprise.c4
-rw-r--r--arch/arm/mach-tegra/board-enterprise.h13
3 files changed, 206 insertions, 63 deletions
diff --git a/arch/arm/mach-tegra/board-enterprise-power.c b/arch/arm/mach-tegra/board-enterprise-power.c
index c9e2a5e6cb53..dd1856e91d5d 100644
--- a/arch/arm/mach-tegra/board-enterprise-power.c
+++ b/arch/arm/mach-tegra/board-enterprise-power.c
@@ -22,7 +22,9 @@
#include <linux/platform_device.h>
#include <linux/resource.h>
#include <linux/regulator/machine.h>
-#include <linux/mfd/tps80031x.h>
+#include <linux/regulator/gpio-switch-regulator.h>
+#include <linux/mfd/tps80031.h>
+#include <linux/regulator/tps80031-regulator.h>
#include <linux/gpio.h>
#include <mach/suspend.h>
#include <linux/io.h>
@@ -37,12 +39,8 @@
#include "power.h"
#include "wakeups-t3.h"
-#ifdef CONFIG_TWL4030_CORE
-static struct regulator_consumer_supply tps80031x_smps4_supply[] = {
- REGULATOR_SUPPLY("avdd_dsi_csi", NULL),
-};
-
-static struct regulator_consumer_supply tps80031x_vio_supply[] = {
+/************************ TPS80031 based regulator ****************/
+static struct regulator_consumer_supply tps80031_vio_supply[] = {
REGULATOR_SUPPLY("avdd_osc", NULL),
REGULATOR_SUPPLY("vddio_sys", NULL),
REGULATOR_SUPPLY("vddio_uart", NULL),
@@ -52,93 +50,228 @@ static struct regulator_consumer_supply tps80031x_vio_supply[] = {
REGULATOR_SUPPLY("vddio_sdmmc1", NULL),
};
-static struct regulator_consumer_supply tps80031x_smps3_supply[] = {
+static struct regulator_consumer_supply tps80031_smps1_supply[] = {
+ REGULATOR_SUPPLY("vdd_cpu", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_smps2_supply[] = {
+ REGULATOR_SUPPLY("vdd_core", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_smps3_supply[] = {
REGULATOR_SUPPLY("en_vddio_ddr_1v2", NULL),
};
+static struct regulator_consumer_supply tps80031_smps4_supply[] = {
+ REGULATOR_SUPPLY("avdd_dsi_csi", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_vana_supply[] = {
+ REGULATOR_SUPPLY("unused_vana", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_ldo1_supply[] = {
+ REGULATOR_SUPPLY("unused_ldo1", NULL),
+};
-static struct regulator_consumer_supply tps80031x_ldo2_supply[] = {
+static struct regulator_consumer_supply tps80031_ldo2_supply[] = {
REGULATOR_SUPPLY("vdd_rtc", NULL),
};
-static struct regulator_consumer_supply tps80031x_ldo6_supply[] = {
+static struct regulator_consumer_supply tps80031_ldo3_supply[] = {
+ REGULATOR_SUPPLY("vdd_vbrtr", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_ldo4_supply[] = {
+ REGULATOR_SUPPLY("unused_ldo4", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_ldo5_supply[] = {
+ REGULATOR_SUPPLY("unused_ldo5", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_ldo6_supply[] = {
REGULATOR_SUPPLY("vddio_sdmmc3", NULL),
};
-static struct regulator_consumer_supply tps80031x_ldousb_supply[] = {
- REGULATOR_SUPPLY("avdd_hdmi_pll", NULL),
+static struct regulator_consumer_supply tps80031_ldo7_supply[] = {
+ REGULATOR_SUPPLY("vdd_plla_p_c_s", NULL),
+ REGULATOR_SUPPLY("vdd_pllm", NULL),
+ REGULATOR_SUPPLY("vdd_pllu_d", NULL),
+ REGULATOR_SUPPLY("vdd_pllx", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_ldoln_supply[] = {
+ REGULATOR_SUPPLY("unused_ldoln", NULL),
};
-static struct regulator_consumer_supply tps80031x_ldo7_supply[] = {
- REGULATOR_SUPPLY("avdd_plla_p_c_s", NULL),
- REGULATOR_SUPPLY("avdd_pllm", NULL),
- REGULATOR_SUPPLY("avdd_pllu_d", NULL),
- REGULATOR_SUPPLY("avdd_pllx", NULL),
+static struct regulator_consumer_supply tps80031_ldousb_supply[] = {
+ REGULATOR_SUPPLY("unused_ldousb", NULL),
};
#define TPS_PDATA_INIT(_id, _minmv, _maxmv, _supply_reg, _always_on, \
- _boot_on, _apply_uv) \
- { \
- .constraints = { \
- .min_uV = (_minmv)*1000, \
- .max_uV = (_maxmv)*1000, \
- .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, \
- .apply_uV = _apply_uv, \
- }, \
- .num_consumer_supplies = \
- ARRAY_SIZE(tps80031x_##_id##_supply), \
- .consumer_supplies = tps80031x_##_id##_supply, \
+ _boot_on, _apply_uv, _init_uV, _init_enable, _init_apply) \
+ static struct tps80031_regulator_platform_data pdata_##_id = { \
+ .regulator = { \
+ .constraints = { \
+ .min_uV = (_minmv)*1000, \
+ .max_uV = (_maxmv)*1000, \
+ .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, \
+ .apply_uV = _apply_uv, \
+ }, \
+ .num_consumer_supplies = \
+ ARRAY_SIZE(tps80031_##_id##_supply), \
+ .consumer_supplies = tps80031_##_id##_supply, \
+ .supply_regulator = _supply_reg, \
+ }, \
+ .init_uV = _init_uV * 1000, \
+ .init_enable = _init_enable, \
+ .init_apply = _init_apply, \
}
-static struct regulator_init_data smps4_data = TPS_PDATA_INIT(smps4, 600, 2100, 0, 1, 1, 0);
-static struct regulator_init_data vio_data = TPS_PDATA_INIT(vio, 0, 1800, 0, 1, 1, 0);
-static struct regulator_init_data smps3_data = TPS_PDATA_INIT(smps3, 600, 2100, 0, 1, 1, 0);
-static struct regulator_init_data ldo2_data = TPS_PDATA_INIT(ldo2, 1000, 3300, 0, 1, 1, 0);
-static struct regulator_init_data ldo6_data = TPS_PDATA_INIT(ldo6, 1000, 3300, 0, 1, 1, 0);
-static struct regulator_init_data ldousb_data = TPS_PDATA_INIT(ldousb, 1000, 3300, 0, 1, 1, 0);
-static struct regulator_init_data ldo7_data = TPS_PDATA_INIT(ldo7, 1000, 3300, 0, 1, 1, 0);
+TPS_PDATA_INIT(vio, 600, 2100, 0, 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(smps1, 600, 2100, 0, 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(smps2, 600, 2100, 0, 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(smps3, 600, 2100, 0, 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(smps4, 600, 2100, 0, 0, 0, 0, -1, 0, 0);
+
+TPS_PDATA_INIT(ldo1, 1000, 3300, tps80031_rails(VIO), 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(ldo2, 1000, 3300, 0, 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(ldo3, 1000, 3300, tps80031_rails(VIO), 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(ldo4, 1000, 3300, 0, 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(ldo5, 1000, 3300, 0, 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(ldo6, 1000, 3300, 0, 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(ldo7, 1000, 3300, tps80031_rails(VIO), 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(ldoln, 1000, 3300, tps80031_rails(SMPS3), 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(ldousb, 1000, 3300, 0, 0, 0, 0, -1, 0, 0);
+TPS_PDATA_INIT(vana, 1000, 3300, 0, 0, 0, 0, -1, 0, 0);
-static struct twl4030_clock_init_data clk_data = {
- .ck32k_lowpwr_enable = 0,
- .clk32_active_state_on = 1,
+#define TPS_REG(_id, _data) \
+ { \
+ .id = TPS80031_ID_##_id, \
+ .name = "tps80031-regulator", \
+ .platform_data = &pdata_##_data, \
+ }
+
+static struct tps80031_subdev_info tps80031_devs[] = {
+ TPS_REG(VIO, vio),
+ TPS_REG(SMPS1, smps1),
+ TPS_REG(SMPS2, smps2),
+ TPS_REG(SMPS3, smps3),
+ TPS_REG(SMPS4, smps4),
+ TPS_REG(LDO1, ldo1),
+ TPS_REG(LDO2, ldo2),
+ TPS_REG(LDO3, ldo3),
+ TPS_REG(LDO4, ldo4),
+ TPS_REG(LDO5, ldo5),
+ TPS_REG(LDO6, ldo6),
+ TPS_REG(LDO7, ldo7),
+ TPS_REG(LDOLN, ldoln),
+ TPS_REG(LDOUSB, ldousb),
+ TPS_REG(VANA, vana),
};
-static struct twl4030_platform_data tps_platform = {
- .clock = &clk_data,
- .smps4 = &smps4_data,
- .vio = &vio_data,
- .smps3 = &smps3_data,
- .ldo2 = &ldo2_data,
- .ldo6 = &ldo6_data,
- .ldousb = &ldousb_data,
- .ldo7 = &ldo7_data,
+struct tps80031_32kclock_plat_data clk32k_pdata = {
+ .en_clk32kg = 1,
+};
+static struct tps80031_platform_data tps_platform = {
+ .num_subdevs = ARRAY_SIZE(tps80031_devs),
+ .subdevs = tps80031_devs,
+ .irq_base = TPS80031_IRQ_BASE,
+ .gpio_base = TPS80031_GPIO_BASE,
+ .clk32k_pdata = &clk32k_pdata,
};
static struct i2c_board_info __initdata enterprise_regulators[] = {
{
- I2C_BOARD_INFO("mpu80031", 0x48),
+ I2C_BOARD_INFO("tps80031", 0x48),
.irq = INT_EXTERNAL_PMU,
.platform_data = &tps_platform,
},
};
-int __init enterprise_regulator_init(void)
+/************************ GPIO based switch regulator ****************/
+
+/* REGEN2 from PMU*/
+static struct regulator_consumer_supply gpio_switch_pmu_regen2_supply[] = {
+ REGULATOR_SUPPLY("avdd_usb", NULL),
+ REGULATOR_SUPPLY("avdd_hdmi", NULL),
+ REGULATOR_SUPPLY("avdd_hdmi_pll", NULL),
+};
+static int gpio_switch_pmu_regen2_voltages[] = {3300};
+
+/* Macro for defining gpio switch regulator sub device data */
+#define GREG_INIT(_id, _var, _name, _input_supply, _gpio_nr, _active_low, \
+ _init_state, _pg, _enable, _disable) \
+ static struct gpio_switch_regulator_subdev_data gpio_pdata_##_var = \
+ { \
+ .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), \
+ .num_consumer_supplies = \
+ ARRAY_SIZE(gpio_switch_##_name##_supply), \
+ .consumer_supplies = gpio_switch_##_name##_supply, \
+ .constraints = { \
+ .valid_modes_mask = (REGULATOR_MODE_NORMAL | \
+ REGULATOR_MODE_STANDBY), \
+ .valid_ops_mask = (REGULATOR_CHANGE_MODE | \
+ REGULATOR_CHANGE_STATUS | \
+ REGULATOR_CHANGE_VOLTAGE), \
+ }, \
+ .enable_rail = _enable, \
+ .disable_rail = _disable, \
+ }
+
+GREG_INIT(0, pmu_regen2, pmu_regen2, NULL, TPS80031_GPIO_REGEN2, 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_regen2),
+};
+
+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)
{
- i2c_register_board_info(4, enterprise_regulators, 1);
- return 0;
+ 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);
+ }
+ return platform_device_register(&gswitch_regulator_pdata);
}
-#else
+
int __init enterprise_regulator_init(void)
{
+ i2c_register_board_info(4, enterprise_regulators, 1);
+ enterprise_gpio_switch_regulator_init();
return 0;
}
-#endif
static struct tegra_suspend_platform_data enterprise_suspend_data = {
.cpu_timer = 2000,
@@ -159,5 +292,4 @@ int __init enterprise_suspend_init(void)
{
tegra_init_suspend(&enterprise_suspend_data);
return 0;
-
}
diff --git a/arch/arm/mach-tegra/board-enterprise.c b/arch/arm/mach-tegra/board-enterprise.c
index d966ca2bb339..5a8e248ce18f 100644
--- a/arch/arm/mach-tegra/board-enterprise.c
+++ b/arch/arm/mach-tegra/board-enterprise.c
@@ -377,7 +377,6 @@ static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
[0] = {
.instance = 0,
.vbus_gpio = -1,
- .vbus_reg_supply = "vdd_vbus_micro_usb",
},
[1] = {
.instance = 1,
@@ -386,7 +385,6 @@ static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
[2] = {
.instance = 2,
.vbus_gpio = -1,
- .vbus_reg_supply = "vdd_vbus_typea_usb",
},
};
@@ -490,9 +488,9 @@ static void __init tegra_enterprise_init(void)
snprintf(serial, sizeof(serial), "%llx", tegra_chip_uid());
andusb_plat.serial_number = kstrdup(serial, GFP_KERNEL);
platform_add_devices(enterprise_devices, ARRAY_SIZE(enterprise_devices));
+ enterprise_regulator_init();
enterprise_audio_init();
enterprise_sdhci_init();
- enterprise_regulator_init();
touch_init();
enterprise_usb_init();
enterprise_kbc_init();
diff --git a/arch/arm/mach-tegra/board-enterprise.h b/arch/arm/mach-tegra/board-enterprise.h
index 13a483f81dca..69bf4ca4ec8e 100644
--- a/arch/arm/mach-tegra/board-enterprise.h
+++ b/arch/arm/mach-tegra/board-enterprise.h
@@ -41,4 +41,17 @@ int enterprise_baseband_init(void);
#define TOUCH_BUS_ATMEL_T9 1
#endif
+/*****************External GPIO tables ******************/
+/* External peripheral gpio base. */
+#define TPS80031_GPIO_BASE TEGRA_NR_GPIOS
+#define TPS80031_GPIO_REGEN1 (TPS80031_GPIO_BASE + 0)
+#define TPS80031_GPIO_REGEN2 (TPS80031_GPIO_BASE + 1)
+#define TPS80031_GPIO_SYSEN (TPS80031_GPIO_BASE + 2)
+#define TPS80031_GPIO_END (TPS80031_GPIO_BASE + 3)
+
+/*****************External Interrupt tables ******************/
+/* External peripheral irq base */
+#define TPS80031_IRQ_BASE TEGRA_NR_IRQS
+#define TPS80031_IRQ_END (TPS80031_IRQ_BASE + 24)
+
#endif