mako: Enable Krait Retention.

Add SPM sequences to do Krait retention for 8960,8930
and 8064. Also added a new rpmrs level containing the
latencies and power measurements for this new low power
state.

Change-Id: Id7c965dd69da43952aa4d5ec4484b0bc29c2c883
msm: pm: Update spm retention sequence to support per core retention

On krait revision < 3, power driver is not using full spm sequence and
calling into trustzone as a part of executing krait retention.
Also krait retention is not supported on secondary cores.

krait pass3 is upgraded to use full spm sequence, hence add support
for per core retention and avoid calling into trustzone
while executing retention.

CRs-fixed: 437281
Change-Id: I6a2b3d7c4d0fd5b9a340957b16b940b7a09bbd91
Signed-off-by: Anji Jonnala <anjir@codeaurora.org>
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
mako: Update spm retention sequence to support per core retention

Change-Id: I77c49ef2fbc539d6f46ede1a60d49fd0e1a8e0cd
msm: board-8064: Initialize SPM driver earlier than thermal

Thermal driver needs to be able to do core control and force cores to
be offline during certain thermal conditions. SPM driver is needed for
cores to do power collapse.

CRs-Fixed: 460083
Change-Id: Id64fe7529438aad68a515c19317db2b95b8b9b65
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
mako: Initialize SPM driver earlier than thermal

Thermal driver needs to be able to do core control and force cores to
be offline during certain thermal conditions. SPM driver is needed for
cores to do power collapse.

Change-Id: I723fc0aaa284abe8cd691cf0ded764c59de22daa
mako: Fix SPM sequences

Change-Id: I106659d6640895d2c39c005808a037230a5a7411
mako: Add power collapse debug counters support.

Add platform device for PC debug counters. These counter stores the
warmboot entry/exit counters for each core on a non-cacheable always
on IMEM memory. This is a useful feature during debug to understand if
the system has correctly warmbooted after a power collapse.

Usage for core0 debug counters:-
counters at address 0x2A03F664 represent no of times PC attempted.
counters at address 0x2A03F66C represent no of times PC failed.
counters at address 0x2A03F668 represent no of times warm boot happened.
no of PC attemps = PC failures + warm boot entries.

Change-Id: Ib37a0adb9e0d01b83d4c24168c8f90c8810f695a
Revert SPM changes

Revert "mako: Add power collapse debug counters support."

This reverts commit 134dabf16ce710f3d45628b6ead9860568502116.

Revert "mako: Fix SPM sequences"

This reverts commit 47c24d5551c025ea3f0ea6faead5605f4417508b.

Revert "mako: Initialize SPM driver earlier than thermal"

This reverts commit 4f3615d7315bb51bf9a8952b78a5ce99f2a0993b.

Revert "msm: board-8064: Initialize SPM driver earlier than thermal"

This reverts commit e612a31d05ea4bf8924f5af0a9f9e42aec74bf8f.

Revert "mako: Update spm retention sequence to support per core retention"

This reverts commit 9422feb5d54d7aefc4c151ca6c93cfd06fd58ed1.

Revert "msm: pm: Update spm retention sequence to support per core retention"

This reverts commit 590fce53503e46d3d9ba002a71cb259640b1c99d.

Revert "mako: Enable Krait Retention."

This reverts commit bc9742a2ad2857cd827427f412bf94c0bb2cf45d.

Revert "mako: Add support to query cpu status"

This reverts commit f8494838bf99f63e7b8548af2b59fe3d8c067e92.

Revert "msm: pm: Add support to query cpu status"

This reverts commit 1f9269180b8d2f2b8a4eb7527b2fc2b27e4ebf9a.

Revert "msm: pm-data: Enable powercollapse/suspend_enabled for non-boot cpus"

This reverts commit 533b3ffddb7bfb143c22512fd891c1213413cfa5.

Revert "msm: pm: Add support for retention on each core"

This reverts commit faa5907835b303330d8b1fe33775f4e0ca99a61e.

Revert "msm: hotplug: wait for hotplug completion event from secondary core"

This reverts commit 03488d46c6bf03302283faf38941240197522ec8.

msm: spm: set vdd directly for current cpu

In cases where a cpu is setting vdd for itself we need not
call msm_spm_smp_set_vdd through smp_call_function_single.

Without this change when CPU calls for itself when interrupts
are disabled we get following warning

[ 38.407752] ------------[ cut here ]------------
[ 38.407752] WARNING: at kernel/kernel/smp.c:320
smp_call_function_single+0xa8/0x1c8()
[ 38.407752] Modules linked in: adsprpc
[ 38.407752] [<c00149b8>] (unwind_backtrace+0x0/0x11c) from [<c0082afc>]
(warn_slowpath_common+0x4c/0x64)
[ 38.407752] [<c0082afc>] (warn_slowpath_common+0x4c/0x64) from
[<c0082b2c>] (warn_slowpath_null+0x18/0x1c)
[ 38.407752] [<c0082b2c>] (warn_slowpath_null+0x18/0x1c) from
[<c00c510c>] (smp_call_function_single+0xa8/0x1c8)
[ 38.407752] [<c00c510c>] (smp_call_function_single+0xa8/0x1c8) from
[<c0058f6c>] (msm_spm_set_vdd+0x48/0x70)
[ 38.407752] [<c0058f6c>] (msm_spm_set_vdd+0x48/0x70) from [<c0056a98>]
(msm_pm_power_collapse+0x13c/0x334)
[ 38.407752] [<c0056a98>] (msm_pm_power_collapse+0x13c/0x334) from
[<c0057120>] (msm_pm_enter+0x170/0x2dc)
[ 38.407752] [<c0057120>] (msm_pm_enter+0x170/0x2dc) from [<c00b7580>]
(suspend_devices_and_enter+0x1d0/0x334)
[ 38.407752] [<c00b7580>] (suspend_devices_and_enter+0x1d0/0x334) from
[<c00b7800>] (pm_suspend+0x11c/0x1f8)
[ 38.407752] [<c00b7800>] (pm_suspend+0x11c/0x1f8) from [<c00b87a4>]
(suspend+0x68/0x180)
[ 38.407752] [<c00b87a4>] (suspend+0x68/0x180) from [<c009b050>]
(process_one_work+0x280/0x488)
[ 38.407752] [<c009b050>] (process_one_work+0x280/0x488) from
[<c009b46c>] (worker_thread+0x214/0x3b4)
[ 38.407752] [<c009b46c>] (worker_thread+0x214/0x3b4) from [<c009f364>]
(kthread+0x84/0x90)
[ 38.407752] [<c009f364>] (kthread+0x84/0x90) from [<c000f108>]
(kernel_thread_exit+0x0/0x8)
[ 38.407752] ---[ end trace da227214a82491ba ]---

Change-Id: I1aa121f57d74860b6bc8620b40699567e55a9d02
CRs-Fixed: 480408
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>