]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
regulator: core: Let boot-on regulators be powered off
authorPascal Paillet <p.paillet@st.com>
Wed, 13 Nov 2019 10:27:37 +0000 (11:27 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 05:04:26 +0000 (00:04 -0500)
BugLink: https://bugs.launchpad.net/bugs/1860490
[ Upstream commit 089b3f61ecfc43ca4ea26d595e1d31ead6de3f7b ]

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 <p.paillet@st.com>
Link: https://lore.kernel.org/r/20191113102737.27831-1-p.paillet@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/regulator/core.c

index b06535e57a8be6e6897b841a098e837a5fa7dcbb..5842b2f42b8efca28976398ac6ab8c140d9162c3 100644 (file)
@@ -1397,7 +1397,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);