thermal: msm: Update TSENS for 8960_V2

TSENS V2 supports reading from multiple sensors and
notifiying clients when the lower/upper thresholds
are reached. The lower/upper threshold use the last
sensors threshold that are set through the thermal sysfs.
TSENS HW is enabled only when the main sensor is requested.
The TSENS block is disabled if the main senors is disabled
irrespective of any other sensors that are being enabled.
When TSENS receives notification on temperature threshold
being reached, it checks and sends events to the sensors
that are enabled and whose thresholds are above the upper
or below the lower thresholds set in the tsens threshold
register.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
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>
tsens: msm8960: Split write ordering for TSENS Enable

Split the writes to the TSENS controller to first enable
the CLK in the first write and enable the TSENS block in
the following write.

Change-Id: Ia5116b6b7cb3a60f8dcc40b8558112d594c63357
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>
driver/thermal: create kernel MSM thermal management for MSM8x60 SOC

Conflicts:
	arch/arm/mach-msm/board-vigor.c
	drivers/thermal/Kconfig
	drivers/thermal/msm_thermal.c