From 18e131ef2f547115dd0c90c058917c865167364c Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Mon, 2 Jan 2012 13:08:45 +0530 Subject: regulator: Enable supply regulator if child rail is enabled. During regulator_register, the rail is set on the provided machine constraints and if it is enabled then it is also require to enable the supply regulator. This will make sure that: 1. Proper reference count for supply regulator to be maintain. 2. Supply regulator should be enable when given rail is enabled. Signed-off-by: Laxman Dewangan Signed-off-by: Mark Brown Cherry-picked from linus' mainline: b2296bd43e781976743354c668a356b0df98e1da Signed-off-by: Laxman Dewangan Change-Id: Ibfdcc8e8dc04a109905883239a7f358a1ef9d54d Reviewed-on: http://git-master/r/73176 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Laxman Dewangan Tested-by: Laxman Dewangan --- drivers/regulator/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/regulator/core.c') diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index f3247f7ccefc..79d670c913e2 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2690,6 +2690,14 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, ret = set_supply(rdev, r); if (ret < 0) goto scrub; + + /* Enable supply if rail is enabled */ + if (rdev->desc->ops->is_enabled && + rdev->desc->ops->is_enabled(rdev)) { + ret = regulator_enable(rdev->supply); + if (ret < 0) + goto scrub; + } } /* add consumers devices */ -- cgit v1.2.3