]> Git Repo - linux.git/commitdiff
regulator: core: Respect off_on_delay at startup
authorVincent Whitchurch <[email protected]>
Thu, 22 Apr 2021 08:30:44 +0000 (10:30 +0200)
committerMark Brown <[email protected]>
Thu, 22 Apr 2021 15:27:34 +0000 (16:27 +0100)
We currently do not respect off_on_delay the first time we turn on a
regulator.  This is problematic since the regulator could have been
turned off by the bootloader, or it could it have been turned off during
the probe of the regulator driver (such as when regulator-fixed requests
the enable GPIO), either of which could potentially have happened less
than off_on_delay microseconds ago before the first time a client
requests for the regulator to be turned on.

We can't know exactly when the regulator was turned off, but initialise
off_on_delay to the current time when registering the regulator, so that
we guarantee that we respect the off_on_delay in all cases.

Signed-off-by: Vincent Whitchurch <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
drivers/regulator/core.c

index 16114aea099a288a405f3fa3a69c91daf1041c52..d6219cb8bd29f75905f2ca4962c21206f0b3cf28 100644 (file)
@@ -1439,6 +1439,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)
 
                if (rdev->constraints->always_on)
                        rdev->use_count++;
+       } else if (rdev->desc->off_on_delay) {
+               rdev->last_off_jiffy = jiffies;
        }
 
        print_constraints(rdev);
This page took 0.065554 seconds and 4 git commands to generate.