linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: create cooling device based on ACPI
@ 2023-04-28  7:03 wangyouwan
  2023-04-28  9:56 ` Dhruva Gole
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: wangyouwan @ 2023-04-28  7:03 UTC (permalink / raw)
  To: rafael, viresh.kumar; +Cc: linux-pm, linux-kernel, youwan Wang

From: youwan Wang <wangyouwan@126.com>

When using the "scpi_cpufreq" driver, an error
occurs:cpufreq_cooling: OF node not available for cpu*.
The current computer motherboard is using ACPI firmware.
Go to see that the error is caused by calling the
"of_cpufreq_cooling_register" interface.
comment:create cpufreq cooling device based on DT.

Signed-off-by: youwan Wang <wangyouwan@126.com>
---
 drivers/cpufreq/cpufreq.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 6b52ebe5a890..3418c68959d5 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1528,8 +1528,13 @@ static int cpufreq_online(unsigned int cpu)
 	if (cpufreq_driver->ready)
 		cpufreq_driver->ready(policy);
 
-	if (cpufreq_thermal_control_enabled(cpufreq_driver))
+	if (cpufreq_thermal_control_enabled(cpufreq_driver)) {
+#ifdef CONFIG_ACPI
+		policy->cdev = cpufreq_cooling_register(policy);
+#else
 		policy->cdev = of_cpufreq_cooling_register(policy);
+#endif
+	}
 
 	pr_debug("initialization complete\n");
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] cpufreq: create cooling device based on ACPI
  2023-04-28  7:03 [PATCH] cpufreq: create cooling device based on ACPI wangyouwan
@ 2023-04-28  9:56 ` Dhruva Gole
  2023-05-10  8:48   ` wangyouwan
  2023-04-28 11:37 ` Rafael J. Wysocki
  2023-05-08  7:12 ` 回复: " Xinglong Yang
  2 siblings, 1 reply; 7+ messages in thread
From: Dhruva Gole @ 2023-04-28  9:56 UTC (permalink / raw)
  To: wangyouwan, rafael, viresh.kumar; +Cc: linux-pm, linux-kernel

Hi,

On 28/04/23 12:33, wangyouwan@126.com wrote:
> From: youwan Wang <wangyouwan@126.com>
> 
> When using the "scpi_cpufreq" driver, an error

Pardon, do you mean drivers/cpufreq/acpi-cpufreq.c ?

> occurs:cpufreq_cooling: OF node not available for cpu*.


If this is fixing some errors/ bugs, maybe add an appropriate fixes
tag?

> The current computer motherboard is using ACPI firmware.
> Go to see that the error is caused by calling the
> "of_cpufreq_cooling_register" interface.
> comment:create cpufreq cooling device based on DT.
> 
> Signed-off-by: youwan Wang <wangyouwan@126.com>
> ---
>   drivers/cpufreq/cpufreq.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
[...]
>   

-- 
Thanks and Regards,
Dhruva Gole

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] cpufreq: create cooling device based on ACPI
  2023-04-28  7:03 [PATCH] cpufreq: create cooling device based on ACPI wangyouwan
  2023-04-28  9:56 ` Dhruva Gole
@ 2023-04-28 11:37 ` Rafael J. Wysocki
  2023-05-10  7:51   ` wangyouwan
  2023-05-08  7:12 ` 回复: " Xinglong Yang
  2 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2023-04-28 11:37 UTC (permalink / raw)
  To: wangyouwan; +Cc: rafael, viresh.kumar, linux-pm, linux-kernel

On Fri, Apr 28, 2023 at 9:19 AM <wangyouwan@126.com> wrote:
>
> From: youwan Wang <wangyouwan@126.com>
>
> When using the "scpi_cpufreq" driver, an error
> occurs:cpufreq_cooling: OF node not available for cpu*.
> The current computer motherboard is using ACPI firmware.
> Go to see that the error is caused by calling the
> "of_cpufreq_cooling_register" interface.
> comment:create cpufreq cooling device based on DT.
>
> Signed-off-by: youwan Wang <wangyouwan@126.com>
> ---
>  drivers/cpufreq/cpufreq.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 6b52ebe5a890..3418c68959d5 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1528,8 +1528,13 @@ static int cpufreq_online(unsigned int cpu)
>         if (cpufreq_driver->ready)
>                 cpufreq_driver->ready(policy);
>
> -       if (cpufreq_thermal_control_enabled(cpufreq_driver))
> +       if (cpufreq_thermal_control_enabled(cpufreq_driver)) {
> +#ifdef CONFIG_ACPI
> +               policy->cdev = cpufreq_cooling_register(policy);
> +#else
>                 policy->cdev = of_cpufreq_cooling_register(policy);
> +#endif

Please avoid adding #ifdefs like this in random places.

Moreover, what if the kernel supports ACPI and the platform is DT-based?

> +       }
>
>         pr_debug("initialization complete\n");
>
> --

^ permalink raw reply	[flat|nested] 7+ messages in thread

* 回复: [PATCH] cpufreq: create cooling device based on ACPI
  2023-04-28  7:03 [PATCH] cpufreq: create cooling device based on ACPI wangyouwan
  2023-04-28  9:56 ` Dhruva Gole
  2023-04-28 11:37 ` Rafael J. Wysocki
@ 2023-05-08  7:12 ` Xinglong Yang
       [not found]   ` <205f534.5815.18804b3dd08.Coremail.wangyouwan@126.com>
  2 siblings, 1 reply; 7+ messages in thread
From: Xinglong Yang @ 2023-05-08  7:12 UTC (permalink / raw)
  To: wangyouwan; +Cc: linux-kernel

Does this patch need to be packaged with other patches?
Whether the function cpufreq_cooling_register is declared in cpufreq.c?

-----邮件原件-----
发件人: wangyouwan@126.com <wangyouwan@126.com>
发送时间: 2023年4月28日 15:03
收件人: rafael@kernel.org; viresh.kumar@linaro.org
抄送: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; youwan Wang <wangyouwan@126.com>
主题: [PATCH] cpufreq: create cooling device based on ACPI

EXTERNAL EMAIL

From: youwan Wang <wangyouwan@126.com>

When using the "scpi_cpufreq" driver, an error
occurs:cpufreq_cooling: OF node not available for cpu*.
The current computer motherboard is using ACPI firmware.
Go to see that the error is caused by calling the "of_cpufreq_cooling_register" interface.
comment:create cpufreq cooling device based on DT.

Signed-off-by: youwan Wang <wangyouwan@126.com>
---
 drivers/cpufreq/cpufreq.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 6b52ebe5a890..3418c68959d5 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1528,8 +1528,13 @@ static int cpufreq_online(unsigned int cpu)
        if (cpufreq_driver->ready)
                cpufreq_driver->ready(policy);

-       if (cpufreq_thermal_control_enabled(cpufreq_driver))
+       if (cpufreq_thermal_control_enabled(cpufreq_driver)) { #ifdef
+CONFIG_ACPI
+               policy->cdev = cpufreq_cooling_register(policy); #else
                policy->cdev = of_cpufreq_cooling_register(policy);
+#endif
+       }

        pr_debug("initialization complete\n");

--
2.25.1



This email (including its attachments) is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Unauthorized use, dissemination, distribution or copying of this email or the information herein or taking any action in reliance on the contents of this email or the information herein, by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is strictly prohibited. If you are not the intended recipient, please do not read, copy, use or disclose any part of this e-mail to others. Please notify the sender immediately and permanently delete this e-mail and any attachments if you received it in error. Internet communications cannot be guaranteed to be timely, secure, error-free or virus-free. The sender does not accept liability for any errors or omissions.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re:Re: [PATCH] cpufreq: create cooling device based on ACPI
  2023-04-28 11:37 ` Rafael J. Wysocki
@ 2023-05-10  7:51   ` wangyouwan
  0 siblings, 0 replies; 7+ messages in thread
From: wangyouwan @ 2023-05-10  7:51 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: viresh.kumar, linux-pm, linux-kernel


Okay, thank you for the reminder! 
If I make this change, I'm not sure if it will work. If it does, I'll submit a new patch.

--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1494,8 +1494,13 @@ static int cpufreq_online(unsigned int cpu)
        if (cpufreq_driver->ready)
                cpufreq_driver->ready(policy);
 
-       if (cpufreq_thermal_control_enabled(cpufreq_driver))
-               policy->cdev = of_cpufreq_cooling_register(policy);
+       if (cpufreq_thermal_control_enabled(cpufreq_driver)) {
+               struct device_node *np = of_get_cpu_node(policy->cpu, NULL);
+               if (np)
+                       policy->cdev = of_cpufreq_cooling_register(policy);
+               else
+                       policy->cdev = cpufreq_cooling_register(policy);

+       }













At 2023-04-28 19:37:26, "Rafael J. Wysocki" <rafael@kernel.org> wrote:
>On Fri, Apr 28, 2023 at 9:19 AM <wangyouwan@126.com> wrote:
>>
>> From: youwan Wang <wangyouwan@126.com>
>>
>> When using the "scpi_cpufreq" driver, an error
>> occurs:cpufreq_cooling: OF node not available for cpu*.
>> The current computer motherboard is using ACPI firmware.
>> Go to see that the error is caused by calling the
>> "of_cpufreq_cooling_register" interface.
>> comment:create cpufreq cooling device based on DT.
>>
>> Signed-off-by: youwan Wang <wangyouwan@126.com>
>> ---
>>  drivers/cpufreq/cpufreq.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index 6b52ebe5a890..3418c68959d5 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -1528,8 +1528,13 @@ static int cpufreq_online(unsigned int cpu)
>>         if (cpufreq_driver->ready)
>>                 cpufreq_driver->ready(policy);
>>
>> -       if (cpufreq_thermal_control_enabled(cpufreq_driver))
>> +       if (cpufreq_thermal_control_enabled(cpufreq_driver)) {
>> +#ifdef CONFIG_ACPI
>> +               policy->cdev = cpufreq_cooling_register(policy);
>> +#else
>>                 policy->cdev = of_cpufreq_cooling_register(policy);
>> +#endif
>
>Please avoid adding #ifdefs like this in random places.
>
>Moreover, what if the kernel supports ACPI and the platform is DT-based?
>
>> +       }
>>
>>         pr_debug("initialization complete\n");
>>
>> --

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re:回复: Re:回复: [PATCH] cpufreq: create cooling device based on ACPI
       [not found]     ` <PUZPR06MB5498536FCB73BD6D5BD928ECF0779@PUZPR06MB5498.apcprd06.prod.outlook.com>
@ 2023-05-10  8:45       ` wangyouwan
  0 siblings, 0 replies; 7+ messages in thread
From: wangyouwan @ 2023-05-10  8:45 UTC (permalink / raw)
  To: Xinglong Yang; +Cc: linux-kernel



thanks,i try



At 2023-05-10 16:26:14, "Xinglong Yang" <xinglong.yang@cixtech.com> wrote:



 P {margin-top:0;margin-bottom:0;} 




If you use ACPI firware, why you register cpu as cooling devices device in cpufreq_online
 function?







When
 the kernel use ACPI firmware, CPUs will be registed as cooling devices during the cpu initialization, please refs to the file "processor_driver.c"







That is not needed to register it again.  



发件人: wangyouwan <wangyouwan@126.com>

发送时间: 2023年5月10日 16:07

收件人: Xinglong Yang <xinglong.yang@cixtech.com>

主题: Re:回复: [PATCH] cpufreq: create cooling device based on ACPI

 




EXTERNAL EMAIL



yes , I'm using the 5.4 kernel, and the "scpi-cpufreq" function is used in the scpi_clocks_probe_acpi function.







At 2023-05-08 15:12:51, "Xinglong Yang" <xinglong.yang@cixtech.com> wrote:

>Does this patch need to be packaged with other patches?

>Whether the function cpufreq_cooling_register is declared in cpufreq.c?

>

>-----邮件原件-----

>发件人: wangyouwan@126.com <wangyouwan@126.com>

>发送时间: 2023年4月28日 15:03

>收件人: rafael@kernel.org; viresh.kumar@linaro.org

>抄送: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; youwan Wang <wangyouwan@126.com>

>主题: [PATCH] cpufreq: create cooling device based on ACPI

>

>EXTERNAL EMAIL

>

>From: youwan Wang <wangyouwan@126.com>

>

>When using the "scpi_cpufreq" driver, an error

>occurs:cpufreq_cooling: OF node not available for cpu*.

>The current computer motherboard is using ACPI firmware.

>Go to see that the error is caused by calling the "of_cpufreq_cooling_register" interface.

>comment:create cpufreq cooling device based on DT.

>

>Signed-off-by: youwan Wang <wangyouwan@126.com>

>---

> drivers/cpufreq/cpufreq.c | 7 ++++++-

> 1 file changed, 6 insertions(+), 1 deletion(-)

>

>diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 6b52ebe5a890..3418c68959d5 100644

>--- a/drivers/cpufreq/cpufreq.c

>+++ b/drivers/cpufreq/cpufreq.c

>@@ -1528,8 +1528,13 @@ static int cpufreq_online(unsigned int cpu)

>        if (cpufreq_driver->ready)

>                cpufreq_driver->ready(policy);

>

>-       if (cpufreq_thermal_control_enabled(cpufreq_driver))

>+       if (cpufreq_thermal_control_enabled(cpufreq_driver)) { #ifdef

>+CONFIG_ACPI

>+               policy->cdev = cpufreq_cooling_register(policy); #else

>                policy->cdev = of_cpufreq_cooling_register(policy);

>+#endif

>+       }

>

>        pr_debug("initialization complete\n");

>

>--

>2.25.1

>

>

>

>This email (including its attachments) is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Unauthorized use, dissemination, distribution or
 copying of this email or the information herein or taking any action in reliance on the contents of this email or the information herein, by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended
 recipient, is strictly prohibited. If you are not the intended recipient, please do not read, copy, use or disclose any part of this e-mail to others. Please notify the sender immediately and permanently delete this e-mail and any attachments if you received
 it in error. Internet communications cannot be guaranteed to be timely, secure, error-free or virus-free. The sender does not accept liability for any errors or omissions.








This email (including its attachments) is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Unauthorized use, dissemination,
 distribution or copying of this email or the information herein or taking any action in reliance on the contents of this email or the information herein, by anyone other than the intended recipient, or an employee or agent responsible for delivering the message
 to the intended recipient, is strictly prohibited. If you are not the intended recipient, please do not read, copy, use or disclose any part of this e-mail to others. Please notify the sender immediately and permanently delete this e-mail and any attachments
 if you received it in error. Internet communications cannot be guaranteed to be timely, secure, error-free or virus-free. The sender does not accept liability for any errors or omissions.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re:Re: [PATCH] cpufreq: create cooling device based on ACPI
  2023-04-28  9:56 ` Dhruva Gole
@ 2023-05-10  8:48   ` wangyouwan
  0 siblings, 0 replies; 7+ messages in thread
From: wangyouwan @ 2023-05-10  8:48 UTC (permalink / raw)
  To: Dhruva Gole; +Cc: rafael, viresh.kumar, linux-pm, linux-kernel



I'm sorry, but I'm using the 5.4 kernel, and the "scpi-cpufreq" function is used in the scpi_clocks_probe_acpi function.



At 2023-04-28 17:56:07, "Dhruva Gole" <d-gole@ti.com> wrote:
>Hi,
>
>On 28/04/23 12:33, wangyouwan@126.com wrote:
>> From: youwan Wang <wangyouwan@126.com>
>> 
>> When using the "scpi_cpufreq" driver, an error
>
>Pardon, do you mean drivers/cpufreq/acpi-cpufreq.c ?
>
>> occurs:cpufreq_cooling: OF node not available for cpu*.
>
>
>If this is fixing some errors/ bugs, maybe add an appropriate fixes
>tag?
>
>> The current computer motherboard is using ACPI firmware.
>> Go to see that the error is caused by calling the
>> "of_cpufreq_cooling_register" interface.
>> comment:create cpufreq cooling device based on DT.
>> 
>> Signed-off-by: youwan Wang <wangyouwan@126.com>
>> ---
>>   drivers/cpufreq/cpufreq.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>[...]
>>   
>
>-- 
>Thanks and Regards,
>Dhruva Gole

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-05-10  8:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-28  7:03 [PATCH] cpufreq: create cooling device based on ACPI wangyouwan
2023-04-28  9:56 ` Dhruva Gole
2023-05-10  8:48   ` wangyouwan
2023-04-28 11:37 ` Rafael J. Wysocki
2023-05-10  7:51   ` wangyouwan
2023-05-08  7:12 ` 回复: " Xinglong Yang
     [not found]   ` <205f534.5815.18804b3dd08.Coremail.wangyouwan@126.com>
     [not found]     ` <PUZPR06MB5498536FCB73BD6D5BD928ECF0779@PUZPR06MB5498.apcprd06.prod.outlook.com>
2023-05-10  8:45       ` Re:回复: " wangyouwan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).