aboutsummaryrefslogtreecommitdiff
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2015-07-17 14:41:54 -0700
committerMark Brown <broonie@kernel.org>2015-07-24 18:28:46 +0100
commit3a003baeec246f604ed1d2e0087560d7f15edcc6 (patch)
tree6b9e16f35e605a1b23386be578df569b599e978b /drivers/regulator/core.c
parentbc0195aad0daa2ad5b0d76cce22b167bc3435590 (diff)
regulator: Add over current protection (OCP) support
Some regulators can automatically shut down when they detect an over current event. Add an op (set_over_current_protection) and a DT property + constraint to support this capability. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index c9f72019bd68..520413e2bca0 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1081,6 +1081,15 @@ static int set_machine_constraints(struct regulator_dev *rdev,
}
}
+ if (rdev->constraints->over_current_protection
+ && ops->set_over_current_protection) {
+ ret = ops->set_over_current_protection(rdev);
+ if (ret < 0) {
+ rdev_err(rdev, "failed to set over current protection\n");
+ goto out;
+ }
+ }
+
print_constraints(rdev);
return 0;
out: