summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2015-06-11 17:37:03 -0700
committerMark Brown <broonie@kernel.org>2015-06-12 13:05:11 +0100
commit22a10bca280073f81e9e2d9fed6f90a3bcf00236 (patch)
tree2952174336d871fbd47996291c811aac64199295 /drivers/regulator
parentb787f68c36d49bb1d9236f403813641efa74a031 (diff)
downloadlinux-22a10bca280073f81e9e2d9fed6f90a3bcf00236.tar.bz2
regulator: Add system_load constraint
Some regulators have a fixed load that isn't captured by consumers that the kernel knows about. Add a constraint to support this. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c2
-rw-r--r--drivers/regulator/of_regulator.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 443eaab933fc..c8d5e2b05fdf 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -678,6 +678,8 @@ static int drms_uA_update(struct regulator_dev *rdev)
list_for_each_entry(sibling, &rdev->consumer_list, list)
current_uA += sibling->uA_load;
+ current_uA += rdev->constraints->system_load;
+
if (rdev->desc->ops->set_load) {
/* set the optimum mode for our new total regulator load */
err = rdev->desc->ops->set_load(rdev, current_uA);
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 24e812c48d93..482a86f90839 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -95,6 +95,9 @@ static void of_get_regulation_constraints(struct device_node *np,
}
}
+ if (!of_property_read_u32(np, "regulator-system-load", &pval))
+ constraints->system_load = pval;
+
for (i = 0; i < ARRAY_SIZE(regulator_states); i++) {
switch (i) {
case PM_SUSPEND_MEM: