diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2016-03-02 05:54:46 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-03-02 09:31:45 -0500 |
commit | 909f7ee0b5f30f735e16864a7ed18d2e6123e6d9 (patch) | |
tree | d1a5c7de386afc4c23409df2dd2a3c0b505f4947 | |
parent | 07a06694cb591592842b608dd3ada839503f1134 (diff) |
regulator: core: Add support for active-discharge configuration
Add support to enable/disable active discharge of regulator via
machine constraints. This configuration is done when setting
machine constraint during regulator register and if regulator
driver implemented the callback ops.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/regulator/core.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 7ebb7c899158..5b1e049a5930 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -1151,6 +1151,17 @@ static int set_machine_constraints(struct regulator_dev *rdev, | |||
1151 | } | 1151 | } |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | if (rdev->constraints->active_discharge && ops->set_active_discharge) { | ||
1155 | bool ad_state = (rdev->constraints->active_discharge == | ||
1156 | REGULATOR_ACTIVE_DISCHARGE_ENABLE) ? true : false; | ||
1157 | |||
1158 | ret = ops->set_active_discharge(rdev, ad_state); | ||
1159 | if (ret < 0) { | ||
1160 | rdev_err(rdev, "failed to set active discharge\n"); | ||
1161 | return ret; | ||
1162 | } | ||
1163 | } | ||
1164 | |||
1154 | print_constraints(rdev); | 1165 | print_constraints(rdev); |
1155 | return 0; | 1166 | return 0; |
1156 | out: | 1167 | out: |