aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/devfreq/governor_userspace.c
diff options
context:
space:
mode:
authorMyungJoo Ham <myungjoo.ham@samsung.com>2011-12-09 02:42:19 -0500
committerMyungJoo Ham <myungjoo.ham@samsung.com>2012-01-19 20:12:38 -0500
commit6530b9dea1b7f33eaf79ba625e3a99f2455f3eb1 (patch)
tree70beddf04779d5941ba6ef851b30e02c7fa0c86c /drivers/devfreq/governor_userspace.c
parenta95e1f5dbca385908aa4087bb98470b0e0ac58d8 (diff)
PM / devfreq: add min/max_freq limit requested by users.
The frequency requested to devfreq device driver from devfreq governors is restricted by min_freq and max_freq input. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'drivers/devfreq/governor_userspace.c')
-rw-r--r--drivers/devfreq/governor_userspace.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/devfreq/governor_userspace.c b/drivers/devfreq/governor_userspace.c
index 4f8b563da782..0681246fc89d 100644
--- a/drivers/devfreq/governor_userspace.c
+++ b/drivers/devfreq/governor_userspace.c
@@ -25,10 +25,19 @@ static int devfreq_userspace_func(struct devfreq *df, unsigned long *freq)
25{ 25{
26 struct userspace_data *data = df->data; 26 struct userspace_data *data = df->data;
27 27
28 if (!data->valid) 28 if (data->valid) {
29 unsigned long adjusted_freq = data->user_frequency;
30
31 if (df->max_freq && adjusted_freq > df->max_freq)
32 adjusted_freq = df->max_freq;
33
34 if (df->min_freq && adjusted_freq < df->min_freq)
35 adjusted_freq = df->min_freq;
36
37 *freq = adjusted_freq;
38 } else {
29 *freq = df->previous_freq; /* No user freq specified yet */ 39 *freq = df->previous_freq; /* No user freq specified yet */
30 else 40 }
31 *freq = data->user_frequency;
32 return 0; 41 return 0;
33} 42}
34 43