msm: board-8064: Add GPIO controlled external regulators
Add support for the external regulators present on MPQ8064 boards. These
regulators are enabled via external SX1509 gpio-expander chip.
Change-Id: I4aa940996c9cdf9de302018efd2a1dc6dc3229c1
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8064-regulator.c b/arch/arm/mach-msm/board-8064-regulator.c
index 114ba7e..7bb8af9 100644
--- a/arch/arm/mach-msm/board-8064-regulator.c
+++ b/arch/arm/mach-msm/board-8064-regulator.c
@@ -252,6 +252,24 @@
REGULATOR_SUPPLY("ext_ts_sw", NULL),
REGULATOR_SUPPLY("vdd_ana", "3-005b"),
};
+VREG_CONSUMERS(FRC_5V) = {
+ REGULATOR_SUPPLY("frc_5v", NULL),
+};
+VREG_CONSUMERS(AVC_1P2V) = {
+ REGULATOR_SUPPLY("avc_1p2v", NULL),
+};
+VREG_CONSUMERS(AVC_1P8V) = {
+ REGULATOR_SUPPLY("avc_1p8v", NULL),
+};
+VREG_CONSUMERS(AVC_2P2V) = {
+ REGULATOR_SUPPLY("avc_2p2v", NULL),
+};
+VREG_CONSUMERS(AVC_5V) = {
+ REGULATOR_SUPPLY("avc_5v", NULL),
+};
+VREG_CONSUMERS(AVC_3P3V) = {
+ REGULATOR_SUPPLY("avc_3p3v", NULL),
+};
#define PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
_apply_uV, _pull_down, _always_on, _supply_regulator, \
@@ -486,6 +504,18 @@
PM8921_MPP_PM_TO_SYS(8), NULL),
};
+struct gpio_regulator_platform_data
+mpq8064_gpio_regulator_pdata[] __devinitdata = {
+ GPIO_VREG(FRC_5V, "frc_5v", "frc_5v_en", SX150X_GPIO(4, 10), NULL),
+ GPIO_VREG(AVC_1P2V, "avc_1p2v", "avc_1p2v_en", SX150X_GPIO(4, 2), NULL),
+ GPIO_VREG(AVC_1P8V, "avc_1p8v", "avc_1p8v_en", SX150X_GPIO(4, 4), NULL),
+ GPIO_VREG(AVC_2P2V, "avc_2p2v", "avc_2p2v_en",
+ SX150X_GPIO(4, 14), NULL),
+ GPIO_VREG(AVC_5V, "avc_5v", "avc_5v_en", SX150X_GPIO(4, 3), NULL),
+ GPIO_VREG(AVC_3P3V, "avc_3p3v", "avc_3p3v_en",
+ SX150X_GPIO(4, 15), "avc_5v"),
+};
+
/* SAW regulator constraints */
struct regulator_init_data msm8064_saw_regulator_pdata_8921_s5 =
/* ID vreg_name min_uV max_uV */
diff --git a/arch/arm/mach-msm/board-8064.c b/arch/arm/mach-msm/board-8064.c
index 73b2e54..b38ae3c 100644
--- a/arch/arm/mach-msm/board-8064.c
+++ b/arch/arm/mach-msm/board-8064.c
@@ -1830,14 +1830,6 @@
},
};
-static struct platform_device *mpq_devices[] __initdata = {
- &mpq8064_device_qup_i2c_gsbi5,
- &msm_device_sps_apq8064,
-#ifdef CONFIG_MSM_ROTATOR
- &msm_rotator_device,
-#endif
-};
-
static struct platform_device *common_devices[] __initdata = {
&apq8064_device_dmov,
&apq8064_device_qup_i2c_gsbi1,
@@ -1962,6 +1954,80 @@
#endif
};
+static struct platform_device
+mpq8064_device_ext_5v_frc_vreg __devinitdata = {
+ .name = GPIO_REGULATOR_DEV_NAME,
+ .id = SX150X_GPIO(4, 10),
+ .dev = {
+ .platform_data =
+ &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_FRC_5V],
+ },
+};
+
+static struct platform_device
+mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
+ .name = GPIO_REGULATOR_DEV_NAME,
+ .id = SX150X_GPIO(4, 2),
+ .dev = {
+ .platform_data =
+ &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
+ },
+};
+
+static struct platform_device
+mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
+ .name = GPIO_REGULATOR_DEV_NAME,
+ .id = SX150X_GPIO(4, 4),
+ .dev = {
+ .platform_data =
+ &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
+ },
+};
+
+static struct platform_device
+mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
+ .name = GPIO_REGULATOR_DEV_NAME,
+ .id = SX150X_GPIO(4, 14),
+ .dev = {
+ .platform_data =
+ &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
+ },
+};
+
+static struct platform_device
+mpq8064_device_ext_5v_buck_vreg __devinitdata = {
+ .name = GPIO_REGULATOR_DEV_NAME,
+ .id = SX150X_GPIO(4, 3),
+ .dev = {
+ .platform_data =
+ &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
+ },
+};
+
+static struct platform_device
+mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
+ .name = GPIO_REGULATOR_DEV_NAME,
+ .id = SX150X_GPIO(4, 15),
+ .dev = {
+ .platform_data =
+ &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
+ },
+};
+
+static struct platform_device *mpq_devices[] __initdata = {
+ &msm_device_sps_apq8064,
+ &mpq8064_device_qup_i2c_gsbi5,
+#ifdef CONFIG_MSM_ROTATOR
+ &msm_rotator_device,
+#endif
+ &mpq8064_device_ext_5v_frc_vreg,
+ &mpq8064_device_ext_1p2_buck_vreg,
+ &mpq8064_device_ext_1p8_buck_vreg,
+ &mpq8064_device_ext_2p2_buck_vreg,
+ &mpq8064_device_ext_5v_buck_vreg,
+ &mpq8064_device_ext_3p3v_ldo_vreg,
+};
+
static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
.max_clock_speed = 1100000,
};
diff --git a/arch/arm/mach-msm/board-8064.h b/arch/arm/mach-msm/board-8064.h
index d1cc31e..7dcad10 100644
--- a/arch/arm/mach-msm/board-8064.h
+++ b/arch/arm/mach-msm/board-8064.h
@@ -43,11 +43,21 @@
#define GPIO_VREG_ID_EXT_TS_SW 2
#define GPIO_VREG_ID_EXT_MPP8 3
+#define GPIO_VREG_ID_FRC_5V 0
+#define GPIO_VREG_ID_AVC_1P2V 1
+#define GPIO_VREG_ID_AVC_1P8V 2
+#define GPIO_VREG_ID_AVC_2P2V 3
+#define GPIO_VREG_ID_AVC_5V 4
+#define GPIO_VREG_ID_AVC_3P3V 5
+
#define APQ8064_EXT_3P3V_REG_EN_GPIO 77
extern struct gpio_regulator_platform_data
apq8064_gpio_regulator_pdata[] __devinitdata;
+extern struct gpio_regulator_platform_data
+ mpq8064_gpio_regulator_pdata[] __devinitdata;
+
extern struct rpm_regulator_platform_data
apq8064_rpm_regulator_pdata __devinitdata;