diff options
-rw-r--r-- | drivers/regulator/tps6586x-regulator.c | 28 | ||||
-rw-r--r-- | include/linux/mfd/tps6586x.h | 17 |
2 files changed, 44 insertions, 1 deletions
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index 771c171a49f7..4708fe30fca3 100644 --- a/drivers/regulator/tps6586x-regulator.c +++ b/drivers/regulator/tps6586x-regulator.c @@ -370,6 +370,30 @@ static inline int tps6586x_regulator_set_pwm_mode(struct platform_device *pdev) return ret; } +static inline int tps6586x_regulator_set_slew_rate(struct platform_device *pdev) +{ + struct device *parent = pdev->dev.parent; + struct regulator_init_data *p = pdev->dev.platform_data; + struct tps6586x_settings *setting = p->driver_data; + uint8_t reg; + + if (setting == NULL) + return 0; + + /* only SM0 and SM1 can have the slew rate settings */ + switch (pdev->id) { + case TPS6586X_ID_SM_0: + reg = TPS6586X_SM0SL; + break; + case TPS6586X_ID_SM_1: + reg = TPS6586X_SM1SL; + break; + default: + return 0; + } + return tps6586x_write(parent, reg, setting->slew_rate); +} + static inline struct tps6586x_regulator *find_regulator_info(int id) { struct tps6586x_regulator *ri; @@ -412,6 +436,10 @@ static int __devinit tps6586x_regulator_probe(struct platform_device *pdev) platform_set_drvdata(pdev, rdev); + err = tps6586x_regulator_set_slew_rate(pdev); + if (err) + return err; + return tps6586x_regulator_set_pwm_mode(pdev); } diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h index 6d6ddc983f10..e43184a43201 100644 --- a/include/linux/mfd/tps6586x.h +++ b/include/linux/mfd/tps6586x.h @@ -55,12 +55,27 @@ enum { enum pwm_pfm_mode { PWM_ONLY, AUTO_PWM_PFM, - NOT_CONFIGURABLE + PWM_DEFAULT_VALUE, + +}; + +enum slew_rate_settings { + SLEW_RATE_INSTANTLY = 0, + SLEW_RATE_0110UV_PER_SEC = 0x1, + SLEW_RATE_0220UV_PER_SEC = 0x2, + SLEW_RATE_0440UV_PER_SEC = 0x3, + SLEW_RATE_0880UV_PER_SEC = 0x4, + SLEW_RATE_1760UV_PER_SEC = 0x5, + SLEW_RATE_3520UV_PER_SEC = 0x6, + SLEW_RATE_7040UV_PER_SEC = 0x7, + SLEW_RATE_DEFAULT_VALUE, }; struct tps6586x_settings { /* SM0, SM1 and SM2 have PWM-only and auto PWM/PFM mode */ enum pwm_pfm_mode sm_pwm_mode; + /* SM0 and SM1 have slew rate settings */ + enum slew_rate_settings slew_rate; }; enum { |