Re: [RFC PATCH] PM / Runtime: runtime: Add sysfs option for forcing runtime suspend
From: Alan Stern <stern@rowland.harvard.edu>
Date: 2015-09-26 15:20:52
Also in:
linux-pm, lkml
From: Alan Stern <stern@rowland.harvard.edu>
Date: 2015-09-26 15:20:52
Also in:
linux-pm, lkml
On Sat, 26 Sep 2015, Rafael J. Wysocki wrote:
quoted
quoted
So something like: echo on >/sys/.../power/control (in case the device was already in runtime suspend with wakeups enabled) echo off >/sys/.../power/wakeup echo auto >/sys/.../power/control
Cases where the driver wants to avoid runtime suspend (while the device is active) because of bad wakeup support in the hardware can be handled easily enough. The runtime-idle or runtime-suspend callback routine can check whether wakeup == off; if it isn't then the callback should return -EBUSY. Thus the driver can prevent runtime suspend without any need to increment the usage counter.
quoted
That, or there may be an additional value, say "aggressive", to write to the control file in which case it becomes just echo aggressive >/sys/.../power/controlThat said I suppose that the "off" value for the "wakeup" file might also be useful in some other cases, so it likely is a better approach.
We still need some sort of "inhibit" callback for cases where the driver doesn't want to go into runtime suspend but does want to turn off all I/O. Should this callback be triggered when the user writes "off" to power/wakeup, or when the user writes "inhibit" to power/control, or should there be a separate sysfs attribute? Alan Stern