tizen 2.4 release
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / drivers / cpufreq / cpufreq_pmqos_wc1b.c
1 /* cpufreq_pmqos_wc1b.c */
2
3 #include <linux/cpuidle.h>
4
5 /* ROTARY BOOSTER + */
6 #define ROTARY_BOOSTER_DELAY    200
7 static int rotary_min_cpu_freq = 600000;
8 static int rotary_min_mif_freq = 200000;
9 /* ROTARY BOOSTER - */
10
11 /* HARD KEY BOOSTER + */
12 static int hard_key_min_cpu_freq = 1000000;
13 #define KEY_BOOSTER_DELAY       200
14 /* HARD KEY BOOSTER - */
15
16 /* TOUCH WAKEUP BOOSTER + */
17 static int touch_wakeup_min_cpu_freq = 1000000;
18 #define TOUCH_WAKEUP_BOOSTER_DELAY      200
19 /* TOUCH WAKEUP BOOSTER - */
20
21 #define TOUCH_BOOSTER_OFF_TIME          100
22 #define TOUCH_BOOSTER_CHG_TIME          200
23
24 #define TOUCH_BOOSTER_MIF_PRESS         200000
25 #define TOUCH_BOOSTER_MIF_MOVE          200000
26 #define TOUCH_BOOSTER_MIF_RELEASE       200000
27
28 #define TOUCH_BOOSTER_INT_PRESS         100000
29 #define TOUCH_BOOSTER_INT_MOVE          100000
30 #define TOUCH_BOOSTER_INT_RELEASE       100000
31
32 static struct pm_qos_request pm_qos_cpu_req;
33 static struct pm_qos_request pm_qos_cpu_online_req;
34
35 static struct pm_qos_request pm_qos_mif_req;
36 static struct pm_qos_request pm_qos_int_req;
37
38 unsigned int press_cpu_freq, release_cpu_freq;
39 int touch_cpu_online;
40
41 unsigned int press_mif_freq = TOUCH_BOOSTER_MIF_PRESS;
42 unsigned int release_mif_freq = TOUCH_BOOSTER_MIF_RELEASE;
43
44 unsigned int press_int_freq = TOUCH_BOOSTER_INT_PRESS;
45 unsigned int release_int_freq = TOUCH_BOOSTER_INT_RELEASE;
46
47
48 void touch_booster_press_sub(void)
49 {
50         press_cpu_freq = cpufreq_get_touch_boost_press();
51         touch_cpu_online = touch_cpu_get_online_min();
52
53         if (!pm_qos_request_active(&pm_qos_cpu_req))
54                 pm_qos_add_request(&pm_qos_cpu_req
55                         , PM_QOS_CPU_FREQ_MIN, press_cpu_freq);
56
57         if (!pm_qos_request_active(&pm_qos_mif_req))
58                 pm_qos_add_request(&pm_qos_mif_req
59                         , PM_QOS_BUS_THROUGHPUT, press_mif_freq);
60
61         if (!pm_qos_request_active(&pm_qos_int_req))
62                 pm_qos_add_request(&pm_qos_int_req
63                         , PM_QOS_DEVICE_THROUGHPUT, press_int_freq);
64
65         if (touch_cpu_online > 1) {
66                 if (!pm_qos_request_active(&pm_qos_cpu_online_req))
67                         pm_qos_add_request(&pm_qos_cpu_online_req
68                                 , PM_QOS_CPU_ONLINE_MIN, touch_cpu_online);
69         }
70
71         cpuidle_set_w_aftr_enable(0);
72 }
73
74
75 void touch_booster_move_sub(void)
76 {
77         unsigned int move_cpu_freq = cpufreq_get_touch_boost_move();
78         unsigned int move_mif_freq = TOUCH_BOOSTER_MIF_MOVE;
79         unsigned int move_int_freq = TOUCH_BOOSTER_INT_MOVE;
80
81         pm_qos_update_request(&pm_qos_cpu_req, move_cpu_freq);
82         pm_qos_update_request(&pm_qos_mif_req, move_mif_freq);
83         pm_qos_update_request(&pm_qos_int_req, move_int_freq);
84 }
85
86
87 void touch_booster_release_sub(void)
88 {
89         release_cpu_freq = cpufreq_get_touch_boost_release();
90
91         pm_qos_update_request(&pm_qos_cpu_req, release_cpu_freq);
92         pm_qos_update_request(&pm_qos_mif_req, release_mif_freq);
93         pm_qos_update_request(&pm_qos_int_req, release_int_freq);
94 }
95
96
97
98 void touch_booster_off_sub(void)
99 {
100         if (pm_qos_request_active(&pm_qos_cpu_req))
101                 pm_qos_remove_request(&pm_qos_cpu_req);
102
103         if (pm_qos_request_active(&pm_qos_mif_req))
104                 pm_qos_remove_request(&pm_qos_mif_req);
105
106         if (pm_qos_request_active(&pm_qos_int_req))
107                 pm_qos_remove_request(&pm_qos_int_req);
108
109         if (pm_qos_request_active(&pm_qos_cpu_online_req))
110                 pm_qos_remove_request(&pm_qos_cpu_online_req);
111
112         cpuidle_w_after_oneshot_log_en();
113         cpuidle_set_w_aftr_enable(1);
114 }
115
116