23 Jul, 2019
1 commit
-
Fix below build warning when CONFIG_PM_SLEEP=n:
drivers/thermal/imx_thermal.c:243:12: warning: 'imx7_lpsr_save'
defined but not used [-Wunused-variable]static u32 imx7_lpsr_save[2];
^~~~~~~~~~~~~~
AR drivers/spi/built-in.oSigned-off-by: Anson Huang
Reviewed-by: Jacky Bai
(cherry picked from commit e4a858fb57a2460af3c615647828f9f32e532097)
18 Apr, 2019
28 commits
-
Per design team's feadback, the 'V' bit is NOT very safe enough for
checking the validation of the temp value. So just check if the
temp value is in the sensor's valid measurment range.Signed-off-by: Jacky Bai
Reviewed-by: Anson Huang
(cherry picked from commit 324525467aac8bdea6bb5e9ac83149b3a194369e) -
add thermal driver on i.MX8MM
Signed-off-by: Bai Ping
Reviewed-by: Anson Huang
(cherry picked from commit 719cb8604dd253ec9484a39a40251f49e5300752) -
Upstream rejected ARCH_MXC_ARM64 in favor of defining ARCH_MXC for
arm64 so the current condition is never enabled.Make it depend on HAVE_IMX_SC instead because it depends on SCFW API.
Fixes: 166ac38501ae ("MLK-14972-02 driver: thermal: Add i.MX8QM/QXP thermal support")
Signed-off-by: Leonard Crestez
-
Remove unused function imx_get_sensor_data() to fix compilation warnings.
Signed-off-by: Arulpandiyan Vadivel
-
Add status check for thermal zones, ignore those thermal
zones with status set to "disabled".Signed-off-by: Anson Huang
Acked-by: Leonard Crestez
Signed-off-by: Arulpandiyan Vadivel -
Improve i.MX system controller thermal driver name
by making it lower case.Signed-off-by: Anson Huang
Reviewed-by: Bai Ping
Signed-off-by: Arulpandiyan Vadivel -
Linux expects millicelsius but tenths are handled incorrectly.
Fixes: 10a2548b8b60 ("MLK-14972-02 driver: thermal: Add i.MX8QM/QXP thermal support")
Signed-off-by: Leonard Crestez
Acked-by: Anson Huang
Signed-off-by: Arulpandiyan Vadivel -
Remove unused thermal sensors and add PMIC thermal sensors
for i.MX8QM.Signed-off-by: Anson Huang
Reviewed-by: Bai Ping
Signed-off-by: Arulpandiyan Vadivel -
Add PMIC thermal sensors for i.MX8QXP.
Signed-off-by: Anson Huang
Reviewed-by: Bai Ping
Signed-off-by: Arulpandiyan Vadivel -
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
Reviewed-by: Bai Ping
Signed-off-by: Arulpandiyan Vadivel -
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
Reviewed-by: Bai Ping
Signed-off-by: Arulpandiyan Vadivel -
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
Reviewed-by: Bai Ping
Signed-off-by: Arulpandiyan Vadivel -
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
Signed-off-by: Dong Aisheng
Signed-off-by: Arulpandiyan Vadivel -
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
Signed-off-by: Arulpandiyan Vadivel -
Add get_trend and set_trip_temp callback to support
cpu-freq cooling function.Signed-off-by: Anson Huang
Signed-off-by: Arulpandiyan Vadivel -
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
Reviewed-by: Bai Ping
Signed-off-by: Arulpandiyan Vadivel -
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
Signed-off-by: Arulpandiyan Vadivel -
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
Signed-off-by: Arulpandiyan Vadivel -
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
Signed-off-by: Arulpandiyan Vadivel -
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
[Arul: Fix merge conflicts]
Signed-off-by: Arulpandiyan Vadivel -
Add i.MX8QM/QXP thermal driver support.
Signed-off-by: Bai Ping
Signed-off-by: Arulpandiyan Vadivel -
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
[Arul: Fix merge conflicts]
Signed-off-by: Arulpandiyan Vadivel -
In order to test the critical trip point function, the
critical trip point temp should be writable from userspace.Signed-off-by: Bai Ping
Signed-off-by: Arulpandiyan Vadivel -
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)Also unregister the busfreq_notifier when the thermal driver is removed.
Signed-off-by: Bai Ping
Signed-off-by: Arulpandiyan Vadivel -
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
[Arul: fix merge conflicts]
Signed-off-by: Arulpandiyan Vadivel -
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
Signed-off-by: Arulpandiyan Vadivel -
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 function, but has different register offset and bitfield define.Signed-off-by: Bai Ping
[Arul: Fix merge conflicts]
Signed-off-by: Arulpandiyan Vadivel -
this patch is chery-picked from imx_3.14.y
(cherry picked from commit 51e376b469c)
ENGR00274056-1 thermal: add device cooling for thermal drivercpu 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
Signed-off-by: Shawn Guo
Signed-off-by: Bai Ping
Signed-off-by: Arulpandiyan Vadivel
06 Mar, 2019
2 commits
-
[ Upstream commit 129699bb8c7572106b5bbb2407c2daee4727ccad ]
Changes since V1:
* Use dev_info instead of printk
* Use dev_warn instead of BUG_ONPreviously, 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
Signed-off-by: Zhang Rui
Signed-off-by: Sasha Levin -
[ 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
Signed-off-by: Zhang Rui
Signed-off-by: Sasha Levin
13 Feb, 2019
5 commits
-
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
Signed-off-by: Eduardo Valentin
Signed-off-by: Greg Kroah-Hartman -
[ 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
Signed-off-by: Bjorn Andersson
Signed-off-by: Eduardo Valentin
Signed-off-by: Sasha Levin -
[ Upstream commit d56c19d07e0bc3ceff366a49b7d7a2440c967b1b ]
By defaul of-based thermal driver do not enable hwmon.
This patch does this explicitly, so that the temperature can be read
through the common hwmon sysfs.Signed-off-by: Matthias Brugger
Acked-by: Stefan Wahren
Signed-off-by: Eduardo Valentin
Signed-off-by: Sasha Levin -
[ Upstream commit 68000a0d983f539c95ebe5dccd4f29535c7ac0af ]
Sysfs interface to update cooling device cur_state does not
currently holding cooling device lock sometimes leading to
stale values in cur_state if getting updated simultanelously
from user space and thermal framework. Adding the proper locking
code fixes this issue.Signed-off-by: Thara Gopinath
Signed-off-by: Zhang Rui
Signed-off-by: Sasha Levin -
[ 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
Signed-off-by: Wei Wang
Signed-off-by: Zhang Rui
Signed-off-by: Sasha Levin
21 Dec, 2018
1 commit
-
[ Upstream commit 70bb27b79adf63ea39e37371d09c823c7a8f93ce ]
Commit 8c0e64ac4075 ("thermal: armada: get rid of the ->is_valid()
pointer") removed the unnecessary indirection through a function
pointer, but in doing so, also removed the negation operator too:- if (priv->data->is_valid && !priv->data->is_valid(priv)) {
+ if (armada_is_valid(priv)) {which results in:
armada_thermal f06f808c.thermal: Temperature sensor reading not valid
armada_thermal f2400078.thermal: Temperature sensor reading not valid
armada_thermal f4400078.thermal: Temperature sensor reading not validat boot, or whenever the "temp" sysfs file is read. Replace the
negation operator.Fixes: 8c0e64ac4075 ("thermal: armada: get rid of the ->is_valid() pointer")
Signed-off-by: Russell King
Signed-off-by: Eduardo Valentin
Signed-off-by: Sasha Levin
21 Nov, 2018
1 commit
-
commit 3c587768271e9c20276522025729e4ebca51583b upstream.
This patch fixes use-after-free that was detected by KASAN. The bug is
triggered on a CPUFreq driver module unload by freeing 'cdev' on device
unregister and then using the freed structure during of the cdev's sysfs
data destruction. The solution is to unregister the sysfs at first, then
destroy sysfs data and finally release the cooling device.Cc: # v4.17+
Fixes: 8ea229511e06 ("thermal: Add cooling device's statistics in sysfs")
Signed-off-by: Dmitry Osipenko
Acked-by: Viresh Kumar
Acked-by: Eduardo Valentin
Signed-off-by: Zhang Rui
Signed-off-by: Greg Kroah-Hartman
14 Nov, 2018
2 commits
-
[ Upstream commit 760eea43f8c6d48684f1f34b8a02fddc1456e849 ]
The workqueue used for monitoring the hardware may run while the device
is already suspended. Fix this by using the freezable system workqueue
instead, cfr. commit 51e20d0e3a60cf46 ("thermal: Prevent polling from
happening during system suspend").Fixes: 608567aac3206ae8 ("thermal: da9062/61: Thermal junction temperature monitoring driver")
Signed-off-by: Geert Uytterhoeven
Acked-by: Steve Twiss
Signed-off-by: Eduardo Valentin
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman -
[ Upstream commit 697ee786f15d7b65c7f3045d45fe3a05d28e0911 ]
When testing bind/unbind on r8a7791/koelsch:
WARNING: CPU: 1 PID: 697 at lib/debugobjects.c:329 debug_print_object+0x8c/0xb4
ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x10This happens if the workqueue runs after the device has been unbound.
Fix this by cancelling any queued work during remove.Fixes: e0a5172e9eec7f0d ("thermal: rcar: add interrupt support")
Signed-off-by: Geert Uytterhoeven
Reviewed-by: Niklas Söderlund
Signed-off-by: Eduardo Valentin
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman