1import /vendor/etc/init/hw/init.zuma.usb.rc
2import android.hardware.drm@1.2-service.widevine.rc
3import init.exynos.sensorhub.rc
4
5on early-init
6    write /proc/sys/kernel/sched_pelt_multiplier 1
7    write /sys/kernel/mm/lru_gen/enabled n
8
9on init
10    # CPU0 cannot be offline
11    chmod 0444 /sys/devices/system/cpu/cpu0/online
12
13    # Set teo as cpu idle governor
14    write /sys/devices/system/cpu/cpuidle/current_governor teo
15    # Disable util-awareness for mids and bigs
16    write /proc/vendor_sched/teo_util_threshold "2 1024 1024"
17
18    # Boot time fs tuning
19    write /sys/block/sda/queue/scheduler bfq
20    write /sys/block/sda/queue/iosched/slice_idle 0
21
22    chown system system /proc/vendor_sched/groups/bg/set_task_group
23    chown system system /proc/vendor_sched/groups/cam/set_task_group
24    chown system system /proc/vendor_sched/groups/fg/set_task_group
25    chown system system /proc/vendor_sched/groups/nnapi/set_task_group
26    chown system system /proc/vendor_sched/groups/sys/set_task_group
27    chown system system /proc/vendor_sched/groups/sys_bg/set_task_group
28    chown system system /proc/vendor_sched/groups/ta/set_task_group
29    chown system system /proc/vendor_sched/groups/rt/set_task_group
30    chown system system /proc/vendor_sched/groups/sf/set_task_group
31    chown system system /proc/vendor_sched/groups/dex2oat/set_task_group
32    chown system system /proc/vendor_sched/groups/cam_power/set_task_group
33    chown system system /proc/vendor_sched/groups/ota/set_task_group
34    chown system system /proc/vendor_sched/groups/bg/set_proc_group
35    chown system system /proc/vendor_sched/groups/cam/set_proc_group
36    chown system system /proc/vendor_sched/groups/fg/set_proc_group
37    chown system system /proc/vendor_sched/groups/nnapi/set_proc_group
38    chown system system /proc/vendor_sched/groups/sys/set_proc_group
39    chown system system /proc/vendor_sched/groups/sys_bg/set_proc_group
40    chown system system /proc/vendor_sched/groups/ta/set_proc_group
41    chown system system /proc/vendor_sched/groups/rt/set_proc_group
42    chown system system /proc/vendor_sched/groups/sf/set_proc_group
43    chown system system /proc/vendor_sched/groups/dex2oat/set_proc_group
44    chown system system /proc/vendor_sched/groups/cam_power/set_proc_group
45    chown system system /proc/vendor_sched/groups/ota/set_proc_group
46    chown system system /proc/vendor_sched/prefer_idle_set
47    chown system system /proc/vendor_sched/prefer_idle_clear
48    chown system system /proc/vendor_sched/pmu_poll_enable
49    chown system system /proc/vendor_sched/pmu_poll_time
50    chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/lcpi_threshold
51    chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/spc_threshold
52    chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/limit_frequency
53    chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/pmu_limit_enable
54    chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/lcpi_threshold
55    chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/spc_threshold
56    chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/limit_frequency
57    chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/pmu_limit_enable
58    chown system system /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/lcpi_threshold
59    chown system system /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/spc_threshold
60    chown system system /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/limit_frequency
61    chown system system /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/pmu_limit_enable
62
63    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/memlat_cpuidle_state_aware
64    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/memlat_cpuidle_state_aware
65    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/memlat_cpuidle_state_aware
66    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/memlat_cpuidle_state_aware
67    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/memlat_cpuidle_state_aware
68    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/memlat_cpuidle_state_aware
69    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/memlat_cpuidle_state_aware
70    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/memlat_cpuidle_state_aware
71    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu8_memlat@17000010/memlat_cpuidle_state_aware
72
73    chmod 0220 /proc/vendor_sched/groups/bg/set_task_group
74    chmod 0220 /proc/vendor_sched/groups/cam/set_task_group
75    chmod 0220 /proc/vendor_sched/groups/fg/set_task_group
76    chmod 0220 /proc/vendor_sched/groups/nnapi/set_task_group
77    chmod 0220 /proc/vendor_sched/groups/sys/set_task_group
78    chmod 0220 /proc/vendor_sched/groups/sys_bg/set_task_group
79    chmod 0220 /proc/vendor_sched/groups/ta/set_task_group
80    chmod 0220 /proc/vendor_sched/groups/rt/set_task_group
81    chmod 0220 /proc/vendor_sched/groups/sf/set_task_group
82    chmod 0220 /proc/vendor_sched/groups/dex2oat/set_task_group
83    chmod 0220 /proc/vendor_sched/groups/cam_power/set_task_group
84    chmod 0220 /proc/vendor_sched/groups/ota/set_task_group
85    chmod 0220 /proc/vendor_sched/groups/bg/set_proc_group
86    chmod 0220 /proc/vendor_sched/groups/cam/set_proc_group
87    chmod 0220 /proc/vendor_sched/groups/fg/set_proc_group
88    chmod 0220 /proc/vendor_sched/groups/nnapi/set_proc_group
89    chmod 0220 /proc/vendor_sched/groups/sys/set_proc_group
90    chmod 0220 /proc/vendor_sched/groups/sys_bg/set_proc_group
91    chmod 0220 /proc/vendor_sched/groups/ta/set_proc_group
92    chmod 0220 /proc/vendor_sched/groups/rt/set_proc_group
93    chmod 0220 /proc/vendor_sched/groups/sf/set_proc_group
94    chmod 0220 /proc/vendor_sched/groups/dex2oat/set_proc_group
95    chmod 0220 /proc/vendor_sched/groups/cam_power/set_proc_group
96    chmod 0220 /proc/vendor_sched/groups/ota/set_proc_group
97    chmod 0220 /proc/vendor_sched/prefer_idle_set
98    chmod 0220 /proc/vendor_sched/prefer_idle_clear
99    chmod 0660 /proc/vendor_sched/pmu_poll_enable
100    chmod 0220 /proc/vendor_sched/pmu_poll_time
101
102    start vendor.keymaster-4-0
103
104    # ZRAM setup
105    write /proc/sys/vm/page-cluster 0
106
107    # Some user code relies on ro.boot.hardware.revision
108    setprop ro.boot.hardware.revision ${ro.revision}
109
110    # Allow PAI targeting per hardware SKU
111    setprop ro.oem.key1 ${ro.boot.hardware.sku}
112
113    # Property used by vintf for sku specific manifests
114    # Property used by NFC for sku specific configurations
115    setprop ro.boot.product.hardware.sku ${ro.boot.hardware.sku}
116
117    # Support legacy paths
118    symlink /data/app /factory
119
120    # Apply network parameters for high data performance.
121    write /proc/sys/net/core/rmem_default 1310720
122    write /proc/sys/net/core/rmem_max 8388608
123    write /proc/sys/net/core/wmem_default 327680
124    write /proc/sys/net/core/wmem_max 8388608
125    write /proc/sys/net/core/optmem_max 20480
126    write /proc/sys/net/core/netdev_max_backlog 10000
127    write /proc/sys/net/ipv4/tcp_rmem "2097152 4194304 8388608"
128    write /proc/sys/net/ipv4/tcp_wmem "262144 524288 8388608"
129    write /proc/sys/net/ipv4/tcp_mem "44259 59012 88518"
130    write /proc/sys/net/ipv4/udp_mem "88518 118025 177036"
131
132    write /sys/class/net/rmnet0/queues/rx-0/rps_cpus fe
133    write /sys/class/net/rmnet1/queues/rx-0/rps_cpus fe
134    write /sys/class/net/rmnet2/queues/rx-0/rps_cpus fe
135    write /sys/class/net/rmnet3/queues/rx-0/rps_cpus fe
136    write /sys/class/net/rmnet4/queues/rx-0/rps_cpus fe
137    write /sys/class/net/rmnet5/queues/rx-0/rps_cpus fe
138    write /sys/class/net/rmnet6/queues/rx-0/rps_cpus fe
139    write /sys/class/net/rmnet7/queues/rx-0/rps_cpus fe
140
141    # Create UDS structure for base VR services.
142    mkdir /dev/socket/pdx 0775 system system
143    mkdir /dev/socket/pdx/system 0775 system system
144    mkdir /dev/socket/pdx/system/buffer_hub 0775 system system
145    mkdir /dev/socket/pdx/system/performance 0775 system system
146    mkdir /dev/socket/pdx/system/vr 0775 system system
147    mkdir /dev/socket/pdx/system/vr/display 0775 system system
148    mkdir /dev/socket/pdx/system/vr/pose 0775 system system
149    mkdir /dev/socket/pdx/system/vr/sensors 0775 system system
150
151    # Boot time 183626384
152    write /proc/vendor_sched/groups/ta/uclamp_min 221
153    write /proc/vendor_sched/groups/ta/prefer_idle 1
154    write /proc/vendor_sched/groups/fg/uclamp_min 221
155    write /proc/vendor_sched/groups/fg/prefer_idle 1
156    write /proc/vendor_sched/groups/sys/uclamp_min 221
157    write /proc/vendor_sched/groups/sys/prefer_idle 1
158
159    # governor setting
160    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor sched_pixel
161    write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/up_rate_limit_us 500
162    write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/down_rate_limit_us 5000
163    write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/down_rate_limit_scale_pow 2
164    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor sched_pixel
165    write /sys/devices/system/cpu/cpu4/cpufreq/sched_pixel/up_rate_limit_us 500
166    write /sys/devices/system/cpu/cpu4/cpufreq/sched_pixel/down_rate_limit_us 20000
167    write /sys/devices/system/cpu/cpu8/cpufreq/scaling_governor sched_pixel
168    write /sys/devices/system/cpu/cpu8/cpufreq/sched_pixel/up_rate_limit_us 500
169    write /sys/devices/system/cpu/cpu8/cpufreq/sched_pixel/down_rate_limit_us 20000
170
171
172    # memlat cpuidle awareness setting
173    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/memlat_cpuidle_state_aware 2
174    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/memlat_cpuidle_state_aware 2
175    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/memlat_cpuidle_state_aware 2
176    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/memlat_cpuidle_state_aware 2
177    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/memlat_cpuidle_state_aware 2
178    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/memlat_cpuidle_state_aware 2
179    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/memlat_cpuidle_state_aware 2
180    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/memlat_cpuidle_state_aware 2
181    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu8_memlat@17000010/memlat_cpuidle_state_aware 2
182
183    # RT uclamp setting
184    write /proc/sys/kernel/sched_util_clamp_min_rt_default 0
185
186    # change permissions and default values for camera-daemon cpu controller
187    chown system system /dev/cpuctl/camera-daemon/cpu.uclamp.min
188    chown system system /dev/cpuctl/camera-daemon/cpu.uclamp.max
189    chown root root /dev/cpuctl/camera-daemon/cpu.uclamp.latency_sensitive
190    chown system system /dev/cpuctl/camera-daemon/cgroup.procs
191
192    mkdir /dev/cpuset/camera-daemon-high-group
193    write /dev/cpuset/camera-daemon-high-group/cpus 0-8
194    write /dev/cpuset/camera-daemon-high-group/mems 0
195    chown system system /dev/cpuset/camera-daemon-high-group/tasks
196    chmod 0664 /dev/cpuset/camera-daemon-high-group/tasks
197
198    mkdir /dev/cpuset/camera-daemon-mid-group
199    write /dev/cpuset/camera-daemon-mid-group/cpus 0-8
200    write /dev/cpuset/camera-daemon-mid-group/mems 0
201    chown system system /dev/cpuset/camera-daemon-mid-group/tasks
202    chmod 0664 /dev/cpuset/camera-daemon-mid-group/tasks
203
204    mkdir /dev/cpuset/camera-daemon-mid-high-group
205    write /dev/cpuset/camera-daemon-mid-high-group/cpus 0-8
206    write /dev/cpuset/camera-daemon-mid-high-group/mems 0
207    chown system system /dev/cpuset/camera-daemon-mid-high-group/tasks
208    chmod 0664 /dev/cpuset/camera-daemon-mid-high-group/tasks
209
210    write /proc/vendor_sched/groups/cam/prefer_idle 1
211    write /proc/vendor_sched/groups/cam/uclamp_min 1
212
213    chown system system /dev/cpuset/cgroup.procs
214
215    # nanohub sensor
216    chmod 0664 /dev/nanohub
217    chmod 0664 /dev/nanohub_comms
218    chown system system /dev/nanohub
219    chown system system /dev/nanohub_comms
220
221    # Dump maxfg
222    chown system system /sys/class/power_supply/maxfg/m5_model_state
223    chown system system /sys/class/power_supply/maxfg_base/m5_model_state
224
225    # Dump eeprom
226    chown system system /sys/devices/platform/10c90000.hsi2c/i2c-9/9-0050/eeprom
227    chown system system /dev/battery_history
228    chmod 0644 /dev/battery_history
229
230    # Loading common kernel modules in background
231    start init_display
232
233    # Charge stats (write 0)
234    chown system system /sys/class/power_supply/battery/charge_stats
235
236    # Pca Charge stats (write 0)
237    chown system system /sys/class/power_supply/dc-mains/device/chg_stats
238
239    # Wireless Charge stats (write 0)
240    chown system system /sys/class/power_supply/wireless/device/charge_stats
241
242    # Thermal Charge stats (write 0)
243    chown system system /sys/devices/platform/google,charger/thermal_stats
244
245    # Google Charger stats (write 0)
246    chown system system /sys/devices/platform/google,charger/charge_stats
247
248    # Permission for wireless charging
249    chown system system /sys/class/power_supply/wireless/capacity
250    chown system system /sys/class/power_supply/wireless/device/rtx
251    chown system system /sys/class/power_supply/wireless/device/rxdata
252    chown system system /sys/class/power_supply/wireless/device/txdata
253    chown system system /sys/class/power_supply/wireless/device/rxlen
254    chown system system /sys/class/power_supply/wireless/device/txlen
255    chown system system /sys/class/power_supply/wireless/device/ccreset
256    chown system system /sys/class/power_supply/wireless/device/status
257    chown system system /sys/class/power_supply/wireless/device/version
258    chown system system /sys/class/power_supply/wireless/device/features
259    chown system system /sys/class/power_supply/wireless/device/authtype
260
261    # Adaptive charge
262    chown system system /sys/class/power_supply/battery/charge_deadline
263
264    # Charging policy
265    chown system system /sys/class/power_supply/battery/charging_policy
266
267    # BatteryHealthData
268    chown system system /sys/class/power_supply/battery/first_usage_date
269    chown system system /sys/class/power_supply/battery/swelling_data
270
271    # Battery Defender
272    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_cnt
273    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_dry_run
274    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_enable
275    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_recharge_soc
276    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_reset_sec
277    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_clear
278    chown system system /sys/devices/platform/google,battery/power_supply/battery/health_safety_margin
279    chown system system /sys/devices/platform/google,charger/bd_drainto_soc
280    chown system system /sys/devices/platform/google,charger/bd_recharge_soc
281    chown system system /sys/devices/platform/google,charger/bd_recharge_voltage
282    chown system system /sys/devices/platform/google,charger/bd_resume_abs_temp
283    chown system system /sys/devices/platform/google,charger/bd_resume_soc
284    chown system system /sys/devices/platform/google,charger/bd_resume_temp
285    chown system system /sys/devices/platform/google,charger/bd_resume_time
286    chown system system /sys/devices/platform/google,charger/bd_temp_dry_run
287    chown system system /sys/devices/platform/google,charger/bd_temp_enable
288    chown system system /sys/devices/platform/google,charger/bd_trigger_temp
289    chown system system /sys/devices/platform/google,charger/bd_trigger_time
290    chown system system /sys/devices/platform/google,charger/bd_trigger_voltage
291    chown system system /sys/devices/platform/google,charger/bd_clear
292    chown system system /sys/devices/platform/google,charger/bd_state
293    chown system system /sys/devices/platform/google,charger/charge_start_level
294    chown system system /sys/devices/platform/google,charger/charge_stop_level
295    chown system system /sys/devices/platform/google,cpm/dc_ctl
296
297    # Power Stats HAL
298    chown system system /dev/bbd_pwrstat
299
300    # Add a boost for NNAPI HAL
301    write /proc/vendor_sched/groups/nnapi/prefer_idle 0
302    write /proc/vendor_sched/groups/nnapi/uclamp_min 512
303
304    # Add memlat governor settings
305    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/polling_interval 10
306    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/polling_interval 10
307    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/polling_interval 10
308    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/polling_interval 10
309    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/polling_interval 10
310    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/polling_interval 10
311    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/polling_interval 10
312    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/polling_interval 10
313    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu8_memlat@17000010/polling_interval 10
314    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/mem_latency/ratio_ceil 1800
315    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/mem_latency/ratio_ceil 1800
316    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/mem_latency/ratio_ceil 1800
317    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/mem_latency/ratio_ceil 1800
318    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/mem_latency/ratio_ceil 3700
319    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/mem_latency/ratio_ceil 3700
320    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/mem_latency/ratio_ceil 3700
321    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/mem_latency/ratio_ceil 3700
322    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu8_memlat@17000010/mem_latency/ratio_ceil 3400
323    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/mem_latency/stall_floor 3000
324    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/mem_latency/stall_floor 3000
325    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/mem_latency/stall_floor 3000
326    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/mem_latency/stall_floor 3000
327    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/mem_latency/stall_floor 2400
328    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/mem_latency/stall_floor 2400
329    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/mem_latency/stall_floor 2400
330    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/mem_latency/stall_floor 2400
331    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu8_memlat@17000010/mem_latency/stall_floor 500
332
333    # Set boost_adpf_prio, -1 by default
334    write /proc/vendor_sched/boost_adpf_prio ${persist.device_config.vendor_system_native_boot.boost_adpf_prio:--1}
335
336    # Add dsulat governor settings
337    write /sys/class/devfreq/gs_dsulat_devfreq:devfreq_dsu_lat@17000090/dsu_latency/ratio_ceil_cl0 700
338    write /sys/class/devfreq/gs_dsulat_devfreq:devfreq_dsu_lat@17000090/dsu_latency/ratio_ceil_cl1 1000
339    write /sys/class/devfreq/gs_dsulat_devfreq:devfreq_dsu_lat@17000090/dsu_latency/ratio_ceil_cl2 3000
340
341    write /sys/class/devfreq/gs_dsulat_devfreq:devfreq_dsu_lat@17000090/dsu_latency/mem_stall_floor_cl0 1750
342    write /sys/class/devfreq/gs_dsulat_devfreq:devfreq_dsu_lat@17000090/dsu_latency/mem_stall_floor_cl1 1750
343    write /sys/class/devfreq/gs_dsulat_devfreq:devfreq_dsu_lat@17000090/dsu_latency/mem_stall_floor_cl2 1750
344
345    write /sys/class/devfreq/gs_dsulat_devfreq:devfreq_dsu_lat@17000090/dsu_latency/dsulat_cpuidle_state_aware_cl0 2
346    write /sys/class/devfreq/gs_dsulat_devfreq:devfreq_dsu_lat@17000090/dsu_latency/dsulat_cpuidle_state_aware_cl1 2
347    write /sys/class/devfreq/gs_dsulat_devfreq:devfreq_dsu_lat@17000090/dsu_latency/dsulat_cpuidle_state_aware_cl2 2
348
349    # Give pixelstats group access to PCIe link statistics counters
350    chown system system /sys/devices/platform/12100000.pcie/link_stats/complete_timeout_irqs
351    chown system system /sys/devices/platform/12100000.pcie/link_stats/link_down_irqs
352    chown system system /sys/devices/platform/12100000.pcie/link_stats/link_recovery_failures
353    chown system system /sys/devices/platform/12100000.pcie/link_stats/link_up_failures
354    chown system system /sys/devices/platform/13120000.pcie/link_stats/complete_timeout_irqs
355    chown system system /sys/devices/platform/13120000.pcie/link_stats/link_down_irqs
356    chown system system /sys/devices/platform/13120000.pcie/link_stats/link_recovery_failures
357    chown system system /sys/devices/platform/13120000.pcie/link_stats/link_up_failures
358
359    # Change GSA log group for dumpstate
360    chown root system /sys/devices/platform/16490000.gsa-ns/log_main
361    chown root system /sys/devices/platform/16490000.gsa-ns/log_intermediate
362
363on init && property:ro.boot.hardware.cpu.pagesize=4096
364    write /sys/block/zram0/comp_algorithm lz77eh
365
366on init && property:ro.boot.hardware.cpu.pagesize=16384
367    write /sys/block/zram0/comp_algorithm lzo-rle
368
369on post-fs
370    # Ensure device is ready and start storageproxyd
371    wait /dev/sg1
372    start storageproxyd
373
374on late-fs
375    # Start bootanimation class before mount
376    start bootanim
377    class_start animation
378
379    # Mount RW partitions which need run fsck
380    mount_all --late
381
382on post-fs-data
383    # Modem temperature driver
384    chown radio system /sys/devices/platform/cp-tm1/cp_temp
385
386    # Log data folder
387    mkdir /data/vendor 0771 radio system
388    mkdir /data/vendor/log 0771 radio system
389    mkdir /data/vendor/log/cbd 0771 radio system
390    mkdir /data/vendor/log/rfsd 0771 radio system
391
392    mkdir /data/exynos/log 0771 radio system
393    mkdir /data/vendor/rild 0771 radio system
394    mkdir /data/vendor/dump 0771 radio system
395    mkdir /data/vendor/slog 0771 system system
396
397    # PixelLogger log paths.
398    mkdir /data/vendor/radio 773 system radio
399    mkdir /data/vendor/radio/logs 773 system radio
400    mkdir /data/vendor/radio/logs/always-on 777 system radio
401
402    # Modem extended log folder
403    mkdir /data/vendor/radio/extended_logs 0770 radio system
404
405    # Log Mask Library Mask storage paths
406    mkdir /data/vendor/radio/log_masks 777 system system
407
408    # Modem MDS log folder
409    mkdir /data/vendor/radio/mds 0771 radio system
410
411    # Modem SIM log folder
412    mkdir /data/vendor/radio/sim 0771 radio system
413
414    # Modem OTA UECap folder
415    mkdir /data/vendor/radio/ota_uecap 0773 radio system
416
417    # Unzipped modem images folder
418    mkdir /data/vendor/radio/image 0771 radio system
419
420    # Modem stat folder
421    mkdir /data/vendor/modem_stat 0771 radio system
422    write /data/vendor/modem_stat/debug.txt ""
423    chown radio system /data/vendor/modem_stat/debug.txt
424    chmod 0664 /data/vendor/modem_stat/debug.txt
425
426    # Modem replay folder
427    mkdir /mnt/vendor/modem_userdata/replay 0775 radio system
428
429    # Write display MIPI frequency from Modem
430    chown system system /sys/devices/platform/19440000.drmdsim/hs_clock
431    chown system system /sys/devices/platform/19450000.drmdsim/hs_clock
432    chmod 0664 /sys/devices/platform/19440000.drmdsim/hs_clock
433    chmod 0664 /sys/devices/platform/19450000.drmdsim/hs_clock
434
435    # IPSEC PIDDIR for VoWiFi
436    mkdir /data/vendor/misc 0771 root system
437    mkdir /data/vendor/misc/vpn 0771 root system
438
439    # Permissions Camera
440    mkdir /data/vendor/camera 0770 system camera
441    mkdir /data/vendor/camera/catpipe 0770 system camera
442
443    # ranging sensor
444    chown system system /dev/ispolin_ranging
445    chmod 0660 /dev/ispolin_ranging
446
447    # Audio dump and debug
448    mkdir /data/vendor/audio 0770 audio audio
449
450    # Create the directories for Darwinn HAL.
451    mkdir /data/vendor/hal_neuralnetworks_darwinn 0770 system system
452    mkdir /data/vendor/hal_neuralnetworks_darwinn/checksum_cache 0770 system system
453    mkdir /data/vendor/edgetpu 0770 system system
454    mkdir /data/vendor/edgetpu/cache 0770 system system
455
456    # Compatibility path for TPU
457    symlink /dev/edgetpu-soc /dev/edgetpu
458
459on zygote-start
460    # For PixelLogger configuration file.
461    chmod 0771 /data/vendor/wifi
462    write /proc/vendor_sched/groups/ta/uclamp_min 1
463    write /proc/vendor_sched/groups/fg/uclamp_min 0
464    write /proc/vendor_sched/groups/sys/uclamp_min 0
465    write /proc/vendor_sched/groups/ta/preferred_idle_mask_low 0x03f
466    write /proc/vendor_sched/groups/ta/preferred_idle_mask_mid 0x1f0
467    write /proc/vendor_sched/groups/ta/preferred_idle_mask_high 0x1f0
468    write /proc/vendor_sched/groups/ta/prefer_idle 1
469    write /proc/vendor_sched/groups/fg/preferred_idle_mask_low 0x03f
470    write /proc/vendor_sched/groups/fg/preferred_idle_mask_mid 0x1f0
471    write /proc/vendor_sched/groups/fg/preferred_idle_mask_high 0x1f0
472    write /proc/vendor_sched/groups/fg/prefer_idle 1
473    write /proc/vendor_sched/groups/sys/preferred_idle_mask_low 0x03f
474    write /proc/vendor_sched/groups/sys/preferred_idle_mask_mid 0x1f0
475    write /proc/vendor_sched/groups/sys/preferred_idle_mask_high 0x1f0
476    write /proc/vendor_sched/groups/sys/prefer_idle 1
477
478    write /proc/vendor_sched/groups/bg/ug 0
479    write /proc/vendor_sched/groups/sys_bg/ug 0
480    write /proc/vendor_sched/groups/ota/ug 0
481    write /proc/vendor_sched/groups/dex2oat/ug 1
482    write /proc/vendor_sched/groups/ta/ug 2
483    write /proc/vendor_sched/groups/fg/ug 2
484    write /proc/vendor_sched/groups/nnapi/ug 2
485    write /proc/vendor_sched/groups/rt/ug 2
486    write /proc/vendor_sched/groups/sf/ug 2
487    write /proc/vendor_sched/groups/sys/ug 2
488
489
490on post-fs-data
491    # Create the directories used by the Wireless subsystem
492    mkdir /data/vendor/wifi 0771 wifi wifi
493    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
494    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
495
496# Gatekeeper data
497    mkdir /data/vendor/gk 0771 system system
498
499# HWC data
500    mkdir /data/vendor/log/hwc 0771 system graphics
501
502# Video data
503    mkdir /data/vendor/media 0700 mediacodec mediacodec
504
505on post-fs-data
506    # GPS
507    mkdir /data/vendor/gps 0771 system system
508    chown system system /data/vendor/gps
509    rm /data/vendor/gps/gps_started
510    rm /data/vendor/gps/glonass_started
511    rm /data/vendor/gps/beidou_started
512    rm /data/vendor/gps/smd_started
513    rm /data/vendor/gps/sv_cno.info
514
515    chown gps system /sys/devices/platform/111e0000.spi/spi_master/spi21/spi21.0/nstandby
516    chmod 0664 /dev/ttyBCM
517    chown gps system /dev/ttyBCM
518    chmod 0664 /dev/bbd_control
519    chown gps system /dev/bbd_control
520    chmod 0664 /dev/bbd_patch
521    chown gps system /dev/bbd_patch
522    chmod 0664 /dev/bbd_sensor
523    chown gps system /dev/bbd_sensor
524
525on early-boot
526    # Wait for insmod_sh to finish all common modules
527    wait_for_prop vendor.common.modules.ready 1
528
529    # logbuffer
530    chown system system /dev/logbuffer_maxfg
531    chown system system /dev/logbuffer_maxfg_monitor
532    chown system system /dev/logbuffer_maxq
533    chown system system /dev/logbuffer_rtx
534    chown system system /dev/logbuffer_ssoc
535    chown system system /dev/logbuffer_ttf
536    chown system system /dev/logbuffer_tcpm
537    chown system system /dev/logbuffer_usbpd
538    chown system system /dev/logbuffer_wireless
539    chown system system /dev/logbuffer_pca9468
540    chown system system /dev/logbuffer_cpm
541    chown system system /dev/logbuffer_wc68
542    chown system system /dev/logbuffer_ln8411
543    chown system system /dev/logbuffer_pcie0
544    chown system system /dev/logbuffer_pcie1
545    chown system system /dev/logbuffer_bd
546    chown system system /dev/logbuffer_cpif
547
548on boot
549
550    # Allow to access debugfs for system:system
551    chmod 0755 /sys/kernel/debug
552    chown system system /sys/kernel/debug
553
554    #setprop ro.radio.noril no
555
556    # default country code
557    setprop ro.boot.wificountrycode 00
558
559    # Set up kernel tracing, but disable it by default
560    chmod 0222 /sys/kernel/debug/tracing/trace_marker
561    write /sys/kernel/debug/tracing/tracing_on 0
562
563    # Trigger TMU to ACPM pi table update
564    write /sys/module/gs_thermal/parameters/update_acpm_pi_table 1
565
566    # Change permission for A-Box firmware logs file & GPR dump
567    chown audioserver system /sys/devices/platform/17c50000.abox/reset
568    chown audioserver system /sys/devices/platform/17c50000.abox/service
569    chown audioserver system /sys/devices/platform/17c50000.abox/0.abox_debug/gpr
570    chown audioserver system /sys/devices/platform/17c50000.abox/0.abox_debug/calliope_sram
571    chown audioserver system /sys/devices/platform/17c50000.abox/0.abox_debug/calliope_dram
572    chown audioserver system /sys/devices/platform/17c50000.abox/0.abox_debug/calliope_iva
573    chown audioserver system /sys/kernel/debug/abox/log-00
574
575    # Change sched lib affinity
576    write /proc/vendor_sched/sched_lib_name libunity.so
577    write /proc/vendor_sched/sched_lib_mask_out 0x1f0
578
579# Permission for USB SELECT
580    chown system system /sys/class/android_usb/android0/enable
581    chmod 0660 /sys/class/android_usb/android0/enable
582    chown system system /sys/class/android_usb/android0/idVendor
583    chmod 0660 /sys/class/android_usb/android0/idVendor
584    chown system system /sys/class/android_usb/android0/idProduct
585    chmod 0660 /sys/class/android_usb/android0/idProduct
586    chown system system /sys/class/android_usb/android0/f_diag/clients
587    chmod 0660 /sys/class/android_usb/android0/f_diag/clients
588    chown system system /sys/class/android_usb/android0/functions
589    chmod 0660 /sys/class/android_usb/android0/functions
590    chown system system /sys/class/android_usb/android0/bDeviceClass
591    chmod 0660 /sys/class/android_usb/android0/bDeviceClass
592
593# Permission for UART SWITCH
594    chmod 0660 /sys/class/sec/switch/uart_sel
595    chown system system /sys/class/sec/switch/uart_sel
596
597# VTS sysfs file permission
598    chown audioserver system /sys/devices/platform/13810000.vts/vts_svoice_model
599    chown audioserver system /sys/devices/platform/13810000.vts/vts_google_model
600    chmod 0660 /sys/devices/platform/13810000.vts/vts_svoice_model
601    chmod 0660 /sys/devices/platform/13810000.vts/vts_google_model
602
603on property:persist.vendor.radio.no_modem_board=1
604    setprop ro.radio.noril yes
605
606on fs
607    mount_all --early
608
609    # Mount modem partition
610    mount_all /vendor/etc/fstab.modem --early
611    restorecon_recursive /mnt/vendor/modem_img
612
613# Permissions for ION
614    chmod 0660 /sys/class/ion_cma/ion_video_ext/isolated
615    chown system system /sys/class/ion_cma/ion_video_ext/isolated
616
617# Permissions for hwcomposer
618    chown system system /sys/class/backlight/panel0-backlight/als_table
619    chown system system /sys/class/backlight/panel0-backlight/brightness
620    chown system system /sys/class/backlight/panel0-backlight/dimming_on
621    chown system system /sys/class/backlight/panel0-backlight/hbm_mode
622    chown system system /sys/class/backlight/panel0-backlight/local_hbm_mode
623    chown system system /sys/class/backlight/panel0-backlight/allow_wakeup_by_state_change
624    chown system system /sys/devices/platform/exynos-drm/primary-panel/gamma
625    chown system system /sys/devices/platform/exynos-drm/primary-panel/min_vrefresh
626    chown system system /sys/devices/platform/exynos-drm/primary-panel/idle_delay_ms
627    chown system system /sys/devices/platform/exynos-drm/primary-panel/panel_idle
628    chown system system /sys/devices/platform/exynos-drm/primary-panel/panel_need_handle_idle_exit
629    chown system system /sys/devices/platform/exynos-drm/primary-panel/op_hz
630    chown system system /sys/devices/platform/exynos-drm/primary-panel/refresh_ctrl
631    chown system system /sys/devices/platform/exynos-drm/primary-panel/power_state
632    chown system system /sys/module/drm/parameters/vblankoffdelay
633    chown system system /sys/module/drm/parameters/debug
634    chown system system /sys/class/dqe0/atc/ambient_light
635    chown system system /sys/class/dqe0/atc/st
636    chown system system /sys/class/dqe0/atc/en
637    chown system system /sys/class/dqe0/atc/lt
638    chown system system /sys/class/dqe0/atc/ns
639    chown system system /sys/class/dqe0/atc/dither
640    chown system system /sys/class/dqe0/atc/pl_w1
641    chown system system /sys/class/dqe0/atc/pl_w2
642    chown system system /sys/class/dqe0/atc/ctmode
643    chown system system /sys/class/dqe0/atc/pp_en
644    chown system system /sys/class/dqe0/atc/upgrade_on
645    chown system system /sys/class/dqe0/atc/tdr_max
646    chown system system /sys/class/dqe0/atc/tdr_min
647    chown system system /sys/class/dqe0/atc/back_light
648    chown system system /sys/class/dqe0/atc/dstep
649    chown system system /sys/class/dqe0/atc/scale_mode
650    chown system system /sys/class/dqe0/atc/threshold_1
651    chown system system /sys/class/dqe0/atc/threshold_2
652    chown system system /sys/class/dqe0/atc/threshold_3
653    chown system system /sys/class/dqe0/atc/gain_limit
654    chown system system /sys/class/dqe0/atc/lt_calc_ab_shift
655
656    chown system system /sys/devices/platform/19470000.drmdecon/early_wakeup
657    chmod 0660 /sys/devices/platform/19470000.drmdecon/early_wakeup
658
659    chown system system /sys/devices/platform/19470000.drmdecon/hibernation
660    chmod 0644 /sys/devices/platform/19470000.drmdecon/hibernation
661
662# Copy DRM Key
663#    copy /system/app/wv.keys /factory/wv.keys
664
665# Permission for DRM Key
666#    chmod 0644 /factory/wv.keys
667
668# Permission for flashlight control for HAL3.3
669# The Istor espresso board does not have the flash led h/w, So the below permission line are blocked.
670# If you want to test the flashlight in board which have the flash led h/w, Enable the below blocked lines.
671    chmod 0660 /sys/class/camera/flash/rear_torch_flash
672    chown system camera /sys/class/camera/flash/rear_torch_flash
673#load ecd firmware
674    write /proc/ecd/load_firmware 1
675
676service abox /vendor/bin/main_abox 17c50000.abox
677    class late_start
678    user audioserver
679    group audioserver
680    seclabel u:r:abox:s0
681
682# on userdebug and eng builds, enable kgdb on the serial console
683on property:ro.debuggable=1
684    write /sys/module/kgdboc/parameters/kgdboc ttyFIQ1
685    write /sys/module/fiq_debugger/parameters/kgdb_enable 1
686
687# Touch
688on property:vendor.device.modules.ready=1
689    chown system system /sys/class/spi_master/spi20/spi20.0/stm_fts_cmd
690    chown system system /sys/class/spi_master/spi20/spi20.0/glove_mode
691    chown system system /sys/devices/virtual/sec/tsp/fw_version
692    chown system system /sys/devices/virtual/sec/tsp/cmd
693    chown system system /sys/devices/virtual/sec/tsp/cmd_result
694    chown system system /sys/devices/virtual/sec/tsp/status
695    chown system system /sys/devices/virtual/goog_touch_interface/gti.0/force_active
696    chown system system /sys/devices/virtual/goog_touch_interface/gti.0/fw_ver
697    chown system system /sys/devices/virtual/goog_touch_interface/gti.0/ms_base
698    chown system system /sys/devices/virtual/goog_touch_interface/gti.0/ms_diff
699    chown system system /sys/devices/virtual/goog_touch_interface/gti.0/ms_raw
700    chown system system /sys/devices/virtual/goog_touch_interface/gti.0/self_test
701    chown system system /sys/devices/virtual/goog_touch_interface/gti.0/ss_base
702    chown system system /sys/devices/virtual/goog_touch_interface/gti.0/ss_diff
703    chown system system /sys/devices/virtual/goog_touch_interface/gti.0/ss_raw
704    # Allow access to touch
705    chown system input /dev/touch_offload
706    chmod 660 /dev/touch_offload
707
708# Route touch_sensitivity_mode to persist
709on property:debug.touch_sensitivity_mode=0
710    setprop persist.vendor.touch_sensitivity_mode 0
711
712on property:debug.touch_sensitivity_mode=1
713    setprop persist.vendor.touch_sensitivity_mode 1
714
715on property:init.svc.vendor.charger=running
716    stop keymaster-4-0
717
718    setprop sys.usb.configfs 1
719    setprop vendor.setup.power 1
720
721    # keep one little and one big
722    write /sys/devices/system/cpu/cpu1/online 0
723    write /sys/devices/system/cpu/cpu2/online 0
724    write /sys/devices/system/cpu/cpu3/online 0
725    write /sys/devices/system/cpu/cpu4/online 0
726    write /sys/devices/system/cpu/cpu5/online 0
727    write /sys/devices/system/cpu/cpu7/online 0
728
729on property:sys.boot_completed=1
730    # Enable ZRAM on boot_complete
731    swapon_all /vendor/etc/fstab.${ro.board.platform}
732    write /proc/sys/vm/swappiness 60
733
734    # Set kswapd affinity
735    write /sys/kernel/vendor_mm/kswapd_cpu_affinity ff
736
737    # Adjust watermark level
738    write /proc/sys/vm/watermark_scale_factor 200
739
740    # Back to default VM settings
741    write /proc/sys/vm/dirty_expire_centisecs 3000
742    write /proc/sys/vm/dirty_background_ratio 10
743
744    # Cancel boot devfreq
745    write /sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/exynos_data/cancel_boot_freq 1
746
747    # Restore prefer idle
748    write /proc/vendor_sched/groups/ta/preferred_idle_mask_low 0x1ff
749    write /proc/vendor_sched/groups/ta/preferred_idle_mask_mid 0x1ff
750    write /proc/vendor_sched/groups/ta/preferred_idle_mask_high 0x1ff
751    write /proc/vendor_sched/groups/fg/preferred_idle_mask_low 0x1ff
752    write /proc/vendor_sched/groups/fg/preferred_idle_mask_mid 0x1ff
753    write /proc/vendor_sched/groups/fg/preferred_idle_mask_high 0x1ff
754    write /proc/vendor_sched/groups/sys/preferred_idle_mask_low 0x1ff
755    write /proc/vendor_sched/groups/sys/preferred_idle_mask_mid 0x1ff
756    write /proc/vendor_sched/groups/sys/preferred_idle_mask_high 0x1ff
757
758    # Setup final cpuset
759    write /dev/cpuset/top-app/cpus 0-8
760    write /dev/cpuset/foreground/cpus 0-7
761    write /dev/cpuset/background/cpus 0-3
762    write /dev/cpuset/system-background/cpus 0-3
763    write /dev/cpuset/restricted/cpus 0-3
764    write /dev/cpuset/camera-daemon/cpus 0-8
765    setprop vendor.powerhal.init 1
766
767    # Setup final cpu.uclamp
768    write /proc/vendor_sched/groups/ta/uclamp_min 1
769    write /proc/vendor_sched/groups/fg/uclamp_min 0
770    write /proc/vendor_sched/groups/sys/prefer_idle 0
771
772    # Set ug group
773    write /proc/vendor_sched/groups/bg/ug 0
774    write /proc/vendor_sched/groups/sys_bg/ug 0
775    write /proc/vendor_sched/groups/ota/ug 0
776    write /proc/vendor_sched/groups/dex2oat/ug 1
777    write /proc/vendor_sched/groups/ta/ug 1
778
779    # Set bg group throttle
780    write /proc/vendor_sched/ug_bg_group_throttle ${persist.device_config.vendor_system_native.ug_bg_group_throttle:-308}
781
782    # Set uclamp.max for some groups, which could indicate cpu importance used in scheduling
783    write /proc/vendor_sched/auto_uclamp_max "130 130 130 130 512 512 512 512 670"
784    write /proc/vendor_sched/groups/bg/uclamp_max 130
785    write /proc/vendor_sched/groups/sys_bg/uclamp_max 512
786    write /proc/vendor_sched/groups/ota/uclamp_max 512
787    write /proc/vendor_sched/groups/dex2oat/uclamp_max -2
788
789    write /proc/vendor_sched/uclamp_max_filter_divider 4
790    write /proc/vendor_sched/uclamp_max_filter_rt 16
791    write /proc/vendor_sched/uclamp_max_filter_enable 1
792
793    # Set PMU freq limit parameters
794    write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/lcpi_threshold 0
795    write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/spc_threshold 76
796    write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/limit_frequency 1328000
797    write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/lcpi_threshold 0
798    write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/spc_threshold 73
799    write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/limit_frequency 1836000
800    write /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/lcpi_threshold 0
801    write /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/spc_threshold 68
802    write /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/limit_frequency 2363000
803    write /proc/vendor_sched/pmu_poll_time 10
804
805    # Disable PMU freq limit
806    write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/pmu_limit_enable 1
807    write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/pmu_limit_enable 1
808    write /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/pmu_limit_enable 1
809    write /proc/vendor_sched/pmu_poll_enable 0
810
811    # Make devices on the critical path for suspend/resume asynchronous
812    write /sys/devices/platform/fixedregulator@0/regulator/regulator.2/power/async "enabled"
813    write /sys/devices/platform/fixedregulator@0/power/async "enabled"
814    write /sys/devices/platform/26040000.clock-controller/power/async "enabled"
815    write /sys/devices/platform/10840000.pinctrl/power/async "enabled"
816    write /sys/devices/platform/13060000.pinctrl/power/async "enabled"
817
818    # Setup cpu.shares to throttle background groups (bg ~ 5% sysbg ~ 5% dex2oat ~2.5%)
819    write /dev/cpuctl/background/cpu.shares 1024
820    write /dev/cpuctl/system-background/cpu.shares 1024
821    write /dev/cpuctl/dex2oat/cpu.shares 512
822    write /dev/cpuctl/system/cpu.shares 20480
823    # We only have system and background groups holding tasks and the groups below are empty
824    write /dev/cpuctl/camera-daemon/cpu.shares 20480
825    write /dev/cpuctl/foreground/cpu.shares 20480
826    write /dev/cpuctl/nnapi-hal/cpu.shares 20480
827    write /dev/cpuctl/rt/cpu.shares 20480
828    write /dev/cpuctl/top-app/cpu.shares 20480
829
830    # gvotables for dumpstate
831    chown system system /sys/kernel/debug/gvotables
832
833    # Permission for wireless charging
834    chown system system /sys/class/power_supply/wireless/capacity
835    chown system system /sys/class/power_supply/wireless/device/rtx
836    chown system system /sys/class/power_supply/wireless/device/rxdata
837    chown system system /sys/class/power_supply/wireless/device/txdata
838    chown system system /sys/class/power_supply/wireless/device/rxlen
839    chown system system /sys/class/power_supply/wireless/device/txlen
840    chown system system /sys/class/power_supply/wireless/device/ccreset
841    chown system system /sys/class/power_supply/wireless/device/status
842    chown system system /sys/class/power_supply/wireless/device/version
843
844    # AOC reset permission
845    chown root system /sys/devices/platform/17000000.aoc/reset
846    chmod 0220 /sys/devices/platform/17000000.aoc/reset
847
848    # write serialno to battery path for pairing
849    write /sys/class/power_supply/battery/dev_sn ${ro.boot.serialno}
850
851    # Disable GPU firmware logging
852    write /sys/devices/platform/1f000000.mali/firmware_config/Log\ verbosity/cur 0
853
854    # Enable SICD
855    write /sys/devices/system/cpu/cpupm/cpupm/sicd 1
856
857on property:sys.boot_completed=1 && property:persist.sys.device_provisioned=1
858    write /sys/class/power_supply/battery/first_usage_date 0
859
860# IMS WiFi Calling
861    service charonservice /system/vendor/bin/charon
862    class main
863    user root
864    disabled
865    seclabel u:r:charonservice:s0
866
867on property:vendor.charon.exec=1
868    rm /data/vendor/misc/vpn/charon.pid
869    chmod 0666 /dev/tun
870    start charonservice
871
872on property:vendor.charon.exec=0
873    stop charonservice
874    rm /data/vendor/misc/vpn/charon.pid
875
876# charger driver exposes now finer grain control, map demo mode to those properties
877# NOTE: demo mode can only be exit wiping data (which reset the persist properties)
878on property:sys.retaildemo.enabled=1
879    setprop persist.vendor.charge.stop.level 35
880    setprop persist.vendor.charge.start.level 30
881
882# Test Harness Mode default battery profile.
883on  property:persist.sys.test_harness=1 && property:persist.vendor.testing_battery_profile=0
884    setprop persist.vendor.charge.stop.level 70
885    setprop persist.vendor.charge.start.level 35
886    setprop vendor.battery.defender.disable 1
887
888# Extremely restricted battery profile.
889on  property:persist.sys.test_harness=1 && property:persist.vendor.testing_battery_profile=1
890    setprop persist.vendor.charge.stop.level 50
891    setprop persist.vendor.charge.start.level 35
892    setprop vendor.battery.defender.disable 1
893
894# Normal behavior (as if the device was a regular device)
895on  property:persist.sys.test_harness=1 && property:persist.vendor.testing_battery_profile=2
896    setprop persist.vendor.charge.stop.level 100
897    setprop persist.vendor.charge.start.level 0
898
899# Unrestricted, allows charging to 100%
900on  property:persist.sys.test_harness=1 && property:persist.vendor.testing_battery_profile=3
901    setprop persist.vendor.charge.stop.level 100
902    setprop persist.vendor.charge.start.level 0
903    setprop vendor.battery.defender.disable 1
904
905# bugreport is triggered by holding down volume down, volume up and power
906service bugreport /system/bin/dumpstate -d -p -z
907    class main
908    disabled
909    oneshot
910    keycodes 114 115 116
911
912
913service storageproxyd /vendor/bin/storageproxyd -d /dev/trusty-ipc-dev0 \
914        -r /dev/sg1 -p /data/vendor/ss -t ufs
915    class early_hal
916    user system
917    group system
918    task_profiles MaxPerformance
919
920# Write build info to kdebuginfo
921on property:ro.build.fingerprint=*
922    write /sys/module/debug_kinfo/parameters/build_info ${ro.build.fingerprint}
923
924# Bluetooth
925on early-boot
926    chown bluetooth system /sys/devices/platform/175b0000.serial/serial0/serial0-0/bluetooth/hci0/rfkill0/state
927    chown bluetooth system /sys/devices/platform/odm/odm:btbcm/rfkill/rfkill0/state
928    chown bluetooth system /sys/devices/platform/odm/odm:btbcm/rfkill/rfkill2/state
929
930on post-fs-data
931    chown bluetooth system /proc/bluetooth/sleep/btwake
932    chown bluetooth system /proc/bluetooth/sleep/lpm
933    chown bluetooth system /proc/bluetooth/sleep/btwrite
934    chown bluetooth system /sys/devices/platform/155d0000.serial/uart_dbg
935    mkdir /data/vendor/bluetooth 0770 bluetooth system
936
937# ODPM
938on early-boot && property:ro.boot.hardware.sku=GC3VE
939    write /sys/bus/iio/devices/iio:device0/enabled_rails "CH11=BUCK12S"
940on early-boot && property:ro.boot.hardware.sku=GZPF0
941    write /sys/bus/iio/devices/iio:device0/enabled_rails "CH11=BUCK12S"
942on early-boot && property:ro.boot.hardware.sku=GPJ41
943    write /sys/bus/iio/devices/iio:device0/enabled_rails "CH11=BUCK12S"
944on early-boot && property:ro.boot.hardware.sku=G9BQD
945    write /sys/bus/iio/devices/iio:device0/enabled_rails "CH11=BUCK12S"
946on early-boot && property:ro.boot.hardware.sku=GKV4X
947    write /sys/bus/iio/devices/iio:device0/enabled_rails "CH11=BUCK12S"
948on early-boot && property:ro.boot.hardware.sku=G6GPR
949    write /sys/bus/iio/devices/iio:device0/enabled_rails "CH11=BUCK12S"
950on early-boot && property:ro.boot.hardware.sku=G576D
951    write /sys/bus/iio/devices/iio:device0/enabled_rails "CH11=BUCK12S"
952on early-boot && property:ro.boot.hardware.sku=GGH2X
953    write /sys/bus/iio/devices/iio:device0/enabled_rails "CH11=BUCK12S"
954
955on post-fs-data
956    mkdir /data/vendor/powerstats 0771 system system
957    chown system system /data/vendor/powerstats
958    # Thermal Residency Stats (write 1 to reset)
959    chown system system /sys/kernel/metrics/thermal/tr_by_group/tmu/stats_reset
960    chown system system /sys/kernel/metrics/thermal/tr_by_group/spmic/stats_reset
961
962on property:vendor.thermal.link_ready=1
963    # BCL
964    write /sys/devices/platform/cpupm/cpupm/cpd_cl1 0 #Disable power down
965    write /sys/devices/platform/cpupm/cpupm/cpd_cl2 0 #Disable power down
966    write /sys/devices/virtual/pmic/mitigation/clock_ratio/tpu_light_clk_ratio 0x80041c3 #OCP
967    write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu1_heavy_clk_ratio 0xfff041c0 #DFS
968    write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu2_heavy_clk_ratio 0xfff041c0 #DFS
969    write /sys/devices/virtual/pmic/mitigation/clock_ratio/gpu_light_clk_ratio 0x80041c3 #OCP
970    write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu2_light_clk_ratio 0xfff041c3 #OCP
971    write /sys/devices/virtual/pmic/mitigation/clock_ratio/gpu_heavy_clk_ratio 0xfff04381 #DFS
972    write /sys/devices/virtual/pmic/mitigation/clock_ratio/tpu_heavy_clk_ratio 0xfff041c1 #DFS
973    write /sys/devices/virtual/pmic/mitigation/triggered_lvl/smpl_lvl 3100
974    write /sys/devices/virtual/pmic/mitigation/triggered_lvl/soft_ocp_cpu2_lvl 12000
975    write /sys/devices/virtual/pmic/mitigation/triggered_lvl/soft_ocp_gpu_lvl 9000
976    write /sys/devices/virtual/pmic/mitigation/triggered_lvl/soft_ocp_tpu_lvl 8500
977    write /sys/devices/virtual/pmic/mitigation/clock_div/tpu_clk_div 0x1
978    write /sys/devices/virtual/pmic/mitigation/clock_div/gpu_clk_div 0x1
979    write /sys/devices/virtual/pmic/mitigation/clock_div/cpu2_clk_div 0x1
980    write /sys/devices/platform/cpupm/cpupm/cpd_cl1 1 #Enable power down
981    write /sys/devices/platform/cpupm/cpupm/cpd_cl2 1 #Enable power down
982    chown system system /dev/thermal/tz-by-name/soc/mode
983    chown system system /dev/thermal/tz-by-name/vdroop2/trip_point_0_temp
984    chown system system /dev/thermal/tz-by-name/vdroop2/trip_point_0_hyst
985    chown system system /dev/thermal/tz-by-name/vdroop1/trip_point_0_temp
986    chown system system /dev/thermal/tz-by-name/vdroop1/trip_point_0_hyst
987    chown system system /dev/thermal/tz-by-name/smpl_gm/trip_point_0_temp
988    chown system system /dev/thermal/tz-by-name/smpl_gm/trip_point_0_hyst
989    chown system system /dev/thermal/tz-by-name/ocp_cpu1/trip_point_0_temp
990    chown system system /dev/thermal/tz-by-name/ocp_cpu1/trip_point_0_hyst
991    chown system system /dev/thermal/tz-by-name/ocp_cpu2/trip_point_0_temp
992    chown system system /dev/thermal/tz-by-name/ocp_cpu2/trip_point_0_hyst
993    chown system system /dev/thermal/tz-by-name/ocp_tpu/trip_point_0_temp
994    chown system system /dev/thermal/tz-by-name/ocp_tpu/trip_point_0_hyst
995    chown system system /dev/thermal/tz-by-name/ocp_gpu/trip_point_0_temp
996    chown system system /dev/thermal/tz-by-name/ocp_gpu/trip_point_0_hyst
997    chown system system /dev/thermal/tz-by-name/soft_ocp_cpu1/trip_point_0_temp
998    chown system system /dev/thermal/tz-by-name/soft_ocp_cpu1/trip_point_0_hyst
999    chown system system /dev/thermal/tz-by-name/soft_ocp_cpu2/trip_point_0_temp
1000    chown system system /dev/thermal/tz-by-name/soft_ocp_cpu2/trip_point_0_hyst
1001    chown system system /dev/thermal/tz-by-name/soft_ocp_tpu/trip_point_0_temp
1002    chown system system /dev/thermal/tz-by-name/soft_ocp_tpu/trip_point_0_hyst
1003    chown system system /dev/thermal/tz-by-name/soft_ocp_gpu/trip_point_0_temp
1004    chown system system /dev/thermal/tz-by-name/soft_ocp_gpu/trip_point_0_hyst
1005    chown system system /dev/thermal/tz-by-name/soc/trip_point_0_temp
1006    chown system system /dev/thermal/tz-by-name/soc/trip_point_0_hyst
1007    chown system system /dev/thermal/tz-by-name/batoilo/trip_point_0_temp
1008    chown system system /dev/thermal/tz-by-name/batoilo/trip_point_0_hyst
1009    # Thermal
1010    chown system system /dev/thermal/tz-by-name/soc_therm/trip_point_0_temp
1011    chown system system /dev/thermal/tz-by-name/soc_therm/trip_point_0_hyst
1012    chown system system /dev/thermal/tz-by-name/usb_conn_therm/trip_point_0_temp
1013    chown system system /dev/thermal/tz-by-name/usb_conn_therm/trip_point_0_hyst
1014    chown system system /dev/thermal/tz-by-name/disp_therm/trip_point_0_temp
1015    chown system system /dev/thermal/tz-by-name/disp_therm/trip_point_0_hyst
1016    chown system system /dev/thermal/tz-by-name/north_therm/trip_point_0_temp
1017    chown system system /dev/thermal/tz-by-name/north_therm/trip_point_0_hyst
1018    chown system system /dev/thermal/tz-by-name/cam_therm/trip_point_0_temp
1019    chown system system /dev/thermal/tz-by-name/cam_therm/trip_point_0_hyst
1020    chown system system /dev/thermal/tz-by-name/charge_therm/trip_point_0_temp
1021    chown system system /dev/thermal/tz-by-name/charge_therm/trip_point_0_hyst
1022    chown system system /dev/thermal/tz-by-name/soc_therm/trip_point_0_temp
1023    chown system system /dev/thermal/tz-by-name/soc_therm/trip_point_0_hyst
1024    chown system system /dev/thermal/tz-by-name/neutral_therm/trip_point_0_temp
1025    chown system system /dev/thermal/tz-by-name/neutral_therm/trip_point_0_hyst
1026    chown system system /dev/thermal/tz-by-name/usb_pwr_therm/trip_point_0_temp
1027    chown system system /dev/thermal/tz-by-name/usb_pwr_therm/trip_point_0_hyst
1028    chown system system /dev/thermal/tz-by-name/quiet_therm/trip_point_0_temp
1029    chown system system /dev/thermal/tz-by-name/quiet_therm/trip_point_0_hyst
1030
1031    chmod 664 /dev/thermal/cdev-by-name/thermal-cpufreq-0/user_vote
1032    chown system system /dev/thermal/cdev-by-name/thermal-cpufreq-0/user_vote
1033    chmod 664 /dev/thermal/cdev-by-name/thermal-cpufreq-1/user_vote
1034    chown system system /dev/thermal/cdev-by-name/thermal-cpufreq-1/user_vote
1035    chmod 664 /dev/thermal/cdev-by-name/thermal-cpufreq-2/user_vote
1036    chown system system /dev/thermal/cdev-by-name/thermal-cpufreq-2/user_vote
1037    chmod 664 /dev/thermal/cdev-by-name/thermal-gpufreq-0/user_vote
1038    chown system system /dev/thermal/cdev-by-name/thermal-gpufreq-0/user_vote
1039    chmod 664 /dev/thermal/cdev-by-name/gxp-cooling/user_vote
1040    chown system system /dev/thermal/cdev-by-name/gxp-cooling/user_vote
1041    chmod 664 /dev/thermal/cdev-by-name/tpu_cooling/user_vote
1042    chown system system /dev/thermal/cdev-by-name/tpu_cooling/user_vote
1043    chmod 664 /dev/thermal/cdev-by-name/fcc/cur_state
1044    chown system system /dev/thermal/cdev-by-name/fcc/cur_state
1045    chmod 664 /dev/thermal/cdev-by-name/dc_icl/cur_state
1046    chown system system /dev/thermal/cdev-by-name/dc_icl/cur_state
1047    chmod 664 /dev/thermal/cdev-by-name/chg_mdis/cur_state
1048    chown system system /dev/thermal/cdev-by-name/chg_mdis/cur_state
1049    chmod 664 /dev/thermal/cdev-by-name/usbc-port/cur_state
1050    chown system system /dev/thermal/cdev-by-name/usbc-port/cur_state
1051
1052on charger
1053    # Use charger thermal config
1054    setprop vendor.thermal.config "thermal_info_config_charge.json"
1055
1056    # Wait for insmod_sh to finish all common modules
1057    wait_for_prop vendor.common.modules.ready 1
1058
1059    # Create thermal symlink in off charging mode
1060    mkdir /dev/thermal 0750 system system
1061    mkdir /dev/thermal/tz-by-name 0750 system system
1062    mkdir /dev/thermal/cdev-by-name 0750 system system
1063    start vendor.thermal.symlinks
1064
1065    # Cancel boot devfreq and uclamp
1066    write /sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/exynos_data/cancel_boot_freq 1
1067    write /proc/vendor_sched/groups/ta/uclamp_min 0
1068    write /proc/vendor_sched/groups/ta/prefer_idle 0
1069    write /proc/vendor_sched/groups/fg/uclamp_min 0
1070    write /proc/vendor_sched/groups/fg/prefer_idle 0
1071    write /proc/vendor_sched/groups/sys/uclamp_min 0
1072    write /proc/vendor_sched/groups/sys/prefer_idle 0
1073
1074on property:vendor.disable.bcl.control=1
1075    write /sys/devices/virtual/pmic/mitigation/instruction/enable_mitigation 0
1076
1077on property:vendor.disable.bcl.control=0
1078    write /sys/devices/virtual/pmic/mitigation/instruction/enable_mitigation 1
1079
1080# UDFPS
1081on post-fs-data && property:ro.vendor.factory=1
1082    # HBM mode for UDFPS factory apk
1083    chmod 666 /d/dri/0/DSI-1/panel/reg/payload
1084    chmod 666 /d/dri/0/DSI-1/panel/reg/count
1085    chmod 666 /d/dri/0/DSI-1/panel/reg/address
1086    chmod 666 /d/dri/0/DSI-1/panel/hbm_mode
1087    chmod 666 /sys/class/backlight/panel0-backlight/local_hbm_max_timeout
1088    chmod 666 /sys/class/backlight/panel0-backlight/local_hbm_mode
1089    chmod 666 /sys/class/backlight/panel0-backlight/hbm_mode
1090
1091# MTE
1092on property:persist.device_config.runtime_native_boot.mode_override=sync
1093    # Per-core mode overrides.
1094    # Little Cores: sync
1095    write /sys/devices/system/cpu/cpu0/mte_tcf_preferred sync
1096    write /sys/devices/system/cpu/cpu1/mte_tcf_preferred sync
1097    write /sys/devices/system/cpu/cpu2/mte_tcf_preferred sync
1098    write /sys/devices/system/cpu/cpu3/mte_tcf_preferred sync
1099    # Mid Cores: sync
1100    write /sys/devices/system/cpu/cpu4/mte_tcf_preferred sync
1101    write /sys/devices/system/cpu/cpu5/mte_tcf_preferred sync
1102    write /sys/devices/system/cpu/cpu6/mte_tcf_preferred sync
1103    write /sys/devices/system/cpu/cpu7/mte_tcf_preferred sync
1104    # Big Core: sync mode performance is prohibitively bad
1105    write /sys/devices/system/cpu/cpu8/mte_tcf_preferred asymm
1106
1107on property:persist.device_config.runtime_native_boot.mode_override=asymm
1108    # Per-core mode overrides.
1109    write /sys/devices/system/cpu/cpu0/mte_tcf_preferred asymm
1110    write /sys/devices/system/cpu/cpu1/mte_tcf_preferred asymm
1111    write /sys/devices/system/cpu/cpu2/mte_tcf_preferred asymm
1112    write /sys/devices/system/cpu/cpu3/mte_tcf_preferred asymm
1113    write /sys/devices/system/cpu/cpu4/mte_tcf_preferred asymm
1114    write /sys/devices/system/cpu/cpu5/mte_tcf_preferred asymm
1115    write /sys/devices/system/cpu/cpu6/mte_tcf_preferred asymm
1116    write /sys/devices/system/cpu/cpu7/mte_tcf_preferred asymm
1117    write /sys/devices/system/cpu/cpu8/mte_tcf_preferred asymm
1118