Zvikomborero VIncent Zvikaramba | a25011a | 2016-07-21 16:32:35 -0400 | [diff] [blame] | 1 | #!/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 | |
| 29 | target=`getprop ro.board.platform` |
| 30 | if [ -f /sys/devices/soc0/soc_id ]; then |
| 31 | platformid=`cat /sys/devices/soc0/soc_id` |
| 32 | else |
| 33 | platformid=`cat /sys/devices/system/soc/soc0/id` |
| 34 | fi |
| 35 | # |
| 36 | # Function to start sensors for DSPS enabled platforms |
| 37 | # |
| 38 | start_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 | |
| 52 | start_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 0660 /sys/module/qpnp_bms/parameters/* |
| 61 | chmod 0660 /sys/module/pm8921_bms/parameters/* |
| 62 | mkdir -p /data/bms |
| 63 | chown -h root.system /data/bms |
| 64 | chmod 0770 /data/bms |
| 65 | start battery_monitor |
| 66 | fi |
| 67 | } |
| 68 | |
| 69 | start_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 0664 /sys/class/power_supply/battery/input_current_max |
| 78 | chmod 0664 /sys/class/power_supply/battery/input_current_trim |
| 79 | chmod 0664 /sys/class/power_supply/battery/input_current_settled |
| 80 | chmod 0664 /sys/class/power_supply/battery/voltage_min |
| 81 | chmod 0664 /sys/module/qpnp_charger/parameters/charger_monitor |
| 82 | start charger_monitor |
| 83 | fi |
| 84 | } |
| 85 | |
| 86 | start_msm_irqbalance_8939() |
| 87 | { |
| 88 | if [ -f /system/bin/msm_irqbalance ]; then |
| 89 | case "$platformid" in |
| 90 | "239" | "241" | "263" | "268" | "269" | "270" | "271") |
| 91 | start msm_irqbalance;; |
| 92 | esac |
| 93 | fi |
| 94 | } |
| 95 | |
| 96 | start_msm_irqbalance() |
| 97 | { |
| 98 | if [ -f /system/bin/msm_irqbalance ]; then |
| 99 | start msm_irqbalance |
| 100 | fi |
| 101 | } |
| 102 | |
| 103 | baseband=`getprop ro.baseband` |
| 104 | # |
| 105 | # Suppress default route installation during RA for IPV6; user space will take |
| 106 | # care of this |
| 107 | # exception default ifc |
| 108 | for file in /proc/sys/net/ipv6/conf/* |
| 109 | do |
| 110 | echo 0 > $file/accept_ra_defrtr |
| 111 | done |
| 112 | echo 1 > /proc/sys/net/ipv6/conf/default/accept_ra_defrtr |
| 113 | |
| 114 | case "$baseband" in |
| 115 | "svlte2a") |
| 116 | start bridgemgrd |
| 117 | ;; |
| 118 | esac |
| 119 | |
| 120 | start_sensors |
| 121 | |
| 122 | case "$target" in |
| 123 | "msm7630_surf" | "msm7630_1x" | "msm7630_fusion") |
| 124 | if [ -f /sys/devices/soc0/hw_platform ]; then |
| 125 | value=`cat /sys/devices/soc0/hw_platform` |
| 126 | else |
| 127 | value=`cat /sys/devices/system/soc/soc0/hw_platform` |
| 128 | fi |
| 129 | case "$value" in |
| 130 | "Fluid") |
| 131 | start profiler_daemon;; |
| 132 | esac |
| 133 | ;; |
| 134 | "msm8660" ) |
| 135 | if [ -f /sys/devices/soc0/hw_platform ]; then |
| 136 | platformvalue=`cat /sys/devices/soc0/hw_platform` |
| 137 | else |
| 138 | platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform` |
| 139 | fi |
| 140 | case "$platformvalue" in |
| 141 | "Fluid") |
| 142 | start profiler_daemon;; |
| 143 | esac |
| 144 | ;; |
| 145 | "msm8960") |
| 146 | case "$baseband" in |
| 147 | "msm") |
| 148 | start_battery_monitor;; |
| 149 | esac |
| 150 | |
| 151 | if [ -f /sys/devices/soc0/hw_platform ]; then |
| 152 | platformvalue=`cat /sys/devices/soc0/hw_platform` |
| 153 | else |
| 154 | platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform` |
| 155 | fi |
| 156 | case "$platformvalue" in |
| 157 | "Fluid") |
| 158 | start profiler_daemon;; |
| 159 | "Liquid") |
| 160 | start profiler_daemon;; |
| 161 | esac |
| 162 | ;; |
| 163 | "msm8974") |
| 164 | platformvalue=`cat /sys/devices/soc0/hw_platform` |
| 165 | case "$platformvalue" in |
| 166 | "Fluid") |
| 167 | start profiler_daemon;; |
| 168 | "Liquid") |
| 169 | start profiler_daemon;; |
| 170 | esac |
| 171 | case "$baseband" in |
| 172 | "msm") |
| 173 | start_battery_monitor |
| 174 | ;; |
| 175 | esac |
| 176 | start_charger_monitor |
| 177 | ;; |
| 178 | "apq8084") |
| 179 | platformvalue=`cat /sys/devices/soc0/hw_platform` |
| 180 | case "$platformvalue" in |
| 181 | "Fluid") |
| 182 | start profiler_daemon;; |
| 183 | "Liquid") |
| 184 | start profiler_daemon;; |
| 185 | esac |
| 186 | ;; |
| 187 | "msm8226") |
| 188 | start_charger_monitor |
| 189 | ;; |
| 190 | "msm8610") |
| 191 | start_charger_monitor |
| 192 | ;; |
| 193 | "msm8916") |
| 194 | start_msm_irqbalance_8939 |
| 195 | ;; |
| 196 | "msm8994") |
| 197 | start_msm_irqbalance |
| 198 | ;; |
| 199 | "msm8909") |
| 200 | ;; |
| 201 | esac |
| 202 | |
| 203 | bootmode=`getprop ro.bootmode` |
| 204 | emmc_boot=`getprop ro.boot.emmc` |
| 205 | case "$emmc_boot" |
| 206 | in "true") |
| 207 | if [ "$bootmode" != "charger" ]; then # start rmt_storage and rfs_access |
| 208 | start rmt_storage |
| 209 | start rfs_access |
| 210 | fi |
| 211 | ;; |
| 212 | esac |