blob: 8aea228d71964c1a0dc63930136134911564ad62 [file] [log] [blame]
Zvikomborero VIncent Zvikarambaa25011a2016-07-21 16:32:35 -04001#!/system/bin/sh
2# Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are met:
6# * Redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer.
8# * Redistributions in binary form must reproduce the above copyright
9# notice, this list of conditions and the following disclaimer in the
10# documentation and/or other materials provided with the distribution.
11# * Neither the name of The Linux Foundation nor
12# the names of its contributors may be used to endorse or promote
13# products derived from this software without specific prior written
14# permission.
15#
16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28
29target=`getprop ro.board.platform`
30if [ -f /sys/devices/soc0/soc_id ]; then
31 platformid=`cat /sys/devices/soc0/soc_id`
32else
33 platformid=`cat /sys/devices/system/soc/soc0/id`
34fi
Zvikomborero VIncent Zvikaramba864e8852016-07-22 18:29:01 -040035
Zvikomborero VIncent Zvikarambaa25011a2016-07-21 16:32:35 -040036#
37# Function to start sensors for DSPS enabled platforms
38#
39start_sensors()
40{
41 if [ -c /dev/msm_dsps -o -c /dev/sensors ]; then
42 chmod -h 775 /persist/sensors
43 chmod -h 664 /persist/sensors/sensors_settings
44 chown -h system.root /persist/sensors/sensors_settings
45
46 mkdir -p /data/misc/sensors
47 chmod -h 775 /data/misc/sensors
48
49 start sensors
50 fi
51}
52
53start_battery_monitor()
54{
55 if ls /sys/bus/spmi/devices/qpnp-bms-*/fcc_data ; then
56 chown -h root.system /sys/module/pm8921_bms/parameters/*
57 chown -h root.system /sys/module/qpnp_bms/parameters/*
58 chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_data
59 chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_temp
60 chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_chgcyl
61 chmod 0660 /sys/module/qpnp_bms/parameters/*
62 chmod 0660 /sys/module/pm8921_bms/parameters/*
63 mkdir -p /data/bms
64 chown -h root.system /data/bms
65 chmod 0770 /data/bms
66 start battery_monitor
67 fi
68}
69
70start_charger_monitor()
71{
72 if ls /sys/module/qpnp_charger/parameters/charger_monitor; then
73 chown -h root.system /sys/module/qpnp_charger/parameters/*
74 chown -h root.system /sys/class/power_supply/battery/input_current_max
75 chown -h root.system /sys/class/power_supply/battery/input_current_trim
76 chown -h root.system /sys/class/power_supply/battery/input_current_settled
77 chown -h root.system /sys/class/power_supply/battery/voltage_min
78 chmod 0664 /sys/class/power_supply/battery/input_current_max
79 chmod 0664 /sys/class/power_supply/battery/input_current_trim
80 chmod 0664 /sys/class/power_supply/battery/input_current_settled
81 chmod 0664 /sys/class/power_supply/battery/voltage_min
82 chmod 0664 /sys/module/qpnp_charger/parameters/charger_monitor
83 start charger_monitor
84 fi
85}
86
87start_msm_irqbalance_8939()
88{
89 if [ -f /system/bin/msm_irqbalance ]; then
90 case "$platformid" in
91 "239" | "241" | "263" | "268" | "269" | "270" | "271")
92 start msm_irqbalance;;
93 esac
94 fi
95}
96
97start_msm_irqbalance()
98{
99 if [ -f /system/bin/msm_irqbalance ]; then
100 start msm_irqbalance
101 fi
102}
103
104baseband=`getprop ro.baseband`
105#
106# Suppress default route installation during RA for IPV6; user space will take
107# care of this
108# exception default ifc
109for file in /proc/sys/net/ipv6/conf/*
110do
111 echo 0 > $file/accept_ra_defrtr
112done
113echo 1 > /proc/sys/net/ipv6/conf/default/accept_ra_defrtr
114
115case "$baseband" in
116 "svlte2a")
117 start bridgemgrd
118 ;;
119esac
120
121start_sensors
122
123case "$target" in
124 "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
125 if [ -f /sys/devices/soc0/hw_platform ]; then
126 value=`cat /sys/devices/soc0/hw_platform`
127 else
128 value=`cat /sys/devices/system/soc/soc0/hw_platform`
129 fi
130 case "$value" in
131 "Fluid")
132 start profiler_daemon;;
133 esac
134 ;;
135 "msm8660" )
136 if [ -f /sys/devices/soc0/hw_platform ]; then
137 platformvalue=`cat /sys/devices/soc0/hw_platform`
138 else
139 platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform`
140 fi
141 case "$platformvalue" in
142 "Fluid")
143 start profiler_daemon;;
144 esac
145 ;;
146 "msm8960")
147 case "$baseband" in
148 "msm")
149 start_battery_monitor;;
150 esac
151
152 if [ -f /sys/devices/soc0/hw_platform ]; then
153 platformvalue=`cat /sys/devices/soc0/hw_platform`
154 else
155 platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform`
156 fi
157 case "$platformvalue" in
158 "Fluid")
159 start profiler_daemon;;
160 "Liquid")
161 start profiler_daemon;;
162 esac
163 ;;
164 "msm8974")
165 platformvalue=`cat /sys/devices/soc0/hw_platform`
166 case "$platformvalue" in
167 "Fluid")
168 start profiler_daemon;;
169 "Liquid")
170 start profiler_daemon;;
171 esac
172 case "$baseband" in
173 "msm")
174 start_battery_monitor
175 ;;
176 esac
177 start_charger_monitor
178 ;;
179 "apq8084")
180 platformvalue=`cat /sys/devices/soc0/hw_platform`
181 case "$platformvalue" in
182 "Fluid")
183 start profiler_daemon;;
184 "Liquid")
185 start profiler_daemon;;
186 esac
187 ;;
188 "msm8226")
189 start_charger_monitor
190 ;;
191 "msm8610")
192 start_charger_monitor
193 ;;
194 "msm8916")
195 start_msm_irqbalance_8939
196 ;;
197 "msm8994")
198 start_msm_irqbalance
199 ;;
200 "msm8909")
201 ;;
202esac
203
204bootmode=`getprop ro.bootmode`
205emmc_boot=`getprop ro.boot.emmc`
206case "$emmc_boot"
207 in "true")
208 if [ "$bootmode" != "charger" ]; then # start rmt_storage and rfs_access
209 start rmt_storage
210 start rfs_access
211 fi
212 ;;
213esac