summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/tps80031.c12
-rw-r--r--drivers/regulator/tps80031-regulator.c18
-rw-r--r--include/linux/mfd/tps80031.h2
3 files changed, 29 insertions, 3 deletions
diff --git a/drivers/mfd/tps80031.c b/drivers/mfd/tps80031.c
index 094adaa19a49..1cffa45f1e96 100644
--- a/drivers/mfd/tps80031.c
+++ b/drivers/mfd/tps80031.c
@@ -198,6 +198,7 @@ struct tps80031_client {
struct tps80031 {
struct device *dev;
unsigned long chip_info;
+ int es_version;
struct gpio_chip gpio;
struct irq_chip irq_chip;
@@ -484,6 +485,13 @@ unsigned long tps80031_get_chip_info(struct device *dev)
}
EXPORT_SYMBOL_GPL(tps80031_get_chip_info);
+int tps80031_get_pmu_version(struct device *dev)
+{
+ struct tps80031 *tps80031 = dev_get_drvdata(dev);
+ return tps80031->es_version;
+}
+EXPORT_SYMBOL_GPL(tps80031_get_pmu_version);
+
static struct tps80031 *tps80031_dev;
int tps80031_power_off(void)
{
@@ -1009,7 +1017,8 @@ static int dbg_tps_show(struct seq_file *s, void *unused)
print_regs("MASK_PH Regs", s, SLAVE_ID1, 0x20, 0x21);
print_regs("PMC MISC Regs", s, SLAVE_ID1, 0xE0, 0xEF);
print_regs("CONT_STATE", s, SLAVE_ID2, 0xE0, 0xE4);
- print_regs("VERNUM Regs", s, SLAVE_ID1, 0x87, 0x87);
+ print_regs("VERNUM Regs", s, SLAVE_ID3, 0x87, 0x87);
+ print_regs("EEPROM Regs", s, SLAVE_ID3, 0xDF, 0xDF);
print_regs("CHARGE Regs", s, SLAVE_ID2, 0xDA, 0xF5);
return 0;
}
@@ -1099,6 +1108,7 @@ static int __devinit tps80031_i2c_probe(struct i2c_client *client,
if (tps80031 == NULL)
return -ENOMEM;
+ tps80031->es_version = jtag_ver;
tps80031->dev = &client->dev;
i2c_set_clientdata(client, tps80031);
tps80031->chip_info = id->driver_data;
diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c
index 5cd164a985b1..9ea5cb9725a6 100644
--- a/drivers/regulator/tps80031-regulator.c
+++ b/drivers/regulator/tps80031-regulator.c
@@ -504,11 +504,12 @@ static int tps80031ldo_list_voltage(struct regulator_dev *rdev, unsigned index)
return (ri->min_mV + ((index - 1) * 100)) * 1000;
}
-static int __tps80031_ldo2_set_voltage(struct device *parent,
+static int __tps80031_ldo2_set_voltage_track_mode(struct device *parent,
struct tps80031_regulator *ri, int min_uV, int max_uV)
{
int vsel = 0;
int ret;
+ int nvsel;
if (min_uV < 600000) {
vsel = 0;
@@ -522,6 +523,18 @@ static int __tps80031_ldo2_set_voltage(struct device *parent,
return -EINVAL;
}
+ /* Check for valid setting for TPS80031 or TPS80032-ES1.0 */
+ if ((tps80031_get_chip_info(parent) == TPS80031) ||
+ ((tps80031_get_chip_info(parent) == TPS80032) &&
+ (tps80031_get_pmu_version(parent) == 0x0))) {
+ nvsel = vsel & 0x1F;
+ if ((nvsel == 0x0) || (nvsel >= 0x19 && nvsel <= 0x1F)) {
+ dev_err(ri->dev, "Invalid value for track mode LDO2 "
+ "configuration for TPS8003x PMU\n");
+ return -EINVAL;
+ }
+ }
+
ret = tps80031_write(parent, ri->volt_id, ri->volt_reg, vsel);
if (ret < 0)
dev_err(ri->dev, "Error in writing the Voltage register\n");
@@ -544,7 +557,8 @@ static int __tps80031_ldo_set_voltage(struct device *parent,
if ((ri->desc.id == TPS80031_ID_LDO2) &&
(ri->flags & TRACK_MODE_ENABLE))
- return __tps80031_ldo2_set_voltage(parent, ri, min_uV, max_uV);
+ return __tps80031_ldo2_set_voltage_track_mode(parent, ri,
+ min_uV, max_uV);
/*
* Use the below formula to calculate vsel
diff --git a/include/linux/mfd/tps80031.h b/include/linux/mfd/tps80031.h
index 0be3424a6dd8..ef5502c5c767 100644
--- a/include/linux/mfd/tps80031.h
+++ b/include/linux/mfd/tps80031.h
@@ -186,4 +186,6 @@ extern unsigned long tps80031_get_chip_info(struct device *dev);
extern int tps80031_gpadc_conversion(int channle_no);
+extern int tps80031_get_pmu_version(struct device *dev);
+
#endif /*__LINUX_MFD_TPS80031_H */