Hello!
On 12/19/2016 08:11 PM, Geert Uytterhoeven wrote:
One quirk needed for WoL is that the module clock needs to be prevented
from being switched off by Runtime PM. To keep the clock alive the
I tried to find the code in question and failed, getting muddled in the
RPM maze. Could you point at this code for my education? :-)
In my investigation I observed this (simplified) call graph with regards
to clocks for suspend:
pm_suspend
There's a long list of the calls skipped here. :-)
pm_clk_suspend
clk_disable
clk_core_disable
cpg_mstp_clock_disable
The interesting function here are clk_core_disable(). In that function a
'enable_count' for each clock is decremented and the clock is only
turned of if the count reaches zero, hence cpg_mstp_clock_disable() are
only called if the counter reaches 0. At runtime the enable_count can be
displayed by examining /sys/kernel/debug/clk/clk_summary.
Well, this is not new to me... it's more interesting how we get there... :-)
[...]
usage count of the clock. Then when Runtime PM decreases the clock usage
count it won't reach 0 and be switched off.
You mean it does this even though we don't call pr_runtime_put_sync()
as done in sh_eth_close()?
Yes.
I had a look at the pm_runtime_* functions in include/linux/pm_runtime.h
and drivers/base/power/runtime.c and could not find any clock handling.
Maybe they only deal with power domains?
There should be a generic way to prevent a device from being suspended.
Indeed.
This will make sure the module clock is not disabled, and the power domain
(if applicable) is not powered down.
I've just bumped into <linux/pm_wakeirq.h>, it looks promising...
[...]
Gr{oetje,eeting}s,
Geert
MBR, Sergei