Re: [PATCH 1/1] thermal/drivers/imx_sc_thermal: return -EAGAIN when SCFW turn off resource

From: Daniel Lezcano
Date: Thu Aug 17 2023 - 11:23:21 EST



Hi Ulf,

thanks for your answer

On 16/08/2023 23:23, Ulf Hansson wrote:
On Wed, 16 Aug 2023 at 22:46, Daniel Lezcano <daniel.lezcano@xxxxxxxxxx> wrote:

[ ... ]

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?

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.

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

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?



--
<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