aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/devfreq.h
diff options
context:
space:
mode:
authorMyungJoo Ham <myungjoo.ham@samsung.com>2011-10-01 18:19:34 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-10-01 18:19:34 -0400
commitce26c5bb9569d8b826f01b8620fc16d8da6821e9 (patch)
tree3960fee73ec26f939295c92a231a09abcb4c816e /include/linux/devfreq.h
parent9005b65099ee4f14b6be691c4574612fe947531a (diff)
PM / devfreq: Add basic governors
Four cpufreq-like governors are provided as examples. powersave: use the lowest frequency possible. The user (device) should set the polling_ms as 0 because polling is useless for this governor. performance: use the highest freqeuncy possible. The user (device) should set the polling_ms as 0 because polling is useless for this governor. userspace: use the user specified frequency stored at devfreq.user_set_freq. With sysfs support in the following patch, a user may set the value with the sysfs interface. simple_ondemand: simplified version of cpufreq's ondemand governor. When a user updates OPP entries (enable/disable/add), OPP framework automatically notifies devfreq to update operating frequency accordingly. Thus, devfreq users (device drivers) do not need to update devfreq manually with OPP entry updates or set polling_ms for powersave , performance, userspace, or any other "static" governors. Note that these are given only as basic examples for governors and any devices with devfreq may implement their own governors with the drivers and use them. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Mike Turquette <mturquette@ti.com> Acked-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'include/linux/devfreq.h')
-rw-r--r--include/linux/devfreq.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index b3be3d3cbaa7..afb94583960c 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -166,6 +166,36 @@ extern int devfreq_register_opp_notifier(struct device *dev,
166extern int devfreq_unregister_opp_notifier(struct device *dev, 166extern int devfreq_unregister_opp_notifier(struct device *dev,
167 struct devfreq *devfreq); 167 struct devfreq *devfreq);
168 168
169#ifdef CONFIG_DEVFREQ_GOV_POWERSAVE
170extern const struct devfreq_governor devfreq_powersave;
171#endif
172#ifdef CONFIG_DEVFREQ_GOV_PERFORMANCE
173extern const struct devfreq_governor devfreq_performance;
174#endif
175#ifdef CONFIG_DEVFREQ_GOV_USERSPACE
176extern const struct devfreq_governor devfreq_userspace;
177#endif
178#ifdef CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND
179extern const struct devfreq_governor devfreq_simple_ondemand;
180/**
181 * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq
182 * and devfreq_add_device
183 * @ upthreshold If the load is over this value, the frequency jumps.
184 * Specify 0 to use the default. Valid value = 0 to 100.
185 * @ downdifferential If the load is under upthreshold - downdifferential,
186 * the governor may consider slowing the frequency down.
187 * Specify 0 to use the default. Valid value = 0 to 100.
188 * downdifferential < upthreshold must hold.
189 *
190 * If the fed devfreq_simple_ondemand_data pointer is NULL to the governor,
191 * the governor uses the default values.
192 */
193struct devfreq_simple_ondemand_data {
194 unsigned int upthreshold;
195 unsigned int downdifferential;
196};
197#endif
198
169#else /* !CONFIG_PM_DEVFREQ */ 199#else /* !CONFIG_PM_DEVFREQ */
170static struct devfreq *devfreq_add_device(struct device *dev, 200static struct devfreq *devfreq_add_device(struct device *dev,
171 struct devfreq_dev_profile *profile, 201 struct devfreq_dev_profile *profile,
@@ -198,6 +228,11 @@ static int devfreq_unregister_opp_notifier(struct device *dev,
198 return -EINVAL; 228 return -EINVAL;
199} 229}
200 230
231#define devfreq_powersave NULL
232#define devfreq_performance NULL
233#define devfreq_userspace NULL
234#define devfreq_simple_ondemand NULL
235
201#endif /* CONFIG_PM_DEVFREQ */ 236#endif /* CONFIG_PM_DEVFREQ */
202 237
203#endif /* __LINUX_DEVFREQ_H__ */ 238#endif /* __LINUX_DEVFREQ_H__ */