Added missing init scripts
diff --git a/rootdir/Android.mk b/rootdir/Android.mk
index 9e7b259..423c2d4 100644
--- a/rootdir/Android.mk
+++ b/rootdir/Android.mk
@@ -71,7 +71,7 @@
LOCAL_MODULE_TAGS := optional eng
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)
-LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
+LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/etc/
include $(BUILD_PREBUILT)
######################
@@ -95,6 +95,26 @@
include $(BUILD_PREBUILT)
######################
+### init.qcom.post_boot.sh
+include $(CLEAR_VARS)
+LOCAL_MODULE := init.qcom.post_boot.sh
+LOCAL_MODULE_TAGS := optional eng
+LOCAL_MODULE_CLASS := ETC
+LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)
+LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/etc/
+include $(BUILD_PREBUILT)
+
+######################
+### init.qcom.sdio.sh
+include $(CLEAR_VARS)
+LOCAL_MODULE := init.qcom.sdio.sh
+LOCAL_MODULE_TAGS := optional eng
+LOCAL_MODULE_CLASS := ETC
+LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)
+LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/etc/
+include $(BUILD_PREBUILT)
+
+######################
### init.qcom.factory.sh
include $(CLEAR_VARS)
LOCAL_MODULE := init.qcom.factory.sh
@@ -105,6 +125,46 @@
include $(BUILD_PREBUILT)
######################
+### init.qcom.modem_links.sh
+include $(CLEAR_VARS)
+LOCAL_MODULE := init.qcom.modem_links.sh
+LOCAL_MODULE_TAGS := optional eng
+LOCAL_MODULE_CLASS := ETC
+LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)
+LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/etc/
+include $(BUILD_PREBUILT)
+
+######################
+### init.qcom.efs.sync.sh
+include $(CLEAR_VARS)
+LOCAL_MODULE := init.qcom.efs.sync.sh
+LOCAL_MODULE_TAGS := optional eng
+LOCAL_MODULE_CLASS := ETC
+LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)
+LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/etc/
+include $(BUILD_PREBUILT)
+
+######################
+### init.qcom.wifi.sh
+include $(CLEAR_VARS)
+LOCAL_MODULE := init.qcom.wifi.sh
+LOCAL_MODULE_TAGS := optional eng
+LOCAL_MODULE_CLASS := ETC
+LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)
+LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/etc/
+include $(BUILD_PREBUILT)
+
+######################
+### init.qcom.bt.sh
+include $(CLEAR_VARS)
+LOCAL_MODULE := init.qcom.bt.sh
+LOCAL_MODULE_TAGS := optional eng
+LOCAL_MODULE_CLASS := ETC
+LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)
+LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/etc/
+include $(BUILD_PREBUILT)
+
+######################
### init.qcom.syspart_fixup.sh
include $(CLEAR_VARS)
LOCAL_MODULE := init.qcom.syspart_fixup.sh
@@ -141,7 +201,7 @@
LOCAL_MODULE_TAGS := optional eng
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := etc/$(LOCAL_MODULE)
-LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
+LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/etc/
include $(BUILD_PREBUILT)
######################
diff --git a/rootdir/etc/init.qcom.bt.sh b/rootdir/etc/init.qcom.bt.sh
new file mode 100644
index 0000000..1a9f031
--- /dev/null
+++ b/rootdir/etc/init.qcom.bt.sh
@@ -0,0 +1,357 @@
+#!/system/bin/sh
+# Copyright (c) 2009-2013, 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.
+#
+
+#Read the arguments passed to the script
+config="$1"
+
+BLUETOOTH_SLEEP_PATH=/proc/bluetooth/sleep/proto
+LOG_TAG="qcom-bluetooth"
+LOG_NAME="${0}:"
+
+hciattach_pid=""
+
+loge ()
+{
+ /system/bin/log -t $LOG_TAG -p e "$LOG_NAME $@"
+}
+
+logi ()
+{
+ /system/bin/log -t $LOG_TAG -p i "$LOG_NAME $@"
+}
+
+failed ()
+{
+ loge "$1: exit code $2"
+ exit $2
+}
+
+program_bdaddr ()
+{
+ /system/bin/btnvtool -O
+ logi "Bluetooth Address programmed successfully"
+}
+
+#
+# enable bluetooth profiles dynamically
+#
+config_bt ()
+{
+ baseband=`getprop ro.baseband`
+ target=`getprop ro.board.platform`
+ if [ -f /sys/devices/soc0/soc_id ]; then
+ soc_hwid=`cat /sys/devices/soc0/soc_id`
+ else
+ soc_hwid=`cat /sys/devices/system/soc/soc0/id`
+ fi
+ btsoc=`getprop qcom.bluetooth.soc`
+
+ case $baseband in
+ "apq")
+ setprop ro.qualcomm.bluetooth.opp true
+ setprop ro.qualcomm.bluetooth.ftp true
+ setprop ro.qualcomm.bluetooth.nap false
+ setprop ro.bluetooth.sap false
+ setprop ro.bluetooth.dun false
+ # For MPQ as baseband is same for both
+ case $soc_hwid in
+ "130")
+ setprop ro.qualcomm.bluetooth.hsp true
+ setprop ro.qualcomm.bluetooth.hfp true
+ setprop ro.qualcomm.bluetooth.pbap false
+ setprop ro.qualcomm.bluetooth.map false
+ ;;
+ *)
+ setprop ro.qualcomm.bluetooth.hsp false
+ setprop ro.qualcomm.bluetooth.hfp false
+ setprop ro.qualcomm.bluetooth.pbap true
+ setprop ro.qualcomm.bluetooth.map true
+ ;;
+ esac
+ ;;
+ "mdm" | "svlte2a" | "svlte1" | "csfb")
+ setprop ro.qualcomm.bluetooth.opp true
+ setprop ro.qualcomm.bluetooth.hfp true
+ setprop ro.qualcomm.bluetooth.hsp true
+ setprop ro.qualcomm.bluetooth.pbap true
+ setprop ro.qualcomm.bluetooth.ftp true
+ setprop ro.qualcomm.bluetooth.map true
+ setprop ro.qualcomm.bluetooth.nap true
+ setprop ro.bluetooth.sap true
+ case $target in
+ "apq8084")
+ setprop ro.bluetooth.dun true
+ logi "Enabling BT-DUN for APQ8084"
+ ;;
+ *)
+ setprop ro.bluetooth.dun false
+ ;;
+ esac
+ ;;
+ "msm")
+ setprop ro.qualcomm.bluetooth.opp true
+ setprop ro.qualcomm.bluetooth.hfp true
+ setprop ro.qualcomm.bluetooth.hsp true
+ setprop ro.qualcomm.bluetooth.pbap true
+ setprop ro.qualcomm.bluetooth.ftp true
+ setprop ro.qualcomm.bluetooth.nap true
+ setprop ro.bluetooth.sap true
+ setprop ro.bluetooth.dun true
+ case $btsoc in
+ "ath3k")
+ setprop ro.qualcomm.bluetooth.map false
+ ;;
+ *)
+ setprop ro.qualcomm.bluetooth.map true
+ ;;
+ esac
+ ;;
+ *)
+ setprop ro.qualcomm.bluetooth.opp true
+ setprop ro.qualcomm.bluetooth.hfp true
+ setprop ro.qualcomm.bluetooth.hsp true
+ setprop ro.qualcomm.bluetooth.pbap true
+ setprop ro.qualcomm.bluetooth.ftp true
+ setprop ro.qualcomm.bluetooth.map true
+ setprop ro.qualcomm.bluetooth.nap true
+ setprop ro.bluetooth.sap true
+ setprop ro.bluetooth.dun true
+ ;;
+ esac
+
+ #Enable Bluetooth Profiles specific to target Dynamically
+ case $target in
+ "msm8960")
+ if [ "$btsoc" != "ath3k" ] && [ "$soc_hwid" != "130" ]
+ then
+ setprop ro.bluetooth.hfp.ver 1.6
+ setprop ro.qualcomm.bt.hci_transport smd
+ fi
+ ;;
+ "msm8974" | "msm8226" | "msm8610" | "msm8916" | "msm8909" )
+ if [ "$btsoc" != "ath3k" ]
+ then
+ setprop ro.bluetooth.hfp.ver 1.6
+ setprop ro.qualcomm.bt.hci_transport smd
+ fi
+ ;;
+ "apq8084" | "mpq8092" | "msm8994" )
+ if [ "$btsoc" != "rome" ]
+ then
+ setprop ro.qualcomm.bt.hci_transport smd
+ elif [ "$btsoc" = "rome" ]
+ then
+ setprop ro.bluetooth.hfp.ver 1.6
+ fi
+ ;;
+ *)
+ ;;
+ esac
+
+if [ -f /system/etc/bluetooth/stack.conf ]; then
+stack=`cat /system/etc/bluetooth/stack.conf`
+fi
+
+case "$stack" in
+ "bluez")
+ logi "Bluetooth stack is $stack"
+ setprop ro.qc.bluetooth.stack $stack
+ reason=`getprop vold.decrypt`
+ case "$reason" in
+ "trigger_restart_framework")
+ start dbus
+ ;;
+ esac
+ ;;
+ *)
+ logi "Bluetooth stack is Bluedroid"
+ ;;
+esac
+
+}
+
+start_hciattach ()
+{
+ /system/bin/hciattach -n $BTS_DEVICE $BTS_TYPE $BTS_BAUD &
+ hciattach_pid=$!
+ logi "start_hciattach: pid = $hciattach_pid"
+ echo 1 > $BLUETOOTH_SLEEP_PATH
+}
+
+kill_hciattach ()
+{
+ echo 0 > $BLUETOOTH_SLEEP_PATH
+ logi "kill_hciattach: pid = $hciattach_pid"
+ ## careful not to kill zero or null!
+ kill -TERM $hciattach_pid
+ # this shell doesn't exit now -- wait returns for normal exit
+}
+
+logi "init.qcom.bt.sh config = $config"
+case "$config" in
+ "onboot")
+ program_bdaddr
+ config_bt
+ exit 0
+ ;;
+ *)
+ ;;
+esac
+
+# mimic hciattach options parsing -- maybe a waste of effort
+USAGE="hciattach [-n] [-p] [-b] [-t timeout] [-s initial_speed] <tty> <type | id> [speed] [flow|noflow] [bdaddr]"
+
+while getopts "blnpt:s:" f
+do
+ case $f in
+ b | l | n | p) opt_flags="$opt_flags -$f" ;;
+ t) timeout=$OPTARG;;
+ s) initial_speed=$OPTARG;;
+ \?) echo $USAGE; exit 1;;
+ esac
+done
+shift $(($OPTIND-1))
+
+# Note that "hci_qcomm_init -e" prints expressions to set the shell variables
+# BTS_DEVICE, BTS_TYPE, BTS_BAUD, and BTS_ADDRESS.
+
+#Selectively Disable sleep
+BOARD=`getprop ro.board.platform`
+STACK=`getprop ro.qc.bluetooth.stack`
+
+# BR/EDR & LE power class configurations
+POWER_CLASS=`getprop qcom.bt.dev_power_class`
+LE_POWER_CLASS=`getprop qcom.bt.le_dev_pwr_class`
+
+# BR/EDR RF power backoff
+POWER_BACKOFF=`getprop qcom.bt.dev_power_backoff`
+
+#find the transport type
+TRANSPORT=`getprop ro.qualcomm.bt.hci_transport`
+logi "Transport : $TRANSPORT"
+case $STACK in
+ "bluez")
+ logi "** Bluez stack **"
+ ;;
+ *)
+ logi "** Bluedroid stack **"
+ setprop bluetooth.status off
+ ;;
+esac
+
+
+case $POWER_CLASS in
+ 1) PWR_CLASS="-p 0" ;
+ logi "Power Class: 1";;
+ 2) PWR_CLASS="-p 1" ;
+ logi "Power Class: 2";;
+ 3) PWR_CLASS="-p 2" ;
+ logi "Power Class: CUSTOM";;
+ *) PWR_CLASS="";
+ logi "Power Class: Ignored. Default(1) used (1-CLASS1/2-CLASS2/3-CUSTOM)";
+ logi "Power Class: To override, Before turning BT ON; setprop qcom.bt.dev_power_class <1 or 2 or 3>";;
+esac
+
+case $LE_POWER_CLASS in
+ 1) LE_PWR_CLASS="-P 0" ;
+ logi "LE Power Class: 1";;
+ 2) LE_PWR_CLASS="-P 1" ;
+ logi "LE Power Class: 2";;
+ 3) LE_PWR_CLASS="-P 2" ;
+ logi "LE Power Class: CUSTOM";;
+ *) LE_PWR_CLASS="-P 1";
+ logi "LE Power Class: Ignored. Default(2) used (1-CLASS1/2-CLASS2/3-CUSTOM)";
+ logi "LE Power Class: To override, Before turning BT ON; setprop qcom.bt.le_dev_pwr_class <1 or 2 or 3>";;
+esac
+
+case $POWER_BACKOFF in
+ 0) POWER_BACKOFF="-k 0" ;
+ logi "Power Backoff: 0";;
+ 1) POWER_BACKOFF="-k 1" ;
+ logi "Power Backoff: 1";;
+ 2) POWER_BACKOFF="-k 2" ;
+ logi "Power Backoff: 2";;
+ 3) POWER_BACKOFF="-k 3" ;
+ logi "Power Backoff: 3";;
+ *) POWER_BACKOFF="";
+ logi "Power Backoff: Ignored. Configuration in source code will be used";
+esac
+
+eval $(/system/bin/hci_qcomm_init -e $PWR_CLASS $LE_PWR_CLASS $POWER_BACKOFF && echo "exit_code_hci_qcomm_init=0" || echo "exit_code_hci_qcomm_init=1")
+
+case $exit_code_hci_qcomm_init in
+ 0) logi "Bluetooth QSoC firmware download succeeded, $BTS_DEVICE $BTS_TYPE $BTS_BAUD $BTS_ADDRESS";;
+ *) failed "Bluetooth QSoC firmware download failed" $exit_code_hci_qcomm_init;
+ case $STACK in
+ "bluez")
+ logi "** Bluez stack **"
+ ;;
+ *)
+ logi "** Bluedroid stack **"
+ setprop bluetooth.status off
+ ;;
+ esac
+
+ exit $exit_code_hci_qcomm_init;;
+esac
+
+# init does SIGTERM on ctl.stop for service
+trap "kill_hciattach" TERM INT
+
+case $TRANSPORT in
+ "smd")
+ case $STACK in
+ "bluez")
+ logi "** Bluez stack **"
+ echo 1 > /sys/module/hci_smd/parameters/hcismd_set
+ ;;
+ *)
+ logi "** Bluedroid stack **"
+ setprop bluetooth.status on
+ ;;
+ esac
+ ;;
+ *)
+ logi "start hciattach"
+ start_hciattach
+ case $STACK in
+ "bluez")
+ logi "Bluetooth is turning On with Bluez stack "
+ ;;
+ *)
+ logi "** Bluedroid stack **"
+ setprop bluetooth.status on
+ ;;
+ esac
+
+ wait $hciattach_pid
+ logi "Bluetooth stopped"
+ ;;
+esac
+
+exit 0
diff --git a/rootdir/etc/init.qcom.efs.sync.sh b/rootdir/etc/init.qcom.efs.sync.sh
new file mode 100644
index 0000000..e216b10
--- /dev/null
+++ b/rootdir/etc/init.qcom.efs.sync.sh
@@ -0,0 +1,34 @@
+#!/system/bin/sh
+# Copyright (c) 2012, 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 "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.
+#
+#
+
+PATH=/system/bin:$PATH
+export PATH
+cat /sys/devices/platform/rs300000a7.65536/force_sync
+cat /sys/devices/platform/rs300100a7.65536/force_sync
diff --git a/rootdir/etc/init.qcom.modem_links.sh b/rootdir/etc/init.qcom.modem_links.sh
new file mode 100644
index 0000000..5de8356
--- /dev/null
+++ b/rootdir/etc/init.qcom.modem_links.sh
@@ -0,0 +1,177 @@
+#!/system/bin/sh
+# Copyright (c) 2014, 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 "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.
+#
+#
+
+# No path is set up at this point so we have to do it here.
+PATH=/sbin:/system/sbin:/system/bin:/system/xbin
+export PATH
+
+# Check for images and set up symlinks
+cd /firmware/image
+
+# Get the list of files in /firmware/image
+# for which sym links have to be created
+
+fwfiles=`ls modem* adsp* wcnss* mba* venus* tima_*`
+
+# Check if the links with similar names
+# have been created in /system/etc/firmware
+
+cd /system/etc/firmware
+linksNeeded=1
+
+# For everyfile in fwfiles check if
+# the corresponding file exists
+for fwfile in $fwfiles; do
+
+ # if (condition) does not seem to work
+ # with the android shell. Therefore
+ # make do with case statements instead.
+ # if a file named $fwfile is present
+ # no need to create links. If the file
+ # with the name $fwfile is not present
+ # need to create links.
+
+ case `ls $fwfile` in
+ $fwfile)
+ continue;;
+ *)
+ # file with $fwfile does not exist
+ # need to create links
+ linksNeeded=1
+ break;;
+ esac
+
+done
+
+case $linksNeeded in
+ 1)
+ cd /firmware/image
+
+ case `ls modem.mdt 2>/dev/null` in
+ modem.mdt)
+ for imgfile in modem*; do
+ ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null
+ done
+ ;;
+ *)
+ # trying to log here but nothing will be logged since it is
+ # early in the boot process. Is there a way to log this message?
+ log -p w -t PIL no modem image found;;
+ esac
+
+ case `ls adsp.mdt 2>/dev/null` in
+ adsp.mdt)
+ for imgfile in adsp*; do
+ ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null
+ done
+ ;;
+ *)
+ log -p w -t PIL no adsp image found;;
+ esac
+
+ case `ls wcnss.mdt 2>/dev/null` in
+ wcnss.mdt)
+ for imgfile in wcnss*; do
+ ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null
+ done
+ ;;
+ *)
+ log -p w -t PIL no wcnss image found;;
+ esac
+
+ case `ls tima_pkm.mdt 2>/dev/null` in
+ tima_pkm.mdt)
+ for imgfile in tima_pkm*; do
+ ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null
+ done
+ ;;
+ *)
+ log -p w -t PIL 8974 device but no tima_pkm image found;;
+ esac
+
+ case `ls tima_lkm.mdt 2>/dev/null` in
+ tima_lkm.mdt)
+ for imgfile in tima_lkm*; do
+ ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null
+ done
+ ;;
+ *)
+ log -p w -t PIL 8974 device but no tima_lkm image found;;
+ esac
+
+ case `ls tima_atn.mdt 2>/dev/null` in
+ tima_atn.mdt)
+ for imgfile in tima_atn*; do
+ ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null
+ done
+ ;;
+ *)
+ log -p w -t PIL 8974 device but no tima_atn image found;;
+ esac
+
+ case `ls mba.mdt 2>/dev/null` in
+ mba.mdt)
+ for imgfile in mba*; do
+ ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null
+ done
+ ;;
+ *)
+ log -p w -t PIL no mba image found;;
+ esac
+
+ case `ls venus.mdt 2>/dev/null` in
+ venus.mdt)
+ for imgfile in venus*; do
+ ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null
+ done
+ ;;
+ *)
+ log -p w -t PIL no venus image found;;
+ esac
+
+ case `ls tz_otp.mdt 2>/dev/null` in
+ tz_otp.mdt)
+ for imgfile in tz_otp*; do
+ ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null
+ done
+ ;;
+ *)
+ log -p w -t PIL 8974 device but no tz_otp image found;;
+ esac
+
+ ;;
+
+ *)
+ # Nothing to do. No links needed
+ ;;
+esac
+
+cd /
+
diff --git a/rootdir/etc/init.qcom.post_boot.sh b/rootdir/etc/init.qcom.post_boot.sh
new file mode 100644
index 0000000..f01e105
--- /dev/null
+++ b/rootdir/etc/init.qcom.post_boot.sh
@@ -0,0 +1,1514 @@
+#!/system/bin/sh
+# Copyright (c) 2012-2013, 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.
+#
+
+target=`getprop ro.board.platform`
+case "$target" in
+ "msm7201a_ffa" | "msm7201a_surf" | "msm7627_ffa" | "msm7627_6x" | "msm7627a" | "msm7627_surf" | \
+ "qsd8250_surf" | "qsd8250_ffa" | "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "qsd8650a_st1x")
+ echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
+ ;;
+esac
+
+case "$target" in
+ "msm7201a_ffa" | "msm7201a_surf")
+ echo 500000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+ ;;
+esac
+
+case "$target" in
+ "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
+ echo 75000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+ echo 1 > /sys/module/pm2/parameters/idle_sleep_mode
+ ;;
+esac
+
+case "$target" in
+ "msm7201a_ffa" | "msm7201a_surf" | "msm7627_ffa" | "msm7627_6x" | "msm7627_surf" | "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "msm7627a" )
+ echo 245760 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ ;;
+esac
+
+case "$target" in
+ "msm8660")
+ echo 1 > /sys/module/rpm_resources/enable_low_power/L2_cache
+ echo 1 > /sys/module/rpm_resources/enable_low_power/pxo
+ echo 2 > /sys/module/rpm_resources/enable_low_power/vdd_dig
+ echo 2 > /sys/module/rpm_resources/enable_low_power/vdd_mem
+ echo 1 > /sys/module/rpm_resources/enable_low_power/rpm_cpu
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
+ echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
+ echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+ echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
+ echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
+ echo 4 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
+ echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ echo 384000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ chown -h system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
+ chown -h system /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
+ chown -h root.system /sys/devices/system/cpu/mfreq
+ chmod -h 220 /sys/devices/system/cpu/mfreq
+ chown -h root.system /sys/devices/system/cpu/cpu1/online
+ chmod -h 664 /sys/devices/system/cpu/cpu1/online
+ ;;
+esac
+
+case "$target" in
+ "msm8960")
+ echo 1 > /sys/module/rpm_resources/enable_low_power/L2_cache
+ echo 1 > /sys/module/rpm_resources/enable_low_power/pxo
+ echo 1 > /sys/module/rpm_resources/enable_low_power/vdd_dig
+ echo 1 > /sys/module/rpm_resources/enable_low_power/vdd_mem
+ echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
+ echo 0 > /sys/module/msm_thermal/core_control/enabled
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
+ echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
+ echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
+ echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+ echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
+ echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
+ echo 4 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
+ echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
+ echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
+ echo 3 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
+ echo 918000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
+ echo 1026000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
+ echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
+ chown -h system /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+ chown -h system /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
+ chown -h system /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
+ echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ echo 384000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
+ echo 384000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
+ echo 384000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ chown -h system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
+ chown -h system /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
+ chown -h system /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
+ chown -h system /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
+ chown -h system /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
+ chown -h system /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
+ echo 1 > /sys/module/msm_thermal/core_control/enabled
+ chown -h root.system /sys/devices/system/cpu/mfreq
+ chmod -h 220 /sys/devices/system/cpu/mfreq
+ chown -h root.system /sys/devices/system/cpu/cpu1/online
+ chown -h root.system /sys/devices/system/cpu/cpu2/online
+ chown -h root.system /sys/devices/system/cpu/cpu3/online
+ chmod -h 664 /sys/devices/system/cpu/cpu1/online
+ chmod -h 664 /sys/devices/system/cpu/cpu2/online
+ chmod -h 664 /sys/devices/system/cpu/cpu3/online
+ # set DCVS parameters for CPU
+ echo 40000 > /sys/module/msm_dcvs/cores/cpu0/slack_time_max_us
+ echo 40000 > /sys/module/msm_dcvs/cores/cpu0/slack_time_min_us
+ echo 100000 > /sys/module/msm_dcvs/cores/cpu0/em_win_size_min_us
+ echo 500000 > /sys/module/msm_dcvs/cores/cpu0/em_win_size_max_us
+ echo 0 > /sys/module/msm_dcvs/cores/cpu0/slack_mode_dynamic
+ echo 1000000 > /sys/module/msm_dcvs/cores/cpu0/disable_pc_threshold
+ echo 25000 > /sys/module/msm_dcvs/cores/cpu1/slack_time_max_us
+ echo 25000 > /sys/module/msm_dcvs/cores/cpu1/slack_time_min_us
+ echo 100000 > /sys/module/msm_dcvs/cores/cpu1/em_win_size_min_us
+ echo 500000 > /sys/module/msm_dcvs/cores/cpu1/em_win_size_max_us
+ echo 0 > /sys/module/msm_dcvs/cores/cpu1/slack_mode_dynamic
+ echo 1000000 > /sys/module/msm_dcvs/cores/cpu1/disable_pc_threshold
+ echo 25000 > /sys/module/msm_dcvs/cores/cpu2/slack_time_max_us
+ echo 25000 > /sys/module/msm_dcvs/cores/cpu2/slack_time_min_us
+ echo 100000 > /sys/module/msm_dcvs/cores/cpu2/em_win_size_min_us
+ echo 500000 > /sys/module/msm_dcvs/cores/cpu2/em_win_size_max_us
+ echo 0 > /sys/module/msm_dcvs/cores/cpu2/slack_mode_dynamic
+ echo 1000000 > /sys/module/msm_dcvs/cores/cpu2/disable_pc_threshold
+ echo 25000 > /sys/module/msm_dcvs/cores/cpu3/slack_time_max_us
+ echo 25000 > /sys/module/msm_dcvs/cores/cpu3/slack_time_min_us
+ echo 100000 > /sys/module/msm_dcvs/cores/cpu3/em_win_size_min_us
+ echo 500000 > /sys/module/msm_dcvs/cores/cpu3/em_win_size_max_us
+ echo 0 > /sys/module/msm_dcvs/cores/cpu3/slack_mode_dynamic
+ echo 1000000 > /sys/module/msm_dcvs/cores/cpu3/disable_pc_threshold
+ # set DCVS parameters for GPU
+ echo 20000 > /sys/module/msm_dcvs/cores/gpu0/slack_time_max_us
+ echo 20000 > /sys/module/msm_dcvs/cores/gpu0/slack_time_min_us
+ echo 0 > /sys/module/msm_dcvs/cores/gpu0/slack_mode_dynamic
+ # set msm_mpdecision parameters
+ echo 45000 > /sys/module/msm_mpdecision/slack_time_max_us
+ echo 15000 > /sys/module/msm_mpdecision/slack_time_min_us
+ echo 100000 > /sys/module/msm_mpdecision/em_win_size_min_us
+ echo 1000000 > /sys/module/msm_mpdecision/em_win_size_max_us
+ echo 3 > /sys/module/msm_mpdecision/online_util_pct_min
+ echo 25 > /sys/module/msm_mpdecision/online_util_pct_max
+ echo 97 > /sys/module/msm_mpdecision/em_max_util_pct
+ echo 2 > /sys/module/msm_mpdecision/rq_avg_poll_ms
+ echo 10 > /sys/module/msm_mpdecision/mp_em_rounding_point_min
+ echo 85 > /sys/module/msm_mpdecision/mp_em_rounding_point_max
+ echo 50 > /sys/module/msm_mpdecision/iowait_threshold_pct
+ #set permissions for the nodes needed by display on/off hook
+ chown -h system /sys/module/msm_dcvs/cores/cpu0/slack_time_max_us
+ chown -h system /sys/module/msm_dcvs/cores/cpu0/slack_time_min_us
+ chown -h system /sys/module/msm_mpdecision/slack_time_max_us
+ chown -h system /sys/module/msm_mpdecision/slack_time_min_us
+ chmod -h 664 /sys/module/msm_dcvs/cores/cpu0/slack_time_max_us
+ chmod -h 664 /sys/module/msm_dcvs/cores/cpu0/slack_time_min_us
+ chmod -h 664 /sys/module/msm_mpdecision/slack_time_max_us
+ chmod -h 664 /sys/module/msm_mpdecision/slack_time_min_us
+ if [ -f /sys/devices/soc0/soc_id ]; then
+ soc_id=`cat /sys/devices/soc0/soc_id`
+ else
+ soc_id=`cat /sys/devices/system/soc/soc0/id`
+ fi
+ case "$soc_id" in
+ "130")
+ echo 230 > /sys/class/gpio/export
+ echo 228 > /sys/class/gpio/export
+ echo 229 > /sys/class/gpio/export
+ echo "in" > /sys/class/gpio/gpio230/direction
+ echo "rising" > /sys/class/gpio/gpio230/edge
+ echo "in" > /sys/class/gpio/gpio228/direction
+ echo "rising" > /sys/class/gpio/gpio228/edge
+ echo "in" > /sys/class/gpio/gpio229/direction
+ echo "rising" > /sys/class/gpio/gpio229/edge
+ echo 253 > /sys/class/gpio/export
+ echo 254 > /sys/class/gpio/export
+ echo 257 > /sys/class/gpio/export
+ echo 258 > /sys/class/gpio/export
+ echo 259 > /sys/class/gpio/export
+ echo "out" > /sys/class/gpio/gpio253/direction
+ echo "out" > /sys/class/gpio/gpio254/direction
+ echo "out" > /sys/class/gpio/gpio257/direction
+ echo "out" > /sys/class/gpio/gpio258/direction
+ echo "out" > /sys/class/gpio/gpio259/direction
+ chown -h media /sys/class/gpio/gpio253/value
+ chown -h media /sys/class/gpio/gpio254/value
+ chown -h media /sys/class/gpio/gpio257/value
+ chown -h media /sys/class/gpio/gpio258/value
+ chown -h media /sys/class/gpio/gpio259/value
+ chown -h media /sys/class/gpio/gpio253/direction
+ chown -h media /sys/class/gpio/gpio254/direction
+ chown -h media /sys/class/gpio/gpio257/direction
+ chown -h media /sys/class/gpio/gpio258/direction
+ chown -h media /sys/class/gpio/gpio259/direction
+ echo 0 > /sys/module/rpm_resources/enable_low_power/vdd_dig
+ echo 0 > /sys/module/rpm_resources/enable_low_power/vdd_mem
+ ;;
+ esac
+ ;;
+esac
+
+case "$target" in
+ "msm8974")
+ echo 4 > /sys/module/lpm_levels/enable_low_power/l2
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/retention/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/retention/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/retention/idle_enabled
+ echo 0 > /sys/module/msm_thermal/core_control/enabled
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ if [ -f /sys/devices/soc0/soc_id ]; then
+ soc_id=`cat /sys/devices/soc0/soc_id`
+ else
+ soc_id=`cat /sys/devices/system/soc/soc0/id`
+ fi
+ case "$soc_id" in
+ "208" | "211" | "214" | "217" | "209" | "212" | "215" | "218" | "194" | "210" | "213" | "216")
+ for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
+ do
+ echo "cpubw_hwmon" > $devfreq_gov
+ done
+ echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo "interactive" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
+ echo "interactive" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
+ echo "interactive" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
+ echo "20000 1400000:40000 1700000:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
+ echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
+ echo 1190400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
+ echo 1 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
+ echo "85 1500000:90 1800000:70" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
+ echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
+ echo 20 > /sys/module/cpu_boost/parameters/boost_ms
+ echo 1728000 > /sys/module/cpu_boost/parameters/sync_threshold
+ echo 100000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
+ echo 1497600 > /sys/module/cpu_boost/parameters/input_boost_freq
+ echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
+ setprop ro.qualcomm.perf.cores_online 2
+ ;;
+ *)
+ echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
+ echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
+ echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
+ echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+ echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
+ echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
+ echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
+ echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
+ echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
+ echo 3 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
+ echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
+ echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
+ echo 1190400 > /sys/devices/system/cpu/cpufreq/ondemand/input_boost
+ echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
+ ;;
+ esac
+ echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ echo 300000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
+ echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
+ echo 300000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ echo 1 > /sys/module/msm_thermal/core_control/enabled
+ chown -h root.system /sys/devices/system/cpu/mfreq
+ chmod -h 220 /sys/devices/system/cpu/mfreq
+ chown -h root.system /sys/devices/system/cpu/cpu1/online
+ chown -h root.system /sys/devices/system/cpu/cpu2/online
+ chown -h root.system /sys/devices/system/cpu/cpu3/online
+ chmod -h 664 /sys/devices/system/cpu/cpu1/online
+ chmod -h 664 /sys/devices/system/cpu/cpu2/online
+ chmod -h 664 /sys/devices/system/cpu/cpu3/online
+ echo 1 > /dev/cpuctl/apps/cpu.notify_on_migrate
+ ;;
+esac
+
+case "$target" in
+ "msm8916")
+ # Change PM debug parameters permission
+ chown -h radio.system /sys/module/qpnp_power_on/parameters/reset_enabled
+ chown -h radio.system /sys/module/qpnp_power_on/parameters/wake_enabled
+ chown -h radio.system /sys/module/qpnp_int/parameters/debug_mask
+ chown -h radio.system /sys/module/lpm_levels/parameters/secdebug
+ chmod -h 664 /sys/module/qpnp_power_on/parameters/reset_enabled
+ chmod -h 664 /sys/module/qpnp_power_on/parameters/wake_enabled
+ chmod -h 664 /sys/module/qpnp_int/parameters/debug_mask
+ chmod -h 664 /sys/module/lpm_levels/parameters/secdebug
+ chmod -h 444 /sys/kernel/wakeup_reasons/last_resume_reason
+
+ if [ -f /sys/devices/soc0/soc_id ]; then
+ soc_id=`cat /sys/devices/soc0/soc_id`
+ else
+ soc_id=`cat /sys/devices/system/soc/soc0/id`
+ fi
+ case "$soc_id" in
+ "206" | "247" | "248" | "249" | "250")
+ echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ ;;
+ "239" | "241" | "263")
+ if [ -f /sys/devices/soc0/revision ]; then
+ revision=`cat /sys/devices/soc0/revision`
+ else
+ revision=`cat /sys/devices/system/soc/soc0/revision`
+ fi
+ case "$revision" in
+ "3.0")
+ echo N > /sys/module/lpm_levels/system/power/power-l2-gdhs/idle_enabled
+ echo N > /sys/module/lpm_levels/system/performance/performance-l2-gdhs/idle_enabled
+ ;;
+ esac
+ echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
+ echo 10 > /sys/class/net/rmnet0/queues/rx-0/rps_cpus
+ if [ -f /sys/devices/soc0/platform_subtype_id ]; then
+ platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
+ fi
+ if [ -f /sys/devices/soc0/hw_platform ]; then
+ hw_platform=`cat /sys/devices/soc0/hw_platform`
+ fi
+ case "$soc_id" in
+ "239")
+ case "$hw_platform" in
+ "Surf")
+ case "$platform_subtype_id" in
+ "1" | "2")
+ start hbtp
+ ;;
+ esac
+ ;;
+ "MTP")
+ case "$platform_subtype_id" in
+ "3")
+ start hbtp
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ "268" | "269" | "270" | "271")
+ echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
+ echo 10 > /sys/class/net/rmnet0/queues/rx-0/rps_cpus
+ ;;
+ "233" | "240" | "242")
+ echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ ;;
+ esac
+
+ #control daemon for xosd
+ factory_mode=`getprop ro.factory.factory_binary`
+ if [ "$factory_mode" != "factory" ]; then
+ product_name=`getprop ro.product.name`
+ case "$product_name" in
+ a8*)
+ jig_mode=`cat /sys/class/sec/switch/attached_dev`
+ case "$jig_mode" in
+ "JIG UART ON" | "JIG UART OFF" | "JIG UART OFF/VB")
+ echo "PM: JIG UART" > /dev/kmsg
+ ;;
+ *)
+ echo "PM: stop at_distributor" > /dev/kmsg
+ stop at_distributor
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+case "$target" in
+ "msm8226")
+ echo 4 > /sys/module/lpm_levels/enable_low_power/l2
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+ echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
+ echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
+ echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
+ echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
+ echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
+ echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
+ echo 787200 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
+ echo 300000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
+ echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
+ echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ chown -h root.system /sys/devices/system/cpu/cpu1/online
+ chown -h root.system /sys/devices/system/cpu/cpu2/online
+ chown -h root.system /sys/devices/system/cpu/cpu3/online
+ chmod -h 664 /sys/devices/system/cpu/cpu1/online
+ chmod -h 664 /sys/devices/system/cpu/cpu2/online
+ chmod -h 664 /sys/devices/system/cpu/cpu3/online
+ ;;
+esac
+
+case "$target" in
+ "msm8610")
+ echo 4 > /sys/module/lpm_levels/enable_low_power/l2
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+ echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
+ echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
+ echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
+ echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
+ echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
+ echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
+ echo 787200 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
+ echo 300000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
+ echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
+ echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ setprop ro.qualcomm.perf.min_freq 7
+ echo 1 > /sys/kernel/mm/ksm/deferred_timer
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ chown -h root.system /sys/devices/system/cpu/cpu1/online
+ chown -h root.system /sys/devices/system/cpu/cpu2/online
+ chown -h root.system /sys/devices/system/cpu/cpu3/online
+ chmod -h 664 /sys/devices/system/cpu/cpu1/online
+ chmod -h 664 /sys/devices/system/cpu/cpu2/online
+ chmod -h 664 /sys/devices/system/cpu/cpu3/online
+ ;;
+esac
+
+case "$target" in
+ "msm8916")
+
+ if [ -f /sys/devices/soc0/soc_id ]; then
+ soc_id=`cat /sys/devices/soc0/soc_id`
+ else
+ soc_id=`cat /sys/devices/system/soc/soc0/id`
+ fi
+
+ #Enable adaptive LMK and set vmpressure_file_min
+ ProductName=`getprop ro.product.name`
+ if [ "$ProductName" == "msm8916_32" ] || [ "$ProductName" == "msm8916_32_LMT" ]; then
+ echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
+ echo 69253 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
+ elif [ "$ProductName" == "msm8916_64" ] || [ "$ProductName" == "msm8916_64_LMT" ]; then
+ echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
+ echo 81250 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
+ fi
+
+ # HMP scheduler settings for 8916, 8936, 8939, 8929
+ echo 3 > /proc/sys/kernel/sched_window_stats_policy
+
+ # Apply governor settings for 8916
+ case "$soc_id" in
+ "206" | "247" | "248" | "249" | "250")
+
+ # HMP scheduler load tracking settings
+ echo 3 > /proc/sys/kernel/sched_ravg_hist_size
+
+ # HMP Task packing settings for 8916
+ echo 30 > /proc/sys/kernel/sched_small_task
+ echo 50 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
+ echo 50 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
+ echo 50 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
+ echo 50 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
+ echo 3 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run
+
+ # disable thermal core_control to update scaling_min_freq
+ echo 0 > /sys/module/msm_thermal/core_control/enabled
+ echo 1 > /sys/devices/system/cpu/cpu0/online
+ echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/target_loads
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
+ chown -h system.system /sys/class/devfreq/0.qcom,cpubw/min_freq
+ chown -h system.system /sys/class/devfreq/0.qcom,cpubw/max_freq
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/target_loads
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
+ chmod -h 0660 /sys/class/devfreq/0.qcom,cpubw/min_freq
+ chmod -h 0660 /sys/class/devfreq/0.qcom,cpubw/max_freq
+ echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ # enable thermal core_control now
+ echo 1 > /sys/module/msm_thermal/core_control/enabled
+
+ echo "25000 1094400:50000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
+ echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
+ echo 25000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
+ echo 998400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
+ echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
+ echo "1 800000:85 998400:90 1094400:80" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
+ echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
+ echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
+ echo 40 > /sys/class/kgsl/kgsl-3d0/idle_timer
+
+ # Bring up all cores online
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ ;;
+ esac
+
+ # Apply governor settings for 8936
+ case "$soc_id" in
+ "233" | "240" | "242")
+
+ # HMP scheduler load tracking settings
+ echo 3 > /proc/sys/kernel/sched_ravg_hist_size
+
+ # HMP Task packing settings for 8936
+ echo 50 > /proc/sys/kernel/sched_small_task
+ echo 50 > /proc/sys/kernel/sched_mostly_idle_load
+ echo 10 > /proc/sys/kernel/sched_mostly_idle_nr_run
+
+ # disable thermal core_control to update scaling_min_freq, interactive gov
+ echo 0 > /sys/module/msm_thermal/core_control/enabled
+ echo 1 > /sys/devices/system/cpu/cpu0/online
+ echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ # enable thermal core_control now
+ echo 1 > /sys/module/msm_thermal/core_control/enabled
+
+ echo "25000 1113600:50000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
+ echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
+ echo 25000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
+ echo 960000 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
+ echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
+ echo "1 800000:85 1113600:90 1267200:80" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
+ echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
+ echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
+
+ # Bring up all cores online
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ echo 1 > /sys/devices/system/cpu/cpu4/online
+
+ for gpu_bimc_io_percent in /sys/class/devfreq/qcom,gpubw*/bw_hwmon/io_percent
+ do
+ echo 40 > $gpu_bimc_io_percent
+ done
+
+ ;;
+ esac
+
+ # Apply governor settings for 8939
+ case "$soc_id" in
+ "239" | "241" | "263" | "268" | "269" | "270" | "271")
+ # disable thermal core_control for updating interactive gov settings
+ echo 0 > /sys/module/msm_thermal/core_control/enabled
+
+ # change sched_window_stats_policy same as KK version
+ echo 2 > /proc/sys/kernel/sched_window_stats_policy
+
+ # enable governor for perf cluster
+ echo 1 > /sys/devices/system/cpu/cpu0/online
+ echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ # enable governor for power cluster
+ echo 1 >/sys/devices/system/cpu/cpu4/online
+ echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
+
+ # HMP Task packing settings for 8939, 8929
+ echo 30 > /proc/sys/kernel/sched_small_task
+ echo 50 > /proc/sys/kernel/sched_mostly_idle_load
+ echo 3 > /proc/sys/kernel/sched_mostly_idle_nr_run
+
+ for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor
+ do
+ echo "cpufreq" > $devfreq_gov
+ done
+
+ if [ "$soc_id" == "0" ]; then
+ for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
+ do
+ echo "bw_hwmon" > $devfreq_gov
+ for cpu_bimc_io_percent in /sys/class/devfreq/qcom,cpubw*/bw_hwmon/io_percent
+ do
+ echo 25 > $cpu_bimc_io_percent
+ done
+ done
+ for poll in /sys/class/devfreq/qcom,cpubw*/polling_interval
+ do
+ echo 20 > $poll
+ done
+ else
+ # Bus-DCVS settings
+ echo "bw_hwmon" > /sys/class/devfreq/0.qcom,cpubw/governor
+ echo 16 > /sys/class/devfreq/0.qcom,cpubw/bw_hwmon/io_percent
+ echo 20 > /sys/class/devfreq/0.qcom,cpubw/polling_interval
+
+ chown -h system.system /sys/class/devfreq/0.qcom,cpubw/governor
+ chown -h system.system /sys/class/devfreq/0.qcom,cpubw/bw_hwmon/io_percent
+ chown -h system.system /sys/class/devfreq/0.qcom,cpubw/polling_interval
+ chown -h system.system /sys/class/devfreq/0.qcom,cpubw/max_freq
+ chown -h system.system /sys/class/devfreq/0.qcom,cpubw/min_freq
+ chmod -h 0660 /sys/class/devfreq/0.qcom,cpubw/governor
+ chmod -h 0660 /sys/class/devfreq/0.qcom,cpubw/bw_hwmon/io_percent
+ chmod -h 0660 /sys/class/devfreq/0.qcom,cpubw/polling_interval
+ chmod -h 0664 /sys/class/devfreq/0.qcom,cpubw/max_freq
+ chmod -h 0664 /sys/class/devfreq/0.qcom,cpubw/min_freq
+ fi
+
+ for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor
+ do
+ echo "powersave" > $devfreq_gov
+ for timeout in /sys/class/devfreq/qcom,mincpubw*/cpufreq/timeout
+ do
+ echo 20 > $timeout
+ done
+ done
+
+ for gpu_bimc_io_percent in /sys/class/devfreq/qcom,gpubw*/bw_hwmon/io_percent
+ do
+ echo 40 > $gpu_bimc_io_percent
+ done
+
+ chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
+ chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
+ chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
+ chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
+ chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
+ chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
+ chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
+ chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
+ chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/lpm_disable_freq
+ chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
+ chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
+ chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
+ chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
+ chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
+ chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
+ chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
+ chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
+ chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
+ chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
+ chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/lpm_disable_freq
+ chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
+ chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
+
+ echo "25000 1100000:50000 1300000:25000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
+ echo 99 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
+ echo 25000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
+ echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
+ echo 2000000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/lpm_disable_freq
+ echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
+ echo "63 500000:85 850000:80 1000000:95" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
+ echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
+ echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
+ echo 499200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
+ echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
+
+ # Set governor parameters for power cluster
+ chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
+ chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
+ chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
+ chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
+ chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
+ chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
+ chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
+ chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
+ chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/lpm_disable_freq
+ chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
+ chown -h system.system /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
+ chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
+ chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
+ chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
+ chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
+ chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
+ chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
+ chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
+ chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
+ chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/lpm_disable_freq
+ chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
+ chmod -h 0660 /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
+
+ echo "25000 800000:50000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
+ echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
+ echo 25000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
+ echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
+ echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/lpm_disable_freq
+ echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
+ echo "85 800000:90" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
+ echo 50000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
+ echo 50000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
+ echo 533333 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
+ echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
+ echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
+
+ echo 400000 > /proc/sys/kernel/sched_freq_inc_notify
+ echo 400000 > /proc/sys/kernel/sched_freq_dec_notify
+
+ # enable thermal core_control now
+ echo 1 > /sys/module/msm_thermal/core_control/enabled
+
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ echo 1 > /sys/devices/system/cpu/cpu4/online
+ echo 1 > /sys/devices/system/cpu/cpu5/online
+ echo 1 > /sys/devices/system/cpu/cpu6/online
+ echo 1 > /sys/devices/system/cpu/cpu7/online
+ chown -h root.system /sys/devices/system/cpu/cpu0/online
+ chown -h root.system /sys/devices/system/cpu/cpu1/online
+ chown -h root.system /sys/devices/system/cpu/cpu2/online
+ chown -h root.system /sys/devices/system/cpu/cpu3/online
+ chown -h root.system /sys/devices/system/cpu/cpu4/online
+ chown -h root.system /sys/devices/system/cpu/cpu5/online
+ chown -h root.system /sys/devices/system/cpu/cpu6/online
+ chown -h root.system /sys/devices/system/cpu/cpu7/online
+ chmod -h 664 /sys/devices/system/cpu/cpu0/online
+ chmod -h 664 /sys/devices/system/cpu/cpu1/online
+ chmod -h 664 /sys/devices/system/cpu/cpu2/online
+ chmod -h 664 /sys/devices/system/cpu/cpu3/online
+ chmod -h 664 /sys/devices/system/cpu/cpu4/online
+ chmod -h 664 /sys/devices/system/cpu/cpu5/online
+ chmod -h 664 /sys/devices/system/cpu/cpu6/online
+ chmod -h 664 /sys/devices/system/cpu/cpu7/online
+ echo Y > /sys/module/lpm_levels/system/power/power-l2-active/idle_enabled
+ echo Y > /sys/module/lpm_levels/system/power/power-l2-pc/idle_enabled
+ echo Y > /sys/module/lpm_levels/system/performance/performance-l2-active/idle_enabled
+ echo Y > /sys/module/lpm_levels/system/performance/performance-l2-pc/idle_enabled
+ echo Y > /sys/module/lpm_levels/system/power/power-l2-pc/suspend_enabled
+ echo Y > /sys/module/lpm_levels/system/performance/performance-l2-pc/suspend_enabled
+ echo Y > /sys/module/lpm_levels/system/system-cci-active/idle_enabled
+ echo Y > /sys/module/lpm_levels/system/system-cci-retention/idle_enabled
+ echo Y > /sys/module/lpm_levels/system/system-cci-pc/idle_enabled
+ echo Y > /sys/module/lpm_levels/system/system-cci-pc/suspend_enabled
+ echo 90 > /proc/sys/kernel/sched_upmigrate
+ echo 70 > /proc/sys/kernel/sched_downmigrate
+ echo 30 > /proc/sys/kernel/sched_init_task_load
+ echo 5 > /proc/sys/kernel/sched_ravg_hist_size
+ echo 10 > /proc/sys/kernel/sched_upmigrate_min_nice
+ echo 1 > /proc/sys/kernel/sched_boot_complete
+ echo 30 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_load
+ echo 960000 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_freq
+ echo 960000 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_freq
+ echo 960000 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_freq
+ echo 960000 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_freq
+ chown -h radio.system /sys/class/kgsl/kgsl-3d0/default_pwrlevel
+ chown -h radio.system /sys/class/kgsl/kgsl-3d0/idle_timer
+ chmod -h 664 /sys/class/kgsl/kgsl-3d0/default_pwrlevel
+ chmod -h 664 /sys/class/kgsl/kgsl-3d0/idle_timer
+ rm /data/system/default_values
+ ;;
+ esac
+
+ # Apply governor settings for 8939 V3.0. confirm the soc id value and method
+ case "$soc_id" in
+ "65536" )
+ # HMP scheduler settings for 8939 V3.0
+ echo 3 > /proc/sys/kernel/sched_window_stats_policy
+ echo 3 > /proc/sys/kernel/sched_ravg_hist_size
+
+ # HMP Task packing settings for 8939 V3.0
+ echo 20 > /proc/sys/kernel/sched_small_task
+ echo 30 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_load
+
+ echo 3 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_nr_run
+
+ echo 0 > /sys/devices/system/cpu/cpu0/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu1/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu2/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu3/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu4/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu5/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu6/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu7/sched_prefer_idle
+
+ for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
+ do
+ echo "bw_hwmon" > $devfreq_gov
+ for cpu_io_percent in /sys/class/devfreq/qcom,cpubw*/bw_hwmon/io_percent
+ do
+ echo 20 > $cpu_io_percent
+ done
+ done
+
+ for gpu_bimc_io_percent in /sys/class/devfreq/qcom,gpubw*/bw_hwmon/io_percent
+ do
+ echo 40 > $gpu_bimc_io_percent
+ done
+ # disable thermal core_control to update interactive gov settings
+ echo 0 > /sys/module/msm_thermal/core_control/enabled
+
+ # enable governor for perf cluster
+ echo 1 > /sys/devices/system/cpu/cpu0/online
+ echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo "19000 1113600:39000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
+ echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
+ echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
+ echo 1113600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
+ echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
+ echo "1 960000:85 1113600:90 1344000:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
+ echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
+ echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
+ echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+
+ # enable governor for power cluster
+ echo 1 > /sys/devices/system/cpu/cpu4/online
+ echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
+ echo "39000 998400:19000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
+ echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
+ echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
+ echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
+ echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
+ echo "1 800000:90" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
+ echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
+ echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
+ echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
+
+ # enable thermal core_control now
+ echo 1 > /sys/module/msm_thermal/core_control/enabled
+
+ # Bring up all cores online
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ echo 1 > /sys/devices/system/cpu/cpu5/online
+ echo 1 > /sys/devices/system/cpu/cpu6/online
+ echo 1 > /sys/devices/system/cpu/cpu7/online
+
+ # HMP scheduler (big.Little cluster related) settings
+ echo 93 > /proc/sys/kernel/sched_upmigrate
+ echo 70 > /proc/sys/kernel/sched_downmigrate
+
+ # Enable sched guided freq control
+ echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
+ echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
+ echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
+ echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
+ echo 50000 > /proc/sys/kernel/sched_freq_inc_notify
+ echo 50000 > /proc/sys/kernel/sched_freq_dec_notify
+
+ # Enable core control
+ insmod /system/lib/modules/core_ctl.ko
+ echo 2 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
+ echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/max_cpus
+ echo 68 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
+ echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
+ echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
+
+ ;;
+ esac
+ ;;
+esac
+
+case "$target" in
+ "msm8952")
+
+ # HMP scheduler settings for 8952 soc id is 264
+ echo 3 > /proc/sys/kernel/sched_window_stats_policy
+ echo 3 > /proc/sys/kernel/sched_ravg_hist_size
+
+ # HMP Task packing settings for 8952
+ echo 20 > /proc/sys/kernel/sched_small_task
+ echo 30 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_load
+ echo 30 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_load
+
+ echo 3 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_nr_run
+ echo 3 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_nr_run
+
+ echo 0 > /sys/devices/system/cpu/cpu0/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu1/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu2/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu3/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu4/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu5/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu6/sched_prefer_idle
+ echo 0 > /sys/devices/system/cpu/cpu7/sched_prefer_idle
+
+ for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
+ do
+ echo "bw_hwmon" > $devfreq_gov
+ for cpu_io_percent in /sys/class/devfreq/qcom,cpubw*/bw_hwmon/io_percent
+ do
+ echo 20 > $cpu_io_percent
+ done
+ done
+
+ for gpu_bimc_io_percent in /sys/class/devfreq/qcom,gpubw*/bw_hwmon/io_percent
+ do
+ echo 40 > $gpu_bimc_io_percent
+ done
+ # disable thermal core_control to update interactive gov settings
+ echo 0 > /sys/module/msm_thermal/core_control/enabled
+
+ # enable governor for perf cluster
+ echo 1 > /sys/devices/system/cpu/cpu0/online
+ echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo "19000 1113600:39000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
+ echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
+ echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
+ echo 1113600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
+ echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
+ echo "1 960000:85 1113600:90 1344000:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
+ echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
+ echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/sampling_down_factor
+ echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+
+ # enable governor for power cluster
+ echo 1 > /sys/devices/system/cpu/cpu4/online
+ echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
+ echo "39000 998400:19000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
+ echo 90 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
+ echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
+ echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
+ echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
+ echo "1 800000:90" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
+ echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
+ echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/sampling_down_factor
+ echo 800000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
+
+ # enable thermal core_control now
+ echo 1 > /sys/module/msm_thermal/core_control/enabled
+
+ # Bring up all cores online
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ echo 1 > /sys/devices/system/cpu/cpu5/online
+ echo 1 > /sys/devices/system/cpu/cpu6/online
+ echo 1 > /sys/devices/system/cpu/cpu7/online
+
+ # HMP scheduler (big.Little cluster related) settings
+ echo 93 > /proc/sys/kernel/sched_upmigrate
+ echo 70 > /proc/sys/kernel/sched_downmigrate
+
+ # Enable sched guided freq control
+ echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
+ echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
+ echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
+ echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
+ echo 50000 > /proc/sys/kernel/sched_freq_inc_notify
+ echo 50000 > /proc/sys/kernel/sched_freq_dec_notify
+
+ # Enable core control
+ insmod /system/lib/modules/core_ctl.ko
+ echo 2 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
+ echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/max_cpus
+ echo 68 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
+ echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
+ echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
+ ;;
+esac
+
+
+case "$target" in
+ "apq8084")
+ echo 4 > /sys/module/lpm_levels/enable_low_power/l2
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/retention/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/retention/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/retention/idle_enabled
+ echo 0 > /sys/module/msm_thermal/core_control/enabled
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
+ do
+ echo "cpubw_hwmon" > $devfreq_gov
+ done
+ echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo "interactive" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
+ echo "interactive" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
+ echo "interactive" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
+ echo "20000 1400000:40000 1700000:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
+ echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
+ echo 1497600 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
+ echo "85 1500000:90 1800000:70" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
+ echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
+ echo 20 > /sys/module/cpu_boost/parameters/boost_ms
+ echo 1728000 > /sys/module/cpu_boost/parameters/sync_threshold
+ echo 100000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
+ echo 1497600 > /sys/module/cpu_boost/parameters/input_boost_freq
+ echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
+ echo 1 > /dev/cpuctl/apps/cpu.notify_on_migrate
+ echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ echo 300000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
+ echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
+ echo 300000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
+ echo 1 > /sys/module/msm_thermal/core_control/enabled
+ setprop ro.qualcomm.perf.cores_online 2
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ chown -h root.system /sys/devices/system/cpu/mfreq
+ chmod -h 220 /sys/devices/system/cpu/mfreq
+ chown -h root.system /sys/devices/system/cpu/cpu1/online
+ chown -h root.system /sys/devices/system/cpu/cpu2/online
+ chown -h root.system /sys/devices/system/cpu/cpu3/online
+ chmod -h 664 /sys/devices/system/cpu/cpu1/online
+ chmod -h 664 /sys/devices/system/cpu/cpu2/online
+ chmod -h 664 /sys/devices/system/cpu/cpu3/online
+ ;;
+esac
+
+case "$target" in
+ "mpq8092")
+ echo 4 > /sys/module/lpm_levels/enable_low_power/l2
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu1/retention/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu2/retention/idle_enabled
+ echo 1 > /sys/module/msm_pm/modes/cpu3/retention/idle_enabled
+ echo 0 > /sys/module/msm_thermal/core_control/enabled
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
+ echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
+ echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
+ echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+ echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
+ echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
+ echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ echo 300000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
+ echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
+ echo 300000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
+ echo 1 > /sys/module/msm_thermal/core_control/enabled
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+ chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ chown -h root.system /sys/devices/system/cpu/mfreq
+ chmod -h 220 /sys/devices/system/cpu/mfreq
+ chown -h root.system /sys/devices/system/cpu/cpu1/online
+ chown -h root.system /sys/devices/system/cpu/cpu2/online
+ chown -h root.system /sys/devices/system/cpu/cpu3/online
+ chmod -h 664 /sys/devices/system/cpu/cpu1/online
+ chmod -h 664 /sys/devices/system/cpu/cpu2/online
+ chmod -h 664 /sys/devices/system/cpu/cpu3/online
+ ;;
+esac
+
+case "$target" in
+ "msm8994")
+ echo 0 > /sys/module/msm_thermal/core_control/enabled
+ echo -n disable > /sys/devices/soc.*/qcom,bcl.*/mode
+ bcl_hotplug_mask=`cat /sys/devices/soc.*/qcom,bcl.*/hotplug_mask`
+ echo 0 > /sys/devices/soc.*/qcom,bcl.*/hotplug_mask
+ echo -n enable > /sys/devices/soc.*/qcom,bcl.*/mode
+ echo 1 > /sys/devices/system/cpu/cpu4/online
+ echo 1 > /sys/devices/system/cpu/cpu5/online
+ echo 1 > /sys/devices/system/cpu/cpu6/online
+ echo 1 > /sys/devices/system/cpu/cpu7/online
+ echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
+ # configure governor settings for little cluster
+ echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load
+ echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif
+ echo "20000 750000:40000 800000:20000" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
+ echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
+ echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
+ echo 768000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
+ echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
+ echo "85 780000:90" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
+ echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
+ echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ # configure governor settings for big cluster
+ echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
+ echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load
+ echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif
+ echo "20000 750000:40000 800000:20000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay
+ echo 99 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load
+ echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate
+ echo 768000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq
+ echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy
+ echo "85 780000:90" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads
+ echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time
+ echo 384000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq
+ echo 1 > /sys/module/msm_thermal/core_control/enabled
+ echo -n disable > /sys/devices/soc.*/qcom,bcl.*/mode
+ echo $bcl_hotplug_mask > /sys/devices/soc.*/qcom,bcl.*/hotplug_mask
+ echo -n enable > /sys/devices/soc.*/qcom,bcl.*/mode
+ # Enable task migration fixups in the scheduler
+ echo 1 > /proc/sys/kernel/sched_migration_fixup
+ for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
+ do
+ echo "bw_hwmon" > $devfreq_gov
+ done
+ /system/bin/energy-awareness
+ #enable rps static configuration
+ echo 8 > /sys/class/net/rmnet_ipa0/queues/rx-0/rps_cpus
+ echo 30 > /proc/sys/kernel/sched_small_task
+ ;;
+esac
+
+case "$target" in
+ "msm8909")
+
+ if [ -f /sys/devices/soc0/soc_id ]; then
+ soc_id=`cat /sys/devices/soc0/soc_id`
+ else
+ soc_id=`cat /sys/devices/system/soc/soc0/id`
+ fi
+
+ #Enable adaptive LMK and set vmpressure_file_min
+ echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
+ echo 69253 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min
+
+ # HMP scheduler settings for 8909 similiar to 8916
+ echo 3 > /proc/sys/kernel/sched_window_stats_policy
+ echo 3 > /proc/sys/kernel/sched_ravg_hist_size
+
+ # HMP Task packing settings for 8909 similiar to 8916
+ echo 30 > /proc/sys/kernel/sched_small_task
+ echo 50 > /proc/sys/kernel/sched_mostly_idle_load
+ echo 10 > /proc/sys/kernel/sched_mostly_idle_nr_run
+
+ # Apply governor settings for 8909
+
+ # disable thermal core_control to update scaling_min_freq
+ echo 0 > /sys/module/msm_thermal/core_control/enabled
+ echo 1 > /sys/devices/system/cpu/cpu0/online
+ echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+ echo 400000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+ # enable thermal core_control now
+ echo 1 > /sys/module/msm_thermal/core_control/enabled
+
+ echo "25000 800000:50000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
+ echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
+ echo 25000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
+ echo 800000 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
+ echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
+ echo "1 400000:85 998400:90 1094400:80" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
+ echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
+ echo 50000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor
+
+ # Bring up all cores online
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu2/online
+ echo 1 > /sys/devices/system/cpu/cpu3/online
+ echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
+
+ for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor
+ do
+ echo "bw_hwmon" > $devfreq_gov
+ done
+ ;;
+esac
+
+case "$target" in
+ "msm7627_ffa" | "msm7627_surf" | "msm7627_6x")
+ echo 25000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+ ;;
+esac
+
+case "$target" in
+ "qsd8250_surf" | "qsd8250_ffa" | "qsd8650a_st1x")
+ echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+ ;;
+esac
+
+case "$target" in
+ "qsd8650a_st1x")
+ mount -t debugfs none /sys/kernel/debug
+ ;;
+esac
+
+chown -h system /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+chown -h system /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
+chown -h system /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
+
+emmc_boot=`getprop ro.boot.emmc`
+case "$emmc_boot"
+ in "true")
+ chown -h system /sys/devices/platform/rs300000a7.65536/force_sync
+ chown -h system /sys/devices/platform/rs300000a7.65536/sync_sts
+ chown -h system /sys/devices/platform/rs300100a7.65536/force_sync
+ chown -h system /sys/devices/platform/rs300100a7.65536/sync_sts
+ ;;
+esac
+
+case "$target" in
+ "msm8960" | "msm8660" | "msm7630_surf")
+ echo 10 > /sys/devices/platform/msm_sdcc.3/idle_timeout
+ ;;
+ "msm7627a")
+ echo 10 > /sys/devices/platform/msm_sdcc.1/idle_timeout
+ ;;
+esac
+
+# Post-setup services
+case "$target" in
+ "msm8660" | "msm8960" | "msm8226" | "msm8610" | "mpq8092" )
+ start mpdecision
+ ;;
+ "msm8916")
+ if [ -f /sys/devices/soc0/soc_id ]; then
+ soc_id=`cat /sys/devices/soc0/soc_id`
+ else
+ soc_id=`cat /sys/devices/system/soc/soc0/id`
+ fi
+ case $soc_id in
+ "239" | "241" | "263" | "268" | "269" | "270" | "271")
+ setprop ro.min_freq_0 499200
+ setprop ro.min_freq_4 533333
+ ;;
+ "206" | "247" | "248" | "249" | "250" | "233" | "240" | "242")
+ setprop ro.min_freq_0 800000
+ ;;
+ esac
+ #start perfd after setprop
+ start perfd # start perfd on 8916, 8939 and 8929
+ ;;
+ "msm8974")
+ start mpdecision
+ echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb
+ ;;
+ "msm8994")
+ rm /data/system/default_values
+ setprop ro.min_freq_0 384000
+ setprop ro.min_freq_4 384000
+ start perfd
+ ;;
+ "apq8084")
+ rm /data/system/default_values
+ start mpdecision
+ echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb
+ echo 512 > /sys/block/sda/bdi/read_ahead_kb
+ echo 512 > /sys/block/sdb/bdi/read_ahead_kb
+ echo 512 > /sys/block/sdc/bdi/read_ahead_kb
+ echo 512 > /sys/block/sdd/bdi/read_ahead_kb
+ echo 512 > /sys/block/sde/bdi/read_ahead_kb
+ echo 512 > /sys/block/sdf/bdi/read_ahead_kb
+ echo 512 > /sys/block/sdg/bdi/read_ahead_kb
+ echo 512 > /sys/block/sdh/bdi/read_ahead_kb
+ ;;
+ "msm7627a")
+ if [ -f /sys/devices/soc0/soc_id ]; then
+ soc_id=`cat /sys/devices/soc0/soc_id`
+ else
+ soc_id=`cat /sys/devices/system/soc/soc0/id`
+ fi
+ case "$soc_id" in
+ "127" | "128" | "129")
+ start mpdecision
+ ;;
+ esac
+ ;;
+esac
+
+# Enable Power modes and set the CPU Freq Sampling rates
+case "$target" in
+ "msm7627a")
+ start qosmgrd
+ echo 1 > /sys/module/pm2/modes/cpu0/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/pm2/modes/cpu1/standalone_power_collapse/idle_enabled
+ echo 1 > /sys/module/pm2/modes/cpu0/standalone_power_collapse/suspend_enabled
+ echo 1 > /sys/module/pm2/modes/cpu1/standalone_power_collapse/suspend_enabled
+ #SuspendPC:
+ echo 1 > /sys/module/pm2/modes/cpu0/power_collapse/suspend_enabled
+ #IdlePC:
+ echo 1 > /sys/module/pm2/modes/cpu0/power_collapse/idle_enabled
+ echo 25000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
+ ;;
+esac
+
+# Change adj level and min_free_kbytes setting for lowmemory killer to kick in
+case "$target" in
+ "msm7627a")
+ echo 0,1,2,4,9,12 > /sys/module/lowmemorykiller/parameters/adj
+ echo 5120 > /proc/sys/vm/min_free_kbytes
+ ;;
+esac
+
+# Install AdrenoTest.apk if not already installed
+if [ -f /data/prebuilt/AdrenoTest.apk ]; then
+ if [ ! -d /data/data/com.qualcomm.adrenotest ]; then
+ pm install /data/prebuilt/AdrenoTest.apk
+ fi
+fi
+
+# Install SWE_Browser.apk if not already installed
+if [ -f /data/prebuilt/SWE_AndroidBrowser.apk ]; then
+ if [ ! -d /data/data/com.android.swe.browser ]; then
+ pm install /data/prebuilt/SWE_AndroidBrowser.apk
+ fi
+fi
+
+# Change adj level and min_free_kbytes setting for lowmemory killer to kick in
+case "$target" in
+ "msm8660")
+ start qosmgrd
+ echo 0,1,2,4,9,12 > /sys/module/lowmemorykiller/parameters/adj
+ echo 5120 > /proc/sys/vm/min_free_kbytes
+ ;;
+esac
+
+case "$target" in
+ "msm8226" | "msm8974" | "msm8610" | "apq8084" | "mpq8092" | "msm8610" | "msm8916" | "msm8994")
+ # Let kernel know our image version/variant/crm_version
+ image_version="10:"
+ image_version+=`getprop ro.build.id`
+ image_version+=":"
+ image_version+=`getprop ro.build.version.incremental`
+ image_variant=`getprop ro.product.name`
+ image_variant+="-"
+ image_variant+=`getprop ro.build.type`
+ oem_version=`getprop ro.build.version.codename`
+ echo 10 > /sys/devices/soc0/select_image
+ echo $image_version > /sys/devices/soc0/image_version
+ echo $image_variant > /sys/devices/soc0/image_variant
+ echo $oem_version > /sys/devices/soc0/image_crm_version
+ ;;
+esac
+
+# Create native cgroup and move all tasks to it. Allot 15% real-time
+# bandwidth limit to native cgroup (which is what remains after
+# Android uses up 80% real-time bandwidth limit). root cgroup should
+# become empty after all tasks are moved to native cgroup.
+
+CGROUP_ROOT=/dev/cpuctl
+mkdir $CGROUP_ROOT/native
+echo 150000 > $CGROUP_ROOT/native/cpu.rt_runtime_us
+
+# We could be racing with task creation, as a result of which its possible that
+# we may fail to move all tasks from root cgroup to native cgroup in one shot.
+# Retry few times before giving up.
+
+for loop_count in 1 2 3
+do
+ for i in $(cat $CGROUP_ROOT/tasks)
+ do
+ echo $i > $CGROUP_ROOT/native/tasks
+ done
+
+ root_tasks=$(cat $CGROUP_ROOT/tasks)
+ if [ -z "$root_tasks" ]
+ then
+ break
+ fi
+done
+
+# Check if we failed to move all tasks from root cgroup
+if [ ! -z "$root_tasks" ]
+then
+ echo "Error: Could not move all tasks to native cgroup"
+fi
diff --git a/rootdir/etc/init.qcom.sdio.sh b/rootdir/etc/init.qcom.sdio.sh
new file mode 100644
index 0000000..c0ae28a
--- /dev/null
+++ b/rootdir/etc/init.qcom.sdio.sh
@@ -0,0 +1,77 @@
+#!/system/bin/sh
+# Copyright (c) 2010, 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 "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.
+#
+
+# For successful WLAN card detection, WLAN needs SDIO polling turned on.
+# This script can be used to turn on/off SDIO polling on appropriate
+# SDIO slot on the MSM target (e.g. slot 3 on 7x30 surf).
+
+arg=$1
+target=`getprop ro.board.platform`
+
+case "$target" in
+ "msm7627_6x")
+ echo 1 > /sys/devices/platform/msm_sdcc.1/polling
+ echo 1 > /sys/devices/platform/msm_sdcc.2/polling
+ ;;
+
+ "msm7627_ffa")
+ echo 1 > /sys/devices/platform/msm_sdcc.2/polling
+ ;;
+
+ "msm7627_surf")
+ echo 1 > /sys/devices/platform/msm_sdcc.1/polling
+ echo 1 > /sys/devices/platform/msm_sdcc.2/polling
+ ;;
+
+ "msm7627a")
+ echo 1 > /sys/devices/platform/msm_sdcc.2/polling
+ ;;
+
+ "msm7630_surf")
+ echo 1 > /sys/devices/platform/msm_sdcc.3/polling
+ ;;
+
+ "msm7630_1x")
+ echo 1 > /sys/devices/platform/msm_sdcc.3/polling
+ ;;
+
+ "msm7630_fusion")
+ echo 1 > /sys/devices/platform/msm_sdcc.3/polling
+ ;;
+
+ "msm8660")
+ echo 1 > /sys/devices/platform/msm_sdcc.4/polling
+ ;;
+
+ "msm8660_csfb")
+ echo 1 > /sys/devices/platform/msm_sdcc.4/polling
+ ;;
+esac
+
+exit 0
diff --git a/rootdir/etc/init.qcom.sh b/rootdir/etc/init.qcom.sh
index adf8271..246f01b 100644
--- a/rootdir/etc/init.qcom.sh
+++ b/rootdir/etc/init.qcom.sh
@@ -34,10 +34,8 @@
fi
#load modules
- insmod /system/lib/modules/radio-iris-transport.ko
insmod /system/lib/modules/pronto/pronto_wlan.ko
modprobe wlan
- modprobe radio-iris-transport
#
# Function to start sensors for DSPS enabled platforms
diff --git a/rootdir/etc/init.qcom.wifi.sh b/rootdir/etc/init.qcom.wifi.sh
new file mode 100644
index 0000000..bc03f5c
--- /dev/null
+++ b/rootdir/etc/init.qcom.wifi.sh
@@ -0,0 +1,506 @@
+#!/system/bin/sh
+# Copyright (c) 2010-2013, 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 "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.
+#
+# This script will load and unload the wifi driver to put the wifi in
+# in deep sleep mode so that there won't be voltage leakage.
+# Loading/Unloading the driver only incase if the Wifi GUI is not going
+# to Turn ON the Wifi. In the Script if the wlan driver status is
+# ok(GUI loaded the driver) or loading(GUI is loading the driver) then
+# the script won't do anything. Otherwise (GUI is not going to Turn On
+# the Wifi) the script will load/unload the driver
+# This script will get called after post bootup.
+
+target="$1"
+serialno="$2"
+
+btsoc=""
+
+# No path is set up at this point so we have to do it here.
+PATH=/sbin:/system/sbin:/system/bin:/system/xbin
+export PATH
+
+# Trigger WCNSS platform driver
+trigger_wcnss()
+{
+ # We need to trigger WCNSS platform driver, WCNSS driver
+ # will export a file which we must touch so that the
+ # driver knows that userspace is ready to handle firmware
+ # download requests.
+
+ # See if an appropriately named device file is present
+ wcnssnode=`ls /dev/wcnss*`
+ case "$wcnssnode" in
+ *wcnss*)
+ # Before triggering wcnss, let it know that
+ # caldata is available at userspace.
+ if [ -e /data/misc/wifi/WCNSS_qcom_wlan_cal.bin ]; then
+ calparm=`ls /sys/module/wcnsscore/parameters/has_calibrated_data`
+ if [ -e $calparm ] && [ ! -e /data/misc/wifi/WCN_FACTORY ]; then
+ echo 1 > $calparm
+ fi
+ fi
+ # There is a device file. Write to the file
+ # so that the driver knows userspace is
+ # available for firmware download requests
+ echo 1 > $wcnssnode
+ ;;
+
+ *)
+ # There is not a device file present, so
+ # the driver must not be available
+ echo "No WCNSS device node detected"
+ ;;
+ esac
+
+ # Plumb down the device serial number
+ if [ -f /sys/devices/*wcnss-wlan/serial_number ]; then
+ cd /sys/devices/*wcnss-wlan
+ echo $serialno > serial_number
+ cd /
+ elif [ -f /sys/devices/platform/wcnss_wlan.0/serial_number ]; then
+ echo $serialno > /sys/devices/platform/wcnss_wlan.0/serial_number
+ fi
+}
+
+
+case "$target" in
+ msm8974* | msm8226* | msm8610*)
+
+# Check whether device is plugged on the HSIC bus
+# Currently HSIC bus will be the first index
+
+ if [ -e /sys/bus/platform/drivers/msm_hsic_host ]; then
+ if [ ! -L /sys/bus/usb/devices/1-1 ]; then
+ echo msm_hsic_host > /sys/bus/platform/drivers/msm_hsic_host/unbind
+ fi
+
+ chown -h system.system /sys/bus/platform/drivers/msm_hsic_host/bind
+ chown -h system.system /sys/bus/platform/drivers/msm_hsic_host/unbind
+ chmod -h 0200 /sys/bus/platform/drivers/msm_hsic_host/bind
+ chmod -h 0200 /sys/bus/platform/drivers/msm_hsic_host/unbind
+ fi
+
+ wlanchip=""
+
+# force ar6004 is ar6004_wlan.conf existed.
+ if [ -f /system/etc/firmware/ath6k/AR6004/ar6004_wlan.conf ]; then
+ wlanchip=`cat /system/etc/firmware/ath6k/AR6004/ar6004_wlan.conf`
+ fi
+
+# auto detect ar6004-sdio card
+# for ar6004-sdio card, the vendor id and device id is as the following
+# vendor id device id
+# 0x0271 0x0400
+# 0x0271 0x0401
+ if [ "$wlanchip" == "" ]; then
+ sdio_vendors=`echo \`cat /sys/bus/mmc/devices/*/*/vendor\``
+ sdio_devices=`echo \`cat /sys/bus/mmc/devices/*/*/device\``
+ ven_idx=0
+
+ for vendor in $sdio_vendors; do
+ case "$vendor" in
+ "0x0271")
+ dev_idx=0
+ for device in $sdio_devices; do
+ if [ $ven_idx -eq $dev_idx ]; then
+ case "$device" in
+ "0x0400" | "0x0401" | "0x0402")
+ wlanchip="AR6004-SDIO"
+ ;;
+ *)
+ ;;
+ esac
+ fi
+ dev_idx=$(( $dev_idx + 1))
+ done
+ ;;
+ *)
+ ;;
+ esac
+ ven_idx=$(( $ven_idx + 1))
+ done
+ # auto detect ar6004-sdio card end
+ fi
+
+# for ar6004-usb card, the vendor id and device id is as the following
+# vendor id product id
+# 0x0cf3 0x9374
+# 0x0cf3 0x9372
+ if [ "$wlanchip" == "" ]; then
+ usb_vendors=`echo \`cat /sys/bus/usb/devices/*/*/idVendor\``
+ usb_products=`echo \`cat /sys/bus/usb/devices/*/*/idProduct\``
+ ven_idx=0
+
+ for vendor in $usb_vendors; do
+ case "$vendor" in
+ "0cf3")
+ dev_idx=0
+ for product in $usb_products; do
+ if [ $ven_idx -eq $dev_idx ]; then
+ case "$product" in
+ "9374" | "9372")
+ wlanchip="AR6004-USB"
+ ;;
+ *)
+ ;;
+ esac
+ fi
+ dev_idx=$(( $dev_idx + 1))
+ done
+ ;;
+ *)
+ ;;
+ esac
+ ven_idx=$(( $ven_idx + 1))
+ done
+ # auto detect ar6004-usb card end
+ fi
+
+ echo "The WLAN Chip ID is $wlanchip"
+ case "$wlanchip" in
+ "AR6004-USB")
+ echo msm_hsic_host > /sys/bus/platform/drivers/msm_hsic_host/unbind
+ setprop wlan.driver.ath 2
+ setprop qcom.bluetooth.soc ath3k
+ btsoc="ath3k"
+ rm /system/lib/modules/wlan.ko
+ ln -s /system/lib/modules/ath6kl-3.5/ath6kl_usb.ko \
+ /system/lib/modules/wlan.ko
+ rm /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin
+ rm /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin
+ ln -s /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin_usb \
+ /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin
+ ln -s /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin_usb \
+ /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin
+ rm /system/etc/firmware/ath6k/AR6004/hw3.0/bdata.bin
+ ln -s /system/etc/firmware/ath6k/AR6004/hw3.0/bdata.bin_usb \
+ /system/etc/firmware/ath6k/AR6004/hw3.0/bdata.bin
+
+ # Use different wpa_supplicant.conf template between wcn driver
+ # and ath6kl driver
+ rm /system/etc/wifi/wpa_supplicant.conf
+ ln -s /system/etc/wifi/wpa_supplicant_ath6kl.conf \
+ /system/etc/wifi/wpa_supplicant.conf
+ ;;
+
+ "AR6004-SDIO")
+ setprop wlan.driver.ath 2
+ setprop qcom.bluetooth.soc ath3k
+ btsoc="ath3k"
+ # Chown polling nodes as needed from UI running on system server
+ chmod -h 0200 /sys/devices/msm_sdcc.1/polling
+ chmod -h 0200 /sys/devices/msm_sdcc.2/polling
+ chmod -h 0200 /sys/devices/msm_sdcc.3/polling
+ chmod -h 0200 /sys/devices/msm_sdcc.4/polling
+
+ chown -h system.system /sys/devices/msm_sdcc.1/polling
+ chown -h system.system /sys/devices/msm_sdcc.2/polling
+ chown -h system.system /sys/devices/msm_sdcc.3/polling
+ chown -h system.system /sys/devices/msm_sdcc.4/polling
+
+ rm /system/lib/modules/wlan.ko
+ ln -s /system/lib/modules/ath6kl-3.5/ath6kl_sdio.ko \
+ /system/lib/modules/wlan.ko
+ rm /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin
+ rm /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin
+ ln -s /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin_sdio \
+ /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin
+ ln -s /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin_sdio \
+ /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin
+ rm /system/etc/firmware/ath6k/AR6004/hw3.0/bdata.bin
+ ln -s /system/etc/firmware/ath6k/AR6004/hw3.0/bdata.bin_sdio \
+ /system/etc/firmware/ath6k/AR6004/hw3.0/bdata.bin
+
+ # Use different wpa_supplicant.conf template between wcn driver
+ # and ath6kl driver
+ rm /system/etc/wifi/wpa_supplicant.conf
+ ln -s /system/etc/wifi/wpa_supplicant_ath6kl.conf \
+ /system/etc/wifi/wpa_supplicant.conf
+ ;;
+
+ *)
+ echo "*** WI-FI chip ID is not specified in /persist/wlan_chip_id **"
+ echo "*** Use the default WCN driver. **"
+ setprop wlan.driver.ath 0
+ rm /system/lib/modules/wlan.ko
+ ln -s /system/lib/modules/pronto/pronto_wlan.ko \
+ /system/lib/modules/wlan.ko
+ # Populate the writable driver configuration file
+ if [ ! -s /data/misc/wifi/WCNSS_qcom_cfg.ini ]; then
+ cp /system/etc/wifi/WCNSS_qcom_cfg.ini \
+ /data/misc/wifi/WCNSS_qcom_cfg.ini
+ chown -h system:wifi /data/misc/wifi/WCNSS_qcom_cfg.ini
+ chmod -h 660 /data/misc/wifi/WCNSS_qcom_cfg.ini
+ fi
+
+ # The property below is used in Qcom SDK for softap to determine
+ # the wifi driver config file
+ setprop wlan.driver.config /data/misc/wifi/WCNSS_qcom_cfg.ini
+
+ # Use different wpa_supplicant.conf template between wcn driver
+ # and ath6kl driver
+ rm /system/etc/wifi/wpa_supplicant.conf
+ ln -s /system/etc/wifi/wpa_supplicant_wcn.conf \
+ /system/etc/wifi/wpa_supplicant.conf
+
+ # Trigger WCNSS platform driver
+ trigger_wcnss &
+ ;;
+ esac
+ ;;
+
+ apq8084*)
+ echo "*** Use the CNSS CLD driver.**"
+ setprop wlan.driver.ath 0
+
+ # Use different wpa_supplicant.conf template between wcn driver
+ # and ath6kl driver
+ rm /system/etc/wifi/wpa_supplicant.conf
+ ln -s /system/etc/wifi/wpa_supplicant_wcn.conf \
+ /system/etc/wifi/wpa_supplicant.conf
+ ;;
+
+ msm8960*)
+
+ # Move cfg80211.ko to prima directory, the default cfg80211.ko is
+ # for wcnss solution
+ if [ ! -L /system/lib/modules/cfg80211.ko ]; then
+ mv /system/lib/modules/cfg80211.ko /system/lib/modules/prima/
+ fi
+
+ wlanchip=""
+
+ if [ -f /system/etc/firmware/ath6k/AR6004/ar6004_wlan.conf ]; then
+ wlanchip=`cat /system/etc/firmware/ath6k/AR6004/ar6004_wlan.conf`
+ fi
+
+ if [ "$wlanchip" == "" ]; then
+ # auto detect ar6004-usb card
+ # for ar6004-usb card, the vendor id and device id is as the following
+ # vendor id product id
+ # 0x0cf3 0x9374
+ # 0x0cf3 0x9372
+ usb_vendors=`echo \`cat /sys/bus/usb/devices/*/*/idVendor\``
+ usb_products=`echo \`cat /sys/bus/usb/devices/*/*/idProduct\``
+ ven_idx=0
+
+ for vendor in $usb_vendors; do
+ case "$vendor" in
+ "0cf3")
+ dev_idx=0
+ for product in $usb_products; do
+ if [ $ven_idx -eq $dev_idx ]; then
+ case "$product" in
+ "9374" | "9372")
+ wlanchip="AR6004-USB"
+ ;;
+ *)
+ ;;
+ esac
+ fi
+ dev_idx=$(( $dev_idx + 1))
+ done
+ ;;
+ *)
+ ;;
+ esac
+ ven_idx=$(( $ven_idx + 1))
+ done
+ # auto detect ar6004-usb card end
+ fi
+
+ if [ "$wlanchip" == "" ]; then
+ # auto detect ar6004-sdio card
+ # for ar6004-sdio card, the vendor id and device id is
+ # as the following
+ # vendor id device id
+ # 0x0271 0x0400
+ # 0x0271 0x0401
+ sdio_vendors=`echo \`cat /sys/bus/mmc/devices/*/*/vendor\``
+ sdio_devices=`echo \`cat /sys/bus/mmc/devices/*/*/device\``
+ ven_idx=0
+
+ for vendor in $sdio_vendors; do
+ case "$vendor" in
+ "0x0271")
+ dev_idx=0
+ for device in $sdio_devices; do
+ if [ $ven_idx -eq $dev_idx ]; then
+ case "$device" in
+ "0x0400" | "0x0401")
+ wlanchip="AR6004-SDIO"
+ ;;
+ *)
+ ;;
+ esac
+ fi
+ dev_idx=$(( $dev_idx + 1))
+ done
+ ;;
+ *)
+ ;;
+ esac
+ ven_idx=$(( $ven_idx + 1))
+ done
+ # auto detect ar6004-sdio card end
+ fi
+
+ echo "The WLAN Chip ID is $wlanchip"
+ case "$wlanchip" in
+ "AR6004-USB")
+ setprop wlan.driver.ath 2
+ rm /system/lib/modules/wlan.ko
+ rm /system/lib/modules/cfg80211.ko
+ ln -s /system/lib/modules/ath6kl-3.5/ath6kl_usb.ko \
+ /system/lib/modules/wlan.ko
+ ln -s /system/lib/modules/ath6kl-3.5/cfg80211.ko \
+ /system/lib/modules/cfg80211.ko
+ rm /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin
+ rm /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin
+ ln -s /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin_usb \
+ /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin
+ ln -s /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin_usb \
+ /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin
+
+ # Use different wpa_supplicant.conf template between wcn driver
+ # and ath6kl driver
+ rm /system/etc/wifi/wpa_supplicant.conf
+ ln -s /system/etc/wifi/wpa_supplicant_ath6kl.conf \
+ /system/etc/wifi/wpa_supplicant.conf
+ ;;
+ "AR6004-SDIO")
+ setprop wlan.driver.ath 2
+ setprop qcom.bluetooth.soc ath3k
+ btsoc="ath3k"
+ rm /system/lib/modules/wlan.ko
+ rm /system/lib/modules/cfg80211.ko
+ ln -s /system/lib/modules/ath6kl-3.5/ath6kl_sdio.ko \
+ /system/lib/modules/wlan.ko
+ ln -s /system/lib/modules/ath6kl-3.5/cfg80211.ko \
+ /system/lib/modules/cfg80211.ko
+ rm /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin
+ rm /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin
+ ln -s /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin_sdio \
+ /system/etc/firmware/ath6k/AR6004/hw1.3/fw.ram.bin
+ ln -s /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin_sdio \
+ /system/etc/firmware/ath6k/AR6004/hw1.3/bdata.bin
+
+ # Use different wpa_supplicant.conf template between wcn driver
+ # and ath6kl driver
+ rm /system/etc/wifi/wpa_supplicant.conf
+ ln -s /system/etc/wifi/wpa_supplicant_ath6kl.conf \
+ /system/etc/wifi/wpa_supplicant.conf
+ ;;
+ *)
+ echo "*** WI-FI chip ID is not specified in /persist/wlan_chip_id **"
+ echo "*** Use the default WCN driver. **"
+ setprop wlan.driver.ath 0
+ rm /system/lib/modules/wlan.ko
+ rm /system/lib/modules/cfg80211.ko
+ ln -s /system/lib/modules/prima/prima_wlan.ko \
+ /system/lib/modules/wlan.ko
+ ln -s /system/lib/modules/prima/cfg80211.ko \
+ /system/lib/modules/cfg80211.ko
+
+ # The property below is used in Qcom SDK for softap to determine
+ # the wifi driver config file
+ setprop wlan.driver.config /data/misc/wifi/WCNSS_qcom_cfg.ini
+
+ # Use different wpa_supplicant.conf template between wcn driver
+ # and ath6kl driver
+ rm /system/etc/wifi/wpa_supplicant.conf
+ ln -s /system/etc/wifi/wpa_supplicant_wcn.conf \
+ /system/etc/wifi/wpa_supplicant.conf
+
+ # Trigger WCNSS platform driver
+ trigger_wcnss &
+ ;;
+ esac
+ ;;
+
+ msm7627a*)
+
+ # The default cfg80211 module is for volans
+ if [ ! -L /system/lib/modules/cfg80211.ko ]; then
+ mv /system/lib/modules/cfg80211.ko /system/lib/modules/volans/
+ fi
+
+ wlanchip=`cat /persist/wlan_chip_id`
+ echo "The WLAN Chip ID is $wlanchip"
+ case "$wlanchip" in
+ "ATH6KL")
+ setprop wlan.driver.ath 1
+ rm /system/lib/modules/wlan.ko
+ rm /system/lib/modules/cfg80211.ko
+ ln -s /system/lib/modules/ath6kl/ath6kl_sdio.ko \
+ /system/lib/modules/wlan.ko
+ ln -s /system/lib/modules/ath6kl/cfg80211.ko \
+ /system/lib/modules/cfg80211.ko
+ ;;
+ "WCN1314")
+ setprop wlan.driver.ath 0
+ rm /system/lib/modules/wlan.ko
+ rm /system/lib/modules/cfg80211.ko
+ ln -s /system/lib/modules/volans/WCN1314_rf.ko \
+ /system/lib/modules/wlan.ko
+ ln -s /system/lib/modules/volans/cfg80211.ko \
+ /system/lib/modules/cfg80211.ko
+ ;;
+ *)
+ setprop wlan.driver.ath 1
+ rm /system/lib/modules/wlan.ko
+ rm /system/lib/modules/cfg80211.ko
+ ln -s /system/lib/modules/ath6kl/ath6kl_sdio.ko \
+ /system/lib/modules/wlan.ko
+ ln -s /system/lib/modules/ath6kl/cfg80211.ko \
+ /system/lib/modules/cfg80211.ko
+ echo "************************************************************"
+ echo "*** Error:WI-FI chip ID is not specified in"
+ echo "/persist/wlan_chip_id"
+ echo "******* WI-FI may not work ***************************"
+ ;;
+ esac
+ ;;
+
+ msm7627*)
+ ln -s /data/hostapd/qcom_cfg.ini /etc/firmware/wlan/qcom_cfg.ini
+ ln -s /persist/qcom_wlan_nv.bin /etc/firmware/wlan/qcom_wlan_nv.bin
+ ;;
+
+ msm8660*)
+ ;;
+
+ msm7630*)
+ ;;
+
+ *)
+ ;;
+esac
+
+# Run audio init script
+/system/bin/sh /system/etc/init.qcom.audio.sh "$target" "$btsoc"