diff options
author | Javier Martinez Canillas <javier@osg.samsung.com> | 2016-03-23 20:59:34 -0300 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-06-01 16:08:57 -0400 |
commit | db9c6316bb5a33c02bba78b23101e917b012e399 (patch) | |
tree | e93e2c8771e753de1632a821b45fc7f11d2cf375 /drivers/regulator | |
parent | 28c94eff0f24045ff56867196a8a564cc4c5419a (diff) |
regulator: Try to resolve regulators supplies on registration
[ Upstream commit 5e3ca2b349b1e2c80b060b51bbf2af37448fad85 ]
Commit 6261b06de565 ("regulator: Defer lookup of supply to regulator_get")
moved the regulator supplies lookup logic from the regulators registration
to the regulators get time.
Unfortunately, that changed the behavior of the regulator core since now a
parent supply with a child regulator marked as always-on, won't be enabled
unless a client driver attempts to get the child regulator during boot.
This patch tries to resolve the parent supply for the already registered
regulators each time that a new regulator is registered. So the regulators
that have child regulators marked as always on will be enabled regardless
if a driver gets the child regulator or not.
That was the behavior before the mentioned commit, since parent supplies
were looked up at regulator registration time instead of during child get.
Since regulator_resolve_supply() checks for rdev->supply, most of the times
it will be a no-op. Errors aren't checked to keep the possible out of order
dependencies which was the motivation for the mentioned commit.
Also, the supply being available will be enforced on regulator get anyways
in case the resolve fails on regulators registration.
Fixes: 6261b06de565 ("regulator: Defer lookup of supply to regulator_get")
Suggested-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org> # 4.1+
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/core.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 0301750fe282..b352a1fa2f2a 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3592,6 +3592,11 @@ static void rdev_init_debugfs(struct regulator_dev *rdev) &rdev->bypass_count); } +static int regulator_register_resolve_supply(struct device *dev, void *data) +{ + return regulator_resolve_supply(dev_to_rdev(dev)); +} + /** * regulator_register - register regulator * @regulator_desc: regulator to register @@ -3740,6 +3745,10 @@ regulator_register(const struct regulator_desc *regulator_desc, list_add(&rdev->list, ®ulator_list); rdev_init_debugfs(rdev); + + /* try to resolve regulators supply since a new one was registered */ + class_for_each_device(®ulator_class, NULL, NULL, + regulator_register_resolve_supply); out: mutex_unlock(®ulator_list_mutex); kfree(config); |