msm: acpuclock-krait: Support alternate PVS and speed bin format

msm8974 and future targets use a different eFuse register layout
than targets from previous SoC generations. Instead of hard-coding
acpuclock-krait to assume the old format, allow the format to
be decided on a per-SoC basis via function pointer assignments.

Two formats are currently supported:
 - "Format A", used for 8974
 - "Format B", used for older Krait-based targets

Change-Id: Id9e8a6c83e3003f2b19ac56bb7aee5dc6b1d00cf
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm: acpuclock-krait: Add support for HFPLL lock detect bit polling

Some recent devices have a lock detect bit that can be used to
determine when the HFPLL frequency has stabilized. Add optional
support for polling this bit instead of delaying pessimistically
for 60us.

Change-Id: I38bb0c98e36f66fc5efadf9189dbe817f648a972
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm: acpuclock-krait: Add __init markings to 'krait vmin' functions

These functions are only called during boot and can be safely
discarded after.

Change-Id: I6bf20a42fec8b82c3f35e1c042b799ef2dad7790
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm: acpuclock-krait: Only print supported number of frequencies once

The current code prints the number of CPU frequencies supported
once for each possible CPU, even though the number of supported
frequencies is the same for each CPU. Cut down on log noise by
printing this number only once.

For example, print:

  [ 0.412932] acpuclk-8974 qcom,acpuclk.23: CPU Frequencies Supported:
11

...instead of:

  [ 0.426013] acpuclk-8974 qcom,acpuclk.23: CPU0: 11 frequencies
supported
  [ 0.426052] acpuclk-8974 qcom,acpuclk.23: CPU1: 11 frequencies
supported
  [ 0.426089] acpuclk-8974 qcom,acpuclk.23: CPU2: 11 frequencies
supported
  [ 0.426124] acpuclk-8974 qcom,acpuclk.23: CPU3: 11 frequencies
supported

Change-Id: Iaf15970e6cfcfaec79c0edf8564cab9141fbc05f
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm: saw-regulator: Support enable and disable

Enable and disable callbacks are added as an optimization so that
we don't update voltages when the regulator is disabled. The use
case for this is a call sequence during CPU Hotplug like so:

Down:

regulator_disable()
regulator_set_voltage(0)

Up:

regulator_set_voltage(original_voltage)
regulator_enable()

Since the SPM actually enables and disables the regulator when
executing a WFI, we want these calls to actually amount to NOPs.
The calls must exist for consistency with other regulator
implementations that do mandate this sequence.

In order to support this sequence, regulator_disable() will simply
set the device to 'offline'. When a regulator is offline, then
calls to regulator_set_voltage() do not actually adjust the
voltage through the SPM; they simply cache the value that was
specified. Then, during regulator_enable, iff the voltage value
corresponding to the last regulator_set_voltage differs from the
value actually programmed in hardware do we reprogram the
hardware.

These rules support the call sequence above since the last value
written to hardware will occur with the regulator enabled by
acpuclock. When executing Hotplug Down, the
set_voltage(0) call does not take effect since the regulator has
been explicitly disabled. In the Hotplug Up case, the set_voltage
case is also cached since the regulator remains disabled. The
value set by the client here should be equal to the value
previously set in hardware (eg. restore). Lastly, the
regulaor_enable() callback sees that the value are the same, and
therefore does not update hardware.

Change-Id: I071a25e6d0c30e378c5dcddcdd9ae26fe02da04a
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
msm: acpuclock-krait: Use standard regulator APIs during CPU Hotplug

Voltage regulators supplying CPU cores need to be properly
notified when their underlying core goes offline. Use
regulator_disable() / regulator_enable() during this case to
notify them. Also make calls to regulator_set_voltage to
complement the regulator_disable call, since in the regulator
framework voltages are orthogonal to enable / disable.

This solves a problem on msm8974 where the ganged regulator
voltage is left higher than necessary when offlining CPU cores.

CRs-fixed: 410992
Change-Id: I1e569924133d98e75343d8b4ff24901dd2951de7
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
msm: acpuclock-krait: Enable HFPLL for init only if switching to it

The existing code left the HFPLL enabled in hfpll_init(), even if
the CPU was detected to be at a non-HFPLL rate. Correct this for
power savings between when hfpll_init() and the first runtime CPU
frequency switch happen. This also ensure votes for HFPLL
regulators are not left unnecessarily asserted.

Change-Id: Iaca5dc7e4769bdbd494d669726ba9b500256f793
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>