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