Commit graph

21 commits

Author SHA1 Message Date
Duy Truong
04e554807c Update copyright to The Linux Foundation
Change-Id: Ibead64ce2e901dede2ddd1b86088b88f2350ce92
Signed-off-by: Duy Truong <dtruong@codeaurora.org>
2013-03-15 17:07:39 -07:00
Siddartha Mohanadoss
461b5c26ba thermal: tsens8960: Add platform detection
TSENS is not supported on the MSM8960 1.0 because of a
HW bug. The driver used a platform detection mechanism
through a flag. With the 8960PRO the CPU MAJOR
version resets back to major version 1. The driver
does not distinguish the PRO parts differently and
disables the driver. Change the method to detect
the CPU using the platform detection api instead
of relying on the platform data.

Change-Id: I446eb196cf81e6a29760530dfbce6910652e867c
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
(cherry picked from commit 30447fec965309e30f1eb33c0d318ee4a5365026)
(cherry picked from commit 25bb62fbbc050147ae298179d7abe4ad08f78371)
2013-03-07 15:20:06 -08:00
Eugene Seah
3a0a24410a thermal: tsens: Leave sensors enabled on TSENS init.
This change allows kernel thermal mitigation to read sensors
that are not the main sensor (TSENS0) even after the driver probe
occurs.

Signed-off-by: Eugene Seah <eseah@codeaurora.org>
(cherry picked from commit bf8b0777937ab5f06f81d7b26cb7226f69099f70)

Change-Id: I4ab19b6b7604344f91700340115dcf6c4ecfe820
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:18:49 -08:00
Ajay Dudani
cdd1bf28a1 thermal: tsens8960: Fix delay in the ISR
There are more sensors on APQ8064 and MSM8930 whose status registers are to be
read and checked against enabled sensors if thresholds interrupts are crossed.
This causes delay in processing the ISR before it is returned causing other
timer events to be delayed.

Fix this by performing the status register reads for the sensors in a separate
workqueue.

CRs-Fixed: 390508
Change-Id: I7b254d0d73dfefb667e7bf9484ae704fe4ff38a8
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
2013-03-04 12:46:05 -08:00
Siddartha Mohanadoss
5810697174 thermal: msm8960_tsens: Disable Remote sensor
MSM8x30 and APQ8064 share the same TSENS block. However
the remote sensor 10 on the MSM8x30 is not calibrated. Hence
disable the sensor since its not exposed as a thermal node.
Having the remote sensor enabled leads to incorrect TSENS
threshold trip point getting triggered.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Change-Id: I3cf4d844c806fd2cd9c9e09b5134be46ed361b31
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:37 -08:00
Siddartha Mohanadoss
0f2de9d0df thermal: tsens8960: Add suspend/resume for TSENS
TSENS does not operate reliably during VDD_CX minimization.

Incorrect temperature readings are reported on some instances
when Apps processor comes out of suspend. This leads the
TSENS reporting incorrect temperature during system resume.

Change-Id: I882b37fbe290477926c3a242d3092be8b950dfab
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
[davidb: only drivers/thermal]
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:36 -08:00
Siddartha Mohanadoss
38cdcd9de6 mdm9615: Add calibration data for TSENS
MDM9615 has identical configuration for the number
of sensors and slope with MSM8960. Add support to
enable the TSENS for calibrated parts.

Change-Id: Ieb1f118ce916ab5a4f079b18b11541d86c3a5560
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
[davidb: only drivers/thermal]
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:34 -08:00
Siddartha Mohanadoss
e5cfe133b9 thermal: msm8960_tsens: Fix string length
Increase the character buffer to support the string length for
sensor10.

Change-Id: Ib1f49cea22604267f2a7fecb1eee4ef3e9e03615
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:32 -08:00
Siddartha Mohanadoss
6d72c9b1b4 thermal: msm8960_tsens: Fix setting mode for disabled sensors
Thermal driver in kernel currently requires the main sensor
to perform mitigation. Disable all the auxiliary sensors
and update the mode of the main sensor as being enabled during
TSENS init.

Round the converted temperature to the nearest degree.
Remove unwanted register reads added for debug and reference
to magic numbers in the code.

Change-Id: Id5652ba16f9adb462dc61266600f394901eee194
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:31 -08:00
Siddartha Mohanadoss
085efea37e thermal: msm8960_tsens: Add APQ8064 support
TSENS is used by the thermal daemon for thermal management.
On APQ8064 there are 11 TSENS sensors that can be used by the
thermal daemon to monitor the temperature across the chip.

TSENS for APQ8064 supports individual slope for each of the
sensors. The offset used in the temperature from each of the
slope is used for temperature calcuation from the ADC code.

Change-Id: I00457aff8d67ab3367882ffe1077af863b90bc49
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:30 -08:00
Jeff Ohlstein
b1add6d969 thermal: msm8960_tsens: nullify tmdev when early_init fails
The initialization code uses the tmdev variable as an indicator as to
whether or not early initialization succeeded. However, when early init
fails, it only kfrees the pointer, it doesn't set it to NULL. This
causes us to dereference the now-freed pointer.

Additionally, squash the message that prints each time we fail to read
the temperature sensor, and print a warning to the kernel log when tsens
calibration data is not present.

Change-Id: Iab400cac687cdbc36d8c69541675c29a0b82c704
Signed-off-by: Jeff Ohlstein <johlstei@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:29 -08:00
Siddartha Mohanadoss
2aa28c379d 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>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:27 -08:00
Siddartha Mohanadoss
190ef70221 thermal: tsens: Change the TSENS min threshold
TSENS does not shutdown the device when the Min/Max
thresholds are crossed. Setting the thresholds to the
lowest allowed Min threshold covers cases if there is
a threshold check in the kernel driver outside of the
TSENS driver. Thermal daemon sets the lower/upper
thresholds and the TSENS sends all notification to the
daemon to take the appropriate action.

Change-Id: Icc72e27bf0b8b9184a891e024b280fc642e7e628
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:26 -08:00
Siddartha Mohanadoss
e2d2f6ecc5 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>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:25 -08:00
Siddartha Mohanadoss
3350fba23e 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>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:23 -08:00
Siddartha Mohanadoss
93da454787 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>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:22 -08:00
Siddartha Mohanadoss
59214a411c 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>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:21 -08:00
Siddartha Mohanadoss
74c1658ff9 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>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:19 -08:00
Siddartha Mohanadoss
2aa966117d thermal: tsens: Add support for MDM9615
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:18 -08:00
Siddartha Mohanadoss
6b2810f71d 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>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:18 -08:00
Siddartha Mohanadoss
c965b5d997 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>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:17 -08:00