From 22a10bca280073f81e9e2d9fed6f90a3bcf00236 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Thu, 11 Jun 2015 17:37:03 -0700 Subject: 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 Signed-off-by: Mark Brown --- drivers/regulator/core.c | 2 ++ drivers/regulator/of_regulator.c | 3 +++ 2 files changed, 5 insertions(+) (limited to 'drivers/regulator') 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: -- cgit v1.2.3