From: Pascal Paillet
Date: Wed, 13 Nov 2019 10:27:37 +0000 (+0100)
Subject: regulator: core: Let boot-on regulators be powered off
X-Git-Tag: v4.19.226~31
X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dc1b1d7faf616ed663d0bba9be5abb4d1ed35d01;p=thirdparty%2Fkernel%2Fstable.git
regulator: core: Let boot-on regulators be powered off
commit 089b3f61ecfc43ca4ea26d595e1d31ead6de3f7b upstream.
Boot-on regulators are always kept on because their use_count value
is now incremented at boot time and never cleaned.
Only increment count value for alway-on regulators.
regulator_late_cleanup() is now able to power off boot-on regulators
when unused.
Fixes: 05f224ca6693 ("regulator: core: Clean enabling always-on regulators + their supplies")
Signed-off-by: Pascal Paillet
Link: https://lore.kernel.org/r/20191113102737.27831-1-p.paillet@st.com
Signed-off-by: Mark Brown
Acked-by: Andre Kalb
Signed-off-by: Greg Kroah-Hartman
---
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 088ed4ee6d83e..045075cd256ce 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1211,7 +1211,9 @@ static int set_machine_constraints(struct regulator_dev *rdev)
rdev_err(rdev, "failed to enable\n");
return ret;
}
- rdev->use_count++;
+
+ if (rdev->constraints->always_on)
+ rdev->use_count++;
}
print_constraints(rdev);