summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorXin Xie <xxie@nvidia.com>2011-04-25 17:36:15 -0700
committerVarun Colbert <vcolbert@nvidia.com>2011-07-21 15:07:27 -0700
commit89f82d3c1d06f1952b281516edad965f16297121 (patch)
tree667cc4e3580d1f80cec1cb6d098a25f890c12d2a /drivers/regulator
parentf3d6b91a116310f074619ff40faf69ee074f9b29 (diff)
regulator: tps6586x: add SMx slew rate setting
bug 815933 Change-Id: I3b8f8910b12ff4f8a5f9588615bd0bb6452bdc3b Reviewed-on: http://git-master/r/40263 Reviewed-by: Xin Xie <xxie@nvidia.com> Tested-by: Xin Xie <xxie@nvidia.com> Reviewed-by: Jonathan Mayo <jmayo@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/tps6586x-regulator.c28
1 files changed, 28 insertions, 0 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);
}