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>
msm: thermal: Relax temperature thresholds

Relax temperature thresholds, the device is constantly throttling.
Also, use core control to avoid physical damage, not temperature
control.

Conflicts:
	arch/arm/boot/dts/msm8974.dtsi
msm: thermal: Disable vdd restriction

This does not make sense. Additionaly, start temperature monitoring
after booting phase.
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: 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>
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: 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>