Re: [PATCH v2 0/2] pinctrl: Allow indicating loss of state across suspend/resume

From: Tony Lindgren
Date: Tue Nov 07 2017 - 20:02:33 EST


* Rafael J. Wysocki <rjw@xxxxxxxxxxxxx> [171108 00:25]:
> On Tuesday, November 7, 2017 5:00:06 PM CET Tony Lindgren wrote:
> > For runtime PM, restoring the state constantly is unnecessary and not
> > good for battery life. The logic can be just:
> >
> > 1. Device driver runtime PM suspend saves the state when needed
> >
> > 2. Device driver runtime PM resume checks if context_lost was set by
> > the bus or power domain code
> >
> > 3. If context was lost, device driver restores the state, or in some
> > cases may need re-run the driver register init related parts
> > to bring the driver back up, then clears the context_lost flag
> >
> > How about something like the following patch? So far only compile
> > tested with CONFIG_PM enabled. If that looks like the way to go,
> > I'll test it properly and add some comments for the functions and
> > post a proper patch :)
>
> Honestly, I'm not sure.
>
> I'd rather have a context_lost flag to start with and see how/if
> drivers will use that before adding any common infra for handling
> this.

Right, I'll provide some use cases but it will be a little while.

Currently it's done in non-generic way at the interconnect code
for my use cases:

$ git grep "\.context_offs = " arch/arm/mach-omap2/*data.c | wc -l
276

It seems that we could have genpd take care of this in a generic
way with the patch I posted.

Regards,

Tony