blob: a673b5a7d499f4b80f6dfce8e772bd897fc9da4e [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
35#
36# Function to start sensors for DSPS enabled platforms
37#
38start_sensors()
39{
40 if [ -c /dev/msm_dsps -o -c /dev/sensors ]; then
41 chmod -h 775 /persist/sensors
42 chmod -h 664 /persist/sensors/sensors_settings
43 chown -h system.root /persist/sensors/sensors_settings
44
45 mkdir -p /data/misc/sensors
46 chmod -h 775 /data/misc/sensors
47
48 start sensors
49 fi
50}
51
52start_battery_monitor()
53{
54 if ls /sys/bus/spmi/devices/qpnp-bms-*/fcc_data ; then
55 chown -h root.system /sys/module/pm8921_bms/parameters/*
56 chown -h root.system /sys/module/qpnp_bms/parameters/*
57 chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_data
58 chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_temp
59 chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_chgcyl
60 chmod -h 0660 /sys/module/qpnp_bms/parameters/*
61 chmod -h 0660 /sys/module/pm8921_bms/parameters/*
62 mkdir -p /data/bms
63 chown -h root.system /data/bms
64 chmod -h 0770 /data/bms
65 start battery_monitor
66 fi
67}
68
69start_charger_monitor()
70{
71 if ls /sys/module/qpnp_charger/parameters/charger_monitor; then
72 chown -h root.system /sys/module/qpnp_charger/parameters/*
73 chown -h root.system /sys/class/power_supply/battery/input_current_max
74 chown -h root.system /sys/class/power_supply/battery/input_current_trim
75 chown -h root.system /sys/class/power_supply/battery/input_current_settled
76 chown -h root.system /sys/class/power_supply/battery/voltage_min
77 chmod -h 0664 /sys/class/power_supply/battery/input_current_max
78 chmod -h 0664 /sys/class/power_supply/battery/input_current_trim
79 chmod -h 0664 /sys/class/power_supply/battery/input_current_settled
80 chmod -h 0664 /sys/class/power_supply/battery/voltage_min
81 chmod -h 0664 /sys/module/qpnp_charger/parameters/charger_monitor
82 start charger_monitor
83 fi
84}
85
86start_vm_bms()
87{
88 if [ -e /dev/vm_bms ]; then
89 chown -h root.system /sys/class/power_supply/bms/current_now
90 chown -h root.system /sys/class/power_supply/bms/voltage_ocv
91 chmod -h 0664 /sys/class/power_supply/bms/current_now
92 chmod -h 0664 /sys/class/power_supply/bms/voltage_ocv
93 start vm_bms
94 fi
95}
96
97start_msm_irqbalance()
98{
99 if [ -f /system/bin/msm_irqbalance ]; then
100 case "$platformid" in
101 "239")
102 start msm_irqbalance;;
103 esac
104 fi
105}
106
107baseband=`getprop ro.baseband`
108#
109# Suppress default route installation during RA for IPV6; user space will take
110# care of this
111# exception default ifc
112for file in /proc/sys/net/ipv6/conf/*
113do
114 echo 0 > $file/accept_ra_defrtr
115done
116echo 1 > /proc/sys/net/ipv6/conf/default/accept_ra_defrtr
117
118case "$baseband" in
119 "svlte2a")
120 start bridgemgrd
121 ;;
122esac
123
124start_sensors
125
126case "$target" in
127 "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
128 if [ -f /sys/devices/soc0/hw_platform ]; then
129 value=`cat /sys/devices/soc0/hw_platform`
130 else
131 value=`cat /sys/devices/system/soc/soc0/hw_platform`
132 fi
133 case "$value" in
134 "Fluid")
135 start profiler_daemon;;
136 esac
137 ;;
138 "msm8660" )
139 if [ -f /sys/devices/soc0/hw_platform ]; then
140 platformvalue=`cat /sys/devices/soc0/hw_platform`
141 else
142 platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform`
143 fi
144 case "$platformvalue" in
145 "Fluid")
146 start profiler_daemon;;
147 esac
148 ;;
149 "msm8960")
150 case "$baseband" in
151 "msm")
152 start_battery_monitor;;
153 esac
154
155 if [ -f /sys/devices/soc0/hw_platform ]; then
156 platformvalue=`cat /sys/devices/soc0/hw_platform`
157 else
158 platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform`
159 fi
160 case "$platformvalue" in
161 "Fluid")
162 start profiler_daemon;;
163 "Liquid")
164 start profiler_daemon;;
165 esac
166 ;;
167 "msm8974")
168 platformvalue=`cat /sys/devices/soc0/hw_platform`
169 case "$platformvalue" in
170 "Fluid")
171 start profiler_daemon;;
172 "Liquid")
173 start profiler_daemon;;
174 esac
175 case "$baseband" in
176 "msm")
177 start_battery_monitor
178 ;;
179 esac
180 start_charger_monitor
181 ;;
182 "apq8084")
183 platformvalue=`cat /sys/devices/soc0/hw_platform`
184 case "$platformvalue" in
185 "Fluid")
186 start profiler_daemon;;
187 "Liquid")
188 start profiler_daemon;;
189 esac
190 ;;
191 "msm8226")
192 start_charger_monitor
193 ;;
194 "msm8610")
195 start_charger_monitor
196 ;;
197 "msm8916")
198 start_vm_bms
199 start_msm_irqbalance
200 ;;
201esac