2 * drivers/cpufreq/cpufreq_interactive.c
4 * Copyright (C) 2010 Google, Inc.
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * Author: Mike Chan (mike@android.com)
19 #include <linux/cpu.h>
20 #include <linux/cpumask.h>
21 #include <linux/cpufreq.h>
22 #include <linux/module.h>
23 #include <linux/mutex.h>
24 #include <linux/sched.h>
25 #include <linux/sched/rt.h>
26 #include <linux/tick.h>
27 #include <linux/time.h>
28 #include <linux/timer.h>
29 #include <linux/workqueue.h>
30 #include <linux/kthread.h>
31 #include <linux/mutex.h>
32 #include <linux/slab.h>
33 #include <linux/input.h>
35 #define CREATE_TRACE_POINTS
36 #include <trace/events/cpufreq_interactive.h>
38 #include <asm/cputime.h>
40 static atomic_t active_count = ATOMIC_INIT(0);
42 struct cpufreq_interactive_cpuinfo {
43 struct timer_list cpu_timer;
50 u64 target_set_time_in_idle;
51 u64 target_validate_time;
52 u64 target_validate_time_in_idle;
53 struct cpufreq_policy *policy;
54 struct cpufreq_frequency_table *freq_table;
55 unsigned int target_freq;
59 static DEFINE_PER_CPU(struct cpufreq_interactive_cpuinfo, cpuinfo);
61 /* Workqueues handle frequency scaling */
62 static struct task_struct *up_task;
63 static struct workqueue_struct *down_wq;
64 static struct work_struct freq_scale_down_work;
65 static cpumask_t up_cpumask;
66 static spinlock_t up_cpumask_lock;
67 static cpumask_t down_cpumask;
68 static spinlock_t down_cpumask_lock;
69 static struct mutex set_speed_lock;
71 /* Hi speed to bump to from lo speed when load burst (default max) */
72 static u64 hispeed_freq;
74 /* Go to hi speed when CPU load at or above this value. */
75 #define DEFAULT_GO_HISPEED_LOAD 85
76 static unsigned long go_hispeed_load;
79 * The minimum amount of time to spend at a frequency before we can ramp down.
81 #define DEFAULT_MIN_SAMPLE_TIME (80 * USEC_PER_MSEC)
82 static unsigned long min_sample_time;
85 * The sample rate of the timer used to increase frequency
87 #define DEFAULT_TIMER_RATE (20 * USEC_PER_MSEC)
88 static unsigned long timer_rate;
91 * Wait this long before raising speed above hispeed, by default a single
94 #define DEFAULT_ABOVE_HISPEED_DELAY DEFAULT_TIMER_RATE
95 static unsigned long above_hispeed_delay_val;
98 * Boost to hispeed on touchscreen input.
101 static int input_boost_val;
103 struct cpufreq_interactive_inputopen {
104 struct input_handle *handle;
105 struct work_struct inputopen_work;
108 static struct cpufreq_interactive_inputopen inputopen;
110 static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
113 #ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE
116 struct cpufreq_governor cpufreq_gov_interactive = {
117 .name = "interactive",
118 .governor = cpufreq_governor_interactive,
119 .max_transition_latency = 10000000,
120 .owner = THIS_MODULE,
123 static void cpufreq_interactive_timer(unsigned long data)
125 unsigned int delta_idle;
126 unsigned int delta_time;
128 int load_since_change;
131 struct cpufreq_interactive_cpuinfo *pcpu =
132 &per_cpu(cpuinfo, data);
134 unsigned int new_freq;
140 if (!pcpu->governor_enabled)
144 * Once pcpu->timer_run_time is updated to >= pcpu->idle_exit_time,
145 * this lets idle exit know the current idle time sample has
146 * been processed, and idle exit can generate a new sample and
147 * re-arm the timer. This prevents a concurrent idle
148 * exit on that CPU from writing a new set of info at the same time
149 * the timer function runs (the timer function can't use that info
150 * until more time passes).
152 time_in_idle = pcpu->time_in_idle;
153 idle_exit_time = pcpu->idle_exit_time;
154 now_idle = get_cpu_idle_time_us(data, &pcpu->timer_run_time);
157 /* If we raced with cancelling a timer, skip. */
161 delta_idle = (unsigned int)(now_idle - time_in_idle);
162 delta_time = (unsigned int)(pcpu->timer_run_time - idle_exit_time);
165 * If timer ran less than 1ms after short-term sample started, retry.
167 if (delta_time < 1000)
170 if (delta_idle > delta_time)
173 cpu_load = 100 * (delta_time - delta_idle) / delta_time;
175 delta_idle = (unsigned int)(now_idle - pcpu->target_set_time_in_idle);
176 delta_time = (unsigned int)(pcpu->timer_run_time -
177 pcpu->target_set_time);
179 if ((delta_time == 0) || (delta_idle > delta_time))
180 load_since_change = 0;
183 100 * (delta_time - delta_idle) / delta_time;
186 * Choose greater of short-term load (since last idle timer
187 * started or timer function re-armed itself) or long-term load
188 * (since last frequency change).
190 if (load_since_change > cpu_load)
191 cpu_load = load_since_change;
193 if (cpu_load >= go_hispeed_load) {
194 if (pcpu->target_freq <= pcpu->policy->min) {
195 new_freq = hispeed_freq;
197 new_freq = pcpu->policy->max * cpu_load / 100;
199 if (new_freq < hispeed_freq)
200 new_freq = hispeed_freq;
202 if (pcpu->target_freq == hispeed_freq &&
203 new_freq > hispeed_freq &&
204 pcpu->timer_run_time - pcpu->target_set_time
205 < above_hispeed_delay_val) {
206 trace_cpufreq_interactive_notyet(data, cpu_load,
213 new_freq = pcpu->policy->max * cpu_load / 100;
216 if (cpufreq_frequency_table_target(pcpu->policy, pcpu->freq_table,
217 new_freq, CPUFREQ_RELATION_H,
219 pr_warn_once("timer %d: cpufreq_frequency_table_target error\n",
224 new_freq = pcpu->freq_table[index].frequency;
227 * Do not scale down unless we have been at this frequency for the
228 * minimum sample time since last validated.
230 if (new_freq < pcpu->target_freq) {
231 if (pcpu->timer_run_time - pcpu->target_validate_time
233 trace_cpufreq_interactive_notyet(data, cpu_load,
234 pcpu->target_freq, new_freq);
239 pcpu->target_validate_time_in_idle = now_idle;
240 pcpu->target_validate_time = pcpu->timer_run_time;
242 if (pcpu->target_freq == new_freq) {
243 trace_cpufreq_interactive_already(data, cpu_load,
244 pcpu->target_freq, new_freq);
245 goto rearm_if_notmax;
248 trace_cpufreq_interactive_target(data, cpu_load, pcpu->target_freq,
250 pcpu->target_set_time_in_idle = now_idle;
251 pcpu->target_set_time = pcpu->timer_run_time;
253 if (new_freq < pcpu->target_freq) {
254 pcpu->target_freq = new_freq;
255 spin_lock_irqsave(&down_cpumask_lock, flags);
256 cpumask_set_cpu(data, &down_cpumask);
257 spin_unlock_irqrestore(&down_cpumask_lock, flags);
258 queue_work(down_wq, &freq_scale_down_work);
260 pcpu->target_freq = new_freq;
261 spin_lock_irqsave(&up_cpumask_lock, flags);
262 cpumask_set_cpu(data, &up_cpumask);
263 spin_unlock_irqrestore(&up_cpumask_lock, flags);
264 wake_up_process(up_task);
269 * Already set max speed and don't see a need to change that,
270 * wait until next idle to re-evaluate, don't need timer.
272 if (pcpu->target_freq == pcpu->policy->max)
276 if (!timer_pending(&pcpu->cpu_timer)) {
278 * If already at min: if that CPU is idle, don't set timer.
279 * Else cancel the timer if that CPU goes idle. We don't
280 * need to re-evaluate speed until the next idle exit.
282 if (pcpu->target_freq == pcpu->policy->min) {
288 pcpu->timer_idlecancel = 1;
291 pcpu->time_in_idle = get_cpu_idle_time_us(
292 data, &pcpu->idle_exit_time);
293 mod_timer(&pcpu->cpu_timer,
294 jiffies + usecs_to_jiffies(timer_rate));
301 static void cpufreq_interactive_idle_start(void)
303 struct cpufreq_interactive_cpuinfo *pcpu =
304 &per_cpu(cpuinfo, smp_processor_id());
307 if (!pcpu->governor_enabled)
312 pending = timer_pending(&pcpu->cpu_timer);
314 if (pcpu->target_freq != pcpu->policy->min) {
317 * Entering idle while not at lowest speed. On some
318 * platforms this can hold the other CPU(s) at that speed
319 * even though the CPU is idle. Set a timer to re-evaluate
320 * speed so this idle CPU doesn't hold the other CPUs above
321 * min indefinitely. This should probably be a quirk of
322 * the CPUFreq driver.
325 pcpu->time_in_idle = get_cpu_idle_time_us(
326 smp_processor_id(), &pcpu->idle_exit_time);
327 pcpu->timer_idlecancel = 0;
328 mod_timer(&pcpu->cpu_timer,
329 jiffies + usecs_to_jiffies(timer_rate));
334 * If at min speed and entering idle after load has
335 * already been evaluated, and a timer has been set just in
336 * case the CPU suddenly goes busy, cancel that timer. The
337 * CPU didn't go busy; we'll recheck things upon idle exit.
339 if (pending && pcpu->timer_idlecancel) {
340 del_timer(&pcpu->cpu_timer);
342 * Ensure last timer run time is after current idle
343 * sample start time, so next idle exit will always
344 * start a new idle sampling period.
346 pcpu->idle_exit_time = 0;
347 pcpu->timer_idlecancel = 0;
353 static void cpufreq_interactive_idle_end(void)
355 struct cpufreq_interactive_cpuinfo *pcpu =
356 &per_cpu(cpuinfo, smp_processor_id());
362 * Arm the timer for 1-2 ticks later if not already, and if the timer
363 * function has already processed the previous load sampling
364 * interval. (If the timer is not pending but has not processed
365 * the previous interval, it is probably racing with us on another
366 * CPU. Let it compute load based on the previous sample and then
367 * re-arm the timer for another interval when it's done, rather
368 * than updating the interval start time to be "now", which doesn't
369 * give the timer function enough time to make a decision on this
372 if (timer_pending(&pcpu->cpu_timer) == 0 &&
373 pcpu->timer_run_time >= pcpu->idle_exit_time &&
374 pcpu->governor_enabled) {
376 get_cpu_idle_time_us(smp_processor_id(),
377 &pcpu->idle_exit_time);
378 pcpu->timer_idlecancel = 0;
379 mod_timer(&pcpu->cpu_timer,
380 jiffies + usecs_to_jiffies(timer_rate));
385 static int cpufreq_interactive_up_task(void *data)
390 struct cpufreq_interactive_cpuinfo *pcpu;
393 set_current_state(TASK_INTERRUPTIBLE);
394 spin_lock_irqsave(&up_cpumask_lock, flags);
396 if (cpumask_empty(&up_cpumask)) {
397 spin_unlock_irqrestore(&up_cpumask_lock, flags);
400 if (kthread_should_stop())
403 spin_lock_irqsave(&up_cpumask_lock, flags);
406 set_current_state(TASK_RUNNING);
407 tmp_mask = up_cpumask;
408 cpumask_clear(&up_cpumask);
409 spin_unlock_irqrestore(&up_cpumask_lock, flags);
411 for_each_cpu(cpu, &tmp_mask) {
413 unsigned int max_freq = 0;
415 pcpu = &per_cpu(cpuinfo, cpu);
418 if (!pcpu->governor_enabled)
421 mutex_lock(&set_speed_lock);
423 for_each_cpu(j, pcpu->policy->cpus) {
424 struct cpufreq_interactive_cpuinfo *pjcpu =
425 &per_cpu(cpuinfo, j);
427 if (pjcpu->target_freq > max_freq)
428 max_freq = pjcpu->target_freq;
431 if (max_freq != pcpu->policy->cur)
432 __cpufreq_driver_target(pcpu->policy,
435 mutex_unlock(&set_speed_lock);
436 trace_cpufreq_interactive_up(cpu, pcpu->target_freq,
444 static void cpufreq_interactive_freq_down(struct work_struct *work)
449 struct cpufreq_interactive_cpuinfo *pcpu;
451 spin_lock_irqsave(&down_cpumask_lock, flags);
452 tmp_mask = down_cpumask;
453 cpumask_clear(&down_cpumask);
454 spin_unlock_irqrestore(&down_cpumask_lock, flags);
456 for_each_cpu(cpu, &tmp_mask) {
458 unsigned int max_freq = 0;
460 pcpu = &per_cpu(cpuinfo, cpu);
463 if (!pcpu->governor_enabled)
466 mutex_lock(&set_speed_lock);
468 for_each_cpu(j, pcpu->policy->cpus) {
469 struct cpufreq_interactive_cpuinfo *pjcpu =
470 &per_cpu(cpuinfo, j);
472 if (pjcpu->target_freq > max_freq)
473 max_freq = pjcpu->target_freq;
476 if (max_freq != pcpu->policy->cur)
477 __cpufreq_driver_target(pcpu->policy, max_freq,
480 mutex_unlock(&set_speed_lock);
481 trace_cpufreq_interactive_down(cpu, pcpu->target_freq,
486 static void cpufreq_interactive_boost(void)
491 struct cpufreq_interactive_cpuinfo *pcpu;
493 trace_cpufreq_interactive_boost(hispeed_freq);
494 spin_lock_irqsave(&up_cpumask_lock, flags);
496 for_each_online_cpu(i) {
497 pcpu = &per_cpu(cpuinfo, i);
499 if (pcpu->target_freq < hispeed_freq) {
500 pcpu->target_freq = hispeed_freq;
501 cpumask_set_cpu(i, &up_cpumask);
502 pcpu->target_set_time_in_idle =
503 get_cpu_idle_time_us(i, &pcpu->target_set_time);
508 * Refresh time at which current (possibly being
509 * boosted) speed last validated (reset timer for
510 * allowing speed to drop).
513 pcpu->target_validate_time_in_idle =
514 get_cpu_idle_time_us(i, &pcpu->target_validate_time);
517 spin_unlock_irqrestore(&up_cpumask_lock, flags);
520 wake_up_process(up_task);
523 static void cpufreq_interactive_input_event(struct input_handle *handle,
525 unsigned int code, int value)
527 if (input_boost_val && type == EV_SYN && code == SYN_REPORT)
528 cpufreq_interactive_boost();
531 static void cpufreq_interactive_input_open(struct work_struct *w)
533 struct cpufreq_interactive_inputopen *io =
534 container_of(w, struct cpufreq_interactive_inputopen,
538 error = input_open_device(io->handle);
540 input_unregister_handle(io->handle);
543 static int cpufreq_interactive_input_connect(struct input_handler *handler,
544 struct input_dev *dev,
545 const struct input_device_id *id)
547 struct input_handle *handle;
550 pr_info("%s: connect to %s\n", __func__, dev->name);
551 handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
556 handle->handler = handler;
557 handle->name = "cpufreq_interactive";
559 error = input_register_handle(handle);
563 inputopen.handle = handle;
564 queue_work(down_wq, &inputopen.inputopen_work);
571 static void cpufreq_interactive_input_disconnect(struct input_handle *handle)
573 input_close_device(handle);
574 input_unregister_handle(handle);
578 static const struct input_device_id cpufreq_interactive_ids[] = {
580 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
581 INPUT_DEVICE_ID_MATCH_ABSBIT,
582 .evbit = { BIT_MASK(EV_ABS) },
583 .absbit = { [BIT_WORD(ABS_MT_POSITION_X)] =
584 BIT_MASK(ABS_MT_POSITION_X) |
585 BIT_MASK(ABS_MT_POSITION_Y) },
586 }, /* multi-touch touchscreen */
588 .flags = INPUT_DEVICE_ID_MATCH_KEYBIT |
589 INPUT_DEVICE_ID_MATCH_ABSBIT,
590 .keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) },
591 .absbit = { [BIT_WORD(ABS_X)] =
592 BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) },
597 static struct input_handler cpufreq_interactive_input_handler = {
598 .event = cpufreq_interactive_input_event,
599 .connect = cpufreq_interactive_input_connect,
600 .disconnect = cpufreq_interactive_input_disconnect,
601 .name = "cpufreq_interactive",
602 .id_table = cpufreq_interactive_ids,
605 static ssize_t show_hispeed_freq(struct kobject *kobj,
606 struct attribute *attr, char *buf)
608 return sprintf(buf, "%llu\n", hispeed_freq);
611 static ssize_t store_hispeed_freq(struct kobject *kobj,
612 struct attribute *attr, const char *buf,
618 ret = strict_strtoull(buf, 0, &val);
625 static struct global_attr hispeed_freq_attr = __ATTR(hispeed_freq, 0644,
626 show_hispeed_freq, store_hispeed_freq);
629 static ssize_t show_go_hispeed_load(struct kobject *kobj,
630 struct attribute *attr, char *buf)
632 return sprintf(buf, "%lu\n", go_hispeed_load);
635 static ssize_t store_go_hispeed_load(struct kobject *kobj,
636 struct attribute *attr, const char *buf, size_t count)
641 ret = strict_strtoul(buf, 0, &val);
644 go_hispeed_load = val;
648 static struct global_attr go_hispeed_load_attr = __ATTR(go_hispeed_load, 0644,
649 show_go_hispeed_load, store_go_hispeed_load);
651 static ssize_t show_min_sample_time(struct kobject *kobj,
652 struct attribute *attr, char *buf)
654 return sprintf(buf, "%lu\n", min_sample_time);
657 static ssize_t store_min_sample_time(struct kobject *kobj,
658 struct attribute *attr, const char *buf, size_t count)
663 ret = strict_strtoul(buf, 0, &val);
666 min_sample_time = val;
670 static struct global_attr min_sample_time_attr = __ATTR(min_sample_time, 0644,
671 show_min_sample_time, store_min_sample_time);
673 static ssize_t show_above_hispeed_delay(struct kobject *kobj,
674 struct attribute *attr, char *buf)
676 return sprintf(buf, "%lu\n", above_hispeed_delay_val);
679 static ssize_t store_above_hispeed_delay(struct kobject *kobj,
680 struct attribute *attr,
681 const char *buf, size_t count)
686 ret = strict_strtoul(buf, 0, &val);
689 above_hispeed_delay_val = val;
693 define_one_global_rw(above_hispeed_delay);
695 static ssize_t show_timer_rate(struct kobject *kobj,
696 struct attribute *attr, char *buf)
698 return sprintf(buf, "%lu\n", timer_rate);
701 static ssize_t store_timer_rate(struct kobject *kobj,
702 struct attribute *attr, const char *buf, size_t count)
707 ret = strict_strtoul(buf, 0, &val);
714 static struct global_attr timer_rate_attr = __ATTR(timer_rate, 0644,
715 show_timer_rate, store_timer_rate);
717 static ssize_t show_input_boost(struct kobject *kobj, struct attribute *attr,
720 return sprintf(buf, "%u\n", input_boost_val);
723 static ssize_t store_input_boost(struct kobject *kobj, struct attribute *attr,
724 const char *buf, size_t count)
729 ret = strict_strtoul(buf, 0, &val);
732 input_boost_val = val;
736 define_one_global_rw(input_boost);
738 static struct attribute *interactive_attributes[] = {
739 &hispeed_freq_attr.attr,
740 &go_hispeed_load_attr.attr,
741 &above_hispeed_delay.attr,
742 &min_sample_time_attr.attr,
743 &timer_rate_attr.attr,
748 static struct attribute_group interactive_attr_group = {
749 .attrs = interactive_attributes,
750 .name = "interactive",
753 static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
758 struct cpufreq_interactive_cpuinfo *pcpu;
759 struct cpufreq_frequency_table *freq_table;
762 case CPUFREQ_GOV_START:
763 if (!cpu_online(policy->cpu))
767 cpufreq_frequency_get_table(policy->cpu);
769 for_each_cpu(j, policy->cpus) {
770 pcpu = &per_cpu(cpuinfo, j);
771 pcpu->policy = policy;
772 pcpu->target_freq = policy->cur;
773 pcpu->freq_table = freq_table;
774 pcpu->target_set_time_in_idle =
775 get_cpu_idle_time_us(j,
776 &pcpu->target_set_time);
777 pcpu->target_validate_time =
778 pcpu->target_set_time;
779 pcpu->target_validate_time_in_idle =
780 pcpu->target_set_time_in_idle;
781 pcpu->governor_enabled = 1;
786 hispeed_freq = policy->max;
789 * Do not register the idle hook and create sysfs
790 * entries if we have already done so.
792 if (atomic_inc_return(&active_count) > 1)
795 rc = sysfs_create_group(cpufreq_global_kobject,
796 &interactive_attr_group);
800 rc = input_register_handler(&cpufreq_interactive_input_handler);
802 pr_warn("%s: failed to register input handler\n",
807 case CPUFREQ_GOV_STOP:
808 for_each_cpu(j, policy->cpus) {
809 pcpu = &per_cpu(cpuinfo, j);
810 pcpu->governor_enabled = 0;
812 del_timer_sync(&pcpu->cpu_timer);
815 * Reset idle exit time since we may cancel the timer
816 * before it can run after the last idle exit time,
817 * to avoid tripping the check in idle exit for a timer
818 * that is trying to run.
820 pcpu->idle_exit_time = 0;
823 flush_work(&freq_scale_down_work);
824 if (atomic_dec_return(&active_count) > 0)
827 input_unregister_handler(&cpufreq_interactive_input_handler);
828 sysfs_remove_group(cpufreq_global_kobject,
829 &interactive_attr_group);
833 case CPUFREQ_GOV_LIMITS:
834 if (policy->max < policy->cur)
835 __cpufreq_driver_target(policy,
836 policy->max, CPUFREQ_RELATION_H);
837 else if (policy->min > policy->cur)
838 __cpufreq_driver_target(policy,
839 policy->min, CPUFREQ_RELATION_L);
845 static int cpufreq_interactive_idle_notifier(struct notifier_block *nb,
851 cpufreq_interactive_idle_start();
854 cpufreq_interactive_idle_end();
861 static struct notifier_block cpufreq_interactive_idle_nb = {
862 .notifier_call = cpufreq_interactive_idle_notifier,
865 static int __init cpufreq_interactive_init(void)
868 struct cpufreq_interactive_cpuinfo *pcpu;
869 struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
871 go_hispeed_load = DEFAULT_GO_HISPEED_LOAD;
872 min_sample_time = DEFAULT_MIN_SAMPLE_TIME;
873 above_hispeed_delay_val = DEFAULT_ABOVE_HISPEED_DELAY;
874 timer_rate = DEFAULT_TIMER_RATE;
876 /* Initalize per-cpu timers */
877 for_each_possible_cpu(i) {
878 pcpu = &per_cpu(cpuinfo, i);
879 init_timer(&pcpu->cpu_timer);
880 pcpu->cpu_timer.function = cpufreq_interactive_timer;
881 pcpu->cpu_timer.data = i;
884 up_task = kthread_create(cpufreq_interactive_up_task, NULL,
887 return PTR_ERR(up_task);
889 sched_setscheduler_nocheck(up_task, SCHED_FIFO, ¶m);
890 get_task_struct(up_task);
892 /* No rescuer thread, bind to CPU queuing the work for possibly
893 warm cache (probably doesn't matter much). */
894 down_wq = alloc_workqueue("knteractive_down", 0, 1);
899 INIT_WORK(&freq_scale_down_work,
900 cpufreq_interactive_freq_down);
902 spin_lock_init(&up_cpumask_lock);
903 spin_lock_init(&down_cpumask_lock);
904 mutex_init(&set_speed_lock);
906 idle_notifier_register(&cpufreq_interactive_idle_nb);
907 INIT_WORK(&inputopen.inputopen_work, cpufreq_interactive_input_open);
908 return cpufreq_register_governor(&cpufreq_gov_interactive);
911 put_task_struct(up_task);
915 #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE
916 fs_initcall(cpufreq_interactive_init);
918 module_init(cpufreq_interactive_init);
921 static void __exit cpufreq_interactive_exit(void)
923 cpufreq_unregister_governor(&cpufreq_gov_interactive);
924 kthread_stop(up_task);
925 put_task_struct(up_task);
926 destroy_workqueue(down_wq);
929 module_exit(cpufreq_interactive_exit);
931 MODULE_AUTHOR("Mike Chan <mike@android.com>");
932 MODULE_DESCRIPTION("'cpufreq_interactive' - A cpufreq governor for "
933 "Latency sensitive workloads");
934 MODULE_LICENSE("GPL");