summaryrefslogtreecommitdiff
path: root/rootdir/etc/init.qcom.rc
blob: 3992976f97d38c2094bdff147b67550ea60453ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
#
# Copyright 2012 The Android Open Source Project
# Copyright (C) 2013 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import /vendor/etc/init/hw/init.qcom.power.rc
import /vendor/etc/init/hw/init.sony.rc
import /vendor/etc/init/hw/init.sony.usb.rc
import /vendor/etc/init/hw/init.platform-common.rc
import /vendor/etc/init/hw/init.camera.rc

on early-init
    mount debugfs /sys/kernel/debug /sys/kernel/debug mode=755

    # Turn off backlight on blank
    write /sys/class/leds/lcd-backlight/trigger "backlight"

on init
    symlink /dev/block/platform/msm_sdcc.1 /dev/block/bootdevice

    # Enable subsystem restart
    write /sys/module/subsystem_restart/parameters/enable_ramdumps 0
    write /sys/bus/msm_subsys/devices/subsys0/restart_level "RELATED"
    write /sys/bus/msm_subsys/devices/subsys1/restart_level "RELATED"
    write /sys/bus/msm_subsys/devices/subsys2/restart_level "RELATED"
    write /sys/bus/msm_subsys/devices/subsys3/restart_level "RELATED"

    chmod 0664 /proc/rdtag
    chown root system /proc/rdtag

    wait /dev/block/mmcblk0p1
    chown system system /dev/block/mmcblk0p1
    chmod 0770 /dev/block/mmcblk0p1

    write /sys/module/qpnp_rtc/parameters/poweron_alarm 1

    # Enable panic on out of memory
    write /proc/sys/vm/panic_on_oom 2

    # Setup zram options
    write /sys/block/zram0/comp_algorithm lz4

    # Create a tmpfs for dynamic network mounting
    mkdir /storage/removable/remote 0700 root system
    mount tmpfs tmpfs /storage/removable/remote mode=0755,uid=0,gid=0

    # Set the property to indicate type of virtual display to 0
    # 0 indicates that virtual display is not a Wifi display and that the
    # session is not exercised through RemoteDisplay in the android framework
    setprop persist.sys.wfd.virtual 0

on fs
    mount_all ./vendor/etc/fstab.qcom

    # Mount ZRAM
    swapon_all ./vendor/etc/fstab.qcom

    # Adaptive LMK
    write /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk 1
    write /sys/module/lowmemorykiller/parameters/vmpressure_file_min 53059

    # Start hvdcp to enable quck charge 2.0 in power off charge
    start hvdcp

on early-boot
    # set RLIMIT_MEMLOCK to 64MB
    setrlimit 8 67108864 67108864

    write /sys/kernel/boot_adsp/boot 1

    # Run pre_hw_config.sh before entering charge only mode.
    exec /system/bin/sh /system/etc/pre_hw_config.sh

on boot
    write /sys/module/qpnp_power_on/parameters/forcecrash_on 1

    # Bluetooth
    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
    # bluetooth LPM
    chown bluetooth bluetooth /proc/bluetooth/sleep/lpm
    chown bluetooth bluetooth /proc/bluetooth/sleep/btwrite

    # BT DUN port-bridge
    chmod 0660 /dev/smd7
    chown bluetooth bluetooth /dev/smd7

    chmod 0660 /sys/class/rfkill/rfkill0/state
    chown bluetooth bluetooth /dev/ttyHS0
    chmod 0660 /dev/ttyHS0
    chown bluetooth bluetooth /sys/devices/platform/msm_serial_hs.0/clock
    chmod 0660 /sys/devices/platform/msm_serial_hs.0/clock

    # Create QMUX deamon socket area
    mkdir /dev/socket/qmux_radio 2770 radio radio
    mkdir /dev/socket/netmgr 0750 radio radio
    mkdir /dev/socket/qmux_audio 2770 media audio
    mkdir /dev/socket/qmux_bluetooth 2770 bluetooth bluetooth
    mkdir /dev/socket/qmux_gps 2770 gps gps

    # Create PERFD deamon related dirs
    mkdir /data/misc/perfd 2755 root system
    mkdir /data/system/perfd 2770 root system

    #Create NETMGR daemon socket area
    mkdir /dev/socket/netmgr 0750 radio radio

    # Wlan Interface Port
    setprop wifi.interface wlan0

    # WiFi Firmware
    chown wifi wifi /sys/module/bcmdhd/parameters/firmware_path

    # Send single UNSOL_CALL_RING notification
    setprop ro.telephony.call_ring.multiple false

    # port-bridge
    chmod 0660 /dev/smd0
    chown system system /dev/smd0

    chmod 0444 /sys/devices/platform/msm_hsusb/gadget/usb_state

    # Graphics
    chown system graphics /sys/class/graphics/fb0/idle_time
    chmod 0664 /sys/devices/virtual/graphics/fb0/idle_time
    chown system graphics /sys/class/graphics/fb0/dynamic_fps
    chmod 0664 /sys/devices/virtual/graphics/fb0/dynamic_fps
    chown system graphics /sys/class/graphics/fb0/dyn_pu
    chmod 0664 /sys/devices/virtual/graphics/fb0/dyn_pu
    chown system graphics /sys/class/graphics/fb0/modes
    chmod 0664 /sys/devices/virtual/graphics/fb0/modes
    chown system graphics /sys/class/graphics/fb0/mode
    chmod 0664 /sys/devices/virtual/graphics/fb0/mode

    chown system graphics /sys/class/graphics/fb1/hpd
    chmod 0664 /sys/devices/virtual/graphics/fb1/hpd
    chown system graphics /sys/class/graphics/fb1/res_info
    chmod 0664 /sys/class/graphics/fb1/res_info
    chmod 0664 /sys/devices/virtual/graphics/fb1/res_info
    chown system graphics /sys/class/graphics/fb1/vendor_name
    chmod 0664 /sys/devices/virtual/graphics/fb1/vendor_name
    chown system graphics /sys/class/graphics/fb1/product_description
    chmod 0664 /sys/devices/virtual/graphics/fb1/product_description
    chown system graphics /sys/class/graphics/fb1/video_mode
    chmod 0664 /sys/devices/virtual/graphics/fb1/video_mode
    chown system graphics /sys/class/graphics/fb1/format_3d
    chmod 0664 /sys/devices/virtual/graphics/fb1/format_3d
    chown system graphics /sys/class/graphics/fb1/s3d_mode
    chmod 0664 /sys/devices/virtual/graphics/fb1/s3d_mode
    chown system graphics /sys/class/graphics/fb1/cec/enable
    chmod 0664 /sys/devices/virtual/graphics/fb1/cec/enable
    chown system graphics /sys/class/graphics/fb1/cec/logical_addr
    chmod 0664 /sys/devices/virtual/graphics/fb1/cec/logical_addr
    chown system graphics /sys/class/graphics/fb1/cec/rd_msg
    chmod 0664 /sys/devices/virtual/graphics/fb1/cec/rd_msg
    chown system graphics /sys/class/graphics/fb1/pa
    chmod 0664 /sys/devices/virtual/graphics/fb1/pa
    chown system graphics /sys/class/graphics/fb1/cec/wr_msg
    chmod 0664 /sys/devices/virtual/graphics/fb1/cec/wr_msg
    chown system graphics /sys/class/graphics/fb1/hdcp/tp
    chmod 0664 /sys/devices/virtual/graphics/fb1/hdcp/tp

    # create symlink for fb1 as HDMI
    symlink /dev/graphics/fb1 /dev/graphics/hdmi

    # Change owner and group to get adopter/device ids from MHL driver
    chown system system /sys/class/mhl/sii8334/adopter_id
    chown system system /sys/class/mhl/sii8334/device_id

    # For bridgemgr daemon to inform the USB driver of the correct transport
    chown radio radio /sys/class/android_usb/f_rmnet_smd_sdio/transport

    # For setting tcp delayed ack
    chown system system /sys/kernel/ipv4/tcp_delack_seg
    chown system system /sys/kernel/ipv4/tcp_use_userconfig

    # Define TCP delayed ack settings for WiFi & LTE
    setprop net.tcp.delack.default     1
    setprop net.tcp.delack.wifi        20
    setprop net.tcp.delack.lte         8
    setprop net.tcp.usercfg.default    0
    setprop net.tcp.usercfg.wifi       1
    setprop net.tcp.usercfg.lte        1

    # Assign TCP buffer thresholds to be ceiling value of technology maximums
    # Increased technology maximums should be reflected here.
    write /proc/sys/net/core/rmem_max 2097152
    write /proc/sys/net/core/wmem_max 2097152

    chmod 660 /dev/rtc0
    chown system system /dev/rtc0

    # To allow interfaces to get v6 address when tethering is enabled
    write /proc/sys/net/ipv6/conf/rmnet0/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet1/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet2/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet3/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet4/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet5/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet6/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet7/accept_ra 2

    # To prevent out of order acknowledgements from making
    # connection tracking to treat them as not belonging to
    # the connection they belong to.
    # Otherwise, a weird issue happens in which some long
    # connections on high-throughput links get dropped when
    # an ack packet comes out of order
    write /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal 1

    # Set the console loglevel to < KERN_INFO
    # Set the default message loglevel to KERN_INFO
    write /proc/sys/kernel/printk "6 6 1 7"

    chown system /sys/devices/virtual/timed_output/vibrator/vtg_level

    # charger
    chown root system /sys/module/qpnp_charger/parameters/charger_monitor
    chown root system /sys/class/power_supply/battery/input_current_max
    chown root system /sys/class/power_supply/battery/input_current_trim
    chown root system /sys/class/power_supply/battery/voltage_min
    chmod 0644 /sys/module/qpnp_charger/parameters/charger_monitor
    chmod 0644 /sys/class/power_supply/battery/input_current_max
    chmod 0644 /sys/class/power_supply/battery/input_current_trim
    chmod 0644 /sys/class/power_supply/battery/voltage_min

    # thermananger
    chmod 0644 /sys/class/power_supply/usb/current_max

    chown system system /sys/devices/virtual/graphics/fb0/rgb
    chmod 0660 /sys/devices/virtual/graphics/fb0/rgb

    # Touchscreen
    chown system system /sys/devices/virtual/input/clearpad/wakeup_gesture
    chown system system /sys/devices/virtual/input/max1187x/wakeup_gesture

on post-fs
    # Change to socket location on libkeyctrl/suntory for /data encryption
    # Create suntory data directory
    mkdir /dev/socket/suntory 0755 system system
    mkdir /data/suntory 0755 system system

    # led RGB
    chown system system /sys/class/leds/rgb/sync_state
    chown system system /sys/class/leds/rgb/start_blink
    chown system system /sys/class/leds/led:rgb_red/brightness
    chown system system /sys/class/leds/led:rgb_red/lut_pwm
    chown system system /sys/class/leds/led:rgb_red/step_duration
    chown system system /sys/class/leds/led:rgb_red/pause_lo_multi
    chown system system /sys/class/leds/led:rgb_red/pause_hi_multi
    chown system system /sys/class/leds/led:rgb_green/brightness
    chown system system /sys/class/leds/led:rgb_green/lut_pwm
    chown system system /sys/class/leds/led:rgb_green/step_duration
    chown system system /sys/class/leds/led:rgb_green/pause_lo_multi
    chown system system /sys/class/leds/led:rgb_green/pause_hi_multi
    chown system system /sys/class/leds/led:rgb_blue/brightness
    chown system system /sys/class/leds/led:rgb_blue/lut_pwm
    chown system system /sys/class/leds/led:rgb_blue/step_duration
    chown system system /sys/class/leds/led:rgb_blue/pause_lo_multi
    chown system system /sys/class/leds/led:rgb_blue/pause_hi_multi

on post-fs-data
    # Observe dnsmasq.leases file for dhcp information of soft ap.
    chown dhcp dhcp /data/misc/dhcp

    mkdir /data/misc/bluetooth 0770 bluetooth bluetooth

    mkdir /data/tombstones 0755 system system
    mkdir /data/tombstones/vendor 0755 system system
    mkdir /data/pc 0700 radio radio

    # Create directory used by audio subsystem
    mkdir /data/misc/audio 0770 audio audio

    # IR Blaster
    chown system system /dev/ttyHSL2
    chmod 0660 /dev/ttyHSL2
    chown system system /sys/devices/platform/ir_remote_control/enable
    chmod 0220 /sys/devices/platform/ir_remote_control/enable

    chmod 0664 /sys/devices/platform/msm_sdcc.1/polling
    chmod 0664 /sys/devices/platform/msm_sdcc.2/polling
    chmod 0664 /sys/devices/platform/msm_sdcc.3/polling
    chmod 0664 /sys/devices/platform/msm_sdcc.4/polling

    # QCOM Sensors
    mkdir /data/system/sensors 0775 system system
    mkdir /data/misc/sensors 0775 system system
    write /data/system/sensors/settings 1
    chmod 664 /data/system/sensors/settings
    chown system /data/system/sensors/settings

    # Chown polling nodes as needed from UI running on system server
    chown system system /sys/devices/platform/msm_sdcc.1/polling
    chown system system /sys/devices/platform/msm_sdcc.2/polling
    chown system system /sys/devices/platform/msm_sdcc.3/polling
    chown system system /sys/devices/platform/msm_sdcc.4/polling

    chown system system /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/policy

    # Create directories for QuIPS
    mkdir /data/misc/quipc 0770 gps system

    # Create the directories used by the Wireless subsystem
    mkdir /data/vendor/wifi 0770 wifi wifi
    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi

    # Create directory used by bluetooth subsystem
    mkdir /data/vendor/bluetooth 2770 bluetooth bluetooth

    # Provide the access to hostapd.conf only to root and group
    chmod 0660 /data/hostapd/hostapd.conf

    mkdir /data/audio 0770 media audio

    # Enable Power save functionality for modem
    setprop persist.radio.add_power_save 1

    chown system /dev/block/platform/msm_sdcc.1/by-name

    setprop vold.post_fs_data_done 1

    # Create directory for TZ Apps
    mkdir /data/misc/qsee 0770 system system

    # Create directories for Location services
    mkdir /data/misc/location 0770 gps gps
    mkdir /data/misc/location/gpsone_d 0770 system gps
    mkdir /data/misc/location/gsiff 0770 gps gps
    mkdir /data/misc/location/mq 0770 gps gps
    mkdir /data/misc/location/quipc 0770 gps system
    mkdir /data/misc/location/xtra 0770 gps gps
    mkdir /data/misc/location/xtwifi 0770 gps gps

    # SONY: Create a dir on data partition not to be deleted during mr and wipedata
    mkdir /data/persist 0770 system system

    # SONY: Create dir for Widevine keybox
    mkdir /data/persist/wv 0700 system system

    # SONY: Create dir for marlin sdata
    mkdir /data/persist/marlin 0700 system system

    # SONY: Create a dir for pin-cache components
    mkdir /data/pc 0600 radio radio
    mkdir /cache/pc 0770 radio system

on property:bluetooth.isEnabled=true
#    start btwlancoex
    write /sys/class/bluetooth/hci0/idle_timeout 7000

# QMUX must be in multiple groups to support external process connections
service qmuxd /vendor/bin/qmuxd
    class main
    user root
    group radio audio bluetooth gps nfc diag wakelock oem_2950

# Wi-Fi and BT MAC addresses
service macaddrsetup /vendor/bin/macaddrsetup /sys/devices/platform/bcmdhd_wlan/macaddr
    class late_start
    user root
    oneshot

service netmgrd /vendor/bin/netmgrd
    class late_start
    user root
    group root wifi wakelock radio inet system
    seclabel u:r:netmgrd:s0

on property:ro.radio.noril=true
    stop ril-daemon
    stop netmgrd

service qseecomd /vendor/bin/qseecomd
    class core
    user root
    group drmrpc root

service wpa_supplicant /vendor/bin/hw/wpa_supplicant \
    -O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1 \
    -g@android:wpa_wlan0
    #   we will start as root and wpa_supplicant will switch to user wifi
    #   after setting up the capabilities required for WEXT
    #   user wifi
    #   group wifi inet keystore
    interface android.hardware.wifi.supplicant@1.0::ISupplicant default
    interface android.hardware.wifi.supplicant@1.1::ISupplicant default
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

on property:ro.data.large_tcp_window_size=true
    # Adjust socket buffer to enlarge TCP receive window for high bandwidth (e.g. DO-RevB)
    write /proc/sys/net/ipv4/tcp_adv_win_scale 2

service ril-daemon1 /vendor/bin/hw/rild -c 2
    class main
    user radio
    group radio cache inet misc audio log readproc wakelock
    capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW

on property:persist.radio.multisim.config=dsds
    start ril-daemon1

# Start suntrold
service suntrold /vendor/bin/suntrold
    user system
    group system camera
    oneshot
    class main

# Modem Log QMI service
service mlog_qmi_service /vendor/bin/mlog_qmi_service
    class core
    user root

service irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config"
    class main
    user root
    oneshot

service rmt_storage /vendor/bin/rmt_storage
    class core
    user root
    group system wakelock
    shutdown critical

service sensors /vendor/bin/sensors.qcom
    class core
    user root
    group root wakelock

service qcom-sensor-sh /vendor/bin/init.qcom-sensor.sh
    class main
    user root
    oneshot

# HexagonDSP FastRPC daemon
service adsprpcd /vendor/bin/adsprpcd
   class main
   user media
   group media
   seclabel u:r:adsprpcd:s0

service charger /system/bin/charger
    class charger
    user system
    group system graphics input
    capabilities SYS_BOOT
    seclabel u:r:charger:s0

# Redefined Service
service audioserver /system/bin/audioserver
    class main
    user audioserver
    # media gid needed for /dev/fm (radio) and for /data/misc/media (tee)
    group audio camera drmrpc inet media mediadrm net_bt bluetooth net_bw_acct oem_2950
    ioprio rt 4

service drm /system/bin/drmserver
    class main
    user drm
    group drm system inet drmrpc readproc


service media /system/bin/mediaserver
    class main
    user media
    group audio camera inet net_bt bluetooth net_bw_acct drmrpc mediadrm system
    ioprio rt 4

service mediadrm /system/bin/mediadrmserver
    class main
    user media
    group mediadrm drmrpc
    ioprio rt 4

service mpdecision /vendor/bin/mpdecision --avg_comp
    class main
    user root
    group root readproc
    disabled

# brcm-uim-sysfs (BT/FM/ANT+)
service uim /vendor/bin/brcm-uim-sysfs
    class late_start
    user root
    group bluetooth net_bt
    seclabel u:r:uim:s0

# Quick Charge
service hvdcp /vendor/bin/hvdcp
    class core
    user root
    disabled

# TFA9890 AMP
service tfa9890_amp /vendor/bin/tfa9890_amp
    class late_start
    user root
    group root
    oneshot