Subject: Re: [PATCH 2/3] thermal: qoriq_thermal: only enable supported
sensors
On 16/05/2023 10:37, Peng Fan (OSS) wrote:
From: Peng Fan <peng.fan@xxxxxxx>interval Register */
There are MAX 16 sensors, but not all of them supported. Such as
i.MX8MQ, there are only 3 sensors. Enabling all 16 sensors will touch
reserved bits from i.MX8MQ reference mannual, and TMU will stuck,
temperature will not update anymore.
Fixes: 45038e03d633 ("thermal: qoriq: Enable all sensors before
registering them")
Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
---
drivers/thermal/qoriq_thermal.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/drivers/thermal/qoriq_thermal.c
b/drivers/thermal/qoriq_thermal.c index b806a0929459..53748c4a5be1
100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -31,7 +31,6 @@
#define TMR_DISABLE 0x0
#define TMR_ME 0x80000000
#define TMR_ALPF 0x0c000000
-#define TMR_MSITE_ALL GENMASK(15, 0)
#define REGS_TMTMIR 0x008 /* Temperature measurement
#define TMTMIR_DEFAULT 0x0000000fthermal_zone_device *tz, int *temp)
@@ -105,6 +104,11 @@ static int tmu_get_temp(struct
* within sensor range. TEMP is an 9 bit value representing
* temperature in KelVin.
*/
+
+ regmap_read(qdata->regmap, REGS_TMR, &val);
+ if (!(val & TMR_ME))
+ return -EAGAIN;
How is this change related to what is described in the changelog?
devm_thermal_zone_of_sensor_register will invoke get temp,
since we reverted the 45038e03d633 did, we need to check TMR_ME
to avoid return invalid temperature.