summaryrefslogtreecommitdiff
path: root/drivers/thermal
AgeCommit message (Collapse)Author
2019-03-28Merge remote-tracking branch 'remotes/fslc/4.9-2.3.x-imx' into ↵Colibri-iMX7_LXDE-Image_2.8b6.184-20190401Colibri-iMX6_LXDE-Image_2.8b6.184-20190401Colibri-iMX6ULL_LXDE-Image_2.8b6.184-20190401Apalis-iMX6_LXDE-Image_2.8b6.184-20190401Marcel Ziswiler
toradex_4.9-2.3.x-imx-next
2019-03-28Merge tag 'v4.9.166' into 4.9-2.3.x-imxMarcel Ziswiler
This is the 4.9.166 stable release
2019-03-05drivers: thermal: int340x_thermal: Fix sysfs race conditionAaron Hill
[ Upstream commit 129699bb8c7572106b5bbb2407c2daee4727ccad ] Changes since V1: * Use dev_info instead of printk * Use dev_warn instead of BUG_ON Previously, sysfs_create_group was called before all initialization had fully run - specifically, before pci_set_drvdata was called. Since the sysctl group is visible to userspace as soon as sysfs_create_group returns, a small window of time existed during which a process could read from an uninitialized/partially-initialized device. This commit moves the creation of the sysctl group to after all initialized is completed. This ensures that it's impossible for userspace to read from a sysctl file before initialization has fully completed. To catch any future regressions, I've added a check to ensure that proc_thermal_emum_mode is never PROC_THERMAL_NONE when a process tries to read from a sysctl file. Previously, the aforementioned race condition could result in the 'else' branch running while PROC_THERMAL_NONE was set, leading to a null pointer deference. Signed-off-by: Aaron Hill <aa1ronham@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-03-05thermal: int340x_thermal: Fix a NULL vs IS_ERR() checkDan Carpenter
[ Upstream commit 3fe931b31a4078395c1967f0495dcc9e5ec6b5e3 ] The intel_soc_dts_iosf_init() function doesn't return NULL, it returns error pointers. Fixes: 4d0dd6c1576b ("Thermal/int340x/processor_thermal: Enable auxiliary DTS for Braswell") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-02-12thermal: hwmon: inline helpers when CONFIG_THERMAL_HWMON is not setEduardo Valentin
commit 03334ba8b425b2ad275c8f390cf83c7b081c3095 upstream. Avoid warnings like this: thermal_hwmon.h:29:1: warning: ‘thermal_remove_hwmon_sysfs’ defined but not used [-Wunused-function] thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) Fixes: 0dd88793aacd ("thermal: hwmon: move hwmon support to single file") Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-12thermal: generic-adc: Fix adc to temp interpolationBjorn Andersson
[ Upstream commit 9d216211fded20fff301d0317af3238d8383634c ] First correct the edge case to return the last element if we're outside the range, rather than at the last element, so that interpolation is not omitted for points between the two last entries in the table. Then correct the formula to perform linear interpolation based the two points surrounding the read ADC value. The indices for temp are kept as "hi" and "lo" to pair with the adc indices, but there's no requirement that the temperature is provided in descendent order. mult_frac() is used to prevent issues with overflowing the int. Cc: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-02-12Thermal: do not clear passive state during system sleepWei Wang
[ Upstream commit 964f4843a455d2ffb199512b08be8d5f077c4cac ] commit ff140fea847e ("Thermal: handle thermal zone device properly during system sleep") added PM hook to call thermal zone reset during sleep. However resetting thermal zone will also clear the passive state and thus cancel the polling queue which leads the passive cooling device state not being cleared properly after sleep. thermal_pm_notify => thermal_zone_device_reset set passive to 0 thermal_zone_trip_update will skip update passive as `old_target == instance->target'. monitor_thermal_zone => thermal_zone_device_set_polling will cancel tz->poll_queue, so the cooling device state will not be changed afterwards. Reported-by: Kame Wang <kamewang@google.com> Signed-off-by: Wei Wang <wvw@google.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-01-30imx_thermal.c: Use new temperature trip point valuesPhilippe Schenker
Use the max. junction temperature read from fusing for critical shutdown temperature. Passive temperature is set 10C lower. Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
2018-12-27imx_thermal.c: Use old trip point values from BSP 2.7Colibri-iMX7_LXDE-Image_2.8b5.156-20181228Colibri-iMX6_LXDE-Image_2.8b5.156-20181228Colibri-iMX6ULL_LXDE-Image_2.8b5.156-20181228Apalis-iMX6_LXDE-Image_2.8b5.156-20181228Philippe Schenker
In kernel upgrade from 4.1 -> 4.9 trip point values have been changed by NXP. These new values caused a lot of modules to critical shut-down during validation and verification. This commit changes the new imx_thermal.c code to use the old, well verified values. Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com> (cherry picked from commit 308edefe57c5c96fad196b6e65fa159857e969f3)
2018-12-24imx_thermal.c: unregister all ressources in error pathMax Krummenacher
This was seen in code inspection. While at it, fix error text. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2018-12-12Merge tag 'v4.9.144' into 4.9-2.3.x-imxMarcel Ziswiler
This is the 4.9.144 stable release
2018-10-03thermal: of-thermal: disable passive polling when thermal zone is disabledAnson Huang
[ Upstream commit 152395fd03d4ce1e535a75cdbf58105e50587611 ] When thermal zone is in passive mode, disabling its mode from sysfs is NOT taking effect at all, it is still polling the temperature of the disabled thermal zone and handling all thermal trips, it makes user confused. The disabling operation should disable the thermal zone behavior completely, for both active and passive mode, this patch clears the passive_delay when thermal zone is disabled and restores it when it is enabled. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-24MLK-18428-01 driver: thermal: add tmu driver on imx8mmBai Ping
add thermal driver on i.MX8MM Signed-off-by: Bai Ping <ping.bai@nxp.com> Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
2018-08-24MLK-18687-2 thermal: imx_sc: add status check for thermal zoneAnson Huang
Add status check for thermal zones, ignore those thermal zones with status set to "disabled". Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Acked-by: Leonard Crestez <leonard.crestez@nxp.com>
2018-08-24MLK-18648 thermal: improve imx sc thermal driver nameAnson Huang
Improve i.MX system controller thermal driver name by making it lower case. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Bai Ping <ping.bai@nxp.com>
2018-08-24MLK-18569 thermal: imx_sc: Fix interpreting tenths as milicelsiusLeonard Crestez
Linux expects milicelsius but tenths are handled incorrectly. Fixes: 10a2548b8b60 ("MLK-14972-02 driver: thermal: Add i.MX8QM/QXP thermal support") Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Acked-by: Anson Huang <anson.huang@nxp.com>
2018-08-24MLK-17698-5 thermal: imx_sc: add PMIC thermal sensor for i.MX8QMAnson Huang
Remove unused thermal sensors and add PMIC thermal sensors for i.MX8QM. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Bai Ping <ping.bai@nxp.com>
2018-08-24MLK-17698-3 thermal: imx_sc: add PMIC thermal sensors for i.MX8QXPAnson Huang
Add PMIC thermal sensors for i.MX8QXP. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Bai Ping <ping.bai@nxp.com>
2018-08-24MLK-17698-1 thermal: imx_sc: use system controller thermal sensor for A35 CPUAnson Huang
Now that SCFW (0d43db9 SCF-22: Move SCU controls to SYSTEM. Allows AP to use SCU temp sensor.) exposes SCU's temp sensor for AP, and it is placed more close to i.MX8QXP A35 core, so it should be used as A35's CPU thermal sensor, add this change and move DRC temp sensor to a new thermal zone. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Bai Ping <ping.bai@nxp.com>
2018-08-24MLK-16526-2 thermal: qoriq: add buffer for passive cooling mechanismAnson Huang
On i.MX8MQ, When temperature exceeds passive point, the cooling mechanism will be trigger and temperature will begin to drop, to avoid back and forth surrounding the passive point, here adds 10 C buffer for passive point, that means when cooling mechanism is trigger, only after the temperature drop to 10 C below the passive point, the cooling mechanism will exit. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Bai Ping <ping.bai@nxp.com>
2018-08-24MLK-16526-1 thermal: imx_sc: add buffer for passive cooling mechanismAnson Huang
On i.MX8QM/8QXP, When temperature exceeds passive point, the cooling mechanism will be trigger and temperature will begin to drop, to avoid back and forth surrounding the passive point, here adds 10 C buffer for passive point, that means when cooling mechanism is trigger, only after the temperature drop to 10 C below the passive point, the cooling mechanism will exit. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Bai Ping <ping.bai@nxp.com>
2018-08-24MLK-16470 thermal: imx_thermal: fix wrong thermal grade register read for MX7DDong Aisheng
From MX7D Fuse Map v2.9, the thermal grade register is 0x440[7:6], not 0x480[7:6] as before. Fixes: 2045abb4391a ("MLK-11518-01 thermal: imx: add thermal support for imx7") Reviewed-by: Bai Ping <ping.bai@nxp.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2018-08-24MLK-16415 thermal: imx_sc: add device cooling for all thermal zonesAnson Huang
For system controller thermal devices, add device cooling for all thermal zones, when temperature exceeds passive trip point, thermal driver will send out notification, all devices that register device cooling notification can take actions to cooling down the chip, such as for GPU, below message will be printed out: [ 581.284453] System is too hot. GPU3D will work at 1/64 clock. And when temperature drops to below passive trip point, GPU cooling action will be cancelled: [ 578.300532] Hot alarm is canceled. GPU3D clock will return to 64/64 Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-08-24MLK-16372-1 thermal: imx_sc: add get_trend and set_trip_temp supportAnson Huang
Add get_trend and set_trip_temp callback to support cpu-freq cooling function. Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-08-24MLK-16300 thermal: imx: avoid error message of get_temp when thermal zone is offAnson Huang
For i.MX system controller thermal, when some of the thermal zones are powered off, the get temp will fail, and thermal driver will return CPU thermal zone's temp instead. But current driver will return A53 cluster for all cases, and A53 cluster may be also off when booting up A72 cluster only, so below error message will come out: [ 475.606431] read temp sensor:0 failed [ 475.610107] thermal thermal_zone0: failed to read out thermal zone (-22) To avoid this error, for the case of thermal zones power off, thermal driver can return current thread's CPU cluster temperature. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Bai Ping <ping.bai@nxp.com>
2018-08-24MLK-16109-1 thermal: qoriq: add device cooling supportAnson Huang
On i.MX8MQ, once temperautre exceeds hot threshold, some modules like GPU etc. can reduce its frequency to cool down the chip. All modules can register this device cooling notifier to receive thermal HOT notification. Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-08-24MLK-16093-2 thermal: qoriq: add necessary callbacks for cooling supportAnson Huang
Add get_trend and set_trip_temp to support i.MX8MQ cooling device, get_trend is to customize cooling governor behavior, once temperature exceeds passive trip, cooling device will work at full function, and set_trip_temp is for updating trip temp when do thermal test via modifying trip temp from sysfs. Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-08-24MLK-15953-02 driver: thermal: Add tmu thermal driver support for i.mx8mqBai Ping
On i.MX8MQ, we use the same TMU as on QorIQ platform, so the TMU driver for QorIQ platform can be resued on our i.MX8M platform. Signed-off-by: Bai Ping <ping.bai@nxp.com>
2018-08-24MLK-15075 thermal: imx: fix temp read failure on i.mx7dBai Ping
On i.MX7D, if the system enter LPSR mode, the tempmon module will be power down, so the regiter's value is lost, so we need to save the registers before suspend and restore the register after resume back. Signed-off-by: Bai Ping <ping.bai@nxp.com>
2018-08-24MLK-14972-02 driver: thermal: Add i.MX8QM/QXP thermal supportBai Ping
Add i.MX8QM/QXP thermal driver support. Signed-off-by: Bai Ping <ping.bai@nxp.com>
2018-08-24MLK-14291 thermal: imx: fix setting passive trip tempIrina Tirdea
When setting passive temperature trip point, it is not allowed to set a higher value than the default. Currently the driver compares the new temperature to set with a constant (0). This comparison wil always be true (temp to set higher than 0) and the driver will return -EINVAL. This is a leftover from rebasing the commit fc4fcd689419 ("MLK-11705 thermal: imx: make the critical trip temp changable for test"). Fix the comparison by using the actual default passive temperature value instead of the wrong constant. Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com>
2018-08-24MLK-12219 thermal: imx: unregister busfreq_notifier in thermal_removeBai Ping
unregister the busfreq_notifier when the thermal driver is removed. Signed-off-by: Bai Ping <ping.bai@nxp.com>
2018-08-24MLK-12072 thermal: imx: enable tempmon finish bit check on imx7d TO1.1Bai Ping
On i.MX7D TO1.0, the finish bit in tempmon module used for verify the temp value is broken, so it can NOT be used for checking the temp value. On TO1.1, this issue has been fixed, so we can use this bit to verify if the temp value is valid. Signed-off-by: Bai Ping <ping.bai@nxp.com>
2018-08-24MLK-11705 thermal: imx: make the critical trip temp changable for testBai Ping
In order to test the critical trip point funtion, the critical trip point temp should be writable from userspace. Signed-off-by: Bai Ping <b51503@freescale.com>
2018-08-24MLK-11600 thermal: imx: notify thermal driver in low_bus_freq_modeBai Ping
As thermal sensor alarm function needs PLL3 to be always on, but low power idle needs all PLLs to be off, they are exclusive. Low power idle is only enabled when system staying at low bus mode which means the overall system power consumption is NOT high, thermal alarm function can be disabled in this mode to allow low power idle to be entered, and thermal sensor will still use polling mechanism to monitor the system temperature. Add busfreq notify to achieve this goal. (this patch is copied from commit dd3d1e6c6ff0) Signed-off-by: Bai Ping <b51503@freescale.com>
2018-08-24MLK-11518-03 thermal: imx enable devfreq coolingBai Ping
Enable devfreq cooling to trigger GPU freq change when hot trip is reached. Make sure thermal driver loaded after cpufreq is loaded, otherwise, cpu_cooling will not get valid cpufreq table, hence cpu_cooling will be not working. Signed-off-by: Bai Ping <b51503@freescale.com>
2018-08-24MLK-11518-02 thermal: imx: add .get_trend callback fn in thermal driverBai Ping
add .get_trend callback to determine the thermal raise/fall trend, when the temp great than a threshold, drop to the lowest trend (THERMAL_TREND_DROP_FULL). Signed-off-by: Bai Ping <b51503@freescale.com>
2018-08-24MLK-11518-01 thermal: imx: add thermal support for imx7Bai Ping
This pacth re-write part of the code the support i.MX6 and i.MX7 in thermal driver. the TEMPMON module in i.MX6 and i.MX7 can provide the same funtion, but has different register offset and bitfield define. Signed-off-by: Bai Ping <b51503@freescale.com>
2018-08-24MLK-11485 thermal: add device cooling for thermal driverAnson Huang
this patch is chery-picked from imx_3.14.y (cherry picked from commit 51e376b469c) ENGR00274056-1 thermal: add device cooling for thermal driver cpu cooling is not enough when temperature is too hot, as some devices may contribute a lot of heat to SOC, such as GPU, so we need to add device cooling as well, when system is too hot, devices can also take their actions to lower SOC temperature. when temperature cross the passive trip, device cooling driver will send out notification, those devices who register this devfreq_cooling notification will take actions to lower SOC temperature. Signed-off-by: Anson Huang <b20788@freescale.com> Signed-off-by: Shawn Guo <shawn.guo@freescale.com> Signed-off-by: Bai Ping <b51503@freescale.com>
2018-08-03thermal: exynos: fix setting rising_threshold for Exynos5433Bartlomiej Zolnierkiewicz
[ Upstream commit 8bfc218d0ebbabcba8ed2b8ec1831e0cf1f71629 ] Add missing clearing of the previous value when setting rising temperature threshold. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-16thermal: exynos: Propagate error value from tmu_read()Marek Szyprowski
commit c8da6cdef57b459ac0fd5d9d348f8460a575ae90 upstream. tmu_read() in case of Exynos4210 might return error for out of bound values. Current code ignores such value, what leads to reporting critical temperature value. Add proper error code propagation to exynos_get_temp() function. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> CC: stable@vger.kernel.org # v4.6+ Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-16thermal: exynos: Reading temperature makes sense only when TMU is turned onMarek Szyprowski
commit 88fc6f73fddf64eb507b04f7b2bd01d7291db514 upstream. When thermal sensor is not yet enabled, reading temperature might return random value. This might even result in stopping system booting when such temperature is higher than the critical value. Fix this by checking if TMU has been actually enabled before reading the temperature. This change fixes booting of Exynos4210-based board with TMU enabled (for example Samsung Trats board), which was broken since v4.4 kernel release. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Fixes: 9e4249b40340 ("thermal: exynos: Fix first temperature read after registering sensor") CC: stable@vger.kernel.org # v4.6+ Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-24thermal: imx: Fix race condition in imx_thermal_probe()Mikhail Lappo
commit cf1ba1d73a33944d8c1a75370a35434bf146b8a7 upstream. When device boots with T > T_trip_1 and requests interrupt, the race condition takes place. The interrupt comes before THERMAL_DEVICE_ENABLED is set. This leads to an attempt to reading sensor value from irq and disabling the sensor, based on the data->mode field, which expected to be THERMAL_DEVICE_ENABLED, but still stays as THERMAL_DEVICE_DISABLED. Afher this issue sensor is never re-enabled, as the driver state is wrong. Fix this problem by setting the 'data' members prior to requesting the interrupts. Fixes: 37713a1e8e4c ("thermal: imx: implement thermal alarm interrupt handling") Cc: <stable@vger.kernel.org> Signed-off-by: Mikhail Lappo <mikhail.lappo@esrlabs.com> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-13thermal: power_allocator: fix one race condition issue for thermal_instances ↵Yi Zeng
list [ Upstream commit a5de11d67dcd268b8d0beb73dc374de5e97f0caf ] When invoking allow_maximum_power and traverse tz->thermal_instances, we should grab thermal_zone_device->lock to avoid race condition. For example, during the system reboot, if the mali GPU device implements device shutdown callback and unregister GPU devfreq cooling device, the deleted list head may be accessed to cause panic, as the following log shows: [ 33.551070] c3 25 (kworker/3:0) Unable to handle kernel paging request at virtual address dead000000000070 [ 33.566708] c3 25 (kworker/3:0) pgd = ffffffc0ed290000 [ 33.572071] c3 25 (kworker/3:0) [dead000000000070] *pgd=00000001ed292003, *pud=00000001ed292003, *pmd=0000000000000000 [ 33.581515] c3 25 (kworker/3:0) Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 33.599761] c3 25 (kworker/3:0) CPU: 3 PID: 25 Comm: kworker/3:0 Not tainted 4.4.35+ #912 [ 33.614137] c3 25 (kworker/3:0) Workqueue: events_freezable thermal_zone_device_check [ 33.620245] c3 25 (kworker/3:0) task: ffffffc0f32e4200 ti: ffffffc0f32f0000 task.ti: ffffffc0f32f0000 [ 33.629466] c3 25 (kworker/3:0) PC is at power_allocator_throttle+0x7c8/0x8a4 [ 33.636609] c3 25 (kworker/3:0) LR is at power_allocator_throttle+0x808/0x8a4 [ 33.643742] c3 25 (kworker/3:0) pc : [<ffffff8008683dd0>] lr : [<ffffff8008683e10>] pstate: 20000145 [ 33.652874] c3 25 (kworker/3:0) sp : ffffffc0f32f3bb0 [ 34.468519] c3 25 (kworker/3:0) Process kworker/3:0 (pid: 25, stack limit = 0xffffffc0f32f0020) [ 34.477220] c3 25 (kworker/3:0) Stack: (0xffffffc0f32f3bb0 to 0xffffffc0f32f4000) [ 34.819822] c3 25 (kworker/3:0) Call trace: [ 34.824021] c3 25 (kworker/3:0) Exception stack(0xffffffc0f32f39c0 to 0xffffffc0f32f3af0) [ 34.924993] c3 25 (kworker/3:0) [<ffffff8008683dd0>] power_allocator_throttle+0x7c8/0x8a4 [ 34.933184] c3 25 (kworker/3:0) [<ffffff80086807f4>] handle_thermal_trip.part.25+0x70/0x224 [ 34.941545] c3 25 (kworker/3:0) [<ffffff8008680a68>] thermal_zone_device_update+0xc0/0x20c [ 34.949818] c3 25 (kworker/3:0) [<ffffff8008680bd4>] thermal_zone_device_check+0x20/0x2c [ 34.957924] c3 25 (kworker/3:0) [<ffffff80080b93a4>] process_one_work+0x168/0x458 [ 34.965414] c3 25 (kworker/3:0) [<ffffff80080ba068>] worker_thread+0x13c/0x4b4 [ 34.972650] c3 25 (kworker/3:0) [<ffffff80080c0a4c>] kthread+0xe8/0xfc [ 34.979187] c3 25 (kworker/3:0) [<ffffff8008084e90>] ret_from_fork+0x10/0x40 [ 34.986244] c3 25 (kworker/3:0) Code: f9405e73 eb1302bf d102e273 54ffc460 (b9402a61) [ 34.994339] c3 25 (kworker/3:0) ---[ end trace 32057901e3b7e1db ]--- Signed-off-by: Yi Zeng <yizeng@asrmicro.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-25thermal: fix INTEL_SOC_DTS_IOSF_CORE dependenciesArnd Bergmann
commit 68fd77cf8a4b045594231f07e5fc92e1a34c0a9e upstream. We get a Kconfig warning when selecting this without also enabling CONFIG_PCI: warning: (X86_INTEL_LPSS && INTEL_SOC_DTS_IOSF_CORE && SND_SST_IPC_ACPI && MMC_SDHCI_ACPI && PUNIT_ATOM_DEBUG) selects IOSF_MBI which has unmet direct dependencies (PCI) This adds a new depedency. Fixes: 3a2419f865a6 ("Thermal: Intel SoC: DTS thermal use common APIs") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-25thermal/drivers/hisi: Fix multiple alarm interrupts firingDaniel Lezcano
commit db2b0332608c8e648ea1e44727d36ad37cdb56cb upstream. The DT specifies a threshold of 65000, we setup the register with a value in the temperature resolution for the controller, 64656. When we reach 64656, the interrupt fires, the interrupt is disabled. Then the irq thread runs and calls thermal_zone_device_update() which will call in turn hisi_thermal_get_temp(). The function will look if the temperature decreased, assuming it was more than 65000, but that is not the case because the current temperature is 64656 (because of the rounding when setting the threshold). This condition being true, we re-enable the interrupt which fires immediately after exiting the irq thread. That happens again and again until the temperature goes to more than 65000. Potentially, there is here an interrupt storm if the temperature stabilizes at this temperature. A very unlikely case but possible. In any case, it does not make sense to handle dozens of alarm interrupt for nothing. Fix this by rounding the threshold value to the controller resolution so the check against the threshold is consistent with the one set in the controller. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Leo Yan <leo.yan@linaro.org> Tested-by: Leo Yan <leo.yan@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Kevin Wangtao <kevin.wangtao@hisilicon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-25thermal/drivers/hisi: Simplify the temperature/step computationDaniel Lezcano
commit 48880b979cdc9ef5a70af020f42b8ba1e51dbd34 upstream. The step and the base temperature are fixed values, we can simplify the computation by converting the base temperature to milli celsius and use a pre-computed step value. That saves us a lot of mult + div for nothing at runtime. Take also the opportunity to change the function names to be consistent with the rest of the code. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Leo Yan <leo.yan@linaro.org> Tested-by: Leo Yan <leo.yan@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Kevin Wangtao <kevin.wangtao@hisilicon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-25thermal/drivers/hisi: Fix kernel panic on alarm interruptDaniel Lezcano
commit 2cb4de785c40d4a2132cfc13e63828f5a28c3351 upstream. The threaded interrupt for the alarm interrupt is requested before the temperature controller is setup. This one can fire an interrupt immediately leading to a kernel panic as the sensor data is not initialized. In order to prevent that, move the threaded irq after the Tsensor is setup. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Leo Yan <leo.yan@linaro.org> Tested-by: Leo Yan <leo.yan@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Kevin Wangtao <kevin.wangtao@hisilicon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-25thermal/drivers/hisi: Fix missing interrupt enablementDaniel Lezcano
commit c176b10b025acee4dc8f2ab1cd64eb73b5ccef53 upstream. The interrupt for the temperature threshold is not enabled at the end of the probe function, enable it after the setup is complete. On the other side, the irq_enabled is not correctly set as we are checking if the interrupt is masked where 'yes' means irq_enabled=false. irq_get_irqchip_state(data->irq, IRQCHIP_STATE_MASKED, &data->irq_enabled); As we are always enabling the interrupt, it is pointless to check if the interrupt is masked or not, just set irq_enabled to 'true'. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Leo Yan <leo.yan@linaro.org> Tested-by: Leo Yan <leo.yan@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Kevin Wangtao <kevin.wangtao@hisilicon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-25thermal: hisilicon: Handle return value of clk_prepare_enableArvind Yadav
commit 919054fdfc8adf58c5512fe9872eb53ea0f5525d upstream. clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Kevin Wangtao <kevin.wangtao@hisilicon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>