aboutsummaryrefslogtreecommitdiff
path: root/rootdir/init.qcom.rc
blob: 8150c519762e6abfbb17f737ba658718a7e8d97a (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
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
#
# 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 init.device.rc
import init.sony.usb.rc

on early-init
    mount debugfs debugfs /sys/kernel/debug
    chown system system /sys/kernel/debug/kgsl/proc

on init
    mkdir /mnt/shell/emulated 0700 shell shell
    mkdir /storage/emulated 0555 root root
    mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
    mkdir /mnt/media_rw/usbdisk 0700 media_rw media_rw
    mkdir /storage/sdcard1 0775 system system
    mkdir /storage/usbdisk 0775 system system

    export EXTERNAL_STORAGE /storage/emulated/legacy
    export SECONDARY_STORAGE /storage/sdcard1
    export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
    export EMULATED_STORAGE_TARGET /storage/emulated

    # for backwards compatibility
    symlink /storage/emulated/legacy /sdcard
    symlink /storage/emulated/legacy /mnt/sdcard
    symlink /storage/emulated/legacy /storage/sdcard0
    symlink /mnt/shell/emulated/0 /storage/emulated/legacy
    symlink /storage/sdcard1 /ext_card
    symlink /storage/sdcard1 /mnt/ext_card
    symlink /storage/usbdisk /usbdisk
    symlink /storage/usbdisk /mnt/usbdisk

    mkdir /tmp
    mount tmpfs tmpfs /tmp nosuid mode=0755,uid=0,gid=0
    chmod 0664 /proc/rdtag
    chown root system /proc/rdtag

    mkdir /dev/bus 0755 root root
    mkdir /dev/bus/usb 0755 root root

    # create directory for scd
    mkdir /dev/socket/scd 0755 system system

    # Enable ramdumps from subsystems to dump
    # Should be initialized during init
    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"

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

    # 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
    mkdir /mnt/idd 0751 sony_idd sony_idd

    mount_all ./fstab.qcom
    setprop ro.crypto.fuse_sdcard true

    chown sony_idd sony_idd /mnt/idd
    chmod 0751 /mnt/idd

    mkdir /lta-label 0555 system system
    wait /dev/block/platform/msm_sdcc.1/by-name/LTALabel
    mount ext4 /dev/block/platform/msm_sdcc.1/by-name/LTALabel /lta-label nosuid nodev noatime noexec ro barrier=0
    chown system system /lta-label
    chmod 0555 /lta-label

    chmod 0755 /data/etc
    start tad
    exec /sbin/wait4tad_static
    exec /system/bin/taimport

    restorecon -R /data/etc

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

    write /sys/kernel/boot_adsp/boot 1

    start ta_qmi_service
    start sct_service

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

    exec /system/bin/sh /system/etc/init.qcom.wifi.sh

on boot
    write /sys/module/qpnp_power_on/parameters/forcecrash_on 1
    exec /system/bin/btnvtool -O
    chown bluetooth bluetooth /sys/module/bluetooth_power/parameters/power
    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
    chown bluetooth bluetooth /proc/bluetooth/sleep/proto
    chown bluetooth bluetooth /sys/module/hci_uart/parameters/ath_lpm
    chown bluetooth bluetooth /sys/module/hci_uart/parameters/ath_btwrite
    chown system system /sys/module/sco/parameters/disable_esco
    chown bluetooth bluetooth /sys/module/hci_smd/parameters/hcismd_set
    chmod 0660 /sys/module/bluetooth_power/parameters/power
    chmod 0660 /sys/module/hci_smd/parameters/hcismd_set
    chmod 0660 /sys/class/rfkill/rfkill0/state
    chmod 0660 /proc/bluetooth/sleep/proto
    chown bluetooth bluetooth /dev/ttyHS0
    chmod 0660 /sys/module/hci_uart/parameters/ath_lpm
    chmod 0660 /sys/module/hci_uart/parameters/ath_btwrite
    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

    chmod 0660 /dev/ttyHS2
    chown bluetooth bluetooth /dev/ttyHS2

    # Create QMUX deamon socket area
    mkdir /dev/socket/qmux_radio 0770 radio radio
    chmod 2770 /dev/socket/qmux_radio
    mkdir /dev/socket/qmux_audio 0770 media audio
    chmod 2770 /dev/socket/qmux_audio
    mkdir /dev/socket/qmux_bluetooth 0770 bluetooth net_bt_stack
    chmod 2770 /dev/socket/qmux_bluetooth
    mkdir /dev/socket/qmux_gps 0770 gps gps
    chmod 2770 /dev/socket/qmux_gps

    setprop ro.telephony.call_ring.multiple false

    # Remove SUID bit for iproute2 ip tool
    chmod 0755 /system/bin/ip

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

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

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

    # Remove write permissions to video related nodes
    chown system graphics /sys/class/graphics/fb1/hpd
    chown system system /sys/class/graphics/fb1/hdcp/tp
    chown system graphics /sys/class/graphics/fb1/vendor_name
    chown system graphics /sys/class/graphics/fb1/product_description
    chmod 0664 /sys/class/graphics/fb1/hpd
    chmod 0664 /sys/class/graphics/fb1/hdcp/tp
    chmod 0664 /sys/class/graphics/fb1/vendor_name
    chmod 0664 /sys/class/graphics/fb1/product_description
    chmod 0664 /sys/class/graphics/fb1/video_mode
    chmod 0664 /sys/class/graphics/fb1/format_3d

    # 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

    # Change permissions for fps_level nodes
    chown system graphics /sys/class/graphics/fb0/msm_fb_fps_level
    chown system graphics /sys/class/graphics/fb1/msm_fb_fps_level
    chown system graphics /sys/class/graphics/fb2/msm_fb_fps_level
    chmod 644 /sys/class/graphics/fb0/msm_fb_fps_level
    chmod 400 /sys/class/graphics/fb1/msm_fb_fps_level
    chmod 400 /sys/class/graphics/fb2/msm_fb_fps_level

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

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

    chown root system /proc/net/ip_conntrack

    # Enable DEBUG_SUSPEND, DEBUG_EXIT_SUSPEND, and DEBUG_WAKEUP
    write /sys/module/wakelock/parameters/debug_mask 7

    #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
    write /proc/sys/net/ipv6/conf/rmnet_sdio0/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_sdio1/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_sdio2/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_sdio3/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_sdio4/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_sdio5/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_sdio6/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_sdio7/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_usb0/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_usb1/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_usb2/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_usb3/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_usb0/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_usb1/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_usb2/accept_ra 2
    write /proc/sys/net/ipv6/conf/rmnet_usb3/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

    # NFC local data and nfcee xml storage
    mkdir /data/nfc 0770 nfc nfc
    mkdir /data/nfc/param 0770 nfc nfc

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

# QCOM Sensors
    insmod /system/lib/modules/adsprpc.ko
    mkdir /data/system 0775 system system
    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
    start sensors

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

on post-fs
    exec /system/bin/chargemon
    write /sys/class/power_supply/battery/enable_stop_charging_at_low_battery 1

    # Change to socket location on libkeyctrl/suntory for /data encryption
    mkdir /dev/socket/suntory 0755 system system

# msm specific files that need to be created on /data
on post-fs-data
    mkdir /data/media 0770 media_rw media_rw

    # Create the directories used by the Wireless subsystem
    mkdir /data/misc/wifi 0770 wifi wifi
    mkdir /data/misc/wifi/sockets 0770 wifi wifi
    mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi
    mkdir /data/misc/dhcp 0770 dhcp dhcp
    # to observe dnsmasq.leases file for dhcp information of soft ap.
    chown dhcp dhcp /data/misc/dhcp

    # Update WIFI MAC address
    mkdir /data/misc/wifi/prima 0775 wifi wifi
    exec /system/bin/mac-update

    mkdir /data/credmgr 0700 system system
    mkdir /data/tombstones 0755 system system
    mkdir /data/tombstones/vendor 0755 system system
    mkdir /data/pc 0700 radio radio
    mkdir /data/persist 0770 system system

    # 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

    # 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 gpsone_daemon services
    mkdir /data/misc/gpsone_d 0770 system gps

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

    # Create directories for Location services
    mkdir /data/misc/location 0770 gps gps
    mkdir /data/misc/location/mq 0770 gps gps
    mkdir /data/misc/location/xtwifi 0770 gps gps

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

    mkdir /data/audio 0770 media audio

    # Create /data/time folder for time-services
    mkdir /data/time 0700 system system

    # 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

    rm /data/local/tmp/adreno_config.txt

    # communicate with mpdecision and thermald
    mkdir /dev/socket/mpdecision 0770 system system
    chmod 2770 /dev/socket/mpdecision

    # Enable Power modes and set the CPU Freq Sampling rates
    write /sys/module/lpm_resources/enable_low_power/l2 1
    write /sys/module/lpm_resources/enable_low_power/pxo 1
    write /sys/module/lpm_resources/enable_low_power/vdd_dig 1
    write /sys/module/lpm_resources/enable_low_power/vdd_mem 1
    write /sys/module/msm_pm/modes/cpu0/retention/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu1/retention/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu2/retention/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu3/retention/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled 1
    write /sys/module/msm_thermal/core_control/enabled 0
    write /sys/devices/system/cpu/cpu1/online 1
    write /sys/devices/system/cpu/cpu2/online 1
    write /sys/devices/system/cpu/cpu3/online 1

    # ondemand
    #write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "ondemand"
    #write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "ondemand"
    #write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "ondemand"
    #write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor "ondemand"
    #write /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate 50000
    #write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold 90
    #write /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy 1
    #write /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor 4
    #write /sys/devices/system/cpu/cpufreq/ondemand/down_differential 10
    #write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core 70
    #write /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core 3
    #write /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq 918000
    #write /sys/devices/system/cpu/cpufreq/ondemand/sync_freq 1026000
    #write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load 80
    #chown system /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
    #chown system /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
    #chown system /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy

    # interactive
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "interactive"
    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "interactive"
    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "interactive"
    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor "interactive"
    write /sys/devices/system/cpu/cpufreq/interactive/io_is_busy 1
    write /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay "20000 1400000:40000 1700000:20000"
    write /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load 90
    write /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq 1190400
    write /sys/devices/system/cpu/cpufreq/interactive/target_loads "85 1500000:90 1800000:70"
    write /sys/devices/system/cpu/cpufreq/interactive/min_sample_time 40000
    write /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor 100000

    write /sys/module/cpu_boost/parameters/boost_ms 20
    write /sys/module/cpu_boost/parameters/sync_threshold 1728000
    write /sys/module/cpu_boost/parameters/input_boost_freq 1497600
    write /sys/module/cpu_boost/parameters/input_boost_ms 40

    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq 300000
    chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    write /sys/module/msm_thermal/core_control/enabled 1
    chown root system /sys/devices/system/cpu/mfreq
    chmod 220 /sys/devices/system/cpu/mfreq
    chown root system /sys/devices/system/cpu/cpu1/online
    chown root system /sys/devices/system/cpu/cpu2/online
    chown root system /sys/devices/system/cpu/cpu3/online
    chmod 664 /sys/devices/system/cpu/cpu1/online
    chmod 664 /sys/devices/system/cpu/cpu2/online
    chmod 664 /sys/devices/system/cpu/cpu3/online
    write /dev/cpuctl/apps/cpu.notify_on_migrate 1
    # set DCVS parameters for CPU
    write /sys/module/msm_dcvs/cores/cpu0/slack_time_max_us 40000
    write /sys/module/msm_dcvs/cores/cpu0/slack_time_min_us 40000
    write /sys/module/msm_dcvs/cores/cpu0/em_win_size_min_us 100000
    write /sys/module/msm_dcvs/cores/cpu0/em_win_size_max_us 500000
    write /sys/module/msm_dcvs/cores/cpu0/slack_mode_dynamic 0
    write /sys/module/msm_dcvs/cores/cpu0/disable_pc_threshold 1000000
    write /sys/module/msm_dcvs/cores/cpu1/slack_time_max_us 25000
    write /sys/module/msm_dcvs/cores/cpu1/slack_time_min_us 25000
    write /sys/module/msm_dcvs/cores/cpu1/em_win_size_min_us 100000
    write /sys/module/msm_dcvs/cores/cpu1/em_win_size_max_us 500000
    write /sys/module/msm_dcvs/cores/cpu1/slack_mode_dynamic 0
    write /sys/module/msm_dcvs/cores/cpu1/disable_pc_threshold 1000000
    write /sys/module/msm_dcvs/cores/cpu2/slack_time_max_us 25000
    write /sys/module/msm_dcvs/cores/cpu2/slack_time_min_us 25000
    write /sys/module/msm_dcvs/cores/cpu2/em_win_size_min_us 100000
    write /sys/module/msm_dcvs/cores/cpu2/em_win_size_max_us 500000
    write /sys/module/msm_dcvs/cores/cpu2/slack_mode_dynamic 0
    write /sys/module/msm_dcvs/cores/cpu2/disable_pc_threshold 1000000
    write /sys/module/msm_dcvs/cores/cpu3/slack_time_max_us 25000
    write /sys/module/msm_dcvs/cores/cpu3/slack_time_min_us 25000
    write /sys/module/msm_dcvs/cores/cpu3/em_win_size_min_us 100000
    write /sys/module/msm_dcvs/cores/cpu3/em_win_size_max_us 500000
    write /sys/module/msm_dcvs/cores/cpu3/slack_mode_dynamic 0
    write /sys/module/msm_dcvs/cores/cpu3/disable_pc_threshold 1000000
    # set DCVS parameters for GPU
    write /sys/module/msm_dcvs/cores/gpu0/slack_time_max_us 20000
    write /sys/module/msm_dcvs/cores/gpu0/slack_time_min_us 20000
    write /sys/module/msm_dcvs/cores/gpu0/slack_mode_dynamic 0
    # set msm_mpdecision parameters
    write /sys/module/msm_mpdecision/slack_time_max_us 45000
    write /sys/module/msm_mpdecision/slack_time_min_us 15000
    write /sys/module/msm_mpdecision/em_win_size_min_us 100000
    write /sys/module/msm_mpdecision/em_win_size_max_us 1000000
    write /sys/module/msm_mpdecision/online_util_pct_min 3
    write /sys/module/msm_mpdecision/online_util_pct_max 25
    write /sys/module/msm_mpdecision/em_max_util_pct 97
    write /sys/module/msm_mpdecision/rq_avg_poll_ms 2
    write /sys/module/msm_mpdecision/mp_em_rounding_point_min 10
    write /sys/module/msm_mpdecision/mp_em_rounding_point_max 85
    write /sys/module/msm_mpdecision/iowait_threshold_pct 50
    # set permissions for the nodes needed by display on/off hook
    chown system /sys/module/msm_dcvs/cores/cpu0/slack_time_max_us
    chown system /sys/module/msm_dcvs/cores/cpu0/slack_time_min_us
    chown system /sys/module/msm_mpdecision/slack_time_max_us
    chown system /sys/module/msm_mpdecision/slack_time_min_us
    chmod 664 /sys/module/msm_dcvs/cores/cpu0/slack_time_max_us
    chmod 664 /sys/module/msm_dcvs/cores/cpu0/slack_time_min_us
    chmod 664 /sys/module/msm_mpdecision/slack_time_max_us
    chmod 664 /sys/module/msm_mpdecision/slack_time_min_us

    # SONY: Camera
    mkdir /data/camera 0770 media camera
    chown media camera /sys/devices/sony_camera_0/info
    chmod 0770 /sys/devices/sony_camera_0/info
    chown media camera /sys/devices/sony_camera_1/info
    chmod 0770 /sys/devices/sony_camera_1/info

on charger
    # Enable Power modes and set the CPU Freq Sampling rates
    write /sys/module/lpm_resources/enable_low_power/l2 1
    write /sys/module/lpm_resources/enable_low_power/pxo 1
    write /sys/module/lpm_resources/enable_low_power/vdd_dig 1
    write /sys/module/lpm_resources/enable_low_power/vdd_mem 1
    write /sys/module/msm_pm/modes/cpu0/retention/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled 1
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "powersave"
    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "powersave"
    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "powersave"
    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor "powersave"
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu1/online 0
    write /sys/devices/system/cpu/cpu2/online 0
    write /sys/devices/system/cpu/cpu3/online 0

on property:init.svc.wpa_supplicant=stopped
    stop dhcpcd

# Update WIFI MAC address
service mac-update /system/bin/mac-update
    class main
    user wifi
    oneshot

service hciattach /system/bin/sh /system/etc/init.qcom.bt.sh
    class late_start
    user bluetooth
    group qcom_oncrpc bluetooth net_bt_admin system net_bt_stack
    disabled
    oneshot

on property:bluetooth.hciattach=true
    start hciattach

on property:bluetooth.hciattach=false
    setprop bluetooth.status off

# QMUX must be in multiple groups to support external process connections
service qmuxd /system/bin/qmuxd
    class main
    user radio
    group radio audio bluetooth gps qcom_diag net_bt_stack

# SONY: TrimArea Daemon
# Last 2 args: start block(blk size 128k), number of blocks(partitionsize(kb)/128(kb))
service tad /sbin/tad_static /dev/block/mmcblk0 1,16
    class core
    user root
    group root
    socket tad stream 0660 system system
    disabled

service updatemiscta /system/bin/updatemiscta
    class main
    user root
    oneshot

service netmgrd /system/bin/netmgrd
    class main

# start GNS/Sensor interface daemon
service gsiff_daemon /system/bin/gsiff_daemon
    class late_start
    user gps
    group gps net_raw misc

service qrngd /system/bin/qrngd -f
    class main
    user root
    group root

service qrngp /system/bin/qrngp
    class main
    user root
    group root
    oneshot
    disabled

on property:sys.boot_completed=1
    start qrngp
    write /sys/block/mmcblk0/bdi/read_ahead_kb 512

service qseecomd /system/bin/qseecomd
    class core
    user root
    group root

service hw_config /system/bin/sh /system/etc/hw_config.sh
    class main
    user root
    oneshot

service wpa_supplicant /system/bin/wpa_supplicant \
    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
    -O/data/misc/wifi/sockets \
    -e/data/misc/wifi/entropy.bin -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
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

service p2p_supplicant /system/bin/wpa_supplicant \
    -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
    -I/system/etc/wifi/p2p_supplicant_overlay.conf -N \
    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
    -O/data/misc/wifi/sockets -puse_p2p_group_interface=1 \
    -e/data/misc/wifi/entropy.bin -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
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL
    class main
    disabled
    oneshot

service dhcpcd_p2p /system/bin/dhcpcd -aABKL
    class main
    disabled
    oneshot

service iprenew_wlan0 /system/bin/dhcpcd -n
    class main
    disabled
    oneshot

service iprenew_p2p /system/bin/dhcpcd -n
    class main
    disabled
    oneshot

service dhcpcd_bt-pan /system/bin/dhcpcd -BKLG
    disabled
    oneshot

service iprenew_bt-pan /system/bin/dhcpcd -n
    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

# virtual sdcard daemon running as media_rw (1023)
service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
    class late_start

service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
    class late_start
    disabled

service fuse_usbdisk /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/usbdisk /storage/usbdisk
    class late_start
    disabled

service mpdecision /system/bin/mpdecision --avg_comp
    class main
    user root

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

# bugreport is triggered by holding down volume down, volume up and power
service bugreport /system/bin/dumpstate -d -p -B \
        -o /data/data/com.android.shell/files/bugreports/bugreport
    class main
    disabled
    oneshot
    keycodes 114 115 116

service fm_dl /system/bin/sh /system/etc/init.qcom.fm.sh
    class late_start
    user root
    group system qcom_oncrpc
    disabled
    oneshot

service illumination /system/bin/illumination_service
    socket illumination stream 0660 system camera
    class main
    user root

service scd /system/bin/scd
    class main
    user system
    group system

# Secure Config Transfer service
service sct_service /system/bin/sct_service
    user root
    disabled

# Trim Area QMI service
service ta_qmi_service /system/bin/ta_qmi_service
    user root
    disabled

# Start system_monitor
service system_monitor /system/bin/system_monitor
    socket sysmon stream 0660 root system
    class core
    user root

service rmt_storage /system/bin/rmt_storage
    class core
    user root

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

service ppd /system/bin/mm-pp-daemon
    class late_start
    user system
    socket pps stream 0660 system system
    group system graphics qcom_diag
    disabled

service qcamerasvr /system/bin/mm-qcamera-daemon
    class late_start
    user camera
    group camera system inet input

service sensors /system/bin/sensors.qcom
    class main
    user root
    group root
    disabled

service wcnss-service /system/bin/wcnss_service
    class late_start
    user system
    group system wifi
    disabled
    oneshot

service time_daemon /system/bin/time_daemon
    class late_start
    user root
    group root radio qcom_diag

service ptt_socket_app /system/bin/ptt_socket_app
    class main
    user system
    group system
    oneshot

on property:init.svc.surfaceflinger=running
    start ppd

on property:init.svc.surfaceflinger=stopped
    stop ppd

# Powersave
on property:sys.perf.profile=0
    start mpdecision
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor conservative
    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor conservative
    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor conservative
    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor conservative
    write /sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor ondemand

# Balanced
on property:sys.perf.profile=1
    start mpdecision
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor interactive
    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor interactive
    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor interactive
    write /sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor ondemand

# High performance
on property:sys.perf.profile=2
    stop mpdecision
    write /sys/devices/system/cpu/cpu0/online 1
    write /sys/devices/system/cpu/cpu1/online 1
    write /sys/devices/system/cpu/cpu2/online 1
    write /sys/devices/system/cpu/cpu3/online 1
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor performance
    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor performance
    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor performance
    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor performance
    write /sys/class/kgsl/kgsl-3d0/pwrscale/trustzone/governor performance