summaryrefslogtreecommitdiff
path: root/drivers/thermal
AgeCommit message (Collapse)Author
2016-12-14devfreq_cooling: return on allocation failureDan Carpenter
If the allocation fails then we can't continue. Fixes: a76caf55e5b3 ('thermal: Add devfreq cooling') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> [jy0922.shim: apply mainline patch] Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
2016-12-14thermal: devfreq_cooling: Make power a u64Javi Merino
The prototype of do_div() is: uint32_t do_div(uint64_t *n, uint32_t base); Make power u64 to avoid the following warning: drivers/thermal/devfreq_cooling.c: In function 'get_dynamic_power': drivers/thermal/devfreq_cooling.c:267:2: warning: comparison of distinct pointer types lacks a cast [enabled by default] drivers/thermal/devfreq_cooling.c:267:2: warning: right shift count >= width of type [enabled by default] drivers/thermal/devfreq_cooling.c:267:2: warning: passing argument 1 of '__div64_32' from incompatible pointer type [enabled by default] include/asm-generic/div64.h:35:17: note: expected 'uint64_t *' but argument is of type 'long unsigned int *' Reported-by: kbuild test robot <fengguang.wu@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> [jy0922.shim: apply mainline patch] Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
2016-12-14thermal: devfreq_cooling: use a thermal_cooling_device for register and ↵Javi Merino
unregister Be consistent with what other cooling devices do and return a struct thermal_cooling_device * on register. Also, for the unregister, accept a struct thermal_cooling_device * as parameter. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> [jy0922.shim: apply mainline patch] Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
2016-12-14devfreq_cooling: add trace informationJavi Merino
Tracing is useful for debugging and performance tuning. Add similar traces to what's present in the cpu cooling device. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@redhat.com> Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> [jy0922.shim: apply from mainline with fixup of fuzz] Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
2016-12-14thermal: Add devfreq coolingØrjan Eide
Add a generic thermal cooling device for devfreq, that is similar to cpu_cooling. The device must use devfreq. In order to use the power extension of the cooling device, it must have registered its OPPs using the OPP library. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Ørjan Eide <orjan.eide@arm.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> [jy0922.shim: apply from mainline with fixup of fuzz] Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
2016-12-14thermal: remove devfreq coolingJoonyoung Shim
Remove local old driver to apply original mainline driver for devfreq cooling. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
2016-12-14thermal: extend the cooling device API to include power informationJavi Merino
Add three optional callbacks to the cooling device interface to allow them to express power. In addition to the callbacks, add helpers to identify cooling devices that implement the power cooling device API. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> [jy0922.shim: apply mainline patch] Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
2016-12-14LOCAL / PM / devfreq: rollback mutex locking for update_devfreq()Joonyoung Shim
Userspace, performance and powersave governers call update_devfreq() with mutex locking. It causes nested mutex locking error. I'm not sure that i should make a choice which reverting change that includes mutex locking in update_devfreq() or removing mutex locking before update_devfreq() is called on each governers. IMHO, the upstream codes don't include mutex locking in update_devfreq() so first option is better. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
2016-12-14thermal: consistently use int for trip tempWei Ni
The commit 17e8351a7739 consistently use int for temperature, however it missed a few in trip temperature and thermal_core. In current codes, the trip->temperature used "unsigned long" and zone->temperature used"int", if the temperature is negative value, it will get wrong result when compare temperature with trip temperature. This patch can fix it. Signed-off-by: Wei Ni <wni@nvidia.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> [backport from mainline to fix previous backported commit] Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2016-12-14Revert "Correct backport of fa3c776 ("Thermal: Ignore invalid trip points")"Seung-Woo Kim
This reverts commit 5640c4c37eee293451388cd5ee74dfed3a30f32d. In this tree, the commit 17e8351a7739 ("thermal: consistently use int for temperatures") is already backported, so this patch should be reverted. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2016-12-14thermal: consistently use int for temperaturesSascha Hauer
The thermal code uses int, long and unsigned long for temperatures in different places. Using an unsigned type limits the thermal framework to positive temperatures without need. Also several drivers currently will report temperatures near UINT_MAX for temperatures below 0°C. This will probably immediately shut the machine down due to overtemperature if started below 0°C. 'long' is 64bit on several architectures. This is not needed since INT_MAX °mC is above the melting point of all known materials. Consistently use a plain 'int' for temperatures throughout the thermal code and the drivers. This only changes the places in the drivers where the temperature is passed around as pointer, when drivers internally use another type this is not changed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com> Reviewed-by: Darren Hart <dvhart@linux.intel.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Peter Feuerer <peter@piie.net> Cc: Punit Agrawal <punit.agrawal@arm.com> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Jean Delvare <jdelvare@suse.de> Cc: Peter Feuerer <peter@piie.net> Cc: Heiko Stuebner <heiko@sntech.de> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Stephen Warren <swarren@wwwdotorg.org> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: linux-acpi@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-omap@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org Cc: Guenter Roeck <linux@roeck-us.net> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Darren Hart <dvhart@infradead.org> Cc: lm-sensors@lm-sensors.org Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-12-14thermal: exynos5433: Add missing code for setting rising threshold.Jonghwa Lee
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
2016-12-14thermal: devfreq_cooling: Return the max cooling state correctly.Jonghwa Lee
After initialization with prebuilt opp table, max_state value is not correct. This patch fixes it. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
2016-12-14thermal: samsung: Make TMU's MUX address configurableJonghwa Lee
There is a test purpose MUX in Exynos TMU(Thermal Management Unit) and it used fixed value up to now while it can be diverged depends on chip implementation or specific uses. It now becomes configurable value via device tree. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
2016-12-14thermal: devfreq_cooling: Add missing update_devfreq()Chanwoo Choi
This patch add the missing update_devfreq() to update the maximum frequency of devfreq cooling device when g3d sensor detect the overheating temperature. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2016-12-14thermal: devfreq_cooling: Add generic devfreq cooling device implementaionChanwoo Choi
This patch add the generic devfreq cooling device based on devfreq framework. The devfreq device is used as cooling device. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2016-12-14thermal: cpu_cooling: Update cpufreq policy only for online cpus.Jonghwa Lee
Current cpu_cooling driver sets cooling state without consideration of CPU hotplug. However, applicable CPUs may differs because of hotplug, so it has to check whether target CPU is online either. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
2016-12-14LINUX-SAMSUNG / thermal: exynos: Add the support for Exynos5433 TMUChanwoo Choi
This patch adds the support for Exynos5433's TMU (Thermal Management Unit). Exynos5433 has a little different register bit fields as following description: - Support the eight trip points for rising/falling interrupt by using two registers - Read the calibration type (1-point or 2-point) and sensor id from TRIMINFO register - Use a little different register address Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2016-06-17thermal: cpu_cooling: fix improper order during initializationLukasz Luba
[ Upstream commit f840ab18bdf2e415dac21d09fbbbd2873111bd48 ] The freq_table array is not populated before calling thermal_of_cooling_register. The code which populates the freq table was introduced in commit f6859014. This should be done before registering new thermal cooling device. The log shows effects of this wrong decision. [ 2.172614] cpu cpu1: Failed to get voltage for frequency 1984518656000: -34 [ 2.220863] cpu cpu0: Failed to get voltage for frequency 1984524416000: -34 Cc: <stable@vger.kernel.org> # 3.19+ Fixes: f6859014c7e7 ("thermal: cpu_cooling: Store frequencies in descending order") Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Acked-by: Javi Merino <javi.merino@arm.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2016-06-17thermal/cpu_cooling: rename cpufreq_val as clipped_freqViresh Kumar
[ Upstream commit 59f0d21883f39d27f14408d4ca211dce80658963 ] That's what it is for, lets name it properly. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2016-04-25Correct backport of fa3c776 ("Thermal: Ignore invalid trip points")Mike Galbraith
Backport of 81ad4276b505e987dd8ebbdf63605f92cd172b52 failed to adjust for intervening ->get_trip_temp() argument type change, thus causing stack protector to panic. drivers/thermal/thermal_core.c: In function ‘thermal_zone_device_register’: drivers/thermal/thermal_core.c:1569:41: warning: passing argument 3 of ‘tz->ops->get_trip_temp’ from incompatible pointer type [-Wincompatible-pointer-types] if (tz->ops->get_trip_temp(tz, count, &trip_temp)) ^ drivers/thermal/thermal_core.c:1569:41: note: expected ‘long unsigned int *’ but argument is of type ‘int *’ CC: <stable@vger.kernel.org> #3.18,#4.1 Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
2016-04-18Thermal: Ignore invalid trip pointsZhang Rui
[ Upstream commit 81ad4276b505e987dd8ebbdf63605f92cd172b52 ] In some cases, platform thermal driver may report invalid trip points, thermal core should not take any action for these trip points. This fixed a regression that bogus trip point starts to screw up thermal control on some Lenovo laptops, after commit bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461 Author: Zhang Rui <rui.zhang@intel.com> Date: Fri Oct 30 16:31:47 2015 +0800 Thermal: initialize thermal zone device correctly After thermal zone device registered, as we have not read any temperature before, thus tz->temperature should not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the first thermal_zone_device_update(). Both thermal core framework and step_wise governor is enhanced to handle this. And since the step_wise governor is the only one that uses trends, so it's the only thermal governor that needs to be updated. Tested-by: Manuel Krause <manuelkrause@netscape.net> Tested-by: szegad <szegadlo@poczta.onet.pl> Tested-by: prash <prash.n.rao@gmail.com> Tested-by: amish <ammdispose-arch@yahoo.com> Tested-by: Matthias <morpheusxyz123@yahoo.de> Reviewed-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Chen Yu <yu.c.chen@intel.com> CC: <stable@vger.kernel.org> #3.18+ Link: https://bugzilla.redhat.com/show_bug.cgi?id=1317190 Link: https://bugzilla.kernel.org/show_bug.cgi?id=114551 Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2016-02-01Thermal: do thermal zone update after a cooling device registeredChen Yu
[ Upstream commit 4511f7166a2deb5f7a578cf87fd2fe1ae83527e3 ] When a new cooling device is registered, we need to update the thermal zone to set the new registered cooling device to a proper state. This fixes a problem that the system is cool, while the fan devices are left running on full speed after boot, if fan device is registered after thermal zone device. Here is the history of why current patch looks like this: https://patchwork.kernel.org/patch/7273041/ CC: <stable@vger.kernel.org> #3.18+ Reference:https://bugzilla.kernel.org/show_bug.cgi?id=92431 Tested-by: Manuel Krause <manuelkrause@netscape.net> Tested-by: szegad <szegadlo@poczta.onet.pl> Tested-by: prash <prash.n.rao@gmail.com> Tested-by: amish <ammdispose-arch@yahoo.com> Reviewed-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Chen Yu <yu.c.chen@intel.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2016-02-01Thermal: handle thermal zone device properly during system sleepZhang Rui
[ Upstream commit ff140fea847e1c2002a220571ab106c2456ed252 ] Current thermal code does not handle system sleep well because 1. the cooling device cooling state may be changed during suspend 2. the previous temperature reading becomes invalid after resumed because it is got before system sleep 3. updating thermal zone device during suspending/resuming is wrong because some devices may have already been suspended or may have not been resumed. Thus, the proper way to do this is to cancel all thermal zone device update requirements during suspend/resume, and after all the devices have been resumed, reset and update every registered thermal zone devices. This also fixes a regression introduced by: Commit 19593a1fb1f6 ("ACPI / fan: convert to platform driver") Because, with above commit applied, all the fan devices are attached to the acpi_general_pm_domain, and they are turned on by the pm_domain automatically after resume, without the awareness of thermal core. CC: <stable@vger.kernel.org> #3.18+ Reference: https://bugzilla.kernel.org/show_bug.cgi?id=78201 Reference: https://bugzilla.kernel.org/show_bug.cgi?id=91411 Tested-by: Manuel Krause <manuelkrause@netscape.net> Tested-by: szegad <szegadlo@poczta.onet.pl> Tested-by: prash <prash.n.rao@gmail.com> Tested-by: amish <ammdispose-arch@yahoo.com> Tested-by: Matthias <morpheusxyz123@yahoo.de> Reviewed-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Chen Yu <yu.c.chen@intel.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2016-02-01Thermal: initialize thermal zone device correctlyZhang Rui
[ Upstream commit bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461 ] After thermal zone device registered, as we have not read any temperature before, thus tz->temperature should not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the first thermal_zone_device_update(). Both thermal core framework and step_wise governor is enhanced to handle this. And since the step_wise governor is the only one that uses trends, so it's the only thermal governor that needs to be updated. CC: <stable@vger.kernel.org> #3.18+ Tested-by: Manuel Krause <manuelkrause@netscape.net> Tested-by: szegad <szegadlo@poczta.onet.pl> Tested-by: prash <prash.n.rao@gmail.com> Tested-by: amish <ammdispose-arch@yahoo.com> Tested-by: Matthias <morpheusxyz123@yahoo.de> Reviewed-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Chen Yu <yu.c.chen@intel.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2015-08-16thermal: exynos: Disable the regulator on probe failureKrzysztof Kozlowski
commit 5f09a5cbd14ae16e93866040fa44d930ff885650 upstream. During probe the regulator (if present) was enabled but not disabled in case of failure. So an unsuccessful probe lead to enabling the regulator which was actually not needed because the device was not enabled. Additionally each deferred probe lead to increase of regulator enable count so it would not be effectively disabled during removal of the device. Test HW: Exynos4412 - Trats2 board Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Fixes: 498d22f616f6 ("thermal: exynos: Support for TMU regulator defined at device tree") Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-19Merge branch 'fixes' of ↵Zhang Rui
git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal into for-rc
2015-05-09thermal: armada: Update Armada 380 thermal sensor coefficientsNadav Haklai
Improve the Armada 380 thermal sensor accuracy by using updated formula. The updated formula is: Temperature[C degrees] = 0.4761 * tsen_vsen_out - 279.1 Signed-off-by: Nadav Haklai <nadavh@marvell.com> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Cc: <stable@vger.kernel.org> #v3.16 Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-05-09thermal: rockchip: fix an error codeDan Carpenter
There is a copy and paste bug, "->clk" vs "->pclk", so we return the wrong error code here. Fixes: cbac8f639437 ('thermal: rockchip: add driver for thermal') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Caesar Wang <wxt@rock-chips.com> Reviewed-by: Doug Anderson <dianders@chromium.org> Tested-by: Caesar Wang <wxt@rock-chips.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-05-09thermal/powerclamp: fix missing newer package c-statesJacob Pan
Package C8 to C10 was introduced in newer Intel CPUs, we need to include them in the package c-state residency calculation. Otherwise, idle injection target is not accurately maintained by the closed control loop. Also cleaned up the code to make it scale better with large number of c-states. Reported-by: Kristen Carlson Accardi <kristen@linux.intel.com> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-05-09thermal/intel_powerclamp: add id for broadwell serverJacob Pan
Broadwell server has support for package C-states, idle injection works as expected on this platform. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-05-09thermal/intel_powerclamp: add __init / __exit annotationsMathias Krause
Mark the module init / exit functions with __init / __exit accodingly. This allows making the intel_powerclamp_ids[] array __initconst, too, as it only gets referenced from powerclamp_probe(). This is safe as file2alias doesn't care about the section, but the symbol name for the MODULE_DEVICE_TABLE alias. Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Mathias Krause <minipli@googlemail.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-05-08thermal: ti-soc-thermal: OMAP5: Implement Workaround for Errata i813Keerthy
DESCRIPTION Spurious Thermal Alert: Talert can happen randomly while the device remains under the temperature limit defined for this event to trig. This spurious event is caused by a incorrect re-synchronization between clock domains. The comparison between configured threshold and current temperature value can happen while the value is transitioning (metastable), thus causing inappropriate event generation. No spurious event occurs as long as the threshold value stays unchanged. Spurious event can be generated while a thermal alert threshold is modified in CONTROL_BANDGAP_THRESHOLD_MPU/GPU/CORE/DSPEVE/IVA_n. WORKAROUND Spurious event generation can be avoided by performing following sequence when the threshold is modified: 1. Mask the hot/cold events at the thermal IP level. 2. Modify Threshold. 3. Unmask the hot/cold events at the thermal IP level. Signed-off-by: Keerthy <j-keerthy@ti.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-05-08thermal: ti-soc-thermal: dra7: Implement Workaround for Errata i814Keerthy
Bandgap Temperature read Dtemp can be corrupted DESCRIPTION Read accesses to registers listed below can be corrupted due to incorrect resynchronization between clock domains. Read access to registers below can be corrupted : • CTRL_CORE_DTEMP_MPU/GPU/CORE/DSPEVE/IVA_n (n = 0 to 4) • CTRL_CORE_TEMP_SENSOR_MPU/GPU/CORE/DSPEVE/IVA_n WORKAROUND Multiple reads to CTRL_CORE_TEMP_SENSOR_MPU/GPU/CORE/DSPEVE/IVA[9:0]: BGAP_DTEMPMPU/GPU/CORE/DSPEVE/IVA is needed to discard false value and read right value: 1. Perform two successive reads to BGAP_DTEMP bit field. (a) If read1 returns Val1 and read2 returns Val1, then right value is Val1. (b) If read1 returns Val1, read 2 returns Val2, a third read is needed. 2. Perform third read (a) If read3 returns Val2 then right value is Val2. (b) If read3 returns Val3, then right value is Val3. The above in gist means if val1 and val2 are the same then we can go ahead with that value else we need a third read which will be right since synchronization will be complete by then. Signed-off-by: Keerthy <j-keerthy@ti.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-05-01thermal: Use bool function return values of true/false not 1/0Joe Perches
Use the normal return values for bool functions Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-04-07drivers: thermal: st: remove several sparse warningsEduardo Valentin
Simple patch to make symbols static. Symbols that are not shared with other parts of the kernel can be made static. This change also removes several sparse complains. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Lee Jones <lee.jones@linaro.org> Cc: Pavel Machek <pavel@ucw.cz> Cc: Ajit Pal Singh <ajitpal.singh@st.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-04-07thermal: constify of_device_id arrayFabian Frederick
of_device_id is always used as const. (See driver.of_match_table and open firmware functions) Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-04-07thermal: Do not log an error if thermal_zone_get_temp returns -EAGAINHans de Goede
Some temperature sensors only get updated every few seconds and while waiting for the first irq reporting a (new) temperature to happen there get_temp operand will return -EAGAIN as it does not have any data to report yet. Not logging an error in this case avoids messages like these from showing up in dmesg on affected systems: [ 1.219353] thermal thermal_zone0: failed to read out thermal zone 0 [ 2.015433] thermal thermal_zone0: failed to read out thermal zone 0 [ 2.416737] thermal thermal_zone0: failed to read out thermal zone 0 Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-03-05thermal: Make sysfs attributes of cooling devices default attributesMatthias Kaehlcke
Default attributes are created when the device is registered. Attributes created after device registration can lead to race conditions, where user space (e.g. udev) sees the device but not the attributes. Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-03-05Thermal/int340x: Fix memleak for aux tripSrinivas Pandruvada
When thermal zone device register fails or on module exit, the memory for aux_trip is not freed. This change fixes this issue. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-03-02thermal: exynos: Fix wrong control of power down detection mode for Exynos7Chanwoo Choi
This patch fixes the wrong control of PD_DET_EN (power down detection mode) for Exynos7 because exynos7_tmu_control() always enables the power down detection mode regardless 'on' parameter. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Tested-by: Abhilash Kesavan <a.kesavan@samsung.com> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
2015-02-28thermal: int340x_thermal: Ignore missing _ART, _TRT tablesSrinivas Pandruvada
It is possible that _ART/_TRT tables are missing or have errors. Ignore those failures, as INT3400 thermal zone is still required for _OSC or mode switch. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-02-28thermal/intel_powerclamp: add id for Avoton SoCMiguel Bernal Marin
Enable Intel Powerclamp driver on Atom* Processor C2000 Product Family for Microservers (Avoton). Avoton - SoCs for micro-servers has package C-states which can be used for idle injection. Reported-by: Jose Navarro <jose.navarro@intel.com> Suggested-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Tested-by: Jose Carlos Venegas Munoz <jos.c.venegas.munoz@intel.com> Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-02-24thermal: exynos: Clean-up code to use oneline entry for exynos compatible tableChanwoo Choi
This patch cleanup the code to use oneline for entry of exynos compatible table. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-02-24thermal: rcar: Make error and remove paths symmetrical with initGeert Uytterhoeven
Swap interrupt disable and thermal zone unregistration in the error and remove paths, to make them more symmetrical with the initialization path. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-02-24thermal: rcar: Fix race condition between init and interruptGeert Uytterhoeven
As soon as the interrupt has been enabled by devm_request_irq(), the interrupt routine may be called, depending on the current status of the hardware. However, at that point rcar_thermal_common hasn't been initialized complely yet. E.g. rcar_thermal_common.base is still NULL, causing a NULL pointer dereference: Unable to handle kernel NULL pointer dereference at virtual address 0000000c pgd = c0004000 [0000000c] *pgd=00000000 Internal error: Oops: 5 [#1] SMP ARM CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.19.0-rc7-ape6evm-04564-gb6e46cb7cbe82389 #30 Hardware name: Generic R8A73A4 (Flattened Device Tree) task: ee8953c0 ti: ee896000 task.ti: ee896000 PC is at rcar_thermal_irq+0x1c/0xf0 LR is at _raw_spin_lock_irqsave+0x48/0x54 Postpone the call to devm_request_irq() until all initialization has been done to fix this. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-02-24ti-soc-thermal: Delete an unnecessary check before the function call ↵Markus Elfring
"cpufreq_cooling_unregister" The cpufreq_cooling_unregister() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-02-24thermal: ti-soc-thermal: bandgap: Fix build warning if !CONFIG_PM_SLEEPGrygorii Strashko
Fix following build warning if CONFIG_PM_SLEEP is not set: drivers/thermal/ti-soc-thermal/ti-bandgap.c:1478:12: warning: 'ti_bandgap_suspend' defined but not used [-Wunused-function] static int ti_bandgap_suspend(struct device *dev) ^ drivers/thermal/ti-soc-thermal/ti-bandgap.c:1492:12: warning: 'ti_bandgap_resume' defined but not used [-Wunused-function] static int ti_bandgap_resume(struct device *dev) ^ Acked-by: Nishanth Menon <nm@ti.com> Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2015-02-20thermal: exynos: fix: Check if data->tmu_read callback is present before readLukasz Majewski
The exynos_tmu_data() function should on entrance test not only for valid data pointer, but also for data->tmu_read one. It is important, since afterwards it is dereferenced to get temperature code. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Abhilash Kesavan <a.kesavan@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-02-19Merge branch 'fixes' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal Pull more thermal managament updates from Zhang Rui: "Specifics: - Exynos thermal driver refactoring. Several cleanups, code optimization, unused symbols removal, and unused feature removal in Exynos thermal driver. Thanks Lukasz for this effort. - Exynos thermal driver support to OF thermal. After the code refactoring, the driver earned the support to OF thermal. Chip thermal data were moved from driver code to DTS, reducing the code footprint. Thanks Lukasz for this. - After receiving the OF thermal support, the exynos thermal driver now must allow modular build. Thanks Arnd for detecting, reporting and fixing this. - Exynos thermal driver support to Exynos 7 SoC. Thanks Abhilash for this. - Accurate temperature reporting on Rockchip thermal driver, thanks to Caesar. - Fix on how OF thermal enables its zones, thanks Lukasz for fixing. - Fixes in OF thermal examples under Documentation/. Thanks Srinivas for fixing" * 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal: thermal: exynos: Add TMU support for Exynos7 SoC dts: Documentation: Add documentation for Exynos7 SoC thermal bindings cpufreq: exynos: allow modular build thermal: Fix examples in DT documentation thermal: exynos: Correct sanity check at exynos_report_trigger() function thermal: Kconfig: Remove config for not used EXYNOS_THERMAL_CORE thermal: exynos: Remove exynos_tmu_data.c file thermal: rockchip: make temperature reporting much more accurate thermal: exynos: Remove exynos_thermal_common.[c|h] files thermal: samsung: core: Exynos TMU rework to use device tree for configuration dts: Documentation: Update exynos-thermal.txt example for Exynos5440 dts: Documentation: Extending documentation entry for exynos-thermal cpufreq: exynos: Use device tree to determine if cpufreq cooling should be registered thermal: exynos: Modify exynos thermal code to use device tree for cpu cooling configuration thermal: exynos: Provide thermal_exynos.h file to be included in device tree files thermal: exynos: cosmetic: Correct comment format thermal: of: Enable thermal_zoneX when sensor is correctly added