diff options
author | Xin Xie <xxie@nvidia.com> | 2011-08-09 06:47:50 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-08-28 12:41:28 -0400 |
commit | 500c524aad173864a58e128d0be9713fa5846471 (patch) | |
tree | 7ff51b0c7489b0f13422f27784678008e831ac26 /drivers/regulator/tps6586x-regulator.c | |
parent | fc999b83799074832367d3cfd724c341c849a7da (diff) |
regulator: tps6586x: add SMx slew rate setting
Add output vlotage slew rate setting for SM0/SM1
Signed-off-by: Xin Xie <xxie@nvidia.com>
Signed-off-by: Danny Huang <dahuang@nvidia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator/tps6586x-regulator.c')
-rw-r--r-- | drivers/regulator/tps6586x-regulator.c | 32 |
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, | |||
332 | 1 << ri->enable_bit[1]); | 332 | 1 << ri->enable_bit[1]); |
333 | } | 333 | } |
334 | 334 | ||
335 | static int tps6586x_regulator_set_slew_rate(struct platform_device *pdev) | ||
336 | { | ||
337 | struct device *parent = pdev->dev.parent; | ||
338 | struct regulator_init_data *p = pdev->dev.platform_data; | ||
339 | struct tps6586x_settings *setting = p->driver_data; | ||
340 | uint8_t reg; | ||
341 | |||
342 | if (setting == NULL) | ||
343 | return 0; | ||
344 | |||
345 | if (!(setting->slew_rate & TPS6586X_SLEW_RATE_SET)) | ||
346 | return 0; | ||
347 | |||
348 | /* only SM0 and SM1 can have the slew rate settings */ | ||
349 | switch (pdev->id) { | ||
350 | case TPS6586X_ID_SM_0: | ||
351 | reg = TPS6586X_SM0SL; | ||
352 | break; | ||
353 | case TPS6586X_ID_SM_1: | ||
354 | reg = TPS6586X_SM1SL; | ||
355 | break; | ||
356 | default: | ||
357 | dev_warn(&pdev->dev, "Only SM0/SM1 can set slew rate\n"); | ||
358 | return -EINVAL; | ||
359 | } | ||
360 | |||
361 | return tps6586x_write(parent, reg, | ||
362 | setting->slew_rate & TPS6586X_SLEW_RATE_MASK); | ||
363 | } | ||
364 | |||
335 | static inline struct tps6586x_regulator *find_regulator_info(int id) | 365 | static inline struct tps6586x_regulator *find_regulator_info(int id) |
336 | { | 366 | { |
337 | struct tps6586x_regulator *ri; | 367 | struct tps6586x_regulator *ri; |
@@ -374,7 +404,7 @@ static int __devinit tps6586x_regulator_probe(struct platform_device *pdev) | |||
374 | 404 | ||
375 | platform_set_drvdata(pdev, rdev); | 405 | platform_set_drvdata(pdev, rdev); |
376 | 406 | ||
377 | return 0; | 407 | return tps6586x_regulator_set_slew_rate(pdev); |
378 | } | 408 | } |
379 | 409 | ||
380 | static int __devexit tps6586x_regulator_remove(struct platform_device *pdev) | 410 | static int __devexit tps6586x_regulator_remove(struct platform_device *pdev) |