hwmon: scmi-hwmon: implement change_mode for thermal zones
Subsystems (2)
PATCH v3 1/1 hwmon: scmi-hwmon: implement change_mode for thermal zones
From: Peng Fan <[email protected]>
The thermal sensors maybe disabled before kernel boot, so add change_mode for thermal zones to support configuring the thermal sensor to enabled state. If reading the temperature when the sensor is disabled, there will be error reported.
The cost is an extra config_get all to SCMI firmware to get the status of the thermal sensor. No function level impact.
---
V3:
Update commit log to show it only applys to thermal Add comments in code
Add R-b from Cristian
Guenter, I Cced [email protected] when sending V1/V2
Let me Cc Guenter Roeck <[email protected]> in V3, hope you not mind
V2:
Use SCMI_SENS_CFG_IS_ENABLED & clear BIT[31:9] before update config(Thanks Cristian)
drivers/hwmon/scmi-hwmon.c | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
drivers/hwmon/scmi-hwmon.c +39 -0
@@ -151,7 +151,46 @@ static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz,return ret; } +static int scmi_hwmon_thermal_change_mode (struct thermal_zone_device *tz, +enum thermal_device_mode new_mode) +{ +int ret; +u32 config; +enum thermal_device_mode cur_mode =THERMAL_DEVICE_DISABLED ; +struct scmi_thermal_sensor *th_sensor =thermal_zone_device_priv (tz); + + ret = sensor_ops->config_get (th_sensor->ph, th_sensor->info->id, + &config); +if (ret) +return ret; + +if (SCMI_SENS_CFG_IS_ENABLED (config)) + cur_mode =THERMAL_DEVICE_ENABLED ; + +if (cur_mode == new_mode) +return 0 ; + +/* +* Per SENSOR_CONFIG_SET sensor_config description: +* BIT[31:11] should be set to 0 if the sensor update interval does +* not need to be updated, so clear them. +* And SENSOR_CONFIG_GET does not return round up/down, so also clear +* BIT[10:9] round up/down. +*/ + config &= ~(SCMI_SENS_CFG_UPDATE_SECS_MASK | +SCMI_SENS_CFG_UPDATE_EXP_MASK | +SCMI_SENS_CFG_ROUND_MASK ); +if (new_mode ==THERMAL_DEVICE_ENABLED ) + config |=SCMI_SENS_CFG_SENSOR_ENABLED_MASK ; +else + config &= ~SCMI_SENS_CFG_SENSOR_ENABLED_MASK ; + +return sensor_ops->config_set (th_sensor->ph, th_sensor->info->id, + config); +} +static const struct thermal_zone_device_ops scmi_hwmon_thermal_ops = { + .change_mode = scmi_hwmon_thermal_change_mode, .get_temp = scmi_hwmon_thermal_get_temp, };
Signature · 1 line
2.37.1
Guenter Roeck
maintainerQuoted 10 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
The thermal sensors maybe disabled before kernel boot, so add
change_modefor thermal zones to support configuring the thermal sensor to enabled state. If reading the temperature when the sensor is disabled, there will be error reported.The cost is an extra
config_getall to SCMI firmware to get the status of the thermal sensor. No function level impact.
Quoted 9 lines
Reviewed-by Cristian Marussi <[email protected]>Signed-off-by Peng Fan <[email protected]>---
V3:
Update commit log to show it only applys to thermal Add comments in code
Add R-b from Cristian
You didn't address my question regarding the behavior of hwmon attributes if a sensor is disabled.
Quoted 3 lines
Guenter, I Cced [email protected] when sending V1/V2
Let me Cc Guenter Roeck <[email protected]> in V3, hope you not mind
This time I received it twice ;-).
Quoted 29 lines
V2:
UseSCMI_SENS_CFG_IS_ENABLED& clear BIT[31:9] before update config(Thanks Cristian)drivers/hwmon/scmi-hwmon.c | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)drivers/hwmon/scmi-hwmon.c +15
-0@@ -151,7 +151,46 @@ static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz,return ret; } +static int scmi_hwmon_thermal_change_mode (struct thermal_zone_device *tz, +enum thermal_device_mode new_mode) +{ +int ret; +u32 config; +enum thermal_device_mode cur_mode =THERMAL_DEVICE_DISABLED ; +struct scmi_thermal_sensor *th_sensor =thermal_zone_device_priv (tz); + + ret = sensor_ops->config_get (th_sensor->ph, th_sensor->info->id, + &config); +if (ret) +return ret; + +if (SCMI_SENS_CFG_IS_ENABLED (config)) + cur_mode =THERMAL_DEVICE_ENABLED ;
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz, · line 178
Quoted 10 lines
drivers/hwmon/scmi-hwmon.c +10
-0+ +if (cur_mode == new_mode) +return 0 ; + +/* +* Per SENSOR_CONFIG_SET sensor_config description: +* BIT[31:11] should be set to 0 if the sensor update interval does +* not need to be updated, so clear them. +* And SENSOR_CONFIG_GET does not return round up/down, so also clear +* BIT[10:9] round up/down.
What does "clear" mean ? Is it going to round up ? Round down ? And why would it be necessary to clear those bits if SENSOR_CONFIG_GET does not return the current setting in the first place ?
Thanks,
Guenter
Quoted 18 lines
drivers/hwmon/scmi-hwmon.c +14
-0+*/ + config &= ~(SCMI_SENS_CFG_UPDATE_SECS_MASK | +SCMI_SENS_CFG_UPDATE_EXP_MASK | +SCMI_SENS_CFG_ROUND_MASK ); +if (new_mode ==THERMAL_DEVICE_ENABLED ) + config |=SCMI_SENS_CFG_SENSOR_ENABLED_MASK ; +else + config &= ~SCMI_SENS_CFG_SENSOR_ENABLED_MASK ; + +return sensor_ops->config_set (th_sensor->ph, th_sensor->info->id, + config); +} +static const struct thermal_zone_device_ops scmi_hwmon_thermal_ops = { + .change_mode = scmi_hwmon_thermal_change_mode, .get_temp = scmi_hwmon_thermal_get_temp, };
Hi Guenter,
Quoted 18 lines
Subject: Re: [PATCH V3] hwmon: scmi-hwmon: implement
change_modefor thermal zonesQuoted 14 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
The thermal sensors maybe disabled before kernel boot, so add
change_modefor thermal zones to support configuring the thermal sensor to enabled state. If reading the temperature when the sensor is disabled, there will be error reported.The cost is an extra
config_getall to SCMI firmware to get the status of the thermal sensor. No function level impact.Reviewed-by Cristian Marussi <[email protected]>Signed-off-by Peng Fan <[email protected]>---
Quoted 8 lines
Quoted 5 lines
V3:
Update commit log to show it only applys to thermal Add comments in code
Add R-b from CristianYou didn't address my question regarding the behavior of hwmon attributes if a sensor is disabled.
Would you please share a bit more on what attributes? You mean the files under /sys/class/hwmon/hwmon0?
If the sensor is disabled, when cat temp[x]_input, it will report:
root@imx95-19x19-lpddr5-evk:/sys/class/hwmon/hwmon0# cat temp3_input cat: temp3_input: Protocol error
For enabled, it will report value:
root@imx95-19x19-lpddr5-evk:/sys/class/hwmon/hwmon0# cat temp1_input 31900
Quoted 51 lines
Quoted 4 lines
Guenter, I Cced [email protected] when sending V1/V2
Let me Cc Guenter Roeck <[email protected]> in V3, hope you not mindThis time I received it twice ;-).
Quoted 5 lines
V2:
UseSCMI_SENS_CFG_IS_ENABLED& clear BIT[31:9] before update
config(Thanks Cristian)drivers/hwmon/scmi-hwmon.c | 39++++++++++++++++++++++++++++++++++++++
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct
Quoted 7 lines
1 file changed, 39 insertions(+)drivers/hwmon/scmi-hwmon.c +0
-0@@ -151,7 +151,46 @@ static int scmi_hwmon_thermal_get_temp(struct
thermal_zone_device*tz,drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz,
Quoted 4 lines
drivers/hwmon/scmi-hwmon.c +1
-0return ret; } +static int scmi_hwmon_thermal_change_mode(struct
thermal_zone_device*tz,drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct · line 155
Quoted 1 line
drivers/hwmon/scmi-hwmon.c +1
-0+enum thermal_device_mode
new_mode) {drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz,
Quoted 3 lines
drivers/hwmon/scmi-hwmon.c +3
-0+int ret; +u32 config; + enum thermal_device_mode cur_mode =
THERMAL_DEVICE_DISABLED;Quoted 9 lines
drivers/hwmon/scmi-hwmon.c +9
-0+struct scmi_thermal_sensor *th_sensor = +thermal_zone_device_priv (tz); + + ret = sensor_ops->config_get (th_sensor->ph, th_sensor->info->id, + &config); +if (ret) +return ret; + +if (SCMI_SENS_CFG_IS_ENABLED (config))drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz,
Quoted 10 lines
drivers/hwmon/scmi-hwmon.c +10
-0+ cur_mode =THERMAL_DEVICE_ENABLED ; + +if (cur_mode == new_mode) +return 0 ; + +/* +* Per SENSOR_CONFIG_SET sensor_config description: +* BIT[31:11] should be set to 0 if the sensor update interval does +* not need to be updated, so clear them. +* And SENSOR_CONFIG_GET does not return round up/down, so also clear
Quoted 5 lines
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz, · line 178
Quoted 1 line
drivers/hwmon/scmi-hwmon.c +1
-0+* BIT[10:9] round up/down. What does "clear" mean ? Is it going to round up ? Round down ? And why would it be necessary to clear those bits if
SENSOR_CONFIG_GETdoes not return the current setting in the first place ?
This is to follow Cristian's suggestion to clear [31:9], because we only need to set the sensor to enabled state, no other attributes.
My understanding is with BIT[31:11] set to 0, BIT[10:9] will not take effect. Cristian may help comment more since he suggested to clear them in V1/V2
You are right, currently config_get will return [10:2] as reserved, so config_set bit[10:9] no need touch. But config_get bit[10:2] may update to return the value in future SCMI spec?
Cristian or Sudeep may help comment here.
Thanks,
Peng.
Quoted 23 lines
Thanks,
GuenterQuoted 19 lines
drivers/hwmon/scmi-hwmon.c +14
-0+*/ + config &= ~(SCMI_SENS_CFG_UPDATE_SECS_MASK | +SCMI_SENS_CFG_UPDATE_EXP_MASK | +SCMI_SENS_CFG_ROUND_MASK ); +if (new_mode ==THERMAL_DEVICE_ENABLED ) + config |=SCMI_SENS_CFG_SENSOR_ENABLED_MASK ; +else + config &= ~SCMI_SENS_CFG_SENSOR_ENABLED_MASK ; + +return sensor_ops->config_set (th_sensor->ph, th_sensor->info->id, + config); +} +static const struct thermal_zone_device_ops scmi_hwmon_thermal_ops = { + .change_mode = scmi_hwmon_thermal_change_mode, .get_temp = scmi_hwmon_thermal_get_temp, };
Cristian Marussi
reviewerQuoted 2 lines · Peng Fan
Hi Guenter,
Hi,
Quoted 101 lines
Quoted 18 lines
Subject: Re: [PATCH V3] hwmon: scmi-hwmon: implement
change_modefor thermal zonesQuoted 14 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
The thermal sensors maybe disabled before kernel boot, so add
change_modefor thermal zones to support configuring the thermal sensor to enabled state. If reading the temperature when the sensor is disabled, there will be error reported.The cost is an extra
config_getall to SCMI firmware to get the status of the thermal sensor. No function level impact.Reviewed-by Cristian Marussi <[email protected]>Signed-off-by Peng Fan <[email protected]>---
Quoted 8 lines
Quoted 5 lines
V3:
Update commit log to show it only applys to thermal Add comments in code
Add R-b from CristianYou didn't address my question regarding the behavior of hwmon attributes if a sensor is disabled.
Would you please share a bit more on what attributes? You mean the files under
/sys/class/hwmon/hwmon0?If the sensor is disabled, when cat temp[x]_input, it will report:
root@imx95-19x19-lpddr5-evk:/sys/class/hwmon/hwmon0# cat temp3_input cat: temp3_input: Protocol errorFor enabled, it will report value:
root@imx95-19x19-lpddr5-evk:/sys/class/hwmon/hwmon0# cat temp1_input 31900Quoted 51 lines
Quoted 4 lines
Guenter, I Cced [email protected] when sending V1/V2
Let me Cc Guenter Roeck <[email protected]> in V3, hope you not mindThis time I received it twice ;-).
Quoted 5 lines
V2:
UseSCMI_SENS_CFG_IS_ENABLED& clear BIT[31:9] before update
config(Thanks Cristian)drivers/hwmon/scmi-hwmon.c | 39++++++++++++++++++++++++++++++++++++++
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct
Quoted 7 lines
1 file changed, 39 insertions(+)drivers/hwmon/scmi-hwmon.c +0
-0@@ -151,7 +151,46 @@ static int scmi_hwmon_thermal_get_temp(struct
thermal_zone_device*tz,drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz,
Quoted 4 lines
drivers/hwmon/scmi-hwmon.c +1
-0return ret; } +static int scmi_hwmon_thermal_change_mode(struct
thermal_zone_device*tz,drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct · line 155
Quoted 1 line
drivers/hwmon/scmi-hwmon.c +1
-0+enum thermal_device_mode
new_mode) {drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz,
Quoted 3 lines
drivers/hwmon/scmi-hwmon.c +3
-0+int ret; +u32 config; + enum thermal_device_mode cur_mode =
THERMAL_DEVICE_DISABLED;Quoted 9 lines
drivers/hwmon/scmi-hwmon.c +9
-0+struct scmi_thermal_sensor *th_sensor = +thermal_zone_device_priv (tz); + + ret = sensor_ops->config_get (th_sensor->ph, th_sensor->info->id, + &config); +if (ret) +return ret; + +if (SCMI_SENS_CFG_IS_ENABLED (config))drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz,
Quoted 10 lines
drivers/hwmon/scmi-hwmon.c +10
-0+ cur_mode =THERMAL_DEVICE_ENABLED ; + +if (cur_mode == new_mode) +return 0 ; + +/* +* Per SENSOR_CONFIG_SET sensor_config description: +* BIT[31:11] should be set to 0 if the sensor update interval does +* not need to be updated, so clear them. +* And SENSOR_CONFIG_GET does not return round up/down, so also clear
Quoted 5 lines
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz, · line 178
Quoted 1 line
drivers/hwmon/scmi-hwmon.c +1
-0+* BIT[10:9] round up/down. What does "clear" mean ? Is it going to round up ? Round down ? And why would it be necessary to clear those bits if
SENSOR_CONFIG_GETdoes not return the current setting in the first place ?This is to follow Cristian's suggestion to clear [31:9], because we only need to set the sensor to enabled state, no other attributes.
My understanding is with BIT[31:11] set to 0, BIT[10:9] will not take effect. Cristian may help comment more since he suggested to clear them in V1/V2
Quoted 5 lines
You are right, currently
config_getwill return [10:2] as reserved, soconfig_setbit[10:9] no need touch. Butconfig_getbit[10:2] may update to return the value in future SCMI spec?Cristian or Sudeep may help comment here.
From the spec SENSOR_CONFIG_SET can also be used to set the chosen update-interval for the sensor and the rounding-mode, but the specified rounding mode refers only to the currently issued CONFIG_SET operation, it is not a permanent configuration for the sensor: for this reason when you instead issue a CONFIG_GET it does not make any sense to return the rounding mode, since the interval returned by the GET is the already (previously) rounded final value configured on the sensor. So the spec is right and does not need any change in these regards.
By the spec, also, if you set the update-interval to 0 in a CONFIG_SET, the chosen interval will remain unchanged, so the value of the ROUND bits is indeed irrelevant.
Now, my (probably ill) advice to anyway clear also the round bits was aimed at using some sort of well-known value in the SET (even though ignored) given that the GET does specify those bits as reserved but you cannot be sure what the previous GET just returned from the fw-of-the-day (maybe by mistake), and if those bits will be effectively ignored on the SET given the zeroed interval value.
Indeed, looking at this again, all of this is maybe just overthinking and it just confusing at this point to needlessly clear also those ROUNDING bits, since not required by the spec.
Just clear the interval bits, my bad.
Thanks,
Cristian
Guenter Roeck
maintainerQuoted 32 lines · Peng Fan
Hi Guenter,
Quoted 18 lines
Subject: Re: [PATCH V3] hwmon: scmi-hwmon: implement
change_modefor thermal zonesQuoted 14 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
The thermal sensors maybe disabled before kernel boot, so add
change_modefor thermal zones to support configuring the thermal sensor to enabled state. If reading the temperature when the sensor is disabled, there will be error reported.The cost is an extra
config_getall to SCMI firmware to get the status of the thermal sensor. No function level impact.Reviewed-by Cristian Marussi <[email protected]>Signed-off-by Peng Fan <[email protected]>---
Quoted 8 lines
Quoted 5 lines
V3:
Update commit log to show it only applys to thermal Add comments in code
Add R-b from CristianYou didn't address my question regarding the behavior of hwmon attributes if a sensor is disabled.
Would you please share a bit more on what attributes? You mean the files under
/sys/class/hwmon/hwmon0?
Quoted 9 lines
If the sensor is disabled, when cat temp[x]_input, it will report:
root@imx95-19x19-lpddr5-evk:/sys/class/hwmon/hwmon0# cat temp3_input cat: temp3_input: Protocol errorFor enabled, it will report value:
root@imx95-19x19-lpddr5-evk:/sys/class/hwmon/hwmon0# cat temp1_input 31900
This is wrong. If the sensor is disabled, there should either be no sensor attribute (if the condition is permanent), or there should be tempX_enable attribute(s) which return the sensor status (and, if appropriate, permit it to be enabled). If the condition is not permanent, attempts to read the sensor value should return -ENODATA.
Overall, hwmon functionality is orthogonal to thermal subsystem use. It is not appropriate for the thermal subsystem to disable any temperature sensors in the hwmon subsystem because the user might expect to be able to read temperatures from hwmon devices even if sensors are not in use by the thermal subsystem.
Thanks,
Guenter
Cristian Marussi
reviewerQuoted 43 lines · Guenter Roeck
Quoted 32 lines · Peng Fan
Hi Guenter,
Quoted 18 lines
Subject: Re: [PATCH V3] hwmon: scmi-hwmon: implement
change_modefor thermal zonesQuoted 14 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
The thermal sensors maybe disabled before kernel boot, so add
change_modefor thermal zones to support configuring the thermal sensor to enabled state. If reading the temperature when the sensor is disabled, there will be error reported.The cost is an extra
config_getall to SCMI firmware to get the status of the thermal sensor. No function level impact.Reviewed-by Cristian Marussi <[email protected]>Signed-off-by Peng Fan <[email protected]>---
Quoted 8 lines
Quoted 5 lines
V3:
Update commit log to show it only applys to thermal Add comments in code
Add R-b from CristianYou didn't address my question regarding the behavior of hwmon attributes if a sensor is disabled.
Would you please share a bit more on what attributes? You mean the files under
/sys/class/hwmon/hwmon0?Quoted 9 lines
If the sensor is disabled, when cat temp[x]_input, it will report:
root@imx95-19x19-lpddr5-evk:/sys/class/hwmon/hwmon0# cat temp3_input cat: temp3_input: Protocol errorFor enabled, it will report value:
root@imx95-19x19-lpddr5-evk:/sys/class/hwmon/hwmon0# cat temp1_input 31900
Quoted 6 lines
This is wrong. If the sensor is disabled, there should either be no sensor attribute (if the condition is permanent), or there should be
tempX_enableattribute(s) which return the sensor status (and, if appropriate, permit it to be enabled). If the condition is not permanent, attempts to read the sensor value should return-ENODATA.
If the sensor is permanently disabled it should not have been exposed by the SCMI server at all, in first place; in such a case it wont appear at all in hwmon.
In this case seems like the sensor is NOT supposed to be ever disabled (not even temporarily), it it just that you want to ensure that is enabled, so I would say @Peng, should not that be done in the fw SCMI server ? (i.e. to turn on, early on, all those resources that are
exposed to the agent and meant to be always on)
Regarding the non-permanent condition, currently if the SCMI reading failed, for some reason, we return the same error as returned from the SCMI layer, so I suppose I should post a patch to remap that return value to -ENODATA.
Quoted 5 lines
Overall, hwmon functionality is orthogonal to thermal subsystem use. It is not appropriate for the thermal subsystem to disable any temperature sensors in the hwmon subsystem because the user might expect to be able to read temperatures from hwmon devices even if sensors are not in use by the thermal subsystem.
Agreed, but it seems that indeed here the attempt is to make sure that an accidentally disabled sensor is turned on.
Thanks,
Cristian
Guenter Roeck
maintainerQuoted 3 lines · Cristian Marussi
Agreed, but it seems that indeed here the attempt is to make sure that an accidentally disabled sensor is turned on.
From the patch:
+static int scmi_hwmon_thermal_change_mode(struct thermal_zone_device *tz,
+ enum thermal_device_mode new_mode)
+{
...
+ if (new_mode == THERMAL_DEVICE_ENABLED)
+ config |= SCMI_SENS_CFG_SENSOR_ENABLED_MASK;
+ else
+ config &= ~SCMI_SENS_CFG_SENSOR_ENABLED_MASK;
This clearly contradicts your statement. It leaves the sensor in full control by the thermal subsystem. If the thermal subsystem decides to turn it off, it is turned off.
Guenter
Cristian Marussi
reviewerQuoted 17 lines · Guenter Roeck
Quoted 3 lines · Cristian Marussi
Agreed, but it seems that indeed here the attempt is to make sure that an accidentally disabled sensor is turned on.
From the patch:
drivers/hwmon/scmi-hwmon.c +7
-0+static int scmi_hwmon_thermal_change_mode (struct thermal_zone_device *tz, +enum thermal_device_mode new_mode) +{ +if (new_mode ==THERMAL_DEVICE_ENABLED ) + config |=SCMI_SENS_CFG_SENSOR_ENABLED_MASK ; +else + config &= ~SCMI_SENS_CFG_SENSOR_ENABLED_MASK ;
Quoted 3 lines
This clearly contradicts your statement. It leaves the sensor in full control by the thermal subsystem. If the thermal subsystem decides to turn it off, it is turned off.
Yes, indeed, and this is wrong as you explained; what I meant is that it seems to me now after this discussion, and from the commit message, that the reason (and the aim of this patch) is different from how it achieves it (as a side effect)
"The thermal sensors maybe disabled before kernel boot, so add change_mode
for thermal zones to support configuring the thermal sensor to enabled state. If reading the temperature when the sensor is disabled, there will be error reported."
Quoted 2 lines · So when I
Quoted 2 lines
Agreed, but it seems that indeed here the attempt is to make sure that an accidentally disabled sensor is turned on.
and
Quoted 5 lines
Quoted 5 lines
In this case seems like the sensor is NOT supposed to be ever disabled (not even temporarily), it it just that you want to ensure that is enabled, so I would say @Peng, should not that be done in the fw SCMI server ? (i.e. to turn on, early on, all those resources that are
exposed to the agent and meant to be always on)
I implied to drop this patch and instead make sure the visible-and-always-enabled sensor is default-enabled by the SCMI server running in the firmware, given that there won't be any need to ever disable it, from the hwmon interface NOR from the thermal subsystem.
Sorry if I have not been clear (but I maybe still well-wrong anyway :D)
Thanks,
Cristian
Quoted 50 lines
Subject: Re: [PATCH V3] hwmon: scmi-hwmon: implement
change_modefor thermal zonesQuoted 9 lines · Guenter Roeck
Quoted 3 lines · Cristian Marussi
Agreed, but it seems that indeed here the attempt is to make sure that an accidentally disabled sensor is turned on.
From the patch:
+static int scmi_hwmon_thermal_change_mode(struct
thermal_zone_device*tz,Review
Quoted 1 line
(quoted diff) +1
-0+ enum thermal_device_mode
new_mode) {Quoted 9 lines
...
(quoted diff) +4
-0+ if (new_mode == THERMAL_DEVICE_ENABLED) + config |= SCMI_SENS_CFG_SENSOR_ENABLED_MASK; + else + config &= ~SCMI_SENS_CFG_SENSOR_ENABLED_MASK;This clearly contradicts your statement. It leaves the sensor in full control by the thermal subsystem. If the thermal subsystem decides to turn it off, it is turned off.
Yes, indeed, and this is wrong as you explained; what I meant is that it seems to me now after this discussion, and from the commit message, that the reason (and the aim of this patch) is different from how it achieves it (as a side effect)
"The thermal sensors maybe disabled before kernel boot, so add
change_modefor thermal zones to support configuring the thermal sensor to enabled state. If reading the temperature when the sensor is disabled, there will be error reported."Quoted 2 lines · So when I
Quoted 2 lines
Agreed, but it seems that indeed here the attempt is to make sure that an accidentally disabled sensor is turned on.
and
Quoted 6 lines
Quoted 6 lines
In this case seems like the sensor is NOT supposed to be ever disabled (not even temporarily), it it just that you want to ensure that is enabled, so I would say @Peng, should not that be done in the fw SCMI server ? (i.e. to turn on, early on, all those resources that are
exposed to the agent and meant to be always on)
Quoted 6 lines
I implied to drop this patch and instead make sure the visible-and-always- enabled sensor is default-enabled by the SCMI server running in the firmware, given that there won't be any need to ever disable it, from the hwmon interface NOR from the thermal subsystem.
Sorry if I have not been clear (but I maybe still well-wrong anyway :D)
Sorry to bring back this old topic.
The tempsensor is disabled at boot, I will check with FW owner to enable it by default. But the tempsensor will consume some power, if leaving it always enabled.
Do we need to export a HWMON_T_ENABLE to temperature sensor if leaving thermal framework only reading temp?
Thanks,
Peng.
Quoted 4 lines
Thanks,
Cristian