thermal: tsens: Add platform information for 9615

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
thermal: msm8960: Check for SOC version

8960 TSENS is not supported on V1 version. Enable it only
for V2 version.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
thermal: tsens: Add support for MDM9615

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
thermal: tsens: Use Calibration offset data from QFPROM

Current code uses default calibration offset value. Switch
over to using Calibrated offset value read from the QFPROM
to calculate the slope and offset and compensate it with the
temperature read from TSENS.

Change-Id: Ifa839f284acb7d5bba07ff46d986eeebd2132dd2
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
thermal: tsens8960: Fix setting initial return value

Set initial value for rc in calib sensors routine.

Change-Id: Id75d1fd094f33597a9693f2ea10fcd96116bb9d0
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
thermal: msm8960_tsens: Fix reading the correct sensor4 address

Fix reading from the correct QFPROM sensor4 address for offset
value to calculate calibration.

Change-Id: I6b044a078b3b8f88802367044d773534ae679e05
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
thermal: tsens: Add tsens notify callback

TSENS driver does not handle the decision to shut down
the device on critical temperature events. The thermal
daemon is notified to take appropriate action.

The thermal sys framework expects the kernel driver to
handle critical events. If the kernel driver does not
have any provision to handle such events the thermal
sys takes action to shutdown the device. Adding the
notify api is to avoid such an action from the thermal sys.

Change-Id: I4bdddb5db040246df40389d3a487a22e66b0820f
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
thermal: msm8960_tsens: Read TSENS temperature

Add kernel API to read TSENS temperature for clients
in the kernel space. Currently the TSENS driver only
supports reading the TSENS temperature from the
thermal sys.

Split the TSENS initialization into two parts.
First is to perform the initial calibration that is
used to convert the raw ADC code to Degrees Celcius
and initialize the TSENS HW. Second is to register the
TSENS driver to the linux thermal framework and create
the temperature zones that will be accessed by the
Thermal daemon to set thresholds, read the temperature
and receive notifications.

Change-Id: Id2305a7aa755e1e9cfaecd8b5c1870ed05d9b5e9
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
cmdline_khz: cpufreq: modify the thermald hack
driver/thermal: create kernel MSM thermal management for MSM8x60 SOC
thermal: Don't limit CPU frequency after msm_thermal is disabled

There may be an outstanding task to check for threshold crossing
when msm_thermal is disabled and CPU is restored to maximum
frequency. This task can get scheduled after the maximum frequency
is restored, and result in another mitigation that pins CPU
frequencies to 918mHz. This happens in the case that the final
temperature was still above the max temperature threshold.
This patch ensures any outstanding tasks are cancelled and flushed
before finally restoring the CPU frequencies.

CRs-fixed: 351614
Change-Id: Ifce00b379989b78856803ac09c7403207f5c998b
Signed-off-by: Eugene Seah <eseah@codeaurora.org>
thermal: make debug message more meaningful and useful

also print CPU temperature reading ~20 sec interval
board: pyramid - there are 6 thermal zones, not 5
msm_thermal: 3-phase thermal throttling

This introduces 3-phase thermal throttling to the existing
msm_thermal driver (it now works more like thermald).
This also changes the sampling rate to check every second
for increased temperatures.
Additionally this adds clear thresholds for the 2 new tripping
points.

Signed-off-by: showp1984 <showp1984@gmail.com>
msm_thermal: add sysfs interface

This adds a sysfs interface to msm_thermal.
I've also restructured the tuneables into a struct
for better overview.

Signed-off-by: showp1984 <showp1984@gmail.com>
msm_thermal: move sysfs to /sys/kernel/msm_thermal/conf/

Signed-off-by: showp1984 <showp1984@gmail.com>