aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/twl-core.c59
-rw-r--r--drivers/regulator/twl-regulator.c54
-rw-r--r--drivers/usb/otg/twl6030-usb.c2
-rw-r--r--include/linux/i2c/twl.h39
4 files changed, 83 insertions, 71 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 953189c..2f61173 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -200,7 +200,7 @@
#define TWL6030_BASEADD_GASGAUGE 0x00C0
#define TWL6030_BASEADD_PIH 0x00D0
#define TWL6030_BASEADD_CHARGER 0x00E0
-#define TWL6025_BASEADD_CHARGER 0x00DA
+#define TWL6032_BASEADD_CHARGER 0x00DA
/* subchip/slave 2 0x4A - DFT */
#define TWL6030_BASEADD_DIEID 0x00C0
@@ -227,6 +227,9 @@
#define TWL5031 BIT(2) /* twl5031 has different registers */
#define TWL6030_CLASS BIT(3) /* TWL6030 class */
+/* need to access USB_PRODUCT_ID_LSB to identify which 6030 varient we are */
+#define USB_PRODUCT_ID_LSB 0x02
+
/*----------------------------------------------------------------------*/
/* is driver active, bound to a chip? */
@@ -334,7 +337,7 @@ static struct twl_mapping twl6030_map[] = {
{ SUB_CHIP_ID0, TWL6030_BASEADD_RTC },
{ SUB_CHIP_ID0, TWL6030_BASEADD_MEM },
- { SUB_CHIP_ID1, TWL6025_BASEADD_CHARGER },
+ { SUB_CHIP_ID1, TWL6032_BASEADD_CHARGER },
{ SUB_CHIP_ID0, TWL6030_BASEADD_PM_SLAVE_RES },
};
@@ -767,9 +770,9 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
| REGULATOR_CHANGE_STATUS,
};
- if (features & TWL6025_SUBCLASS) {
+ if (features & TWL6032_SUBCLASS) {
usb3v3.supply = "ldousb";
- regulator = TWL6025_REG_LDOUSB;
+ regulator = TWL6032_REG_LDOUSB;
} else {
usb3v3.supply = "vusb";
regulator = TWL6030_REG_VUSB;
@@ -796,8 +799,8 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
if (twl_has_regulator() && child)
usb3v3.dev = child;
} else if (twl_has_regulator() && twl_class_is_6030()) {
- if (features & TWL6025_SUBCLASS)
- child = add_regulator(TWL6025_REG_LDOUSB,
+ if (features & TWL6032_SUBCLASS)
+ child = add_regulator(TWL6032_REG_LDOUSB,
pdata->ldousb, features);
else
child = add_regulator(TWL6030_REG_VUSB,
@@ -930,7 +933,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
/* twl6030 regulators */
if (twl_has_regulator() && twl_class_is_6030() &&
- !(features & TWL6025_SUBCLASS)) {
+ !(features & TWL6032_SUBCLASS)) {
child = add_regulator(TWL6030_REG_VMMC, pdata->vmmc,
features);
if (IS_ERR(child))
@@ -997,7 +1000,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
return PTR_ERR(child);
}
- /* 6030 and 6025 share this regulator */
+ /* 6030 and 6032 share this regulator */
if (twl_has_regulator() && twl_class_is_6030()) {
child = add_regulator(TWL6030_REG_VANA, pdata->vana,
features);
@@ -1005,60 +1008,60 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
return PTR_ERR(child);
}
- /* twl6025 regulators */
+ /* twl6032 regulators */
if (twl_has_regulator() && twl_class_is_6030() &&
- (features & TWL6025_SUBCLASS)) {
- child = add_regulator(TWL6025_REG_LDO5, pdata->ldo5,
+ (features & TWL6032_SUBCLASS)) {
+ child = add_regulator(TWL6032_REG_LDO5, pdata->ldo5,
features);
if (IS_ERR(child))
return PTR_ERR(child);
- child = add_regulator(TWL6025_REG_LDO1, pdata->ldo1,
+ child = add_regulator(TWL6032_REG_LDO1, pdata->ldo1,
features);
if (IS_ERR(child))
return PTR_ERR(child);
- child = add_regulator(TWL6025_REG_LDO7, pdata->ldo7,
+ child = add_regulator(TWL6032_REG_LDO7, pdata->ldo7,
features);
if (IS_ERR(child))
return PTR_ERR(child);
- child = add_regulator(TWL6025_REG_LDO6, pdata->ldo6,
+ child = add_regulator(TWL6032_REG_LDO6, pdata->ldo6,
features);
if (IS_ERR(child))
return PTR_ERR(child);
- child = add_regulator(TWL6025_REG_LDOLN, pdata->ldoln,
+ child = add_regulator(TWL6032_REG_LDOLN, pdata->ldoln,
features);
if (IS_ERR(child))
return PTR_ERR(child);
- child = add_regulator(TWL6025_REG_LDO2, pdata->ldo2,
+ child = add_regulator(TWL6032_REG_LDO2, pdata->ldo2,
features);
if (IS_ERR(child))
return PTR_ERR(child);
- child = add_regulator(TWL6025_REG_LDO4, pdata->ldo4,
+ child = add_regulator(TWL6032_REG_LDO4, pdata->ldo4,
features);
if (IS_ERR(child))
return PTR_ERR(child);
- child = add_regulator(TWL6025_REG_LDO3, pdata->ldo3,
+ child = add_regulator(TWL6032_REG_LDO3, pdata->ldo3,
features);
if (IS_ERR(child))
return PTR_ERR(child);
- child = add_regulator(TWL6025_REG_SMPS3, pdata->smps3,
+ child = add_regulator(TWL6032_REG_SMPS3, pdata->smps3,
features);
if (IS_ERR(child))
return PTR_ERR(child);
- child = add_regulator(TWL6025_REG_SMPS4, pdata->smps4,
+ child = add_regulator(TWL6032_REG_SMPS4, pdata->smps4,
features);
if (IS_ERR(child))
return PTR_ERR(child);
- child = add_regulator(TWL6025_REG_VIO, pdata->vio6025,
+ child = add_regulator(TWL6032_REG_VIO, pdata->vio6032,
features);
if (IS_ERR(child))
return PTR_ERR(child);
@@ -1209,7 +1212,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
unsigned i;
struct twl4030_platform_data *pdata = client->dev.platform_data;
u8 temp;
- int ret = 0;
+ int ret = 0, features;
if (!pdata) {
dev_dbg(&client->dev, "no platform data?\n");
@@ -1299,7 +1302,15 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1);
}
- status = add_children(pdata, id->driver_data);
+
+ features = id->driver_data;
+ if (twl_class_is_6030()) {
+ twl_i2c_read_u8(TWL_MODULE_USB, &temp, USB_PRODUCT_ID_LSB);
+ if (temp == 0x32)
+ features |= TWL6032_SUBCLASS;
+ }
+
+ status = add_children(pdata, features);
fail:
if (status < 0)
twl_remove(client);
@@ -1314,7 +1325,7 @@ static const struct i2c_device_id twl_ids[] = {
{ "tps65930", TPS_SUBSET }, /* fewer LDOs and DACs; no charger */
{ "tps65920", TPS_SUBSET }, /* fewer LDOs; no codec or charger */
{ "twl6030", TWL6030_CLASS }, /* "Phoenix power chip" */
- { "twl6025", TWL6030_CLASS | TWL6025_SUBCLASS }, /* "Phoenix lite" */
+ { "twl6032", TWL6030_CLASS | TWL6032_SUBCLASS }, /* Phoenix lite */
{ /* end of list */ },
};
MODULE_DEVICE_TABLE(i2c, twl_ids);
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index f34ae3a..8ac43a2 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -109,7 +109,7 @@ struct twlreg_info {
#define SMPS_OFFSET_EN BIT(0)
#define SMPS_EXTENDED_EN BIT(1)
-/* twl6025 SMPS EPROM values */
+/* twl6032 SMPS EPROM values */
#define TWL6030_SMPS_OFFSET 0xB0
#define TWL6030_SMPS_MULT 0xB3
#define SMPS_MULTOFFSET_SMPS4 BIT(0)
@@ -185,12 +185,12 @@ static int twl6030reg_is_enabled(struct regulator_dev *rdev)
struct twlreg_info *info = rdev_get_drvdata(rdev);
int grp = 0, val;
- if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS)))
+ if (!(twl_class_is_6030() && (info->features & TWL6032_SUBCLASS)))
grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP);
if (grp < 0)
return grp;
- if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS)))
+ if (!(twl_class_is_6030() && (info->features & TWL6032_SUBCLASS)))
grp &= P1_GRP_6030;
else
grp = 1;
@@ -252,7 +252,7 @@ static int twl6030reg_enable(struct regulator_dev *rdev)
int grp = 0;
int ret;
- if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS)))
+ if (!(twl_class_is_6030() && (info->features & TWL6032_SUBCLASS)))
grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP);
if (grp < 0)
return grp;
@@ -296,7 +296,7 @@ static int twl6030reg_disable(struct regulator_dev *rdev)
int grp = 0;
int ret;
- if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS)))
+ if (!(twl_class_is_6030() && (info->features & TWL6032_SUBCLASS)))
grp = P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030;
/* For 6030, set the off state for all grps enabled */
@@ -395,7 +395,7 @@ static int twl6030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
int grp = 0;
int val;
- if (!(twl_class_is_6030() && (info->features & TWL6025_SUBCLASS)))
+ if (!(twl_class_is_6030() && (info->features & TWL6032_SUBCLASS)))
grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP);
if (grp < 0)
@@ -953,13 +953,13 @@ static struct regulator_ops twlsmps_ops = {
}, \
}
-#define TWL6025_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \
+#define TWL6032_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \
.base = offset, \
.min_mV = min_mVolts, \
.max_mV = max_mVolts, \
.desc = { \
.name = #label, \
- .id = TWL6025_REG_##label, \
+ .id = TWL6032_REG_##label, \
.n_voltages = ((max_mVolts - min_mVolts)/100) + 1, \
.ops = &twl6030ldo_ops, \
.type = REGULATOR_VOLTAGE, \
@@ -1010,13 +1010,13 @@ static struct regulator_ops twlsmps_ops = {
}, \
}
-#define TWL6025_ADJUSTABLE_SMPS(label, offset) { \
+#define TWL6032_ADJUSTABLE_SMPS(label, offset) { \
.base = offset, \
.min_mV = 600, \
.max_mV = 2100, \
.desc = { \
.name = #label, \
- .id = TWL6025_REG_##label, \
+ .id = TWL6032_REG_##label, \
.n_voltages = TWL603X_SMPS_NUMBER_VOLTAGES, \
.ops = &twlsmps_ops, \
.type = REGULATOR_VOLTAGE, \
@@ -1070,20 +1070,20 @@ static struct twlreg_info twl_regs[] = {
TWL6030_ADJUSTABLE_SMPS(VMEM, 0x34, 600, 4000),
TWL6030_ADJUSTABLE_SMPS(V2V1, 0x1c, 1800, 2100),
- /* 6025 are renamed compared to 6030 versions */
- TWL6025_ADJUSTABLE_LDO(LDO2, 0x54, 1000, 3300),
- TWL6025_ADJUSTABLE_LDO(LDO4, 0x58, 1000, 3300),
- TWL6025_ADJUSTABLE_LDO(LDO3, 0x5c, 1000, 3300),
- TWL6025_ADJUSTABLE_LDO(LDO5, 0x68, 1000, 3300),
- TWL6025_ADJUSTABLE_LDO(LDO1, 0x6c, 1000, 3300),
- TWL6025_ADJUSTABLE_LDO(LDO7, 0x74, 1000, 3300),
- TWL6025_ADJUSTABLE_LDO(LDO6, 0x60, 1000, 3300),
- TWL6025_ADJUSTABLE_LDO(LDOLN, 0x64, 1000, 3300),
- TWL6025_ADJUSTABLE_LDO(LDOUSB, 0x70, 1000, 3300),
-
- TWL6025_ADJUSTABLE_SMPS(SMPS3, 0x34),
- TWL6025_ADJUSTABLE_SMPS(SMPS4, 0x10),
- TWL6025_ADJUSTABLE_SMPS(VIO, 0x16),
+ /* 6032 are renamed compared to 6030 versions */
+ TWL6032_ADJUSTABLE_LDO(LDO2, 0x54, 1000, 3300),
+ TWL6032_ADJUSTABLE_LDO(LDO4, 0x58, 1000, 3300),
+ TWL6032_ADJUSTABLE_LDO(LDO3, 0x5c, 1000, 3300),
+ TWL6032_ADJUSTABLE_LDO(LDO5, 0x68, 1000, 3300),
+ TWL6032_ADJUSTABLE_LDO(LDO1, 0x6c, 1000, 3300),
+ TWL6032_ADJUSTABLE_LDO(LDO7, 0x74, 1000, 3300),
+ TWL6032_ADJUSTABLE_LDO(LDO6, 0x60, 1000, 3300),
+ TWL6032_ADJUSTABLE_LDO(LDOLN, 0x64, 1000, 3300),
+ TWL6032_ADJUSTABLE_LDO(LDOUSB, 0x70, 1000, 3300),
+
+ TWL6032_ADJUSTABLE_SMPS(SMPS3, 0x34),
+ TWL6032_ADJUSTABLE_SMPS(SMPS4, 0x10),
+ TWL6032_ADJUSTABLE_SMPS(VIO, 0x16),
};
static u8 twl_get_smps_offset(void)
@@ -1164,19 +1164,19 @@ static int __devinit twlreg_probe(struct platform_device *pdev)
}
switch (pdev->id) {
- case TWL6025_REG_SMPS3:
+ case TWL6032_REG_SMPS3:
if (twl_get_smps_mult() & SMPS_MULTOFFSET_SMPS3)
info->flags |= SMPS_EXTENDED_EN;
if (twl_get_smps_offset() & SMPS_MULTOFFSET_SMPS3)
info->flags |= SMPS_OFFSET_EN;
break;
- case TWL6025_REG_SMPS4:
+ case TWL6032_REG_SMPS4:
if (twl_get_smps_mult() & SMPS_MULTOFFSET_SMPS4)
info->flags |= SMPS_EXTENDED_EN;
if (twl_get_smps_offset() & SMPS_MULTOFFSET_SMPS4)
info->flags |= SMPS_OFFSET_EN;
break;
- case TWL6025_REG_VIO:
+ case TWL6032_REG_VIO:
if (twl_get_smps_mult() & SMPS_MULTOFFSET_VIO)
info->flags |= SMPS_EXTENDED_EN;
if (twl_get_smps_offset() & SMPS_MULTOFFSET_VIO)
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index 9f51eaf..443a7da 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -208,7 +208,7 @@ static int twl6030_usb_ldo_init(struct twl6030_usb *twl)
{
char *regulator_name;
- if (twl->features & TWL6025_SUBCLASS)
+ if (twl->features & TWL6032_SUBCLASS)
regulator_name = "ldousb";
else
regulator_name = "vusb";
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 38fb965..46cba075 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -71,6 +71,7 @@
#define TWL4030_MODULE_PM_RECEIVER 0x15
#define TWL4030_MODULE_RTC 0x16
#define TWL4030_MODULE_SECURED_REG 0x17
+#define TWL6032_MODULE_CHARGER 0x18
#define TWL6030_MODULE_SLAVE_RES 0x19
#define TWL_MODULE_USB TWL4030_MODULE_USB
@@ -176,7 +177,7 @@ static inline int twl_class_is_ ##class(void) \
TWL_CLASS_IS(4030, TWL4030_CLASS_ID)
TWL_CLASS_IS(6030, TWL6030_CLASS_ID)
-#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */
+#define TWL6032_SUBCLASS BIT(4) /* Phoenix Lite is a varient*/
/*
* Read and write single 8-bit registers
@@ -798,7 +799,7 @@ struct twl4030_platform_data {
struct regulator_init_data *vusb;
struct regulator_init_data *clk32kg;
struct regulator_init_data *clk32kaudio;
- /* TWL6025 LDO regulators */
+ /* TWL6032 LDO regulators */
struct regulator_init_data *ldo1;
struct regulator_init_data *ldo2;
struct regulator_init_data *ldo3;
@@ -808,10 +809,10 @@ struct twl4030_platform_data {
struct regulator_init_data *ldo7;
struct regulator_init_data *ldoln;
struct regulator_init_data *ldousb;
- /* TWL6025 DCDC regulators */
+ /* TWL6032 DCDC regulators */
struct regulator_init_data *smps3;
struct regulator_init_data *smps4;
- struct regulator_init_data *vio6025;
+ struct regulator_init_data *vio6032;
};
/*----------------------------------------------------------------------*/
@@ -893,21 +894,21 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
#define TWL6030_REG_VRTC 47
#define TWL6030_REG_CLK32KG 48
-/* LDOs on 6025 have different names */
-#define TWL6025_REG_LDO2 49
-#define TWL6025_REG_LDO4 50
-#define TWL6025_REG_LDO3 51
-#define TWL6025_REG_LDO5 52
-#define TWL6025_REG_LDO1 53
-#define TWL6025_REG_LDO7 54
-#define TWL6025_REG_LDO6 55
-#define TWL6025_REG_LDOLN 56
-#define TWL6025_REG_LDOUSB 57
-
-/* 6025 DCDC supplies */
-#define TWL6025_REG_SMPS3 58
-#define TWL6025_REG_SMPS4 59
-#define TWL6025_REG_VIO 60
+/* LDOs on 6032 have different names */
+#define TWL6032_REG_LDO2 49
+#define TWL6032_REG_LDO4 50
+#define TWL6032_REG_LDO3 51
+#define TWL6032_REG_LDO5 52
+#define TWL6032_REG_LDO1 53
+#define TWL6032_REG_LDO7 54
+#define TWL6032_REG_LDO6 55
+#define TWL6032_REG_LDOLN 56
+#define TWL6032_REG_LDOUSB 57
+
+/* 6032 DCDC supplies */
+#define TWL6032_REG_SMPS3 58
+#define TWL6032_REG_SMPS4 59
+#define TWL6032_REG_VIO 60
#define TWL6030_REG_CLK32KAUDIO 61