ARM: dts: msm: i2c: change  clock rate to 19.2 MHz

For standard  requirement, I2C source
speed of 50MHz causes high power usage, hence
this patch change the clock rate to 19.2 MHz
to save power.

CRs-Fixed: 552956
Change-Id: Ifb17fb79062a390a19881d247a2ac0ca5cc55d80
Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>
msm: pm-8x60: Use generic clk apis during power collapse

The power management code calls in acpuclk code directly to switch to a
always on clock source during power collapse there by turning off the
HFPLL during any power collapse. The Krait clock management is switching
to use clocks ops model. To necessitate the change, the power management
code will register for CPU/L2 clock sources and disables the
corresponding clocks during power collapse.

Add a DT node to indicate if the clock sources are synchronized across
the cores/L2, to prevent querying on clock sources that might not be
available on certain targets. Also, clk_get() doesn't currently support
deferred probe, change the compile order to include pm-8x60 after clocks
driver to ensure that clock drivers get probed before pm-8x60.

Change-Id: I671296064dda93f1d2226e6ae059d827c4c00890
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
msm: cpufreq: Add support for CPU clocks and msm-cpufreq device

Add support for using clock APIs to do CPU/L2 frequency scaling. When clock
APIs are used to control CPU/L2 frequencies, the cpufreq driver must handle
the CPU -> L2 -> DDR bandwidth voting. Use a msm-cpufreq device to provide
the per SoC list of CPU frequencies and their L2/DDR bandwidth mapping
information.

If CPU/L2 clocks are not available, fallback to using acpuclock APIs. We
eventually want to remove the use of non-standard acpuclock APIs.

Signed-off-by: Domenico Marino <johnlemon.lol@gmail.com>

Conflicts:

        arch/arm/mach-msm/cpufreq.c

Change-Id: I0f8a9608d3030d39660e0363f6e86e60b7c4b6e4
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/cpufreq.c
msm: cpufreq: Add msm_cpufreq debugfs file to show CPU -> L2/BW mapping

Example output:
cat /sys/kernel/debug/clk/msm_cpufreq
  CPU (KHz)  L2 (KHz)  Mem (MBps)
     300000    300000         600
     422400    422400        1200
     652800    499200        1600
     729600    576000        2456
     883200    576000        2456
     960000    960000        3680
    1036800   1036800        3680
    1190400   1036800        3680
    1267200   1267200        6400
    1497600   1497600        6400
    1574400   1574400        6400
    1728000   1651200        6400
    1958400   1728000        7448
    2265600   1728000        7448

Change-Id: I20df8c3778c0fcd0ef1f369acb1cb72cf5334812
Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
msm: cpufreq: Remove unused msm_cpufreq_set_freq_limits() API

The msm_cpufreq_set_freq_limits() is a mach specific way to set CPU freq
limits. The thermal code no longer uses this API and instead uses the
standard INCOMPATIBLE notifiers provided by the common CPUfreq framework.
Since this API is no longer needed, delete it.

Change-Id: I5c07b17195d4e4b75cdd4d82f8e7cb6cb6f3e199
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Domenico Marino <johnlemon.lol@gmail.com>

Conflicts:
	arch/arm/mach-msm/cpufreq.c
	drivers/thermal/msm_thermal.c
msm: krait-regulator: force BHS on offlined CPUs at boot

There could be regulator enable calls on offlined CPUs at boot time.
That leads to an issue where the driver calls smp functions on them
to switch ldo/bhs.

Set the force_bhs flags on offlined CPUs at boot to avoid this problem.

Change-Id: I9f5bccc89e59ef2da12670b921b98e02fb078acf
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
msm: krait-regulator: Add flag to disable LDO mode usage

Add a feature which allows to disable using LDO. When enabled, the
core continues to run from BHS possibly seeing a higher input voltage.
This may increase the leakage from the core but will not cause a
brownout.

Change-Id: I793af7a9eeddfd52f5fea9b4c59c774f0272f431
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
msm: krait-regulator: fix the cold boot sequence

One has to turn on BHS regardless of the kpss version. This gets
us to the expected APC_PWR_GATE_CONFIG register prior to enabling
sequencer.

Change-Id: I6c44f3e70b56211dae682c3b2740519f22f53f94
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
msm: krait-regulator: fix up CPU_UP_CANCELED handling

The driver handles CPU_UP_CANCELED as if the core went ONLINE. This
leads to smp call functions on that cpu even when the cpu is offline.
Make CPU_UP_CANCELED force bhs on the target cpu, since it is still
offline.

Change-Id: I668dbfd947d836a1f468d57372e73fbd08dd437e
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
ARM: dts: msm: Add clock-krait and msm-cpufreq device for msm8974

The clock-krait device is a more accurate and detailed representation of
the Krait subsystem clock tree than the acpuclk device. Registering and
probing this device allows the use of standard clock APIs to control CPU/L2
clocks. So, replace the acpuclk device with a clock-krait device.

When exposing the CPU/L2 clock tree through clock APIs, the cpufreq driver
has to handle the L2 and memory BW voting. So, add the msm-cpufreq device
to provide the required data and to avoid breaking cpufreq functionality.

To make sure the switchover doesn't break power management code, also set
the PM device flag that indicates cpu clocks are controlled through
standard clock APIs.

Also update clock 8974 lookup table for clock-krait device.

Conflicts:

	arch/arm/boot/dts/msm8974pro-ac.dtsi
	arch/arm/boot/dts/msm8974pro.dtsi

Change-Id: I8b563199ffcca717603e98a9878314ff34fba7f7
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>

Conflicts:
	arch/arm/boot/dts/msm8974-v1-pm.dtsi
	arch/arm/boot/dts/msm8974pro-pma8084.dtsi
	arch/arm/boot/dts/msm8974pro.dtsi
	arch/arm/mach-msm/clock-8974.c
Revert "ARM: dts: msm: Add clock-krait and msm-cpufreq device for msm8974"

This reverts commit f3d1f39c4bb17f020e77425f2dc3ff8d1ad5457e.
Fix cherry pick derps

Signed-off-by: Domenico Marino <johnlemon.lol@gmail.com>
msm: clock-8974: Add an active-only GPLL0 clock

The clock-krait driver will require an active-only GPLL0
clock to select as a source for the CPU clock(s). Add this
clock.

Change-Id: I7daf4a71343703e31eb0d4534089ebba37755900
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>