summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/regulator/tps65090-regulator.c23
-rw-r--r--include/linux/mfd/tps65090.h8
-rw-r--r--include/linux/regulator/tps65090-regulator.h7
3 files changed, 38 insertions, 0 deletions
diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c
index 4d28dc1e73c4..003024091aa4 100644
--- a/drivers/regulator/tps65090-regulator.c
+++ b/drivers/regulator/tps65090-regulator.c
@@ -45,6 +45,7 @@ struct tps65090_regulator {
bool enable_ext_control;
int gpio;
int gpio_state;
+ int wait_timeout_us;
};
static inline struct device *to_tps65090_dev(struct regulator_dev *rdev)
@@ -97,6 +98,27 @@ static int tps65090_reg_enable(struct regulator_dev *rdev)
return 0;
}
+ /* Setup wait_time for current limited timeout, WTFET[1:0]@bits[3:2] */
+ if (ri->wait_timeout_us > 0) {
+ int wait_timeout = ri->wait_timeout_us;
+ u8 en_reg = ri->rinfo->reg_en_reg;
+
+ if (wait_timeout <= 200)
+ ret = tps65090_update_bits(parent, en_reg, 0xc, 0x0);
+ else if (wait_timeout <= 800)
+ ret = tps65090_update_bits(parent, en_reg, 0xc, 0x4);
+ else if (wait_timeout <= 1600)
+ ret = tps65090_update_bits(parent, en_reg, 0xc, 0x8);
+ else
+ ret = tps65090_update_bits(parent, en_reg, 0xc, 0xc);
+
+ if (ret < 0) {
+ dev_err(&rdev->dev, "Error updating reg 0x%x WTFET\n",
+ en_reg);
+ return ret;
+ }
+ }
+
ret = tps65090_set_bits(parent, ri->rinfo->reg_en_reg,
ri->rinfo->en_bit);
if (ret < 0)
@@ -289,6 +311,7 @@ static int __devinit tps65090_regulator_probe(struct platform_device *pdev)
ri = &pmic[num];
ri->dev = &pdev->dev;
ri->rinfo = rinfo;
+ ri->wait_timeout_us = tps_pdata->wait_timeout_us;
if (is_dcdc(id)) {
ret = tps65090_regulator_preinit(id, ri, tps_pdata);
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
index 61352eacda2e..ec0d7dce9453 100644
--- a/include/linux/mfd/tps65090.h
+++ b/include/linux/mfd/tps65090.h
@@ -108,4 +108,12 @@ static inline int tps65090_clr_bits(struct device *dev, int reg,
return regmap_update_bits(tps->rmap, reg, BIT(bit_num), 0u);
}
+static inline int tps65090_update_bits(struct device *dev, int reg,
+ uint8_t bit_mask, uint8_t val)
+{
+ struct tps65090 *tps = dev_get_drvdata(dev);
+
+ return regmap_update_bits(tps->rmap, reg, bit_mask, val);
+}
+
#endif /*__LINUX_MFD_TPS65090_H */
diff --git a/include/linux/regulator/tps65090-regulator.h b/include/linux/regulator/tps65090-regulator.h
index 785ca84efa8b..e8a94f36ebd7 100644
--- a/include/linux/regulator/tps65090-regulator.h
+++ b/include/linux/regulator/tps65090-regulator.h
@@ -1,3 +1,4 @@
+
/*
* Regulator driver interface for TI TPS65090 PMIC family
*
@@ -47,6 +48,11 @@ enum {
* DCDC1, DCDC2 and DCDC3.
* @gpio: Gpio number if external control is enabled and controlled through
* gpio.
+ * @wait_timeout_us: wait timeout in microseconds;
+ * >0 : specify minimum wait timeout in us for FETx, will update WTFET[1:0]
+ * in FETx_CTRL reg;
+ * 0 : not to update WTFET[1:0] in FETx_CTRL reg for FETx;
+ * -1 : for non-FETx.
*/
struct tps65090_regulator_platform_data {
@@ -54,6 +60,7 @@ struct tps65090_regulator_platform_data {
bool enable_ext_control;
int gpio;
struct regulator_init_data *reg_init_data;
+ int wait_timeout_us;
};
#endif /* __REGULATOR_TPS65090_H */