diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2012-01-02 02:38:45 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-02 06:36:02 -0500 |
commit | b2296bd43e781976743354c668a356b0df98e1da (patch) | |
tree | 2f440014a55bc7b10205b0c18644a516db79f41d /drivers/regulator | |
parent | 4fef21eaacb9d739f0120c930c78dac4f6875b9f (diff) |
regulator: Enable supply regulator if child rail is enabled.
During regulator_register, the rail is set on the provided
machine constraints and if it is enabled then it is also
require to enable the supply regulator. This will make sure
that:
1. Proper reference count for supply regulator to be maintain.
2. Supply regulator should be enable when given rail is enabled.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/core.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e70e15c4aa28..eb750a1ed7fe 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -2802,6 +2802,14 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | |||
2802 | ret = set_supply(rdev, r); | 2802 | ret = set_supply(rdev, r); |
2803 | if (ret < 0) | 2803 | if (ret < 0) |
2804 | goto scrub; | 2804 | goto scrub; |
2805 | |||
2806 | /* Enable supply if rail is enabled */ | ||
2807 | if (rdev->desc->ops->is_enabled && | ||
2808 | rdev->desc->ops->is_enabled(rdev)) { | ||
2809 | ret = regulator_enable(rdev->supply); | ||
2810 | if (ret < 0) | ||
2811 | goto scrub; | ||
2812 | } | ||
2805 | } | 2813 | } |
2806 | 2814 | ||
2807 | /* add consumers devices */ | 2815 | /* add consumers devices */ |