thermal/drivers/imx_sc_thermal: return -EAGAIN when SCFW turn off resource
Subsystems (2)
Frank Li
maintainerPATCH 1/1 thermal/drivers/imx_sc_thermal: return -EAGAIN when SCFW turn off resource
Avoid endless print following message when SCFW turns off resource.
[ 1818.342337] thermal thermal_zone0: failed to read out thermal zone (-1)
--- drivers/thermal/imx_sc_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/thermal/imx_sc_thermal.c +3 -1
@@ -58,7 +58,9 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) hdr->size =2 ; ret =imx_scu_call_rpc (thermal_ipc_handle, &msg, true); -if (ret) +if (ret == -EPERM )/* NO POWER */ +return -EAGAIN ; +else if (ret)return ret; *temp = msg.data.resp.celsius *1000 + msg.data.resp.tenths *100 ;
Signature · 1 line
2.34.1
Quoted 13 lines · Frank Li
Avoid endless print following message when SCFW turns off resource.
[ 1818.342337] thermal thermal_zone0: failed to read out thermal zone (-1)Signed-off-by Frank Li <[email protected]>--- drivers/thermal/imx_sc_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/thermal/imx_sc_thermal.c +0
-0
drivers/thermal/imx_sc_thermal.c static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) · line 62
Quoted 6 lines
drivers/thermal/imx_sc_thermal.c +2
-1@@ -58,7 +58,9 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) hdr->size =2 ; ret =imx_scu_call_rpc (thermal_ipc_handle, &msg, true); -if (ret) +if (ret == -EPERM )/* NO POWER */ +return -EAGAIN ;
Isn't there a chain call somewhere when the resource is turned off, so the thermal zone can be disabled?
Quoted 4 lines
drivers/thermal/imx_sc_thermal.c +1
-0+else if (ret)return ret; *temp = msg.data.resp.celsius *1000 + msg.data.resp.tenths *100 ;
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Frank Li
maintainerQuoted 9 lines · Daniel Lezcano
Quoted 8 lines · Frank Li
Avoid endless print following message when SCFW turns off resource.
[ 1818.342337] thermal thermal_zone0: failed to read out thermal zone (-1)Signed-off-by Frank Li <[email protected]>--- drivers/thermal/imx_sc_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 13 lines
drivers/thermal/imx_sc_thermal.c static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) · line 61
Quoted 10 lines
drivers/thermal/imx_sc_thermal.c +2
-1@@ -58,7 +58,9 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) hdr->size =2 ; ret =imx_scu_call_rpc (thermal_ipc_handle, &msg, true); -if (ret) +if (ret == -EPERM )/* NO POWER */ +return -EAGAIN ;Isn't there a chain call somewhere when the resource is turned off, so the thermal zone can be disabled?
A possible place in drivers/firmware/imx/scu-pd.c. but I am not sure how to get thermal devices. I just found a API thermal_zone_get_zone_by_name(). I am not sure if it is good to depend on "name", which add coupling between two drivers and if there are external thermal devices(such as) has the same name, it will wrong turn off.
If add power domain notification in thermal driver, I am not how to get other devices's pd in thermal driver.
Any example I can refer?
Or this is simple enough solution.
Frank
Quoted 12 lines
Quoted 4 lines
drivers/thermal/imx_sc_thermal.c +1
-0+else if (ret)return ret; *temp = msg.data.resp.celsius *1000 + msg.data.resp.tenths *100 ;Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Hi Frank,
sorry for the delay
Quoted 24 lines · Frank Li
Quoted 9 lines · Daniel Lezcano
Quoted 8 lines · Frank Li
Avoid endless print following message when SCFW turns off resource.
[ 1818.342337] thermal thermal_zone0: failed to read out thermal zone (-1)Signed-off-by Frank Li <[email protected]>--- drivers/thermal/imx_sc_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 13 lines
drivers/thermal/imx_sc_thermal.c static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) · line 61
Quoted 10 lines
drivers/thermal/imx_sc_thermal.c +2
-1@@ -58,7 +58,9 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) hdr->size =2 ; ret =imx_scu_call_rpc (thermal_ipc_handle, &msg, true); -if (ret) +if (ret == -EPERM )/* NO POWER */ +return -EAGAIN ;Isn't there a chain call somewhere when the resource is turned off, so the thermal zone can be disabled?
Quoted 5 lines
A possible place in
drivers/firmware/imx/scu-pd.c. but I am not sure how to get thermal devices. I just found a APIthermal_zone_get_zone_by_name(). I am not sure if it is good to depend on "name", which add coupling between two drivers and if there are external thermal devices(such as) has the same name, it will wrong turn off.
Correct
Quoted 6 lines
If add power domain notification in thermal driver, I am not how to get other devices's pd in thermal driver.
Any example I can refer?
Or this is simple enough solution.
The solution works for removing the error message but it does not solve the root cause of the issue. The thermal zone keeps monitoring while the sensor is down.
So the question is why the sensor is shut down if it is in use?
Quoted 12 lines
Quoted 12 lines
Quoted 4 lines
drivers/thermal/imx_sc_thermal.c +1
-0+else if (ret)return ret; *temp = msg.data.resp.celsius *1000 + msg.data.resp.tenths *100 ;Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Frank Li
maintainerQuoted 43 lines · Daniel Lezcano
Hi Frank,
sorry for the delay
Quoted 24 lines · Frank Li
Quoted 9 lines · Daniel Lezcano
Quoted 8 lines · Frank Li
Avoid endless print following message when SCFW turns off resource.
[ 1818.342337] thermal thermal_zone0: failed to read out thermal zone (-1)Signed-off-by Frank Li <[email protected]>--- drivers/thermal/imx_sc_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 13 lines
drivers/thermal/imx_sc_thermal.c static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) · line 61
Quoted 10 lines
drivers/thermal/imx_sc_thermal.c +2
-1@@ -58,7 +58,9 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) hdr->size =2 ; ret =imx_scu_call_rpc (thermal_ipc_handle, &msg, true); -if (ret) +if (ret == -EPERM )/* NO POWER */ +return -EAGAIN ;Isn't there a chain call somewhere when the resource is turned off, so the thermal zone can be disabled?
Quoted 5 lines
A possible place in
drivers/firmware/imx/scu-pd.c. but I am not sure how to get thermal devices. I just found a APIthermal_zone_get_zone_by_name(). I am not sure if it is good to depend on "name", which add coupling between two drivers and if there are external thermal devices(such as) has the same name, it will wrong turn off.Correct
Quoted 5 lines
If add power domain notification in thermal driver, I am not how to get other devices's pd in thermal driver.
Any example I can refer?
Quoted 7 lines
Quoted 1 line
Or this is simple enough solution.
The solution works for removing the error message but it does not solve the root cause of the issue. The thermal zone keeps monitoring while the sensor is down.
So the question is why the sensor is shut down if it is in use?
Do you know if there are any code I reference? I supposed it is quite common.
Frank
Quoted 23 lines
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
drivers/thermal/imx_sc_thermal.c +1
-0+else if (ret)return ret; *temp = msg.data.resp.celsius *1000 + msg.data.resp.tenths *100 ;Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> BlogSignature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Quoted 46 lines · Frank Li
Quoted 45 lines · Daniel Lezcano
Hi Frank,
sorry for the delay
Quoted 24 lines · Frank Li
Quoted 9 lines · Daniel Lezcano
Quoted 8 lines · Frank Li
Avoid endless print following message when SCFW turns off resource.
[ 1818.342337] thermal thermal_zone0: failed to read out thermal zone (-1)Signed-off-by Frank Li <[email protected]>--- drivers/thermal/imx_sc_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 13 lines
drivers/thermal/imx_sc_thermal.c static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) · line 61
Quoted 10 lines
drivers/thermal/imx_sc_thermal.c +2
-1@@ -58,7 +58,9 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) hdr->size =2 ; ret =imx_scu_call_rpc (thermal_ipc_handle, &msg, true); -if (ret) +if (ret == -EPERM )/* NO POWER */ +return -EAGAIN ;Isn't there a chain call somewhere when the resource is turned off, so the thermal zone can be disabled?
Quoted 5 lines
A possible place in
drivers/firmware/imx/scu-pd.c. but I am not sure how to get thermal devices. I just found a APIthermal_zone_get_zone_by_name(). I am not sure if it is good to depend on "name", which add coupling between two drivers and if there are external thermal devices(such as) has the same name, it will wrong turn off.Correct
Quoted 6 lines
If add power domain notification in thermal driver, I am not how to get other devices's pd in thermal driver.
Any example I can refer?
Or this is simple enough solution.
Quoted 7 lines
Quoted 5 lines
The solution works for removing the error message but it does not solve the root cause of the issue. The thermal zone keeps monitoring while the sensor is down.
So the question is why the sensor is shut down if it is in use?
Do you know if there are any code I reference? I supposed it is quite common.
Sorry, I don't get your comment
What I meant is why is the sensor turned off if it is in use ?
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Frank Li
maintainerQuoted 51 lines · Daniel Lezcano
Quoted 50 lines · Frank Li
Quoted 49 lines · Daniel Lezcano
Hi Frank,
sorry for the delay
Quoted 24 lines · Frank Li
Quoted 9 lines · Daniel Lezcano
Quoted 8 lines · Frank Li
Avoid endless print following message when SCFW turns off resource.
[ 1818.342337] thermal thermal_zone0: failed to read out thermal zone (-1)Signed-off-by Frank Li <[email protected]>--- drivers/thermal/imx_sc_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 13 lines
drivers/thermal/imx_sc_thermal.c static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) · line 61
Quoted 10 lines
drivers/thermal/imx_sc_thermal.c +2
-1@@ -58,7 +58,9 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) hdr->size =2 ; ret =imx_scu_call_rpc (thermal_ipc_handle, &msg, true); -if (ret) +if (ret == -EPERM )/* NO POWER */ +return -EAGAIN ;Isn't there a chain call somewhere when the resource is turned off, so the thermal zone can be disabled?
Quoted 5 lines
A possible place in
drivers/firmware/imx/scu-pd.c. but I am not sure how to get thermal devices. I just found a APIthermal_zone_get_zone_by_name(). I am not sure if it is good to depend on "name", which add coupling between two drivers and if there are external thermal devices(such as) has the same name, it will wrong turn off.Correct
Quoted 6 lines
If add power domain notification in thermal driver, I am not how to get other devices's pd in thermal driver.
Any example I can refer?
Or this is simple enough solution.
The solution works for removing the error message but it does not solve the root cause of the issue. The thermal zone keeps monitoring while the sensor is down.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
So the question is why the sensor is shut down if it is in use?
Do you know if there are any code I reference? I supposed it is quite common.
Sorry, I don't get your comment
What I meant is why is the sensor turned off if it is in use ?
One typical example is cpu hotplug. The sensor is located CPU power domain. If CPU hotplug off, CPU power domain will be turn off.
It doesn't make sensor keep monitor such sensor when CPU already power off. It doesn't make sensor to keep CPU power on just because want to get sensor data.
Anthor example is GPU, if there are GPU0 and GPU1. Most case just GPU0 work. GPU1 may turn off when less loading.
Ideally, thermal can get notification from power domain driver. when such power domain turn off, disable thermal zone.
So far, I have not idea how to do that.
Quoted 8 lines
Signature · 6 lines
-- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Quoted 67 lines · Frank Li
Quoted 51 lines · Daniel Lezcano
Quoted 50 lines · Frank Li
Quoted 49 lines · Daniel Lezcano
Hi Frank,
sorry for the delay
Quoted 24 lines · Frank Li
Quoted 9 lines · Daniel Lezcano
Quoted 8 lines · Frank Li
Avoid endless print following message when SCFW turns off resource.
[ 1818.342337] thermal thermal_zone0: failed to read out thermal zone (-1)Signed-off-by Frank Li <[email protected]>--- drivers/thermal/imx_sc_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 13 lines
drivers/thermal/imx_sc_thermal.c static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) · line 61
Quoted 10 lines
drivers/thermal/imx_sc_thermal.c +2
-1@@ -58,7 +58,9 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) hdr->size =2 ; ret =imx_scu_call_rpc (thermal_ipc_handle, &msg, true); -if (ret) +if (ret == -EPERM )/* NO POWER */ +return -EAGAIN ;Isn't there a chain call somewhere when the resource is turned off, so the thermal zone can be disabled?
Quoted 5 lines
A possible place in
drivers/firmware/imx/scu-pd.c. but I am not sure how to get thermal devices. I just found a APIthermal_zone_get_zone_by_name(). I am not sure if it is good to depend on "name", which add coupling between two drivers and if there are external thermal devices(such as) has the same name, it will wrong turn off.Correct
Quoted 6 lines
If add power domain notification in thermal driver, I am not how to get other devices's pd in thermal driver.
Any example I can refer?
Or this is simple enough solution.
The solution works for removing the error message but it does not solve the root cause of the issue. The thermal zone keeps monitoring while the sensor is down.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
So the question is why the sensor is shut down if it is in use?
Do you know if there are any code I reference? I supposed it is quite common.
Sorry, I don't get your comment
What I meant is why is the sensor turned off if it is in use ?
One typical example is cpu hotplug. The sensor is located CPU power domain. If CPU hotplug off, CPU power domain will be turn off.
It doesn't make sensor keep monitor such sensor when CPU already power off. It doesn't make sensor to keep CPU power on just because want to get sensor data.
Quoted 7 lines
Anthor example is GPU, if there are GPU0 and GPU1. Most case just GPU0 work. GPU1 may turn off when less loading.
Ideally, thermal can get notification from power domain driver. when such power domain turn off, disable thermal zone.
So far, I have not idea how to do that.
Ulf,
do you have a guidance to link the thermal zone and the power domain in order to get a poweron/off notification leading to enable/disable the thermal zone ?
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Quoted 75 lines · Daniel Lezcano
Quoted 73 lines · Frank Li
Quoted 51 lines · Daniel Lezcano
Quoted 50 lines · Frank Li
Quoted 49 lines · Daniel Lezcano
Hi Frank,
sorry for the delay
Quoted 24 lines · Frank Li
Quoted 9 lines · Daniel Lezcano
Quoted 8 lines · Frank Li
Avoid endless print following message when SCFW turns off resource.
[ 1818.342337] thermal thermal_zone0: failed to read out thermal zone (-1)Signed-off-by Frank Li <[email protected]>--- drivers/thermal/imx_sc_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 13 lines
drivers/thermal/imx_sc_thermal.c static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) · line 61
Quoted 10 lines
drivers/thermal/imx_sc_thermal.c +2
-1@@ -58,7 +58,9 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) hdr->size =2 ; ret =imx_scu_call_rpc (thermal_ipc_handle, &msg, true); -if (ret) +if (ret == -EPERM )/* NO POWER */ +return -EAGAIN ;Isn't there a chain call somewhere when the resource is turned off, so the thermal zone can be disabled?
Quoted 5 lines
A possible place in
drivers/firmware/imx/scu-pd.c. but I am not sure how to get thermal devices. I just found a APIthermal_zone_get_zone_by_name(). I am not sure if it is good to depend on "name", which add coupling between two drivers and if there are external thermal devices(such as) has the same name, it will wrong turn off.Correct
Quoted 6 lines
If add power domain notification in thermal driver, I am not how to get other devices's pd in thermal driver.
Any example I can refer?
Or this is simple enough solution.
The solution works for removing the error message but it does not solve the root cause of the issue. The thermal zone keeps monitoring while the sensor is down.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
So the question is why the sensor is shut down if it is in use?
Do you know if there are any code I reference? I supposed it is quite common.
Sorry, I don't get your comment
What I meant is why is the sensor turned off if it is in use ?
One typical example is cpu hotplug. The sensor is located CPU power domain. If CPU hotplug off, CPU power domain will be turn off.
It doesn't make sensor keep monitor such sensor when CPU already power off. It doesn't make sensor to keep CPU power on just because want to get sensor data.
Anthor example is GPU, if there are GPU0 and GPU1. Most case just GPU0 work. GPU1 may turn off when less loading.
Ideally, thermal can get notification from power domain driver. when such power domain turn off, disable thermal zone.
Quoted 7 lines
Quoted 1 line
So far, I have not idea how to do that.
Ulf,
do you have a guidance to link the thermal zone and the power domain in order to get a poweron/off notification leading to enable/disable the thermal zone ?
I don't know the details here, so apologize for my ignorance to start with. What platform is this?
A vague idea could be to hook up the thermal sensor to the corresponding CPU power domain. Assuming the CPU power domain is modelled as a genpd provider, then this allows the driver for the thermal sensor to register for power-on/off notifications of the genpd (see dev_pm_genpd_add_notifier()).
Can this work?
Kind regards
Uffe
Hi Ulf,
thanks for your answer
Quoted 1 line · Ulf Hansson
On Wed, 16 Aug 2023 at 22:46, Daniel Lezcano <[email protected]> wrote:
[ ... ]
Quoted 34 lines
Quoted 34 lines
Quoted 33 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 6 lines
If add power domain notification in thermal driver, I am not how to get other devices's pd in thermal driver.
Any example I can refer?
Or this is simple enough solution.
The solution works for removing the error message but it does not solve the root cause of the issue. The thermal zone keeps monitoring while the sensor is down.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
So the question is why the sensor is shut down if it is in use?
Do you know if there are any code I reference? I supposed it is quite common.
Sorry, I don't get your comment
What I meant is why is the sensor turned off if it is in use ?
One typical example is cpu hotplug. The sensor is located CPU power domain. If CPU hotplug off, CPU power domain will be turn off.
It doesn't make sensor keep monitor such sensor when CPU already power off. It doesn't make sensor to keep CPU power on just because want to get sensor data.
Anthor example is GPU, if there are GPU0 and GPU1. Most case just GPU0 work. GPU1 may turn off when less loading.
Ideally, thermal can get notification from power domain driver. when such power domain turn off, disable thermal zone.
So far, I have not idea how to do that.
Quoted 8 lines
Quoted 5 lines
Ulf,
do you have a guidance to link the thermal zone and the power domain in order to get a poweron/off notification leading to enable/disable the thermal zone ?
I don't know the details here, so apologize for my ignorance to start with. What platform is this?
I will let Frank answer this
Quoted 7 lines
A vague idea could be to hook up the thermal sensor to the corresponding CPU power domain. Assuming the CPU power domain is modelled as a genpd provider, then this allows the driver for the thermal sensor to register for power-on/off notifications of the genpd (see
dev_pm_genpd_add_notifier()).Can this work?
Yes indeed it sounds like what should be achieved. Assuming it is not modeled with genpd how would you describe those in order to have the sensor belonging to one specific power domain?
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Frank Li
maintainerQuoted 78 lines · Ulf Hansson
Quoted 77 lines · Daniel Lezcano
Quoted 74 lines · Frank Li
Quoted 51 lines · Daniel Lezcano
Quoted 50 lines · Frank Li
Quoted 49 lines · Daniel Lezcano
Hi Frank,
sorry for the delay
Quoted 24 lines · Frank Li
Quoted 9 lines · Daniel Lezcano
Quoted 8 lines · Frank Li
Avoid endless print following message when SCFW turns off resource.
[ 1818.342337] thermal thermal_zone0: failed to read out thermal zone (-1)Signed-off-by Frank Li <[email protected]>--- drivers/thermal/imx_sc_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 13 lines
drivers/thermal/imx_sc_thermal.c static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) · line 61
Quoted 10 lines
drivers/thermal/imx_sc_thermal.c +2
-1@@ -58,7 +58,9 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) hdr->size =2 ; ret =imx_scu_call_rpc (thermal_ipc_handle, &msg, true); -if (ret) +if (ret == -EPERM )/* NO POWER */ +return -EAGAIN ;Isn't there a chain call somewhere when the resource is turned off, so the thermal zone can be disabled?
Quoted 5 lines
A possible place in
drivers/firmware/imx/scu-pd.c. but I am not sure how to get thermal devices. I just found a APIthermal_zone_get_zone_by_name(). I am not sure if it is good to depend on "name", which add coupling between two drivers and if there are external thermal devices(such as) has the same name, it will wrong turn off.Correct
Quoted 6 lines
If add power domain notification in thermal driver, I am not how to get other devices's pd in thermal driver.
Any example I can refer?
Or this is simple enough solution.
The solution works for removing the error message but it does not solve the root cause of the issue. The thermal zone keeps monitoring while the sensor is down.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
So the question is why the sensor is shut down if it is in use?
Do you know if there are any code I reference? I supposed it is quite common.
Sorry, I don't get your comment
What I meant is why is the sensor turned off if it is in use ?
One typical example is cpu hotplug. The sensor is located CPU power domain. If CPU hotplug off, CPU power domain will be turn off.
It doesn't make sensor keep monitor such sensor when CPU already power off. It doesn't make sensor to keep CPU power on just because want to get sensor data.
Anthor example is GPU, if there are GPU0 and GPU1. Most case just GPU0 work. GPU1 may turn off when less loading.
Ideally, thermal can get notification from power domain driver. when such power domain turn off, disable thermal zone.
So far, I have not idea how to do that.
Quoted 8 lines
Quoted 5 lines
Ulf,
do you have a guidance to link the thermal zone and the power domain in order to get a poweron/off notification leading to enable/disable the thermal zone ?
I don't know the details here, so apologize for my ignorance to start with. What platform is this?
i.MX8QM.
Quoted 8 lines
A vague idea could be to hook up the thermal sensor to the corresponding CPU power domain. Assuming the CPU power domain is modelled as a genpd provider, then this allows the driver for the thermal sensor to register for power-on/off notifications of the genpd (see
dev_pm_genpd_add_notifier()).Can this work?
I don't think. dev_pm_genpd_ad_notifier() need a dev, which binded to pd.
tsens: thermal-sensor {
compatible = "fsl,imx-sc-thermal";
tsens-num = <6>;
#thermal-sensor-cells = <1>;
};we have 6 thermal-sensor, which assocated with 6 pd,
IMX_SC_R_SYSTEM, IMX_SC_R_PMIC_0,
IMX_SC_R_AP_0, IMX_SC_R_AP_1,
IMX_SC_R_GPU_0_PID0, IMX_SC_R_GPU_1_PID0,
IMX_SC_R_DRC_0We don't want to hold PD on just because want to get temperature. GPU pd consume much power.
I want to register one callback at thermal-sensor driver, when GPU pd on, enable thermal-zone. when GPU pd off, disable thermal zone.
we can do more common way.
gpu-thermal1 {
polling-delay-passive = <250>;
polling-delay = <2000>;
>>> pd=<&GPU1_PD>
thermal-sensors = <&tsens IMX_SC_R_GPU_1_PID0>;
};if GPU1_PD on, then gpu-thermal1 enable,
if GPU1_PD off, then gpu-thermal1 disable.
Quoted 3 lines
Kind regards
Uffe
Quoted 82 lines · Frank Li
Quoted 80 lines · Ulf Hansson
Quoted 79 lines · Daniel Lezcano
Quoted 67 lines · Frank Li
Quoted 51 lines · Daniel Lezcano
Quoted 50 lines · Frank Li
Quoted 49 lines · Daniel Lezcano
Hi Frank,
sorry for the delay
Quoted 24 lines · Frank Li
Quoted 9 lines · Daniel Lezcano
Quoted 8 lines · Frank Li
Avoid endless print following message when SCFW turns off resource.
[ 1818.342337] thermal thermal_zone0: failed to read out thermal zone (-1)Signed-off-by Frank Li <[email protected]>--- drivers/thermal/imx_sc_thermal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 13 lines
drivers/thermal/imx_sc_thermal.c static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) · line 61
Quoted 10 lines
drivers/thermal/imx_sc_thermal.c +2
-1@@ -58,7 +58,9 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) hdr->size =2 ; ret =imx_scu_call_rpc (thermal_ipc_handle, &msg, true); -if (ret) +if (ret == -EPERM )/* NO POWER */ +return -EAGAIN ;Isn't there a chain call somewhere when the resource is turned off, so the thermal zone can be disabled?
Quoted 5 lines
A possible place in
drivers/firmware/imx/scu-pd.c. but I am not sure how to get thermal devices. I just found a APIthermal_zone_get_zone_by_name(). I am not sure if it is good to depend on "name", which add coupling between two drivers and if there are external thermal devices(such as) has the same name, it will wrong turn off.Correct
Quoted 6 lines
If add power domain notification in thermal driver, I am not how to get other devices's pd in thermal driver.
Any example I can refer?
Or this is simple enough solution.
The solution works for removing the error message but it does not solve the root cause of the issue. The thermal zone keeps monitoring while the sensor is down.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
So the question is why the sensor is shut down if it is in use?
Do you know if there are any code I reference? I supposed it is quite common.
Sorry, I don't get your comment
What I meant is why is the sensor turned off if it is in use ?
One typical example is cpu hotplug. The sensor is located CPU power domain. If CPU hotplug off, CPU power domain will be turn off.
It doesn't make sensor keep monitor such sensor when CPU already power off. It doesn't make sensor to keep CPU power on just because want to get sensor data.
Quoted 7 lines
Anthor example is GPU, if there are GPU0 and GPU1. Most case just GPU0 work. GPU1 may turn off when less loading.
Ideally, thermal can get notification from power domain driver. when such power domain turn off, disable thermal zone.
So far, I have not idea how to do that.
Ulf,
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
do you have a guidance to link the thermal zone and the power domain in order to get a poweron/off notification leading to enable/disable the thermal zone ?
I don't know the details here, so apologize for my ignorance to start with. What platform is this?
i.MX8QM.
Thanks!
Quoted 11 lines
Quoted 9 lines
A vague idea could be to hook up the thermal sensor to the corresponding CPU power domain. Assuming the CPU power domain is modelled as a genpd provider, then this allows the driver for the thermal sensor to register for power-on/off notifications of the genpd (see
dev_pm_genpd_add_notifier()).Can this work?
I don't think.
dev_pm_genpd_ad_notifier()need a dev, which binded to pd.
Yes, correct.
Quoted 6 lines
tsens: thermal-sensor {
compatible = "fsl,imx-sc-thermal";
tsens-num = <6>;
#thermal-sensor-cells = <1>;
};Are you saying that the above doesn't have a corresponding struct device created for it? That sounds like a problem that can be fixed, right? Not sure if it makes sense though.
Quoted 9 lines
we have 6 thermal-sensor, which assocated with 6 pd,
IMX_SC_R_SYSTEM, IMX_SC_R_PMIC_0, IMX_SC_R_AP_0, IMX_SC_R_AP_1, IMX_SC_R_GPU_0_PID0, IMX_SC_R_GPU_1_PID0, IMX_SC_R_DRC_0We don't want to hold PD on just because want to get temperature. GPU pd consume much power.
Of course, that would be a bad idea it seems like.
The corresponding struct device that's hooked up to a genpd, can remain runtime suspended as long as you think it makes sense. Thus it would not keep the PM domain powered on when it isn't needed.
Quoted 3 lines
I want to register one callback at thermal-sensor driver, when GPU pd on, enable thermal-zone. when GPU pd off, disable thermal zone.
Right, that should work fine too, I think. It seems like this is just a matter of modelling this correctly in DT, I have no strong opinion in this regard.
Quoted 11 lines
we can do more common way.
gpu-thermal1 { polling-delay-passive = <250>; polling-delay = <2000>; >>> pd=<&GPU1_PD> thermal-sensors = <&tsens IMX_SC_R_GPU_1_PID0>; };
Quoted 3 lines
if
GPU1_PDon, then gpu-thermal1 enable,
ifGPU1_PDoff, then gpu-thermal1 disable.
Sounds like it's worth a try! Please keep me posted.
Kind regards
Uffe