From: Viresh Kumar <viresh.kumar@linaro.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: rafael.j.wysocki@intel.com, linux-pm@vger.kernel.org,
prarit@redhat.com, trenn@suse.de
Subject: Re: [PATCH v2 1/4] cpufreq: Add configurable generic policies
Date: Wed, 9 Dec 2015 07:48:04 +0530 [thread overview]
Message-ID: <20151209021804.GR3692@ubuntu> (raw)
In-Reply-To: <1449613890-10403-2-git-send-email-srinivas.pandruvada@linux.intel.com>
On 08-12-15, 14:31, Srinivas Pandruvada wrote:
> For drivers using cpufreq_driver->setpolicy callback, by default two
> policies are available (performance and powersave). The client drivers
> can't change them, even if there is no support for a policy.
> This change adds a new field "available_policies" in the struct
> cpufreq_policy. The client driver can optionally set this field during
> init() callback. If the client driver doesn't set this field then the
> default policies are "performance powersave" matching current
> implementation.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> drivers/cpufreq/cpufreq.c | 9 ++++++++-
> include/linux/cpufreq.h | 1 +
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 8412ce5..286eaec 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -688,7 +688,10 @@ static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy,
> struct cpufreq_governor *t;
>
> if (!has_target()) {
> - i += sprintf(buf, "performance powersave");
> + if (policy->available_policies & CPUFREQ_POLICY_PERFORMANCE)
> + i += sprintf(buf, "performance ");
> + if (policy->available_policies & CPUFREQ_POLICY_POWERSAVE)
> + i += sprintf(&buf[i], "powersave ");
> goto out;
> }
>
> @@ -966,6 +969,10 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy)
>
> memcpy(&new_policy, policy, sizeof(*policy));
>
> + if (!policy->available_policies)
> + policy->available_policies = CPUFREQ_POLICY_PERFORMANCE |
> + CPUFREQ_POLICY_POWERSAVE;
> +
> /* Update governor of new_policy to the governor used before hotplug */
> gov = find_governor(policy->last_governor);
> if (gov)
> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index 177c768..7cc17df 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -76,6 +76,7 @@ struct cpufreq_policy {
> unsigned int restore_freq; /* = policy->cur before transition */
> unsigned int suspend_freq; /* freq to set during suspend */
>
> + u8 available_policies;
> unsigned int policy; /* see above */
> unsigned int last_policy; /* policy before unplug */
> struct cpufreq_governor *governor; /* see below */
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
next prev parent reply other threads:[~2015-12-09 2:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-08 22:31 [PATCH v2 0/4] cpufreq governors and Intel P state driver compatibility Srinivas Pandruvada
2015-12-08 22:31 ` [PATCH v2 1/4] cpufreq: Add configurable generic policies Srinivas Pandruvada
2015-12-09 2:18 ` Viresh Kumar [this message]
2015-12-08 22:31 ` [PATCH v2 2/4] cpufreq: Add ondemand as a generic policy Srinivas Pandruvada
2015-12-08 22:31 ` [PATCH v2 3/4] Documentation: cpu-freq: update setpolicy documentation Srinivas Pandruvada
2015-12-09 2:19 ` Viresh Kumar
2015-12-08 22:31 ` [PATCH v2 4/4] cpufreq: intel_pstate: Change powersave to ondemand policy Srinivas Pandruvada
2015-12-08 23:45 ` [PATCH v2 0/4] cpufreq governors and Intel P state driver compatibility Prarit Bhargava
2015-12-08 23:57 ` Srinivas Pandruvada
2015-12-09 13:12 ` Prarit Bhargava
2015-12-09 16:18 ` Srinivas Pandruvada
2015-12-16 19:33 ` Srinivas Pandruvada
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=20151209021804.GR3692@ubuntu \
--to=viresh.kumar@linaro.org \
--cc=linux-pm@vger.kernel.org \
--cc=prarit@redhat.com \
--cc=rafael.j.wysocki@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=trenn@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).