linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Shin <jacob.shin@amd.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Jacob Shin <jacob.shin@amd.com>
Subject: [PATCH V2 1/2] cpufreq: ondemand: allow custom powersave_bias_target function to be registered
Date: Thu, 28 Mar 2013 13:24:16 -0500	[thread overview]
Message-ID: <1364495057-14939-2-git-send-email-jacob.shin@amd.com> (raw)
In-Reply-To: <1364495057-14939-1-git-send-email-jacob.shin@amd.com>

This allows for another [arch specific] driver to hook into existing
powersave bias function of the ondemand governor. i.e. This allows AMD
specific powersave bias function (in a separate AMD specific driver)
to aid ondemand governor's frequency transition deicisions.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>
---
 drivers/cpufreq/cpufreq_governor.h |    3 +++
 drivers/cpufreq/cpufreq_ondemand.c |   22 +++++++++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index c83cabf..4b6808f 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -262,4 +262,7 @@ bool need_load_eval(struct cpu_dbs_common_info *cdbs,
 		unsigned int sampling_rate);
 int cpufreq_governor_dbs(struct cpufreq_policy *policy,
 		struct common_dbs_data *cdata, unsigned int event);
+void od_register_powersave_bias_function(unsigned int (*f)
+		(struct cpufreq_policy *, unsigned int, unsigned int));
+void od_unregister_powersave_bias_function(void);
 #endif /* _CPUFREQ_GOVERNER_H */
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 15e80ee..36f0798 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -40,6 +40,8 @@
 
 static DEFINE_PER_CPU(struct od_cpu_dbs_info_s, od_cpu_dbs_info);
 
+static struct od_ops od_ops;
+
 #ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND
 static struct cpufreq_governor cpufreq_gov_ondemand;
 #endif
@@ -145,7 +147,8 @@ static void dbs_freq_increase(struct cpufreq_policy *p, unsigned int freq)
 	struct od_dbs_tuners *od_tuners = dbs_data->tuners;
 
 	if (od_tuners->powersave_bias)
-		freq = powersave_bias_target(p, freq, CPUFREQ_RELATION_H);
+		freq = od_ops.powersave_bias_target(p, freq,
+				CPUFREQ_RELATION_H);
 	else if (p->cur == p->max)
 		return;
 
@@ -206,8 +209,8 @@ static void od_check_cpu(int cpu, unsigned int load_freq)
 			__cpufreq_driver_target(policy, freq_next,
 					CPUFREQ_RELATION_L);
 		} else {
-			int freq = powersave_bias_target(policy, freq_next,
-					CPUFREQ_RELATION_L);
+			int freq = od_ops.powersave_bias_target(policy,
+					freq_next, CPUFREQ_RELATION_L);
 			__cpufreq_driver_target(policy, freq,
 					CPUFREQ_RELATION_L);
 		}
@@ -565,6 +568,19 @@ static struct common_dbs_data od_dbs_cdata = {
 	.exit = od_exit,
 };
 
+void od_register_powersave_bias_function(unsigned int (*f)
+		(struct cpufreq_policy *, unsigned int, unsigned int))
+{
+	od_ops.powersave_bias_target = f;
+}
+EXPORT_SYMBOL_GPL(od_register_powersave_bias_function);
+
+void od_unregister_powersave_bias_function(void)
+{
+	od_ops.powersave_bias_target = powersave_bias_target;
+}
+EXPORT_SYMBOL_GPL(od_unregister_powersave_bias_function);
+
 static int od_cpufreq_governor_dbs(struct cpufreq_policy *policy,
 		unsigned int event)
 {
-- 
1.7.9.5

  reply	other threads:[~2013-03-28 18:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28 18:24 [PATCH V2 0/2] cpufreq: ondemand: add AMD specific powersave bias Jacob Shin
2013-03-28 18:24 ` Jacob Shin [this message]
2013-04-02 12:43   ` [PATCH V2 1/2] cpufreq: ondemand: allow custom powersave_bias_target function to be registered Borislav Petkov
2013-04-02 14:35     ` Jacob Shin
2013-04-02 13:31   ` Borislav Petkov
2013-03-28 18:24 ` [PATCH V2 2/2] cpufreq: AMD "frequency sensitivity feedback" powersave bias for ondemand governor Jacob Shin
2013-04-02 11:40   ` Thomas Renninger
2013-04-02 12:49     ` Borislav Petkov
2013-04-02 14:34     ` Jacob Shin
2013-04-02 13:42   ` Borislav Petkov
2013-04-02 17:18     ` Jacob Shin
2013-03-29  2:48 ` [PATCH V2 0/2] cpufreq: ondemand: add AMD specific powersave bias Viresh Kumar
2013-04-01 19:38   ` Jacob Shin
2013-04-01 20:43     ` Rafael J. Wysocki

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=1364495057-14939-2-git-send-email-jacob.shin@amd.com \
    --to=jacob.shin@amd.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=viresh.kumar@linaro.org \
    /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).