13 Mar, 2019
1 commit
-
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)
12 Feb, 2019
25 commits
-
add thermal driver on i.MX8MM
Signed-off-by: Bai Ping
Reviewed-by: Anson Huang -
Add status check for thermal zones, ignore those thermal
zones with status set to "disabled".Signed-off-by: Anson Huang
Acked-by: Leonard Crestez -
Improve i.MX system controller thermal driver name
by making it lower case.Signed-off-by: Anson Huang
Reviewed-by: Bai Ping -
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 -
Remove unused thermal sensors and add PMIC thermal sensors
for i.MX8QM.Signed-off-by: Anson Huang
Reviewed-by: Bai Ping -
Add PMIC thermal sensors for i.MX8QXP.
Signed-off-by: Anson Huang
Reviewed-by: Bai Ping -
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 -
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 -
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 -
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 -
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
-
Add get_trend and set_trip_temp callback to support
cpu-freq cooling function.Signed-off-by: Anson 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
Reviewed-by: Bai Ping -
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
-
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
-
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
-
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
-
Add i.MX8QM/QXP thermal driver support.
Signed-off-by: Bai 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
-
In order to test the critical trip point funtion, the
critical trip point temp should be writable from userspace.Signed-off-by: Bai 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)Also unregister the busfreq_notifier when the thermal driver is removed.
Signed-off-by: Bai 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
-
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
-
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
-
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
08 Dec, 2018
5 commits
-
commit 10d7e9a9181f4637640f388d334c6740c1b5d0e8 upstream.
The sensor is all setup, bind, resetted, acked, etc... every single second.
That was the way to workaround a problem with the interrupt bouncing again and
again.With the following changes, we fix all in one:
- Do the setup, one time, at probe time
- Add the IRQF_ONESHOT, ack the interrupt in the threaded handler
- Remove the interrupt handler
- Set the correct value for the LAG register
- Remove all the irq_enabled stuff in the code as the interruption
handling is fixed- Remove the 3ms delay
- Reorder the initialization routine to be in the right order
It ends up to a nicer code and more efficient, the 3-5ms delay is removed from
the get_temp() path.Signed-off-by: Daniel Lezcano
Reviewed-by: Leo Yan
Tested-by: Leo Yan
Signed-off-by: Eduardo Valentin
Signed-off-by: Rafael David Tinoco
Signed-off-by: Greg Kroah-Hartman -
commit b424315a287c70eeb5f920f84c92492bd2f5658e upstream.
The TEMP0_CFG configuration register contains different field to set up the
temperature controller. However in the code, nothing prevents a setup to
overwrite the previous one: eg. writing the hdak value overwrites the sensor
selection, the sensor selection overwrites the hdak value.In order to prevent such thing, use a regmap-like mechanism by reading the
value before, set the corresponding bits and write the result.Signed-off-by: Daniel Lezcano
Signed-off-by: Eduardo Valentin
Signed-off-by: Rafael David Tinoco
Signed-off-by: Greg Kroah-Hartman -
commit 1e11b014271ceccb5ea04ae58f4829ac8209a86d upstream.
Hopefully, the function name can help to clarify the semantic of the operations
when writing in the register.Signed-off-by: Daniel Lezcano
Signed-off-by: Eduardo Valentin
Signed-off-by: Rafael David Tinoco
Signed-off-by: Greg Kroah-Hartman -
commit 2d4fa7b4c6f8080ced2e8237c9f46fb1fc110d64 upstream.
The threaded interrupt inspect the sensors structure to look in the temp
threshold field, but this field is read-only in all the code, except in the
probe function before the threaded interrupt is set. In other words there
is not race window in the threaded interrupt when reading the field value.Signed-off-by: Daniel Lezcano
Reviewed-by: Leo Yan
Signed-off-by: Eduardo Valentin
Signed-off-by: Rafael David Tinoco
Signed-off-by: Greg Kroah-Hartman -
commit ff4ec2997df8fe7cc40513dbe5f86d9f88fb6be7 upstream.
By essence, the tsensor does not really support multiple sensor at the same
time. It allows to set a sensor and use it to get the temperature, another
sensor could be switched but with a delay of 3-5ms. It is difficult to read
simultaneously several sensors without a big delay.Today, just one sensor is used, it is not necessary to deal with multiple
sensors in the code. Remove them and if it is needed in the future add them
on top of a code which will be clean up in the meantime.Signed-off-by: Daniel Lezcano
Reviewed-by: Leo Yan
Acked-by: Wangtao (Kevin, Kirin)
Signed-off-by: Eduardo Valentin
Signed-off-by: Rafael David Tinoco
Signed-off-by: Greg Kroah-Hartman
21 Nov, 2018
1 commit
-
commit fec3624f0bcdb6b20ef9ccf9d9d55d0d75d776f8 upstream.
Moving the bcm2835 thermal driver to the broadcom directory prevented it
from getting enabled for arm64 builds, since the broadcom directory is only
available when 32-bit specific ARCH_BCM is set.Fix this by enabling the Broadcom menu for ARCH_BCM or ARCH_BCM2835.
Fixes: 6892cf07e733 ("thermal: bcm2835: move to the broadcom subdirectory")
Reviewed-by: Eric Anholt
Signed-off-by: Allen Wild
Signed-off-by: Stefan Wahren
Signed-off-by: Eduardo Valentin
Signed-off-by: Sudip Mukherjee
Signed-off-by: Greg Kroah-Hartman
14 Nov, 2018
1 commit
-
[ 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
04 Oct, 2018
1 commit
-
[ 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
Signed-off-by: Eduardo Valentin
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman
03 Aug, 2018
1 commit
-
[ Upstream commit 8bfc218d0ebbabcba8ed2b8ec1831e0cf1f71629 ]
Add missing clearing of the previous value when setting rising
temperature threshold.Signed-off-by: Bartlomiej Zolnierkiewicz
Signed-off-by: Eduardo Valentin
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman
03 Jul, 2018
1 commit
-
commit bd2a07f71a1e2e198f8a30cb551d9defe422d83d upstream.
Printk format "%pCr" will be removed soon, as clk_get_rate() must not be
called in atomic context.Replace it by printing the variable that already holds the clock rate.
Note that calling clk_get_rate() is safe here, as the code runs in task
context.Link: http://lkml.kernel.org/r/1527845302-12159-3-git-send-email-geert+renesas@glider.be
To: Jia-Ju Bai
To: Jonathan Corbet
To: Michael Turquette
To: Stephen Boyd
To: Zhang Rui
To: Eduardo Valentin
To: Eric Anholt
To: Stefan Wahren
To: Greg Kroah-Hartman
Cc: Sergey Senozhatsky
Cc: Petr Mladek
Cc: Linus Torvalds
Cc: Steven Rostedt
Cc: linux-doc@vger.kernel.org
Cc: linux-clk@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: linux-serial@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org # 4.12+
Signed-off-by: Geert Uytterhoeven
Acked-by: Stefan Wahren
Signed-off-by: Petr Mladek
Signed-off-by: Greg Kroah-Hartman
21 Jun, 2018
1 commit
-
[ Upstream commit 13b86f50eaaddaea4bdd2fe476fd12e6a0951add ]
Starting with kernel 4.17 thermal_cooling_device_register() will call the
get_max_state() op during register.Since we deref priv->priv in int3403_get_max_state() this means we must
set priv->priv before calling thermal_cooling_device_register().Signed-off-by: Hans de Goede
Signed-off-by: Zhang Rui
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman
16 May, 2018
2 commits
-
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
CC: stable@vger.kernel.org # v4.6+
Signed-off-by: Bartlomiej Zolnierkiewicz
Signed-off-by: Eduardo Valentin
Signed-off-by: Greg Kroah-Hartman -
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
Fixes: 9e4249b40340 ("thermal: exynos: Fix first temperature read after registering sensor")
CC: stable@vger.kernel.org # v4.6+
Signed-off-by: Bartlomiej Zolnierkiewicz
Signed-off-by: Eduardo Valentin
Signed-off-by: Greg Kroah-Hartman
24 Apr, 2018
1 commit
-
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:
Signed-off-by: Mikhail Lappo
Signed-off-by: Fabio Estevam
Reviewed-by: Philipp Zabel
Acked-by: Dong Aisheng
Signed-off-by: Zhang Rui
Signed-off-by: Greg Kroah-Hartman