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: I7b01f274f773ce513300ed3e4b074bae63e84c64
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
diff --git a/arch/arm/mach-msm/acpuclock-krait.h b/arch/arm/mach-msm/acpuclock-krait.h
index 4b6834d..4db95b3 100644
--- a/arch/arm/mach-msm/acpuclock-krait.h
+++ b/arch/arm/mach-msm/acpuclock-krait.h
@@ -39,6 +39,7 @@
PLL_0 = 0,
HFPLL,
PLL_8,
+ NUM_SRC_ID,
};
/**