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