From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Quentin Perret <quentin.perret@arm.com>
Cc: linux-pm@vger.kernel.org, Viresh Kumar <viresh.kumar@linaro.org>,
amit.kachhap@gmail.com, rjw@rjwysocki.net,
linux-kernel@vger.kernel.org, will.deacon@arm.com,
edubezval@gmail.com, mka@chromium.org, catalin.marinas@arm.com,
rui.zhang@intel.com, javi.merino@kernel.org,
ionela.voinescu@arm.com, dietmar.eggemann@arm.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 2/3] PM / EM: Expose perf domain struct
Date: Wed, 15 May 2019 13:07:36 +0200 [thread overview]
Message-ID: <a4c0ab68-f8d0-a70d-58e5-b8de55199000@linaro.org> (raw)
In-Reply-To: <20190515110156.ru2wxqvwffqgq3t3@queper01-lin>
On 15/05/2019 13:01, Quentin Perret wrote:
> On Wednesday 15 May 2019 at 12:51:57 (+0200), Daniel Lezcano wrote:
>> On 15/05/2019 12:46, Quentin Perret wrote:
>>> On Wednesday 15 May 2019 at 11:40:44 (+0100), Quentin Perret wrote:
>>
>> [ ... ]
>>
>>>> +#ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR
>>>> if (capacitance) {
>>>> ret = update_freq_table(cpufreq_cdev, capacitance);
>>>> if (ret) {
>>>> cdev = ERR_PTR(ret);
>>>> goto remove_ida;
>>>> }
>>>> -
>>>> - cooling_ops = &cpufreq_power_cooling_ops;
>>>> - } else {
>>>> - cooling_ops = &cpufreq_cooling_ops;
>>>> }
>>>> +#endif
>>>> + cooling_ops = &cpufreq_cooling_ops;
>>>
>>> Argh, that is actually broken with !capacitance and
>>> THERMAL_GOV_POWER_ALLOCATOR=y ... Perhaps it's best to keep the two
>>> thermal_cooling_device_ops struct separated in the end.
>>
>> Or alternatively you can keep one structure but instead of filling the
>> state2power,power2state and getrequestedpower fields in the declaration,
>> you fill them in the if (capacitance) block, no?
>
> Something like the below ? Yes, that works too. I'll write a proper
> patch and send that next week or so.
Yes, exactly. And IMHO, that helps for the understanding of code also.
> --->8---
>
> /* Bind cpufreq callbacks to thermal cooling device ops */
>
> static struct thermal_cooling_device_ops cpufreq_cooling_ops = {
> - .get_max_state = cpufreq_get_max_state,
> - .get_cur_state = cpufreq_get_cur_state,
> - .set_cur_state = cpufreq_set_cur_state,
> -};
> -
> -static struct thermal_cooling_device_ops cpufreq_power_cooling_ops = {
> .get_max_state = cpufreq_get_max_state,
> .get_cur_state = cpufreq_get_cur_state,
> .set_cur_state = cpufreq_set_cur_state,
> - .get_requested_power = cpufreq_get_requested_power,
> - .state2power = cpufreq_state2power,
> - .power2state = cpufreq_power2state,
> };
>
> /* Notifier for cpufreq policy change */
> @@ -674,18 +667,19 @@ __cpufreq_cooling_register(struct device_node *np,
> pr_debug("%s: freq:%u KHz\n", __func__, freq);
> }
>
> + cooling_ops = &cpufreq_cooling_ops;
> +#ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR
> if (capacitance) {
> ret = update_freq_table(cpufreq_cdev, capacitance);
> if (ret) {
> cdev = ERR_PTR(ret);
> goto remove_ida;
> }
> -
> - cooling_ops = &cpufreq_power_cooling_ops;
> - } else {
> - cooling_ops = &cpufreq_cooling_ops;
> + cooling_ops->get_requested_power = cpufreq_get_requested_power;
> + cooling_ops->state2power = cpufreq_state2power;
> + cooling_ops->power2state = cpufreq_power2state;
> }
> -
> +#endif
> cdev = thermal_of_cooling_device_register(np, dev_name, cpufreq_cdev,
> cooling_ops);
> if (IS_ERR(cdev))
>
--
<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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-05-15 11:07 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 8:23 [PATCH v4 0/3] Make IPA use PM_EM Quentin Perret
2019-05-15 8:23 ` [PATCH v4 1/3] arm64: defconfig: Enable CONFIG_ENERGY_MODEL Quentin Perret
2019-05-15 8:46 ` Daniel Lezcano
2019-05-15 9:22 ` Quentin Perret
2019-05-15 8:23 ` [PATCH v4 2/3] PM / EM: Expose perf domain struct Quentin Perret
2019-05-15 9:06 ` Daniel Lezcano
2019-05-15 9:17 ` Quentin Perret
2019-05-15 9:56 ` Daniel Lezcano
2019-05-15 10:07 ` Quentin Perret
2019-05-15 10:16 ` Daniel Lezcano
2019-05-15 10:22 ` Viresh Kumar
2019-05-15 10:40 ` Quentin Perret
2019-05-15 10:46 ` Quentin Perret
2019-05-15 10:51 ` Daniel Lezcano
2019-05-15 11:01 ` Quentin Perret
2019-05-15 11:07 ` Daniel Lezcano [this message]
2019-05-15 10:54 ` Daniel Lezcano
2019-05-15 10:57 ` Quentin Perret
2019-05-15 8:23 ` [PATCH v4 3/3] thermal: cpu_cooling: Migrate to using the EM framework Quentin Perret
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a4c0ab68-f8d0-a70d-58e5-b8de55199000@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=amit.kachhap@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=edubezval@gmail.com \
--cc=ionela.voinescu@arm.com \
--cc=javi.merino@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mka@chromium.org \
--cc=quentin.perret@arm.com \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
--cc=viresh.kumar@linaro.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox