Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  linux/drivers/devfreq/governor_performance.c
0004  *
0005  *  Copyright (C) 2011 Samsung Electronics
0006  *  MyungJoo Ham <myungjoo.ham@samsung.com>
0007  */
0008 
0009 #include <linux/devfreq.h>
0010 #include <linux/module.h>
0011 #include "governor.h"
0012 
0013 static int devfreq_performance_func(struct devfreq *df,
0014                     unsigned long *freq)
0015 {
0016     /*
0017      * target callback should be able to get floor value as
0018      * said in devfreq.h
0019      */
0020     *freq = DEVFREQ_MAX_FREQ;
0021     return 0;
0022 }
0023 
0024 static int devfreq_performance_handler(struct devfreq *devfreq,
0025                 unsigned int event, void *data)
0026 {
0027     int ret = 0;
0028 
0029     if (event == DEVFREQ_GOV_START) {
0030         mutex_lock(&devfreq->lock);
0031         ret = update_devfreq(devfreq);
0032         mutex_unlock(&devfreq->lock);
0033     }
0034 
0035     return ret;
0036 }
0037 
0038 static struct devfreq_governor devfreq_performance = {
0039     .name = DEVFREQ_GOV_PERFORMANCE,
0040     .get_target_freq = devfreq_performance_func,
0041     .event_handler = devfreq_performance_handler,
0042 };
0043 
0044 static int __init devfreq_performance_init(void)
0045 {
0046     return devfreq_add_governor(&devfreq_performance);
0047 }
0048 subsys_initcall(devfreq_performance_init);
0049 
0050 static void __exit devfreq_performance_exit(void)
0051 {
0052     int ret;
0053 
0054     ret = devfreq_remove_governor(&devfreq_performance);
0055     if (ret)
0056         pr_err("%s: failed remove governor %d\n", __func__, ret);
0057 
0058     return;
0059 }
0060 module_exit(devfreq_performance_exit);
0061 MODULE_LICENSE("GPL");