summaryrefslogtreecommitdiff
path: root/drivers/regulator/tps6586x-regulator.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2011-11-04 07:32:20 +0400
committerGrant Likely <grant.likely@secretlab.ca>2011-11-04 07:32:20 +0400
commit3983138c017b6aeab6ce3dbb1e9afbe80bdac496 (patch)
tree9fdcddfdb8ada91504c90e2551ba6a565ade7325 /drivers/regulator/tps6586x-regulator.c
parented5f886d16369fed5a69d96b8e85777c47206de1 (diff)
parent02aac316abf436a7529d46a71f7083f9f9ef4b49 (diff)
downloadlinux-3983138c017b6aeab6ce3dbb1e9afbe80bdac496.tar.xz
Merge branch 'for-grant' of git://sources.calxeda.com/kernel/linux into devicetree/merge
Diffstat (limited to 'drivers/regulator/tps6586x-regulator.c')
-rw-r--r--drivers/regulator/tps6586x-regulator.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index bb04a75a4c98..dbcf09d5080c 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -332,6 +332,36 @@ static inline int tps6586x_regulator_preinit(struct device *parent,
1 << ri->enable_bit[1]);
}
+static 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;
+
+ if (!(setting->slew_rate & TPS6586X_SLEW_RATE_SET))
+ 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:
+ dev_warn(&pdev->dev, "Only SM0/SM1 can set slew rate\n");
+ return -EINVAL;
+ }
+
+ return tps6586x_write(parent, reg,
+ setting->slew_rate & TPS6586X_SLEW_RATE_MASK);
+}
+
static inline struct tps6586x_regulator *find_regulator_info(int id)
{
struct tps6586x_regulator *ri;
@@ -374,7 +404,7 @@ static int __devinit tps6586x_regulator_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, rdev);
- return 0;
+ return tps6586x_regulator_set_slew_rate(pdev);
}
static int __devexit tps6586x_regulator_remove(struct platform_device *pdev)