blob: f01e1053753f02d9a7f6be434c8b01ad91ab45bc [file] [log] [blame]
Zvikomborero VIncent Zvikaramba566ec732016-08-19 02:18:45 -04001#!/system/bin/sh
2# Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are met:
6# * Redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer.
8# * Redistributions in binary form must reproduce the above copyright
9# notice, this list of conditions and the following disclaimer in the
10# documentation and/or other materials provided with the distribution.
11# * Neither the name of The Linux Foundation nor
12# the names of its contributors may be used to endorse or promote
13# products derived from this software without specific prior written
14# permission.
15#
16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28
29target=`getprop ro.board.platform`
30case "$target" in
31 "msm7201a_ffa" | "msm7201a_surf" | "msm7627_ffa" | "msm7627_6x" | "msm7627a" | "msm7627_surf" | \
32 "qsd8250_surf" | "qsd8250_ffa" | "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "qsd8650a_st1x")
33 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
34 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
35 ;;
36esac
37
38case "$target" in
39 "msm7201a_ffa" | "msm7201a_surf")
40 echo 500000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
41 ;;
42esac
43
44case "$target" in
45 "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
46 echo 75000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
47 echo 1 > /sys/module/pm2/parameters/idle_sleep_mode
48 ;;
49esac
50
51case "$target" in
52 "msm7201a_ffa" | "msm7201a_surf" | "msm7627_ffa" | "msm7627_6x" | "msm7627_surf" | "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "msm7627a" )
53 echo 245760 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
54 ;;
55esac
56
57case "$target" in
58 "msm8660")
59 echo 1 > /sys/module/rpm_resources/enable_low_power/L2_cache
60 echo 1 > /sys/module/rpm_resources/enable_low_power/pxo
61 echo 2 > /sys/module/rpm_resources/enable_low_power/vdd_dig
62 echo 2 > /sys/module/rpm_resources/enable_low_power/vdd_mem
63 echo 1 > /sys/module/rpm_resources/enable_low_power/rpm_cpu
64 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
65 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
66 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
67 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
68 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
69 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
70 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
71 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
72 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
73 echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
74 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
75 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
76 echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
77 echo 4 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
78 echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
79 echo 384000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
80 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
81 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
82 chown -h system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
83 chown -h system /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
84 chown -h root.system /sys/devices/system/cpu/mfreq
85 chmod -h 220 /sys/devices/system/cpu/mfreq
86 chown -h root.system /sys/devices/system/cpu/cpu1/online
87 chmod -h 664 /sys/devices/system/cpu/cpu1/online
88 ;;
89esac
90
91case "$target" in
92 "msm8960")
93 echo 1 > /sys/module/rpm_resources/enable_low_power/L2_cache
94 echo 1 > /sys/module/rpm_resources/enable_low_power/pxo
95 echo 1 > /sys/module/rpm_resources/enable_low_power/vdd_dig
96 echo 1 > /sys/module/rpm_resources/enable_low_power/vdd_mem
97 echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled
98 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
99 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
100 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
101 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
102 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
103 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
104 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
105 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
106 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
107 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
108 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
109 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
110 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
111 echo 0 > /sys/module/msm_thermal/core_control/enabled
112 echo 1 > /sys/devices/system/cpu/cpu1/online
113 echo 1 > /sys/devices/system/cpu/cpu2/online
114 echo 1 > /sys/devices/system/cpu/cpu3/online
115 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
116 echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
117 echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
118 echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
119 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
120 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
121 echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
122 echo 4 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
123 echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
124 echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
125 echo 3 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
126 echo 918000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
127 echo 1026000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
128 echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
129 chown -h system /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
130 chown -h system /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
131 chown -h system /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
132 echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
133 echo 384000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
134 echo 384000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
135 echo 384000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
136 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
137 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
138 chown -h system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
139 chown -h system /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
140 chown -h system /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
141 chown -h system /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
142 chown -h system /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
143 chown -h system /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
144 echo 1 > /sys/module/msm_thermal/core_control/enabled
145 chown -h root.system /sys/devices/system/cpu/mfreq
146 chmod -h 220 /sys/devices/system/cpu/mfreq
147 chown -h root.system /sys/devices/system/cpu/cpu1/online
148 chown -h root.system /sys/devices/system/cpu/cpu2/online
149 chown -h root.system /sys/devices/system/cpu/cpu3/online
150 chmod -h 664 /sys/devices/system/cpu/cpu1/online
151 chmod -h 664 /sys/devices/system/cpu/cpu2/online
152 chmod -h 664 /sys/devices/system/cpu/cpu3/online
153 # set DCVS parameters for CPU
154 echo 40000 > /sys/module/msm_dcvs/cores/cpu0/slack_time_max_us
155 echo 40000 > /sys/module/msm_dcvs/cores/cpu0/slack_time_min_us
156 echo 100000 > /sys/module/msm_dcvs/cores/cpu0/em_win_size_min_us
157 echo 500000 > /sys/module/msm_dcvs/cores/cpu0/em_win_size_max_us
158 echo 0 > /sys/module/msm_dcvs/cores/cpu0/slack_mode_dynamic
159 echo 1000000 > /sys/module/msm_dcvs/cores/cpu0/disable_pc_threshold
160 echo 25000 > /sys/module/msm_dcvs/cores/cpu1/slack_time_max_us
161 echo 25000 > /sys/module/msm_dcvs/cores/cpu1/slack_time_min_us
162 echo 100000 > /sys/module/msm_dcvs/cores/cpu1/em_win_size_min_us
163 echo 500000 > /sys/module/msm_dcvs/cores/cpu1/em_win_size_max_us
164 echo 0 > /sys/module/msm_dcvs/cores/cpu1/slack_mode_dynamic
165 echo 1000000 > /sys/module/msm_dcvs/cores/cpu1/disable_pc_threshold
166 echo 25000 > /sys/module/msm_dcvs/cores/cpu2/slack_time_max_us
167 echo 25000 > /sys/module/msm_dcvs/cores/cpu2/slack_time_min_us
168 echo 100000 > /sys/module/msm_dcvs/cores/cpu2/em_win_size_min_us
169 echo 500000 > /sys/module/msm_dcvs/cores/cpu2/em_win_size_max_us
170 echo 0 > /sys/module/msm_dcvs/cores/cpu2/slack_mode_dynamic
171 echo 1000000 > /sys/module/msm_dcvs/cores/cpu2/disable_pc_threshold
172 echo 25000 > /sys/module/msm_dcvs/cores/cpu3/slack_time_max_us
173 echo 25000 > /sys/module/msm_dcvs/cores/cpu3/slack_time_min_us
174 echo 100000 > /sys/module/msm_dcvs/cores/cpu3/em_win_size_min_us
175 echo 500000 > /sys/module/msm_dcvs/cores/cpu3/em_win_size_max_us
176 echo 0 > /sys/module/msm_dcvs/cores/cpu3/slack_mode_dynamic
177 echo 1000000 > /sys/module/msm_dcvs/cores/cpu3/disable_pc_threshold
178 # set DCVS parameters for GPU
179 echo 20000 > /sys/module/msm_dcvs/cores/gpu0/slack_time_max_us
180 echo 20000 > /sys/module/msm_dcvs/cores/gpu0/slack_time_min_us
181 echo 0 > /sys/module/msm_dcvs/cores/gpu0/slack_mode_dynamic
182 # set msm_mpdecision parameters
183 echo 45000 > /sys/module/msm_mpdecision/slack_time_max_us
184 echo 15000 > /sys/module/msm_mpdecision/slack_time_min_us
185 echo 100000 > /sys/module/msm_mpdecision/em_win_size_min_us
186 echo 1000000 > /sys/module/msm_mpdecision/em_win_size_max_us
187 echo 3 > /sys/module/msm_mpdecision/online_util_pct_min
188 echo 25 > /sys/module/msm_mpdecision/online_util_pct_max
189 echo 97 > /sys/module/msm_mpdecision/em_max_util_pct
190 echo 2 > /sys/module/msm_mpdecision/rq_avg_poll_ms
191 echo 10 > /sys/module/msm_mpdecision/mp_em_rounding_point_min
192 echo 85 > /sys/module/msm_mpdecision/mp_em_rounding_point_max
193 echo 50 > /sys/module/msm_mpdecision/iowait_threshold_pct
194 #set permissions for the nodes needed by display on/off hook
195 chown -h system /sys/module/msm_dcvs/cores/cpu0/slack_time_max_us
196 chown -h system /sys/module/msm_dcvs/cores/cpu0/slack_time_min_us
197 chown -h system /sys/module/msm_mpdecision/slack_time_max_us
198 chown -h system /sys/module/msm_mpdecision/slack_time_min_us
199 chmod -h 664 /sys/module/msm_dcvs/cores/cpu0/slack_time_max_us
200 chmod -h 664 /sys/module/msm_dcvs/cores/cpu0/slack_time_min_us
201 chmod -h 664 /sys/module/msm_mpdecision/slack_time_max_us
202 chmod -h 664 /sys/module/msm_mpdecision/slack_time_min_us
203 if [ -f /sys/devices/soc0/soc_id ]; then
204 soc_id=`cat /sys/devices/soc0/soc_id`
205 else
206 soc_id=`cat /sys/devices/system/soc/soc0/id`
207 fi
208 case "$soc_id" in
209 "130")
210 echo 230 > /sys/class/gpio/export
211 echo 228 > /sys/class/gpio/export
212 echo 229 > /sys/class/gpio/export
213 echo "in" > /sys/class/gpio/gpio230/direction
214 echo "rising" > /sys/class/gpio/gpio230/edge
215 echo "in" > /sys/class/gpio/gpio228/direction
216 echo "rising" > /sys/class/gpio/gpio228/edge
217 echo "in" > /sys/class/gpio/gpio229/direction
218 echo "rising" > /sys/class/gpio/gpio229/edge
219 echo 253 > /sys/class/gpio/export
220 echo 254 > /sys/class/gpio/export
221 echo 257 > /sys/class/gpio/export
222 echo 258 > /sys/class/gpio/export
223 echo 259 > /sys/class/gpio/export
224 echo "out" > /sys/class/gpio/gpio253/direction
225 echo "out" > /sys/class/gpio/gpio254/direction
226 echo "out" > /sys/class/gpio/gpio257/direction
227 echo "out" > /sys/class/gpio/gpio258/direction
228 echo "out" > /sys/class/gpio/gpio259/direction
229 chown -h media /sys/class/gpio/gpio253/value
230 chown -h media /sys/class/gpio/gpio254/value
231 chown -h media /sys/class/gpio/gpio257/value
232 chown -h media /sys/class/gpio/gpio258/value
233 chown -h media /sys/class/gpio/gpio259/value
234 chown -h media /sys/class/gpio/gpio253/direction
235 chown -h media /sys/class/gpio/gpio254/direction
236 chown -h media /sys/class/gpio/gpio257/direction
237 chown -h media /sys/class/gpio/gpio258/direction
238 chown -h media /sys/class/gpio/gpio259/direction
239 echo 0 > /sys/module/rpm_resources/enable_low_power/vdd_dig
240 echo 0 > /sys/module/rpm_resources/enable_low_power/vdd_mem
241 ;;
242 esac
243 ;;
244esac
245
246case "$target" in
247 "msm8974")
248 echo 4 > /sys/module/lpm_levels/enable_low_power/l2
249 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
250 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
251 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
252 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
253 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
254 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
255 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
256 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
257 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
258 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
259 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
260 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
261 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
262 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
263 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
264 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
265 echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled
266 echo 1 > /sys/module/msm_pm/modes/cpu1/retention/idle_enabled
267 echo 1 > /sys/module/msm_pm/modes/cpu2/retention/idle_enabled
268 echo 1 > /sys/module/msm_pm/modes/cpu3/retention/idle_enabled
269 echo 0 > /sys/module/msm_thermal/core_control/enabled
270 echo 1 > /sys/devices/system/cpu/cpu1/online
271 echo 1 > /sys/devices/system/cpu/cpu2/online
272 echo 1 > /sys/devices/system/cpu/cpu3/online
273 if [ -f /sys/devices/soc0/soc_id ]; then
274 soc_id=`cat /sys/devices/soc0/soc_id`
275 else
276 soc_id=`cat /sys/devices/system/soc/soc0/id`
277 fi
278 case "$soc_id" in
279 "208" | "211" | "214" | "217" | "209" | "212" | "215" | "218" | "194" | "210" | "213" | "216")
280 for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
281 do
282 echo "cpubw_hwmon" > $devfreq_gov
283 done
284 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
285 echo "interactive" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
286 echo "interactive" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
287 echo "interactive" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
288 echo "20000 1400000:40000 1700000:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
289 echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
290 echo 1190400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
291 echo 1 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
292 echo "85 1500000:90 1800000:70" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
293 echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
294 echo 20 > /sys/module/cpu_boost/parameters/boost_ms
295 echo 1728000 > /sys/module/cpu_boost/parameters/sync_threshold
296 echo 100000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
297 echo 1497600 > /sys/module/cpu_boost/parameters/input_boost_freq
298 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
299 setprop ro.qualcomm.perf.cores_online 2
300 ;;
301 *)
302 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
303 echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
304 echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
305 echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
306 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
307 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
308 echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
309 echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
310 echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
311 echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
312 echo 3 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
313 echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
314 echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
315 echo 1190400 > /sys/devices/system/cpu/cpufreq/ondemand/input_boost
316 echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
317 ;;
318 esac
319 echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
320 echo 300000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
321 echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
322 echo 300000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
323 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
324 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
325 echo 1 > /sys/module/msm_thermal/core_control/enabled
326 chown -h root.system /sys/devices/system/cpu/mfreq
327 chmod -h 220 /sys/devices/system/cpu/mfreq
328 chown -h root.system /sys/devices/system/cpu/cpu1/online
329 chown -h root.system /sys/devices/system/cpu/cpu2/online
330 chown -h root.system /sys/devices/system/cpu/cpu3/online
331 chmod -h 664 /sys/devices/system/cpu/cpu1/online
332 chmod -h 664 /sys/devices/system/cpu/cpu2/online
333 chmod -h 664 /sys/devices/system/cpu/cpu3/online
334 echo 1 > /dev/cpuctl/apps/cpu.notify_on_migrate
335 ;;
336esac
337
338case "$target" in
339 "msm8916")
340 # Change PM debug parameters permission
341 chown -h radio.system /sys/module/qpnp_power_on/parameters/reset_enabled
342 chown -h radio.system /sys/module/qpnp_power_on/parameters/wake_enabled
343 chown -h radio.system /sys/module/qpnp_int/parameters/debug_mask
344 chown -h radio.system /sys/module/lpm_levels/parameters/secdebug
345 chmod -h 664 /sys/module/qpnp_power_on/parameters/reset_enabled
346 chmod -h 664 /sys/module/qpnp_power_on/parameters/wake_enabled
347 chmod -h 664 /sys/module/qpnp_int/parameters/debug_mask
348 chmod -h 664 /sys/module/lpm_levels/parameters/secdebug
349 chmod -h 444 /sys/kernel/wakeup_reasons/last_resume_reason
350
351 if [ -f /sys/devices/soc0/soc_id ]; then
352 soc_id=`cat /sys/devices/soc0/soc_id`
353 else
354 soc_id=`cat /sys/devices/system/soc/soc0/id`
355 fi
356 case "$soc_id" in
357 "206" | "247" | "248" | "249" | "250")
358 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
359 echo 1 > /sys/devices/system/cpu/cpu1/online
360 echo 1 > /sys/devices/system/cpu/cpu2/online
361 echo 1 > /sys/devices/system/cpu/cpu3/online
362 ;;
363 "239" | "241" | "263")
364 if [ -f /sys/devices/soc0/revision ]; then
365 revision=`cat /sys/devices/soc0/revision`
366 else
367 revision=`cat /sys/devices/system/soc/soc0/revision`
368 fi
369 case "$revision" in
370 "3.0")
371 echo N > /sys/module/lpm_levels/system/power/power-l2-gdhs/idle_enabled
372 echo N > /sys/module/lpm_levels/system/performance/performance-l2-gdhs/idle_enabled
373 ;;
374 esac
375 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
376 echo 10 > /sys/class/net/rmnet0/queues/rx-0/rps_cpus
377 if [ -f /sys/devices/soc0/platform_subtype_id ]; then
378 platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
379 fi
380 if [ -f /sys/devices/soc0/hw_platform ]; then
381 hw_platform=`cat /sys/devices/soc0/hw_platform`
382 fi
383 case "$soc_id" in
384 "239")
385 case "$hw_platform" in
386 "Surf")
387 case "$platform_subtype_id" in
388 "1" | "2")
389 start hbtp
390 ;;
391 esac
392 ;;
393 "MTP")
394 case "$platform_subtype_id" in
395 "3")
396 start hbtp
397 ;;
398 esac
399 ;;
400 esac
401 ;;
402 esac
403 ;;
404 "268" | "269" | "270" | "271")
405 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
406 echo 10 > /sys/class/net/rmnet0/queues/rx-0/rps_cpus
407 ;;
408 "233" | "240" | "242")
409 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
410 echo 1 > /sys/devices/system/cpu/cpu1/online
411 echo 1 > /sys/devices/system/cpu/cpu2/online
412 echo 1 > /sys/devices/system/cpu/cpu3/online
413 ;;
414 esac
415
416 #control daemon for xosd
417 factory_mode=`getprop ro.factory.factory_binary`
418 if [ "$factory_mode" != "factory" ]; then
419 product_name=`getprop ro.product.name`
420 case "$product_name" in
421 a8*)
422 jig_mode=`cat /sys/class/sec/switch/attached_dev`
423 case "$jig_mode" in
424 "JIG UART ON" | "JIG UART OFF" | "JIG UART OFF/VB")
425 echo "PM: JIG UART" > /dev/kmsg
426 ;;
427 *)
428 echo "PM: stop at_distributor" > /dev/kmsg
429 stop at_distributor
430 ;;
431 esac
432 ;;
433 esac
434 fi
435 ;;
436esac
437
438case "$target" in
439 "msm8226")
440 echo 4 > /sys/module/lpm_levels/enable_low_power/l2
441 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
442 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
443 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
444 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
445 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
446 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
447 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
448 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
449 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
450 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
451 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
452 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
453 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
454 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
455 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
456 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
457 echo 1 > /sys/devices/system/cpu/cpu1/online
458 echo 1 > /sys/devices/system/cpu/cpu2/online
459 echo 1 > /sys/devices/system/cpu/cpu3/online
460 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
461 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
462 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
463 echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
464 echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
465 echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
466 echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
467 echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
468 echo 787200 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
469 echo 300000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
470 echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
471 echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
472 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
473 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
474 chown -h root.system /sys/devices/system/cpu/cpu1/online
475 chown -h root.system /sys/devices/system/cpu/cpu2/online
476 chown -h root.system /sys/devices/system/cpu/cpu3/online
477 chmod -h 664 /sys/devices/system/cpu/cpu1/online
478 chmod -h 664 /sys/devices/system/cpu/cpu2/online
479 chmod -h 664 /sys/devices/system/cpu/cpu3/online
480 ;;
481esac
482
483case "$target" in
484 "msm8610")
485 echo 4 > /sys/module/lpm_levels/enable_low_power/l2
486 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
487 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
488 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
489 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
490 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
491 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
492 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
493 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
494 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
495 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
496 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
497 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
498 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
499 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
500 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
501 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
502 echo 1 > /sys/devices/system/cpu/cpu1/online
503 echo 1 > /sys/devices/system/cpu/cpu2/online
504 echo 1 > /sys/devices/system/cpu/cpu3/online
505 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
506 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
507 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
508 echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
509 echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
510 echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
511 echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
512 echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
513 echo 787200 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
514 echo 300000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
515 echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
516 echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
517 setprop ro.qualcomm.perf.min_freq 7
518 echo 1 > /sys/kernel/mm/ksm/deferred_timer
519 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
520 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
521 chown -h root.system /sys/devices/system/cpu/cpu1/online
522 chown -h root.system /sys/devices/system/cpu/cpu2/online
523 chown -h root.system /sys/devices/system/cpu/cpu3/online
524 chmod -h 664 /sys/devices/system/cpu/cpu1/online
525 chmod -h 664 /sys/devices/system/cpu/cpu2/online
526 chmod -h 664 /sys/devices/system/cpu/cpu3/online
527 ;;
528esac
529
530case "$target" in
531 "msm8916")
532
533 if [ -f /sys/devices/soc0/soc_id ]; then
534 soc_id=`cat /sys/devices/soc0/soc_id`
535 else
536 soc_id=`cat /sys/devices/system/soc/soc0/id`
537 fi
538
539 #Enable adaptive LMK and set vmpressure_file_min
540 ProductName=`getprop ro.product.name`
541 if [ "$ProductName" == "msm8916_32" ] || [ "$ProductName" == "msm8916_32_LMT" ]; then
542 echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
543 echo 69253 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
544 elif [ "$ProductName" == "msm8916_64" ] || [ "$ProductName" == "msm8916_64_LMT" ]; then
545 echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
546 echo 81250 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
547 fi
548
549 # HMP scheduler settings for 8916, 8936, 8939, 8929
550 echo 3 > /proc/sys/kernel/sched_window_stats_policy
551
552 # Apply governor settings for 8916
553 case "$soc_id" in
554 "206" | "247" | "248" | "249" | "250")
555
556 # HMP scheduler load tracking settings
557 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
558
559 # HMP Task packing settings for 8916
560 echo 30 > /proc/sys/kernel/sched_small_task
561 echo 50 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
562 echo 50 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
563 echo 50 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
564 echo 50 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
565 echo 3 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run
566 echo 3 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run
567 echo 3 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run
568 echo 3 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run
569
570 # disable thermal core_control to update scaling_min_freq
571 echo 0 > /sys/module/msm_thermal/core_control/enabled
572 echo 1 > /sys/devices/system/cpu/cpu0/online
573 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
574 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
575 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
576 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
577 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
578 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
579 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/target_loads
580 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
581 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
582 chown -h system.system /sys/class/devfreq/0.qcom,cpubw/min_freq
583 chown -h system.system /sys/class/devfreq/0.qcom,cpubw/max_freq
584 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
585 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
586 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
587 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
588 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
589 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/target_loads
590 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
591 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
592 chmod -h 0660 /sys/class/devfreq/0.qcom,cpubw/min_freq
593 chmod -h 0660 /sys/class/devfreq/0.qcom,cpubw/max_freq
594 echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
595 # enable thermal core_control now
596 echo 1 > /sys/module/msm_thermal/core_control/enabled
597
598 echo "25000 1094400:50000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
599 echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
600 echo 25000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
601 echo 998400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
602 echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
603 echo "1 800000:85 998400:90 1094400:80" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
604 echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
605 echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
606 echo 40 > /sys/class/kgsl/kgsl-3d0/idle_timer
607
608 # Bring up all cores online
609 echo 1 > /sys/devices/system/cpu/cpu1/online
610 echo 1 > /sys/devices/system/cpu/cpu2/online
611 echo 1 > /sys/devices/system/cpu/cpu3/online
612 ;;
613 esac
614
615 # Apply governor settings for 8936
616 case "$soc_id" in
617 "233" | "240" | "242")
618
619 # HMP scheduler load tracking settings
620 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
621
622 # HMP Task packing settings for 8936
623 echo 50 > /proc/sys/kernel/sched_small_task
624 echo 50 > /proc/sys/kernel/sched_mostly_idle_load
625 echo 10 > /proc/sys/kernel/sched_mostly_idle_nr_run
626
627 # disable thermal core_control to update scaling_min_freq, interactive gov
628 echo 0 > /sys/module/msm_thermal/core_control/enabled
629 echo 1 > /sys/devices/system/cpu/cpu0/online
630 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
631 echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
632 # enable thermal core_control now
633 echo 1 > /sys/module/msm_thermal/core_control/enabled
634
635 echo "25000 1113600:50000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
636 echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
637 echo 25000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
638 echo 960000 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
639 echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
640 echo "1 800000:85 1113600:90 1267200:80" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
641 echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
642 echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
643
644 # Bring up all cores online
645 echo 1 > /sys/devices/system/cpu/cpu1/online
646 echo 1 > /sys/devices/system/cpu/cpu2/online
647 echo 1 > /sys/devices/system/cpu/cpu3/online
648 echo 1 > /sys/devices/system/cpu/cpu4/online
649
650 for gpu_bimc_io_percent in /sys/class/devfreq/qcom,gpubw*/bw_hwmon/io_percent
651 do
652 echo 40 > $gpu_bimc_io_percent
653 done
654
655 ;;
656 esac
657
658 # Apply governor settings for 8939
659 case "$soc_id" in
660 "239" | "241" | "263" | "268" | "269" | "270" | "271")
661 # disable thermal core_control for updating interactive gov settings
662 echo 0 > /sys/module/msm_thermal/core_control/enabled
663
664 # change sched_window_stats_policy same as KK version
665 echo 2 > /proc/sys/kernel/sched_window_stats_policy
666
667 # enable governor for perf cluster
668 echo 1 > /sys/devices/system/cpu/cpu0/online
669 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
670 # enable governor for power cluster
671 echo 1 >/sys/devices/system/cpu/cpu4/online
672 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
673
674 # HMP Task packing settings for 8939, 8929
675 echo 30 > /proc/sys/kernel/sched_small_task
676 echo 50 > /proc/sys/kernel/sched_mostly_idle_load
677 echo 3 > /proc/sys/kernel/sched_mostly_idle_nr_run
678
679 for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor
680 do
681 echo "cpufreq" > $devfreq_gov
682 done
683
684 if [ "$soc_id" == "0" ]; then
685 for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
686 do
687 echo "bw_hwmon" > $devfreq_gov
688 for cpu_bimc_io_percent in /sys/class/devfreq/qcom,cpubw*/bw_hwmon/io_percent
689 do
690 echo 25 > $cpu_bimc_io_percent
691 done
692 done
693 for poll in /sys/class/devfreq/qcom,cpubw*/polling_interval
694 do
695 echo 20 > $poll
696 done
697 else
698 # Bus-DCVS settings
699 echo "bw_hwmon" > /sys/class/devfreq/0.qcom,cpubw/governor
700 echo 16 > /sys/class/devfreq/0.qcom,cpubw/bw_hwmon/io_percent
701 echo 20 > /sys/class/devfreq/0.qcom,cpubw/polling_interval
702
703 chown -h system.system /sys/class/devfreq/0.qcom,cpubw/governor
704 chown -h system.system /sys/class/devfreq/0.qcom,cpubw/bw_hwmon/io_percent
705 chown -h system.system /sys/class/devfreq/0.qcom,cpubw/polling_interval
706 chown -h system.system /sys/class/devfreq/0.qcom,cpubw/max_freq
707 chown -h system.system /sys/class/devfreq/0.qcom,cpubw/min_freq
708 chmod -h 0660 /sys/class/devfreq/0.qcom,cpubw/governor
709 chmod -h 0660 /sys/class/devfreq/0.qcom,cpubw/bw_hwmon/io_percent
710 chmod -h 0660 /sys/class/devfreq/0.qcom,cpubw/polling_interval
711 chmod -h 0664 /sys/class/devfreq/0.qcom,cpubw/max_freq
712 chmod -h 0664 /sys/class/devfreq/0.qcom,cpubw/min_freq
713 fi
714
715 for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor
716 do
717 echo "powersave" > $devfreq_gov
718 for timeout in /sys/class/devfreq/qcom,mincpubw*/cpufreq/timeout
719 do
720 echo 20 > $timeout
721 done
722 done
723
724 for gpu_bimc_io_percent in /sys/class/devfreq/qcom,gpubw*/bw_hwmon/io_percent
725 do
726 echo 40 > $gpu_bimc_io_percent
727 done
728
729 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
730 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
731 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
732 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
733 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
734 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
735 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
736 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
737 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/lpm_disable_freq
738 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
739 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
740 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
741 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
742 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
743 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
744 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
745 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
746 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
747 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
748 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/lpm_disable_freq
749 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
750 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
751
752 echo "25000 1100000:50000 1300000:25000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
753 echo 99 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
754 echo 25000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
755 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
756 echo 2000000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/lpm_disable_freq
757 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
758 echo "63 500000:85 850000:80 1000000:95" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
759 echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
760 echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
761 echo 499200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
762 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
763 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
764
765 # Set governor parameters for power cluster
766 chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
767 chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
768 chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
769 chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
770 chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
771 chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
772 chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
773 chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
774 chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/lpm_disable_freq
775 chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
776 chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
777 chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
778 chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
779 chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
780 chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
781 chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
782 chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
783 chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
784 chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
785 chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/lpm_disable_freq
786 chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
787 chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
788
789 echo "25000 800000:50000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
790 echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
791 echo 25000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
792 echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
793 echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/lpm_disable_freq
794 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
795 echo "85 800000:90" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
796 echo 50000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
797 echo 50000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
798 echo 533333 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
799 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
800 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
801
802 echo 400000 > /proc/sys/kernel/sched_freq_inc_notify
803 echo 400000 > /proc/sys/kernel/sched_freq_dec_notify
804
805 # enable thermal core_control now
806 echo 1 > /sys/module/msm_thermal/core_control/enabled
807
808 echo 1 > /sys/devices/system/cpu/cpu1/online
809 echo 1 > /sys/devices/system/cpu/cpu2/online
810 echo 1 > /sys/devices/system/cpu/cpu3/online
811 echo 1 > /sys/devices/system/cpu/cpu4/online
812 echo 1 > /sys/devices/system/cpu/cpu5/online
813 echo 1 > /sys/devices/system/cpu/cpu6/online
814 echo 1 > /sys/devices/system/cpu/cpu7/online
815 chown -h root.system /sys/devices/system/cpu/cpu0/online
816 chown -h root.system /sys/devices/system/cpu/cpu1/online
817 chown -h root.system /sys/devices/system/cpu/cpu2/online
818 chown -h root.system /sys/devices/system/cpu/cpu3/online
819 chown -h root.system /sys/devices/system/cpu/cpu4/online
820 chown -h root.system /sys/devices/system/cpu/cpu5/online
821 chown -h root.system /sys/devices/system/cpu/cpu6/online
822 chown -h root.system /sys/devices/system/cpu/cpu7/online
823 chmod -h 664 /sys/devices/system/cpu/cpu0/online
824 chmod -h 664 /sys/devices/system/cpu/cpu1/online
825 chmod -h 664 /sys/devices/system/cpu/cpu2/online
826 chmod -h 664 /sys/devices/system/cpu/cpu3/online
827 chmod -h 664 /sys/devices/system/cpu/cpu4/online
828 chmod -h 664 /sys/devices/system/cpu/cpu5/online
829 chmod -h 664 /sys/devices/system/cpu/cpu6/online
830 chmod -h 664 /sys/devices/system/cpu/cpu7/online
831 echo Y > /sys/module/lpm_levels/system/power/power-l2-active/idle_enabled
832 echo Y > /sys/module/lpm_levels/system/power/power-l2-pc/idle_enabled
833 echo Y > /sys/module/lpm_levels/system/performance/performance-l2-active/idle_enabled
834 echo Y > /sys/module/lpm_levels/system/performance/performance-l2-pc/idle_enabled
835 echo Y > /sys/module/lpm_levels/system/power/power-l2-pc/suspend_enabled
836 echo Y > /sys/module/lpm_levels/system/performance/performance-l2-pc/suspend_enabled
837 echo Y > /sys/module/lpm_levels/system/system-cci-active/idle_enabled
838 echo Y > /sys/module/lpm_levels/system/system-cci-retention/idle_enabled
839 echo Y > /sys/module/lpm_levels/system/system-cci-pc/idle_enabled
840 echo Y > /sys/module/lpm_levels/system/system-cci-pc/suspend_enabled
841 echo 90 > /proc/sys/kernel/sched_upmigrate
842 echo 70 > /proc/sys/kernel/sched_downmigrate
843 echo 30 > /proc/sys/kernel/sched_init_task_load
844 echo 5 > /proc/sys/kernel/sched_ravg_hist_size
845 echo 10 > /proc/sys/kernel/sched_upmigrate_min_nice
846 echo 1 > /proc/sys/kernel/sched_boot_complete
847 echo 30 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
848 echo 30 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
849 echo 30 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
850 echo 30 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
851 echo 30 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_load
852 echo 30 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_load
853 echo 30 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_load
854 echo 30 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_load
855 echo 960000 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_freq
856 echo 960000 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_freq
857 echo 960000 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_freq
858 echo 960000 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_freq
859 chown -h radio.system /sys/class/kgsl/kgsl-3d0/default_pwrlevel
860 chown -h radio.system /sys/class/kgsl/kgsl-3d0/idle_timer
861 chmod -h 664 /sys/class/kgsl/kgsl-3d0/default_pwrlevel
862 chmod -h 664 /sys/class/kgsl/kgsl-3d0/idle_timer
863 rm /data/system/default_values
864 ;;
865 esac
866
867 # Apply governor settings for 8939 V3.0. confirm the soc id value and method
868 case "$soc_id" in
869 "65536" )
870 # HMP scheduler settings for 8939 V3.0
871 echo 3 > /proc/sys/kernel/sched_window_stats_policy
872 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
873
874 # HMP Task packing settings for 8939 V3.0
875 echo 20 > /proc/sys/kernel/sched_small_task
876 echo 30 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
877 echo 30 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
878 echo 30 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
879 echo 30 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
880 echo 30 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_load
881 echo 30 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_load
882 echo 30 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_load
883 echo 30 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_load
884
885 echo 3 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run
886 echo 3 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run
887 echo 3 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run
888 echo 3 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run
889 echo 3 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_nr_run
890 echo 3 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_nr_run
891 echo 3 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_nr_run
892 echo 3 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_nr_run
893
894 echo 0 > /sys/devices/system/cpu/cpu0/sched_prefer_idle
895 echo 0 > /sys/devices/system/cpu/cpu1/sched_prefer_idle
896 echo 0 > /sys/devices/system/cpu/cpu2/sched_prefer_idle
897 echo 0 > /sys/devices/system/cpu/cpu3/sched_prefer_idle
898 echo 0 > /sys/devices/system/cpu/cpu4/sched_prefer_idle
899 echo 0 > /sys/devices/system/cpu/cpu5/sched_prefer_idle
900 echo 0 > /sys/devices/system/cpu/cpu6/sched_prefer_idle
901 echo 0 > /sys/devices/system/cpu/cpu7/sched_prefer_idle
902
903 for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
904 do
905 echo "bw_hwmon" > $devfreq_gov
906 for cpu_io_percent in /sys/class/devfreq/qcom,cpubw*/bw_hwmon/io_percent
907 do
908 echo 20 > $cpu_io_percent
909 done
910 done
911
912 for gpu_bimc_io_percent in /sys/class/devfreq/qcom,gpubw*/bw_hwmon/io_percent
913 do
914 echo 40 > $gpu_bimc_io_percent
915 done
916 # disable thermal core_control to update interactive gov settings
917 echo 0 > /sys/module/msm_thermal/core_control/enabled
918
919 # enable governor for perf cluster
920 echo 1 > /sys/devices/system/cpu/cpu0/online
921 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
922 echo "19000 1113600:39000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
923 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
924 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
925 echo 1113600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
926 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
927 echo "1 960000:85 1113600:90 1344000:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
928 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
929 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
930 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
931
932 # enable governor for power cluster
933 echo 1 > /sys/devices/system/cpu/cpu4/online
934 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
935 echo "39000 998400:19000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
936 echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
937 echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
938 echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
939 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
940 echo "1 800000:90" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
941 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
942 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
943 echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
944
945 # enable thermal core_control now
946 echo 1 > /sys/module/msm_thermal/core_control/enabled
947
948 # Bring up all cores online
949 echo 1 > /sys/devices/system/cpu/cpu1/online
950 echo 1 > /sys/devices/system/cpu/cpu2/online
951 echo 1 > /sys/devices/system/cpu/cpu3/online
952 echo 1 > /sys/devices/system/cpu/cpu5/online
953 echo 1 > /sys/devices/system/cpu/cpu6/online
954 echo 1 > /sys/devices/system/cpu/cpu7/online
955
956 # HMP scheduler (big.Little cluster related) settings
957 echo 93 > /proc/sys/kernel/sched_upmigrate
958 echo 70 > /proc/sys/kernel/sched_downmigrate
959
960 # Enable sched guided freq control
961 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
962 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
963 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
964 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
965 echo 50000 > /proc/sys/kernel/sched_freq_inc_notify
966 echo 50000 > /proc/sys/kernel/sched_freq_dec_notify
967
968 # Enable core control
969 insmod /system/lib/modules/core_ctl.ko
970 echo 2 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
971 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/max_cpus
972 echo 68 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
973 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
974 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
975
976 ;;
977 esac
978 ;;
979esac
980
981case "$target" in
982 "msm8952")
983
984 # HMP scheduler settings for 8952 soc id is 264
985 echo 3 > /proc/sys/kernel/sched_window_stats_policy
986 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
987
988 # HMP Task packing settings for 8952
989 echo 20 > /proc/sys/kernel/sched_small_task
990 echo 30 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
991 echo 30 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
992 echo 30 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
993 echo 30 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
994 echo 30 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_load
995 echo 30 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_load
996 echo 30 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_load
997 echo 30 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_load
998
999 echo 3 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run
1000 echo 3 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run
1001 echo 3 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run
1002 echo 3 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run
1003 echo 3 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_nr_run
1004 echo 3 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_nr_run
1005 echo 3 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_nr_run
1006 echo 3 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_nr_run
1007
1008 echo 0 > /sys/devices/system/cpu/cpu0/sched_prefer_idle
1009 echo 0 > /sys/devices/system/cpu/cpu1/sched_prefer_idle
1010 echo 0 > /sys/devices/system/cpu/cpu2/sched_prefer_idle
1011 echo 0 > /sys/devices/system/cpu/cpu3/sched_prefer_idle
1012 echo 0 > /sys/devices/system/cpu/cpu4/sched_prefer_idle
1013 echo 0 > /sys/devices/system/cpu/cpu5/sched_prefer_idle
1014 echo 0 > /sys/devices/system/cpu/cpu6/sched_prefer_idle
1015 echo 0 > /sys/devices/system/cpu/cpu7/sched_prefer_idle
1016
1017 for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
1018 do
1019 echo "bw_hwmon" > $devfreq_gov
1020 for cpu_io_percent in /sys/class/devfreq/qcom,cpubw*/bw_hwmon/io_percent
1021 do
1022 echo 20 > $cpu_io_percent
1023 done
1024 done
1025
1026 for gpu_bimc_io_percent in /sys/class/devfreq/qcom,gpubw*/bw_hwmon/io_percent
1027 do
1028 echo 40 > $gpu_bimc_io_percent
1029 done
1030 # disable thermal core_control to update interactive gov settings
1031 echo 0 > /sys/module/msm_thermal/core_control/enabled
1032
1033 # enable governor for perf cluster
1034 echo 1 > /sys/devices/system/cpu/cpu0/online
1035 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1036 echo "19000 1113600:39000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
1037 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
1038 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
1039 echo 1113600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
1040 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
1041 echo "1 960000:85 1113600:90 1344000:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
1042 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
1043 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
1044 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1045
1046 # enable governor for power cluster
1047 echo 1 > /sys/devices/system/cpu/cpu4/online
1048 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
1049 echo "39000 998400:19000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
1050 echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
1051 echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
1052 echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
1053 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
1054 echo "1 800000:90" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
1055 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
1056 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
1057 echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
1058
1059 # enable thermal core_control now
1060 echo 1 > /sys/module/msm_thermal/core_control/enabled
1061
1062 # Bring up all cores online
1063 echo 1 > /sys/devices/system/cpu/cpu1/online
1064 echo 1 > /sys/devices/system/cpu/cpu2/online
1065 echo 1 > /sys/devices/system/cpu/cpu3/online
1066 echo 1 > /sys/devices/system/cpu/cpu5/online
1067 echo 1 > /sys/devices/system/cpu/cpu6/online
1068 echo 1 > /sys/devices/system/cpu/cpu7/online
1069
1070 # HMP scheduler (big.Little cluster related) settings
1071 echo 93 > /proc/sys/kernel/sched_upmigrate
1072 echo 70 > /proc/sys/kernel/sched_downmigrate
1073
1074 # Enable sched guided freq control
1075 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
1076 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
1077 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
1078 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
1079 echo 50000 > /proc/sys/kernel/sched_freq_inc_notify
1080 echo 50000 > /proc/sys/kernel/sched_freq_dec_notify
1081
1082 # Enable core control
1083 insmod /system/lib/modules/core_ctl.ko
1084 echo 2 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
1085 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/max_cpus
1086 echo 68 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
1087 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
1088 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
1089 ;;
1090esac
1091
1092
1093case "$target" in
1094 "apq8084")
1095 echo 4 > /sys/module/lpm_levels/enable_low_power/l2
1096 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
1097 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
1098 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
1099 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
1100 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
1101 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
1102 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
1103 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
1104 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
1105 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
1106 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
1107 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
1108 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
1109 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
1110 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
1111 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
1112 echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled
1113 echo 1 > /sys/module/msm_pm/modes/cpu1/retention/idle_enabled
1114 echo 1 > /sys/module/msm_pm/modes/cpu2/retention/idle_enabled
1115 echo 1 > /sys/module/msm_pm/modes/cpu3/retention/idle_enabled
1116 echo 0 > /sys/module/msm_thermal/core_control/enabled
1117 echo 1 > /sys/devices/system/cpu/cpu1/online
1118 echo 1 > /sys/devices/system/cpu/cpu2/online
1119 echo 1 > /sys/devices/system/cpu/cpu3/online
1120 for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
1121 do
1122 echo "cpubw_hwmon" > $devfreq_gov
1123 done
1124 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1125 echo "interactive" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
1126 echo "interactive" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
1127 echo "interactive" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
1128 echo "20000 1400000:40000 1700000:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
1129 echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
1130 echo 1497600 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
1131 echo "85 1500000:90 1800000:70" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
1132 echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
1133 echo 20 > /sys/module/cpu_boost/parameters/boost_ms
1134 echo 1728000 > /sys/module/cpu_boost/parameters/sync_threshold
1135 echo 100000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
1136 echo 1497600 > /sys/module/cpu_boost/parameters/input_boost_freq
1137 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
1138 echo 1 > /dev/cpuctl/apps/cpu.notify_on_migrate
1139 echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1140 echo 300000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
1141 echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
1142 echo 300000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
1143 echo 1 > /sys/module/msm_thermal/core_control/enabled
1144 setprop ro.qualcomm.perf.cores_online 2
1145 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
1146 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1147 chown -h root.system /sys/devices/system/cpu/mfreq
1148 chmod -h 220 /sys/devices/system/cpu/mfreq
1149 chown -h root.system /sys/devices/system/cpu/cpu1/online
1150 chown -h root.system /sys/devices/system/cpu/cpu2/online
1151 chown -h root.system /sys/devices/system/cpu/cpu3/online
1152 chmod -h 664 /sys/devices/system/cpu/cpu1/online
1153 chmod -h 664 /sys/devices/system/cpu/cpu2/online
1154 chmod -h 664 /sys/devices/system/cpu/cpu3/online
1155 ;;
1156esac
1157
1158case "$target" in
1159 "mpq8092")
1160 echo 4 > /sys/module/lpm_levels/enable_low_power/l2
1161 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
1162 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
1163 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
1164 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
1165 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
1166 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
1167 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
1168 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
1169 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
1170 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
1171 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
1172 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
1173 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
1174 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
1175 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
1176 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
1177 echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled
1178 echo 1 > /sys/module/msm_pm/modes/cpu1/retention/idle_enabled
1179 echo 1 > /sys/module/msm_pm/modes/cpu2/retention/idle_enabled
1180 echo 1 > /sys/module/msm_pm/modes/cpu3/retention/idle_enabled
1181 echo 0 > /sys/module/msm_thermal/core_control/enabled
1182 echo 1 > /sys/devices/system/cpu/cpu1/online
1183 echo 1 > /sys/devices/system/cpu/cpu2/online
1184 echo 1 > /sys/devices/system/cpu/cpu3/online
1185 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1186 echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
1187 echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
1188 echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
1189 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1190 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
1191 echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
1192 echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1193 echo 300000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
1194 echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
1195 echo 300000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
1196 echo 1 > /sys/module/msm_thermal/core_control/enabled
1197 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
1198 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1199 chown -h root.system /sys/devices/system/cpu/mfreq
1200 chmod -h 220 /sys/devices/system/cpu/mfreq
1201 chown -h root.system /sys/devices/system/cpu/cpu1/online
1202 chown -h root.system /sys/devices/system/cpu/cpu2/online
1203 chown -h root.system /sys/devices/system/cpu/cpu3/online
1204 chmod -h 664 /sys/devices/system/cpu/cpu1/online
1205 chmod -h 664 /sys/devices/system/cpu/cpu2/online
1206 chmod -h 664 /sys/devices/system/cpu/cpu3/online
1207 ;;
1208esac
1209
1210case "$target" in
1211 "msm8994")
1212 echo 0 > /sys/module/msm_thermal/core_control/enabled
1213 echo -n disable > /sys/devices/soc.*/qcom,bcl.*/mode
1214 bcl_hotplug_mask=`cat /sys/devices/soc.*/qcom,bcl.*/hotplug_mask`
1215 echo 0 > /sys/devices/soc.*/qcom,bcl.*/hotplug_mask
1216 echo -n enable > /sys/devices/soc.*/qcom,bcl.*/mode
1217 echo 1 > /sys/devices/system/cpu/cpu4/online
1218 echo 1 > /sys/devices/system/cpu/cpu5/online
1219 echo 1 > /sys/devices/system/cpu/cpu6/online
1220 echo 1 > /sys/devices/system/cpu/cpu7/online
1221 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
1222 # configure governor settings for little cluster
1223 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1224 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
1225 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
1226 echo "20000 750000:40000 800000:20000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
1227 echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
1228 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
1229 echo 768000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
1230 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
1231 echo "85 780000:90" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
1232 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
1233 echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1234 # configure governor settings for big cluster
1235 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
1236 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
1237 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
1238 echo "20000 750000:40000 800000:20000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
1239 echo 99 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
1240 echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
1241 echo 768000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
1242 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
1243 echo "85 780000:90" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
1244 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
1245 echo 384000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
1246 echo 1 > /sys/module/msm_thermal/core_control/enabled
1247 echo -n disable > /sys/devices/soc.*/qcom,bcl.*/mode
1248 echo $bcl_hotplug_mask > /sys/devices/soc.*/qcom,bcl.*/hotplug_mask
1249 echo -n enable > /sys/devices/soc.*/qcom,bcl.*/mode
1250 # Enable task migration fixups in the scheduler
1251 echo 1 > /proc/sys/kernel/sched_migration_fixup
1252 for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
1253 do
1254 echo "bw_hwmon" > $devfreq_gov
1255 done
1256 /system/bin/energy-awareness
1257 #enable rps static configuration
1258 echo 8 > /sys/class/net/rmnet_ipa0/queues/rx-0/rps_cpus
1259 echo 30 > /proc/sys/kernel/sched_small_task
1260 ;;
1261esac
1262
1263case "$target" in
1264 "msm8909")
1265
1266 if [ -f /sys/devices/soc0/soc_id ]; then
1267 soc_id=`cat /sys/devices/soc0/soc_id`
1268 else
1269 soc_id=`cat /sys/devices/system/soc/soc0/id`
1270 fi
1271
1272 #Enable adaptive LMK and set vmpressure_file_min
1273 echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
1274 echo 69253 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
1275
1276 # HMP scheduler settings for 8909 similiar to 8916
1277 echo 3 > /proc/sys/kernel/sched_window_stats_policy
1278 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
1279
1280 # HMP Task packing settings for 8909 similiar to 8916
1281 echo 30 > /proc/sys/kernel/sched_small_task
1282 echo 50 > /proc/sys/kernel/sched_mostly_idle_load
1283 echo 10 > /proc/sys/kernel/sched_mostly_idle_nr_run
1284
1285 # Apply governor settings for 8909
1286
1287 # disable thermal core_control to update scaling_min_freq
1288 echo 0 > /sys/module/msm_thermal/core_control/enabled
1289 echo 1 > /sys/devices/system/cpu/cpu0/online
1290 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1291 echo 400000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1292 # enable thermal core_control now
1293 echo 1 > /sys/module/msm_thermal/core_control/enabled
1294
1295 echo "25000 800000:50000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
1296 echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
1297 echo 25000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
1298 echo 800000 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
1299 echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
1300 echo "1 400000:85 998400:90 1094400:80" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
1301 echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
1302 echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
1303
1304 # Bring up all cores online
1305 echo 1 > /sys/devices/system/cpu/cpu1/online
1306 echo 1 > /sys/devices/system/cpu/cpu2/online
1307 echo 1 > /sys/devices/system/cpu/cpu3/online
1308 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
1309
1310 for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
1311 do
1312 echo "bw_hwmon" > $devfreq_gov
1313 done
1314 ;;
1315esac
1316
1317case "$target" in
1318 "msm7627_ffa" | "msm7627_surf" | "msm7627_6x")
1319 echo 25000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1320 ;;
1321esac
1322
1323case "$target" in
1324 "qsd8250_surf" | "qsd8250_ffa" | "qsd8650a_st1x")
1325 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1326 ;;
1327esac
1328
1329case "$target" in
1330 "qsd8650a_st1x")
1331 mount -t debugfs none /sys/kernel/debug
1332 ;;
1333esac
1334
1335chown -h system /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1336chown -h system /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
1337chown -h system /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
1338
1339emmc_boot=`getprop ro.boot.emmc`
1340case "$emmc_boot"
1341 in "true")
1342 chown -h system /sys/devices/platform/rs300000a7.65536/force_sync
1343 chown -h system /sys/devices/platform/rs300000a7.65536/sync_sts
1344 chown -h system /sys/devices/platform/rs300100a7.65536/force_sync
1345 chown -h system /sys/devices/platform/rs300100a7.65536/sync_sts
1346 ;;
1347esac
1348
1349case "$target" in
1350 "msm8960" | "msm8660" | "msm7630_surf")
1351 echo 10 > /sys/devices/platform/msm_sdcc.3/idle_timeout
1352 ;;
1353 "msm7627a")
1354 echo 10 > /sys/devices/platform/msm_sdcc.1/idle_timeout
1355 ;;
1356esac
1357
1358# Post-setup services
1359case "$target" in
1360 "msm8660" | "msm8960" | "msm8226" | "msm8610" | "mpq8092" )
1361 start mpdecision
1362 ;;
1363 "msm8916")
1364 if [ -f /sys/devices/soc0/soc_id ]; then
1365 soc_id=`cat /sys/devices/soc0/soc_id`
1366 else
1367 soc_id=`cat /sys/devices/system/soc/soc0/id`
1368 fi
1369 case $soc_id in
1370 "239" | "241" | "263" | "268" | "269" | "270" | "271")
1371 setprop ro.min_freq_0 499200
1372 setprop ro.min_freq_4 533333
1373 ;;
1374 "206" | "247" | "248" | "249" | "250" | "233" | "240" | "242")
1375 setprop ro.min_freq_0 800000
1376 ;;
1377 esac
1378 #start perfd after setprop
1379 start perfd # start perfd on 8916, 8939 and 8929
1380 ;;
1381 "msm8974")
1382 start mpdecision
1383 echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb
1384 ;;
1385 "msm8994")
1386 rm /data/system/default_values
1387 setprop ro.min_freq_0 384000
1388 setprop ro.min_freq_4 384000
1389 start perfd
1390 ;;
1391 "apq8084")
1392 rm /data/system/default_values
1393 start mpdecision
1394 echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb
1395 echo 512 > /sys/block/sda/bdi/read_ahead_kb
1396 echo 512 > /sys/block/sdb/bdi/read_ahead_kb
1397 echo 512 > /sys/block/sdc/bdi/read_ahead_kb
1398 echo 512 > /sys/block/sdd/bdi/read_ahead_kb
1399 echo 512 > /sys/block/sde/bdi/read_ahead_kb
1400 echo 512 > /sys/block/sdf/bdi/read_ahead_kb
1401 echo 512 > /sys/block/sdg/bdi/read_ahead_kb
1402 echo 512 > /sys/block/sdh/bdi/read_ahead_kb
1403 ;;
1404 "msm7627a")
1405 if [ -f /sys/devices/soc0/soc_id ]; then
1406 soc_id=`cat /sys/devices/soc0/soc_id`
1407 else
1408 soc_id=`cat /sys/devices/system/soc/soc0/id`
1409 fi
1410 case "$soc_id" in
1411 "127" | "128" | "129")
1412 start mpdecision
1413 ;;
1414 esac
1415 ;;
1416esac
1417
1418# Enable Power modes and set the CPU Freq Sampling rates
1419case "$target" in
1420 "msm7627a")
1421 start qosmgrd
1422 echo 1 > /sys/module/pm2/modes/cpu0/standalone_power_collapse/idle_enabled
1423 echo 1 > /sys/module/pm2/modes/cpu1/standalone_power_collapse/idle_enabled
1424 echo 1 > /sys/module/pm2/modes/cpu0/standalone_power_collapse/suspend_enabled
1425 echo 1 > /sys/module/pm2/modes/cpu1/standalone_power_collapse/suspend_enabled
1426 #SuspendPC:
1427 echo 1 > /sys/module/pm2/modes/cpu0/power_collapse/suspend_enabled
1428 #IdlePC:
1429 echo 1 > /sys/module/pm2/modes/cpu0/power_collapse/idle_enabled
1430 echo 25000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1431 ;;
1432esac
1433
1434# Change adj level and min_free_kbytes setting for lowmemory killer to kick in
1435case "$target" in
1436 "msm7627a")
1437 echo 0,1,2,4,9,12 > /sys/module/lowmemorykiller/parameters/adj
1438 echo 5120 > /proc/sys/vm/min_free_kbytes
1439 ;;
1440esac
1441
1442# Install AdrenoTest.apk if not already installed
1443if [ -f /data/prebuilt/AdrenoTest.apk ]; then
1444 if [ ! -d /data/data/com.qualcomm.adrenotest ]; then
1445 pm install /data/prebuilt/AdrenoTest.apk
1446 fi
1447fi
1448
1449# Install SWE_Browser.apk if not already installed
1450if [ -f /data/prebuilt/SWE_AndroidBrowser.apk ]; then
1451 if [ ! -d /data/data/com.android.swe.browser ]; then
1452 pm install /data/prebuilt/SWE_AndroidBrowser.apk
1453 fi
1454fi
1455
1456# Change adj level and min_free_kbytes setting for lowmemory killer to kick in
1457case "$target" in
1458 "msm8660")
1459 start qosmgrd
1460 echo 0,1,2,4,9,12 > /sys/module/lowmemorykiller/parameters/adj
1461 echo 5120 > /proc/sys/vm/min_free_kbytes
1462 ;;
1463esac
1464
1465case "$target" in
1466 "msm8226" | "msm8974" | "msm8610" | "apq8084" | "mpq8092" | "msm8610" | "msm8916" | "msm8994")
1467 # Let kernel know our image version/variant/crm_version
1468 image_version="10:"
1469 image_version+=`getprop ro.build.id`
1470 image_version+=":"
1471 image_version+=`getprop ro.build.version.incremental`
1472 image_variant=`getprop ro.product.name`
1473 image_variant+="-"
1474 image_variant+=`getprop ro.build.type`
1475 oem_version=`getprop ro.build.version.codename`
1476 echo 10 > /sys/devices/soc0/select_image
1477 echo $image_version > /sys/devices/soc0/image_version
1478 echo $image_variant > /sys/devices/soc0/image_variant
1479 echo $oem_version > /sys/devices/soc0/image_crm_version
1480 ;;
1481esac
1482
1483# Create native cgroup and move all tasks to it. Allot 15% real-time
1484# bandwidth limit to native cgroup (which is what remains after
1485# Android uses up 80% real-time bandwidth limit). root cgroup should
1486# become empty after all tasks are moved to native cgroup.
1487
1488CGROUP_ROOT=/dev/cpuctl
1489mkdir $CGROUP_ROOT/native
1490echo 150000 > $CGROUP_ROOT/native/cpu.rt_runtime_us
1491
1492# We could be racing with task creation, as a result of which its possible that
1493# we may fail to move all tasks from root cgroup to native cgroup in one shot.
1494# Retry few times before giving up.
1495
1496for loop_count in 1 2 3
1497do
1498 for i in $(cat $CGROUP_ROOT/tasks)
1499 do
1500 echo $i > $CGROUP_ROOT/native/tasks
1501 done
1502
1503 root_tasks=$(cat $CGROUP_ROOT/tasks)
1504 if [ -z "$root_tasks" ]
1505 then
1506 break
1507 fi
1508done
1509
1510# Check if we failed to move all tasks from root cgroup
1511if [ ! -z "$root_tasks" ]
1512then
1513 echo "Error: Could not move all tasks to native cgroup"
1514fi