RE: [PATCH 2/3] thermal: qoriq_thermal: only enable supported sensors
flat view
From: Peng Fan <peng.fan@nxp.com>
Date: 2023-06-01 09:52:14
Also in:
linux-pm, lkml
Hi Daniel,
Subject: RE: [PATCH 2/3] thermal: qoriq_thermal: only enable supported sensorsquoted
Subject: Re: [PATCH 2/3] thermal: qoriq_thermal: only enable supported sensors On 31/05/2023 14:05, Peng Fan wrote:quoted
quoted
Subject: Re: [PATCH 2/3] thermal: qoriq_thermal: only enable supported sensors On 16/05/2023 10:37, Peng Fan (OSS) wrote:quoted
From: Peng Fan <peng.fan@nxp.com> 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@nxp.com> --- drivers/thermal/qoriq_thermal.c | 30 +++++++++++++++++++-----------quoted
quoted
quoted
quoted
1 file changed, 19 insertions(+), 11 deletions(-)diff --git a/drivers/thermal/qoriq_thermal.cb/drivers/thermal/qoriq_thermal.c indexb806a0929459..53748c4a5be1quoted
quoted
quoted
quoted
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 measurementinterval Register */quoted
#define TMTMIR_DEFAULT 0x0000000f@@ -105,6 +104,11 @@ static int tmu_get_temp(structthermal_zone_device *tz, int *temp)quoted
* 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 avoidreturnquoted
invalid temperature.From a higher perspective if the sensor won't be enabled, then the thermal zone should not be registered, the get_temp won't happen on a disabled sensor and this test won't be necessary, no ?
After thinking more, I'd prefer current logic. We rely on devm_thermal_of_zone_register's return value to know whether there is a valid zone, then set sites bit, and after collected all site bits, we enable the thermal IP. If move the enabling thermal IP before devm_thermal_of_zone_register, We need check dtb thermal zone, to know which zone is valid for current thermal IP. This would complicate the design. So just checking the enabling bit in get temperature would be much simpler, and there just a small window before enabling thermal IP. Thanks, Peng.
Agree, let me move the temp sensor enabling before register thermal zone. Thanks, Peng.quoted
--<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwwquoted
w.linaro.org%2F&data=05%7C01%7Cpeng.fan%40nxp.com%7C2a5070b5049quoted
14957160008db61d37861%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7quoted
C0%7C638211333111330055%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4quoted
wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=aJBF2UEqaCAqcAbHcKzbGReVv6pbYlyQ25riVxEdG08%3Dquoted
&reserved=0> Linaro.org │ Open source software for ARM SoCs Follow Linaro:<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwwquoted
w.facebook.com%2Fpages%2FLinaro&data=05%7C01%7Cpeng.fan%40nxp.cquoted
om%7C2a5070b504914957160008db61d37861%7C686ea1d3bc2b4c6fa92cdquoted
99c5c301635%7C0%7C0%7C638211333111330055%7CUnknown%7CTWFpbquoted
GZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCIquoted
6Mn0%3D%7C3000%7C%7C%7C&sdata=9l627puhL7hQgMlPWaKkCIDkQKGXquoted
TH49rEM0NFipvDs%3D&reserved=0> Facebook |<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftwitquoted
ter.com%2F%23!%2Flinaroorg&data=05%7C01%7Cpeng.fan%40nxp.com%7Cquoted
2a5070b504914957160008db61d37861%7C686ea1d3bc2b4c6fa92cd99c5c30quoted
1635%7C0%7C0%7C638211333111330055%7CUnknown%7CTWFpbGZsb3d8quoted
eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3quoted
D%7C3000%7C%7C%7C&sdata=%2B0Oa%2BrxHmGPga0%2BGQjOOX6Dxaiujquoted
oPJhzwqBjjO%2B2Qo%3D&reserved=0> Twitter |<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwwquoted
w.linaro.org%2Flinaro-blog%2F&data=05%7C01%7Cpeng.fan%40nxp.com%7C2a5070b5049149571quoted
60008db61d37861%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7Cquoted
638211333111330055%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwquoted
MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7Cquoted
%7C&sdata=2lfwzPj3p%2BjowtVDc03plo1Ds%2BnT%2B2eSwdTQ9yQosfo%3quoted
D&reserved=0> Blog
_______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel