Re: [RFC][PATCH 2/3] PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarily

Kevin Hilman
2014-05-15T17:35:51Z

Alan Stern <stern@rowland.harvard.edu> writes:

> On Tue, 13 May 2014, Rafael J. Wysocki wrote:
>
>> > A wakeup request from the hardware could cause a runtime resume to
>> > occur at this time. The barrier wouldn't prevent that.
>> >
>> > It's unlikely, I agree, but not impossible.
>>
>> Yeah, I didn't think about that.
>
> Come to think of it, if the hardware sends a wakeup request then it
> must have been enabled for remote wakeup. And if the hardware settings
> are appropriate for system suspend then it must be enabled for system
> wakeup. Consequently a wakeup from the hardware ought to abort the
> system suspend in any case. So maybe we don't care about this
> scenario.
>
> On the other hand, there may be other mechanisms that could cause a
> runtime resume at this inconvenient time. A timer routine, for
> instance.

Another common case is when device X depends on device Y in it's
->prepare or ->suspend path (e.g. need to write to an I2C connected
GPIO/PMIC) in which case, device Y (and the I2C bus) would be runtime
resumed during device X's ->prepare or ->suspend path, and possibly
after device Y (or the I2C busses) ->prepare and ->suspend.

Kevin