msm: acpuclock-krait: Pre-emptively vote for the L2 HFPLL regulators
It is necessary that the L2 level computation and the setting
of the L2 rate happen atomically, so that the computed level
is still valid when the L2 rate is set. A spinlock protected
critical section is needed for these operations. However, the
votes for the HFPLLs necessitate invocation of the RPM
regulator APIs from a non-atomic context.
To solve this, we must first note that the problem only exists
when:
1. The L2 frequency is being switched away from an HFPLL source
to a non-HFPLL source, or
the L2 frequency is being switched away from a non-HFPLL
source to an HFPLL source.
--AND--
2. The CPU frequency switch (the cause of the L2 switch) is
being performed as a result of cpufreq invoking the switch or
hotplug onlining/offlining a core, since HFPLL regulator
voting does not take place in the power-collapse and resume
paths.
The solution is to pre-emptively vote for the L2 HFPLL regulators
if the target CPU frequency's required L2 level is sourced off of
an HFPLL. These votes are only removed after the spinlock
protected critical section completes, and only if the previous
CPU frequency's required L2 level was already sourced off of an
HFPLL source.
One further optimization is to disable only pre-emption, and
not interrupts in the afore-mentioned critical section.
Change-Id: I921ee9def7159d24c841cdd2ee06a6c1bd666ca3
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
1 file changed