mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
regulator: core: check whether the regulator is being on at startup
If the regulator is enabled, don't have to enable it again. Signed-off-by: shengfei Xu <xsf@rock-chips.com> Change-Id: I293b9002b6373f977313b410709b0e9ad916243d
This commit is contained in:
@@ -1195,10 +1195,13 @@ static int set_machine_constraints(struct regulator_dev *rdev,
|
||||
* and we have control then make sure it is enabled.
|
||||
*/
|
||||
if (rdev->constraints->always_on || rdev->constraints->boot_on) {
|
||||
ret = _regulator_do_enable(rdev);
|
||||
if (ret < 0 && ret != -EINVAL) {
|
||||
rdev_err(rdev, "failed to enable\n");
|
||||
return ret;
|
||||
/* The regulator may on if it's not switchable or left on */
|
||||
if (!_regulator_is_enabled(rdev)) {
|
||||
ret = _regulator_do_enable(rdev);
|
||||
if (ret < 0 && ret != -EINVAL) {
|
||||
rdev_err(rdev, "failed to enable\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user