summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2011-07-25 18:08:15 +0530
committerVarun Colbert <vcolbert@nvidia.com>2011-07-27 11:27:26 -0700
commit210bbd8cf483d4797a32c1b2a2b21b7782d846ed (patch)
tree1d2ca25c9be49079fffb81dadb20f045df7a79d3
parent8e361c80f5a3262b530b47c364d8e712d07efaba (diff)
regulator: tps6591x: Clear external control setting in shutdown
Clearing the external control configuartion in shutdown on the regulator. bug 839572 Change-Id: I2362c6decb7209aa5f5667de48315ef0bc8926a2 Reviewed-on: http://git-master/r/43048 Tested-by: Vivek Kumar <vivekk@nvidia.com> Reviewed-by: Kaushik Sen <ksen@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com>
-rw-r--r--drivers/regulator/tps6591x-regulator.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/regulator/tps6591x-regulator.c b/drivers/regulator/tps6591x-regulator.c
index 2fff27aa8a33..8758211dadb6 100644
--- a/drivers/regulator/tps6591x-regulator.c
+++ b/drivers/regulator/tps6591x-regulator.c
@@ -86,6 +86,7 @@ struct tps6591x_regulator {
int *voltages;
int delay; /* delay in us for regulator to stabilize */
+ enum tps6591x_ext_control ectrl;
};
static inline struct device *to_tps6591x_dev(struct regulator_dev *rdev)
@@ -731,6 +732,7 @@ static int __devinit tps6591x_regulator_probe(struct platform_device *pdev)
return -EINVAL;
}
tps_pdata = pdev->dev.platform_data;
+ ri->ectrl = tps_pdata->ectrl;
err = tps6591x_regulator_preinit(pdev->dev.parent, ri, tps_pdata);
if (err)
@@ -757,6 +759,21 @@ static int __devexit tps6591x_regulator_remove(struct platform_device *pdev)
return 0;
}
+static void tps6591x_regulator_shutdown(struct platform_device *pdev)
+{
+ struct regulator_dev *rdev = platform_get_drvdata(pdev);
+ struct tps6591x_regulator *ri = rdev_get_drvdata(rdev);
+ struct device *parent = to_tps6591x_dev(rdev);
+ int ret;
+
+ if (ri->ectrl == EXT_CTRL_EN1) {
+ ret = tps6591x_clr_bits(parent, ri->en1_reg.addr,
+ (1 << ri->en1_reg.shift_bits));
+ if (ret < 0)
+ dev_err(&pdev->dev, "Error in clearing external control\n");
+ }
+}
+
static struct platform_driver tps6591x_regulator_driver = {
.driver = {
.name = "tps6591x-regulator",
@@ -764,6 +781,7 @@ static struct platform_driver tps6591x_regulator_driver = {
},
.probe = tps6591x_regulator_probe,
.remove = __devexit_p(tps6591x_regulator_remove),
+ .shutdown = tps6591x_regulator_shutdown,
};
static int __init tps6591x_regulator_init(void)