RE: [PATCH/RFC v4 1/4] regulator: core: add prepare and resume_early

Yoshihiro Shimoda
2020-06-29T02:12:34Z

Hi Mark,

> From: Mark Brown, Sent: Friday, June 26, 2020 11:30 PM
>
> On Fri, Jun 26, 2020 at 06:32:19PM +0900, Yoshihiro Shimoda wrote:
>
> > The regulator-fixed driver is possible to be off by firmware
> > like PSCI while the system is suspended. If a consumer could get
> > such a condition from regulator_is_enabled(), it's useful by
> > consumers.
>
> > The regulator subsystem already has regulator-state-(standby|mem|disk)
> > sub-nodes and regulator-off-in-suspend property. However,
> > suitable regulator_ops APIs didn't exist.
>
> > So, add new regulator_ops APIs and prepare()/resume_early() in
> > the regulator_pm_ops to set/clear the condition by new APIs before
> > suspend() functions of consumers are called.
>
> I can't follow this explanation at all, I really can't understand what
> these functions are supposed to do or how they are supposed to be used.
> Nothing in the rest of this series is at all enlightening either. It
> seems there is some need for a consumer to query things about the
> suspend state but there is no obvious connection from that to adding
> these new operations for regulator drivers.

I'm very sorry for lack description... Perhaps I should have described
one of use cases like below.

regulator_prepare()
--> call regulator_ops.set_prepare_disable() if DISABLE_IN_SUSPEND
--> A regulator can be disabled by the operation.
--> We can guarantee an order which is called before a consumer if
it uses dev_pm_ops.suspend().
..
A consumer driver's suspend().
--> call regulator_is_enabled()
--> If the regulator was called set_prepare_disable(), this can returns false.

Best regards,
Yoshihiro Shimoda