msm: thermal: Enable hotplug support in kernel

Enable hotplug support in kernel after msm_thermal is disabled.
msm_thermal will register a call back function with tsens driver
for different sensors. When the threshold is reached, tsens will
generate an interrupt and notify hotplug_notify which will then
send out a complete object signal. Create do_hotplug kthread which
waits for the completion object signal, and check the new state
of hotplug mask to decide if cpu will be hotplugged. When hotplug
is done, call sysfs_notify to update cpus_offlined mask.
store_cpus_offlined and store_cc_enabled will also send complete
object siganl to do_hotplug kthread to update cpus_offlined mask.
Whenever user write into cpus_offlined mask through sysfs node,
the vote will be there until user remove the mask. show_cpus_offlined
will return the OR results of KTM and user space vote.

The sensor mapping is provided in device tree.

Retain the core control part of the kernel module that polls the
temperature to decide to offline cores.

CRs-Fixed: 515110
Change-Id: I7f644088ef4d2683c5bf960df10723a628789aa5
Signed-off-by: Jennifer Liu <chihning@codeaurora.org>

Conflicts:
	drivers/thermal/msm_thermal.c
thermal: tsens: Fix calibration mask for 8x26

Fix two point calibration mask for obtaining
offsets.

Change-Id: I851a52c2f208559dba2f1ee52630366a21ab9456
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
msm: thermal: Clean up msm cpufreq function calls

Remove msm_cpufreq_set_freq_limits and register with
CPUFREQ_POLICY_NOTIFIER to get immediate update on cpu frequencies
as long as a cpufreq_update_policy is called. Ensure that when
cpufreq_update_policy is called, cpu will not be hotplugged by
calling get_online_cpus().

Change-Id: I802d51ad1c352a19d2e456f9f6a89f8d5b89aad8
Signed-off-by: Jennifer Liu <chihning@codeaurora.org>

Conflicts:
	drivers/thermal/msm_thermal.c
msm: thermal: Don't initialize hotplug thread when not configured

Do not initialize the hotplug thread if the device tree
entry for hotplug thresholds are missing for a target.

CRs-fixed: 580249
Change-Id: I8ed99a757a2bd66a6a669ad78d7c4fe632b56012
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
Signed-off-by: Anji Jonnala <anjir@codeaurora.org>

Conflicts:
	drivers/thermal/msm_thermal.c
msm: thermal: Add support for emergency frequency mitigation

Add emergency frequency mitigation support to Kernel Thermal
Monitor (KTM). This feature enables KTM to mitigate the
cpu's max frequency when the temperature crosses the preset
threshold.

CRs-Fixed: 538981
Change-Id: I756e82e577b19c18f32b3297aa97fa2942d8b77d
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>

Conflicts:
	drivers/thermal/msm_thermal.c

Conflicts:
	drivers/thermal/msm_thermal.c
msm: thermal: Add support for requesting optimum current for CX rail

Add support for KTM to request for an optimum current value for
CX rail, when the temperature reaches a preset threshold.

During boot-up, KTM monitors the temperature and makes
a request for optimum current.
After boot-up thermal-engine monitors the temperature
and requests for optimum current value through KTM's
sysfs nodes.

CRs-Fixed: 574569
Change-Id: I9fa184e4921f440ef5b5539dc9573527140f2207
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>

Conflicts:
	Documentation/devicetree/bindings/arm/msm/msm_thermal.txt
	drivers/thermal/msm_thermal.c