smp: Fix idle_thread_init() inline stub

idle_thread_init() does not have arguments.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
smpboot: Remove leftover declaration

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
msm: thermal: Relax temperature thresholds

Relax temperature thresholds, the device is constantly throttling.
Also, use core control to avoid physical damage, not temperature
control.
thermal: tsens: Add redundant fuse map support

Add redundant fuse map for 8x10. Redundant fuse
selection is read to check if the tsens
efuse bits are to be read from the redundant region
instead of reading it from the primary region.

Change-Id: Ia57102b991b435e67ba347b385dc190df430d4d6
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
thermal: qpnp-adc-tm: Reduce kernel log flood

Modify the pr_err log that is used for checking if
clients have a valid callback when threshold request
is made to pr_debug. Currently kernel logs are getting
flooded due to periodic request made from the client.

Change-Id: I74bf4115bc25396da16a96ad7378ba3a7375710f
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
msm: thermal: Set vdd restriction initialize level to -1

Currently the init level is set to 0(enabled), but at this point of
time, the actual voltage is not being set yet. If the device boots
up in low temp, it will try to set level to 0(enabled) again. Since
it will check the level against with previous level which is also
0(means enabled), it will not set the actual voltage/frequency for
the rails.

Set the init level to -1(disabled), so that when device defaults to
enable vdd restriction, it will actually set the voltage.

Change-Id: I9997245953c9947889a813901032c3df8c737ad3
Signed-off-by: Jennifer Liu <chihning@codeaurora.org>
thermal: tsens: Fix invalid set temperature check

When setting a temperature value of 0 there is an error
because of an invalid check. Remove this check.

Change-Id: Iefb348aad5e2ebe8a3c6e9b39a25cb6f284abf6d
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
thermal: qpnp-adc-tm: Remove VADC_TM EOC

VADC_TM is used currently only for monitoring high/low
thresholds. Therefore remove registering for end of conversion
interrupts as we do not use this mode on VADC_TM.

Change-Id: Idf4afd23fa12439667f868666515c01eb7acbfad
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
thermal: Add sensor API to allow any driver to set thresholds

Sensor API allow drivers to set min or max thresholds and get
notified when the corresponding sensor crosses these thresholds.
The sensor API, uses the THERMAL_TRIP_CONFIGURABLE_HI and
THERMAL_TRIP_CONFIGURABLE_LOW, to set the threshold. The existing
sysfs interfaces will not be affected by the newly added API.

Change-Id: I85d2ae132fc3b7b6d157faf0a7390e31fdc7e6da
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
thermal: msm: tsens: Notify thermal framework on threshold cross

Notify thermalsys framework and thereby the driver, using the new
sensor api. Notification is done in the interrupt handler context to
the thermal framework.

Change-Id: Ifdb958105d8d0d9d8987a4e64114101ee44047d2
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
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>
thermal: Fix sensor thresholds not accounted correctly

Sensor threshold min and max are calculated to be binding around the
current temp, but they fail if there no thresholds available with the
min < curr_temp and the max > curr_temp.

Fix negative temperatures handling.

Change-Id: Ie4fb5ca2cdaf430b98c3665773a8d55ac9db5359
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
thermal: Add Support for enabling and disabling tsens trip

Add new API to enable or disable the kernel client's trip
threshold request. The enable or disable trip threshold requests
from different kernel clients and userspace client will
activate/deactivate the corresponding clients threshold request.

Modify thermal sys framework to include only the active
thresholds from clients to determine the current trip
thresholds for tsens.

CRs-Fixed: 561775
Change-Id: I5de81b2272de92f19aa79a13d7bdbd58d4012cf3
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
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>
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>
msm: thermal: Add IOCTL interface support to Kernel Thermal Monitor

Kernel Thermal Monitor exposes an IOCTL dev interface, which can
be used for user space cpu frequency mitigation.

CRs-Fixed: 538981
Change-Id: Idb8b836970f7d5d029fea606aaa4f7958c982f68
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
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>
thermal: qpnp-adc-thermal: Add checks for low/high notification

Add checks to ensure the low and high threshold enable
register is checked against the status low and high
register before proceeding to notify the corresponding
clients.

CRs-fixed: 581522
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Change-Id: Iecd5e08642415ca50c244efdeebbacf295f82303

Conflicts:
	drivers/thermal/qpnp-adc-tm.c
thermal: qpnp-adc-tm: Fix format specifier in snprintf

Add format specifier in snprintf to avoid security
vulnerability issues.

CRs-fixed: 562261
Change-Id: I6ea67633348341267e0646912a6b428709410c78
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>

Conflicts:
	drivers/thermal/qpnp-adc-tm.c