All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: "cpufreq@vger.kernel.org" <cpufreq@vger.kernel.org>,
	Linux PM list <linux-pm@vger.kernel.org>,
	Jonghwa Lee <jonghwa3.lee@samsung.com>,
	Lukasz Majewski <l.majewski@samsung.com>,
	Lukasz Majewski <l.majewski@majess.pl>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Myungjoo Ham <myungjoo.ham@samsung.com>,
	Tomasz Figa <t.figa@samsung.com>,
	Thomas Abraham <ta.omasab@gmail.com>,
	thomas.ab@samsung.com,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	linux-samsung-soc@vger.kernel.org
Subject: [RFC v3 1/5] cpufreq:LAB:ondemand Adjust ondemand to be able to reuse its methods
Date: Tue, 04 Mar 2014 11:27:28 +0100	[thread overview]
Message-ID: <1393928852-22725-2-git-send-email-l.majewski@samsung.com> (raw)
In-Reply-To: <1393928852-22725-1-git-send-email-l.majewski@samsung.com>

Ondemand code needed to be slightly adjusted to allow its reusage.
Mostly one needed to remove static qualifiers and provide some hacks to
allow its working with LAB.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
---
 drivers/cpufreq/cpufreq_governor.h |   10 ++++++++++
 drivers/cpufreq/cpufreq_ondemand.c |   24 ++++++++++++++++--------
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index bfb9ae1..34b1cf2 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -270,4 +270,14 @@ void od_register_powersave_bias_handler(unsigned int (*f)
 		(struct cpufreq_policy *, unsigned int, unsigned int),
 		unsigned int powersave_bias);
 void od_unregister_powersave_bias_handler(void);
+
+/* COMMON CODE FOR DEMAND BASED SWITCHING */
+void od_dbs_timer(struct work_struct *work);
+int od_init(struct dbs_data *dbs_data);
+void od_exit(struct dbs_data *dbs_data);
+void od_check_cpu(int cpu, unsigned int load_freq);
+void update_sampling_rate(struct dbs_data *dbs_data,
+			  unsigned int new_rate);
+
+extern struct od_ops od_ops;
 #endif /* _CPUFREQ_GOVERNOR_H */
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 18d4091..a27326d 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -27,9 +27,9 @@
 #define MIN_FREQUENCY_UP_THRESHOLD		(11)
 #define MAX_FREQUENCY_UP_THRESHOLD		(100)
 
-static DEFINE_PER_CPU(struct od_cpu_dbs_info_s, od_cpu_dbs_info);
+DEFINE_PER_CPU(struct od_cpu_dbs_info_s, od_cpu_dbs_info);
 
-static struct od_ops od_ops;
+struct od_ops od_ops;
 
 #ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND
 static struct cpufreq_governor cpufreq_gov_ondemand;
@@ -152,7 +152,7 @@ static void dbs_freq_increase(struct cpufreq_policy *policy, unsigned int freq)
  * (default), then we try to increase frequency. Else, we adjust the frequency
  * proportional to load.
  */
-static void od_check_cpu(int cpu, unsigned int load)
+void od_check_cpu(int cpu, unsigned int load)
 {
 	struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
 	struct cpufreq_policy *policy = dbs_info->cdbs.cur_policy;
@@ -188,7 +188,7 @@ static void od_check_cpu(int cpu, unsigned int load)
 	}
 }
 
-static void od_dbs_timer(struct work_struct *work)
+void od_dbs_timer(struct work_struct *work)
 {
 	struct od_cpu_dbs_info_s *dbs_info =
 		container_of(work, struct od_cpu_dbs_info_s, cdbs.work.work);
@@ -233,6 +233,9 @@ max_delay:
 /************************** sysfs interface ************************/
 static struct common_dbs_data od_dbs_cdata;
 
+#ifdef CONFIG_CPU_FREQ_GOV_LAB
+extern struct cpufreq_governor cpufreq_gov_lab;
+#endif
 /**
  * update_sampling_rate - update sampling rate effective immediately if needed.
  * @new_rate: new sampling rate
@@ -246,7 +249,7 @@ static struct common_dbs_data od_dbs_cdata;
  * reducing the sampling rate, we need to make the new value effective
  * immediately.
  */
-static void update_sampling_rate(struct dbs_data *dbs_data,
+void update_sampling_rate(struct dbs_data *dbs_data,
 		unsigned int new_rate)
 {
 	struct od_dbs_tuners *od_tuners = dbs_data->tuners;
@@ -263,7 +266,12 @@ static void update_sampling_rate(struct dbs_data *dbs_data,
 		policy = cpufreq_cpu_get(cpu);
 		if (!policy)
 			continue;
+#ifdef CONFIG_CPU_FREQ_GOV_LAB
+		if (policy->governor != &cpufreq_gov_ondemand &&
+		    policy->governor != &cpufreq_gov_lab) {
+#else
 		if (policy->governor != &cpufreq_gov_ondemand) {
+#endif
 			cpufreq_cpu_put(policy);
 			continue;
 		}
@@ -472,7 +480,7 @@ static struct attribute_group od_attr_group_gov_pol = {
 
 /************************** sysfs end ************************/
 
-static int od_init(struct dbs_data *dbs_data)
+int od_init(struct dbs_data *dbs_data)
 {
 	struct od_dbs_tuners *tuners;
 	u64 idle_time;
@@ -514,14 +522,14 @@ static int od_init(struct dbs_data *dbs_data)
 	return 0;
 }
 
-static void od_exit(struct dbs_data *dbs_data)
+void od_exit(struct dbs_data *dbs_data)
 {
 	kfree(dbs_data->tuners);
 }
 
 define_get_cpu_dbs_routines(od_cpu_dbs_info);
 
-static struct od_ops od_ops = {
+struct od_ops od_ops = {
 	.powersave_bias_init_cpu = ondemand_powersave_bias_init_cpu,
 	.powersave_bias_target = generic_powersave_bias_target,
 	.freq_increase = dbs_freq_increase,
-- 
1.7.10.4


  reply	other threads:[~2014-03-04 10:28 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03 14:07 [RFC v2 0/3] LAB: Support for Legacy Application Booster governor Jonghwa Lee
2013-05-03 14:07 ` [RFC v2 1/3] cpufreq:overclocking: Overclocking support at Exynos4 SoC Jonghwa Lee
2013-05-03 14:07 ` [RFC v2 2/3] cpufreq:LAB: Introduce new cpufreq LAB(Legacy Application Boost) governor Jonghwa Lee
2013-05-03 14:07 ` [RFC v2 3/3] cpufreq:LAB: Modify cpufreq_governor to support LAB Governor Jonghwa Lee
2013-05-22  9:07 ` [RFC v2 0/3] LAB: Support for Legacy Application Booster governor Viresh Kumar
2013-05-22 10:27   ` Lukasz Majewski
2013-05-22 11:16     ` Viresh Kumar
2013-05-22 12:05       ` Lukasz Majewski
2013-05-22 14:44       ` [RFC v2 0/3][TESTS] LAB: Support for Legacy Application Booster governor - tests results Lukasz Majewski
2013-05-24  5:56         ` Lukasz Majewski
2013-05-24  7:52           ` Viresh Kumar
2013-05-24  8:30             ` Lukasz Majewski
2013-05-24  8:51               ` Viresh Kumar
2013-05-24  9:06                 ` Daniel Lezcano
2013-05-24  9:06                   ` Daniel Lezcano
2013-05-24  9:13                   ` Viresh Kumar
2013-05-24 10:28                     ` Daniel Lezcano
2013-05-24 10:28                       ` Daniel Lezcano
2013-05-24 10:32                       ` Viresh Kumar
2013-05-24 11:34                     ` Lukasz Majewski
2013-05-24 11:20                 ` Lukasz Majewski
2013-05-27  5:33                   ` Viresh Kumar
2013-05-27  7:34                     ` Lukasz Majewski
2013-05-27 12:00                     ` Rafael J. Wysocki
2013-05-27 12:16                       ` Lukasz Majewski
2013-05-27 13:24                       ` Viresh Kumar
2013-05-27 19:48                         ` Rafael J. Wysocki
2013-05-28  6:40                           ` Lukasz Majewski
2013-05-28  9:44                             ` Viresh Kumar
2013-05-28 12:30                               ` Rafael J. Wysocki
2013-05-28 13:26                                 ` Lukasz Majewski
2013-05-28 21:48                                   ` Rafael J. Wysocki
2013-05-29  5:23                                     ` Viresh Kumar
2013-05-29  7:09                                       ` Lukasz Majewski
2013-05-29  7:39                                         ` Viresh Kumar
2013-05-29 13:45                                           ` Lukasz Majewski
2014-03-04 10:27 ` [RFC v3 0/5] cpufreq:LAB: Support for LAB governor Lukasz Majewski
2014-03-04 10:27   ` Lukasz Majewski
2014-03-04 10:27   ` Lukasz Majewski [this message]
2014-03-04 10:27     ` [RFC v3 1/5] cpufreq:LAB:ondemand Adjust ondemand to be able to reuse its methods Lukasz Majewski
2014-03-04 10:27   ` [RFC v3 2/5] cpufreq:LAB:cpufreq_governor Adjust cpufreq_governor.[h|c] to support LAB Lukasz Majewski
2014-03-04 10:27     ` Lukasz Majewski
2014-03-04 10:27   ` [RFC v3 3/5] cpufreq:LAB:lab Add LAB governor code Lukasz Majewski
2014-03-04 10:27     ` Lukasz Majewski
2014-03-04 10:27   ` [RFC v3 4/5] cpufreq:LAB:Kconfig Add LAB definitions to Kconfig Lukasz Majewski
2014-03-04 10:27     ` Lukasz Majewski
2014-03-04 10:27   ` [RFC v3 5/5] cpufreq:LAB:dts:trats2: Add DTS nodes for LAB governor Lukasz Majewski
2014-03-04 10:27     ` Lukasz Majewski
2014-03-17 15:38   ` [RFC v3 0/5] cpufreq:LAB: Support " Lukasz Majewski
2014-03-17 15:38     ` Lukasz Majewski
2014-03-17 15:38     ` Lukasz Majewski
2014-03-18  6:55     ` Viresh Kumar
2014-03-18  6:55       ` Viresh Kumar
2014-03-18  6:55       ` Viresh Kumar
2014-03-18  9:17       ` Lukasz Majewski
2014-03-18  9:17         ` Lukasz Majewski
2014-03-18  9:17         ` Lukasz Majewski
2014-03-24  6:47         ` Lukasz Majewski
2014-03-24  6:47           ` Lukasz Majewski
2014-03-24  6:47           ` Lukasz Majewski
2014-03-24  6:51           ` Viresh Kumar
2014-03-24  6:51             ` Viresh Kumar
2014-03-24  6:51             ` Viresh Kumar
2014-03-24  8:48   ` Viresh Kumar
2014-03-24  8:48     ` Viresh Kumar
2014-03-24  8:48     ` Viresh Kumar
2014-03-24 10:00     ` Lukasz Majewski
2014-03-24 10:00       ` Lukasz Majewski
2014-03-24 10:00       ` Lukasz Majewski
2014-03-24 10:15       ` Viresh Kumar
2014-03-24 10:15         ` Viresh Kumar
2014-03-24 10:15         ` Viresh Kumar

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=1393928852-22725-2-git-send-email-l.majewski@samsung.com \
    --to=l.majewski@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=jonghwa3.lee@samsung.com \
    --cc=l.majewski@majess.pl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=rjw@rjwysocki.net \
    --cc=t.figa@samsung.com \
    --cc=ta.omasab@gmail.com \
    --cc=thomas.ab@samsung.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.