Commit graph

101 commits

Author SHA1 Message Date
Artem Borisov
d7992e6feb Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1
All bluetooth-related changes were omitted because of our ancient incompatible bt stack.

Change-Id: I96440b7be9342a9c1adc9476066272b827776e64
2017-12-27 17:13:15 +03:00
Richard Guy Briggs
ddcd89f15f thermal: return an error on failure to register thermal class
commit da28d966f6 upstream.

The return code from the registration of the thermal class is used to
unallocate resources, but this failure isn't passed back to the caller of
thermal_init.  Return this failure back to the caller.

This bug was introduced in changeset 4cb18728 which overwrote the return code
when the variable was re-used to catch the return code of the registration of
the genetlink thermal socket family.

Signed-off-by: Richard Guy Briggs <rbriggs@redhat.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Cc: Jonghwan Choi <jhbird.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-12 09:38:47 -07:00
David Collins
b536bcacc5 thermal: pm8xxx-tm: Add configuration option for allowing shutdown override
Add a field to the PMIC thermal alarm core data named
allow_software_override which is used to control whether or not
userspace may switch the mode of a PMIC thermal device to
"enabled" in order to enable software override of PMIC automatic
over temperature shutdown.

allow_software_override -
true:  writing "enabled" to thermalfs mode file results in
       software override of PMIC automatic over temperature
       shutdown.
false: PMIC automatic over temperature shutdown is always
       enabled.  mode file cannot be set to "enabled".

Change-Id: I4c47fdf0c0c4704008591755296118ad7fac95ae
Signed-off-by: David Collins <collinsd@codeaurora.org>
(cherry picked from commit 8f6d8a8e7e1d149687819af7f9abbb24a8459cc0)
2013-03-15 17:08:32 -07:00
David Collins
bdda1c7404 thermal: pm8xxx-tm: Use delayed_work task for temp alarm status reading
Use a delayed_work task to wait at least 40 ms in order for the
temp alarm status value to be updated after the TEMP_STAT IRQ
goes high.  Also remove IRQ enable and disable calls in the ISR
since the work item can only be enqueued once before it is run.

Change-Id: Ib5f13d0e82258b399749de96152c081d71981909
Signed-off-by: David Collins <collinsd@codeaurora.org>
(cherry picked from commit a42ed24bdc1a1ab8e2c0148430df063ee0679d18)
2013-03-15 17:08:32 -07:00
David Collins
668fd2e679 thermal: pm8xxx-tm: Improve temp alarm logging and notification filtering
Modify the kernel log message which is output when the PMIC
temperature alarm triggers so that the current (or estimated)
PMIC die temperature is shown regardless of ADC type.

Also change the log message printing and userspace notification
logic so that they only happen when the PMIC temp alarm stage
differs from what was previously seen.  This will reduce the
number of messages seen while the temperature fluctuates around
one of the thresholds.

Change-Id: I5ee2206ea05dee86666308d11dad1fc5560e58e0
Signed-off-by: David Collins <collinsd@codeaurora.org>
(cherry picked from commit 76e6e2a17d89d79711ecff9182f12460368bd5d9)
2013-03-15 17:08:31 -07:00
David Collins
eb05308844 thermal: pm8xxx-tm: Modify userspace notification method
Change the userspace notification mechanism in the over
temperature interrupt handler from kobject_uevent() to
sysfs_notify() in order to simplify userspace notification
handling.  Ensure that the new notification mechanism is
independent from the current pm8xxx-tm mode.  This means that the
"mode" thermalfs file does not need to be modified in order for
sysfs_notify() to get called in the interrupt handler.

As before, writing "enabled" to mode will enable the software
override of the automatic PMIC hardware stage 2 partial shutdown
and stage 3 full shutdown.  Turning off these features is
typically undesirable and should be avoided unless userspace is
able to take immediate corrective action.

Change-Id: Ibd92b790778fd559df5ce74231e6cf71bef16370
Signed-off-by: David Collins <collinsd@codeaurora.org>
(cherry picked from commit 729c3ae9646cb8dc2a0ad0f301f7222bec70f6c6)
2013-03-15 17:08:30 -07:00
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
2b3add84e1 thermal: tsens8974: Fix one point calibration offsets
Fix the incorrect register shift masks used for one point
calibration read from the efused region. The order for
one point and two point calibration is swapped in the
efuse memory region. Change the driver to update the
above change made in HW.

Change-Id: Ic3382bad8336fd2f9fa6955091b941ee0bda43b1
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-02-27 18:21:16 -08:00
Siddartha Mohanadoss
1f8ccb3a85 thermal: msm8974: Fix calibration less temperature readings
The slope used for temperature calculation is code/degC.
Change the implementation of the equation of the line
to use the slope as code/degC instead of degC/code.

Update the control register default initialization data to
perform a periodic update of the temperature data to the
status registers.

Change-Id: Ia222e4ffa4009767a570a083910a37fd1823011c
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-02-27 18:20:39 -08:00
Eugene Seah
a4b6684b92 msm: Add support for thermal monitor on msm8974
Add thermal monitoring and mitigation to kernel boot on msm8974
to prevent thermal conditions during boot time.

Change-Id: I9db10a4a69772fdcb8f2a450044ce446da8b593c
Signed-off-by: Eugene Seah <eseah@codeaurora.org>
2013-02-27 18:20:26 -08:00
Eugene Seah
fa14860a50 thermal: msm_thermal: Define and implement device tree bindings
Define device tree bindings for MSM_THERMAL driver, and implement
matching code to make the driver abide to these bindings.

Change-Id: I6ed08a09f45f8748841cf44db601f28659e49d9c
Signed-off-by: Eugene Seah <eseah@codeaurora.org>
2013-02-27 18:19:38 -08:00
Stepan Moskovchenko
4a26cc02e3 thermal: tsens8974: Fix NULL pointer dereference
Dereference the thermal device pointer only after checking
that it is valid.

Change-Id: I5619b14f2d37969e59a16a64b6011c1dba9b2e15
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2013-02-27 18:19:26 -08:00
Siddartha Mohanadoss
54fcd12c6c thermal: tsens8974: Support calibrationless sensors
Enable TSENS for calibrationless mode. Previously the
temperature readings from non-calibrated sensors had
high accuracy errors which made it not desirable to
enable TSENS without calibration.

With support for calibrationless sensors the accuracy
of the temperature is within acceptable range to have
it enabled before support for one and two point calibration
is added. Calibrationless sensor uses default slope and
offset based on characterized chip data.

Change default initialization configuration for individual
and remote sensors.

Change-Id: I9186b135508e6a66d312a3862e511ff3e87e4ab6
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-02-27 18:18:40 -08:00
Eugene Seah
1e1403391d msm: Add frequency backoff to thermal monitor
Make thermal monitor performance hit more gradual by stepping down
limit frequency instead of jumping directly to that frequency.
The monitor now steps down to the lowest available cpufreq
frequency, instead of fixing the limit frequency to 918MHz. Also
update the polling frequency to 250ms to improve responsiveness.

Change-Id: I6edb0cfc057284023978de04d7835e9783da5ebd
Signed-off-by: Eugene Seah <eseah@codeaurora.org>
2013-02-27 18:18:02 -08:00
Siddartha Mohanadoss
9bc13d7274 thermal: tsens: Add 8974 TSENS driver
MSM8974 TSENS block supports 11 temperature
sensors that are used for thermal mitigation.

The TSENS driver is part of the thermal sysfs
framework that allows clients to set thresholds
and receive notification on temperature thresholds
being crossed through thermal sysfs.

The driver provides ability to thermal clients
to set upper/lower thresholds for each sensor
and receive individual notification for each
sensor once the threshold is crossed.

All sensors are enabled by default during
driver initialization.

The driver is initialized early during kernel
initialization to provide capability to the
thermal kernel driver to read temperature
from the TSENS sensors. To support this feature
a kernel API is provide to read the TSENS
temperature.

Change-Id: If17daae81cfb522a9cea786b5db0c920adb5ed2d
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2013-02-27 18:16:04 -08:00
Praveen Chidambaram
af014a3fc0 msm: thermal: Simplify kernel thermal safeguard mechanism
Using CPUFreq policy objects and setting the max frequency limit by
overriding the policy->max node, leads to race/overwrite conditions with
an user trying to use the scaling_max_frequency node.

The thermal limits are directly communicated to the 'msm' cpufreq driver
and use the cpufreq_update_policy() to ensure that the frequency is
limited as per the thermal safeguard requirements.

CRs-fixed: 370343
Change-Id: Iab5a15e0f0d25da4b9f6a9417dbfc01bf5d6f8f6
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
2013-02-27 18:12:38 -08:00
Siddartha Mohanadoss
886b302462 thermal: msm_tsens: Fix clearing interrupt bit on resume
Clear the Lower/Upper threshold interrupt bit on resume. Having
the interrupt bit set prevents interrupts from being triggered
when TSENS block is enabled before it goes into suspend.

CRs-Fixed: 322042
Change-Id: Ida283fb2bbbed8032f2c72efc4e5015eb5f43ac9
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:38 -08:00
David Brown
81694ada30 thermal: msm_tsens: Remove redundant license clause
Remove the superfluous FSF address from the license text.

Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:37 -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
Eugene Seah
3dd97375e9 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>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:35 -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
Eugene Seah
40d58c7a0d thermal: Fix hotplug race condition leading to memory corruption.
msm_thermal module made a copy of the CPUFreq policy structure
pointer but continues to try and use it after the core has been
hotplugged (and the original structure is freed). The fix is to
use cpufreq_cpu_get/put instead of copying cpufreq pointers.

CRs-fixed: 342351
Change-Id: I312d8bccc09a5df5805f99fecdc9409d9d4ed2be
Signed-off-by: Eugene Seah <eseah@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:33 -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
Praveen Chidambaram
ac6e574364 msm_thermal: Remove error messages from log when core is offline
If msm_thermal is not cancelled and TSENS reports a high temperature,
it might try to limit the frequency, but since the core is offline,
the frequency limit may not happen. We need not report this error.

Change-Id: I579e2329c6fb038d53f2d207a6a832185e633785
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:29 -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
Praveen Chidambaram
b729ce4ae8 msm: thermal: Add MSM thermal sensing and limiting
Add a thermal driver to poll and detect any thermal condition at boot
and limit max cpu frequency on a thermal condition. This driver is
intended to limit cpu thermal output until the userspace thermald
kicks in. The thermald will disable this driver and take over the
cpu thermal sensing and mitigation.

Change-Id: I2710bfdeb5bf01c864437e13da835621d1b9202c
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:28 -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
7aeaff8075 hwmon: pm8xxx_adc: Remove pm8921-adc
Switch clients to use pm8xxx-adc and remove pm8921-adc.
pm8xxx-adc supports PMIC HK/XOADC for 8960, 9x15, 8064
platforms.

Change-Id: Id27fa908cc097d52e6033c28ce243c6bcf64ed27
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:24 -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
Anirudh Ghayal
4adbe847a9 mfd: pm8058: Modify pm8058 subdevices to pm8xxx interface
Move the following  subdevices to use the pm8xxx interface -
mpp, irq, gpio, keypad, power-key, leds, othc, vibrator,
rtc, batt-alarm, thermal, upl, nfc, pwm, xoadc, regulators,
xo-buffers, charger.

This allows usage of a common driver for modules which are same
across multiple PM8XXX PMICs. It also provides flexibility
to add/remove subdevices for multiple board configurations.

Change-Id: Id9795552fc9f4a2c920c070babfaef1f4cd6ca61
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
[davidb: Only drivers/thermal]
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
8968ae08cd thermal: tsens: 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 interrupt being triggered in critical temperature zone.

Thermal sys takes drastic action of shutting down the phone
which is not desired. Hence remove updating the thermal sys
on temperature changes as its not required.

CRs-Fixed: 309855
Change-Id: Id6186b2a6032150273bc0d74d91c72db5a077ac7
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:20 -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
Siddartha Mohanadoss
85c7cf8557 thermal: thermal_sys: Fix return value of trip_point_temp_set
Return the sizeof attribute as return value in place of the
return value on write to register to set the temperature.
The userspace uses the sizeof attribute as return value
to check for errors.

Change-Id: I14b023639245f2c81072d305fbfc08efb7aada1a
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:16 -08:00
Siddartha Mohanadoss
a25189bc72 thermal: thermal_sys: Add support for configurable trip points.
Add functionality for configurable hi, low and critical low.
Change the trip point attributes to allow userspace clients
with root access to set temperature for configurable hi and
low temperature.

Change-Id: I25c9c3bcfd58e44da5369187d1095559062f1860
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:15 -08:00
Abhijeet Dharmapurikar
95db9f4073 thermal: msm_tsense: fix request irq ordering
Triggering an irq might cause an update to the thermal zone device.
If the thermal zone device is not initialized then a kernel panic ensues.
Request the irq after the thermal devices have been initialized, this way
the isr will be called only after it is initialized.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit 8e85855631a198d27d422cd680c051d0e948e276)

Change-Id: Ieaa753e870ea86d0c56860b4fe2faceba4c2451a
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:14 -08:00
Siddartha Mohanadoss
e4f930189a thermal: msm_tsens: Fix notify to userspace.
Fix notification of event to userspace on receving the
tsens interrupt on threshold temperature changes.

Change-Id: Idf818ed171f146ca38a1db2264bf2a17e55ecace
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:13 -08:00
Yan He
e4fa1d1481 thermal: msm_tsens: add calibration for Tsens
Add calibration for Tsens temperature calculation;
Rewrite the conversion functions between temperature degree and ADC code;
Set TSENS_CONFIG bits (bits 29:28 of TSENS_CNTL) to '01'
because this setting is found to be optimal.

Change-Id: Ie40abb1f11c43b60b9a5a58eb84d360b190a2d02
Signed-off-by: Yan He <yanhe@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2013-02-25 11:33:12 -08:00