Skip to content

Commit

Permalink
regulator: Enable supply regulator if child rail is enabled.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
ldewangan authored and broonie committed Jan 2, 2012
1 parent 4fef21e commit b2296bd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2802,6 +2802,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 */
Expand Down

0 comments on commit b2296bd

Please sign in to comment.