blob: 0ad83156d9d08761d35c27515bdb2b31abb4ca8e [file] [log] [blame]
merothh32be6882022-01-03 01:54:57 +05301#! /vendor/bin/sh
2
3# Copyright (c) 2012-2013, 2016-2020, The Linux Foundation. All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are met:
7# * Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.
9# * Redistributions in binary form must reproduce the above copyright
10# notice, this list of conditions and the following disclaimer in the
11# documentation and/or other materials provided with the distribution.
12# * Neither the name of The Linux Foundation nor
13# the names of its contributors may be used to endorse or promote
14# products derived from this software without specific prior written
15# permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
Michael Bestasc3ad1cd2023-10-03 15:27:40 +030029# Changes from Qualcomm Innovation Center are provided under the following license:
30# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
31# SPDX-License-Identifier: BSD-3-Clause-Clear
32#
merothh32be6882022-01-03 01:54:57 +053033
34function 8953_sched_dcvs_eas()
35{
36 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
37 #governor settings
38 echo 1 > /sys/devices/system/cpu/cpu0/online
39 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
40 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us
41 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
42 #set the hispeed_freq
43 echo 1401600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
44 #default value for hispeed_load is 90, for 8953 and sdm450 it should be 85
45 echo 85 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_load
46 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl
47 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq
48
49 echo 652800 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
50
51 #input boost params
52 echo 1401600 > /sys/module/cpu_boost/parameters/input_boost_freq
53 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
54
55 # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
56 echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost
57 echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost
58 echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost
59 echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost
60 echo -6 > /sys/devices/system/cpu/cpu4/sched_load_boost
61 echo -6 > /sys/devices/system/cpu/cpu5/sched_load_boost
62 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
63 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
64
65 # Enable bus-dcvs
66 for device in /sys/devices/platform/soc
67 do
68 for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw
69 do
70 echo "bw_hwmon" > $cpubw/governor
Rohit R Sekharadf49712022-11-17 21:05:16 +053071 echo 34 > $cpubw/bw_hwmon/io_percent
merothh32be6882022-01-03 01:54:57 +053072 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
Rohit R Sekharadf49712022-11-17 21:05:16 +053073 echo 20 > $cpubw/bw_hwmon/hist_memory
74 echo 10 > $cpubw/bw_hwmon/hyst_length
75 echo 1600 > $cpubw/bw_hwmon/idle_mbps
76 echo 20 > $cpubw/bw_hwmon/low_power_delay
77 echo 34 > $cpubw/bw_hwmon/low_power_io_percent
78 echo "1611 3221 5859 6445 7104" > $cpubw/bw_hwmon/mbps_zones
79 echo 4 > $cpubw/bw_hwmon/sample_ms
80 echo 250 > $cpubw/bw_hwmon/up_scale
81 echo 1611 > $cpubw/min_freq
merothh32be6882022-01-03 01:54:57 +053082 done
83 done
84 else
85 #governor settings
86 echo 1 > /sys/devices/system/cpu/cpu0/online
87 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
88 echo 0 > /sys/devices/system/cpu/cpufreq/schedutil/up_rate_limit_us
89 echo 0 > /sys/devices/system/cpu/cpufreq/schedutil/down_rate_limit_us
90 #set the hispeed_freq
91 echo 1401600 > /sys/devices/system/cpu/cpufreq/schedutil/hispeed_freq
92 #default value for hispeed_load is 90, for 8953 and sdm450 it should be 85
93 echo 85 > /sys/devices/system/cpu/cpufreq/schedutil/hispeed_load
94
95 echo 652800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
96
97 fi
98}
99
100function 8917_sched_dcvs_eas()
101{
102 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
103 #governor settings
104 echo 1 > /sys/devices/system/cpu/cpu0/online
105 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
106 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us
107 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
108 #set the hispeed_freq
109 echo 1094400 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
110 #default value for hispeed_load is 90, for 8917 it should be 85
111 echo 85 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_load
112 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl
113 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq
114
115 echo 960000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
116
117 #input boost params
118 echo 1094400 > /sys/module/cpu_boost/parameters/input_boost_freq
119 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
120
121 # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
122 echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost
123 echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost
124 echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost
125 echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost
126
127 # Enable bus-dcvs
128 for device in /sys/devices/platform/soc
129 do
130 for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw
131 do
132 echo "bw_hwmon" > $cpubw/governor
Rohit R Sekharadf49712022-11-17 21:05:16 +0530133 echo 20 > $cpubw/bw_hwmon/io_percent
134 echo 30 > $cpubw/bw_hwmon/guard_band_mbps
merothh32be6882022-01-03 01:54:57 +0530135 done
136 done
137 else
138 #governor settings
139 echo 1 > /sys/devices/system/cpu/cpu0/online
140 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
141 echo 0 > /sys/devices/system/cpu/cpufreq/schedutil/up_rate_limit_us
142 echo 0 > /sys/devices/system/cpu/cpufreq/schedutil/down_rate_limit_us
143 #set the hispeed_freq
144 echo 1094400 > /sys/devices/system/cpu/cpufreq/schedutil/hispeed_freq
145 #default value for hispeed_load is 90, for 8917 it should be 85
146 echo 85 > /sys/devices/system/cpu/cpufreq/schedutil/hispeed_load
147
148 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
149 fi
150
151 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
152 # memlat specific settings are moved to seperate file under
153 # device/target specific folder
154 setprop vendor.dcvs.prop 1
155 fi
156}
157
158function 8937_sched_dcvs_eas()
159{
160 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
161 # enable governor for perf cluster
162 echo 1 > /sys/devices/system/cpu/cpu0/online
163 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
164 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us
165 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
166 #set the hispeed_freq
167 echo 1094400 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
168 #default value for hispeed_load is 90, for 8937 it should be 85
169 echo 85 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_load
170 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl
171 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq
172
173 echo 960000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
174
175 ## enable governor for power cluster
176 echo 1 > /sys/devices/system/cpu/cpu4/online
177 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
178 #set the hispeed_freq
179 echo 768000 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq
180 #default value for hispeed_load is 90, for 8937 it should be 85
181 echo 85 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_load
182 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl
183 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/rtg_boost_freq
184
185 echo 768000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq
186
187 #input boost params
188 echo 109440 > /sys/module/cpu_boost/parameters/input_boost_freq
189 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
190
191 # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
192 echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost
193 echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost
194 echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost
195 echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost
196 echo -6 > /sys/devices/system/cpu/cpu4/sched_load_boost
197 echo -6 > /sys/devices/system/cpu/cpu5/sched_load_boost
198 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
199 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
200
201 # Enable bus-dcvs
202 for device in /sys/devices/platform/soc
203 do
204 for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw
205 do
206 echo "bw_hwmon" > $cpubw/governor
Rohit R Sekharadf49712022-11-17 21:05:16 +0530207 echo 20 > $cpubw/bw_hwmon/io_percent
208 echo 30 > $cpubw/bw_hwmon/guard_band_mbps
merothh32be6882022-01-03 01:54:57 +0530209 done
210 done
211 else
212 # enable governor for perf cluster
213 echo 1 > /sys/devices/system/cpu/cpu0/online
214 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
215 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
216 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
217 #set the hispeed_freq
218 echo 1094400 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
219 #default value for hispeed_load is 90, for 8937 it should be 85
220 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load
221 ## enable governor for power cluster
222 echo 1 > /sys/devices/system/cpu/cpu4/online
223 echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
224 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/up_rate_limit_us
225 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_rate_limit_us
226 #set the hispeed_freq
227 echo 768000 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq
228 #default value for hispeed_load is 90, for 8937 it should be 85
229 echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_load
230
231 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
232 echo 768000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
233 fi
234
235 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
236 # memlat specific settings are moved to seperate file under
237 # device/target specific folder
238 setprop vendor.dcvs.prop 1
239 fi
240}
241
242function configure_automotive_sku_parameters() {
243
244 echo 1036800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
245 echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
246 echo 1171200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq
247 echo 1785600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
248 echo 902400000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/min_freq
249 echo 902400000 > /sys/class/devfreq/18321110.qcom,cpu4-cpu-l3-lat/min_freq
250 echo 902400000 > /sys/class/devfreq/18321110.qcom,cpu7-cpu-l3-lat/min_freq
251 echo 1612800000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/max_freq
252 echo 1612800000 > /sys/class/devfreq/18321110.qcom,cpu4-cpu-l3-lat/max_freq
253 echo 1612800000 > /sys/class/devfreq/18321110.qcom,cpu7-cpu-l3-lat/max_freq
254 echo 902400000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/min_freq
255 echo 902400000 > /sys/class/devfreq/soc\:qcom,cpu4-cpu-l3-lat/min_freq
256 echo 902400000 > /sys/class/devfreq/soc\:qcom,cpu7-cpu-l3-lat/min_freq
257 echo 1612800000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq
258 echo 1612800000 > /sys/class/devfreq/soc\:qcom,cpu4-cpu-l3-lat/max_freq
259 echo 1612800000 > /sys/class/devfreq/soc\:qcom,cpu7-cpu-l3-lat/max_freq
260
261#read feature id from nvram
262reg_val=`cat /sys/devices/platform/soc/780130.qfprom/qfprom0/nvmem | od -An -t d4`
263feature_id=$(((reg_val >> 20) & 0xFF))
264log -t BOOT -p i "feature id '$feature_id'"
265if [ $feature_id == 0 ]; then
266 echo " SKU Configured : SA8155P"
267 echo 2131200 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
268 echo 2419200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq
269 echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
270elif [ $feature_id == 1 ]; then
271 echo "SKU Configured : SA8150P"
272 echo 1920000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
273 echo 2227200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq
274 echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
275else
276 echo "unknown feature_id value" $feature_id
277fi
278}
279
280function configure_automotive_sku_parameters_sa8195() {
281
282 #Setting the min supported frequencies
283 echo 1113600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
284 echo 1171200 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
285 echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/min_freq
286 echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu4-cpu-l3-lat/min_freq
287 echo 1651200000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/max_freq
288 echo 1651200000 > /sys/class/devfreq/18321110.qcom,cpu4-cpu-l3-lat/max_freq
289 echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/min_freq
290 echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu4-cpu-l3-lat/min_freq
291 echo 1651200000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq
292 echo 1651200000 > /sys/class/devfreq/soc\:qcom,cpu4-cpu-l3-lat/max_freq
293
294 #read feature id
295 reg_val=`cat /sys/devices/platform/soc/780130.qfprom/qfprom0/nvmem | od -An -t d4`
296 feature_id=$(((reg_val >> 20) & 0xFF))
297
298 #setting min gpu freq to 392 MHz
299 echo 4 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel
300 if [ $feature_id == 0 ]; then
301 echo "feature_id is 0 for SA8195AA"
302
303 #setting max cpu freq to 2.496GHz
304 echo 2496000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
305 #setting max gpu freq to 530 MHz
306 echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
307 echo 1804 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq
308 elif [ $feature_id == 1 ] || [ $feature_id == 2 ]; then
309 echo "feature_id is 1 for external SA8195AB"
310 echo "feature_id is 2 for internal SA8195AB"
311
312 #setting max cpu freq to 2.496GHz
313 echo 2496000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
314 #setting max gpu freq to 670 MHz
315 echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
316 echo 2092 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq
317 elif [ $feature_id == 3 ]; then
318 echo "feature_id is 3 for external SA8195AC"
319 else
320 echo "unknown feature_id value" $feature_id
321 fi
322}
323
324function configure_sku_parameters() {
325
326#read feature id from nvram
327reg_val=`cat /sys/devices/platform/soc/780130.qfprom/qfprom0/nvmem | od -An -t d4`
328feature_id=$(((reg_val >> 20) & 0xFF))
329log -t BOOT -p i "feature id '$feature_id'"
330if [ $feature_id == 6 ]; then
331 echo " SKU Configured : SA6145"
332 echo 748800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
333 echo 748800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
334 echo 748800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
335 echo 748800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
336 echo 748800 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
337 echo 748800 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq
338 echo 1017600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq
339 echo 1017600 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq
340 echo 748800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
341 echo 748800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
342 echo 748800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
343 echo 748800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
344 echo 748800 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
345 echo 748800 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq
346 echo 1017600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq
347 echo 1017600 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq
348 echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/min_freq
349 echo 1017600000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/max_freq
350 echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/min_freq
351 echo 1017600000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/max_freq
352 echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/min_freq
353 echo 1017600000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq
354 echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/min_freq
355 echo 1017600000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/max_freq
356 echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
357 echo 1016 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq
358 setprop vendor.sku_identified 1
359 setprop vendor.sku_name "SA6145"
360elif [ $feature_id == 5 ]; then
361 echo "SKU Configured : SA6150"
362 echo 748800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
363 echo 748800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
364 echo 748800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
365 echo 748800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
366 echo 748800 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
367 echo 748800 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq
368 echo 1017600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq
369 echo 1017600 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq
370 echo 998400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
371 echo 998400 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
372 echo 998400 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
373 echo 998400 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
374 echo 998400 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
375 echo 998400 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq
376 echo 1708800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq
377 echo 1708800 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq
378 echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/min_freq
379 echo 1363200000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/max_freq
380 echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/min_freq
381 echo 1363200000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/max_freq
382 echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/min_freq
383 echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq
384 echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/min_freq
385 echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/max_freq
386 echo 2 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
387 echo 1333 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq
388 setprop vendor.sku_identified 1
389 setprop vendor.sku_name "SA6150"
390elif [ $feature_id == 4 ] || [ $feature_id == 3 ]; then
391 echo "SKU Configured : SA6155"
392 echo 748800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
393 echo 748800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
394 echo 748800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
395 echo 748800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
396 echo 748800 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
397 echo 748800 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq
398 echo 1017600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq
399 echo 1017600 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq
400 echo 1593600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
401 echo 1593600 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
402 echo 1593600 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
403 echo 1593600 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
404 echo 1593600 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
405 echo 1593600 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq
406 echo 1900800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq
407 echo 1900800 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq
408 echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/min_freq
409 echo 1363200000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/max_freq
410 echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/min_freq
411 echo 1363200000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/max_freq
412 echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/min_freq
413 echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq
414 echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/min_freq
415 echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/max_freq
416 echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
417 echo 1555 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq
418 setprop vendor.sku_identified 1
419 setprop vendor.sku_name "SA6155"
420else
421 echo "SKU Configured : SA6155"
422 echo 748800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
423 echo 748800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
424 echo 748800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
425 echo 748800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
426 echo 748800 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
427 echo 748800 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq
428 echo 1017600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq
429 echo 1017600 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq
430 echo 1593600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
431 echo 1593600 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
432 echo 1593600 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
433 echo 1593600 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
434 echo 1593600 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
435 echo 1593600 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq
436 echo 1900800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq
437 echo 1900800 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq
438 echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/min_freq
439 echo 1363200000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/max_freq
440 echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/min_freq
441 echo 1363200000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/max_freq
442 echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/min_freq
443 echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq
444 echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/min_freq
445 echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/max_freq
446 echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
447 echo 1555 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq
448 setprop vendor.sku_identified 1
449 setprop vendor.sku_name "SA6155"
450fi
451}
452
453function 8953_sched_dcvs_hmp()
454{
455 #scheduler settings
456 echo 3 > /proc/sys/kernel/sched_window_stats_policy
457 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
458 #task packing settings
459 echo 0 > /sys/devices/system/cpu/cpu0/sched_static_cpu_pwr_cost
460 echo 0 > /sys/devices/system/cpu/cpu1/sched_static_cpu_pwr_cost
461 echo 0 > /sys/devices/system/cpu/cpu2/sched_static_cpu_pwr_cost
462 echo 0 > /sys/devices/system/cpu/cpu3/sched_static_cpu_pwr_cost
463 echo 0 > /sys/devices/system/cpu/cpu4/sched_static_cpu_pwr_cost
464 echo 0 > /sys/devices/system/cpu/cpu5/sched_static_cpu_pwr_cost
465 echo 0 > /sys/devices/system/cpu/cpu6/sched_static_cpu_pwr_cost
466 echo 0 > /sys/devices/system/cpu/cpu7/sched_static_cpu_pwr_cost
467 # spill load is set to 100% by default in the kernel
468 echo 3 > /proc/sys/kernel/sched_spill_nr_run
469 # Apply inter-cluster load balancer restrictions
470 echo 1 > /proc/sys/kernel/sched_restrict_cluster_spill
471 # set sync wakee policy tunable
472 echo 1 > /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
473
474 #governor settings
475 echo 1 > /sys/devices/system/cpu/cpu0/online
476 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
477 echo "19000 1401600:39000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
478 echo 85 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
479 echo 20000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
480 echo 1401600 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
481 echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
482 echo "85 1401600:80" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
483 echo 39000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
484 echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
485 echo 19 > /proc/sys/kernel/sched_upmigrate_min_nice
486 # Enable sched guided freq control
487 echo 1 > /sys/devices/system/cpu/cpufreq/interactive/use_sched_load
488 echo 1 > /sys/devices/system/cpu/cpufreq/interactive/use_migration_notif
489 echo 200000 > /proc/sys/kernel/sched_freq_inc_notify
490 echo 200000 > /proc/sys/kernel/sched_freq_dec_notify
491
492}
493
494function 8917_sched_dcvs_hmp()
495{
496 # HMP scheduler settings
497 echo 3 > /proc/sys/kernel/sched_window_stats_policy
498 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
499 echo 1 > /proc/sys/kernel/sched_restrict_tasks_spread
500 # HMP Task packing settings
501 echo 20 > /proc/sys/kernel/sched_small_task
502 echo 30 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
503 echo 30 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
504 echo 30 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
505 echo 30 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
506
507 echo 3 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run
508 echo 3 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run
509 echo 3 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run
510 echo 3 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run
511
512 echo 0 > /sys/devices/system/cpu/cpu0/sched_prefer_idle
513 echo 0 > /sys/devices/system/cpu/cpu1/sched_prefer_idle
514 echo 0 > /sys/devices/system/cpu/cpu2/sched_prefer_idle
515 echo 0 > /sys/devices/system/cpu/cpu3/sched_prefer_idle
516
517 echo 1 > /sys/devices/system/cpu/cpu0/online
518 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
519 echo "19000 1094400:39000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
520 echo 85 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
521 echo 20000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
522 echo 1094400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
523 echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
524 echo "1 960000:85 1094400:90" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
525 echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
526 echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
527
528 # Enable sched guided freq control
529 echo 1 > /sys/devices/system/cpu/cpufreq/interactive/use_sched_load
530 echo 1 > /sys/devices/system/cpu/cpufreq/interactive/use_migration_notif
531 echo 50000 > /proc/sys/kernel/sched_freq_inc_notify
532 echo 50000 > /proc/sys/kernel/sched_freq_dec_notify
533}
534
535function 8937_sched_dcvs_hmp()
536{
537 # HMP scheduler settings
538 echo 3 > /proc/sys/kernel/sched_window_stats_policy
539 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
540 # HMP Task packing settings
541 echo 20 > /proc/sys/kernel/sched_small_task
542 echo 30 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
543 echo 30 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
544 echo 30 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
545 echo 30 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
546 echo 30 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_load
547 echo 30 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_load
548 echo 30 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_load
549 echo 30 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_load
550
551 echo 3 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run
552 echo 3 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run
553 echo 3 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run
554 echo 3 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run
555 echo 3 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_nr_run
556 echo 3 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_nr_run
557 echo 3 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_nr_run
558 echo 3 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_nr_run
559
560 echo 0 > /sys/devices/system/cpu/cpu0/sched_prefer_idle
561 echo 0 > /sys/devices/system/cpu/cpu1/sched_prefer_idle
562 echo 0 > /sys/devices/system/cpu/cpu2/sched_prefer_idle
563 echo 0 > /sys/devices/system/cpu/cpu3/sched_prefer_idle
564 echo 0 > /sys/devices/system/cpu/cpu4/sched_prefer_idle
565 echo 0 > /sys/devices/system/cpu/cpu5/sched_prefer_idle
566 echo 0 > /sys/devices/system/cpu/cpu6/sched_prefer_idle
567 echo 0 > /sys/devices/system/cpu/cpu7/sched_prefer_idle
568 # enable governor for perf cluster
569 echo 1 > /sys/devices/system/cpu/cpu0/online
570 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
571 echo "19000 1094400:39000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
572 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
573 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
574 echo 1094400 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
575 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
576 echo "1 960000:85 1094400:90 1344000:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
577 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
578 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
579
580 # enable governor for power cluster
581 echo 1 > /sys/devices/system/cpu/cpu4/online
582 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
583 echo 39000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
584 echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
585 echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
586 echo 768000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
587 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
588 echo "1 768000:90" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
589 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
590 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
591
592 # Enable sched guided freq control
593 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
594 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
595 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
596 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
597 echo 50000 > /proc/sys/kernel/sched_freq_inc_notify
598 echo 50000 > /proc/sys/kernel/sched_freq_dec_notify
599
600}
601
602function sdm660_sched_interactive_dcvs() {
603
604 echo 0 > /proc/sys/kernel/sched_select_prev_cpu_us
605 echo 400000 > /proc/sys/kernel/sched_freq_inc_notify
606 echo 400000 > /proc/sys/kernel/sched_freq_dec_notify
607 echo 5 > /proc/sys/kernel/sched_spill_nr_run
608 echo 1 > /proc/sys/kernel/sched_restrict_cluster_spill
609 echo 100000 > /proc/sys/kernel/sched_short_burst_ns
610 echo 1 > /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
611 echo 20 > /proc/sys/kernel/sched_small_wakee_task_load
612
613 # disable thermal bcl hotplug to switch governor
614 echo 0 > /sys/module/msm_thermal/core_control/enabled
615
616 # online CPU0
617 echo 1 > /sys/devices/system/cpu/cpu0/online
618 # configure governor settings for little cluster
619 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
620 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
621 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
622 echo "19000 1401600:39000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
623 echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
624 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
625 echo 1401600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
626 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
627 echo "85 1747200:95" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
628 echo 39000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
629 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis
630 echo 633600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
631 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif
632 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/fast_ramp_down
633 # online CPU4
634 echo 1 > /sys/devices/system/cpu/cpu4/online
635 # configure governor settings for big cluster
636 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
637 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
638 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
639 echo "19000 1401600:39000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
640 echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
641 echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
642 echo 1401600 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
643 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
644 echo "85 1401600:90 2150400:95" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
645 echo 39000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
646 echo 59000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis
647 echo 1113600 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
648 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/ignore_hispeed_on_notif
649 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/fast_ramp_down
650
651 # bring all cores online
652 echo 1 > /sys/devices/system/cpu/cpu0/online
653 echo 1 > /sys/devices/system/cpu/cpu1/online
654 echo 1 > /sys/devices/system/cpu/cpu2/online
655 echo 1 > /sys/devices/system/cpu/cpu3/online
656 echo 1 > /sys/devices/system/cpu/cpu4/online
657 echo 1 > /sys/devices/system/cpu/cpu5/online
658 echo 1 > /sys/devices/system/cpu/cpu6/online
659 echo 1 > /sys/devices/system/cpu/cpu7/online
660
661 # configure LPM
662 echo N > /sys/module/lpm_levels/system/pwr/cpu0/ret/idle_enabled
663 echo N > /sys/module/lpm_levels/system/pwr/cpu1/ret/idle_enabled
664 echo N > /sys/module/lpm_levels/system/pwr/cpu2/ret/idle_enabled
665 echo N > /sys/module/lpm_levels/system/pwr/cpu3/ret/idle_enabled
666 echo N > /sys/module/lpm_levels/system/perf/cpu4/ret/idle_enabled
667 echo N > /sys/module/lpm_levels/system/perf/cpu5/ret/idle_enabled
668 echo N > /sys/module/lpm_levels/system/perf/cpu6/ret/idle_enabled
669 echo N > /sys/module/lpm_levels/system/perf/cpu7/ret/idle_enabled
670 echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-dynret/idle_enabled
671 echo N > /sys/module/lpm_levels/system/perf/perf-l2-dynret/idle_enabled
672 echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-ret/idle_enabled
673 echo N > /sys/module/lpm_levels/system/perf/perf-l2-ret/idle_enabled
674
675 # re-enable thermal and BCL hotplug
676 echo 1 > /sys/module/msm_thermal/core_control/enabled
677
678 # Enable bus-dcvs
679 for cpubw in /sys/class/devfreq/*qcom,cpubw*
680 do
681 echo "bw_hwmon" > $cpubw/governor
682 echo 50 > $cpubw/polling_interval
683 echo 762 > $cpubw/min_freq
684 echo "1525 3143 5859 7759 9887 10327 11863 13763" > $cpubw/bw_hwmon/mbps_zones
685 echo 4 > $cpubw/bw_hwmon/sample_ms
686 echo 85 > $cpubw/bw_hwmon/io_percent
687 echo 100 > $cpubw/bw_hwmon/decay_rate
688 echo 50 > $cpubw/bw_hwmon/bw_step
689 echo 20 > $cpubw/bw_hwmon/hist_memory
690 echo 0 > $cpubw/bw_hwmon/hyst_length
691 echo 80 > $cpubw/bw_hwmon/down_thres
692 echo 0 > $cpubw/bw_hwmon/low_power_ceil_mbps
693 echo 34 > $cpubw/bw_hwmon/low_power_io_percent
694 echo 20 > $cpubw/bw_hwmon/low_power_delay
695 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
696 echo 250 > $cpubw/bw_hwmon/up_scale
697 echo 1600 > $cpubw/bw_hwmon/idle_mbps
698 done
699
700 for memlat in /sys/class/devfreq/*qcom,memlat-cpu*
701 do
702 echo "mem_latency" > $memlat/governor
703 echo 10 > $memlat/polling_interval
704 echo 400 > $memlat/mem_latency/ratio_ceil
705 done
706 echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor
707}
708
709function sdm660_sched_schedutil_dcvs() {
710
711 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
712 # configure governor settings for little cluster
713 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
714 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us
715 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
716 echo 1401600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
717 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl
718 echo 633600 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
719 echo 902400 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq
720
721 # configure governor settings for big cluster
722 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
723 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us
724 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/down_rate_limit_us
725 echo 1401600 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq
726 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl
727 echo 1113600 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq
728 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/rtg_boost_freq
729 else
730 # configure governor settings for little cluster
731 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
732 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
733 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
734 echo 1401600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
735
736 # configure governor settings for big cluster
737 echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
738 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/up_rate_limit_us
739 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_rate_limit_us
740 echo 1401600 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq
741 fi
742
743 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
744
745 #if the kernel version >=4.19,set input_boost_freq accordingly
746 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
747 echo "0:1401600" > /sys/devices/system/cpu/cpu_boost/input_boost_freq
748 echo 40 > /sys/devices/system/cpu/cpu_boost/input_boost_ms
749 else
750 echo "0:1401600" > /sys/module/cpu_boost/parameters/input_boost_freq
751 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
752 fi
753
754 # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
755 echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost
756 echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost
757 echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost
758 echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost
759 echo -6 > /sys/devices/system/cpu/cpu4/sched_load_boost
760 echo -6 > /sys/devices/system/cpu/cpu5/sched_load_boost
761 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
762 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
763 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load
764 echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_load
765
766 # Enable bus-dcvs
767 for device in /sys/devices/platform/soc
768 do
769 for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw
770 do
771 echo "bw_hwmon" > $cpubw/governor
772 echo 50 > $cpubw/polling_interval
773 echo 762 > $cpubw/min_freq
774 echo "1525 3143 5859 7759 9887 10327 11863 13763" > $cpubw/bw_hwmon/mbps_zones
775 echo 4 > $cpubw/bw_hwmon/sample_ms
776 echo 85 > $cpubw/bw_hwmon/io_percent
777 echo 100 > $cpubw/bw_hwmon/decay_rate
778 echo 50 > $cpubw/bw_hwmon/bw_step
779 echo 20 > $cpubw/bw_hwmon/hist_memory
780 echo 0 > $cpubw/bw_hwmon/hyst_length
781 echo 80 > $cpubw/bw_hwmon/down_thres
782 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
783 echo 250 > $cpubw/bw_hwmon/up_scale
784 echo 1600 > $cpubw/bw_hwmon/idle_mbps
785 done
786
787 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -le 14 ]; then
788 for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat
789 do
790 echo "mem_latency" > $memlat/governor
791 echo 10 > $memlat/polling_interval
792 echo 400 > $memlat/mem_latency/ratio_ceil
793 done
794
795 for latfloor in $device/*cpu*-ddr-latfloor*/devfreq/*cpu-ddr-latfloor*
796 do
797 echo "compute" > $latfloor/governor
798 echo 10 > $latfloor/polling_interval
799 done
800 fi
801 done
802
803 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
804 # memlat specific settings are moved to seperate file under
805 # device/target specific folder
806 setprop vendor.dcvs.prop 1
807 fi
808
809}
810
811target=`getprop ro.board.platform`
812
813KernelVersionStr=`cat /proc/sys/kernel/osrelease`
814KernelVersionS=${KernelVersionStr:2:2}
815KernelVersionA=${KernelVersionStr:0:1}
816KernelVersionB=${KernelVersionS%.*}
817
818function configure_zram_parameters() {
819 MemTotalStr=`cat /proc/meminfo | grep MemTotal`
820 MemTotal=${MemTotalStr:16:8}
821
822 low_ram=`getprop ro.config.low_ram`
823
824 # Zram disk - 75% for Go devices.
825 # For 512MB Go device, size = 384MB, set same for Non-Go.
826 # For 1GB Go device, size = 768MB, set same for Non-Go.
827 # For 2GB Go device, size = 1536MB, set same for Non-Go.
828 # For >2GB Non-Go devices, size = 50% of RAM size. Limit the size to 4GB.
829 # And enable lz4 zram compression for Go targets.
830
831 let RamSizeGB="( $MemTotal / 1048576 ) + 1"
832 diskSizeUnit=M
833 if [ $RamSizeGB -le 2 ]; then
834 let zRamSizeMB="( $RamSizeGB * 1024 ) * 3 / 4"
835 else
836 let zRamSizeMB="( $RamSizeGB * 1024 ) / 2"
837 fi
838
839 # use MB avoid 32 bit overflow
840 if [ $zRamSizeMB -gt 4096 ]; then
841 let zRamSizeMB=4096
842 fi
843
844 if [ "$low_ram" == "true" ]; then
845 echo lz4 > /sys/block/zram0/comp_algorithm
846 fi
847
848 if [ -f /sys/block/zram0/disksize ]; then
849 if [ -f /sys/block/zram0/use_dedup ]; then
850 echo 1 > /sys/block/zram0/use_dedup
851 fi
852 echo "$zRamSizeMB""$diskSizeUnit" > /sys/block/zram0/disksize
853
854 # ZRAM may use more memory than it saves if SLAB_STORE_USER
855 # debug option is enabled.
856 if [ -e /sys/kernel/slab/zs_handle ]; then
857 echo 0 > /sys/kernel/slab/zs_handle/store_user
858 fi
859 if [ -e /sys/kernel/slab/zspage ]; then
860 echo 0 > /sys/kernel/slab/zspage/store_user
861 fi
862
863 mkswap /dev/block/zram0
864 swapon /dev/block/zram0 -p 32758
865 fi
866}
867
868function configure_read_ahead_kb_values() {
869 MemTotalStr=`cat /proc/meminfo | grep MemTotal`
870 MemTotal=${MemTotalStr:16:8}
871
872 dmpts=$(ls /sys/block/*/queue/read_ahead_kb | grep -e dm -e mmc)
873
874 # Set 128 for <= 3GB &
875 # set 512 for >= 4GB targets.
876 if [ $MemTotal -le 3145728 ]; then
877 echo 128 > /sys/block/mmcblk0/bdi/read_ahead_kb
878 echo 128 > /sys/block/mmcblk0rpmb/bdi/read_ahead_kb
879 for dm in $dmpts; do
880 echo 128 > $dm
881 done
882 else
883 echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb
884 echo 512 > /sys/block/mmcblk0rpmb/bdi/read_ahead_kb
885 for dm in $dmpts; do
886 echo 512 > $dm
887 done
888 fi
889}
890
891function disable_core_ctl() {
892 if [ -f /sys/devices/system/cpu/cpu0/core_ctl/enable ]; then
893 echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable
894 else
895 echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/disable
896 fi
897}
898
899function enable_swap() {
900 MemTotalStr=`cat /proc/meminfo | grep MemTotal`
901 MemTotal=${MemTotalStr:16:8}
902
903 SWAP_ENABLE_THRESHOLD=1048576
904 swap_enable=`getprop ro.vendor.qti.config.swap`
905
906 # Enable swap initially only for 1 GB targets
907 if [ "$MemTotal" -le "$SWAP_ENABLE_THRESHOLD" ] && [ "$swap_enable" == "true" ]; then
908 # Static swiftness
909 echo 1 > /proc/sys/vm/swap_ratio_enable
910 echo 70 > /proc/sys/vm/swap_ratio
911
912 # Swap disk - 200MB size
913 if [ ! -f /data/vendor/swap/swapfile ]; then
914 dd if=/dev/zero of=/data/vendor/swap/swapfile bs=1m count=200
915 fi
916 mkswap /data/vendor/swap/swapfile
917 swapon /data/vendor/swap/swapfile -p 32758
918 fi
919}
920
Rohit R Sekharadf49712022-11-17 21:05:16 +0530921function disable_ppr()
922{
923 if [ -f /sys/module/process_reclaim/parameters/enable_process_reclaim ]; then
924 echo 0 > /sys/module/process_reclaim/parameters/enable_process_reclaim
925 fi
926}
927
merothh32be6882022-01-03 01:54:57 +0530928function configure_memory_parameters() {
929 # Set Memory parameters.
930 #
931 # Set per_process_reclaim tuning parameters
932 # All targets will use vmpressure range 50-70,
933 # All targets will use 512 pages swap size.
934 #
935 # Set Low memory killer minfree parameters
936 # 32 bit Non-Go, all memory configurations will use 15K series
937 # 32 bit Go, all memory configurations will use uLMK + Memcg
938 # 64 bit will use Google default LMK series.
939 #
940 # Set ALMK parameters (usually above the highest minfree values)
941 # vmpressure_file_min threshold is always set slightly higher
942 # than LMK minfree's last bin value for all targets. It is calculated as
943 # vmpressure_file_min = (last bin - second last bin ) + last bin
944 #
945 # Set allocstall_threshold to 0 for all targets.
946 #
947
948ProductName=`getprop ro.product.name`
949low_ram=`getprop ro.config.low_ram`
950
951if [ "$ProductName" == "msmnile" ] || [ "$ProductName" == "kona" ] || [ "$ProductName" == "sdmshrike_au" ]; then
952 # Enable ZRAM
953 configure_zram_parameters
954 configure_read_ahead_kb_values
955 echo 0 > /proc/sys/vm/page-cluster
956 echo 100 > /proc/sys/vm/swappiness
957else
958 arch_type=`uname -m`
959
960 # Set parameters for 32-bit Go targets.
961 if [ "$low_ram" == "true" ]; then
962 # Disable KLMK, ALMK, PPR & Core Control for Go devices
963 echo 0 > /sys/module/lowmemorykiller/parameters/enable_lmk
964 echo 0 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
965 echo 0 > /sys/module/process_reclaim/parameters/enable_process_reclaim
966 disable_core_ctl
967 # Enable oom_reaper for Go devices
968 if [ -f /proc/sys/vm/reap_mem_on_sigkill ]; then
969 echo 1 > /proc/sys/vm/reap_mem_on_sigkill
970 fi
971 else
972
973 # Read adj series and set adj threshold for PPR and ALMK.
974 # This is required since adj values change from framework to framework.
975 adj_series=`cat /sys/module/lowmemorykiller/parameters/adj`
976 adj_1="${adj_series#*,}"
977 set_almk_ppr_adj="${adj_1%%,*}"
978
979 # PPR and ALMK should not act on HOME adj and below.
980 # Normalized ADJ for HOME is 6. Hence multiply by 6
981 # ADJ score represented as INT in LMK params, actual score can be in decimal
982 # Hence add 6 considering a worst case of 0.9 conversion to INT (0.9*6).
983 # For uLMK + Memcg, this will be set as 6 since adj is zero.
984 set_almk_ppr_adj=$(((set_almk_ppr_adj * 6) + 6))
985 echo $set_almk_ppr_adj > /sys/module/lowmemorykiller/parameters/adj_max_shift
986
987 # Calculate vmpressure_file_min as below & set for 64 bit:
988 # vmpressure_file_min = last_lmk_bin + (last_lmk_bin - last_but_one_lmk_bin)
989 if [ "$arch_type" == "aarch64" ]; then
990 minfree_series=`cat /sys/module/lowmemorykiller/parameters/minfree`
991 minfree_1="${minfree_series#*,}" ; rem_minfree_1="${minfree_1%%,*}"
992 minfree_2="${minfree_1#*,}" ; rem_minfree_2="${minfree_2%%,*}"
993 minfree_3="${minfree_2#*,}" ; rem_minfree_3="${minfree_3%%,*}"
994 minfree_4="${minfree_3#*,}" ; rem_minfree_4="${minfree_4%%,*}"
995 minfree_5="${minfree_4#*,}"
996
997 vmpres_file_min=$((minfree_5 + (minfree_5 - rem_minfree_4)))
998 echo $vmpres_file_min > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
999 else
1000 # Set LMK series, vmpressure_file_min for 32 bit non-go targets.
1001 # Disable Core Control, enable KLMK for non-go 8909.
1002 if [ "$ProductName" == "msm8909" ]; then
1003 disable_core_ctl
1004 echo 1 > /sys/module/lowmemorykiller/parameters/enable_lmk
1005 fi
1006 echo "15360,19200,23040,26880,34415,43737" > /sys/module/lowmemorykiller/parameters/minfree
1007 echo 53059 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
1008 fi
1009
1010 # Enable adaptive LMK for all targets &
1011 # use Google default LMK series for all 64-bit targets >=2GB.
1012 echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
1013
1014 # Enable oom_reaper
1015 if [ -f /sys/module/lowmemorykiller/parameters/oom_reaper ]; then
1016 echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper
1017 fi
1018
1019 if [[ "$ProductName" != "bengal"* ]]; then
1020 #bengal has appcompaction enabled. So not needed
1021 # Set PPR parameters for other targets
1022 if [ -f /sys/devices/soc0/soc_id ]; then
1023 soc_id=`cat /sys/devices/soc0/soc_id`
1024 else
1025 soc_id=`cat /sys/devices/system/soc/soc0/id`
1026 fi
1027
1028 case "$soc_id" in
1029 # Do not set PPR parameters for premium targets
1030 # sdm845 - 321, 341
1031 # msm8998 - 292, 319
1032 # msm8996 - 246, 291, 305, 312
1033 "321" | "341" | "292" | "319" | "246" | "291" | "305" | "312")
1034 ;;
1035 *)
1036 #Set PPR parameters for all other targets.
1037 echo $set_almk_ppr_adj > /sys/module/process_reclaim/parameters/min_score_adj
1038 echo 1 > /sys/module/process_reclaim/parameters/enable_process_reclaim
1039 echo 50 > /sys/module/process_reclaim/parameters/pressure_min
1040 echo 70 > /sys/module/process_reclaim/parameters/pressure_max
1041 echo 30 > /sys/module/process_reclaim/parameters/swap_opt_eff
1042 echo 512 > /sys/module/process_reclaim/parameters/per_swap_size
1043 ;;
1044 esac
1045 fi
1046 fi
1047
1048 if [[ "$ProductName" == "bengal"* ]]; then
1049 #Set PPR nomap parameters for bengal targets
1050 echo 1 > /sys/module/process_reclaim/parameters/enable_process_reclaim
1051 echo 50 > /sys/module/process_reclaim/parameters/pressure_min
1052 echo 70 > /sys/module/process_reclaim/parameters/pressure_max
1053 echo 30 > /sys/module/process_reclaim/parameters/swap_opt_eff
1054 echo 0 > /sys/module/process_reclaim/parameters/per_swap_size
1055 echo 7680 > /sys/module/process_reclaim/parameters/tsk_nomap_swap_sz
1056 fi
1057
1058 # Set allocstall_threshold to 0 for all targets.
1059 # Set swappiness to 100 for all targets
1060 echo 0 > /sys/module/vmpressure/parameters/allocstall_threshold
1061 echo 100 > /proc/sys/vm/swappiness
1062
1063 # Disable wsf for all targets beacause we are using efk.
1064 # wsf Range : 1..1000 So set to bare minimum value 1.
1065 echo 1 > /proc/sys/vm/watermark_scale_factor
1066
1067 configure_zram_parameters
1068
1069 configure_read_ahead_kb_values
1070
1071 enable_swap
1072fi
1073}
1074
1075function enable_memory_features()
1076{
1077 MemTotalStr=`cat /proc/meminfo | grep MemTotal`
1078 MemTotal=${MemTotalStr:16:8}
1079
1080 if [ $MemTotal -le 2097152 ]; then
1081 #Enable B service adj transition for 2GB or less memory
1082 setprop ro.vendor.qti.sys.fw.bservice_enable true
1083 setprop ro.vendor.qti.sys.fw.bservice_limit 5
1084 setprop ro.vendor.qti.sys.fw.bservice_age 5000
1085
1086 #Enable Delay Service Restart
1087 setprop ro.vendor.qti.am.reschedule_service true
1088 fi
1089}
1090
1091function start_hbtp()
1092{
1093 # Start the Host based Touch processing but not in the power off mode.
1094 bootmode=`getprop ro.bootmode`
1095 if [ "charger" != $bootmode ]; then
1096 start vendor.hbtp
1097 fi
1098}
1099
1100case "$target" in
1101 "msm7201a_ffa" | "msm7201a_surf" | "msm7627_ffa" | "msm7627_6x" | "msm7627a" | "msm7627_surf" | \
1102 "qsd8250_surf" | "qsd8250_ffa" | "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "qsd8650a_st1x")
1103 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1104 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
1105 ;;
1106esac
1107
Michael Bestasc3ad1cd2023-10-03 15:27:40 +03001108# For Kodiak target for which cdsp is defective, we read remote cdsp status from fastrpc node
1109# and if its value is false we disable cdsp daemon by setting the cdsp disable propety to true
1110case "$target" in
1111 "lahaina")
1112 if [ -f /sys/devices/soc0/chip_family ]; then
1113 chip_family_id=`cat /sys/devices/soc0/chip_family`
1114 else
1115 chip_family_id=-1
1116 fi
1117
Michael Bestasc3ad1cd2023-10-03 15:27:40 +03001118 case "$chip_family_id" in
1119 "0x76")
1120 if [ -f /sys/devices/platform/soc/soc:qcom,msm_fastrpc/remote_cdsp_status ]; then
1121 remote_cdsp_status=`cat /sys/devices/platform/soc/soc:qcom,msm_fastrpc/remote_cdsp_status`
1122 else
1123 remote_cdsp_status=-1
1124 fi
1125
Michael Bestasc3ad1cd2023-10-03 15:27:40 +03001126 if [ $remote_cdsp_status -eq 0 ]; then
1127 setprop vendor.fastrpc.disable.cdsprpcd.daemon 1
Michael Bestasc3ad1cd2023-10-03 15:27:40 +03001128 fi
1129 esac
1130 ;;
1131esac
1132
merothh32be6882022-01-03 01:54:57 +05301133case "$target" in
1134 "msm7201a_ffa" | "msm7201a_surf")
1135 echo 500000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1136 ;;
1137esac
1138
1139case "$target" in
1140 "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
1141 echo 75000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1142 echo 1 > /sys/module/pm2/parameters/idle_sleep_mode
1143 ;;
1144esac
1145
1146case "$target" in
1147 "msm7201a_ffa" | "msm7201a_surf" | "msm7627_ffa" | "msm7627_6x" | "msm7627_surf" | "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "msm7627a" )
1148 echo 245760 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1149 ;;
1150esac
1151
1152case "$target" in
1153 "msm8660")
1154 echo 1 > /sys/module/rpm_resources/enable_low_power/L2_cache
1155 echo 1 > /sys/module/rpm_resources/enable_low_power/pxo
1156 echo 2 > /sys/module/rpm_resources/enable_low_power/vdd_dig
1157 echo 2 > /sys/module/rpm_resources/enable_low_power/vdd_mem
1158 echo 1 > /sys/module/rpm_resources/enable_low_power/rpm_cpu
1159 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
1160 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
1161 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
1162 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
1163 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
1164 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
1165 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
1166 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
1167 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1168 echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
1169 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1170 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
1171 echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
1172 echo 4 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
1173 echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1174 echo 384000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
1175 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
1176 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1177 chown -h system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
1178 chown -h system /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
1179 chown -h root.system /sys/devices/system/cpu/mfreq
1180 chmod -h 220 /sys/devices/system/cpu/mfreq
1181 chown -h root.system /sys/devices/system/cpu/cpu1/online
1182 chmod -h 664 /sys/devices/system/cpu/cpu1/online
1183 ;;
1184esac
1185
1186case "$target" in
1187 "msm8960")
1188 echo 1 > /sys/module/rpm_resources/enable_low_power/L2_cache
1189 echo 1 > /sys/module/rpm_resources/enable_low_power/pxo
1190 echo 1 > /sys/module/rpm_resources/enable_low_power/vdd_dig
1191 echo 1 > /sys/module/rpm_resources/enable_low_power/vdd_mem
1192 echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled
1193 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
1194 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
1195 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
1196 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
1197 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
1198 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
1199 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
1200 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
1201 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
1202 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
1203 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
1204 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
1205 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
1206 echo 0 > /sys/module/msm_thermal/core_control/enabled
1207 echo 1 > /sys/devices/system/cpu/cpu1/online
1208 echo 1 > /sys/devices/system/cpu/cpu2/online
1209 echo 1 > /sys/devices/system/cpu/cpu3/online
1210 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1211 echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
1212 echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
1213 echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
1214 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1215 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
1216 echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
1217 echo 4 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
1218 echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
1219 echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
1220 echo 3 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
1221 echo 918000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
1222 echo 1026000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
1223 echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
1224 chown -h system /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1225 chown -h system /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
1226 chown -h system /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
1227 echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1228 echo 384000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
1229 echo 384000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
1230 echo 384000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
1231 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
1232 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1233 chown -h system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
1234 chown -h system /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
1235 chown -h system /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
1236 chown -h system /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
1237 chown -h system /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
1238 chown -h system /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
1239 echo 1 > /sys/module/msm_thermal/core_control/enabled
1240 chown -h root.system /sys/devices/system/cpu/mfreq
1241 chmod -h 220 /sys/devices/system/cpu/mfreq
1242 chown -h root.system /sys/devices/system/cpu/cpu1/online
1243 chown -h root.system /sys/devices/system/cpu/cpu2/online
1244 chown -h root.system /sys/devices/system/cpu/cpu3/online
1245 chmod -h 664 /sys/devices/system/cpu/cpu1/online
1246 chmod -h 664 /sys/devices/system/cpu/cpu2/online
1247 chmod -h 664 /sys/devices/system/cpu/cpu3/online
1248 # set DCVS parameters for CPU
1249 echo 40000 > /sys/module/msm_dcvs/cores/cpu0/slack_time_max_us
1250 echo 40000 > /sys/module/msm_dcvs/cores/cpu0/slack_time_min_us
1251 echo 100000 > /sys/module/msm_dcvs/cores/cpu0/em_win_size_min_us
1252 echo 500000 > /sys/module/msm_dcvs/cores/cpu0/em_win_size_max_us
1253 echo 0 > /sys/module/msm_dcvs/cores/cpu0/slack_mode_dynamic
1254 echo 1000000 > /sys/module/msm_dcvs/cores/cpu0/disable_pc_threshold
1255 echo 25000 > /sys/module/msm_dcvs/cores/cpu1/slack_time_max_us
1256 echo 25000 > /sys/module/msm_dcvs/cores/cpu1/slack_time_min_us
1257 echo 100000 > /sys/module/msm_dcvs/cores/cpu1/em_win_size_min_us
1258 echo 500000 > /sys/module/msm_dcvs/cores/cpu1/em_win_size_max_us
1259 echo 0 > /sys/module/msm_dcvs/cores/cpu1/slack_mode_dynamic
1260 echo 1000000 > /sys/module/msm_dcvs/cores/cpu1/disable_pc_threshold
1261 echo 25000 > /sys/module/msm_dcvs/cores/cpu2/slack_time_max_us
1262 echo 25000 > /sys/module/msm_dcvs/cores/cpu2/slack_time_min_us
1263 echo 100000 > /sys/module/msm_dcvs/cores/cpu2/em_win_size_min_us
1264 echo 500000 > /sys/module/msm_dcvs/cores/cpu2/em_win_size_max_us
1265 echo 0 > /sys/module/msm_dcvs/cores/cpu2/slack_mode_dynamic
1266 echo 1000000 > /sys/module/msm_dcvs/cores/cpu2/disable_pc_threshold
1267 echo 25000 > /sys/module/msm_dcvs/cores/cpu3/slack_time_max_us
1268 echo 25000 > /sys/module/msm_dcvs/cores/cpu3/slack_time_min_us
1269 echo 100000 > /sys/module/msm_dcvs/cores/cpu3/em_win_size_min_us
1270 echo 500000 > /sys/module/msm_dcvs/cores/cpu3/em_win_size_max_us
1271 echo 0 > /sys/module/msm_dcvs/cores/cpu3/slack_mode_dynamic
1272 echo 1000000 > /sys/module/msm_dcvs/cores/cpu3/disable_pc_threshold
1273 # set DCVS parameters for GPU
1274 echo 20000 > /sys/module/msm_dcvs/cores/gpu0/slack_time_max_us
1275 echo 20000 > /sys/module/msm_dcvs/cores/gpu0/slack_time_min_us
1276 echo 0 > /sys/module/msm_dcvs/cores/gpu0/slack_mode_dynamic
1277 # set msm_mpdecision parameters
1278 echo 45000 > /sys/module/msm_mpdecision/slack_time_max_us
1279 echo 15000 > /sys/module/msm_mpdecision/slack_time_min_us
1280 echo 100000 > /sys/module/msm_mpdecision/em_win_size_min_us
1281 echo 1000000 > /sys/module/msm_mpdecision/em_win_size_max_us
1282 echo 3 > /sys/module/msm_mpdecision/online_util_pct_min
1283 echo 25 > /sys/module/msm_mpdecision/online_util_pct_max
1284 echo 97 > /sys/module/msm_mpdecision/em_max_util_pct
1285 echo 2 > /sys/module/msm_mpdecision/rq_avg_poll_ms
1286 echo 10 > /sys/module/msm_mpdecision/mp_em_rounding_point_min
1287 echo 85 > /sys/module/msm_mpdecision/mp_em_rounding_point_max
1288 echo 50 > /sys/module/msm_mpdecision/iowait_threshold_pct
1289 #set permissions for the nodes needed by display on/off hook
1290 chown -h system /sys/module/msm_dcvs/cores/cpu0/slack_time_max_us
1291 chown -h system /sys/module/msm_dcvs/cores/cpu0/slack_time_min_us
1292 chown -h system /sys/module/msm_mpdecision/slack_time_max_us
1293 chown -h system /sys/module/msm_mpdecision/slack_time_min_us
1294 chmod -h 664 /sys/module/msm_dcvs/cores/cpu0/slack_time_max_us
1295 chmod -h 664 /sys/module/msm_dcvs/cores/cpu0/slack_time_min_us
1296 chmod -h 664 /sys/module/msm_mpdecision/slack_time_max_us
1297 chmod -h 664 /sys/module/msm_mpdecision/slack_time_min_us
1298 if [ -f /sys/devices/soc0/soc_id ]; then
1299 soc_id=`cat /sys/devices/soc0/soc_id`
1300 else
1301 soc_id=`cat /sys/devices/system/soc/soc0/id`
1302 fi
1303 case "$soc_id" in
1304 "130")
1305 echo 230 > /sys/class/gpio/export
1306 echo 228 > /sys/class/gpio/export
1307 echo 229 > /sys/class/gpio/export
1308 echo "in" > /sys/class/gpio/gpio230/direction
1309 echo "rising" > /sys/class/gpio/gpio230/edge
1310 echo "in" > /sys/class/gpio/gpio228/direction
1311 echo "rising" > /sys/class/gpio/gpio228/edge
1312 echo "in" > /sys/class/gpio/gpio229/direction
1313 echo "rising" > /sys/class/gpio/gpio229/edge
1314 echo 253 > /sys/class/gpio/export
1315 echo 254 > /sys/class/gpio/export
1316 echo 257 > /sys/class/gpio/export
1317 echo 258 > /sys/class/gpio/export
1318 echo 259 > /sys/class/gpio/export
1319 echo "out" > /sys/class/gpio/gpio253/direction
1320 echo "out" > /sys/class/gpio/gpio254/direction
1321 echo "out" > /sys/class/gpio/gpio257/direction
1322 echo "out" > /sys/class/gpio/gpio258/direction
1323 echo "out" > /sys/class/gpio/gpio259/direction
1324 chown -h media /sys/class/gpio/gpio253/value
1325 chown -h media /sys/class/gpio/gpio254/value
1326 chown -h media /sys/class/gpio/gpio257/value
1327 chown -h media /sys/class/gpio/gpio258/value
1328 chown -h media /sys/class/gpio/gpio259/value
1329 chown -h media /sys/class/gpio/gpio253/direction
1330 chown -h media /sys/class/gpio/gpio254/direction
1331 chown -h media /sys/class/gpio/gpio257/direction
1332 chown -h media /sys/class/gpio/gpio258/direction
1333 chown -h media /sys/class/gpio/gpio259/direction
1334 echo 0 > /sys/module/rpm_resources/enable_low_power/vdd_dig
1335 echo 0 > /sys/module/rpm_resources/enable_low_power/vdd_mem
1336 ;;
1337 esac
1338 ;;
1339esac
1340
1341case "$target" in
1342 "msm8974")
1343 echo 4 > /sys/module/lpm_levels/enable_low_power/l2
1344 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
1345 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
1346 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
1347 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
1348 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
1349 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
1350 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
1351 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
1352 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
1353 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
1354 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
1355 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
1356 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
1357 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
1358 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
1359 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
1360 echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled
1361 echo 1 > /sys/module/msm_pm/modes/cpu1/retention/idle_enabled
1362 echo 1 > /sys/module/msm_pm/modes/cpu2/retention/idle_enabled
1363 echo 1 > /sys/module/msm_pm/modes/cpu3/retention/idle_enabled
1364 echo 0 > /sys/module/msm_thermal/core_control/enabled
1365 echo 1 > /sys/devices/system/cpu/cpu1/online
1366 echo 1 > /sys/devices/system/cpu/cpu2/online
1367 echo 1 > /sys/devices/system/cpu/cpu3/online
1368 if [ -f /sys/devices/soc0/soc_id ]; then
1369 soc_id=`cat /sys/devices/soc0/soc_id`
1370 else
1371 soc_id=`cat /sys/devices/system/soc/soc0/id`
1372 fi
1373 case "$soc_id" in
1374 "208" | "211" | "214" | "217" | "209" | "212" | "215" | "218" | "194" | "210" | "213" | "216")
1375 for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
1376 do
1377 echo "cpubw_hwmon" > $devfreq_gov
1378 done
1379 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1380 echo "interactive" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
1381 echo "interactive" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
1382 echo "interactive" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
1383 echo "20000 1400000:40000 1700000:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
1384 echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
1385 echo 1190400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
1386 echo 1 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
1387 echo "85 1500000:90 1800000:70" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
1388 echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
1389 echo 20 > /sys/module/cpu_boost/parameters/boost_ms
1390 echo 1728000 > /sys/module/cpu_boost/parameters/sync_threshold
1391 echo 100000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
1392 echo 1497600 > /sys/module/cpu_boost/parameters/input_boost_freq
1393 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
1394 ;;
1395 *)
1396 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1397 echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
1398 echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
1399 echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
1400 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1401 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
1402 echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
1403 echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
1404 echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
1405 echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
1406 echo 3 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
1407 echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
1408 echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
1409 echo 1190400 > /sys/devices/system/cpu/cpufreq/ondemand/input_boost
1410 echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
1411 ;;
1412 esac
1413 echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1414 echo 300000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
1415 echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
1416 echo 300000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
1417 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
1418 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1419 echo 1 > /sys/module/msm_thermal/core_control/enabled
1420 chown -h root.system /sys/devices/system/cpu/mfreq
1421 chmod -h 220 /sys/devices/system/cpu/mfreq
1422 chown -h root.system /sys/devices/system/cpu/cpu1/online
1423 chown -h root.system /sys/devices/system/cpu/cpu2/online
1424 chown -h root.system /sys/devices/system/cpu/cpu3/online
1425 chmod -h 664 /sys/devices/system/cpu/cpu1/online
1426 chmod -h 664 /sys/devices/system/cpu/cpu2/online
1427 chmod -h 664 /sys/devices/system/cpu/cpu3/online
1428 echo 1 > /dev/cpuctl/apps/cpu.notify_on_migrate
1429 ;;
1430esac
1431
1432case "$target" in
1433 "msm8916")
1434 if [ -f /sys/devices/soc0/soc_id ]; then
1435 soc_id=`cat /sys/devices/soc0/soc_id`
1436 else
1437 soc_id=`cat /sys/devices/system/soc/soc0/id`
1438 fi
1439 case "$soc_id" in
1440 "206")
1441 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
1442 echo 1 > /sys/devices/system/cpu/cpu1/online
1443 echo 1 > /sys/devices/system/cpu/cpu2/online
1444 echo 1 > /sys/devices/system/cpu/cpu3/online
1445 echo 2 > /sys/class/net/rmnet0/queues/rx-0/rps_cpus
1446 ;;
1447 "247" | "248" | "249" | "250")
1448 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
1449 echo 1 > /sys/devices/system/cpu/cpu1/online
1450 echo 1 > /sys/devices/system/cpu/cpu2/online
1451 echo 1 > /sys/devices/system/cpu/cpu3/online
1452 ;;
1453 "239" | "241" | "263")
1454 if [ -f /sys/devices/soc0/revision ]; then
1455 revision=`cat /sys/devices/soc0/revision`
1456 else
1457 revision=`cat /sys/devices/system/soc/soc0/revision`
1458 fi
1459 echo 10 > /sys/class/net/rmnet0/queues/rx-0/rps_cpus
1460 if [ -f /sys/devices/soc0/platform_subtype_id ]; then
1461 platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
1462 fi
1463 if [ -f /sys/devices/soc0/hw_platform ]; then
1464 hw_platform=`cat /sys/devices/soc0/hw_platform`
1465 fi
1466 case "$soc_id" in
1467 "239")
1468 case "$hw_platform" in
1469 "Surf")
1470 case "$platform_subtype_id" in
1471 "1" | "2")
1472 start_hbtp
1473 ;;
1474 esac
1475 ;;
1476 "MTP")
1477 case "$platform_subtype_id" in
1478 "3")
1479 start_hbtp
1480 ;;
1481 esac
1482 ;;
1483 esac
1484 ;;
1485 esac
1486 ;;
1487 "268" | "269" | "270" | "271")
1488 echo 10 > /sys/class/net/rmnet0/queues/rx-0/rps_cpus
1489 ;;
1490 "233" | "240" | "242")
1491 echo 1 > /sys/devices/system/cpu/cpu1/online
1492 echo 1 > /sys/devices/system/cpu/cpu2/online
1493 echo 1 > /sys/devices/system/cpu/cpu3/online
1494 ;;
1495 esac
1496 ;;
1497esac
1498
1499case "$target" in
1500 "msm8226")
1501 echo 4 > /sys/module/lpm_levels/enable_low_power/l2
1502 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
1503 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
1504 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
1505 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
1506 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
1507 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
1508 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
1509 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
1510 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
1511 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
1512 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
1513 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
1514 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
1515 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
1516 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
1517 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
1518 echo 1 > /sys/devices/system/cpu/cpu1/online
1519 echo 1 > /sys/devices/system/cpu/cpu2/online
1520 echo 1 > /sys/devices/system/cpu/cpu3/online
1521 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1522 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1523 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
1524 echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
1525 echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
1526 echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
1527 echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
1528 echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
1529 echo 787200 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
1530 echo 300000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
1531 echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
1532 echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1533 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
1534 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1535 chown -h root.system /sys/devices/system/cpu/cpu1/online
1536 chown -h root.system /sys/devices/system/cpu/cpu2/online
1537 chown -h root.system /sys/devices/system/cpu/cpu3/online
1538 chmod -h 664 /sys/devices/system/cpu/cpu1/online
1539 chmod -h 664 /sys/devices/system/cpu/cpu2/online
1540 chmod -h 664 /sys/devices/system/cpu/cpu3/online
1541 ;;
1542esac
1543
1544case "$target" in
1545 "msm8610")
1546 echo 4 > /sys/module/lpm_levels/enable_low_power/l2
1547 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
1548 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
1549 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
1550 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
1551 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
1552 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
1553 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
1554 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
1555 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
1556 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
1557 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
1558 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
1559 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
1560 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
1561 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
1562 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
1563 echo 1 > /sys/devices/system/cpu/cpu1/online
1564 echo 1 > /sys/devices/system/cpu/cpu2/online
1565 echo 1 > /sys/devices/system/cpu/cpu3/online
1566 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1567 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
1568 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
1569 echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
1570 echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
1571 echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
1572 echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
1573 echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
1574 echo 787200 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
1575 echo 300000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
1576 echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
1577 echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1578 setprop ro.qualcomm.perf.min_freq 7
1579 echo 1 > /sys/kernel/mm/ksm/deferred_timer
1580 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
1581 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1582 chown -h root.system /sys/devices/system/cpu/cpu1/online
1583 chown -h root.system /sys/devices/system/cpu/cpu2/online
1584 chown -h root.system /sys/devices/system/cpu/cpu3/online
1585 chmod -h 664 /sys/devices/system/cpu/cpu1/online
1586 chmod -h 664 /sys/devices/system/cpu/cpu2/online
1587 chmod -h 664 /sys/devices/system/cpu/cpu3/online
1588 ;;
1589esac
1590
1591case "$target" in
1592 "msm8916")
1593
1594 if [ -f /sys/devices/soc0/soc_id ]; then
1595 soc_id=`cat /sys/devices/soc0/soc_id`
1596 else
1597 soc_id=`cat /sys/devices/system/soc/soc0/id`
1598 fi
1599
1600 # HMP scheduler settings for 8916, 8936, 8939, 8929
1601 echo 3 > /proc/sys/kernel/sched_window_stats_policy
1602 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
1603
1604 # Apply governor settings for 8916
1605 case "$soc_id" in
1606 "206" | "247" | "248" | "249" | "250")
1607
1608 # HMP scheduler load tracking settings
1609 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
1610
1611 # HMP Task packing settings for 8916
1612 echo 20 > /proc/sys/kernel/sched_small_task
1613 echo 30 > /proc/sys/kernel/sched_mostly_idle_load
1614 echo 3 > /proc/sys/kernel/sched_mostly_idle_nr_run
1615
1616 # disable thermal core_control to update scaling_min_freq
1617 echo 0 > /sys/module/msm_thermal/core_control/enabled
1618 echo 1 > /sys/devices/system/cpu/cpu0/online
1619 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1620 echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1621 # enable thermal core_control now
1622 echo 1 > /sys/module/msm_thermal/core_control/enabled
1623
1624 echo "25000 1094400:50000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
1625 echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
1626 echo 30000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
1627 echo 998400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
1628 echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
1629 echo "1 800000:85 998400:90 1094400:80" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
1630 echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
1631 echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
1632
1633 # Bring up all cores online
1634 echo 1 > /sys/devices/system/cpu/cpu1/online
1635 echo 1 > /sys/devices/system/cpu/cpu2/online
1636 echo 1 > /sys/devices/system/cpu/cpu3/online
1637 echo 1 > /sys/devices/system/cpu/cpu4/online
1638 ;;
1639 esac
1640
1641 # Apply governor settings for 8936
1642 case "$soc_id" in
1643 "233" | "240" | "242")
1644
1645 # HMP scheduler load tracking settings
1646 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
1647
1648 # HMP Task packing settings for 8936
1649 echo 50 > /proc/sys/kernel/sched_small_task
1650 echo 50 > /proc/sys/kernel/sched_mostly_idle_load
1651 echo 10 > /proc/sys/kernel/sched_mostly_idle_nr_run
1652
1653 # disable thermal core_control to update scaling_min_freq, interactive gov
1654 echo 0 > /sys/module/msm_thermal/core_control/enabled
1655 echo 1 > /sys/devices/system/cpu/cpu0/online
1656 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1657 echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1658 # enable thermal core_control now
1659 echo 1 > /sys/module/msm_thermal/core_control/enabled
1660
1661 echo "25000 1113600:50000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
1662 echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
1663 echo 30000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
1664 echo 960000 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
1665 echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
1666 echo "1 800000:85 1113600:90 1267200:80" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
1667 echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
1668 echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
1669
1670 # Bring up all cores online
1671 echo 1 > /sys/devices/system/cpu/cpu1/online
1672 echo 1 > /sys/devices/system/cpu/cpu2/online
1673 echo 1 > /sys/devices/system/cpu/cpu3/online
1674 echo 1 > /sys/devices/system/cpu/cpu4/online
1675
1676 # Enable low power modes
1677 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
1678
1679 for gpu_bimc_io_percent in /sys/class/devfreq/*qcom,gpubw*/bw_hwmon/io_percent
1680 do
1681 echo 40 > $gpu_bimc_io_percent
1682 done
1683 ;;
1684 esac
1685
1686 # Apply governor settings for 8939
1687 case "$soc_id" in
1688 "239" | "241" | "263" | "268" | "269" | "270" | "271")
1689
1690 if [ `cat /sys/devices/soc0/revision` != "3.0" ]; then
1691 # Apply 1.0 and 2.0 specific Sched & Governor settings
1692
1693 # HMP scheduler load tracking settings
1694 echo 5 > /proc/sys/kernel/sched_ravg_hist_size
1695
1696 # HMP Task packing settings for 8939, 8929
1697 echo 20 > /proc/sys/kernel/sched_small_task
1698
1699 for devfreq_gov in /sys/class/devfreq/*qcom,mincpubw*/governor
1700 do
1701 echo "cpufreq" > $devfreq_gov
1702 done
1703
1704 for devfreq_gov in /sys/class/devfreq/*qcom,cpubw*/governor
1705 do
1706 echo "bw_hwmon" > $devfreq_gov
1707 for cpu_io_percent in /sys/class/devfreq/*qcom,cpubw*/bw_hwmon/io_percent
1708 do
1709 echo 20 > $cpu_io_percent
1710 done
1711 done
1712
1713 for gpu_bimc_io_percent in /sys/class/devfreq/*qcom,gpubw*/bw_hwmon/io_percent
1714 do
1715 echo 40 > $gpu_bimc_io_percent
1716 done
1717 # disable thermal core_control to update interactive gov settings
1718 echo 0 > /sys/module/msm_thermal/core_control/enabled
1719
1720 # enable governor for perf cluster
1721 echo 1 > /sys/devices/system/cpu/cpu0/online
1722 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1723 echo "20000 1113600:50000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
1724 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
1725 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
1726 echo 1113600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
1727 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
1728 echo "1 960000:85 1113600:90 1344000:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
1729 echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
1730 echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
1731 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1732
1733 # enable governor for power cluster
1734 echo 1 > /sys/devices/system/cpu/cpu4/online
1735 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
1736 echo "25000 800000:50000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
1737 echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
1738 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
1739 echo 998400 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
1740 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
1741 echo "1 800000:90" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
1742 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
1743 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
1744 echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
1745
1746 # enable thermal core_control now
1747 echo 1 > /sys/module/msm_thermal/core_control/enabled
1748
1749 # Bring up all cores online
1750 echo 1 > /sys/devices/system/cpu/cpu1/online
1751 echo 1 > /sys/devices/system/cpu/cpu2/online
1752 echo 1 > /sys/devices/system/cpu/cpu3/online
1753 echo 1 > /sys/devices/system/cpu/cpu4/online
1754 echo 1 > /sys/devices/system/cpu/cpu5/online
1755 echo 1 > /sys/devices/system/cpu/cpu6/online
1756 echo 1 > /sys/devices/system/cpu/cpu7/online
1757
1758 # Enable low power modes
1759 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
1760
1761 # HMP scheduler (big.Little cluster related) settings
1762 echo 75 > /proc/sys/kernel/sched_upmigrate
1763 echo 60 > /proc/sys/kernel/sched_downmigrate
1764
1765 # cpu idle load threshold
1766 echo 30 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
1767 echo 30 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
1768 echo 30 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
1769 echo 30 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
1770 echo 30 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_load
1771 echo 30 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_load
1772 echo 30 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_load
1773 echo 30 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_load
1774
1775 # cpu idle nr run threshold
1776 echo 3 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run
1777 echo 3 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run
1778 echo 3 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run
1779 echo 3 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run
1780 echo 3 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_nr_run
1781 echo 3 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_nr_run
1782 echo 3 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_nr_run
1783 echo 3 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_nr_run
1784
1785 else
1786 # Apply 3.0 specific Sched & Governor settings
1787 # HMP scheduler settings for 8939 V3.0
1788 echo 3 > /proc/sys/kernel/sched_window_stats_policy
1789 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
1790 echo 20000000 > /proc/sys/kernel/sched_ravg_window
1791
1792 # HMP Task packing settings for 8939 V3.0
1793 echo 20 > /proc/sys/kernel/sched_small_task
1794 echo 30 > /proc/sys/kernel/sched_mostly_idle_load
1795 echo 3 > /proc/sys/kernel/sched_mostly_idle_nr_run
1796
1797 echo 0 > /sys/devices/system/cpu/cpu0/sched_prefer_idle
1798 echo 0 > /sys/devices/system/cpu/cpu1/sched_prefer_idle
1799 echo 0 > /sys/devices/system/cpu/cpu2/sched_prefer_idle
1800 echo 0 > /sys/devices/system/cpu/cpu3/sched_prefer_idle
1801 echo 0 > /sys/devices/system/cpu/cpu4/sched_prefer_idle
1802 echo 0 > /sys/devices/system/cpu/cpu5/sched_prefer_idle
1803 echo 0 > /sys/devices/system/cpu/cpu6/sched_prefer_idle
1804 echo 0 > /sys/devices/system/cpu/cpu7/sched_prefer_idle
1805
1806 for devfreq_gov in /sys/class/devfreq/*qcom,mincpubw*/governor
1807 do
1808 echo "cpufreq" > $devfreq_gov
1809 done
1810
1811 for devfreq_gov in /sys/class/devfreq/*qcom,cpubw*/governor
1812 do
1813 echo "bw_hwmon" > $devfreq_gov
1814 for cpu_io_percent in /sys/class/devfreq/*qcom,cpubw*/bw_hwmon/io_percent
1815 do
1816 echo 20 > $cpu_io_percent
1817 done
1818 done
1819
1820 for gpu_bimc_io_percent in /sys/class/devfreq/*qcom,gpubw*/bw_hwmon/io_percent
1821 do
1822 echo 40 > $gpu_bimc_io_percent
1823 done
1824 # disable thermal core_control to update interactive gov settings
1825 echo 0 > /sys/module/msm_thermal/core_control/enabled
1826
1827 # enable governor for perf cluster
1828 echo 1 > /sys/devices/system/cpu/cpu0/online
1829 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1830 echo "19000 1113600:39000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
1831 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
1832 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
1833 echo 1113600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
1834 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
1835 echo "1 960000:85 1113600:90 1344000:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
1836 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
1837 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
1838 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
1839
1840 # enable governor for power cluster
1841 echo 1 > /sys/devices/system/cpu/cpu4/online
1842 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
1843 echo 39000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
1844 echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
1845 echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
1846 echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
1847 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
1848 echo "1 800000:90" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
1849 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
1850 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
1851 echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
1852
1853 # enable thermal core_control now
1854 echo 1 > /sys/module/msm_thermal/core_control/enabled
1855
1856 # Bring up all cores online
1857 echo 1 > /sys/devices/system/cpu/cpu1/online
1858 echo 1 > /sys/devices/system/cpu/cpu2/online
1859 echo 1 > /sys/devices/system/cpu/cpu3/online
1860 echo 1 > /sys/devices/system/cpu/cpu5/online
1861 echo 1 > /sys/devices/system/cpu/cpu6/online
1862 echo 1 > /sys/devices/system/cpu/cpu7/online
1863
1864 # Enable low power modes
1865 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
1866
1867 # HMP scheduler (big.Little cluster related) settings
1868 echo 93 > /proc/sys/kernel/sched_upmigrate
1869 echo 83 > /proc/sys/kernel/sched_downmigrate
1870
1871 # Enable sched guided freq control
1872 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
1873 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
1874 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
1875 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
1876 echo 50000 > /proc/sys/kernel/sched_freq_inc_notify
1877 echo 50000 > /proc/sys/kernel/sched_freq_dec_notify
1878
1879 # Enable core control
1880# insmod /system/lib/modules/core_ctl.ko
1881 echo 2 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
1882 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/max_cpus
1883 echo 68 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
1884 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
1885 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
1886 case "$revision" in
1887 "3.0")
1888 # Enable dynamic clock gatin
1889 echo 1 > /sys/module/lpm_levels/lpm_workarounds/dynamic_clock_gating
1890 ;;
1891 esac
1892 fi
1893 ;;
1894 esac
1895 # Set Memory parameters
1896 configure_memory_parameters
1897 ;;
1898esac
1899
1900case "$target" in
1901 "msm8952")
1902
1903 if [ -f /sys/devices/soc0/soc_id ]; then
1904 soc_id=`cat /sys/devices/soc0/soc_id`
1905 else
1906 soc_id=`cat /sys/devices/system/soc/soc0/id`
1907 fi
1908 case "$soc_id" in
1909 "264" | "289")
1910 # Apply Scheduler and Governor settings for 8952
1911
1912 # HMP scheduler settings
1913 echo 3 > /proc/sys/kernel/sched_window_stats_policy
1914 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
1915 echo 20000000 > /proc/sys/kernel/sched_ravg_window
1916
1917 # HMP Task packing settings
1918 echo 20 > /proc/sys/kernel/sched_small_task
1919 echo 30 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
1920 echo 30 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
1921 echo 30 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
1922 echo 30 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
1923 echo 30 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_load
1924 echo 30 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_load
1925 echo 30 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_load
1926 echo 30 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_load
1927
1928 echo 3 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run
1929 echo 3 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run
1930 echo 3 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run
1931 echo 3 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run
1932 echo 3 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_nr_run
1933 echo 3 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_nr_run
1934 echo 3 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_nr_run
1935 echo 3 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_nr_run
1936
1937 echo 0 > /sys/devices/system/cpu/cpu0/sched_prefer_idle
1938 echo 0 > /sys/devices/system/cpu/cpu1/sched_prefer_idle
1939 echo 0 > /sys/devices/system/cpu/cpu2/sched_prefer_idle
1940 echo 0 > /sys/devices/system/cpu/cpu3/sched_prefer_idle
1941 echo 0 > /sys/devices/system/cpu/cpu4/sched_prefer_idle
1942 echo 0 > /sys/devices/system/cpu/cpu5/sched_prefer_idle
1943 echo 0 > /sys/devices/system/cpu/cpu6/sched_prefer_idle
1944 echo 0 > /sys/devices/system/cpu/cpu7/sched_prefer_idle
1945
1946 echo 0 > /proc/sys/kernel/sched_boost
1947
1948 for devfreq_gov in /sys/class/devfreq/*qcom,mincpubw*/governor
1949 do
1950 echo "cpufreq" > $devfreq_gov
1951 done
1952
1953 for devfreq_gov in /sys/class/devfreq/*qcom,cpubw*/governor
1954 do
1955 echo "bw_hwmon" > $devfreq_gov
1956 for cpu_io_percent in /sys/class/devfreq/*qcom,cpubw*/bw_hwmon/io_percent
1957 do
1958 echo 20 > $cpu_io_percent
1959 done
1960 for cpu_guard_band in /sys/class/devfreq/*qcom,cpubw*/bw_hwmon/guard_band_mbps
1961 do
1962 echo 30 > $cpu_guard_band
1963 done
1964 done
1965
1966 for gpu_bimc_io_percent in /sys/class/devfreq/qcom,gpubw*/bw_hwmon/io_percent
1967 do
1968 echo 40 > $gpu_bimc_io_percent
1969 done
1970 # disable thermal & BCL core_control to update interactive gov settings
1971 echo 0 > /sys/module/msm_thermal/core_control/enabled
1972 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
1973 do
1974 echo -n disable > $mode
1975 done
1976 for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask
1977 do
1978 bcl_hotplug_mask=`cat $hotplug_mask`
1979 echo 0 > $hotplug_mask
1980 done
1981 for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask
1982 do
1983 bcl_soc_hotplug_mask=`cat $hotplug_soc_mask`
1984 echo 0 > $hotplug_soc_mask
1985 done
1986 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
1987 do
1988 echo -n enable > $mode
1989 done
1990
1991 # enable governor for perf cluster
1992 echo 1 > /sys/devices/system/cpu/cpu0/online
1993 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
1994 echo "19000 1113600:39000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
1995 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
1996 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
1997 echo 1113600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
1998 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
1999 echo "1 960000:85 1113600:90 1344000:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
2000 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
2001 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
2002 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
2003
2004 # enable governor for power cluster
2005 echo 1 > /sys/devices/system/cpu/cpu4/online
2006 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
2007 echo 39000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
2008 echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
2009 echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
2010 echo 806400 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
2011 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
2012 echo "1 806400:90" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
2013 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
2014 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
2015 echo 806400 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
2016
2017 # Bring up all cores online
2018 echo 1 > /sys/devices/system/cpu/cpu1/online
2019 echo 1 > /sys/devices/system/cpu/cpu2/online
2020 echo 1 > /sys/devices/system/cpu/cpu3/online
2021 echo 1 > /sys/devices/system/cpu/cpu4/online
2022 echo 1 > /sys/devices/system/cpu/cpu5/online
2023 echo 1 > /sys/devices/system/cpu/cpu6/online
2024 echo 1 > /sys/devices/system/cpu/cpu7/online
2025
2026 # Enable Low power modes
2027 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
2028
2029 # HMP scheduler (big.Little cluster related) settings
2030 echo 93 > /proc/sys/kernel/sched_upmigrate
2031 echo 83 > /proc/sys/kernel/sched_downmigrate
2032
2033 # Enable sched guided freq control
2034 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
2035 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
2036 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
2037 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
2038 echo 50000 > /proc/sys/kernel/sched_freq_inc_notify
2039 echo 50000 > /proc/sys/kernel/sched_freq_dec_notify
2040
2041 # Enable core control
2042 echo 2 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
2043 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/max_cpus
2044 echo 68 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
2045 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
2046 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
2047 echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster
2048
2049 # re-enable thermal & BCL core_control now
2050 echo 1 > /sys/module/msm_thermal/core_control/enabled
2051 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2052 do
2053 echo -n disable > $mode
2054 done
2055 for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask
2056 do
2057 echo $bcl_hotplug_mask > $hotplug_mask
2058 done
2059 for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask
2060 do
2061 echo $bcl_soc_hotplug_mask > $hotplug_soc_mask
2062 done
2063 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2064 do
2065 echo -n enable > $mode
2066 done
2067
2068 # Enable dynamic clock gating
2069 echo 1 > /sys/module/lpm_levels/lpm_workarounds/dynamic_clock_gating
2070 # Enable timer migration to little cluster
2071 echo 1 > /proc/sys/kernel/power_aware_timer_migration
2072
2073 # Set Memory parameters
2074 configure_memory_parameters
2075
2076 ;;
2077 *)
2078 panel=`cat /sys/class/graphics/fb0/modes`
2079 if [ "${panel:5:1}" == "x" ]; then
2080 panel=${panel:2:3}
2081 else
2082 panel=${panel:2:4}
2083 fi
2084
2085 # Apply Scheduler and Governor settings for 8976
2086 # SoC IDs are 266, 274, 277, 278
2087
2088 # HMP scheduler (big.Little cluster related) settings
2089 echo 95 > /proc/sys/kernel/sched_upmigrate
2090 echo 85 > /proc/sys/kernel/sched_downmigrate
2091
2092 echo 2 > /proc/sys/kernel/sched_window_stats_policy
2093 echo 5 > /proc/sys/kernel/sched_ravg_hist_size
2094
2095 echo 3 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run
2096 echo 3 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run
2097 echo 3 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run
2098 echo 3 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run
2099 echo 3 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_nr_run
2100 echo 3 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_nr_run
2101 echo 3 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_nr_run
2102 echo 3 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_nr_run
2103
2104 for devfreq_gov in /sys/class/devfreq/*qcom,mincpubw*/governor
2105 do
2106 echo "cpufreq" > $devfreq_gov
2107 done
2108
2109 for devfreq_gov in /sys/class/devfreq/*qcom,cpubw*/governor
2110 do
2111 echo "bw_hwmon" > $devfreq_gov
2112 for cpu_io_percent in /sys/class/devfreq/*qcom,cpubw*/bw_hwmon/io_percent
2113 do
2114 echo 20 > $cpu_io_percent
2115 done
2116 for cpu_guard_band in /sys/class/devfreq/*qcom,cpubw*/bw_hwmon/guard_band_mbps
2117 do
2118 echo 30 > $cpu_guard_band
2119 done
2120 done
2121
2122 for gpu_bimc_io_percent in /sys/class/devfreq/qcom,gpubw*/bw_hwmon/io_percent
2123 do
2124 echo 40 > $gpu_bimc_io_percent
2125 done
2126 # disable thermal & BCL core_control to update interactive gov settings
2127 echo 0 > /sys/module/msm_thermal/core_control/enabled
2128 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2129 do
2130 echo -n disable > $mode
2131 done
2132 for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask
2133 do
2134 bcl_hotplug_mask=`cat $hotplug_mask`
2135 echo 0 > $hotplug_mask
2136 done
2137 for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask
2138 do
2139 bcl_soc_hotplug_mask=`cat $hotplug_soc_mask`
2140 echo 0 > $hotplug_soc_mask
2141 done
2142 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2143 do
2144 echo -n enable > $mode
2145 done
2146
2147 # enable governor for power cluster
2148 echo 1 > /sys/devices/system/cpu/cpu0/online
2149 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
2150 echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
2151 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
2152 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
2153 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
2154 echo 691200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
2155
2156 # enable governor for perf cluster
2157 echo 1 > /sys/devices/system/cpu/cpu4/online
2158 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
2159 echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
2160 echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
2161 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
2162 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
2163 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
2164 echo 883200 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
2165 echo 60000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis
2166
2167 if [ $panel -gt 1080 ]; then
2168 #set texture cache size for resolution greater than 1080p
2169 setprop ro.hwui.texture_cache_size 72
2170 fi
2171
2172 echo 59000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
2173 echo 1305600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
2174 echo "1 691200:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
2175 echo 1382400 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
2176 echo "19000 1382400:39000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
2177 echo "85 1382400:90 1747200:80" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
2178 # HMP Task packing settings for 8976
2179 echo 30 > /proc/sys/kernel/sched_small_task
2180 echo 20 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
2181 echo 20 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
2182 echo 20 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
2183 echo 20 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
2184 echo 20 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_load
2185 echo 20 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_load
2186 echo 20 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_load
2187 echo 20 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_load
2188
2189 echo 0 > /proc/sys/kernel/sched_boost
2190
2191 # Bring up all cores online
2192 echo 1 > /sys/devices/system/cpu/cpu1/online
2193 echo 1 > /sys/devices/system/cpu/cpu2/online
2194 echo 1 > /sys/devices/system/cpu/cpu3/online
2195 echo 1 > /sys/devices/system/cpu/cpu4/online
2196 echo 1 > /sys/devices/system/cpu/cpu5/online
2197 echo 1 > /sys/devices/system/cpu/cpu6/online
2198 echo 1 > /sys/devices/system/cpu/cpu7/online
2199
2200 #Disable CPU retention modes for 32bit builds
2201 ProductName=`getprop ro.product.name`
2202 if [ "$ProductName" == "msm8952_32" ] || [ "$ProductName" == "msm8952_32_LMT" ]; then
2203 echo N > /sys/module/lpm_levels/system/a72/cpu4/retention/idle_enabled
2204 echo N > /sys/module/lpm_levels/system/a72/cpu5/retention/idle_enabled
2205 echo N > /sys/module/lpm_levels/system/a72/cpu6/retention/idle_enabled
2206 echo N > /sys/module/lpm_levels/system/a72/cpu7/retention/idle_enabled
2207 fi
2208
2209 if [ `cat /sys/devices/soc0/revision` == "1.0" ]; then
2210 # Disable l2-pc and l2-gdhs low power modes
2211 echo N > /sys/module/lpm_levels/system/a53/a53-l2-gdhs/idle_enabled
2212 echo N > /sys/module/lpm_levels/system/a72/a72-l2-gdhs/idle_enabled
2213 echo N > /sys/module/lpm_levels/system/a53/a53-l2-pc/idle_enabled
2214 echo N > /sys/module/lpm_levels/system/a72/a72-l2-pc/idle_enabled
2215 fi
2216
2217 # Enable LPM Prediction
2218 echo 1 > /sys/module/lpm_levels/parameters/lpm_prediction
2219
2220 # Enable Low power modes
2221 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
2222 # Disable L2 GDHS on 8976
2223 echo N > /sys/module/lpm_levels/system/a53/a53-l2-gdhs/idle_enabled
2224 echo N > /sys/module/lpm_levels/system/a72/a72-l2-gdhs/idle_enabled
2225
2226 # Enable sched guided freq control
2227 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
2228 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
2229 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
2230 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
2231 echo 50000 > /proc/sys/kernel/sched_freq_inc_notify
2232 echo 50000 > /proc/sys/kernel/sched_freq_dec_notify
2233
2234 # Enable core control
2235 #for 8976
2236 echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
2237 echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/max_cpus
2238 echo 68 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres
2239 echo 40 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres
2240 echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms
2241 echo 1 > /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster
2242
2243 # re-enable thermal & BCL core_control now
2244 echo 1 > /sys/module/msm_thermal/core_control/enabled
2245 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2246 do
2247 echo -n disable > $mode
2248 done
2249 for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask
2250 do
2251 echo $bcl_hotplug_mask > $hotplug_mask
2252 done
2253 for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask
2254 do
2255 echo $bcl_soc_hotplug_mask > $hotplug_soc_mask
2256 done
2257 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2258 do
2259 echo -n enable > $mode
2260 done
2261
2262 # Enable timer migration to little cluster
2263 echo 1 > /proc/sys/kernel/power_aware_timer_migration
2264
2265 case "$soc_id" in
2266 "277" | "278")
2267 # Start energy-awareness for 8976
2268 start energy-awareness
2269 ;;
2270 esac
2271
2272 #enable sched colocation and colocation inheritance
2273 echo 130 > /proc/sys/kernel/sched_grp_upmigrate
2274 echo 110 > /proc/sys/kernel/sched_grp_downmigrate
2275 echo 1 > /proc/sys/kernel/sched_enable_thread_grouping
2276
2277 # Set Memory parameters
2278 configure_memory_parameters
2279
2280 ;;
2281 esac
2282 #Enable Memory Features
2283 enable_memory_features
2284 restorecon -R /sys/devices/system/cpu
2285 ;;
2286esac
2287
2288case "$target" in
2289 "msm8953")
2290
2291 if [ -f /sys/devices/soc0/soc_id ]; then
2292 soc_id=`cat /sys/devices/soc0/soc_id`
2293 else
2294 soc_id=`cat /sys/devices/system/soc/soc0/id`
2295 fi
2296
2297 if [ -f /sys/devices/soc0/hw_platform ]; then
2298 hw_platform=`cat /sys/devices/soc0/hw_platform`
2299 else
2300 hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
2301 fi
2302
2303 if [ -f /sys/devices/soc0/platform_subtype_id ]; then
2304 platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
2305 fi
2306
2307 echo 0 > /proc/sys/kernel/sched_boost
2308
2309 case "$soc_id" in
2310 "293" | "304" | "338" | "351")
2311
2312 # Start Host based Touch processing
2313 case "$hw_platform" in
2314 "MTP" | "Surf" | "RCM" )
2315 #if this directory is present, it means that a
2316 #1200p panel is connected to the device.
2317 dir="/sys/bus/i2c/devices/3-0038"
2318 if [ ! -d "$dir" ]; then
2319 start_hbtp
2320 fi
2321 ;;
2322 esac
2323
2324 if [ $soc_id -eq "338" ]; then
2325 case "$hw_platform" in
2326 "QRD" )
2327 if [ $platform_subtype_id -eq "1" ]; then
2328 start_hbtp
2329 fi
2330 ;;
2331 esac
2332 fi
2333
2334 #init task load, restrict wakeups to preferred cluster
2335 echo 15 > /proc/sys/kernel/sched_init_task_load
2336
2337 for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor
2338 do
2339 echo "cpufreq" > $devfreq_gov
2340 done
2341
2342 for devfreq_gov in /sys/class/devfreq/soc:qcom,cpubw/governor
2343 do
2344 echo "bw_hwmon" > $devfreq_gov
2345 for cpu_io_percent in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/io_percent
2346 do
2347 echo 34 > $cpu_io_percent
2348 done
2349 for cpu_guard_band in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/guard_band_mbps
2350 do
2351 echo 0 > $cpu_guard_band
2352 done
2353 for cpu_hist_memory in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/hist_memory
2354 do
2355 echo 20 > $cpu_hist_memory
2356 done
2357 for cpu_hyst_length in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_length
2358 do
2359 echo 10 > $cpu_hyst_length
2360 done
2361 for cpu_idle_mbps in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/idle_mbps
2362 do
2363 echo 1600 > $cpu_idle_mbps
2364 done
2365 for cpu_low_power_delay in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/low_power_delay
2366 do
2367 echo 20 > $cpu_low_power_delay
2368 done
2369 for cpu_low_power_io_percent in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/low_power_io_percent
2370 do
2371 echo 34 > $cpu_low_power_io_percent
2372 done
2373 for cpu_mbps_zones in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/mbps_zones
2374 do
2375 echo "1611 3221 5859 6445 7104" > $cpu_mbps_zones
2376 done
2377 for cpu_sample_ms in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/sample_ms
2378 do
2379 echo 4 > $cpu_sample_ms
2380 done
2381 for cpu_up_scale in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/up_scale
2382 do
2383 echo 250 > $cpu_up_scale
2384 done
2385 for cpu_min_freq in /sys/class/devfreq/soc:qcom,cpubw/min_freq
2386 do
2387 echo 1611 > $cpu_min_freq
2388 done
2389 done
2390
2391 for gpu_bimc_io_percent in /sys/class/devfreq/soc:qcom,gpubw/bw_hwmon/io_percent
2392 do
2393 echo 40 > $gpu_bimc_io_percent
2394 done
2395
2396 # disable thermal & BCL core_control to update interactive gov settings
2397 echo 0 > /sys/module/msm_thermal/core_control/enabled
2398 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2399 do
2400 echo -n disable > $mode
2401 done
2402 for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask
2403 do
2404 bcl_hotplug_mask=`cat $hotplug_mask`
2405 echo 0 > $hotplug_mask
2406 done
2407 for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask
2408 do
2409 bcl_soc_hotplug_mask=`cat $hotplug_soc_mask`
2410 echo 0 > $hotplug_soc_mask
2411 done
2412 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2413 do
2414 echo -n enable > $mode
2415 done
2416
2417 #if the kernel version >=4.9,use the schedutil governor
2418 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 9 ]; then
2419 8953_sched_dcvs_eas
2420 else
2421 8953_sched_dcvs_hmp
2422 echo 652800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
2423 fi
2424
2425 # Bring up all cores online
2426 echo 1 > /sys/devices/system/cpu/cpu1/online
2427 echo 1 > /sys/devices/system/cpu/cpu2/online
2428 echo 1 > /sys/devices/system/cpu/cpu3/online
2429 echo 1 > /sys/devices/system/cpu/cpu4/online
2430 echo 1 > /sys/devices/system/cpu/cpu5/online
2431 echo 1 > /sys/devices/system/cpu/cpu6/online
2432 echo 1 > /sys/devices/system/cpu/cpu7/online
2433
2434 # Enable low power modes
2435 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
2436
2437 # re-enable thermal & BCL core_control now
2438 echo 1 > /sys/module/msm_thermal/core_control/enabled
2439 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2440 do
2441 echo -n disable > $mode
2442 done
2443 for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask
2444 do
2445 echo $bcl_hotplug_mask > $hotplug_mask
2446 done
2447 for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask
2448 do
2449 echo $bcl_soc_hotplug_mask > $hotplug_soc_mask
2450 done
2451 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2452 do
2453 echo -n enable > $mode
2454 done
2455
2456 # SMP scheduler
2457 echo 85 > /proc/sys/kernel/sched_upmigrate
2458 echo 85 > /proc/sys/kernel/sched_downmigrate
2459
2460 # Set Memory parameters
2461 configure_memory_parameters
Rohit R Sekharadf49712022-11-17 21:05:16 +05302462
2463 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
2464 disable_ppr
2465 fi
merothh32be6882022-01-03 01:54:57 +05302466 ;;
2467 esac
2468 case "$soc_id" in
2469 "349" | "350")
2470
2471 # Start Host based Touch processing
2472 case "$hw_platform" in
2473 "MTP" | "Surf" | "RCM" | "QRD" )
2474 start_hbtp
2475 ;;
2476 esac
2477
2478 for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor
2479 do
2480 echo "cpufreq" > $devfreq_gov
2481 done
2482 for cpubw in /sys/class/devfreq/*qcom,cpubw*
2483 do
2484 echo "bw_hwmon" > $cpubw/governor
2485 echo 50 > $cpubw/polling_interval
2486 echo "1611 3221 5859 6445 7104" > $cpubw/bw_hwmon/mbps_zones
2487 echo 4 > $cpubw/bw_hwmon/sample_ms
2488 echo 34 > $cpubw/bw_hwmon/io_percent
2489 echo 20 > $cpubw/bw_hwmon/hist_memory
2490 echo 80 > $cpubw/bw_hwmon/down_thres
2491 echo 0 > $cpubw/bw_hwmon/hyst_length
2492 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
2493 echo 250 > $cpubw/bw_hwmon/up_scale
2494 echo 1600 > $cpubw/bw_hwmon/idle_mbps
2495 done
2496
2497 # Configure DCC module to capture critical register contents when device crashes
2498 for DCC_PATH in /sys/bus/platform/devices/*.dcc*
2499 do
2500 echo 0 > $DCC_PATH/enable
2501 echo cap > $DCC_PATH/func_type
2502 echo sram > $DCC_PATH/data_sink
2503 echo 1 > $DCC_PATH/config_reset
2504
2505 # Register specifies APC CPR closed-loop settled voltage for current voltage corner
2506 echo 0xb1d2c18 1 > $DCC_PATH/config
2507
2508 # Register specifies SW programmed open-loop voltage for current voltage corner
2509 echo 0xb1d2900 1 > $DCC_PATH/config
2510
2511 # Register specifies APM switch settings and APM FSM state
2512 echo 0xb1112b0 1 > $DCC_PATH/config
2513
2514 # Register specifies CPR mode change state and also #online cores input to CPR HW
2515 echo 0xb018798 1 > $DCC_PATH/config
2516
2517 echo 1 > $DCC_PATH/enable
2518 done
2519
2520 # disable thermal & BCL core_control to update interactive gov settings
2521 echo 0 > /sys/module/msm_thermal/core_control/enabled
2522 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2523 do
2524 echo -n disable > $mode
2525 done
2526 for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask
2527 do
2528 bcl_hotplug_mask=`cat $hotplug_mask`
2529 echo 0 > $hotplug_mask
2530 done
2531 for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask
2532 do
2533 bcl_soc_hotplug_mask=`cat $hotplug_soc_mask`
2534 echo 0 > $hotplug_soc_mask
2535 done
2536 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2537 do
2538 echo -n enable > $mode
2539 done
2540
2541 # configure governor settings for little cluster
2542 echo 1 > /sys/devices/system/cpu/cpu0/online
2543 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
2544 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
2545 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
2546 echo 1363200 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
2547 #default value for hispeed_load is 90, for sdm632 it should be 85
2548 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load
2549 # sched_load_boost as -6 is equivalent to target load as 85.
2550 echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost
2551 echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost
2552 echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost
2553 echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost
2554
2555 # configure governor settings for big cluster
2556 echo 1 > /sys/devices/system/cpu/cpu4/online
2557 echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
2558 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/up_rate_limit_us
2559 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_rate_limit_us
2560 echo 1401600 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq
2561 #default value for hispeed_load is 90, for sdm632 it should be 85
2562 echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_load
2563 # sched_load_boost as -6 is equivalent to target load as 85.
2564 echo -6 > /sys/devices/system/cpu/cpu4/sched_load_boost
2565 echo -6 > /sys/devices/system/cpu/cpu5/sched_load_boost
2566 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
2567 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
2568
2569 echo 614400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
2570 echo 633600 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
2571
2572 # cpuset settings
2573 echo 0-3 > /dev/cpuset/background/cpus
2574 echo 0-3 > /dev/cpuset/system-background/cpus
2575 # choose idle CPU for top app tasks
2576 echo 1 > /dev/stune/top-app/schedtune.prefer_idle
2577
2578 # re-enable thermal & BCL core_control now
2579 echo 1 > /sys/module/msm_thermal/core_control/enabled
2580 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2581 do
2582 echo -n disable > $mode
2583 done
2584 for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask
2585 do
2586 echo $bcl_hotplug_mask > $hotplug_mask
2587 done
2588 for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask
2589 do
2590 echo $bcl_soc_hotplug_mask > $hotplug_soc_mask
2591 done
2592 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
2593 do
2594 echo -n enable > $mode
2595 done
2596
2597 # Disable Core control
2598 echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable
2599 echo 0 > /sys/devices/system/cpu/cpu4/core_ctl/enable
2600
2601 # Bring up all cores online
2602 echo 1 > /sys/devices/system/cpu/cpu1/online
2603 echo 1 > /sys/devices/system/cpu/cpu2/online
2604 echo 1 > /sys/devices/system/cpu/cpu3/online
2605 echo 1 > /sys/devices/system/cpu/cpu4/online
2606 echo 1 > /sys/devices/system/cpu/cpu5/online
2607 echo 1 > /sys/devices/system/cpu/cpu6/online
2608 echo 1 > /sys/devices/system/cpu/cpu7/online
2609
2610 # Enable low power modes
2611 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
2612
2613 # Set Memory parameters
2614 configure_memory_parameters
2615
2616 # Setting b.L scheduler parameters
2617 echo 76 > /proc/sys/kernel/sched_downmigrate
2618 echo 86 > /proc/sys/kernel/sched_upmigrate
2619 echo 80 > /proc/sys/kernel/sched_group_downmigrate
2620 echo 90 > /proc/sys/kernel/sched_group_upmigrate
2621 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
2622
2623 # Enable min frequency adjustment for big cluster
2624 if [ -f /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_cluster ]; then
2625 echo "4-7" > /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_cluster
2626 fi
2627 echo 1 > /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_adjust
2628
2629 ;;
2630 esac
2631 ;;
2632esac
2633
2634case "$target" in
2635 "msm8937")
2636
2637 if [ -f /sys/devices/soc0/soc_id ]; then
2638 soc_id=`cat /sys/devices/soc0/soc_id`
2639 else
2640 soc_id=`cat /sys/devices/system/soc/soc0/id`
2641 fi
2642
2643 if [ -f /sys/devices/soc0/hw_platform ]; then
2644 hw_platform=`cat /sys/devices/soc0/hw_platform`
2645 else
2646 hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
2647 fi
2648 if [ -f /sys/devices/soc0/platform_subtype_id ]; then
2649 platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
2650 fi
2651
2652 # Socid 386 = Pukeena
2653 case "$soc_id" in
2654 "303" | "307" | "308" | "309" | "320" | "386" | "436")
2655
2656 # Start Host based Touch processing
2657 case "$hw_platform" in
2658 "MTP" )
2659 start_hbtp
2660 ;;
2661 esac
2662
2663 case "$hw_platform" in
2664 "Surf" | "RCM" )
2665 if [ $platform_subtype_id -ne "4" ]; then
2666 start_hbtp
2667 fi
2668 ;;
2669 esac
2670 # Apply Scheduler and Governor settings for 8917 / 8920
2671
2672 echo 20000000 > /proc/sys/kernel/sched_ravg_window
2673
2674 #disable sched_boost in 8917
2675 echo 0 > /proc/sys/kernel/sched_boost
2676
2677 # core_ctl is not needed for 8917. Disable it.
2678 disable_core_ctl
2679
2680 if [ $KernelVersionA -le 4 ] && [ $KernelVersionB -le 9 ]; then
2681 for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor
2682 do
2683 echo "cpufreq" > $devfreq_gov
2684 done
2685
2686 for devfreq_gov in /sys/class/devfreq/soc:qcom,cpubw/governor
2687 do
2688 echo "bw_hwmon" > $devfreq_gov
2689 for cpu_io_percent in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/io_percent
2690 do
2691 echo 20 > $cpu_io_percent
2692 done
2693 for cpu_guard_band in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/guard_band_mbps
2694 do
2695 echo 30 > $cpu_guard_band
2696 done
2697 done
2698
2699 for gpu_bimc_io_percent in /sys/class/devfreq/soc:qcom,gpubw/bw_hwmon/io_percent
2700 do
2701 echo 40 > $gpu_bimc_io_percent
2702 done
2703 fi
2704
2705 # disable thermal core_control to update interactive gov settings
2706 echo 0 > /sys/module/msm_thermal/core_control/enabled
2707
2708 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 9 ]; then
2709 8917_sched_dcvs_eas
2710 else
2711 8917_sched_dcvs_hmp
2712 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
2713 fi
2714
2715 # re-enable thermal core_control now
2716 echo 1 > /sys/module/msm_thermal/core_control/enabled
2717
2718 # Disable L2-GDHS low power modes
2719 echo N > /sys/module/lpm_levels/perf/perf-l2-gdhs/idle_enabled
2720 echo N > /sys/module/lpm_levels/perf/perf-l2-gdhs/suspend_enabled
2721
2722 # Bring up all cores online
2723 echo 1 > /sys/devices/system/cpu/cpu1/online
2724 echo 1 > /sys/devices/system/cpu/cpu2/online
2725 echo 1 > /sys/devices/system/cpu/cpu3/online
2726
2727 # Enable low power modes
2728 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
2729
2730 # Set rps mask
2731 echo 2 > /sys/class/net/rmnet0/queues/rx-0/rps_cpus
2732
2733 # Enable dynamic clock gating
2734 echo 1 > /sys/module/lpm_levels/lpm_workarounds/dynamic_clock_gating
2735 # Enable timer migration to little cluster
2736 echo 1 > /proc/sys/kernel/power_aware_timer_migration
2737 # Set Memory parameters
2738 configure_memory_parameters
Rohit R Sekharadf49712022-11-17 21:05:16 +05302739
2740 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
2741 disable_ppr
2742 fi
merothh32be6882022-01-03 01:54:57 +05302743 ;;
2744 *)
2745 ;;
2746 esac
2747
2748 case "$soc_id" in
2749 "294" | "295" | "313" )
2750
2751 # Start Host based Touch processing
2752 case "$hw_platform" in
2753 "MTP" | "Surf" | "RCM" )
2754 start_hbtp
2755 ;;
2756 esac
2757
2758 # Apply Scheduler and Governor settings for 8937/8940
2759
2760 # HMP scheduler settings
2761 echo 3 > /proc/sys/kernel/sched_window_stats_policy
2762 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
2763 echo 20000000 > /proc/sys/kernel/sched_ravg_window
2764
2765 #disable sched_boost in 8937
2766 echo 0 > /proc/sys/kernel/sched_boost
2767
Rohit R Sekharadf49712022-11-17 21:05:16 +05302768 if [ $KernelVersionA -le 4 ] && [ $KernelVersionB -le 9 ]; then
2769 for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor
merothh32be6882022-01-03 01:54:57 +05302770 do
Rohit R Sekharadf49712022-11-17 21:05:16 +05302771 echo "cpufreq" > $devfreq_gov
merothh32be6882022-01-03 01:54:57 +05302772 done
merothh32be6882022-01-03 01:54:57 +05302773
Rohit R Sekharadf49712022-11-17 21:05:16 +05302774 for devfreq_gov in /sys/class/devfreq/soc:qcom,cpubw/governor
2775 do
2776 echo "bw_hwmon" > $devfreq_gov
2777 for cpu_io_percent in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/io_percent
2778 do
2779 echo 20 > $cpu_io_percent
2780 done
2781 for cpu_guard_band in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/guard_band_mbps
2782 do
2783 echo 30 > $cpu_guard_band
2784 done
2785 done
2786
2787 for gpu_bimc_io_percent in /sys/class/devfreq/soc:qcom,gpubw/bw_hwmon/io_percent
2788 do
2789 echo 40 > $gpu_bimc_io_percent
2790 done
2791 fi
merothh32be6882022-01-03 01:54:57 +05302792
2793 # disable thermal core_control to update interactive gov and core_ctl settings
2794 echo 0 > /sys/module/msm_thermal/core_control/enabled
2795
2796 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 9 ]; then
2797 8937_sched_dcvs_eas
2798 else
2799 8937_sched_dcvs_hmp
2800 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
2801 echo 768000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
2802 fi
2803 # Disable L2-GDHS low power modes
2804 echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-gdhs/idle_enabled
2805 echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-gdhs/suspend_enabled
2806 echo N > /sys/module/lpm_levels/system/perf/perf-l2-gdhs/idle_enabled
2807 echo N > /sys/module/lpm_levels/system/perf/perf-l2-gdhs/suspend_enabled
2808
2809 # Bring up all cores online
2810 echo 1 > /sys/devices/system/cpu/cpu1/online
2811 echo 1 > /sys/devices/system/cpu/cpu2/online
2812 echo 1 > /sys/devices/system/cpu/cpu3/online
2813 echo 1 > /sys/devices/system/cpu/cpu4/online
2814 echo 1 > /sys/devices/system/cpu/cpu5/online
2815 echo 1 > /sys/devices/system/cpu/cpu6/online
2816 echo 1 > /sys/devices/system/cpu/cpu7/online
2817
2818 # Enable low power modes
2819 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
2820
2821 # HMP scheduler (big.Little cluster related) settings
2822 echo 93 > /proc/sys/kernel/sched_upmigrate
2823 echo 83 > /proc/sys/kernel/sched_downmigrate
2824
2825 # Enable core control
2826 echo 2 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
2827 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/max_cpus
2828 echo 68 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
2829 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
2830 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
2831 echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster
2832
2833 # re-enable thermal core_control
2834 echo 1 > /sys/module/msm_thermal/core_control/enabled
2835
2836 # Enable dynamic clock gating
2837 echo 1 > /sys/module/lpm_levels/lpm_workarounds/dynamic_clock_gating
2838 # Enable timer migration to little cluster
2839 echo 1 > /proc/sys/kernel/power_aware_timer_migration
2840 # Set Memory parameters
2841 configure_memory_parameters
Rohit R Sekharadf49712022-11-17 21:05:16 +05302842 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
2843 disable_ppr
2844 fi
merothh32be6882022-01-03 01:54:57 +05302845 ;;
2846 *)
2847
2848 ;;
2849 esac
2850
2851 case "$soc_id" in
2852 "354" | "364" | "353" | "363" )
2853
2854 # Start Host based Touch processing
2855 case "$hw_platform" in
2856 "MTP" | "Surf" | "RCM" | "QRD" )
2857 start_hbtp
2858 ;;
2859 esac
2860
2861 # Apply settings for sdm429/sda429/sdm439/sda439
2862 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
2863
2864 for device in /sys/devices/platform/soc
2865 do
2866 for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw
2867 do
2868 echo "bw_hwmon" > $cpubw/governor
Rohit R Sekharadf49712022-11-17 21:05:16 +05302869 echo 20 > $cpubw/bw_hwmon/io_percent
2870 echo 30 > $cpubw/bw_hwmon/guard_band_mbps
merothh32be6882022-01-03 01:54:57 +05302871 done
2872 done
2873 else
2874 for cpubw in /sys/class/devfreq/*qcom,mincpubw*
2875 do
2876 echo "cpufreq" > $cpubw/governor
2877 done
2878
2879 for cpubw in /sys/class/devfreq/*qcom,cpubw*
2880 do
2881 echo "bw_hwmon" > $cpubw/governor
2882 echo 20 > $cpubw/bw_hwmon/io_percent
2883 echo 30 > $cpubw/bw_hwmon/guard_band_mbps
2884 done
2885
2886 for gpu_bimc_io_percent in /sys/class/devfreq/soc:qcom,gpubw/bw_hwmon/io_percent
2887 do
2888 echo 40 > $gpu_bimc_io_percent
2889 done
2890 fi
2891
2892 case "$soc_id" in
2893 "353" | "363" )
2894 # Apply settings for sdm439/sda439
2895 echo 1 > /sys/devices/system/cpu/cpu0/online
2896 echo 1 > /sys/devices/system/cpu/cpu4/online
2897
2898 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
2899
2900 # memlat specific settings are moved to seperate file under
2901 # device/target specific folder
2902 setprop vendor.dcvs.prop 1
2903
2904 # configure schedutil governor settings
2905 # enable governor for perf cluster
2906 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
2907 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us
2908 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
2909
2910 #set the hispeed_freq
2911 echo 1497600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
2912 echo 80 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_load
2913 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl
2914 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq
2915 echo 960000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
2916
2917 #input boost params
2918 echo 1497600 > /sys/module/cpu_boost/parameters/input_boost_freq
2919 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
2920
2921 ## enable governor for power cluster
2922 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
2923 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us
2924 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/down_rate_limit_us
2925
2926 #set the hispeed_freq
2927 echo 998400 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq
2928 echo 85 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_load
2929 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl
2930 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/rtg_boost_freq
2931 echo 768000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq
2932 else
2933 # configure schedutil governor settings
2934 # enable governor for perf cluster
2935 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
2936 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
2937 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
2938
2939 #set the hispeed_freq
2940 echo 1497600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
2941 echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load
2942 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
2943
2944 ## enable governor for power cluster
2945 echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
2946 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/up_rate_limit_us
2947 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_rate_limit_us
2948
2949 #set the hispeed_freq
2950 echo 998400 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq
2951 echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_load
2952 echo 768000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
2953 fi
2954
2955 # sched_load_boost as -6 is equivalent to target load as 85.
2956 echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost
2957 echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost
2958 echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost
2959 echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost
2960 echo -6 > /sys/devices/system/cpu/cpu4/sched_load_boost
2961 echo -6 > /sys/devices/system/cpu/cpu5/sched_load_boost
2962 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
2963 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
2964
2965 # EAS scheduler (big.Little cluster related) settings
2966 echo 93 > /proc/sys/kernel/sched_upmigrate
2967 echo 83 > /proc/sys/kernel/sched_downmigrate
2968 echo 140 > /proc/sys/kernel/sched_group_upmigrate
2969 echo 120 > /proc/sys/kernel/sched_group_downmigrate
2970
2971 # cpuset settings
2972 #echo 0-3 > /dev/cpuset/background/cpus
2973 #echo 0-3 > /dev/cpuset/system-background/cpus
2974
2975 # Bring up all cores online
2976 echo 1 > /sys/devices/system/cpu/cpu1/online
2977 echo 1 > /sys/devices/system/cpu/cpu2/online
2978 echo 1 > /sys/devices/system/cpu/cpu3/online
2979 echo 1 > /sys/devices/system/cpu/cpu4/online
2980 echo 1 > /sys/devices/system/cpu/cpu5/online
2981 echo 1 > /sys/devices/system/cpu/cpu6/online
2982 echo 1 > /sys/devices/system/cpu/cpu7/online
2983
2984 # Enable core control
2985 echo 2 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
2986 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/max_cpus
2987 echo 68 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
2988 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
2989 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
2990 echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster
2991 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres
2992
2993 # Big cluster min frequency adjust settings
2994 if [ -f /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_cluster ]; then
2995 echo "0-3" > /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_cluster
2996 fi
2997 echo 1305600 > /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_floor
2998 ;;
2999 *)
3000 # Apply settings for sdm429/sda429
3001 # configure schedutil governor settings
3002 echo 1 > /sys/devices/system/cpu/cpu0/online
3003
3004 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
3005
3006 # memlat specific settings are moved to seperate file under
3007 # device/target specific folder
3008 setprop vendor.dcvs.prop 1
3009
3010 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
3011 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us
3012 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
3013
3014 #set the hispeed_freq
3015 echo 1305600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
3016 echo 80 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_load
3017 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl
3018 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq
3019 echo 960000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
3020 #input boost params
3021
3022 echo 1305600 > /sys/module/cpu_boost/parameters/input_boost_freq
3023 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
3024 else
3025 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
3026
3027 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
3028 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
3029
3030 #set the hispeed_freq
3031 echo 1305600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
3032 echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load
3033 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
3034 fi
3035
3036 # sched_load_boost as -6 is equivalent to target load as 85.
3037 echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost
3038 echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost
3039 echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost
3040 echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost
3041
3042 # Bring up all cores online
3043 echo 1 > /sys/devices/system/cpu/cpu1/online
3044 echo 1 > /sys/devices/system/cpu/cpu2/online
3045 echo 1 > /sys/devices/system/cpu/cpu3/online
3046 ;;
3047 esac
3048
3049 # Set Memory parameters
3050 configure_memory_parameters
3051
Rohit R Sekharadf49712022-11-17 21:05:16 +05303052 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
3053 disable_ppr
3054 fi
3055
merothh32be6882022-01-03 01:54:57 +05303056 #disable sched_boost
3057 echo 0 > /proc/sys/kernel/sched_boost
3058
3059 # Disable L2-GDHS low power modes
3060 echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-gdhs/idle_enabled
3061 echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-gdhs/suspend_enabled
3062 echo N > /sys/module/lpm_levels/system/perf/perf-l2-gdhs/idle_enabled
3063 echo N > /sys/module/lpm_levels/system/perf/perf-l2-gdhs/suspend_enabled
3064
3065 # Enable low power modes
3066 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
3067
3068 case "$soc_id" in
3069 "353" | "363" )
3070 echo 1 > /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_adjust
3071 ;;
3072 esac
3073 ;;
3074 esac
3075
3076 case "$soc_id" in
3077 "386" | "436")
3078
3079 # Start Host based Touch processing
3080 case "$hw_platform" in
3081 "QRD" )
3082 start_hbtp
3083 ;;
3084 esac
3085 ;;
3086 esac
3087 ;;
3088esac
3089
3090case "$target" in
3091 "sdm660")
3092
3093 # Set the default IRQ affinity to the primary cluster. When a
3094 # CPU is isolated/hotplugged, the IRQ affinity is adjusted
3095 # to one of the CPU from the default IRQ affinity mask.
3096 echo f > /proc/irq/default_smp_affinity
3097
3098 if [ -f /sys/devices/soc0/soc_id ]; then
3099 soc_id=`cat /sys/devices/soc0/soc_id`
3100 else
3101 soc_id=`cat /sys/devices/system/soc/soc0/id`
3102 fi
3103
3104 if [ -f /sys/devices/soc0/hw_platform ]; then
3105 hw_platform=`cat /sys/devices/soc0/hw_platform`
3106 else
3107 hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
3108 fi
3109
3110 panel=`cat /sys/class/graphics/fb0/modes`
3111 if [ "${panel:5:1}" == "x" ]; then
3112 panel=${panel:2:3}
3113 else
3114 panel=${panel:2:4}
3115 fi
3116
3117 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -le 14 ]; then
3118 if [ $panel -gt 1080 ]; then
3119 echo 2 > /proc/sys/kernel/sched_window_stats_policy
3120 echo 5 > /proc/sys/kernel/sched_ravg_hist_size
3121 else
3122 echo 3 > /proc/sys/kernel/sched_window_stats_policy
3123 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
3124 fi
3125 fi
3126 #Apply settings for sdm660, sdm636,sda636
3127 case "$soc_id" in
3128 "317" | "324" | "325" | "326" | "345" | "346" )
3129
3130 echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
3131 echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres
3132 echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres
3133 echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms
3134 echo 1 > /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster
3135 echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres
3136
3137 # Setting b.L scheduler parameters
3138 echo 96 > /proc/sys/kernel/sched_upmigrate
3139 echo 90 > /proc/sys/kernel/sched_downmigrate
3140 echo 140 > /proc/sys/kernel/sched_group_upmigrate
3141 echo 120 > /proc/sys/kernel/sched_group_downmigrate
3142
3143 # cpuset settings
3144 echo 0-3 > /dev/cpuset/background/cpus
3145 echo 0-3 > /dev/cpuset/system-background/cpus
3146
3147 #if the kernel version >=4.14,use the schedutil governor
3148 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 14 ]; then
3149 sdm660_sched_schedutil_dcvs
3150 else
3151 sdm660_sched_interactive_dcvs
3152 fi
3153
3154 # Set Memory parameters
3155 configure_memory_parameters
3156
3157 # enable LPM
3158 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
3159
3160 # Start cdsprpcd only for sdm660 and disable for sdm630
3161 start vendor.cdsprpcd
3162
3163 # Start Host based Touch processing
3164 case "$hw_platform" in
3165 "MTP" | "Surf" | "RCM" | "QRD" )
3166 start_hbtp
3167 ;;
3168 esac
3169 ;;
3170 esac
3171 #Apply settings for sdm630 and Tahaa
3172 case "$soc_id" in
3173 "318" | "327" | "385" )
3174
3175 # Start Host based Touch processing
3176 case "$hw_platform" in
3177 "MTP" | "Surf" | "RCM" | "QRD" )
3178 start_hbtp
3179 ;;
3180 esac
3181
3182 # Disable cdsprpcd daemon for sdm630
3183 setprop vendor.fastrpc.disable.cdsprpcd.daemon 1
3184
3185 # Setting b.L scheduler parameters
3186 echo 85 > /proc/sys/kernel/sched_upmigrate
3187 echo 85 > /proc/sys/kernel/sched_downmigrate
3188 echo 900 > /proc/sys/kernel/sched_group_upmigrate
3189 echo 900 > /proc/sys/kernel/sched_group_downmigrate
3190 echo 0 > /proc/sys/kernel/sched_select_prev_cpu_us
3191 echo 400000 > /proc/sys/kernel/sched_freq_inc_notify
3192 echo 400000 > /proc/sys/kernel/sched_freq_dec_notify
3193 echo 3 > /proc/sys/kernel/sched_spill_nr_run
3194
3195 #init task load, restrict wakeups to preferred cluster
3196 echo 15 > /proc/sys/kernel/sched_init_task_load
3197 echo 1 > /proc/sys/kernel/sched_restrict_cluster_spill
3198 echo 50000 > /proc/sys/kernel/sched_short_burst_ns
3199
3200 # cpuset settings
3201 echo 0-3 > /dev/cpuset/background/cpus
3202 echo 0-3 > /dev/cpuset/system-background/cpus
3203
3204 # disable thermal bcl hotplug to switch governor
3205 echo 0 > /sys/module/msm_thermal/core_control/enabled
3206 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
3207 do
3208 echo -n disable > $mode
3209 done
3210 for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask
3211 do
3212 bcl_hotplug_mask=`cat $hotplug_mask`
3213 echo 0 > $hotplug_mask
3214 done
3215 for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask
3216 do
3217 bcl_soc_hotplug_mask=`cat $hotplug_soc_mask`
3218 echo 0 > $hotplug_soc_mask
3219 done
3220 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
3221 do
3222 echo -n enable > $mode
3223 done
3224
3225 # online CPU0
3226 echo 1 > /sys/devices/system/cpu/cpu0/online
3227 # configure governor settings for Big cluster(CPU0 to CPU3)
3228 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
3229 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
3230 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
3231 echo "19000 1344000:39000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
3232 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
3233 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
3234 echo 1344000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
3235 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
3236 echo "85 1344000:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
3237 echo 39000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
3238 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis
3239 echo 787200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
3240 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif
3241
3242 # online CPU4
3243 echo 1 > /sys/devices/system/cpu/cpu4/online
3244 # configure governor settings for Little cluster(CPU4 to CPU7)
3245 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
3246 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
3247 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
3248 echo "19000 1094400:39000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
3249 echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
3250 echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
3251 echo 1094400 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
3252 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
3253 echo "85 1094400:80" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
3254 echo 39000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
3255 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis
3256 echo 614400 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
3257 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/ignore_hispeed_on_notif
3258
3259 # bring all cores online
3260 echo 1 > /sys/devices/system/cpu/cpu0/online
3261 echo 1 > /sys/devices/system/cpu/cpu1/online
3262 echo 1 > /sys/devices/system/cpu/cpu2/online
3263 echo 1 > /sys/devices/system/cpu/cpu3/online
3264 echo 1 > /sys/devices/system/cpu/cpu4/online
3265 echo 1 > /sys/devices/system/cpu/cpu5/online
3266 echo 1 > /sys/devices/system/cpu/cpu6/online
3267 echo 1 > /sys/devices/system/cpu/cpu7/online
3268
3269 # configure LPM
3270 echo N > /sys/module/lpm_levels/system/perf/cpu0/ret/idle_enabled
3271 echo N > /sys/module/lpm_levels/system/perf/cpu1/ret/idle_enabled
3272 echo N > /sys/module/lpm_levels/system/perf/cpu2/ret/idle_enabled
3273 echo N > /sys/module/lpm_levels/system/perf/cpu3/ret/idle_enabled
3274 echo N > /sys/module/lpm_levels/system/pwr/cpu4/ret/idle_enabled
3275 echo N > /sys/module/lpm_levels/system/pwr/cpu5/ret/idle_enabled
3276 echo N > /sys/module/lpm_levels/system/pwr/cpu6/ret/idle_enabled
3277 echo N > /sys/module/lpm_levels/system/pwr/cpu7/ret/idle_enabled
3278 echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-dynret/idle_enabled
3279 echo N > /sys/module/lpm_levels/system/perf/perf-l2-dynret/idle_enabled
3280 # enable LPM
3281 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
3282
3283 # re-enable thermal and BCL hotplug
3284 echo 1 > /sys/module/msm_thermal/core_control/enabled
3285 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
3286 do
3287 echo -n disable > $mode
3288 done
3289 for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask
3290 do
3291 echo $bcl_hotplug_mask > $hotplug_mask
3292 done
3293 for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask
3294 do
3295 echo $bcl_soc_hotplug_mask > $hotplug_soc_mask
3296 done
3297 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
3298 do
3299 echo -n enable > $mode
3300 done
3301
3302 # Set Memory parameters
3303 configure_memory_parameters
3304
3305 # Enable bus-dcvs
3306 for cpubw in /sys/class/devfreq/*qcom,cpubw*
3307 do
3308 echo "bw_hwmon" > $cpubw/governor
3309 echo 50 > $cpubw/polling_interval
3310 echo 762 > $cpubw/min_freq
3311 echo "1525 3143 4173 5195 5859 7759 9887 10327" > $cpubw/bw_hwmon/mbps_zones
3312 echo 4 > $cpubw/bw_hwmon/sample_ms
3313 echo 85 > $cpubw/bw_hwmon/io_percent
3314 echo 20 > $cpubw/bw_hwmon/hist_memory
3315 echo 0 > $cpubw/bw_hwmon/hyst_length
3316 echo 100 > $cpubw/bw_hwmon/decay_rate
3317 echo 50 > $cpubw/bw_hwmon/bw_step
3318 echo 80 > $cpubw/bw_hwmon/down_thres
3319 echo 0 > $cpubw/bw_hwmon/low_power_ceil_mbps
3320 echo 50 > $cpubw/bw_hwmon/low_power_io_percent
3321 echo 20 > $cpubw/bw_hwmon/low_power_delay
3322 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
3323 echo 250 > $cpubw/bw_hwmon/up_scale
3324 echo 1600 > $cpubw/bw_hwmon/idle_mbps
3325 done
3326
3327 for memlat in /sys/class/devfreq/*qcom,memlat-cpu*
3328 do
3329 echo "mem_latency" > $memlat/governor
3330 echo 10 > $memlat/polling_interval
3331 echo 400 > $memlat/mem_latency/ratio_ceil
3332 done
3333
3334 echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor
3335 ;;
3336 esac
3337 ;;
3338esac
3339
3340case "$target" in
3341 "sdm710")
3342
3343 #Apply settings for sdm710
3344 # Set the default IRQ affinity to the silver cluster. When a
3345 # CPU is isolated/hotplugged, the IRQ affinity is adjusted
3346 # to one of the CPU from the default IRQ affinity mask.
3347 echo 3f > /proc/irq/default_smp_affinity
3348
3349 if [ -f /sys/devices/soc0/soc_id ]; then
3350 soc_id=`cat /sys/devices/soc0/soc_id`
3351 else
3352 soc_id=`cat /sys/devices/system/soc/soc0/id`
3353 fi
3354
3355 if [ -f /sys/devices/soc0/hw_platform ]; then
3356 hw_platform=`cat /sys/devices/soc0/hw_platform`
3357 else
3358 hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
3359 fi
3360
3361 case "$soc_id" in
3362 "336" | "337" | "347" | "360" | "393" )
3363
3364 # Start Host based Touch processing
3365 case "$hw_platform" in
3366 "MTP" | "Surf" | "RCM" | "QRD" )
3367 start_hbtp
3368 ;;
3369 esac
3370
3371 # Core control parameters on silver
3372 echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred
3373 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
3374 echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
3375 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
3376 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
3377 echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster
3378 echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres
3379
3380 # Setting b.L scheduler parameters
3381 echo 96 > /proc/sys/kernel/sched_upmigrate
3382 echo 90 > /proc/sys/kernel/sched_downmigrate
3383 echo 140 > /proc/sys/kernel/sched_group_upmigrate
3384 echo 120 > /proc/sys/kernel/sched_group_downmigrate
3385 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
3386
3387 # configure governor settings for little cluster
3388 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
3389 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us
3390 echo 1209600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
3391 echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
3392
3393 # configure governor settings for big cluster
3394 echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor
3395 echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/rate_limit_us
3396 echo 1344000 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq
3397 echo 652800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq
3398
3399 # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
3400 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
3401 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
3402 echo 85 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load
3403
3404 echo "0:1209600" > /sys/module/cpu_boost/parameters/input_boost_freq
3405 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
3406
3407 # Set Memory parameters
3408 configure_memory_parameters
3409
3410 # Enable bus-dcvs
3411 for cpubw in /sys/class/devfreq/*qcom,cpubw*
3412 do
3413 echo "bw_hwmon" > $cpubw/governor
3414 echo 50 > $cpubw/polling_interval
3415 echo "1144 1720 2086 2929 3879 5931 6881" > $cpubw/bw_hwmon/mbps_zones
3416 echo 4 > $cpubw/bw_hwmon/sample_ms
3417 echo 68 > $cpubw/bw_hwmon/io_percent
3418 echo 20 > $cpubw/bw_hwmon/hist_memory
3419 echo 0 > $cpubw/bw_hwmon/hyst_length
3420 echo 80 > $cpubw/bw_hwmon/down_thres
3421 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
3422 echo 250 > $cpubw/bw_hwmon/up_scale
3423 echo 1600 > $cpubw/bw_hwmon/idle_mbps
3424 done
3425
3426 #Enable mem_latency governor for DDR scaling
3427 for memlat in /sys/class/devfreq/*qcom,memlat-cpu*
3428 do
3429 echo "mem_latency" > $memlat/governor
3430 echo 10 > $memlat/polling_interval
3431 echo 400 > $memlat/mem_latency/ratio_ceil
3432 done
3433
3434 #Enable mem_latency governor for L3 scaling
3435 for memlat in /sys/class/devfreq/*qcom,l3-cpu*
3436 do
3437 echo "mem_latency" > $memlat/governor
3438 echo 10 > $memlat/polling_interval
3439 echo 400 > $memlat/mem_latency/ratio_ceil
3440 done
3441
3442 #Enable userspace governor for L3 cdsp nodes
3443 for l3cdsp in /sys/class/devfreq/*qcom,l3-cdsp*
3444 do
3445 echo "userspace" > $l3cdsp/governor
3446 chown -h system $l3cdsp/userspace/set_freq
3447 done
3448
3449 echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor
3450
3451 # Disable CPU Retention
3452 echo N > /sys/module/lpm_levels/L3/cpu0/ret/idle_enabled
3453 echo N > /sys/module/lpm_levels/L3/cpu1/ret/idle_enabled
3454 echo N > /sys/module/lpm_levels/L3/cpu2/ret/idle_enabled
3455 echo N > /sys/module/lpm_levels/L3/cpu3/ret/idle_enabled
3456 echo N > /sys/module/lpm_levels/L3/cpu4/ret/idle_enabled
3457 echo N > /sys/module/lpm_levels/L3/cpu5/ret/idle_enabled
3458 echo N > /sys/module/lpm_levels/L3/cpu6/ret/idle_enabled
3459 echo N > /sys/module/lpm_levels/L3/cpu7/ret/idle_enabled
3460
3461 # cpuset parameters
3462 echo 0-5 > /dev/cpuset/background/cpus
3463 echo 0-5 > /dev/cpuset/system-background/cpus
3464
3465 # Turn off scheduler boost at the end
3466 echo 0 > /proc/sys/kernel/sched_boost
3467
3468 # Turn on sleep modes.
3469 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
3470 ;;
3471 esac
3472 ;;
3473esac
3474
3475case "$target" in
3476 "trinket")
3477
3478 if [ -f /sys/devices/soc0/soc_id ]; then
3479 soc_id=`cat /sys/devices/soc0/soc_id`
3480 else
3481 soc_id=`cat /sys/devices/system/soc/soc0/id`
3482 fi
3483
3484 case "$soc_id" in
Rohit R Sekharadf49712022-11-17 21:05:16 +05303485 "394" | "467" | "468" )
merothh32be6882022-01-03 01:54:57 +05303486
3487 # Core control parameters on big
3488 echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
3489 echo 40 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres
3490 echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres
3491 echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms
3492 echo 1 > /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster
3493 echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres
3494
3495 # Setting b.L scheduler parameters
3496 echo 67 > /proc/sys/kernel/sched_downmigrate
3497 echo 77 > /proc/sys/kernel/sched_upmigrate
3498 echo 85 > /proc/sys/kernel/sched_group_downmigrate
3499 echo 100 > /proc/sys/kernel/sched_group_upmigrate
3500
3501 # cpuset settings
3502 echo 0-3 > /dev/cpuset/background/cpus
3503 echo 0-3 > /dev/cpuset/system-background/cpus
3504
3505
3506 # configure governor settings for little cluster
3507 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
3508 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
3509 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
3510 echo 1305600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
3511 echo 614400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
3512
3513 # configure governor settings for big cluster
3514 echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
3515 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
3516 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
3517 echo 1401600 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq
3518 echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
3519
3520 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
3521
3522 # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
3523 echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost
3524 echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost
3525 echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost
3526 echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost
3527 echo -6 > /sys/devices/system/cpu/cpu4/sched_load_boost
3528 echo -6 > /sys/devices/system/cpu/cpu5/sched_load_boost
3529 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
3530 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
3531 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load
3532 echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_load
3533
3534 # Set Memory parameters
3535 configure_memory_parameters
3536
3537 # Enable bus-dcvs
3538 ddr_type=`od -An -tx /proc/device-tree/memory/ddr_device_type`
3539 ddr_type4="07"
3540 ddr_type3="05"
3541
3542 for device in /sys/devices/platform/soc
3543 do
3544 for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw
3545 do
3546 echo "bw_hwmon" > $cpubw/governor
3547 echo 762 > $cpubw/min_freq
3548 if [ ${ddr_type:4:2} == $ddr_type4 ]; then
3549 # LPDDR4
3550 echo "2288 3440 4173 5195 5859 7759 10322 11863 13763" > $cpubw/bw_hwmon/mbps_zones
3551 echo 85 > $cpubw/bw_hwmon/io_percent
3552 fi
3553 if [ ${ddr_type:4:2} == $ddr_type3 ]; then
3554 # LPDDR3
3555 echo "1525 3440 5195 5859 7102" > $cpubw/bw_hwmon/mbps_zones
3556 echo 34 > $cpubw/bw_hwmon/io_percent
3557 fi
3558 echo 4 > $cpubw/bw_hwmon/sample_ms
3559 echo 90 > $cpubw/bw_hwmon/decay_rate
3560 echo 190 > $cpubw/bw_hwmon/bw_step
3561 echo 20 > $cpubw/bw_hwmon/hist_memory
3562 echo 0 > $cpubw/bw_hwmon/hyst_length
3563 echo 80 > $cpubw/bw_hwmon/down_thres
3564 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
3565 echo 250 > $cpubw/bw_hwmon/up_scale
3566 echo 1600 > $cpubw/bw_hwmon/idle_mbps
3567 echo 50 > $cpubw/polling_interval
3568 done
3569
3570 done
3571
3572 # memlat specific settings are moved to seperate file under
3573 # device/target specific folder
3574 setprop vendor.dcvs.prop 1
3575
3576 # colcoation v3 disabled
3577 echo 0 > /proc/sys/kernel/sched_min_task_util_for_boost
3578 echo 0 > /proc/sys/kernel/sched_min_task_util_for_colocation
3579 echo 0 > /proc/sys/kernel/sched_little_cluster_coloc_fmin_khz
3580
3581 # Turn off scheduler boost at the end
3582 echo 0 > /proc/sys/kernel/sched_boost
3583
3584 # Turn on sleep modes.
3585 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
3586
3587 ;;
3588 esac
3589 ;;
3590esac
3591
3592case "$target" in
3593 "sm6150")
3594
3595 #Apply settings for sm6150
3596 # Set the default IRQ affinity to the silver cluster. When a
3597 # CPU is isolated/hotplugged, the IRQ affinity is adjusted
3598 # to one of the CPU from the default IRQ affinity mask.
3599 echo 3f > /proc/irq/default_smp_affinity
3600
3601 if [ -f /sys/devices/soc0/soc_id ]; then
3602 soc_id=`cat /sys/devices/soc0/soc_id`
3603 else
3604 soc_id=`cat /sys/devices/system/soc/soc0/id`
3605 fi
3606
3607 case "$soc_id" in
3608 "355" | "369" | "377" | "380" | "384" )
3609 target_type=`getprop ro.hardware.type`
3610 if [ "$target_type" == "automotive" ]; then
3611 # update frequencies
3612 configure_sku_parameters
3613 sku_identified=`getprop vendor.sku_identified`
3614 else
3615 sku_identified=0
3616 fi
3617
3618 # Core control parameters on silver
3619 echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred
3620 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
3621 echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
3622 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
3623 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
3624 echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster
3625 echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres
3626 echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable
3627
3628
3629 # Setting b.L scheduler parameters
3630 # default sched up and down migrate values are 90 and 85
3631 echo 65 > /proc/sys/kernel/sched_downmigrate
3632 echo 71 > /proc/sys/kernel/sched_upmigrate
3633 # default sched up and down migrate values are 100 and 95
3634 echo 85 > /proc/sys/kernel/sched_group_downmigrate
3635 echo 100 > /proc/sys/kernel/sched_group_upmigrate
3636 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
3637
3638 # colocation v3 settings
3639 echo 740000 > /proc/sys/kernel/sched_little_cluster_coloc_fmin_khz
3640
3641
3642 # configure governor settings for little cluster
3643 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
3644 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
3645 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
3646 echo 1209600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
3647 if [ $sku_identified != 1 ]; then
3648 echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
3649 fi
3650
3651 # configure governor settings for big cluster
3652 echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor
3653 echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us
3654 echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us
3655 echo 1209600 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq
3656 if [ $sku_identified != 1 ]; then
3657 echo 768000 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq
3658 fi
3659
3660 # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
3661 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
3662 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
3663 echo 85 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load
3664
3665 echo "0:1209600" > /sys/module/cpu_boost/parameters/input_boost_freq
3666 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
3667
3668 # Set Memory parameters
3669 configure_memory_parameters
3670
3671 # Enable bus-dcvs
3672 for device in /sys/devices/platform/soc
3673 do
3674 for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw
3675 do
3676 echo "bw_hwmon" > $cpubw/governor
3677 echo "2288 4577 7110 9155 12298 14236" > $cpubw/bw_hwmon/mbps_zones
3678 echo 4 > $cpubw/bw_hwmon/sample_ms
3679 echo 68 > $cpubw/bw_hwmon/io_percent
3680 echo 20 > $cpubw/bw_hwmon/hist_memory
3681 echo 0 > $cpubw/bw_hwmon/hyst_length
3682 echo 80 > $cpubw/bw_hwmon/down_thres
3683 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
3684 echo 250 > $cpubw/bw_hwmon/up_scale
3685 echo 1600 > $cpubw/bw_hwmon/idle_mbps
3686 echo 50 > $cpubw/polling_interval
3687 done
3688
3689 for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw
3690 do
3691 echo "bw_hwmon" > $llccbw/governor
3692 echo "1144 1720 2086 2929 3879 5931 6881" > $llccbw/bw_hwmon/mbps_zones
3693 echo 4 > $llccbw/bw_hwmon/sample_ms
3694 echo 68 > $llccbw/bw_hwmon/io_percent
3695 echo 20 > $llccbw/bw_hwmon/hist_memory
3696 echo 0 > $llccbw/bw_hwmon/hyst_length
3697 echo 80 > $llccbw/bw_hwmon/down_thres
3698 echo 0 > $llccbw/bw_hwmon/guard_band_mbps
3699 echo 250 > $llccbw/bw_hwmon/up_scale
3700 echo 1600 > $llccbw/bw_hwmon/idle_mbps
3701 echo 40 > $llccbw/polling_interval
3702 done
3703 done
3704
3705 # memlat specific settings are moved to seperate file under
3706 # device/target specific folder
3707 setprop vendor.dcvs.prop 1
3708
3709 # cpuset parameters
3710 echo 0-5 > /dev/cpuset/background/cpus
3711 echo 0-5 > /dev/cpuset/system-background/cpus
3712
3713 # Turn off scheduler boost at the end
3714 echo 0 > /proc/sys/kernel/sched_boost
3715
3716 # Turn on sleep modes.
3717 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
3718 ;;
3719 esac
3720
3721 #Apply settings for moorea
3722 case "$soc_id" in
3723 "365" | "366" )
3724
3725 # Core control parameters on silver
3726 echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred
3727 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
3728 echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
3729 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
3730 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
3731 echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster
3732 echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres
3733 echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable
3734
3735 # Setting b.L scheduler parameters
3736 # default sched up and down migrate values are 71 and 65
3737 echo 65 > /proc/sys/kernel/sched_downmigrate
3738 echo 71 > /proc/sys/kernel/sched_upmigrate
3739 # default sched up and down migrate values are 100 and 95
3740 echo 85 > /proc/sys/kernel/sched_group_downmigrate
3741 echo 100 > /proc/sys/kernel/sched_group_upmigrate
3742 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
3743
3744 #colocation v3 settings
3745 echo 740000 > /proc/sys/kernel/sched_little_cluster_coloc_fmin_khz
3746
3747 # configure governor settings for little cluster
3748 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
3749 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
3750 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
3751 echo 1248000 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
3752 echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
3753
3754 # configure governor settings for big cluster
3755 echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor
3756 echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us
3757 echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us
3758 echo 1324600 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq
3759 echo 652800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq
3760
3761 # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
3762 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
3763 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
3764 echo 85 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load
3765
3766 echo "0:1248000" > /sys/module/cpu_boost/parameters/input_boost_freq
3767 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
3768
3769 # Set Memory parameters
3770 configure_memory_parameters
3771
3772 # Enable bus-dcvs
3773 for device in /sys/devices/platform/soc
3774 do
3775 for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw
3776 do
3777 echo "bw_hwmon" > $cpubw/governor
3778 echo "2288 4577 7110 9155 12298 14236" > $cpubw/bw_hwmon/mbps_zones
3779 echo 4 > $cpubw/bw_hwmon/sample_ms
3780 echo 68 > $cpubw/bw_hwmon/io_percent
3781 echo 20 > $cpubw/bw_hwmon/hist_memory
3782 echo 0 > $cpubw/bw_hwmon/hyst_length
3783 echo 80 > $cpubw/bw_hwmon/down_thres
3784 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
3785 echo 250 > $cpubw/bw_hwmon/up_scale
3786 echo 1600 > $cpubw/bw_hwmon/idle_mbps
3787 echo 50 > $cpubw/polling_interval
3788 done
3789
3790 for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw
3791 do
3792 echo "bw_hwmon" > $llccbw/governor
3793 echo "1144 1720 2086 2929 3879 5931 6881" > $llccbw/bw_hwmon/mbps_zones
3794 echo 4 > $llccbw/bw_hwmon/sample_ms
3795 echo 68 > $llccbw/bw_hwmon/io_percent
3796 echo 20 > $llccbw/bw_hwmon/hist_memory
3797 echo 0 > $llccbw/bw_hwmon/hyst_length
3798 echo 80 > $llccbw/bw_hwmon/down_thres
3799 echo 0 > $llccbw/bw_hwmon/guard_band_mbps
3800 echo 250 > $llccbw/bw_hwmon/up_scale
3801 echo 1600 > $llccbw/bw_hwmon/idle_mbps
3802 echo 40 > $llccbw/polling_interval
3803 done
3804
3805 for npubw in $device/*npu-npu-ddr-bw/devfreq/*npu-npu-ddr-bw
3806 do
3807 echo 1 > /sys/devices/virtual/npu/msm_npu/pwr
3808 echo "bw_hwmon" > $npubw/governor
3809 echo "1144 1720 2086 2929 3879 5931 6881" > $npubw/bw_hwmon/mbps_zones
3810 echo 4 > $npubw/bw_hwmon/sample_ms
3811 echo 80 > $npubw/bw_hwmon/io_percent
3812 echo 20 > $npubw/bw_hwmon/hist_memory
3813 echo 10 > $npubw/bw_hwmon/hyst_length
3814 echo 30 > $npubw/bw_hwmon/down_thres
3815 echo 0 > $npubw/bw_hwmon/guard_band_mbps
3816 echo 250 > $npubw/bw_hwmon/up_scale
3817 echo 0 > $npubw/bw_hwmon/idle_mbps
3818 echo 40 > $npubw/polling_interval
3819 echo 0 > /sys/devices/virtual/npu/msm_npu/pwr
3820 done
3821 done
3822
3823 # memlat specific settings are moved to seperate file under
3824 # device/target specific folder
3825 setprop vendor.dcvs.prop 1
3826
3827 # cpuset parameters
3828 echo 0-5 > /dev/cpuset/background/cpus
3829 echo 0-5 > /dev/cpuset/system-background/cpus
3830
3831 # Turn off scheduler boost at the end
3832 echo 0 > /proc/sys/kernel/sched_boost
3833
3834 # Turn on sleep modes.
3835 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
3836 ;;
3837 esac
3838
3839 ;;
3840esac
3841
3842
3843case "$target" in
3844 "lito")
3845
3846 #Apply settings for lito
3847 if [ -f /sys/devices/soc0/soc_id ]; then
3848 soc_id=`cat /sys/devices/soc0/soc_id`
3849 fi
3850
3851 case "$soc_id" in
3852 "400" | "440" | "476" )
3853 # Core control parameters on silver
3854 echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred
3855 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
3856 echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
3857 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
3858 echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres
3859 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
3860
3861 # Disable Core control on gold, prime
3862 echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable
3863 echo 0 > /sys/devices/system/cpu/cpu7/core_ctl/enable
3864
3865 # Setting b.L scheduler parameters
3866 echo 65 85 > /proc/sys/kernel/sched_downmigrate
3867 echo 71 95 > /proc/sys/kernel/sched_upmigrate
3868 echo 85 > /proc/sys/kernel/sched_group_downmigrate
3869 echo 100 > /proc/sys/kernel/sched_group_upmigrate
3870 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
3871 echo 0 > /proc/sys/kernel/sched_coloc_busy_hyst_ns
3872 echo 0 > /proc/sys/kernel/sched_coloc_busy_hysteresis_enable_cpus
3873 echo 0 > /proc/sys/kernel/sched_coloc_busy_hyst_max_ms
3874
3875 # disable unfiltering
3876 echo 20000000 > /proc/sys/kernel/sched_task_unfilter_period
3877 echo 1 > /proc/sys/kernel/sched_task_unfilter_nr_windows
3878
3879 # configure governor settings for silver cluster
3880 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
3881 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us
3882 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
3883 echo 1228800 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
3884 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl
3885 echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
3886 echo 650000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq
3887
3888 # configure governor settings for gold cluster
3889 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
3890 echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/up_rate_limit_us
3891 echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/down_rate_limit_us
3892 echo 1228800 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq
3893 echo 85 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load
3894 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
3895 echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/pl
3896 echo 672000 > /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq
3897 echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/rtg_boost_freq
3898
3899 # configure governor settings for gold+ cluster
3900 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy7/scaling_governor
3901 echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/up_rate_limit_us
3902 echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/down_rate_limit_us
3903 echo 1228800 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq
3904 echo 85 > /sys/devices/system/cpu/cpu7/cpufreq/schedutil/hispeed_load
3905 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
3906 echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/pl
3907 echo 672000 > /sys/devices/system/cpu/cpufreq/policy7/scaling_min_freq
3908 echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/rtg_boost_freq
3909
3910 # colocation v3 settings
3911 echo 51 > /proc/sys/kernel/sched_min_task_util_for_boost
3912 echo 35 > /proc/sys/kernel/sched_min_task_util_for_colocation
3913
3914 # Enable conservative pl
3915 echo 1 > /proc/sys/kernel/sched_conservative_pl
3916
3917 echo "0:1228800" > /sys/devices/system/cpu/cpu_boost/input_boost_freq
3918 echo 120 > /sys/devices/system/cpu/cpu_boost/input_boost_ms
3919
3920 # Set Memory parameters
3921 configure_memory_parameters
3922
3923 if [ `cat /sys/devices/soc0/revision` == "2.0" ]; then
3924 # r2.0 related changes
3925 echo "0:1075200" > /sys/devices/system/cpu/cpu_boost/input_boost_freq
3926 echo 610000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq
3927 echo 1075200 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
3928 echo 1152000 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq
3929 echo 1401600 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq
3930 echo 614400 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
3931 echo 652800 > /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq
3932 echo 806400 > /sys/devices/system/cpu/cpufreq/policy7/scaling_min_freq
3933 echo 83 > /proc/sys/kernel/sched_asym_cap_sibling_freq_match_pct
3934 fi
3935
3936 # Enable bus-dcvs
3937 for device in /sys/devices/platform/soc
3938 do
3939 for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw
3940 do
3941 echo "bw_hwmon" > $cpubw/governor
3942 echo "2288 4577 7110 9155 12298 14236 16265" > $cpubw/bw_hwmon/mbps_zones
3943 echo 4 > $cpubw/bw_hwmon/sample_ms
3944 echo 68 > $cpubw/bw_hwmon/io_percent
3945 echo 20 > $cpubw/bw_hwmon/hist_memory
3946 echo 0 > $cpubw/bw_hwmon/hyst_length
3947 echo 80 > $cpubw/bw_hwmon/down_thres
3948 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
3949 echo 250 > $cpubw/bw_hwmon/up_scale
3950 echo 1600 > $cpubw/bw_hwmon/idle_mbps
3951 echo 50 > $cpubw/polling_interval
3952 done
3953
3954 for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw
3955 do
3956 echo "bw_hwmon" > $llccbw/governor
3957 echo "1144 1720 2086 2929 3879 5931 6881 7980" > $llccbw/bw_hwmon/mbps_zones
3958 echo 4 > $llccbw/bw_hwmon/sample_ms
3959 echo 68 > $llccbw/bw_hwmon/io_percent
3960 echo 20 > $llccbw/bw_hwmon/hist_memory
3961 echo 0 > $llccbw/bw_hwmon/hyst_length
3962 echo 80 > $llccbw/bw_hwmon/down_thres
3963 echo 0 > $llccbw/bw_hwmon/guard_band_mbps
3964 echo 250 > $llccbw/bw_hwmon/up_scale
3965 echo 1600 > $llccbw/bw_hwmon/idle_mbps
3966 echo 50 > $llccbw/polling_interval
3967 done
3968
3969 for npubw in $device/*npu*-ddr-bw/devfreq/*npu*-ddr-bw
3970 do
3971 echo 1 > /sys/devices/virtual/npu/msm_npu/pwr
3972 echo "bw_hwmon" > $npubw/governor
3973 echo "1144 1720 2086 2929 3879 5931 6881 7980" > $npubw/bw_hwmon/mbps_zones
3974 echo 4 > $npubw/bw_hwmon/sample_ms
3975 echo 80 > $npubw/bw_hwmon/io_percent
3976 echo 20 > $npubw/bw_hwmon/hist_memory
3977 echo 10 > $npubw/bw_hwmon/hyst_length
3978 echo 30 > $npubw/bw_hwmon/down_thres
3979 echo 0 > $npubw/bw_hwmon/guard_band_mbps
3980 echo 250 > $npubw/bw_hwmon/up_scale
3981 echo 0 > $npubw/bw_hwmon/idle_mbps
3982 echo 40 > $npubw/polling_interval
3983 echo 0 > /sys/devices/virtual/npu/msm_npu/pwr
3984 done
3985
3986 for npullccbw in $device/*npu*-llcc-bw/devfreq/*npu*-llcc-bw
3987 do
3988 echo 1 > /sys/devices/virtual/npu/msm_npu/pwr
3989 echo "bw_hwmon" > $npullccbw/governor
3990 echo "2288 4577 7110 9155 12298 14236 16265" > $npullccbw/bw_hwmon/mbps_zones
3991 echo 4 > $npullccbw/bw_hwmon/sample_ms
3992 echo 100 > $npullccbw/bw_hwmon/io_percent
3993 echo 20 > $npullccbw/bw_hwmon/hist_memory
3994 echo 10 > $npullccbw/bw_hwmon/hyst_length
3995 echo 30 > $npullccbw/bw_hwmon/down_thres
3996 echo 0 > $npullccbw/bw_hwmon/guard_band_mbps
3997 echo 250 > $npullccbw/bw_hwmon/up_scale
3998 echo 40 > $npullccbw/polling_interval
3999 echo 0 > /sys/devices/virtual/npu/msm_npu/pwr
4000 done
4001 done
4002 # memlat specific settings are moved to seperate file under
4003 # device/target specific folder
4004 setprop vendor.dcvs.prop 0
4005 setprop vendor.dcvs.prop 1
4006
4007 # cpuset parameters
4008 echo 0-5 > /dev/cpuset/background/cpus
4009 echo 0-5 > /dev/cpuset/system-background/cpus
4010
4011 # Turn off scheduler boost at the end
4012 echo 0 > /proc/sys/kernel/sched_boost
4013
4014 # Turn on sleep modes
4015 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
4016 ;;
4017 esac
4018
4019 #Apply settings for lagoon
4020 case "$soc_id" in
4021 "434" | "459" )
4022
4023 # Core control parameters on silver
4024 echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred
4025 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
4026 echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
4027 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
4028 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
4029 echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres
4030
4031 # Disable Core control on gold
4032 echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable
4033
4034
4035 # disable unfiltering
4036 echo 20000000 > /proc/sys/kernel/sched_task_unfilter_period
4037
4038 # Setting b.L scheduler parameters
4039 # default sched up and down migrate values are 95 and 85
4040 echo 65 > /proc/sys/kernel/sched_downmigrate
4041 echo 71 > /proc/sys/kernel/sched_upmigrate
4042
4043 # default sched up and down migrate values are 100 and 95
4044 echo 85 > /proc/sys/kernel/sched_group_downmigrate
4045 echo 100 > /proc/sys/kernel/sched_group_upmigrate
4046 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
4047 echo 0 > /proc/sys/kernel/sched_coloc_busy_hyst_ns
4048 echo 0 > /proc/sys/kernel/sched_coloc_busy_hysteresis_enable_cpus
4049 echo 0 > /proc/sys/kernel/sched_coloc_busy_hyst_max_ms
4050
4051 # configure governor settings for little cluster
4052 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
4053 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
4054 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
4055 echo 1248000 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
4056 echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
4057
4058 # configure governor settings for big cluster
4059 echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor
4060 echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us
4061 echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us
4062 echo 1248000 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq
4063 echo 652800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq
4064
4065 #colocation v3 settings
4066 echo 740000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq
4067 echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/rtg_boost_freq
4068 echo 51 > /proc/sys/kernel/sched_min_task_util_for_boost
4069
4070 # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
4071 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
4072 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
4073 echo 85 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load
4074
4075 # Enable conservative pl
4076 echo 1 > /proc/sys/kernel/sched_conservative_pl
4077
4078 echo "0:1248000" > /sys/devices/system/cpu/cpu_boost/input_boost_freq
4079 echo 120 > /sys/devices/system/cpu/cpu_boost/input_boost_ms
4080
4081 # Set Memory parameters
4082 configure_memory_parameters
4083
4084 # Enable bus-dcvs
4085 for device in /sys/devices/platform/soc
4086 do
4087 for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw
4088 do
4089 echo "bw_hwmon" > $cpubw/governor
4090 echo "2288 4577 7110 9155 12298 14236" > $cpubw/bw_hwmon/mbps_zones
4091 echo 4 > $cpubw/bw_hwmon/sample_ms
4092 echo 68 > $cpubw/bw_hwmon/io_percent
4093 echo 20 > $cpubw/bw_hwmon/hist_memory
4094 echo 0 > $cpubw/bw_hwmon/hyst_length
4095 echo 80 > $cpubw/bw_hwmon/down_thres
4096 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
4097 echo 250 > $cpubw/bw_hwmon/up_scale
4098 echo 1600 > $cpubw/bw_hwmon/idle_mbps
4099 echo 50 > $cpubw/polling_interval
4100 done
4101
4102 for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw
4103 do
4104 echo "bw_hwmon" > $llccbw/governor
4105 echo "1144 1720 2086 2929 3879 5931 6881 8137" > $llccbw/bw_hwmon/mbps_zones
4106 echo 4 > $llccbw/bw_hwmon/sample_ms
4107 echo 68 > $llccbw/bw_hwmon/io_percent
4108 echo 20 > $llccbw/bw_hwmon/hist_memory
4109 echo 0 > $llccbw/bw_hwmon/hyst_length
4110 echo 80 > $llccbw/bw_hwmon/down_thres
4111 echo 0 > $llccbw/bw_hwmon/guard_band_mbps
4112 echo 250 > $llccbw/bw_hwmon/up_scale
4113 echo 1600 > $llccbw/bw_hwmon/idle_mbps
4114 echo 40 > $llccbw/polling_interval
4115 done
4116
4117 for npubw in $device/*npu*-ddr-bw/devfreq/*npu*-ddr-bw
4118 do
4119 echo 1 > /sys/devices/virtual/npu/msm_npu/pwr
4120 echo "bw_hwmon" > $npubw/governor
4121 echo "1144 1720 2086 2929 3879 5931 6881 7980" > $npubw/bw_hwmon/mbps_zones
4122 echo 4 > $npubw/bw_hwmon/sample_ms
4123 echo 80 > $npubw/bw_hwmon/io_percent
4124 echo 20 > $npubw/bw_hwmon/hist_memory
4125 echo 10 > $npubw/bw_hwmon/hyst_length
4126 echo 30 > $npubw/bw_hwmon/down_thres
4127 echo 0 > $npubw/bw_hwmon/guard_band_mbps
4128 echo 250 > $npubw/bw_hwmon/up_scale
4129 echo 0 > $npubw/bw_hwmon/idle_mbps
4130 echo 40 > $npubw/polling_interval
4131 echo 0 > /sys/devices/virtual/npu/msm_npu/pwr
4132 done
4133
4134 for npullccbw in $device/*npu*-llcc-bw/devfreq/*npu*-llcc-bw
4135 do
4136 echo 1 > /sys/devices/virtual/npu/msm_npu/pwr
4137 echo "bw_hwmon" > $npullccbw/governor
4138 echo "2288 4577 7110 9155 12298 14236 16265" > $npullccbw/bw_hwmon/mbps_zones
4139 echo 4 > $npullccbw/bw_hwmon/sample_ms
4140 echo 100 > $npullccbw/bw_hwmon/io_percent
4141 echo 20 > $npullccbw/bw_hwmon/hist_memory
4142 echo 10 > $npullccbw/bw_hwmon/hyst_length
4143 echo 30 > $npullccbw/bw_hwmon/down_thres
4144 echo 0 > $npullccbw/bw_hwmon/guard_band_mbps
4145 echo 250 > $npullccbw/bw_hwmon/up_scale
4146 echo 40 > $npullccbw/polling_interval
4147 echo 0 > /sys/devices/virtual/npu/msm_npu/pwr
4148 done
4149 done
4150 # memlat specific settings are moved to seperate file under
4151 # device/target specific folder
4152 setprop vendor.dcvs.prop 1
4153
4154 # cpuset parameters
4155 echo 0-5 > /dev/cpuset/background/cpus
4156 echo 0-5 > /dev/cpuset/system-background/cpus
4157
4158 # Turn off scheduler boost at the end
4159 echo 0 > /proc/sys/kernel/sched_boost
4160
4161 # Turn off sleep modes
4162 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
4163 ;;
4164 esac
4165esac
4166
4167case "$target" in
4168 "bengal")
4169
4170 if [ -f /sys/devices/soc0/soc_id ]; then
4171 soc_id=`cat /sys/devices/soc0/soc_id`
4172 else
4173 soc_id=`cat /sys/devices/system/soc/soc0/id`
4174 fi
4175
4176 case "$soc_id" in
4177 "417" | "420" | "444" | "445" | "469" | "470" )
4178
4179 # Core control is temporarily disabled till bring up
4180 echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable
4181 echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
4182 # Core control parameters on big
4183 echo 40 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres
4184 echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres
4185 echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms
4186 echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres
4187
4188 # Setting b.L scheduler parameters
4189 echo 67 > /proc/sys/kernel/sched_downmigrate
4190 echo 77 > /proc/sys/kernel/sched_upmigrate
4191 echo 85 > /proc/sys/kernel/sched_group_downmigrate
4192 echo 100 > /proc/sys/kernel/sched_group_upmigrate
4193
4194 # cpuset settings
4195 echo 0-3 > /dev/cpuset/background/cpus
4196 echo 0-3 > /dev/cpuset/system-background/cpus
4197
4198
4199 # configure governor settings for little cluster
4200 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
4201 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
4202 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
4203 echo 1305600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
4204 echo 614400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
4205 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rtg_boost_freq
4206
4207 # configure governor settings for big cluster
4208 echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
4209 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/up_rate_limit_us
4210 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_rate_limit_us
4211 echo 1401600 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq
4212 echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
4213 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/rtg_boost_freq
4214
4215 echo "0:1017600" > /sys/devices/system/cpu/cpu_boost/input_boost_freq
4216 echo 80 > /sys/devices/system/cpu/cpu_boost/input_boost_ms
4217
4218 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
4219
4220 # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
4221 echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost
4222 echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost
4223 echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost
4224 echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost
4225 echo -6 > /sys/devices/system/cpu/cpu4/sched_load_boost
4226 echo -6 > /sys/devices/system/cpu/cpu5/sched_load_boost
4227 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
4228 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
4229 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load
4230 echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_load
4231
4232 # Set Memory parameters
4233 configure_memory_parameters
4234
4235 # Enable bus-dcvs
4236 ddr_type=`od -An -tx /proc/device-tree/memory/ddr_device_type`
4237 ddr_type4="07"
4238 ddr_type3="05"
4239
4240 for device in /sys/devices/platform/soc
4241 do
4242 for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw
4243 do
4244 echo "bw_hwmon" > $cpubw/governor
4245 echo 50 > $cpubw/polling_interval
4246 echo 762 > $cpubw/min_freq
4247 if [ ${ddr_type:4:2} == $ddr_type4 ]; then
4248 # LPDDR4
4249 echo "2288 3440 4173 5195 5859 7759 10322 11863 13763" > $cpubw/bw_hwmon/mbps_zones
4250 echo 85 > $cpubw/bw_hwmon/io_percent
4251 fi
4252 if [ ${ddr_type:4:2} == $ddr_type3 ]; then
4253 # LPDDR3
4254 echo "1525 3440 5195 5859 7102" > $cpubw/bw_hwmon/mbps_zones
4255 echo 34 > $cpubw/bw_hwmon/io_percent
4256 fi
4257 echo 4 > $cpubw/bw_hwmon/sample_ms
4258 echo 90 > $cpubw/bw_hwmon/decay_rate
4259 echo 190 > $cpubw/bw_hwmon/bw_step
4260 echo 20 > $cpubw/bw_hwmon/hist_memory
4261 echo 0 > $cpubw/bw_hwmon/hyst_length
4262 echo 80 > $cpubw/bw_hwmon/down_thres
4263 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
4264 echo 250 > $cpubw/bw_hwmon/up_scale
4265 echo 1600 > $cpubw/bw_hwmon/idle_mbps
4266 done
4267
4268 done
4269 # memlat specific settings are moved to seperate file under
4270 # device/target specific folder
4271 setprop vendor.dcvs.prop 1
4272
4273 # colcoation v3 disabled
4274 echo 0 > /proc/sys/kernel/sched_min_task_util_for_boost
4275 echo 0 > /proc/sys/kernel/sched_min_task_util_for_colocation
4276
4277 # Turn off scheduler boost at the end
4278 echo 0 > /proc/sys/kernel/sched_boost
4279
4280 # Turn on sleep modes
4281 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
4282
4283 ;;
4284 esac
4285
Rohit R Sekharadf49712022-11-17 21:05:16 +05304286 #power/perf tunings for khaje
4287 case "$soc_id" in
Michael Bestasc3ad1cd2023-10-03 15:27:40 +03004288 "518" | "561" | "585" | "586" )
Rohit R Sekharadf49712022-11-17 21:05:16 +05304289
4290 # Core control parameters on big
4291 echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable
4292 echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
4293 echo 40 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres
4294 echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres
4295 echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms
4296 echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres
4297
4298 # Setting b.L scheduler parameters
4299 echo 65 > /proc/sys/kernel/sched_downmigrate
4300 echo 71 > /proc/sys/kernel/sched_upmigrate
4301 echo 85 > /proc/sys/kernel/sched_group_downmigrate
4302 echo 100 > /proc/sys/kernel/sched_group_upmigrate
4303
4304 # cpuset settings
4305 echo 0-3 > /dev/cpuset/background/cpus
4306 echo 0-3 > /dev/cpuset/system-background/cpus
4307
4308
4309 # configure governor settings for little cluster
4310 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
4311 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
4312 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
4313 echo 1516800 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
4314 echo 691200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
4315 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rtg_boost_freq
4316
4317 # configure governor settings for big cluster
4318 echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
4319 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/up_rate_limit_us
4320 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_rate_limit_us
4321 echo 1344000 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq
4322 echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
4323 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/rtg_boost_freq
4324
4325 echo "0:1190000" > /sys/devices/system/cpu/cpu_boost/input_boost_freq
4326 echo 80 > /sys/devices/system/cpu/cpu_boost/input_boost_ms
4327
4328 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
4329
4330 # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
4331 echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost
4332 echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost
4333 echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost
4334 echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost
4335 echo -6 > /sys/devices/system/cpu/cpu4/sched_load_boost
4336 echo -6 > /sys/devices/system/cpu/cpu5/sched_load_boost
4337 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
4338 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
4339 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load
4340 echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_load
4341
4342 # Set Memory parameters
4343 configure_memory_parameters
4344
4345 # Enable bus-dcvs
4346
4347 for device in /sys/devices/platform/soc
4348 do
4349 for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw
4350 do
4351 echo "bw_hwmon" > $cpubw/governor
4352 echo 50 > $cpubw/polling_interval
4353 echo 762 > $cpubw/min_freq
4354 echo "2288 3440 4173 5195 5859 7759 10322 11863 13763 15960" > $cpubw/bw_hwmon/mbps_zones
4355 echo 85 > $cpubw/bw_hwmon/io_percent
4356 echo 4 > $cpubw/bw_hwmon/sample_ms
4357 echo 90 > $cpubw/bw_hwmon/decay_rate
4358 echo 190 > $cpubw/bw_hwmon/bw_step
4359 echo 20 > $cpubw/bw_hwmon/hist_memory
4360 echo 0 > $cpubw/bw_hwmon/hyst_length
4361 echo 80 > $cpubw/bw_hwmon/down_thres
4362 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
4363 echo 250 > $cpubw/bw_hwmon/up_scale
4364 echo 1600 > $cpubw/bw_hwmon/idle_mbps
4365 done
4366
4367 done
4368 # memlat specific settings are moved to seperate file under
4369 # device/target specific folder
4370 setprop vendor.dcvs.prop 1
4371
4372 # colcoation v3 disabled
4373 echo 0 > /proc/sys/kernel/sched_min_task_util_for_boost
4374 echo 0 > /proc/sys/kernel/sched_min_task_util_for_colocation
4375
4376 # Turn off scheduler boost at the end
4377 echo 0 > /proc/sys/kernel/sched_boost
4378
4379 echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-gdhs/idle_enabled
4380 echo N > /sys/module/lpm_levels/system/perf/perf-l2-gdhs/idle_enabled
4381 echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-gdhs/suspend_enabled
4382 echo N > /sys/module/lpm_levels/system/perf/perf-l2-gdhs/suspend_enabled
4383 # Turn on sleep modes
4384 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
4385
4386 ;;
4387 esac
4388
merothh32be6882022-01-03 01:54:57 +05304389 # Scuba perf/power tunings
4390 case "$soc_id" in
4391 "441" | "471" | "473" | "474" )
4392
4393 # Quad-core device. disable core_ctl
4394 echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable
4395
4396 # Configure schedutil governor settings
4397 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
4398 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
4399 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
4400 echo 1305600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
4401 echo 614400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
4402 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rtg_boost_freq
4403
4404 # sched_load_boost as -6 is equivalent to target load as 85.
4405 echo 0 > /proc/sys/kernel/sched_boost
4406 echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost
4407 echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost
4408 echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost
4409 echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost
4410 echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load
4411
4412 # Set Memory parameters
4413 configure_memory_parameters
4414
4415 # Enable bus-dcvs
4416 ddr_type=`od -An -tx /proc/device-tree/memory/ddr_device_type`
4417 ddr_type4="07"
4418 ddr_type3="05"
4419
4420 for device in /sys/devices/platform/soc
4421 do
4422 for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw
4423 do
4424 echo "bw_hwmon" > $cpubw/governor
4425 echo 50 > $cpubw/polling_interval
4426 echo 762 > $cpubw/min_freq
4427 if [ ${ddr_type:4:2} == $ddr_type4 ]; then
4428 # LPDDR4
4429 echo "2288 3440 4173 5195 5859 7759 10322 11863 13763" > $cpubw/bw_hwmon/mbps_zones
4430 echo 85 > $cpubw/bw_hwmon/io_percent
4431 fi
4432 if [ ${ddr_type:4:2} == $ddr_type3 ]; then
4433 # LPDDR3
4434 echo "1525 3440 5195 5859 7102" > $cpubw/bw_hwmon/mbps_zones
4435 echo 34 > $cpubw/bw_hwmon/io_percent
4436 fi
4437 echo 4 > $cpubw/bw_hwmon/sample_ms
4438 echo 90 > $cpubw/bw_hwmon/decay_rate
4439 echo 190 > $cpubw/bw_hwmon/bw_step
4440 echo 20 > $cpubw/bw_hwmon/hist_memory
4441 echo 0 > $cpubw/bw_hwmon/hyst_length
4442 echo 80 > $cpubw/bw_hwmon/down_thres
4443 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
4444 echo 250 > $cpubw/bw_hwmon/up_scale
4445 echo 1600 > $cpubw/bw_hwmon/idle_mbps
4446 done
4447
4448 # memlat specific settings are moved to seperate file under
4449 # device/target specific folder
4450 setprop vendor.dcvs.prop 1
4451
4452 done
4453
4454 # Disable low power modes. Enable it after LPM stable
4455 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
4456 ;;
4457 esac
4458
4459 ;;
4460esac
4461
4462
4463#Apply settings for atoll
4464case "$target" in
4465 "atoll")
4466
4467 # Core control parameters on silver
4468 echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred
4469 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
4470 echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
4471 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
4472 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
4473 echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres
4474 echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable
4475
4476 # Setting b.L scheduler parameters
4477 # default sched up and down migrate values are 95 and 85
4478 echo 65 > /proc/sys/kernel/sched_downmigrate
4479 echo 71 > /proc/sys/kernel/sched_upmigrate
4480 # default sched up and down migrate values are 100 and 95
4481 echo 85 > /proc/sys/kernel/sched_group_downmigrate
4482 echo 100 > /proc/sys/kernel/sched_group_upmigrate
4483 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
4484
4485 #colocation v3 settings
4486 echo 740000 > /proc/sys/kernel/sched_little_cluster_coloc_fmin_khz
4487
4488 # configure governor settings for little cluster
4489 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
4490 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
4491 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
4492 echo 1248000 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
4493 echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
4494
4495 # configure governor settings for big cluster
4496 echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor
4497 echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us
4498 echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us
4499 echo 1267200 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq
4500 echo 652800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq
4501
4502 # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable.
4503 echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost
4504 echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost
4505 echo 85 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load
4506
4507 echo "0:1248000" > /sys/module/cpu_boost/parameters/input_boost_freq
4508 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
4509
4510 # Set Memory parameters
4511 configure_memory_parameters
4512
4513 # Enable bus-dcvs
4514 for device in /sys/devices/platform/soc
4515 do
4516 for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw
4517 do
4518 echo "bw_hwmon" > $cpubw/governor
4519 echo "2288 4577 7110 9155 12298 14236" > $cpubw/bw_hwmon/mbps_zones
4520 echo 4 > $cpubw/bw_hwmon/sample_ms
4521 echo 68 > $cpubw/bw_hwmon/io_percent
4522 echo 20 > $cpubw/bw_hwmon/hist_memory
4523 echo 0 > $cpubw/bw_hwmon/hyst_length
4524 echo 80 > $cpubw/bw_hwmon/down_thres
4525 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
4526 echo 250 > $cpubw/bw_hwmon/up_scale
4527 echo 1600 > $cpubw/bw_hwmon/idle_mbps
4528 echo 50 > $cpubw/polling_interval
4529 done
4530
4531 for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw
4532 do
4533 echo "bw_hwmon" > $llccbw/governor
4534 echo "1144 1720 2086 2929 3879 5931 6881 8137" > $llccbw/bw_hwmon/mbps_zones
4535 echo 4 > $llccbw/bw_hwmon/sample_ms
4536 echo 68 > $llccbw/bw_hwmon/io_percent
4537 echo 20 > $llccbw/bw_hwmon/hist_memory
4538 echo 0 > $llccbw/bw_hwmon/hyst_length
4539 echo 80 > $llccbw/bw_hwmon/down_thres
4540 echo 0 > $llccbw/bw_hwmon/guard_band_mbps
4541 echo 250 > $llccbw/bw_hwmon/up_scale
4542 echo 1600 > $llccbw/bw_hwmon/idle_mbps
4543 echo 40 > $llccbw/polling_interval
4544 done
4545
4546 for npubw in $device/*npu*-npu-ddr-bw/devfreq/*npu*-npu-ddr-bw
4547 do
4548 echo 1 > /sys/devices/virtual/npu/msm_npu/pwr
4549 echo "bw_hwmon" > $npubw/governor
4550 echo "1144 1720 2086 2929 3879 5931 6881 8137" > $npubw/bw_hwmon/mbps_zones
4551 echo 4 > $npubw/bw_hwmon/sample_ms
4552 echo 80 > $npubw/bw_hwmon/io_percent
4553 echo 20 > $npubw/bw_hwmon/hist_memory
4554 echo 10 > $npubw/bw_hwmon/hyst_length
4555 echo 30 > $npubw/bw_hwmon/down_thres
4556 echo 0 > $npubw/bw_hwmon/guard_band_mbps
4557 echo 250 > $npubw/bw_hwmon/up_scale
4558 echo 0 > $npubw/bw_hwmon/idle_mbps
4559 echo 40 > $npubw/polling_interval
4560 echo 0 > /sys/devices/virtual/npu/msm_npu/pwr
4561 done
4562
4563 done
4564
4565 # memlat specific settings are moved to seperate file under
4566 # device/target specific folder
4567 setprop vendor.dcvs.prop 1
4568
4569 # cpuset parameters
4570 echo 0-5 > /dev/cpuset/background/cpus
4571 echo 0-5 > /dev/cpuset/system-background/cpus
4572
4573 # Turn off scheduler boost at the end
4574 echo 0 > /proc/sys/kernel/sched_boost
4575
4576 # Turn on sleep modes
4577 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
4578 ;;
4579esac
4580
4581
4582case "$target" in
4583 "qcs605")
4584
4585 #Apply settings for qcs605
4586 # Set the default IRQ affinity to the silver cluster. When a
4587 # CPU is isolated/hotplugged, the IRQ affinity is adjusted
4588 # to one of the CPU from the default IRQ affinity mask.
4589 echo 3f > /proc/irq/default_smp_affinity
4590
4591 if [ -f /sys/devices/soc0/soc_id ]; then
4592 soc_id=`cat /sys/devices/soc0/soc_id`
4593 else
4594 soc_id=`cat /sys/devices/system/soc/soc0/id`
4595 fi
4596
4597 if [ -f /sys/devices/soc0/hw_platform ]; then
4598 hw_platform=`cat /sys/devices/soc0/hw_platform`
4599 else
4600 hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
4601 fi
4602
4603 if [ -f /sys/devices/soc0/platform_subtype_id ]; then
4604 platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
4605 fi
4606
4607 case "$soc_id" in
4608 "347" )
4609
4610 # Start Host based Touch processing
4611 case "$hw_platform" in
4612 "Surf" | "RCM" | "QRD" )
4613 start_hbtp
4614 ;;
4615 "MTP" )
4616 if [ $platform_subtype_id != 5 ]; then
4617 start_hbtp
4618 fi
4619 ;;
4620 esac
4621
4622 # Core control parameters on silver
4623 echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
4624 echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
4625 echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
4626 echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
4627 echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster
4628 echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres
4629
4630 # Setting b.L scheduler parameters
4631 echo 96 > /proc/sys/kernel/sched_upmigrate
4632 echo 90 > /proc/sys/kernel/sched_downmigrate
4633 echo 140 > /proc/sys/kernel/sched_group_upmigrate
4634 echo 120 > /proc/sys/kernel/sched_group_downmigrate
4635
4636 # configure governor settings for little cluster
4637 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
4638 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us
4639 echo 1209600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
4640 echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
4641
4642 # configure governor settings for big cluster
4643 echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor
4644 echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/rate_limit_us
4645 echo 1344000 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq
4646 echo 825600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq
4647
4648 echo "0:1209600" > /sys/module/cpu_boost/parameters/input_boost_freq
4649 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
4650
4651 # Enable bus-dcvs
4652 for cpubw in /sys/class/devfreq/*qcom,cpubw*
4653 do
4654 echo "bw_hwmon" > $cpubw/governor
4655 echo 50 > $cpubw/polling_interval
4656 echo "1144 1720 2086 2929 3879 5931 6881" > $cpubw/bw_hwmon/mbps_zones
4657 echo 4 > $cpubw/bw_hwmon/sample_ms
4658 echo 68 > $cpubw/bw_hwmon/io_percent
4659 echo 20 > $cpubw/bw_hwmon/hist_memory
4660 echo 0 > $cpubw/bw_hwmon/hyst_length
4661 echo 80 > $cpubw/bw_hwmon/down_thres
4662 echo 0 > $cpubw/bw_hwmon/low_power_ceil_mbps
4663 echo 68 > $cpubw/bw_hwmon/low_power_io_percent
4664 echo 20 > $cpubw/bw_hwmon/low_power_delay
4665 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
4666 echo 250 > $cpubw/bw_hwmon/up_scale
4667 echo 1600 > $cpubw/bw_hwmon/idle_mbps
4668 done
4669
4670 #Enable mem_latency governor for DDR scaling
4671 for memlat in /sys/class/devfreq/*qcom,memlat-cpu*
4672 do
4673 echo "mem_latency" > $memlat/governor
4674 echo 10 > $memlat/polling_interval
4675 echo 400 > $memlat/mem_latency/ratio_ceil
4676 done
4677
4678 #Enable mem_latency governor for L3 scaling
4679 for memlat in /sys/class/devfreq/*qcom,l3-cpu*
4680 do
4681 echo "mem_latency" > $memlat/governor
4682 echo 10 > $memlat/polling_interval
4683 echo 400 > $memlat/mem_latency/ratio_ceil
4684 done
4685
4686 echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor
4687
4688 # cpuset parameters
4689 echo 0-5 > /dev/cpuset/background/cpus
4690 echo 0-5 > /dev/cpuset/system-background/cpus
4691
4692 # Turn off scheduler boost at the end
4693 echo 0 > /proc/sys/kernel/sched_boost
4694
4695 # Turn on sleep modes.
4696 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
4697 echo 100 > /proc/sys/vm/swappiness
4698 ;;
4699 esac
4700 ;;
4701esac
4702
4703case "$target" in
4704 "apq8084")
4705 echo 4 > /sys/module/lpm_levels/enable_low_power/l2
4706 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
4707 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
4708 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
4709 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
4710 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
4711 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
4712 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
4713 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
4714 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
4715 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
4716 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
4717 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
4718 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
4719 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
4720 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
4721 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
4722 echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled
4723 echo 1 > /sys/module/msm_pm/modes/cpu1/retention/idle_enabled
4724 echo 1 > /sys/module/msm_pm/modes/cpu2/retention/idle_enabled
4725 echo 1 > /sys/module/msm_pm/modes/cpu3/retention/idle_enabled
4726 echo 0 > /sys/module/msm_thermal/core_control/enabled
4727 echo 1 > /sys/devices/system/cpu/cpu1/online
4728 echo 1 > /sys/devices/system/cpu/cpu2/online
4729 echo 1 > /sys/devices/system/cpu/cpu3/online
4730 for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
4731 do
4732 echo "cpubw_hwmon" > $devfreq_gov
4733 done
4734 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
4735 echo "interactive" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
4736 echo "interactive" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
4737 echo "interactive" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
4738 echo "20000 1400000:40000 1700000:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
4739 echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
4740 echo 1497600 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
4741 echo "85 1500000:90 1800000:70" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
4742 echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
4743 echo 20 > /sys/module/cpu_boost/parameters/boost_ms
4744 echo 1728000 > /sys/module/cpu_boost/parameters/sync_threshold
4745 echo 100000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
4746 echo 1497600 > /sys/module/cpu_boost/parameters/input_boost_freq
4747 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
4748 echo 1 > /dev/cpuctl/apps/cpu.notify_on_migrate
4749 echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
4750 echo 300000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
4751 echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
4752 echo 300000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
4753 echo 1 > /sys/module/msm_thermal/core_control/enabled
4754 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
4755 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
4756 chown -h root.system /sys/devices/system/cpu/mfreq
4757 chmod -h 220 /sys/devices/system/cpu/mfreq
4758 chown -h root.system /sys/devices/system/cpu/cpu1/online
4759 chown -h root.system /sys/devices/system/cpu/cpu2/online
4760 chown -h root.system /sys/devices/system/cpu/cpu3/online
4761 chmod -h 664 /sys/devices/system/cpu/cpu1/online
4762 chmod -h 664 /sys/devices/system/cpu/cpu2/online
4763 chmod -h 664 /sys/devices/system/cpu/cpu3/online
4764 ;;
4765esac
4766
4767case "$target" in
4768 "mpq8092")
4769 echo 4 > /sys/module/lpm_levels/enable_low_power/l2
4770 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
4771 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
4772 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
4773 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
4774 echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
4775 echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
4776 echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
4777 echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
4778 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
4779 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
4780 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
4781 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
4782 echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
4783 echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
4784 echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
4785 echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
4786 echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled
4787 echo 1 > /sys/module/msm_pm/modes/cpu1/retention/idle_enabled
4788 echo 1 > /sys/module/msm_pm/modes/cpu2/retention/idle_enabled
4789 echo 1 > /sys/module/msm_pm/modes/cpu3/retention/idle_enabled
4790 echo 0 > /sys/module/msm_thermal/core_control/enabled
4791 echo 1 > /sys/devices/system/cpu/cpu1/online
4792 echo 1 > /sys/devices/system/cpu/cpu2/online
4793 echo 1 > /sys/devices/system/cpu/cpu3/online
4794 echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
4795 echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
4796 echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
4797 echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
4798 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
4799 echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
4800 echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
4801 echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
4802 echo 300000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
4803 echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
4804 echo 300000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
4805 echo 1 > /sys/module/msm_thermal/core_control/enabled
4806 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
4807 chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
4808 chown -h root.system /sys/devices/system/cpu/mfreq
4809 chmod -h 220 /sys/devices/system/cpu/mfreq
4810 chown -h root.system /sys/devices/system/cpu/cpu1/online
4811 chown -h root.system /sys/devices/system/cpu/cpu2/online
4812 chown -h root.system /sys/devices/system/cpu/cpu3/online
4813 chmod -h 664 /sys/devices/system/cpu/cpu1/online
4814 chmod -h 664 /sys/devices/system/cpu/cpu2/online
4815 chmod -h 664 /sys/devices/system/cpu/cpu3/online
4816 ;;
4817esac
4818
4819case "$target" in
4820 "msm8992")
4821 # disable thermal bcl hotplug to switch governor
4822 echo 0 > /sys/module/msm_thermal/core_control/enabled
4823 echo -n disable > /sys/devices/soc.*/qcom,bcl.*/mode
4824 bcl_hotplug_mask=`cat /sys/devices/soc.*/qcom,bcl.*/hotplug_mask`
4825 echo 0 > /sys/devices/soc.*/qcom,bcl.*/hotplug_mask
4826 echo -n enable > /sys/devices/soc.*/qcom,bcl.*/mode
4827 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
4828 # configure governor settings for little cluster
4829 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
4830 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
4831 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
4832 echo 19000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
4833 echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
4834 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
4835 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
4836 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
4837 echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
4838 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
4839 echo 80000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis
4840 echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
4841 # online CPU4
4842 echo 1 > /sys/devices/system/cpu/cpu4/online
4843 # configure governor settings for big cluster
4844 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
4845 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
4846 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
4847 echo 19000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
4848 echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
4849 echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
4850 echo 1536000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
4851 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
4852 echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
4853 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
4854 echo 80000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis
4855 echo 384000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
4856 # re-enable thermal and BCL hotplug
4857 echo 1 > /sys/module/msm_thermal/core_control/enabled
4858 echo -n disable > /sys/devices/soc.*/qcom,bcl.*/mode
4859 echo $bcl_hotplug_mask > /sys/devices/soc.*/qcom,bcl.*/hotplug_mask
4860 echo $bcl_soc_hotplug_mask > /sys/devices/soc.*/qcom,bcl.*/hotplug_soc_mask
4861 echo -n enable > /sys/devices/soc.*/qcom,bcl.*/mode
4862 # plugin remaining A57s
4863 echo 1 > /sys/devices/system/cpu/cpu5/online
4864 # input boost configuration
4865 echo 0:1248000 > /sys/module/cpu_boost/parameters/input_boost_freq
4866 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
4867 # Enable task migration fixups in the scheduler
4868 echo 1 > /proc/sys/kernel/sched_migration_fixup
4869 for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
4870 do
4871 echo "bw_hwmon" > $devfreq_gov
4872 done
4873 #enable rps static configuration
4874 echo 8 > /sys/class/net/rmnet_ipa0/queues/rx-0/rps_cpus
4875 echo 30 > /proc/sys/kernel/sched_small_task
4876 ;;
4877esac
4878
4879case "$target" in
4880 "msm8994")
4881 # ensure at most one A57 is online when thermal hotplug is disabled
4882 echo 0 > /sys/devices/system/cpu/cpu5/online
4883 echo 0 > /sys/devices/system/cpu/cpu6/online
4884 echo 0 > /sys/devices/system/cpu/cpu7/online
4885 # in case CPU4 is online, limit its frequency
4886 echo 960000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
4887 # Limit A57 max freq from msm_perf module in case CPU 4 is offline
4888 echo "4:960000 5:960000 6:960000 7:960000" > /sys/module/msm_performance/parameters/cpu_max_freq
4889 # disable thermal bcl hotplug to switch governor
4890 echo 0 > /sys/module/msm_thermal/core_control/enabled
4891 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
4892 do
4893 echo -n disable > $mode
4894 done
4895 for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask
4896 do
4897 bcl_hotplug_mask=`cat $hotplug_mask`
4898 echo 0 > $hotplug_mask
4899 done
4900 for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask
4901 do
4902 bcl_soc_hotplug_mask=`cat $hotplug_soc_mask`
4903 echo 0 > $hotplug_soc_mask
4904 done
4905 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
4906 do
4907 echo -n enable > $mode
4908 done
4909 # configure governor settings for little cluster
4910 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
4911 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
4912 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
4913 echo 19000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
4914 echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
4915 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
4916 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
4917 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
4918 echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
4919 echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
4920 echo 80000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis
4921 echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
4922 # online CPU4
4923 echo 1 > /sys/devices/system/cpu/cpu4/online
4924 # Best effort limiting for first time boot if msm_performance module is absent
4925 echo 960000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
4926 # configure governor settings for big cluster
4927 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
4928 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
4929 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
4930 echo "19000 1400000:39000 1700000:19000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
4931 echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
4932 echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
4933 echo 1248000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
4934 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
4935 echo "85 1500000:90 1800000:70" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
4936 echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
4937 echo 80000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis
4938 echo 384000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
4939 # restore A57's max
4940 cat /sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_max_freq > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
4941 # re-enable thermal and BCL hotplug
4942 echo 1 > /sys/module/msm_thermal/core_control/enabled
4943 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
4944 do
4945 echo -n disable > $mode
4946 done
4947 for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask
4948 do
4949 echo $bcl_hotplug_mask > $hotplug_mask
4950 done
4951 for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask
4952 do
4953 echo $bcl_soc_hotplug_mask > $hotplug_soc_mask
4954 done
4955 for mode in /sys/devices/soc.0/qcom,bcl.*/mode
4956 do
4957 echo -n enable > $mode
4958 done
4959 # plugin remaining A57s
4960 echo 1 > /sys/devices/system/cpu/cpu5/online
4961 echo 1 > /sys/devices/system/cpu/cpu6/online
4962 echo 1 > /sys/devices/system/cpu/cpu7/online
4963 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
4964 # Restore CPU 4 max freq from msm_performance
4965 echo "4:4294967295 5:4294967295 6:4294967295 7:4294967295" > /sys/module/msm_performance/parameters/cpu_max_freq
4966 # input boost configuration
4967 echo 0:1344000 > /sys/module/cpu_boost/parameters/input_boost_freq
4968 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
4969 # Setting b.L scheduler parameters
4970 echo 1 > /proc/sys/kernel/sched_migration_fixup
4971 echo 30 > /proc/sys/kernel/sched_small_task
4972 echo 20 > /proc/sys/kernel/sched_mostly_idle_load
4973 echo 3 > /proc/sys/kernel/sched_mostly_idle_nr_run
4974 echo 99 > /proc/sys/kernel/sched_upmigrate
4975 echo 85 > /proc/sys/kernel/sched_downmigrate
4976 echo 400000 > /proc/sys/kernel/sched_freq_inc_notify
4977 echo 400000 > /proc/sys/kernel/sched_freq_dec_notify
4978 #enable rps static configuration
4979 echo 8 > /sys/class/net/rmnet_ipa0/queues/rx-0/rps_cpus
4980 for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
4981 do
4982 echo "bw_hwmon" > $devfreq_gov
4983 done
4984 ;;
4985esac
4986
4987case "$target" in
4988 "msm8996")
4989 # disable thermal bcl hotplug to switch governor
4990 echo 0 > /sys/module/msm_thermal/core_control/enabled
4991 echo -n disable > /sys/devices/soc/soc:qcom,bcl/mode
4992 bcl_hotplug_mask=`cat /sys/devices/soc/soc:qcom,bcl/hotplug_mask`
4993 echo 0 > /sys/devices/soc/soc:qcom,bcl/hotplug_mask
4994 bcl_soc_hotplug_mask=`cat /sys/devices/soc/soc:qcom,bcl/hotplug_soc_mask`
4995 echo 0 > /sys/devices/soc/soc:qcom,bcl/hotplug_soc_mask
4996 echo -n enable > /sys/devices/soc/soc:qcom,bcl/mode
4997 # set sync wakee policy tunable
4998 echo 1 > /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
4999 # configure governor settings for little cluster
5000 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
5001 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
5002 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
5003 echo 19000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
5004 echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
5005 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
5006 echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
5007 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
5008 echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
5009 echo 19000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
5010 echo 79000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis
5011 echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
5012 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif
5013 # online CPU2
5014 echo 1 > /sys/devices/system/cpu/cpu2/online
5015 # configure governor settings for big cluster
5016 echo "interactive" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
5017 echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/use_sched_load
5018 echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/use_migration_notif
5019 echo "19000 1400000:39000 1700000:19000 2100000:79000" > /sys/devices/system/cpu/cpu2/cpufreq/interactive/above_hispeed_delay
5020 echo 90 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/go_hispeed_load
5021 echo 20000 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/timer_rate
5022 echo 1248000 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/hispeed_freq
5023 echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/io_is_busy
5024 echo "85 1500000:90 1800000:70 2100000:95" > /sys/devices/system/cpu/cpu2/cpufreq/interactive/target_loads
5025 echo 19000 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/min_sample_time
5026 echo 79000 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/max_freq_hysteresis
5027 echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
5028 echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/ignore_hispeed_on_notif
5029 # re-enable thermal and BCL hotplug
5030 echo 1 > /sys/module/msm_thermal/core_control/enabled
5031 echo -n disable > /sys/devices/soc/soc:qcom,bcl/mode
5032 echo $bcl_hotplug_mask > /sys/devices/soc/soc:qcom,bcl/hotplug_mask
5033 echo $bcl_soc_hotplug_mask > /sys/devices/soc/soc:qcom,bcl/hotplug_soc_mask
5034 echo -n enable > /sys/devices/soc/soc:qcom,bcl/mode
5035 # input boost configuration
5036 echo "0:1324800 2:1324800" > /sys/module/cpu_boost/parameters/input_boost_freq
5037 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
5038 # Setting b.L scheduler parameters
5039 echo 0 > /proc/sys/kernel/sched_boost
5040 echo 1 > /proc/sys/kernel/sched_migration_fixup
5041 echo 45 > /proc/sys/kernel/sched_downmigrate
5042 echo 45 > /proc/sys/kernel/sched_upmigrate
5043 echo 400000 > /proc/sys/kernel/sched_freq_inc_notify
5044 echo 400000 > /proc/sys/kernel/sched_freq_dec_notify
5045 echo 3 > /proc/sys/kernel/sched_spill_nr_run
5046 echo 100 > /proc/sys/kernel/sched_init_task_load
5047 # Enable bus-dcvs
5048 for cpubw in /sys/class/devfreq/*qcom,cpubw*
5049 do
5050 echo "bw_hwmon" > $cpubw/governor
5051 echo 50 > $cpubw/polling_interval
5052 echo 1525 > $cpubw/min_freq
5053 echo "1525 5195 11863 13763" > $cpubw/bw_hwmon/mbps_zones
5054 echo 4 > $cpubw/bw_hwmon/sample_ms
5055 echo 34 > $cpubw/bw_hwmon/io_percent
5056 echo 20 > $cpubw/bw_hwmon/hist_memory
5057 echo 10 > $cpubw/bw_hwmon/hyst_length
5058 echo 0 > $cpubw/bw_hwmon/low_power_ceil_mbps
5059 echo 34 > $cpubw/bw_hwmon/low_power_io_percent
5060 echo 20 > $cpubw/bw_hwmon/low_power_delay
5061 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
5062 echo 250 > $cpubw/bw_hwmon/up_scale
5063 echo 1600 > $cpubw/bw_hwmon/idle_mbps
5064 done
5065
5066 for memlat in /sys/class/devfreq/*qcom,memlat-cpu*
5067 do
5068 echo "mem_latency" > $memlat/governor
5069 echo 10 > $memlat/polling_interval
5070 done
5071 echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor
5072
5073 soc_revision=`cat /sys/devices/soc0/revision`
5074 if [ "$soc_revision" == "2.0" ]; then
5075 #Disable suspend for v2.0
5076 echo pwr_dbg > /sys/power/wake_lock
5077 elif [ "$soc_revision" == "2.1" ]; then
5078 # Enable C4.D4.E4.M3 LPM modes
5079 # Disable D3 state
5080 echo 0 > /sys/module/lpm_levels/system/pwr/pwr-l2-gdhs/idle_enabled
5081 echo 0 > /sys/module/lpm_levels/system/perf/perf-l2-gdhs/idle_enabled
5082 # Disable DEF-FPC mode
5083 echo N > /sys/module/lpm_levels/system/pwr/cpu0/fpc-def/idle_enabled
5084 echo N > /sys/module/lpm_levels/system/pwr/cpu1/fpc-def/idle_enabled
5085 echo N > /sys/module/lpm_levels/system/perf/cpu2/fpc-def/idle_enabled
5086 echo N > /sys/module/lpm_levels/system/perf/cpu3/fpc-def/idle_enabled
5087 else
5088 # Enable all LPMs by default
5089 # This will enable C4, D4, D3, E4 and M3 LPMs
5090 echo N > /sys/module/lpm_levels/parameters/sleep_disabled
5091 fi
5092 echo N > /sys/module/lpm_levels/parameters/sleep_disabled
5093 # Starting io prefetcher service
5094 start iop
5095
5096 # Set Memory parameters
5097 configure_memory_parameters
5098 ;;
5099esac
5100
5101case "$target" in
5102 "sdm845")
5103
5104 # Set the default IRQ affinity to the silver cluster. When a
5105 # CPU is isolated/hotplugged, the IRQ affinity is adjusted
5106 # to one of the CPU from the default IRQ affinity mask.
5107 echo f > /proc/irq/default_smp_affinity
5108
5109 if [ -f /sys/devices/soc0/soc_id ]; then
5110 soc_id=`cat /sys/devices/soc0/soc_id`
5111 else
5112 soc_id=`cat /sys/devices/system/soc/soc0/id`
5113 fi
5114
5115 if [ -f /sys/devices/soc0/hw_platform ]; then
5116 hw_platform=`cat /sys/devices/soc0/hw_platform`
5117 fi
5118
5119 if [ -f /sys/devices/soc0/platform_subtype_id ]; then
5120 platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
5121 fi
5122
5123 case "$soc_id" in
5124 "321" | "341")
5125 # Start Host based Touch processing
5126 case "$hw_platform" in
5127 "QRD" )
5128 case "$platform_subtype_id" in
5129 "32") #QVR845 do nothing
5130 ;;
5131 *)
5132 start_hbtp
5133 ;;
5134 esac
5135 ;;
5136 *)
5137 start_hbtp
5138 ;;
5139 esac
5140 ;;
5141 esac
5142 # Core control parameters
5143 echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
5144 echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres
5145 echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres
5146 echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms
5147 echo 1 > /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster
5148 echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres
5149
5150 # Setting b.L scheduler parameters
5151 echo 95 > /proc/sys/kernel/sched_upmigrate
5152 echo 85 > /proc/sys/kernel/sched_downmigrate
5153 echo 100 > /proc/sys/kernel/sched_group_upmigrate
5154 echo 95 > /proc/sys/kernel/sched_group_downmigrate
5155 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
5156
5157 # configure governor settings for little cluster
5158 echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
5159 echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us
5160 echo 1209600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq
5161 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/pl
5162 echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
5163
5164 # configure governor settings for big cluster
5165 echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
5166 echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/rate_limit_us
5167 echo 1574400 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq
5168 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/pl
5169 echo "0:1324800" > /sys/module/cpu_boost/parameters/input_boost_freq
5170 echo 120 > /sys/module/cpu_boost/parameters/input_boost_ms
5171 # Limit the min frequency to 825MHz
5172 echo 825000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
5173
5174 # Enable oom_reaper
5175 echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper
5176
5177 # Enable bus-dcvs
5178 for cpubw in /sys/class/devfreq/*qcom,cpubw*
5179 do
5180 echo "bw_hwmon" > $cpubw/governor
5181 echo 50 > $cpubw/polling_interval
5182 echo "2288 4577 6500 8132 9155 10681" > $cpubw/bw_hwmon/mbps_zones
5183 echo 4 > $cpubw/bw_hwmon/sample_ms
5184 echo 50 > $cpubw/bw_hwmon/io_percent
5185 echo 20 > $cpubw/bw_hwmon/hist_memory
5186 echo 10 > $cpubw/bw_hwmon/hyst_length
5187 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
5188 echo 250 > $cpubw/bw_hwmon/up_scale
5189 echo 1600 > $cpubw/bw_hwmon/idle_mbps
5190 done
5191
5192 for llccbw in /sys/class/devfreq/*qcom,llccbw*
5193 do
5194 echo "bw_hwmon" > $llccbw/governor
5195 echo 50 > $llccbw/polling_interval
5196 echo "1720 2929 3879 5931 6881" > $llccbw/bw_hwmon/mbps_zones
5197 echo 4 > $llccbw/bw_hwmon/sample_ms
5198 echo 80 > $llccbw/bw_hwmon/io_percent
5199 echo 20 > $llccbw/bw_hwmon/hist_memory
5200 echo 10 > $llccbw/bw_hwmon/hyst_length
5201 echo 0 > $llccbw/bw_hwmon/guard_band_mbps
5202 echo 250 > $llccbw/bw_hwmon/up_scale
5203 echo 1600 > $llccbw/bw_hwmon/idle_mbps
5204 done
5205
5206 #Enable mem_latency governor for DDR scaling
5207 for memlat in /sys/class/devfreq/*qcom,memlat-cpu*
5208 do
5209 echo "mem_latency" > $memlat/governor
5210 echo 10 > $memlat/polling_interval
5211 echo 400 > $memlat/mem_latency/ratio_ceil
5212 done
5213
5214 #Enable mem_latency governor for L3 scaling
5215 for memlat in /sys/class/devfreq/*qcom,l3-cpu*
5216 do
5217 echo "mem_latency" > $memlat/governor
5218 echo 10 > $memlat/polling_interval
5219 echo 400 > $memlat/mem_latency/ratio_ceil
5220 done
5221
5222 #Enable userspace governor for L3 cdsp nodes
5223 for l3cdsp in /sys/class/devfreq/*qcom,l3-cdsp*
5224 do
5225 echo "userspace" > $l3cdsp/governor
5226 chown -h system $l3cdsp/userspace/set_freq
5227 done
5228
5229 #Gold L3 ratio ceil
5230 echo 4000 > /sys/class/devfreq/soc:qcom,l3-cpu4/mem_latency/ratio_ceil
5231
5232 echo "compute" > /sys/class/devfreq/soc:qcom,mincpubw/governor
5233 echo 10 > /sys/class/devfreq/soc:qcom,mincpubw/polling_interval
5234
5235 # cpuset parameters
5236 echo 0-3 > /dev/cpuset/background/cpus
5237 echo 0-3 > /dev/cpuset/system-background/cpus
5238
5239 # Turn off scheduler boost at the end
5240 echo 0 > /proc/sys/kernel/sched_boost
5241 # Disable CPU Retention
5242 echo N > /sys/module/lpm_levels/L3/cpu0/ret/idle_enabled
5243 echo N > /sys/module/lpm_levels/L3/cpu1/ret/idle_enabled
5244 echo N > /sys/module/lpm_levels/L3/cpu2/ret/idle_enabled
5245 echo N > /sys/module/lpm_levels/L3/cpu3/ret/idle_enabled
5246 echo N > /sys/module/lpm_levels/L3/cpu4/ret/idle_enabled
5247 echo N > /sys/module/lpm_levels/L3/cpu5/ret/idle_enabled
5248 echo N > /sys/module/lpm_levels/L3/cpu6/ret/idle_enabled
5249 echo N > /sys/module/lpm_levels/L3/cpu7/ret/idle_enabled
5250 echo N > /sys/module/lpm_levels/L3/l3-dyn-ret/idle_enabled
5251 # Turn on sleep modes.
5252 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
5253 echo 100 > /proc/sys/vm/swappiness
5254 echo 120 > /proc/sys/vm/watermark_scale_factor
5255 ;;
5256esac
5257
5258case "$target" in
5259 "msmnile")
merothh32be6882022-01-03 01:54:57 +05305260 # cpuset parameters
Rohit R Sekharadf49712022-11-17 21:05:16 +05305261 target_varient=`getprop ro.build.product`
Michael Bestasc3ad1cd2023-10-03 15:27:40 +03005262 if [ "$target_varient" == "msmnile_gvmq" ] || [ "$target_varient" == "msmnile_gvmgh" ]; then
Rohit R Sekharadf49712022-11-17 21:05:16 +05305263 echo 4-7 > /dev/cpuset/background/cpus
5264 echo 4-7 > /dev/cpuset/system-background/cpus
merothh32be6882022-01-03 01:54:57 +05305265
Rohit R Sekharadf49712022-11-17 21:05:16 +05305266 # Enable oom_reaper
5267 if [ -f /sys/module/lowmemorykiller/parameters/oom_reaper ]; then
5268 echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper
5269 else
5270 echo 1 > /proc/sys/vm/reap_mem_on_sigkill
5271 fi
5272 # Disable wsf, beacause we are using efk.
5273 # wsf Range : 1..1000 So set to bare minimum value 1.
5274 echo 1 > /proc/sys/vm/watermark_scale_factor
merothh32be6882022-01-03 01:54:57 +05305275
Rohit R Sekharadf49712022-11-17 21:05:16 +05305276 # Disable wsf, beacause we are using efk.
5277 # wsf Range : 1..1000 So set to bare minimum value 1.
5278 echo 1 > /proc/sys/vm/watermark_scale_factor
5279 # Enable oom_reaper
merothh32be6882022-01-03 01:54:57 +05305280 echo 1 > /proc/sys/vm/reap_mem_on_sigkill
Rohit R Sekharadf49712022-11-17 21:05:16 +05305281
5282 else
5283 # Core control parameters for gold
5284 echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
5285 echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres
5286 echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres
5287 echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms
5288 echo 3 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres
5289
5290 # Core control parameters for gold+
5291 echo 0 > /sys/devices/system/cpu/cpu7/core_ctl/min_cpus
5292 echo 60 > /sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres
5293 echo 30 > /sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres
5294 echo 100 > /sys/devices/system/cpu/cpu7/core_ctl/offline_delay_ms
5295 echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/task_thres
5296 # Controls how many more tasks should be eligible to run on gold CPUs
5297 # w.r.t number of gold CPUs available to trigger assist (max number of
5298 # tasks eligible to run on previous cluster minus number of CPUs in
5299 # the previous cluster).
5300 #
5301 # Setting to 1 by default which means there should be at least
5302 # 4 tasks eligible to run on gold cluster (tasks running on gold cores
5303 # plus misfit tasks on silver cores) to trigger assitance from gold+.
5304 echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/nr_prev_assist_thresh
5305
5306 # Disable Core control on silver
5307 echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable
5308
5309 # Setting b.L scheduler parameters
5310 echo 95 95 > /proc/sys/kernel/sched_upmigrate
5311 echo 85 85 > /proc/sys/kernel/sched_downmigrate
5312 echo 100 > /proc/sys/kernel/sched_group_upmigrate
5313 echo 10 > /proc/sys/kernel/sched_group_downmigrate
Rohit R Sekharadf49712022-11-17 21:05:16 +05305314
5315 echo 0-3 > /dev/cpuset/background/cpus
5316 echo 0-3 > /dev/cpuset/system-background/cpus
5317
5318
Rohit R Sekharadf49712022-11-17 21:05:16 +05305319
5320 # configure governor settings for silver cluster
5321 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
5322 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us
5323 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
5324 echo 1209600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
5325 echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
5326 echo 1 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl
5327
5328 # configure governor settings for gold cluster
5329 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
5330 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us
5331 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
5332 echo 1612800 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq
5333 echo 1 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl
5334
5335 # configure governor settings for gold+ cluster
5336 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy7/scaling_governor
5337 echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/up_rate_limit_us
5338 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
5339 echo 1612800 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq
5340 echo 1 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/pl
5341
5342 # configure input boost settings
5343 echo "0:1324800" > /sys/module/cpu_boost/parameters/input_boost_freq
5344 echo 120 > /sys/module/cpu_boost/parameters/input_boost_ms
5345
5346 # Disable wsf, beacause we are using efk.
5347 # wsf Range : 1..1000 So set to bare minimum value 1.
5348 echo 1 > /proc/sys/vm/watermark_scale_factor
5349
5350 # Enable oom_reaper
5351 if [ -f /sys/module/lowmemorykiller/parameters/oom_reaper ]; then
5352 echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper
5353 else
5354 echo 1 > /proc/sys/vm/reap_mem_on_sigkill
5355 fi
5356
5357 # Enable bus-dcvs
5358 for device in /sys/devices/platform/soc
5359 do
5360 for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw
5361 do
5362 echo "bw_hwmon" > $cpubw/governor
5363 echo "2288 4577 7110 9155 12298 14236 15258" > $cpubw/bw_hwmon/mbps_zones
5364 echo 4 > $cpubw/bw_hwmon/sample_ms
5365 echo 50 > $cpubw/bw_hwmon/io_percent
5366 echo 20 > $cpubw/bw_hwmon/hist_memory
5367 echo 10 > $cpubw/bw_hwmon/hyst_length
5368 echo 30 > $cpubw/bw_hwmon/down_thres
5369 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
5370 echo 250 > $cpubw/bw_hwmon/up_scale
5371 echo 1600 > $cpubw/bw_hwmon/idle_mbps
5372 echo 14236 > $cpubw/max_freq
5373 echo 40 > $cpubw/polling_interval
5374 done
5375
5376 for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw
5377 do
5378 echo "bw_hwmon" > $llccbw/governor
5379 echo "1720 2929 3879 5931 6881 7980" > $llccbw/bw_hwmon/mbps_zones
5380 echo 4 > $llccbw/bw_hwmon/sample_ms
5381 echo 80 > $llccbw/bw_hwmon/io_percent
5382 echo 20 > $llccbw/bw_hwmon/hist_memory
5383 echo 10 > $llccbw/bw_hwmon/hyst_length
5384 echo 30 > $llccbw/bw_hwmon/down_thres
5385 echo 0 > $llccbw/bw_hwmon/guard_band_mbps
5386 echo 250 > $llccbw/bw_hwmon/up_scale
5387 echo 1600 > $llccbw/bw_hwmon/idle_mbps
5388 echo 6881 > $llccbw/max_freq
5389 echo 40 > $llccbw/polling_interval
5390 done
5391
5392 for npubw in $device/*npu-npu-ddr-bw/devfreq/*npu-npu-ddr-bw
5393 do
5394 echo 1 > /sys/devices/virtual/npu/msm_npu/pwr
5395 echo "bw_hwmon" > $npubw/governor
5396 echo "1720 2929 3879 5931 6881 7980" > $npubw/bw_hwmon/mbps_zones
5397 echo 4 > $npubw/bw_hwmon/sample_ms
5398 echo 80 > $npubw/bw_hwmon/io_percent
5399 echo 20 > $npubw/bw_hwmon/hist_memory
5400 echo 6 > $npubw/bw_hwmon/hyst_length
5401 echo 30 > $npubw/bw_hwmon/down_thres
5402 echo 0 > $npubw/bw_hwmon/guard_band_mbps
5403 echo 250 > $npubw/bw_hwmon/up_scale
5404 echo 0 > $npubw/bw_hwmon/idle_mbps
5405 echo 40 > $npubw/polling_interval
5406 echo 0 > /sys/devices/virtual/npu/msm_npu/pwr
5407 done
5408 done
5409 fi
Michael Bestasc3ad1cd2023-10-03 15:27:40 +03005410 # Turn off scheduler boost at the end
5411 echo 0 > /proc/sys/kernel/sched_boost
5412 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
5413
Rohit R Sekharadf49712022-11-17 21:05:16 +05305414 # memlat specific settings are moved to seperate file under
5415 # device/target specific folder
5416 setprop vendor.dcvs.prop 1
5417
5418 if [ -f /sys/devices/soc0/hw_platform ]; then
5419 hw_platform=`cat /sys/devices/soc0/hw_platform`
5420 else
5421 hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
merothh32be6882022-01-03 01:54:57 +05305422 fi
5423
Rohit R Sekharadf49712022-11-17 21:05:16 +05305424 if [ -f /sys/devices/soc0/platform_subtype_id ]; then
5425 platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
5426 fi
merothh32be6882022-01-03 01:54:57 +05305427
Rohit R Sekharadf49712022-11-17 21:05:16 +05305428 case "$hw_platform" in
5429 "MTP" | "Surf" | "RCM" )
5430 # Start Host based Touch processing
5431 case "$platform_subtype_id" in
5432 "0" | "1" | "2" | "3" | "4")
5433 start_hbtp
5434 ;;
5435 esac
5436 ;;
5437 "HDK" )
5438 if [ -d /sys/kernel/hbtpsensor ] ; then
5439 start_hbtp
5440 fi
5441 ;;
5442 esac
merothh32be6882022-01-03 01:54:57 +05305443
Rohit R Sekharadf49712022-11-17 21:05:16 +05305444 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
5445 configure_memory_parameters
5446 target_type=`getprop ro.hardware.type`
5447 if [ -f /sys/devices/soc0/soc_id ]; then
5448 soc_id=`cat /sys/devices/soc0/soc_id`
5449 else
5450 soc_id=`cat /sys/devices/system/soc/soc0/id`
5451 fi
5452 if [ "$target_type" == "automotive" ]; then
5453 # update frequencies
5454 if [ "$soc_id" == "340" ] | [ "$soc_id" == "405" ]; then #sa8195
5455 configure_automotive_sku_parameters_sa8195
5456 else #sa8155
5457 configure_automotive_sku_parameters
5458 fi
5459 fi
merothh32be6882022-01-03 01:54:57 +05305460 ;;
5461esac
5462
5463case "$target" in
5464 "sdmshrike")
5465 # Core control parameters for gold
5466 echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
5467 echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres
5468 echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres
5469 echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms
5470 echo 3 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres
5471
5472 # Core control parameters for gold+
5473 echo 0 > /sys/devices/system/cpu/cpu7/core_ctl/min_cpus
5474 echo 60 > /sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres
5475 echo 30 > /sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres
5476 echo 100 > /sys/devices/system/cpu/cpu7/core_ctl/offline_delay_ms
5477 echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/task_thres
5478 # Controls how many more tasks should be eligible to run on gold CPUs
5479 # w.r.t number of gold CPUs available to trigger assist (max number of
5480 # tasks eligible to run on previous cluster minus number of CPUs in
5481 # the previous cluster).
5482 #
5483 # Setting to 1 by default which means there should be at least
5484 # 4 tasks eligible to run on gold cluster (tasks running on gold cores
5485 # plus misfit tasks on silver cores) to trigger assitance from gold+.
5486 echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/nr_prev_assist_thresh
5487
5488 # Disable Core control on silver
5489 echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable
5490
5491 # Setting b.L scheduler parameters
5492 echo 95 95 > /proc/sys/kernel/sched_upmigrate
5493 echo 85 85 > /proc/sys/kernel/sched_downmigrate
5494 echo 100 > /proc/sys/kernel/sched_group_upmigrate
5495 echo 10 > /proc/sys/kernel/sched_group_downmigrate
5496 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
5497
5498 # cpuset parameters
5499 echo 0-3 > /dev/cpuset/background/cpus
5500 echo 0-3 > /dev/cpuset/system-background/cpus
5501
5502 # Turn off scheduler boost at the end
5503 echo 0 > /proc/sys/kernel/sched_boost
5504
5505 # configure governor settings for silver cluster
5506 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
5507 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us
5508 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
5509 echo 1209600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
5510 echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
5511 echo 1 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl
5512
5513 # configure governor settings for gold cluster
5514 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
5515 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us
5516 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/down_rate_limit_us
5517 echo 1612800 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq
5518 echo 1 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl
5519
5520 # configure governor settings for gold+ cluster
5521 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy7/scaling_governor
5522 echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/up_rate_limit_us
5523 echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/down_rate_limit_us
5524 echo 1612800 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq
5525 echo 1 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/pl
5526
5527 # configure input boost settings
5528 echo "0:1324800" > /sys/module/cpu_boost/parameters/input_boost_freq
5529 echo 120 > /sys/module/cpu_boost/parameters/input_boost_ms
5530
5531 # Disable wsf, beacause we are using efk.
5532 # wsf Range : 1..1000 So set to bare minimum value 1.
5533 echo 1 > /proc/sys/vm/watermark_scale_factor
5534
5535 echo 0-3 > /dev/cpuset/background/cpus
5536 echo 0-3 > /dev/cpuset/system-background/cpus
5537
5538 # Enable oom_reaper
5539 if [ -f /sys/module/lowmemorykiller/parameters/oom_reaper ]; then
5540 echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper
5541 else
5542 echo 1 > /proc/sys/vm/reap_mem_on_sigkill
5543 fi
5544
5545 # Enable bus-dcvs
5546 for device in /sys/devices/platform/soc
5547 do
5548 for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw
5549 do
5550 echo "bw_hwmon" > $cpubw/governor
5551 echo 40 > $cpubw/polling_interval
5552 echo "2288 4577 7110 9155 12298 14236 15258" > $cpubw/bw_hwmon/mbps_zones
5553 echo 4 > $cpubw/bw_hwmon/sample_ms
5554 echo 50 > $cpubw/bw_hwmon/io_percent
5555 echo 20 > $cpubw/bw_hwmon/hist_memory
5556 echo 10 > $cpubw/bw_hwmon/hyst_length
5557 echo 30 > $cpubw/bw_hwmon/down_thres
5558 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
5559 echo 250 > $cpubw/bw_hwmon/up_scale
5560 echo 1600 > $cpubw/bw_hwmon/idle_mbps
5561 echo 14236 > $cpubw/max_freq
5562 done
5563
5564 for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw
5565 do
5566 echo "bw_hwmon" > $llccbw/governor
5567 echo 40 > $llccbw/polling_interval
5568 echo "1720 2929 3879 5931 6881 7980" > $llccbw/bw_hwmon/mbps_zones
5569 echo 4 > $llccbw/bw_hwmon/sample_ms
5570 echo 80 > $llccbw/bw_hwmon/io_percent
5571 echo 20 > $llccbw/bw_hwmon/hist_memory
5572 echo 10 > $llccbw/bw_hwmon/hyst_length
5573 echo 30 > $llccbw/bw_hwmon/down_thres
5574 echo 0 > $llccbw/bw_hwmon/guard_band_mbps
5575 echo 250 > $llccbw/bw_hwmon/up_scale
5576 echo 1600 > $llccbw/bw_hwmon/idle_mbps
5577 echo 6881 > $llccbw/max_freq
5578 done
5579
5580 for npubw in $device/*npu-npu-ddr-bw/devfreq/*npu-npu-ddr-bw
5581 do
5582 echo 1 > /sys/devices/virtual/npu/msm_npu/pwr
5583 echo "bw_hwmon" > $npubw/governor
5584 echo 40 > $npubw/polling_interval
5585 echo "1720 2929 3879 5931 6881 7980" > $npubw/bw_hwmon/mbps_zones
5586 echo 4 > $npubw/bw_hwmon/sample_ms
5587 echo 80 > $npubw/bw_hwmon/io_percent
5588 echo 20 > $npubw/bw_hwmon/hist_memory
5589 echo 6 > $npubw/bw_hwmon/hyst_length
5590 echo 30 > $npubw/bw_hwmon/down_thres
5591 echo 0 > $npubw/bw_hwmon/guard_band_mbps
5592 echo 250 > $npubw/bw_hwmon/up_scale
5593 echo 0 > $npubw/bw_hwmon/idle_mbps
5594 echo 0 > /sys/devices/virtual/npu/msm_npu/pwr
5595 done
5596
5597 #Enable mem_latency governor for L3, LLCC, and DDR scaling
5598 for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat
5599 do
5600 echo "mem_latency" > $memlat/governor
5601 echo 10 > $memlat/polling_interval
5602 echo 400 > $memlat/mem_latency/ratio_ceil
5603 done
5604
5605 #Enable userspace governor for L3 cdsp nodes
5606 for l3cdsp in $device/*cdsp-cdsp-l3-lat/devfreq/*cdsp-cdsp-l3-lat
5607 do
5608 echo "cdspl3" > $l3cdsp/governor
5609 done
5610
5611 #Enable compute governor for gold latfloor
5612 for latfloor in $device/*cpu-ddr-latfloor*/devfreq/*cpu-ddr-latfloor*
5613 do
5614 echo "compute" > $latfloor/governor
5615 echo 10 > $latfloor/polling_interval
5616 done
5617
5618 #Gold L3 ratio ceil
5619 for l3gold in $device/*cpu4-cpu-l3-lat/devfreq/*cpu4-cpu-l3-lat
5620 do
5621 echo 4000 > $l3gold/mem_latency/ratio_ceil
5622 done
5623
5624 #Prime L3 ratio ceil
5625 for l3prime in $device/*cpu7-cpu-l3-lat/devfreq/*cpu7-cpu-l3-lat
5626 do
5627 echo 20000 > $l3prime/mem_latency/ratio_ceil
5628 done
5629 done
5630
5631 if [ -f /sys/devices/soc0/hw_platform ]; then
5632 hw_platform=`cat /sys/devices/soc0/hw_platform`
5633 else
5634 hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
5635 fi
5636
5637 if [ -f /sys/devices/soc0/platform_subtype_id ]; then
5638 platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
5639 fi
5640
5641 case "$hw_platform" in
5642 "MTP" | "Surf" | "RCM" )
5643 # Start Host based Touch processing
5644 case "$platform_subtype_id" in
5645 "0" | "1")
5646 start_hbtp
5647 ;;
5648 esac
5649 ;;
5650 "HDK" )
5651 if [ -d /sys/kernel/hbtpsensor ] ; then
5652 start_hbtp
5653 fi
5654 ;;
5655 esac
5656
5657 #Setting the min and max supported frequencies
5658 reg_val=`cat /sys/devices/platform/soc/780130.qfprom/qfprom0/nvmem | od -An -t d4`
5659 feature_id=$(((reg_val >> 20) & 0xFF))
5660
5661 #Setting the min supported frequencies
5662 echo 1113600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
5663 echo 1171200 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
5664 echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/min_freq
5665 echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu4-cpu-l3-lat/min_freq
5666 echo 1651200000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq
5667 echo 1651200000 > /sys/class/devfreq/soc\:qcom,cpu4-cpu-l3-lat/max_freq
5668 #setting min gpu freq to 392 MHz
5669 echo 4 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel
5670 if [ $feature_id == 0 ]; then
5671 echo "feature_id is 0 for SA8195AA"
5672
5673 #setting max cpu freq to 2.496GHz
5674 echo 2496000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
5675 #setting max gpu freq to 530 MHz
5676 echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
5677 echo 1804 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq
5678 elif [ $feature_id == 1 ] || [ $feature_id == 2 ]; then
5679 echo "feature_id is 1 for external SA8195AB"
5680 echo "feature_id is 2 for internal SA8195AB"
5681
5682 #setting max cpu freq to 2.496GHz
5683 echo 2496000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
5684 #setting max gpu freq to 670 MHz
5685 echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
5686 echo 2092 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq
5687 elif [ $feature_id == 3 ]; then
5688 echo "feature_id is 3 for external SA8195AC"
5689 else
5690 echo "unknown feature_id value" $feature_id
5691 fi
5692
5693 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
5694 configure_memory_parameters
5695 ;;
5696esac
5697
5698case "$target" in
5699 "kona")
5700 rev=`cat /sys/devices/soc0/revision`
5701 ddr_type=`od -An -tx /proc/device-tree/memory/ddr_device_type`
5702 ddr_type4="07"
5703 ddr_type5="08"
5704
5705 # Core control parameters for gold
5706 echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
5707 echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres
5708 echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres
5709 echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms
5710 echo 3 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres
5711
5712 # Core control parameters for gold+
5713 echo 0 > /sys/devices/system/cpu/cpu7/core_ctl/min_cpus
5714 echo 60 > /sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres
5715 echo 30 > /sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres
5716 echo 100 > /sys/devices/system/cpu/cpu7/core_ctl/offline_delay_ms
5717 echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/task_thres
5718 # Controls how many more tasks should be eligible to run on gold CPUs
5719 # w.r.t number of gold CPUs available to trigger assist (max number of
5720 # tasks eligible to run on previous cluster minus number of CPUs in
5721 # the previous cluster).
5722 #
5723 # Setting to 1 by default which means there should be at least
5724 # 4 tasks eligible to run on gold cluster (tasks running on gold cores
5725 # plus misfit tasks on silver cores) to trigger assitance from gold+.
5726 echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/nr_prev_assist_thresh
5727
5728 # Disable Core control on silver
5729 echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable
5730
5731 # Setting b.L scheduler parameters
5732 echo 95 95 > /proc/sys/kernel/sched_upmigrate
5733 echo 85 85 > /proc/sys/kernel/sched_downmigrate
5734 echo 100 > /proc/sys/kernel/sched_group_upmigrate
5735 echo 85 > /proc/sys/kernel/sched_group_downmigrate
5736 echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks
5737 echo 400000000 > /proc/sys/kernel/sched_coloc_downmigrate_ns
5738
5739 # cpuset parameters
5740 echo 0-3 > /dev/cpuset/background/cpus
5741 echo 0-3 > /dev/cpuset/system-background/cpus
5742
5743 # Turn off scheduler boost at the end
5744 echo 0 > /proc/sys/kernel/sched_boost
5745
5746 # configure governor settings for silver cluster
5747 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
5748 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us
5749 echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us
5750 if [ $rev == "2.0" ] || [ $rev == "2.1" ]; then
5751 echo 1248000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
5752 else
5753 echo 1228800 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
5754 fi
5755 echo 691200 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
5756 echo 1 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl
5757
5758 # configure input boost settings
5759 echo "0:1324800" > /sys/devices/system/cpu/cpu_boost/input_boost_freq
5760 echo 120 > /sys/devices/system/cpu/cpu_boost/input_boost_ms
5761
5762 # configure governor settings for gold cluster
5763 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
5764 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/down_rate_limit_us
5765 echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us
5766 echo 1574400 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq
5767 echo 1 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl
5768
5769 # configure governor settings for gold+ cluster
5770 echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy7/scaling_governor
5771 echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/down_rate_limit_us
5772 echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/up_rate_limit_us
5773 if [ $rev == "2.0" ] || [ $rev == "2.1" ]; then
5774 echo 1632000 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq
5775 else
5776 echo 1612800 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq
5777 fi
5778 echo 1 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/pl
5779
5780 # Enable bus-dcvs
5781 for device in /sys/devices/platform/soc
5782 do
5783 for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw
5784 do
5785 echo "bw_hwmon" > $cpubw/governor
5786 echo "4577 7110 9155 12298 14236 15258" > $cpubw/bw_hwmon/mbps_zones
5787 echo 4 > $cpubw/bw_hwmon/sample_ms
5788 echo 50 > $cpubw/bw_hwmon/io_percent
5789 echo 20 > $cpubw/bw_hwmon/hist_memory
5790 echo 10 > $cpubw/bw_hwmon/hyst_length
5791 echo 30 > $cpubw/bw_hwmon/down_thres
5792 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
5793 echo 250 > $cpubw/bw_hwmon/up_scale
5794 echo 1600 > $cpubw/bw_hwmon/idle_mbps
5795 echo 14236 > $cpubw/max_freq
5796 echo 40 > $cpubw/polling_interval
5797 done
5798
5799 for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw
5800 do
5801 echo "bw_hwmon" > $llccbw/governor
5802 if [ ${ddr_type:4:2} == $ddr_type4 ]; then
5803 echo "1720 2086 2929 3879 5161 5931 6881 7980" > $llccbw/bw_hwmon/mbps_zones
5804 elif [ ${ddr_type:4:2} == $ddr_type5 ]; then
5805 echo "1720 2086 2929 3879 5931 6881 7980 10437" > $llccbw/bw_hwmon/mbps_zones
5806 fi
5807 echo 4 > $llccbw/bw_hwmon/sample_ms
5808 echo 80 > $llccbw/bw_hwmon/io_percent
5809 echo 20 > $llccbw/bw_hwmon/hist_memory
5810 echo 10 > $llccbw/bw_hwmon/hyst_length
5811 echo 30 > $llccbw/bw_hwmon/down_thres
5812 echo 0 > $llccbw/bw_hwmon/guard_band_mbps
5813 echo 250 > $llccbw/bw_hwmon/up_scale
5814 echo 1600 > $llccbw/bw_hwmon/idle_mbps
5815 echo 6881 > $llccbw/max_freq
5816 echo 40 > $llccbw/polling_interval
5817 done
5818
5819 for npubw in $device/*npu*-ddr-bw/devfreq/*npu*-ddr-bw
5820 do
5821 echo 1 > /sys/devices/virtual/npu/msm_npu/pwr
5822 echo "bw_hwmon" > $npubw/governor
5823 if [ ${ddr_type:4:2} == $ddr_type4 ]; then
5824 echo "1720 2086 2929 3879 5931 6881 7980" > $npubw/bw_hwmon/mbps_zones
5825 elif [ ${ddr_type:4:2} == $ddr_type5 ]; then
5826 echo "1720 2086 2929 3879 5931 6881 7980 10437" > $npubw/bw_hwmon/mbps_zones
5827 fi
5828 echo 4 > $npubw/bw_hwmon/sample_ms
5829 echo 160 > $npubw/bw_hwmon/io_percent
5830 echo 20 > $npubw/bw_hwmon/hist_memory
5831 echo 10 > $npubw/bw_hwmon/hyst_length
5832 echo 30 > $npubw/bw_hwmon/down_thres
5833 echo 0 > $npubw/bw_hwmon/guard_band_mbps
5834 echo 250 > $npubw/bw_hwmon/up_scale
5835 echo 1600 > $npubw/bw_hwmon/idle_mbps
5836 echo 40 > $npubw/polling_interval
5837 echo 0 > /sys/devices/virtual/npu/msm_npu/pwr
5838 done
5839
5840 for npullccbw in $device/*npu*-llcc-bw/devfreq/*npu*-llcc-bw
5841 do
5842 echo 1 > /sys/devices/virtual/npu/msm_npu/pwr
5843 echo "bw_hwmon" > $npullccbw/governor
5844 echo "4577 7110 9155 12298 14236 15258" > $npullccbw/bw_hwmon/mbps_zones
5845 echo 4 > $npullccbw/bw_hwmon/sample_ms
5846 echo 160 > $npullccbw/bw_hwmon/io_percent
5847 echo 20 > $npullccbw/bw_hwmon/hist_memory
5848 echo 10 > $npullccbw/bw_hwmon/hyst_length
5849 echo 30 > $npullccbw/bw_hwmon/down_thres
5850 echo 0 > $npullccbw/bw_hwmon/guard_band_mbps
5851 echo 250 > $npullccbw/bw_hwmon/up_scale
5852 echo 1600 > $npullccbw/bw_hwmon/idle_mbps
5853 echo 40 > $npullccbw/polling_interval
5854 echo 0 > /sys/devices/virtual/npu/msm_npu/pwr
5855 done
5856 done
5857 # memlat specific settings are moved to seperate file under
5858 # device/target specific folder
5859 setprop vendor.dcvs.prop 0
5860 setprop vendor.dcvs.prop 1
5861 echo N > /sys/module/lpm_levels/parameters/sleep_disabled
5862 configure_memory_parameters
5863 ;;
5864esac
5865
5866case "$target" in
5867 "msm8998" | "apq8098_latv")
5868
5869 echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
5870 echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres
5871 echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres
5872 echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms
5873 echo 1 > /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster
5874 echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres
5875
5876 # Setting b.L scheduler parameters
5877 echo 1 > /proc/sys/kernel/sched_migration_fixup
5878 echo 95 > /proc/sys/kernel/sched_upmigrate
5879 echo 90 > /proc/sys/kernel/sched_downmigrate
5880 echo 100 > /proc/sys/kernel/sched_group_upmigrate
5881 echo 95 > /proc/sys/kernel/sched_group_downmigrate
5882 echo 0 > /proc/sys/kernel/sched_select_prev_cpu_us
5883 echo 400000 > /proc/sys/kernel/sched_freq_inc_notify
5884 echo 400000 > /proc/sys/kernel/sched_freq_dec_notify
5885 echo 5 > /proc/sys/kernel/sched_spill_nr_run
5886 echo 1 > /proc/sys/kernel/sched_restrict_cluster_spill
5887 echo 1 > /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
5888 start iop
5889
5890 # disable thermal bcl hotplug to switch governor
5891 echo 0 > /sys/module/msm_thermal/core_control/enabled
5892
5893 # online CPU0
5894 echo 1 > /sys/devices/system/cpu/cpu0/online
5895 # configure governor settings for little cluster
5896 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
5897 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
5898 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
5899 echo 19000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
5900 echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
5901 echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
5902 echo 1248000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
5903 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
5904 echo "83 1804800:95" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
5905 echo 19000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
5906 echo 79000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis
5907 echo 518400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
5908 echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif
5909 # online CPU4
5910 echo 1 > /sys/devices/system/cpu/cpu4/online
5911 # configure governor settings for big cluster
5912 echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
5913 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
5914 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
5915 echo 19000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
5916 echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
5917 echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
5918 echo 1574400 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
5919 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
5920 echo "83 1939200:90 2016000:95" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
5921 echo 19000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
5922 echo 79000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis
5923 echo 806400 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
5924 echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/ignore_hispeed_on_notif
5925
5926 # re-enable thermal and BCL hotplug
5927 echo 1 > /sys/module/msm_thermal/core_control/enabled
5928
5929 # Enable input boost configuration
5930 echo "0:1324800" > /sys/module/cpu_boost/parameters/input_boost_freq
5931 echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
5932 # Enable bus-dcvs
5933 for cpubw in /sys/class/devfreq/*qcom,cpubw*
5934 do
5935 echo "bw_hwmon" > $cpubw/governor
5936 echo 50 > $cpubw/polling_interval
5937 echo 1525 > $cpubw/min_freq
5938 echo "3143 5859 11863 13763" > $cpubw/bw_hwmon/mbps_zones
5939 echo 4 > $cpubw/bw_hwmon/sample_ms
5940 echo 34 > $cpubw/bw_hwmon/io_percent
5941 echo 20 > $cpubw/bw_hwmon/hist_memory
5942 echo 10 > $cpubw/bw_hwmon/hyst_length
5943 echo 0 > $cpubw/bw_hwmon/low_power_ceil_mbps
5944 echo 34 > $cpubw/bw_hwmon/low_power_io_percent
5945 echo 20 > $cpubw/bw_hwmon/low_power_delay
5946 echo 0 > $cpubw/bw_hwmon/guard_band_mbps
5947 echo 250 > $cpubw/bw_hwmon/up_scale
5948 echo 1600 > $cpubw/bw_hwmon/idle_mbps
5949 done
5950
5951 for memlat in /sys/class/devfreq/*qcom,memlat-cpu*
5952 do
5953 echo "mem_latency" > $memlat/governor
5954 echo 10 > $memlat/polling_interval
5955 echo 400 > $memlat/mem_latency/ratio_ceil
5956 done
5957 echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor
5958 if [ -f /sys/devices/soc0/soc_id ]; then
5959 soc_id=`cat /sys/devices/soc0/soc_id`
5960 else
5961 soc_id=`cat /sys/devices/system/soc/soc0/id`
5962 fi
5963
5964 if [ -f /sys/devices/soc0/hw_platform ]; then
5965 hw_platform=`cat /sys/devices/soc0/hw_platform`
5966 else
5967 hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
5968 fi
5969
5970 if [ -f /sys/devices/soc0/platform_version ]; then
5971 platform_version=`cat /sys/devices/soc0/platform_version`
5972 platform_major_version=$((10#${platform_version}>>16))
5973 fi
5974
5975 if [ -f /sys/devices/soc0/platform_subtype_id ]; then
5976 platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
5977 fi
5978
5979 case "$soc_id" in
5980 "292") #msm8998 apq8098_latv
5981 # Start Host based Touch processing
5982 case "$hw_platform" in
5983 "QRD")
5984 case "$platform_subtype_id" in
5985 "0")
5986 start_hbtp
5987 ;;
5988 "16")
5989 if [ $platform_major_version -lt 6 ]; then
5990 start_hbtp
5991 fi
5992 ;;
5993 esac
5994
5995 ;;
5996 esac
5997 ;;
5998 esac
5999
6000 echo N > /sys/module/lpm_levels/system/pwr/cpu0/ret/idle_enabled
6001 echo N > /sys/module/lpm_levels/system/pwr/cpu1/ret/idle_enabled
6002 echo N > /sys/module/lpm_levels/system/pwr/cpu2/ret/idle_enabled
6003 echo N > /sys/module/lpm_levels/system/pwr/cpu3/ret/idle_enabled
6004 echo N > /sys/module/lpm_levels/system/perf/cpu4/ret/idle_enabled
6005 echo N > /sys/module/lpm_levels/system/perf/cpu5/ret/idle_enabled
6006 echo N > /sys/module/lpm_levels/system/perf/cpu6/ret/idle_enabled
6007 echo N > /sys/module/lpm_levels/system/perf/cpu7/ret/idle_enabled
6008 echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-dynret/idle_enabled
6009 echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-ret/idle_enabled
6010 echo N > /sys/module/lpm_levels/system/perf/perf-l2-dynret/idle_enabled
6011 echo N > /sys/module/lpm_levels/system/perf/perf-l2-ret/idle_enabled
6012 echo N > /sys/module/lpm_levels/parameters/sleep_disabled
6013
6014 echo 0-3 > /dev/cpuset/background/cpus
6015 echo 0-3 > /dev/cpuset/system-background/cpus
6016 echo 0 > /proc/sys/kernel/sched_boost
6017
6018 # Set Memory parameters
6019 configure_memory_parameters
6020 ;;
6021esac
6022
6023case "$target" in
6024 "msm8909")
6025
6026 if [ -f /sys/devices/soc0/soc_id ]; then
6027 soc_id=`cat /sys/devices/soc0/soc_id`
6028 else
6029 soc_id=`cat /sys/devices/system/soc/soc0/id`
6030 fi
6031
6032 # HMP scheduler settings for 8909 similiar to 8917
6033 echo 3 > /proc/sys/kernel/sched_window_stats_policy
6034 echo 3 > /proc/sys/kernel/sched_ravg_hist_size
6035
6036 echo 1 > /proc/sys/kernel/sched_restrict_tasks_spread
6037
6038 echo 20 > /proc/sys/kernel/sched_small_task
6039 echo 30 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
6040 echo 30 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
6041 echo 30 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
6042 echo 30 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
6043
6044 echo 3 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run
6045 echo 3 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run
6046 echo 3 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run
6047 echo 3 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run
6048
6049 echo 0 > /sys/devices/system/cpu/cpu0/sched_prefer_idle
6050 echo 0 > /sys/devices/system/cpu/cpu1/sched_prefer_idle
6051 echo 0 > /sys/devices/system/cpu/cpu2/sched_prefer_idle
6052 echo 0 > /sys/devices/system/cpu/cpu3/sched_prefer_idle
6053
6054 # Apply governor settings for 8909
6055
6056 # disable thermal core_control to update scaling_min_freq
6057 echo 0 > /sys/module/msm_thermal/core_control/enabled
6058 echo 1 > /sys/devices/system/cpu/cpu0/online
6059 echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
6060 echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
6061 # enable thermal core_control now
6062 echo 1 > /sys/module/msm_thermal/core_control/enabled
6063
6064 echo "29000 1094400:49000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
6065 echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
6066 echo 30000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
6067 echo 998400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
6068 echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
6069 echo "1 800000:85 998400:90 1094400:80" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
6070 echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
6071 echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
6072
6073 # Bring up all cores online
6074 echo 1 > /sys/devices/system/cpu/cpu1/online
6075 echo 1 > /sys/devices/system/cpu/cpu2/online
6076 echo 1 > /sys/devices/system/cpu/cpu3/online
6077 echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
6078
6079 for devfreq_gov in /sys/class/devfreq/*qcom,cpubw*/governor
6080 do
6081 echo "bw_hwmon" > $devfreq_gov
6082 for cpu_bimc_bw_step in /sys/class/devfreq/*qcom,cpubw*/bw_hwmon/bw_step
6083 do
6084 echo 60 > $cpu_bimc_bw_step
6085 done
6086 for cpu_guard_band_mbps in /sys/class/devfreq/*qcom,cpubw*/bw_hwmon/guard_band_mbps
6087 do
6088 echo 30 > $cpu_guard_band_mbps
6089 done
6090 done
6091
6092 for gpu_bimc_io_percent in /sys/class/devfreq/*qcom,gpubw*/bw_hwmon/io_percent
6093 do
6094 echo 40 > $gpu_bimc_io_percent
6095 done
6096 for gpu_bimc_bw_step in /sys/class/devfreq/*qcom,gpubw*/bw_hwmon/bw_step
6097 do
6098 echo 60 > $gpu_bimc_bw_step
6099 done
6100 for gpu_bimc_guard_band_mbps in /sys/class/devfreq/*qcom,gpubw*/bw_hwmon/guard_band_mbps
6101 do
6102 echo 30 > $gpu_bimc_guard_band_mbps
6103 done
6104
6105 # Set Memory parameters
6106 configure_memory_parameters
6107 restorecon -R /sys/devices/system/cpu
6108 ;;
6109esac
6110
6111case "$target" in
6112 "msm7627_ffa" | "msm7627_surf" | "msm7627_6x")
6113 echo 25000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
6114 ;;
6115esac
6116
6117case "$target" in
6118 "qsd8250_surf" | "qsd8250_ffa" | "qsd8650a_st1x")
6119 echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
6120 ;;
6121esac
6122
6123case "$target" in
6124 "qsd8650a_st1x")
6125 mount -t debugfs none /sys/kernel/debug
6126 ;;
6127esac
6128
6129chown -h system /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
6130chown -h system /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
6131chown -h system /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
6132
6133emmc_boot=`getprop vendor.boot.emmc`
6134case "$emmc_boot"
6135 in "true")
6136 chown -h system /sys/devices/platform/rs300000a7.65536/force_sync
6137 chown -h system /sys/devices/platform/rs300000a7.65536/sync_sts
6138 chown -h system /sys/devices/platform/rs300100a7.65536/force_sync
6139 chown -h system /sys/devices/platform/rs300100a7.65536/sync_sts
6140 ;;
6141esac
6142
6143case "$target" in
6144 "msm8960" | "msm8660" | "msm7630_surf")
6145 echo 10 > /sys/devices/platform/msm_sdcc.3/idle_timeout
6146 ;;
6147 "msm7627a")
6148 echo 10 > /sys/devices/platform/msm_sdcc.1/idle_timeout
6149 ;;
6150esac
6151
6152# Post-setup services
6153case "$target" in
6154 "msm8660" | "msm8960" | "msm8226" | "msm8610" | "mpq8092" )
6155 start mpdecision
6156 ;;
6157 "msm8974")
6158 start mpdecision
6159 echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb
6160 ;;
6161 "msm8909" | "msm8916" | "msm8937" | "msm8952" | "msm8953" | "msm8994" | "msm8992" | "msm8996" | "msm8998" | "sdm660" | "apq8098_latv" | "sdm845" | "sdm710" | "msmnile" | "msmsteppe" | "sm6150" | "kona" | "lito" | "trinket" | "atoll" | "bengal" | "sdmshrike")
6162 setprop vendor.post_boot.parsed 1
6163 ;;
6164 "apq8084")
6165 rm /data/system/perfd/default_values
6166 start mpdecision
6167 echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb
6168 echo 512 > /sys/block/sda/bdi/read_ahead_kb
6169 echo 512 > /sys/block/sdb/bdi/read_ahead_kb
6170 echo 512 > /sys/block/sdc/bdi/read_ahead_kb
6171 echo 512 > /sys/block/sdd/bdi/read_ahead_kb
6172 echo 512 > /sys/block/sde/bdi/read_ahead_kb
6173 echo 512 > /sys/block/sdf/bdi/read_ahead_kb
6174 echo 512 > /sys/block/sdg/bdi/read_ahead_kb
6175 echo 512 > /sys/block/sdh/bdi/read_ahead_kb
6176 ;;
6177 "msm7627a")
6178 if [ -f /sys/devices/soc0/soc_id ]; then
6179 soc_id=`cat /sys/devices/soc0/soc_id`
6180 else
6181 soc_id=`cat /sys/devices/system/soc/soc0/id`
6182 fi
6183 case "$soc_id" in
6184 "127" | "128" | "129")
6185 start mpdecision
6186 ;;
6187 esac
6188 ;;
6189esac
6190
6191# Enable Power modes and set the CPU Freq Sampling rates
6192case "$target" in
6193 "msm7627a")
6194 start qosmgrd
6195 echo 1 > /sys/module/pm2/modes/cpu0/standalone_power_collapse/idle_enabled
6196 echo 1 > /sys/module/pm2/modes/cpu1/standalone_power_collapse/idle_enabled
6197 echo 1 > /sys/module/pm2/modes/cpu0/standalone_power_collapse/suspend_enabled
6198 echo 1 > /sys/module/pm2/modes/cpu1/standalone_power_collapse/suspend_enabled
6199 #SuspendPC:
6200 echo 1 > /sys/module/pm2/modes/cpu0/power_collapse/suspend_enabled
6201 #IdlePC:
6202 echo 1 > /sys/module/pm2/modes/cpu0/power_collapse/idle_enabled
6203 echo 25000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
6204 ;;
6205esac
6206
6207# Change adj level and min_free_kbytes setting for lowmemory killer to kick in
6208case "$target" in
6209 "msm7627a")
6210 echo 0,1,2,4,9,12 > /sys/module/lowmemorykiller/parameters/adj
6211 echo 5120 > /proc/sys/vm/min_free_kbytes
6212 ;;
6213esac
6214
6215# Install AdrenoTest.apk if not already installed
6216if [ -f /data/prebuilt/AdrenoTest.apk ]; then
6217 if [ ! -d /data/data/com.qualcomm.adrenotest ]; then
6218 pm install /data/prebuilt/AdrenoTest.apk
6219 fi
6220fi
6221
6222# Install SWE_Browser.apk if not already installed
6223if [ -f /data/prebuilt/SWE_AndroidBrowser.apk ]; then
6224 if [ ! -d /data/data/com.android.swe.browser ]; then
6225 pm install /data/prebuilt/SWE_AndroidBrowser.apk
6226 fi
6227fi
6228
6229# Change adj level and min_free_kbytes setting for lowmemory killer to kick in
6230case "$target" in
6231 "msm8660")
6232 start qosmgrd
6233 echo 0,1,2,4,9,12 > /sys/module/lowmemorykiller/parameters/adj
6234 echo 5120 > /proc/sys/vm/min_free_kbytes
6235 ;;
6236esac
6237# Let kernel know our image version/variant/crm_version
6238if [ -f /sys/devices/soc0/select_image ]; then
6239 image_version="10:"
6240 image_version+=`getprop ro.build.id`
6241 image_version+=":"
6242 image_version+=`getprop ro.build.version.incremental`
6243 image_variant=`getprop ro.product.name`
6244 image_variant+="-"
6245 image_variant+=`getprop ro.build.type`
6246 oem_version=`getprop ro.build.version.codename`
6247 echo 10 > /sys/devices/soc0/select_image
6248 echo $image_version > /sys/devices/soc0/image_version
6249 echo $image_variant > /sys/devices/soc0/image_variant
6250 echo $oem_version > /sys/devices/soc0/image_crm_version
6251fi
6252
6253# Change console log level as per console config property
6254console_config=`getprop persist.vendor.console.silent.config`
6255case "$console_config" in
6256 "1")
6257 echo "Enable console config to $console_config"
6258 echo 0 > /proc/sys/kernel/printk
6259 ;;
6260 *)
6261 echo "Enable console config to $console_config"
6262 ;;
6263esac
6264
6265# Parse misc partition path and set property
6266misc_link=$(ls -l /dev/block/bootdevice/by-name/misc)
6267real_path=${misc_link##*>}
6268setprop persist.vendor.mmi.misc_dev_path $real_path