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
|
# Copyright (c) 2009-2012, 2014, 2016, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
import init.target.power.rc
on early-init
#set non-stand-charger can used
write /sys/module/phy_msm_usb/parameters/floated_charger_enable Y
on boot
# Torch
chown system camera /sys/class/leds/torch-light0/brightness
chown system camera /sys/class/leds/flashlight/brightness
chmod 0660 /sys/class/leds/torch-light0/brightness
chmod 0660 /sys/class/leds/flashlight/brightness
# charger
chown system system /sys/bus/i2c/drivers/lc709203/batt_capacity
chmod 0660 /sys/bus/i2c/drivers/lc709203/batt_capacity
chown root system /sys/class/power_supply/bms/current_now
chown root system /sys/class/power_supply/bms/voltage_ocv
chmod 0664 /sys/class/power_supply/bms/current_now
chmod 0664 /sys/class/power_supply/bms/voltage_ocv
# stk3x1x light
chown system system /sys/class/sensors/stk3x1x-light/calibrate
chown system system /sys/class/sensors/stk3x1x-light/enable
chown system system /sys/class/sensors/stk3x1x-light/enable_wakeup
chown system system /sys/class/sensors/stk3x1x-light/flush
chown system system /sys/class/sensors/stk3x1x-light/max_latency
chown system system /sys/class/sensors/stk3x1x-light/poll_delay
chmod 0664 /sys/class/sensors/stk3x1x-light/calibrate
chmod 0664 /sys/class/sensors/stk3x1x-light/enable
chmod 0664 /sys/class/sensors/stk3x1x-light/enable_wakeup
chmod 0664 /sys/class/sensors/stk3x1x-light/flush
chmod 0664 /sys/class/sensors/stk3x1x-light/max_latency
chmod 0664 /sys/class/sensors/stk3x1x-light/poll_delay
# stk3x1x proximity
chown system system /sys/class/sensors/stk3x1x-proximity/calibrate
chown system system /sys/class/sensors/stk3x1x-proximity/enable
chown system system /sys/class/sensors/stk3x1x-proximity/enable_wakeup
chown system system /sys/class/sensors/stk3x1x-proximity/flush
chown system system /sys/class/sensors/stk3x1x-proximity/max_latency
chown system system /sys/class/sensors/stk3x1x-proximity/poll_delay
chmod 0664 /sys/class/sensors/stk3x1x-proximity/calibrate
chmod 0664 /sys/class/sensors/stk3x1x-proximity/enable
chmod 0664 /sys/class/sensors/stk3x1x-proximity/enable_wakeup
chmod 0664 /sys/class/sensors/stk3x1x-proximity/flush
chmod 0664 /sys/class/sensors/stk3x1x-proximity/max_latency
chmod 0664 /sys/class/sensors/stk3x1x-proximity/poll_delay
# BMA
chown system system /sys/class/sensors/bma2x2-accel/calibrate
chown system system /sys/class/sensors/bma2x2-accel/enable
chown system system /sys/class/sensors/bma2x2-accel/enable_wakeup
chown system system /sys/class/sensors/bma2x2-accel/flush
chown system system /sys/class/sensors/bma2x2-accel/max_latency
chown system system /sys/class/sensors/bma2x2-accel/poll_delay
chmod 0664 /sys/class/sensors/bma2x2-accel/calibrate
chmod 0664 /sys/class/sensors/bma2x2-accel/enable
chmod 0664 /sys/class/sensors/bma2x2-accel/enable_wakeup
chmod 0664 /sys/class/sensors/bma2x2-accel/flush
chmod 0664 /sys/class/sensors/bma2x2-accel/max_latency
chmod 0664 /sys/class/sensors/bma2x2-accel/poll_delay
# Set per_process_reclaim tuning parameters
write /sys/module/process_reclaim/parameters/enable_process_reclaim 1
write /sys/module/process_reclaim/parameters/pressure_min 50
write /sys/module/process_reclaim/parameters/pressure_max 70
write /sys/module/process_reclaim/parameters/per_swap_size 512
write /sys/module/process_reclaim/parameters/swap_opt_eff 30
write /sys/block/mmcblk0/queue/add_random 0
write /sys/block/mmcblk0/queue/iosched/slice_idle 0
write /sys/block/mmcblk0/bdi/read_ahead_kb 128
on post-fs-data
mkdir /data/dpm/nsrm 0771 system system
chown system system /data/dpm/nsrm
on init
on property:service.bootanim.exit=1
# Enable swap
write /sys/block/zram0/comp_algorithm lz4
swapon_all fstab.qcom
write /proc/sys/vm/page-cluster 0
write /proc/sys/vm/swappiness 100
service calibacc /system/bin/accelcal
class main
oneshot
disabled
on property:sys.sensors.acc=*
start calibacc
service charger /charger
class charger
group log
service vm_bms /system/bin/vm_bms
class core
user root
group root
on charger
wait /dev/block/bootdevice/by-name/system
mount ext4 /dev/block/bootdevice/by-name/system /system ro barrier=1
chown root system /sys/class/power_supply/bms/current_now
chown root system /sys/class/power_supply/bms/voltage_ocv
chmod 0664 /sys/class/power_supply/bms/current_now
chmod 0664 /sys/class/power_supply/bms/voltage_ocv
write /sys/module/lpm_levels/system/cpu0/wfi/idle_enabled Y
write /sys/module/lpm_levels/system/cpu1/wfi/idle_enabled Y
write /sys/module/lpm_levels/system/cpu2/wfi/idle_enabled Y
write /sys/module/lpm_levels/system/cpu3/wfi/idle_enabled Y
write /sys/module/lpm_levels/system/cpu0/standalone_pc/idle_enabled Y
write /sys/module/lpm_levels/system/cpu1/standalone_pc/idle_enabled Y
write /sys/module/lpm_levels/system/cpu2/standalone_pc/idle_enabled Y
write /sys/module/lpm_levels/system/cpu3/standalone_pc/idle_enabled Y
write /sys/module/lpm_levels/system/cpu0/pc/idle_enabled Y
write /sys/module/lpm_levels/system/cpu1/pc/idle_enabled Y
write /sys/module/lpm_levels/system/cpu2/pc/idle_enabled Y
write /sys/module/lpm_levels/system/cpu3/pc/idle_enabled Y
write /sys/module/lpm_levels/system/cpu0/pc/suspend_enabled N
write /sys/module/lpm_levels/system/cpu1/pc/suspend_enabled Y
write /sys/module/lpm_levels/system/cpu2/pc/suspend_enabled Y
write /sys/module/lpm_levels/system/cpu3/pc/suspend_enabled Y
write /sys/module/lpm_levels/system/l2-pc/idle_enabled Y
write /sys/module/lpm_levels/system/l2-cache-active/idle_enabled Y
write /sys/module/lpm_levels/system/l2-pc/suspend_enabled Y
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ondemand
start vm_bms
service sensord /system/bin/sensord
class main
user root
on property:init.svc.zygote=restarting
restart sensord
service calibacc /system/bin/accelcal
class main
oneshot
disabled
on property:sys.sensors.acc=*
start calibacc
on property:sys.boot_completed=1
# Temp hack to fix torch not being registered on boot
restart media
|