diff --git a/common.mk b/common.mk index 9264c7d..9f8910c 100644 --- a/common.mk +++ b/common.mk @@ -45,6 +45,33 @@ PRODUCT_PACKAGES += \ android.hidl.manager@1.0 \ android.hidl.manager@1.0_system +# Init scripts +PRODUCT_COPY_FILES += \ + $(LOCAL_PATH)/rootdir/etc/init.msm.usb.configfs.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.msm.usb.configfs.rc \ + $(LOCAL_PATH)/rootdir/etc/init.qcom.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.qcom.rc \ + $(LOCAL_PATH)/rootdir/etc/init.qcom.factory.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.qcom.factory.rc \ + $(LOCAL_PATH)/rootdir/etc/init.qcom.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.qcom.usb.rc \ + $(LOCAL_PATH)/rootdir/etc/init.target.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.target.rc + +PRODUCT_COPY_FILES += \ + $(LOCAL_PATH)/rootdir/bin/init.class_main.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.class_main.sh \ + $(LOCAL_PATH)/rootdir/bin/init.crda.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.crda.sh \ + $(LOCAL_PATH)/rootdir/bin/init.mdm.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.mdm.sh \ + $(LOCAL_PATH)/rootdir/bin/init.mi.usb.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.mi.usb.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qcom.class_core.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.class_core.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qcom.coex.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.coex.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qcom.crashdata.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.crashdata.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qcom.early_boot.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.early_boot.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qcom.efs.sync.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.efs.sync.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qcom.post_boot.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.post_boot.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qcom.sdio.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.sdio.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qcom.sensors.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.sensors.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qcom.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qcom.usb.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.usb.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qti.chg_policy.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qti.chg_policy.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qti.fm.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qti.fm.sh \ + $(LOCAL_PATH)/rootdir/bin/init.qti.ims.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qti.ims.sh + # Overlays DEVICE_PACKAGE_OVERLAYS += \ $(LOCAL_PATH)/overlay \ diff --git a/rootdir/bin/init.class_main.sh b/rootdir/bin/init.class_main.sh new file mode 100644 index 0000000..35e72ef --- /dev/null +++ b/rootdir/bin/init.class_main.sh @@ -0,0 +1,153 @@ +#! /vendor/bin/sh + +# Copyright (c) 2013-2014, 2019 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. +# + +# +# start ril-daemon only for targets on which radio is present +# +baseband=`getprop ro.baseband` +sgltecsfb=`getprop persist.vendor.radio.sglte_csfb` +datamode=`getprop persist.vendor.data.mode` +qcrild_status=true + +case "$baseband" in + "apq" | "sda" | "qcs" ) + setprop ro.vendor.radio.noril yes + stop ril-daemon + stop vendor.ril-daemon + stop vendor.qcrild +esac + +case "$baseband" in + "msm" | "csfb" | "svlte2a" | "mdm" | "mdm2" | "sglte" | "sglte2" | "dsda2" | "unknown" | "dsda3" | "sdm" | "sdx" | "sm6") + + # For older modem packages launch ril-daemon. + if [ -f /vendor/firmware_mnt/verinfo/ver_info.txt ]; then + modem=`cat /vendor/firmware_mnt/verinfo/ver_info.txt | + sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' | + sed 's/.*MPSS.\(.*\)/\1/g' | cut -d \. -f 1` + if [ "$modem" = "AT" ]; then + version=`cat /vendor/firmware_mnt/verinfo/ver_info.txt | + sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' | + sed 's/.*AT.\(.*\)/\1/g' | cut -d \- -f 1` + if [ ! -z $version ]; then + if [ "$version" \< "3.1" ]; then + qcrild_status=false + fi + fi + elif [ "$modem" = "TA" ]; then + version=`cat /vendor/firmware_mnt/verinfo/ver_info.txt | + sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' | + sed 's/.*TA.\(.*\)/\1/g' | cut -d \- -f 1` + if [ ! -z $version ]; then + if [ "$version" \< "3.0" ]; then + qcrild_status=false + fi + fi + elif [ "$modem" = "JO" ]; then + version=`cat /vendor/firmware_mnt/verinfo/ver_info.txt | + sed -n 's/^[^:]*modem[^:]*:[[:blank:]]*//p' | + sed 's/.*JO.\(.*\)/\1/g' | cut -d \- -f 1` + if [ ! -z $version ]; then + if [ "$version" \< "3.2" ]; then + qcrild_status=false + fi + fi + elif [ "$modem" = "TH" ]; then + qcrild_status=false + fi + fi + + if [ "$qcrild_status" = "true" ]; then + # Make sure both rild, qcrild are not running at same time. + # This is possible with vanilla aosp system image. + stop ril-daemon + stop vendor.ril-daemon + + start vendor.qcrild + else + start ril-daemon + start vendor.ril-daemon + fi + + case "$baseband" in + "svlte2a" | "csfb") + start qmiproxy + ;; + "sglte" | "sglte2" ) + if [ "x$sgltecsfb" != "xtrue" ]; then + start qmiproxy + else + setprop persist.vendor.radio.voice.modem.index 0 + fi + ;; + esac + + multisim=`getprop persist.radio.multisim.config` + + if [ "$multisim" = "dsds" ] || [ "$multisim" = "dsda" ]; then + if [ "$qcrild_status" = "true" ]; then + start vendor.qcrild2 + else + start vendor.ril-daemon2 + fi + elif [ "$multisim" = "tsts" ]; then + if [ "$qcrild_status" = "true" ]; then + start vendor.qcrild2 + start vendor.qcrild3 + else + start vendor.ril-daemon2 + start vendor.ril-daemon3 + fi + fi + + case "$datamode" in + "tethered") + start vendor.dataqti + start vendor.dataadpl + ;; + "concurrent") + start vendor.dataqti + start vendor.dataadpl + ;; + *) + ;; + esac +esac + +# +# Allow persistent faking of bms +# User needs to set fake bms charge in persist.vendor.bms.fake_batt_capacity +# +fake_batt_capacity=`getprop persist.vendor.bms.fake_batt_capacity` +case "$fake_batt_capacity" in + "") ;; #Do nothing here + * ) + echo "$fake_batt_capacity" > /sys/class/power_supply/battery/capacity + ;; +esac diff --git a/rootdir/bin/init.crda.sh b/rootdir/bin/init.crda.sh new file mode 100644 index 0000000..4264789 --- /dev/null +++ b/rootdir/bin/init.crda.sh @@ -0,0 +1,35 @@ +#! /vendor/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 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. +# + +country=`getprop wlan.crda.country` +# crda takes input in COUNTRY environment variable +if [ $country != "" ] +then +COUNTRY="$country" /system/bin/crda +fi diff --git a/rootdir/bin/init.mdm.sh b/rootdir/bin/init.mdm.sh new file mode 100644 index 0000000..3ed7ed5 --- /dev/null +++ b/rootdir/bin/init.mdm.sh @@ -0,0 +1,34 @@ +#! /vendor/bin/sh + +# Copyright (c) 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 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. +# + +baseband=`getprop ro.baseband` +if [ "$baseband" = "mdm" ] || [ "$baseband" = "mdm2" ]; then + start vendor.mdm_helper +fi + diff --git a/rootdir/bin/init.mi.usb.sh b/rootdir/bin/init.mi.usb.sh new file mode 100644 index 0000000..4d5a0b5 --- /dev/null +++ b/rootdir/bin/init.mi.usb.sh @@ -0,0 +1,7 @@ +#!/vendor/bin/sh +usb_config=`getprop vendor.usb.mimode` + +if [ "$(getprop persist.vendor.usb.config)" != "$usb_config" -a \ + "$(getprop ro.boot.factorybuild)" != "1" ];then + setprop persist.vendor.usb.config "$usb_config" +fi diff --git a/rootdir/bin/init.qcom.class_core.sh b/rootdir/bin/init.qcom.class_core.sh new file mode 100644 index 0000000..8f8265d --- /dev/null +++ b/rootdir/bin/init.qcom.class_core.sh @@ -0,0 +1,216 @@ +#!/vendor/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. +# + +# Set platform variables +target=`getprop ro.board.platform` +if [ -f /sys/devices/soc0/hw_platform ]; then + soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null +else + soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null +fi +if [ -f /sys/devices/soc0/soc_id ]; then + soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null +else + soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null +fi +if [ -f /sys/devices/soc0/platform_version ]; then + soc_hwver=`cat /sys/devices/soc0/platform_version` 2> /dev/null +else + soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null +fi + + +# Dynamic Memory Managment (DMM) provides a sys file system to the userspace +# that can be used to plug in/out memory that has been configured as unstable. +# This unstable memory can be in Active or In-Active State. +# Each of which the userspace can request by writing to a sys file. +# +# ro.dev.dmm = 1; Indicates that DMM is enabled in the Android User Space. This +# property is set in the Android system properties file. +# +# If ro.dev.dmm.dpd.start_address is set here then the target has a memory +# configuration that supports DynamicMemoryManagement. +init_DMM() +{ + block=-1 + + case "$target" in + "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "msm8960") + ;; + *) + return + ;; + esac + + mem="/sys/devices/system/memory" + op=`cat $mem/movable_start_bytes` + case "$op" in + "0") + log -p i -t DMM DMM Disabled. movable_start_bytes not set: $op + ;; + + "$mem/movable_start_bytes: No such file or directory ") + log -p i -t DMM DMM Disabled. movable_start_bytes does not exist: $op + ;; + + *) + log -p i -t DMM DMM available. movable_start_bytes at $op + movable_start_bytes=0x`cat $mem/movable_start_bytes` + block_size_bytes=0x`cat $mem/block_size_bytes` + block=$((#${movable_start_bytes}/${block_size_bytes})) + + chown -h system.system $mem/memory$block/state + chown -h system.system $mem/probe + chown -h system.system $mem/active + chown -h system.system $mem/remove + + case "$target" in + "msm7630_surf" | "msm7630_1x" | "msm7630_fusion") + echo $movable_start_bytes > $mem/probe + case "$?" in + "0") + log -p i -t DMM $movable_start_bytes to physical hotplug succeeded. + ;; + *) + log -p e -t DMM $movable_start_bytes to physical hotplug failed. + return + ;; + esac + + echo online > $mem/memory$block/state + case "$?" in + "0") + log -p i -t DMM \'echo online\' to logical hotplug succeeded. + ;; + *) + log -p e -t DMM \'echo online\' to logical hotplug failed. + return + ;; + esac + ;; + esac + + setprop ro.dev.dmm.dpd.start_address $movable_start_bytes + setprop ro.dev.dmm.dpd.block $block + ;; + esac + + case "$target" in + "msm8960") + return + ;; + esac + + # For 7X30 targets: + # ro.dev.dmm.dpd.start_address is set when the target has a 2x256Mb memory + # configuration. This is also used to indicate that the target is capable of + # setting EBI-1 to Deep Power Down or Self Refresh. + op=`cat $mem/low_power_memory_start_bytes` + case "$op" in + "0") + log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes not set:$op + ;; + "$mem/low_power_memory_start_bytes No such file or directory ") + log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes does not exist:$op + ;; + *) + log -p i -t DMM Self-Refresh-Only available. low_power_memory_start_bytes at $op + ;; + esac +} + +# +# For controlling console and shell on console on 8960 - perist.serial.enable 8960 +# On other target use default ro.debuggable property. +# +serial=`getprop persist.serial.enable` +dserial=`getprop ro.debuggable` +case "$target" in + "msm8960") + case "$serial" in + "0") + echo 0 > /sys/devices/platform/msm_serial_hsl.0/console + ;; + "1") + echo 1 > /sys/devices/platform/msm_serial_hsl.0/console + start console + ;; + *) + case "$dserial" in + "1") + start console + ;; + esac + ;; + esac + ;; + + "msm8610" | "msm8974" | "msm8226") + case "$serial" in + "0") + echo 0 > /sys/devices/f991f000.serial/console + ;; + "1") + echo 1 > /sys/devices/f991f000.serial/console + start console + ;; + *) + case "$dserial" in + "1") + start console + ;; + esac + ;; + esac + ;; + *) + case "$dserial" in + "1") + start console + ;; + esac + ;; +esac + +case "$target" in + "msm7630_surf" | "msm7630_1x" | "msm7630_fusion") + insmod /system/lib/modules/ss_mfcinit.ko + insmod /system/lib/modules/ss_vencoder.ko + insmod /system/lib/modules/ss_vdecoder.ko + chmod -h 0666 /dev/ss_mfc_reg + chmod -h 0666 /dev/ss_vdec + chmod -h 0666 /dev/ss_venc + + init_DMM + ;; + + "msm8960") + init_DMM + ;; +esac diff --git a/rootdir/bin/init.qcom.coex.sh b/rootdir/bin/init.qcom.coex.sh new file mode 100644 index 0000000..a9a22f1 --- /dev/null +++ b/rootdir/bin/init.qcom.coex.sh @@ -0,0 +1,115 @@ +#! /vendor/bin/sh + +# Copyright (c) 2009-2010, 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 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. + +LOG_TAG="qcom-bt-wlan-coex" +LOG_NAME="${0}:" + +coex_pid="" +ath_wlan_supported=`getprop wlan.driver.ath` + +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 +} + +start_coex () +{ + case "$ath_wlan_supported" in + "2") + echo "ATH WLAN Chip ID AR6004 is enabled" + /system/bin/abtfilt -d -z -n -m -a -w wlan0 & + ;; + "1") + echo "ATH WLAN Chip ID is enabled" + # Must have -d -z -n -v -s -w wlan0 parameters for atheros btfilter. + /system/bin/abtfilt -d -z -n -v -q -s -w wlan0 & + ;; + "0") + echo "WCN WLAN Chip ID is enabled" + # Must have -o turned on to avoid daemon (otherwise we cannot get pid) + /system/bin/btwlancoex -o $opt_flags & + ;; + *) + echo "NO WLAN Chip ID is enabled, so enabling ATH as default" + # Must have -d -z -n -v -s -w wlan0 parameters for atheros btfilter. + /system/bin/abtfilt -d -z -n -v -q -s -w wlan0 & + ;; + esac + coex_pid=$! + logi "start_coex: pid = $coex_pid" +} + +kill_coex () +{ + logi "kill_coex: pid = $coex_pid" + kill -TERM $coex_pid + # this shell doesn't exit now -- wait returns for normal exit +} + +# mimic coex options parsing -- maybe a waste of effort +USAGE="${0} [-o] [-c] [-r] [-i] [-h]" + +while getopts "ocrih" f +do + case $f in + o | c | r | i | h) opt_flags="$opt_flags -$f" ;; + \?) echo $USAGE; exit 1;; + esac +done + +# init does SIGTERM on ctl.stop for service +trap "kill_coex" TERM INT + +#Selectively start coex module +target=`getprop ro.board.platform` + +if [ "$target" == "msm8960" ] && [ "$ath_wlan_supported" != "2" ]; then + logi "btwlancoex/abtfilt is not needed" +else + # Build settings may not produce the coex executable + if ls /system/bin/btwlancoex || ls /system/bin/abtfilt + then + start_coex + wait $coex_pid + logi "Coex stopped" + else + logi "btwlancoex/abtfilt not available" + fi +fi +exit 0 diff --git a/rootdir/bin/init.qcom.crashdata.sh b/rootdir/bin/init.qcom.crashdata.sh new file mode 100644 index 0000000..59cf68d --- /dev/null +++ b/rootdir/bin/init.qcom.crashdata.sh @@ -0,0 +1,48 @@ +#!/vendor/bin/sh +# Copyright (c) 2017, 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. +# + +abnormalcnt="persist.vendor.crash.cnt" + +abnormal_cnt=`getprop $abnormalcnt` +crash_detect=`getprop persist.vendor.crash.detect` + +if [ "$abnormal_cnt" = "" ] +then +setprop $abnormalcnt 0 +fi + +if [ "$crash_detect" = "true" ] +then +abnormal_cnt=`expr $abnormal_cnt + 1` +setprop $abnormalcnt $abnormal_cnt +elif [ "$crash_detect" = "false" ];then +setprop persist.vendor.crash.detect true +else +setprop persist.vendor.crash.detect true +fi diff --git a/rootdir/bin/init.qcom.early_boot.sh b/rootdir/bin/init.qcom.early_boot.sh new file mode 100644 index 0000000..59847d4 --- /dev/null +++ b/rootdir/bin/init.qcom.early_boot.sh @@ -0,0 +1,476 @@ +#! /vendor/bin/sh + +# Copyright (c) 2012-2013,2016,2018,2019 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. +# + +export PATH=/vendor/bin + +# Set platform variables +if [ -f /sys/devices/soc0/hw_platform ]; then + soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null +else + soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null +fi +if [ -f /sys/devices/soc0/soc_id ]; then + soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null +else + soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null +fi +if [ -f /sys/devices/soc0/platform_version ]; then + soc_hwver=`cat /sys/devices/soc0/platform_version` 2> /dev/null +else + soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null +fi + +if [ -f /sys/class/drm/card0-DSI-1/modes ]; then + echo "detect" > /sys/class/drm/card0-DSI-1/status + mode_file=/sys/class/drm/card0-DSI-1/modes + while read line; do + fb_width=${line%%x*}; + break; + done < $mode_file +elif [ -f /sys/class/graphics/fb0/virtual_size ]; then + res=`cat /sys/class/graphics/fb0/virtual_size` 2> /dev/null + fb_width=${res%,*} +fi + +log -t BOOT -p i "MSM target '$1', SoC '$soc_hwplatform', HwID '$soc_hwid', SoC ver '$soc_hwver'" + +#For drm based display driver +vbfile=/sys/module/drm/parameters/vblankoffdelay +if [ -w $vbfile ]; then + echo -1 > $vbfile +else + log -t DRM_BOOT -p w "file: '$vbfile' or perms doesn't exist" +fi + +function set_density_by_fb() { + #put default density based on width + if [ -z $fb_width ]; then + setprop vendor.display.lcd_density 320 + else + if [ $fb_width -ge 1600 ]; then + setprop vendor.display.lcd_density 640 + elif [ $fb_width -ge 1440 ]; then + setprop vendor.display.lcd_density 560 + elif [ $fb_width -ge 1080 ]; then + setprop vendor.display.lcd_density 480 + elif [ $fb_width -ge 720 ]; then + setprop vendor.display.lcd_density 320 #for 720X1280 resolution + elif [ $fb_width -ge 480 ]; then + setprop vendor.display.lcd_density 240 #for 480X854 QRD resolution + else + setprop vendor.display.lcd_density 160 + fi + fi +} + +target=`getprop ro.board.platform` +case "$target" in + "msm7630_surf" | "msm7630_1x" | "msm7630_fusion") + case "$soc_hwplatform" in + "FFA" | "SVLTE_FFA") + # linking to surf_keypad_qwerty.kcm.bin instead of surf_keypad_numeric.kcm.bin so that + # the UI keyboard works fine. + ln -s /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin + ;; + "Fluid") + setprop vendor.display.lcd_density 240 + setprop qcom.bt.dev_power_class 2 + ;; + *) + ln -s /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin + ;; + esac + ;; + "sm6150") + case "$soc_hwplatform" in + "ADP") + setprop vendor.display.lcd_density 160 + ;; + esac + case "$soc_hwid" in + 365|366) + sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc1/sku_version` 2> /dev/null + setprop vendor.media.target.version 1 + if [ $sku_ver -eq 1 ]; then + setprop vendor.media.target.version 2 + fi + ;; + 355|369|377|384) + setprop vendor.chre.enabled 0 + ;; + *) + esac + ;; + "msm8660") + case "$soc_hwplatform" in + "Fluid") + setprop vendor.display.lcd_density 240 + ;; + "Dragon") + setprop ro.sound.alsa "WM8903" + ;; + esac + ;; + + "msm8960") + # lcd density is write-once. Hence the separate switch case + case "$soc_hwplatform" in + "Liquid") + if [ "$soc_hwver" == "196608" ]; then # version 0x30000 is 3D sku + setprop ro.sf.hwrotation 90 + fi + + setprop vendor.display.lcd_density 160 + ;; + "MTP") + setprop vendor.display.lcd_density 240 + ;; + *) + case "$soc_hwid" in + "109") + setprop vendor.display.lcd_density 160 + ;; + *) + setprop vendor.display.lcd_density 240 + ;; + esac + ;; + esac + + #Set up composition type based on the target + case "$soc_hwid" in + 87) + #8960 + setprop debug.composition.type dyn + ;; + 153|154|155|156|157|138) + #8064 V2 PRIME | 8930AB | 8630AB | 8230AB | 8030AB | 8960AB + setprop debug.composition.type c2d + ;; + *) + esac + ;; + + "msm8974") + case "$soc_hwplatform" in + "Liquid") + setprop vendor.display.lcd_density 160 + # Liquid do not have hardware navigation keys, so enable + # Android sw navigation bar + setprop ro.hw.nav_keys 0 + ;; + "Dragon") + setprop vendor.display.lcd_density 240 + ;; + *) + setprop vendor.display.lcd_density 320 + ;; + esac + ;; + + "msm8226") + case "$soc_hwplatform" in + *) + setprop vendor.display.lcd_density 320 + ;; + esac + ;; + + "msm8610" | "apq8084" | "mpq8092") + case "$soc_hwplatform" in + *) + setprop vendor.display.lcd_density 240 + ;; + esac + ;; + "apq8084") + case "$soc_hwplatform" in + "Liquid") + setprop vendor.display.lcd_density 320 + # Liquid do not have hardware navigation keys, so enable + # Android sw navigation bar + setprop ro.hw.nav_keys 0 + ;; + "SBC") + setprop vendor.display.lcd_density 200 + # SBC do not have hardware navigation keys, so enable + # Android sw navigation bar + setprop qemu.hw.mainkeys 0 + ;; + *) + setprop vendor.display.lcd_density 480 + ;; + esac + ;; + "msm8996") + case "$soc_hwplatform" in + "Dragon") + setprop vendor.display.lcd_density 240 + setprop qemu.hw.mainkeys 0 + ;; + "ADP") + setprop vendor.display.lcd_density 160 + setprop qemu.hw.mainkeys 0 + ;; + "SBC") + setprop vendor.display.lcd_density 240 + setprop qemu.hw.mainkeys 0 + ;; + *) + setprop vendor.display.lcd_density 560 + ;; + esac + ;; + "msm8937" | "msm8940") + # Set vendor.opengles.version based on chip id. + # MSM8937 and MSM8940 variants supports OpenGLES 3.1 + # 196608 is decimal for 0x30000 to report version 3.0 + # 196609 is decimal for 0x30001 to report version 3.1 + # 196610 is decimal for 0x30002 to report version 3.2 + case "$soc_hwid" in + 294|295|296|297|298|313|353|354|363|364) + setprop vendor.opengles.version 196610 + if [ $soc_hwid = 354 ] + then + setprop vendor.media.target.version 1 + log -t BOOT -p i "SDM429 early_boot prop set for: HwID '$soc_hwid'" + fi + ;; + 303|307|308|309|320) + # Vulkan is not supported for 8917 variants + setprop vendor.opengles.version 196608 + setprop persist.graphics.vulkan.disable true + ;; + *) + setprop vendor.opengles.version 196608 + ;; + esac + ;; + "msm8909") + case "$soc_hwplatform" in + *) + setprop persist.graphics.vulkan.disable true + ;; + esac + ;; + "msm8998" | "apq8098_latv") + case "$soc_hwplatform" in + *) + setprop vendor.display.lcd_density 560 + ;; + esac + ;; + "sdm845") + case "$soc_hwplatform" in + *) + if [ $fb_width -le 1600 ]; then + setprop vendor.display.lcd_density 560 + else + setprop vendor.display.lcd_density 640 + fi + ;; + esac + ;; + "msmnile") + case "$soc_hwplatform" in + *) + if [ $fb_width -le 1600 ]; then + setprop vendor.display.lcd_density 560 + else + setprop vendor.display.lcd_density 640 + fi + ;; + esac + ;; + "kona") + case "$soc_hwplatform" in + *) + if [ $fb_width -le 1600 ]; then + setprop vendor.display.lcd_density 560 + else + setprop vendor.display.lcd_density 640 + fi + ;; + esac + ;; + "lito") + case "$soc_hwplatform" in + *) + sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc1/sku_version` 2> /dev/null + if [ $sku_ver -eq 1 ]; then + setprop vendor.media.target.version 1 + fi + ;; + esac + ;; + "bengal") + case "$soc_hwplatform" in + *) + sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc/sku_version` 2> /dev/null + if [ $sku_ver -eq 1 ]; then + setprop vendor.media.target.version 1 + fi + ;; + esac + ;; + "sdm710" | "msmpeafowl") + case "$soc_hwplatform" in + *) + sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc1/sku_version` 2> /dev/null + if [ $sku_ver -eq 1 ]; then + setprop vendor.media.target.version 1 + fi + ;; + esac + ;; + "msm8953") + cap_ver = 1 + if [ -e "/sys/devices/platform/soc/1d00000.qcom,vidc/capability_version" ]; then + cap_ver=`cat /sys/devices/platform/soc/1d00000.qcom,vidc/capability_version` 2> /dev/null + else + cap_ver=`cat /sys/devices/soc/1d00000.qcom,vidc/capability_version` 2> /dev/null + fi + + if [ $cap_ver -eq 1 ]; then + setprop vendor.media.target.version 1 + fi + ;; + #Set property to differentiate SDM660 & SDM455 + #SOC ID for SDM455 is 385 + "sdm660") + case "$soc_hwid" in + 385) + setprop vendor.media.target.version 1 + esac + ;; +esac + +baseband=`getprop ro.baseband` +#enable atfwd daemon all targets except sda, apq, qcs +case "$baseband" in + "apq" | "sda" | "qcs" ) + setprop persist.vendor.radio.atfwd.start false;; + *) + setprop persist.vendor.radio.atfwd.start true;; +esac + +#set default lcd density +#Since lcd density has read only +#property, it will not overwrite previous set +#property if any target is setting forcefully. +set_density_by_fb + + +# set Lilliput LCD density for ADP +product=`getprop ro.build.product` + +case "$product" in + "msmnile_au") + setprop vendor.display.lcd_density 160 + echo 902400000 > /sys/class/devfreq/soc:qcom,cpu0-cpu-l3-lat/min_freq + echo 1612800000 > /sys/class/devfreq/soc:qcom,cpu0-cpu-l3-lat/max_freq + echo 902400000 > /sys/class/devfreq/soc:qcom,cpu4-cpu-l3-lat/min_freq + echo 1612800000 > /sys/class/devfreq/soc:qcom,cpu4-cpu-l3-lat/max_freq + ;; + *) + ;; +esac +case "$product" in + "sm6150_au") + setprop vendor.display.lcd_density 160 + ;; + *) + ;; +esac +case "$product" in + "sdmshrike_au") + setprop vendor.display.lcd_density 160 + echo 940800000 > /sys/class/devfreq/soc:qcom,cpu0-cpu-l3-lat/min_freq + echo 940800000 > /sys/class/devfreq/soc:qcom,cpu4-cpu-l3-lat/min_freq + ;; + *) + ;; +esac + +case "$product" in + "msmnile_gvmq") + setprop vendor.display.lcd_density 160 + ;; + *) + ;; +esac +# Setup display nodes & permissions +# HDMI can be fb1 or fb2 +# Loop through the sysfs nodes and determine +# the HDMI(dtv panel) + +function set_perms() { + #Usage set_perms + chown -h $2 $1 + chmod $3 $1 +} + +# check for the type of driver FB or DRM +fb_driver=/sys/class/graphics/fb0 +if [ -e "$fb_driver" ] +then + # check for mdp caps + file=/sys/class/graphics/fb0/mdp/caps + if [ -f "$file" ] + then + setprop vendor.gralloc.disable_ubwc 1 + cat $file | while read line; do + case "$line" in + *"ubwc"*) + setprop vendor.gralloc.enable_fb_ubwc 1 + setprop vendor.gralloc.disable_ubwc 0 + esac + done + fi +else + set_perms /sys/devices/virtual/hdcp/msm_hdcp/min_level_change system.graphics 0660 +fi + +# allow system_graphics group to access pmic secure_mode node +set_perms /sys/class/lcd_bias/secure_mode system.graphics 0660 +set_perms /sys/class/leds/wled/secure_mode system.graphics 0660 + +boot_reason=`cat /proc/sys/kernel/boot_reason` +reboot_reason=`getprop ro.boot.alarmboot` +if [ "$boot_reason" = "3" ] || [ "$reboot_reason" = "true" ]; then + setprop ro.vendor.alarm_boot true +else + setprop ro.vendor.alarm_boot false +fi + +# copy GPU frequencies to vendor property +if [ -f /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies ]; then + gpu_freq=`cat /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies` 2> /dev/null + setprop vendor.gpu.available_frequencies "$gpu_freq" +fi diff --git a/rootdir/bin/init.qcom.efs.sync.sh b/rootdir/bin/init.qcom.efs.sync.sh new file mode 100644 index 0000000..5e7bfa1 --- /dev/null +++ b/rootdir/bin/init.qcom.efs.sync.sh @@ -0,0 +1,35 @@ +#! /vendor/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/bin/init.qcom.post_boot.sh b/rootdir/bin/init.qcom.post_boot.sh new file mode 100644 index 0000000..6465a98 --- /dev/null +++ b/rootdir/bin/init.qcom.post_boot.sh @@ -0,0 +1,5595 @@ +#! /vendor/bin/sh + +# Copyright (c) 2012-2013, 2016-2019, 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. +# + +function 8953_sched_dcvs_eas() +{ + #governor settings + echo 1 > /sys/devices/system/cpu/cpu0/online + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/schedutil/rate_limit_us + #set the hispeed_freq + echo 1401600 > /sys/devices/system/cpu/cpufreq/schedutil/hispeed_freq + #default value for hispeed_load is 90, for 8953 and sdm450 it should be 85 + echo 85 > /sys/devices/system/cpu/cpufreq/schedutil/hispeed_load +} + +function 8917_sched_dcvs_eas() +{ + #governor settings + echo 1 > /sys/devices/system/cpu/cpu0/online + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/schedutil/rate_limit_us + #set the hispeed_freq + echo 1094400 > /sys/devices/system/cpu/cpufreq/schedutil/hispeed_freq + #default value for hispeed_load is 90, for 8917 it should be 85 + echo 85 > /sys/devices/system/cpu/cpufreq/schedutil/hispeed_load +} + +function 8937_sched_dcvs_eas() +{ + # enable governor for perf cluster + echo 1 > /sys/devices/system/cpu/cpu0/online + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us + #set the hispeed_freq + echo 1094400 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + #default value for hispeed_load is 90, for 8937 it should be 85 + echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load + ## enable governor for power cluster + echo 1 > /sys/devices/system/cpu/cpu4/online + echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/rate_limit_us + #set the hispeed_freq + echo 768000 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq + #default value for hispeed_load is 90, for 8937 it should be 85 + echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_load + +} + +function configure_automotive_sku_parameters() { + + echo 1036800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 1171200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq + echo 1785600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq + +#read feature id from nvram +reg_val=`cat /sys/devices/platform/soc/780130.qfprom/qfprom0/nvmem | od -An -t d4` +feature_id=$(((reg_val >> 20) & 0xFF)) +log -t BOOT -p i "feature id '$feature_id'" +if [ $feature_id == 0 ]; then + echo " SKU Configured : SA8155P" + echo 2131200 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + echo 2419200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq + echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel +elif [ $feature_id == 1 ]; then + echo "SKU Configured : SA8150P" + echo 1920000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + echo 2227200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq + echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel +else + echo "unknown feature_id value" $feature_id +fi +} + +function configure_sku_parameters() { + +#read feature id from nvram +reg_val=`cat /sys/devices/platform/soc/780130.qfprom/qfprom0/nvmem | od -An -t d4` +feature_id=$(((reg_val >> 20) & 0xFF)) +log -t BOOT -p i "feature id '$feature_id'" +if [ $feature_id == 6 ]; then + echo " SKU Configured : SA6145" + echo 748800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq + echo 1017600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq + echo 1017600 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq + echo 748800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq + echo 748800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq + echo 748800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq + echo 748800 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + echo 748800 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq + echo 1017600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq + echo 1017600 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq + echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/min_freq + echo 1017600000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq + echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/min_freq + echo 1017600000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/max_freq + echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel + echo {class:ddr, res:fixed, val: 1016} > /sys/kernel/debug/aop_send_message + setprop vendor.sku_identified 1 +elif [ $feature_id == 5 ]; then + echo "SKU Configured : SA6150" + echo 748800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq + echo 1017600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq + echo 1017600 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq + echo 998400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq + echo 998400 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq + echo 998400 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq + echo 998400 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq + echo 998400 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + echo 998400 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq + echo 1708800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq + echo 1708800 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq + echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/min_freq + echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq + echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/min_freq + echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/max_freq + echo 2 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel + echo {class:ddr, res:fixed, val: 1333} > /sys/kernel/debug/aop_send_message + setprop vendor.sku_identified 1 +elif [ $feature_id == 4 || $feature_id == 3 ]; then + echo "SKU Configured : SA6155" + echo 748800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq + echo 1017600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq + echo 1017600 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq + echo 1593600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq + echo 1593600 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq + echo 1593600 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq + echo 1593600 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq + echo 1593600 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + echo 1593600 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq + echo 1900800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq + echo 1900800 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq + echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/min_freq + echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq + echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/min_freq + echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/max_freq + echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel + echo {class:ddr, res:fixed, val: 1555} > /sys/kernel/debug/aop_send_message + setprop vendor.sku_identified 1 +else + echo "unknown feature_id value" $feature_id + echo 748800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq + echo 1017600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq + echo 1017600 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq + echo 1593600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq + echo 1593600 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq + echo 1593600 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq + echo 1593600 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq + echo 1593600 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + echo 1593600 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq + echo 1900800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq + echo 1900800 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq + echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/min_freq + echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq + echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/min_freq + echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/max_freq + echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel + echo {class:ddr, res:fixed, val: 1555} > /sys/kernel/debug/aop_send_message + setprop vendor.sku_identified 1 +fi +} + +function 8953_sched_dcvs_hmp() +{ + #scheduler settings + echo 3 > /proc/sys/kernel/sched_window_stats_policy + echo 3 > /proc/sys/kernel/sched_ravg_hist_size + #task packing settings + echo 0 > /sys/devices/system/cpu/cpu0/sched_static_cpu_pwr_cost + echo 0 > /sys/devices/system/cpu/cpu1/sched_static_cpu_pwr_cost + echo 0 > /sys/devices/system/cpu/cpu2/sched_static_cpu_pwr_cost + echo 0 > /sys/devices/system/cpu/cpu3/sched_static_cpu_pwr_cost + echo 0 > /sys/devices/system/cpu/cpu4/sched_static_cpu_pwr_cost + echo 0 > /sys/devices/system/cpu/cpu5/sched_static_cpu_pwr_cost + echo 0 > /sys/devices/system/cpu/cpu6/sched_static_cpu_pwr_cost + echo 0 > /sys/devices/system/cpu/cpu7/sched_static_cpu_pwr_cost + # spill load is set to 100% by default in the kernel + echo 3 > /proc/sys/kernel/sched_spill_nr_run + # Apply inter-cluster load balancer restrictions + echo 1 > /proc/sys/kernel/sched_restrict_cluster_spill + # set sync wakee policy tunable + echo 1 > /proc/sys/kernel/sched_prefer_sync_wakee_to_waker + + #governor settings + echo 1 > /sys/devices/system/cpu/cpu0/online + echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo "19000 1401600:39000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay + echo 85 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load + echo 20000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate + echo 1401600 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy + echo "85 1401600:80" > /sys/devices/system/cpu/cpufreq/interactive/target_loads + echo 39000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time + echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor + echo 19 > /proc/sys/kernel/sched_upmigrate_min_nice + # Enable sched guided freq control + echo 1 > /sys/devices/system/cpu/cpufreq/interactive/use_sched_load + echo 1 > /sys/devices/system/cpu/cpufreq/interactive/use_migration_notif + echo 200000 > /proc/sys/kernel/sched_freq_inc_notify + echo 200000 > /proc/sys/kernel/sched_freq_dec_notify + +} + +function 8917_sched_dcvs_hmp() +{ + # HMP scheduler settings + echo 3 > /proc/sys/kernel/sched_window_stats_policy + echo 3 > /proc/sys/kernel/sched_ravg_hist_size + echo 1 > /proc/sys/kernel/sched_restrict_tasks_spread + # HMP Task packing settings + 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 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 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 1 > /sys/devices/system/cpu/cpu0/online + echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo "19000 1094400:39000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay + echo 85 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load + echo 20000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate + echo 1094400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpufreq/interactive/io_is_busy + echo "1 960000:85 1094400:90" > /sys/devices/system/cpu/cpufreq/interactive/target_loads + echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time + echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/sampling_down_factor + + # Enable sched guided freq control + echo 1 > /sys/devices/system/cpu/cpufreq/interactive/use_sched_load + echo 1 > /sys/devices/system/cpu/cpufreq/interactive/use_migration_notif + echo 50000 > /proc/sys/kernel/sched_freq_inc_notify + echo 50000 > /proc/sys/kernel/sched_freq_dec_notify +} + +function 8937_sched_dcvs_hmp() +{ + # HMP scheduler settings + echo 3 > /proc/sys/kernel/sched_window_stats_policy + echo 3 > /proc/sys/kernel/sched_ravg_hist_size + # HMP Task packing settings + 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 + # 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 1094400: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 1094400 > /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 1094400: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 + + # 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 > /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 768000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy + echo "1 768000: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 + + # 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 + +} +target=`getprop ro.board.platform` + +function configure_zram_parameters() { + MemTotalStr=`cat /proc/meminfo | grep MemTotal` + MemTotal=${MemTotalStr:16:8} + + low_ram=`getprop ro.config.low_ram` + + # Zram disk - 75% for Go devices. + # For 512MB Go device, size = 384MB, set same for Non-Go. + # For 1GB Go device, size = 768MB, set same for Non-Go. + # For >=2GB Non-Go devices, size = 50% of RAM size. Limit the size to 4GB. + # And enable lz4 zram compression for Go targets. + + RamSizeGB=`echo "($MemTotal / 1048576 ) + 1" | bc` + zRamSizeBytes=`echo "$RamSizeGB * 1024 * 1024 * 1024 / 2" | bc` + if [ $zRamSizeBytes -gt 4294967296 ]; then + zRamSizeBytes=4294967296 + fi + + if [ "$low_ram" == "true" ]; then + echo lz4 > /sys/block/zram0/comp_algorithm + fi + + if [ -f /sys/block/zram0/disksize ]; then + if [ -f /sys/block/zram0/use_dedup ]; then + echo 1 > /sys/block/zram0/use_dedup + fi + if [ $MemTotal -le 524288 ]; then + echo 402653184 > /sys/block/zram0/disksize + elif [ $MemTotal -le 1048576 ]; then + echo 805306368 > /sys/block/zram0/disksize + else + echo $zRamSizeBytes > /sys/block/zram0/disksize + fi + mkswap /dev/block/zram0 + swapon /dev/block/zram0 -p 32758 + fi +} + +function configure_read_ahead_kb_values() { + MemTotalStr=`cat /proc/meminfo | grep MemTotal` + MemTotal=${MemTotalStr:16:8} + + # Set 128 for <= 3GB & + # set 512 for >= 4GB targets. + if [ $MemTotal -le 3145728 ]; then + echo 128 > /sys/block/mmcblk0/bdi/read_ahead_kb + echo 128 > /sys/block/mmcblk0/queue/read_ahead_kb + echo 128 > /sys/block/mmcblk0rpmb/bdi/read_ahead_kb + echo 128 > /sys/block/mmcblk0rpmb/queue/read_ahead_kb + echo 128 > /sys/block/dm-0/queue/read_ahead_kb + echo 128 > /sys/block/dm-1/queue/read_ahead_kb + echo 128 > /sys/block/dm-2/queue/read_ahead_kb + else + echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb + echo 512 > /sys/block/mmcblk0/queue/read_ahead_kb + echo 512 > /sys/block/mmcblk0rpmb/bdi/read_ahead_kb + echo 512 > /sys/block/mmcblk0rpmb/queue/read_ahead_kb + echo 512 > /sys/block/dm-0/queue/read_ahead_kb + echo 512 > /sys/block/dm-1/queue/read_ahead_kb + echo 512 > /sys/block/dm-2/queue/read_ahead_kb + fi +} + +function disable_core_ctl() { + if [ -f /sys/devices/system/cpu/cpu0/core_ctl/enable ]; then + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable + else + echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/disable + fi +} + +function enable_swap() { + MemTotalStr=`cat /proc/meminfo | grep MemTotal` + MemTotal=${MemTotalStr:16:8} + + SWAP_ENABLE_THRESHOLD=1048576 + swap_enable=`getprop ro.vendor.qti.config.swap` + + # Enable swap initially only for 1 GB targets + if [ "$MemTotal" -le "$SWAP_ENABLE_THRESHOLD" ] && [ "$swap_enable" == "true" ]; then + # Static swiftness + echo 1 > /proc/sys/vm/swap_ratio_enable + echo 70 > /proc/sys/vm/swap_ratio + + # Swap disk - 200MB size + if [ ! -f /data/vendor/swap/swapfile ]; then + dd if=/dev/zero of=/data/vendor/swap/swapfile bs=1m count=200 + fi + mkswap /data/vendor/swap/swapfile + swapon /data/vendor/swap/swapfile -p 32758 + fi +} + +function configure_memory_parameters() { + # Set Memory parameters. + # + # Set per_process_reclaim tuning parameters + # All targets will use vmpressure range 50-70, + # All targets will use 512 pages swap size. + # + # Set Low memory killer minfree parameters + # 32 bit Non-Go, all memory configurations will use 15K series + # 32 bit Go, all memory configurations will use uLMK + Memcg + # 64 bit will use Google default LMK series. + # + # Set ALMK parameters (usually above the highest minfree values) + # vmpressure_file_min threshold is always set slightly higher + # than LMK minfree's last bin value for all targets. It is calculated as + # vmpressure_file_min = (last bin - second last bin ) + last bin + # + # Set allocstall_threshold to 0 for all targets. + # + +ProductName=`getprop ro.product.name` +low_ram=`getprop ro.config.low_ram` + +if [ "$ProductName" == "msmnile" ] || [ "$ProductName" == "kona" ] || [ "$ProductName" == "sdmshrike_au" ]; then + # Enable ZRAM + configure_zram_parameters + configure_read_ahead_kb_values + echo 0 > /proc/sys/vm/page-cluster + echo 100 > /proc/sys/vm/swappiness +else + arch_type=`uname -m` + MemTotalStr=`cat /proc/meminfo | grep MemTotal` + MemTotal=${MemTotalStr:16:8} + + # Set parameters for 32-bit Go targets. + if [ $MemTotal -le 1048576 ] && [ "$low_ram" == "true" ]; then + # Disable KLMK, ALMK, PPR & Core Control for Go devices + echo 0 > /sys/module/lowmemorykiller/parameters/enable_lmk + echo 0 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk + echo 0 > /sys/module/process_reclaim/parameters/enable_process_reclaim + disable_core_ctl + # Enable oom_reaper for Go devices + if [ -f /proc/sys/vm/reap_mem_on_sigkill ]; then + echo 1 > /proc/sys/vm/reap_mem_on_sigkill + fi + else + + # Read adj series and set adj threshold for PPR and ALMK. + # This is required since adj values change from framework to framework. + adj_series=`cat /sys/module/lowmemorykiller/parameters/adj` + adj_1="${adj_series#*,}" + set_almk_ppr_adj="${adj_1%%,*}" + + # PPR and ALMK should not act on HOME adj and below. + # Normalized ADJ for HOME is 6. Hence multiply by 6 + # ADJ score represented as INT in LMK params, actual score can be in decimal + # Hence add 6 considering a worst case of 0.9 conversion to INT (0.9*6). + # For uLMK + Memcg, this will be set as 6 since adj is zero. + set_almk_ppr_adj=$(((set_almk_ppr_adj * 6) + 6)) + echo $set_almk_ppr_adj > /sys/module/lowmemorykiller/parameters/adj_max_shift + + # Calculate vmpressure_file_min as below & set for 64 bit: + # vmpressure_file_min = last_lmk_bin + (last_lmk_bin - last_but_one_lmk_bin) + if [ "$arch_type" == "aarch64" ]; then + minfree_series=`cat /sys/module/lowmemorykiller/parameters/minfree` + minfree_1="${minfree_series#*,}" ; rem_minfree_1="${minfree_1%%,*}" + minfree_2="${minfree_1#*,}" ; rem_minfree_2="${minfree_2%%,*}" + minfree_3="${minfree_2#*,}" ; rem_minfree_3="${minfree_3%%,*}" + minfree_4="${minfree_3#*,}" ; rem_minfree_4="${minfree_4%%,*}" + minfree_5="${minfree_4#*,}" + + vmpres_file_min=$((minfree_5 + (minfree_5 - rem_minfree_4))) + echo $vmpres_file_min > /sys/module/lowmemorykiller/parameters/vmpressure_file_min + if [ $MemTotal -gt 7602176 ]; then + echo "18432,23040,27648,45158,119414,168896" > /sys/module/lowmemorykiller/parameters/minfree + elif [ $MemTotal -gt 5505024 ]; then + echo "18432,23040,27648,38708,102356,144768" > /sys/module/lowmemorykiller/parameters/minfree + else + echo "18432,23040,27648,32256,55296,80640" > /sys/module/lowmemorykiller/parameters/minfree + fi + else + # Set LMK series, vmpressure_file_min for 32 bit non-go targets. + # Disable Core Control, enable KLMK for non-go 8909. + if [ "$ProductName" == "msm8909" ]; then + disable_core_ctl + echo 1 > /sys/module/lowmemorykiller/parameters/enable_lmk + fi + echo "15360,19200,23040,26880,34415,43737" > /sys/module/lowmemorykiller/parameters/minfree + echo 53059 > /sys/module/lowmemorykiller/parameters/vmpressure_file_min + fi + + # Enable adaptive LMK for all targets & + # use Google default LMK series for all 64-bit targets >=2GB. + echo 1 > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk + + # Enable oom_reaper + if [ -f /sys/module/lowmemorykiller/parameters/oom_reaper ]; then + echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper + fi + + # Set PPR parameters + 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 + # Do not set PPR parameters for premium targets + # sdm845 - 321, 341 + # msm8998 - 292, 319 + # msm8996 - 246, 291, 305, 312 + "321" | "341" | "292" | "319" | "246" | "291" | "305" | "312") + ;; + *) + #Set PPR parameters for all other targets. + echo $set_almk_ppr_adj > /sys/module/process_reclaim/parameters/min_score_adj + echo 0 > /sys/module/process_reclaim/parameters/enable_process_reclaim + echo 50 > /sys/module/process_reclaim/parameters/pressure_min + echo 70 > /sys/module/process_reclaim/parameters/pressure_max + echo 30 > /sys/module/process_reclaim/parameters/swap_opt_eff + echo 512 > /sys/module/process_reclaim/parameters/per_swap_size + ;; + esac + fi + + # Set allocstall_threshold to 0 for all targets. + # Set swappiness to 100 for all targets + echo 0 > /sys/module/vmpressure/parameters/allocstall_threshold + echo 100 > /proc/sys/vm/swappiness + + # Disable wsf for all targets beacause we are using efk. + # wsf Range : 1..1000 So set to bare minimum value 1. + echo 1 > /proc/sys/vm/watermark_scale_factor + + configure_zram_parameters + + configure_read_ahead_kb_values + + enable_swap +fi +} + +function enable_memory_features() +{ + MemTotalStr=`cat /proc/meminfo | grep MemTotal` + MemTotal=${MemTotalStr:16:8} + + if [ $MemTotal -le 2097152 ]; then + #Enable B service adj transition for 2GB or less memory + setprop ro.vendor.qti.sys.fw.bservice_enable true + setprop ro.vendor.qti.sys.fw.bservice_limit 5 + setprop ro.vendor.qti.sys.fw.bservice_age 5000 + + #Enable Delay Service Restart + setprop ro.vendor.qti.am.reschedule_service true + fi +} + +function start_hbtp() +{ + # Start the Host based Touch processing but not in the power off mode. + bootmode=`getprop ro.bootmode` + if [ "charger" != $bootmode ]; then + start vendor.hbtp + fi +} + +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 + ;; + *) + 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") + 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") + 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 + echo 2 > /sys/class/net/rmnet0/queues/rx-0/rps_cpus + ;; + "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 + 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 10 > /sys/class/net/rmnet0/queues/rx-0/rps_cpus + ;; + "233" | "240" | "242") + 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 + ;; +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 + + # HMP scheduler settings for 8916, 8936, 8939, 8929 + echo 3 > /proc/sys/kernel/sched_window_stats_policy + echo 3 > /proc/sys/kernel/sched_ravg_hist_size + + # 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 20 > /proc/sys/kernel/sched_small_task + echo 30 > /proc/sys/kernel/sched_mostly_idle_load + echo 3 > /proc/sys/kernel/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 + 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 30000 > /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 + + # 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 + ;; + 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 30000 > /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 + + # Enable low power modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + 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") + + if [ `cat /sys/devices/soc0/revision` != "3.0" ]; then + # Apply 1.0 and 2.0 specific Sched & Governor settings + + # HMP scheduler load tracking settings + echo 5 > /proc/sys/kernel/sched_ravg_hist_size + + # HMP Task packing settings for 8939, 8929 + echo 20 > /proc/sys/kernel/sched_small_task + + for devfreq_gov in /sys/class/devfreq/*qcom,mincpubw*/governor + do + echo "cpufreq" > $devfreq_gov + done + + 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 "20000 1113600:50000" > /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 50000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time + echo 50000 > /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 "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 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate + echo 998400 > /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/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 + + # Enable low power modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + # HMP scheduler (big.Little cluster related) settings + echo 75 > /proc/sys/kernel/sched_upmigrate + echo 60 > /proc/sys/kernel/sched_downmigrate + + # cpu idle load threshold + 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 + + # cpu idle nr run threshold + 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 + + else + # Apply 3.0 specific Sched & Governor settings + # 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 + echo 20000000 > /proc/sys/kernel/sched_ravg_window + + # HMP Task packing settings for 8939 V3.0 + echo 20 > /proc/sys/kernel/sched_small_task + echo 30 > /proc/sys/kernel/sched_mostly_idle_load + echo 3 > /proc/sys/kernel/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,mincpubw*/governor + do + echo "cpufreq" > $devfreq_gov + done + + 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 > /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 + + # Enable low power modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + # HMP scheduler (big.Little cluster related) settings + echo 93 > /proc/sys/kernel/sched_upmigrate + echo 83 > /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 + case "$revision" in + "3.0") + # Enable dynamic clock gatin + echo 1 > /sys/module/lpm_levels/lpm_workarounds/dynamic_clock_gating + ;; + esac + fi + ;; + esac + # Set Memory parameters + configure_memory_parameters + ;; +esac + +case "$target" in + "msm8952") + + 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 + "264" | "289") + # Apply Scheduler and Governor settings for 8952 + + # HMP scheduler settings + echo 3 > /proc/sys/kernel/sched_window_stats_policy + echo 3 > /proc/sys/kernel/sched_ravg_hist_size + echo 20000000 > /proc/sys/kernel/sched_ravg_window + + # HMP Task packing settings + 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 + + echo 0 > /proc/sys/kernel/sched_boost + + for devfreq_gov in /sys/class/devfreq/*qcom,mincpubw*/governor + do + echo "cpufreq" > $devfreq_gov + done + + 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 + for cpu_guard_band in /sys/class/devfreq/*qcom,cpubw*/bw_hwmon/guard_band_mbps + do + echo 30 > $cpu_guard_band + 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 & BCL core_control to update interactive gov settings + echo 0 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + bcl_hotplug_mask=`cat $hotplug_mask` + echo 0 > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + bcl_soc_hotplug_mask=`cat $hotplug_soc_mask` + echo 0 > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + + # 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 > /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 806400 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy + echo "1 806400: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 806400 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + + # 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 + echo 1 > /sys/devices/system/cpu/cpu5/online + echo 1 > /sys/devices/system/cpu/cpu6/online + echo 1 > /sys/devices/system/cpu/cpu7/online + + # Enable Low power modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + # HMP scheduler (big.Little cluster related) settings + echo 93 > /proc/sys/kernel/sched_upmigrate + echo 83 > /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 + 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 + echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster + + # re-enable thermal & BCL core_control now + echo 1 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + echo $bcl_hotplug_mask > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + echo $bcl_soc_hotplug_mask > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + + # Enable dynamic clock gating + echo 1 > /sys/module/lpm_levels/lpm_workarounds/dynamic_clock_gating + # Enable timer migration to little cluster + echo 1 > /proc/sys/kernel/power_aware_timer_migration + + # Set Memory parameters + configure_memory_parameters + + ;; + *) + panel=`cat /sys/class/graphics/fb0/modes` + if [ "${panel:5:1}" == "x" ]; then + panel=${panel:2:3} + else + panel=${panel:2:4} + fi + + # Apply Scheduler and Governor settings for 8976 + # SoC IDs are 266, 274, 277, 278 + + # HMP scheduler (big.Little cluster related) settings + echo 95 > /proc/sys/kernel/sched_upmigrate + echo 85 > /proc/sys/kernel/sched_downmigrate + + echo 2 > /proc/sys/kernel/sched_window_stats_policy + echo 5 > /proc/sys/kernel/sched_ravg_hist_size + + 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 + + for devfreq_gov in /sys/class/devfreq/*qcom,mincpubw*/governor + do + echo "cpufreq" > $devfreq_gov + done + + 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 + for cpu_guard_band in /sys/class/devfreq/*qcom,cpubw*/bw_hwmon/guard_band_mbps + do + echo 30 > $cpu_guard_band + 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 & BCL core_control to update interactive gov settings + echo 0 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + bcl_hotplug_mask=`cat $hotplug_mask` + echo 0 > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + bcl_soc_hotplug_mask=`cat $hotplug_soc_mask` + echo 0 > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + + # enable governor for power cluster + echo 1 > /sys/devices/system/cpu/cpu0/online + echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load + echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy + echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time + echo 691200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + + # enable governor for perf cluster + echo 1 > /sys/devices/system/cpu/cpu4/online + echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor + echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load + echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy + 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 883200 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 60000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis + + if [ $panel -gt 1080 ]; then + #set texture cache size for resolution greater than 1080p + setprop ro.hwui.texture_cache_size 72 + fi + + echo 59000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay + echo 1305600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq + echo "1 691200:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads + echo 1382400 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq + echo "19000 1382400:39000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay + echo "85 1382400:90 1747200:80" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads + # HMP Task packing settings for 8976 + echo 30 > /proc/sys/kernel/sched_small_task + echo 20 > /sys/devices/system/cpu/cpu0/sched_mostly_idle_load + echo 20 > /sys/devices/system/cpu/cpu1/sched_mostly_idle_load + echo 20 > /sys/devices/system/cpu/cpu2/sched_mostly_idle_load + echo 20 > /sys/devices/system/cpu/cpu3/sched_mostly_idle_load + echo 20 > /sys/devices/system/cpu/cpu4/sched_mostly_idle_load + echo 20 > /sys/devices/system/cpu/cpu5/sched_mostly_idle_load + echo 20 > /sys/devices/system/cpu/cpu6/sched_mostly_idle_load + echo 20 > /sys/devices/system/cpu/cpu7/sched_mostly_idle_load + + echo 0 > /proc/sys/kernel/sched_boost + + # 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 + echo 1 > /sys/devices/system/cpu/cpu5/online + echo 1 > /sys/devices/system/cpu/cpu6/online + echo 1 > /sys/devices/system/cpu/cpu7/online + + #Disable CPU retention modes for 32bit builds + ProductName=`getprop ro.product.name` + if [ "$ProductName" == "msm8952_32" ] || [ "$ProductName" == "msm8952_32_LMT" ]; then + echo N > /sys/module/lpm_levels/system/a72/cpu4/retention/idle_enabled + echo N > /sys/module/lpm_levels/system/a72/cpu5/retention/idle_enabled + echo N > /sys/module/lpm_levels/system/a72/cpu6/retention/idle_enabled + echo N > /sys/module/lpm_levels/system/a72/cpu7/retention/idle_enabled + fi + + if [ `cat /sys/devices/soc0/revision` == "1.0" ]; then + # Disable l2-pc and l2-gdhs low power modes + echo N > /sys/module/lpm_levels/system/a53/a53-l2-gdhs/idle_enabled + echo N > /sys/module/lpm_levels/system/a72/a72-l2-gdhs/idle_enabled + echo N > /sys/module/lpm_levels/system/a53/a53-l2-pc/idle_enabled + echo N > /sys/module/lpm_levels/system/a72/a72-l2-pc/idle_enabled + fi + + # Enable LPM Prediction + echo 1 > /sys/module/lpm_levels/parameters/lpm_prediction + + # Enable Low power modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + # Disable L2 GDHS on 8976 + echo N > /sys/module/lpm_levels/system/a53/a53-l2-gdhs/idle_enabled + echo N > /sys/module/lpm_levels/system/a72/a72-l2-gdhs/idle_enabled + + # 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 + #for 8976 + echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus + echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/max_cpus + echo 68 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres + echo 40 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms + echo 1 > /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster + + # re-enable thermal & BCL core_control now + echo 1 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + echo $bcl_hotplug_mask > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + echo $bcl_soc_hotplug_mask > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + + # Enable timer migration to little cluster + echo 1 > /proc/sys/kernel/power_aware_timer_migration + + case "$soc_id" in + "277" | "278") + # Start energy-awareness for 8976 + start energy-awareness + ;; + esac + + #enable sched colocation and colocation inheritance + echo 130 > /proc/sys/kernel/sched_grp_upmigrate + echo 110 > /proc/sys/kernel/sched_grp_downmigrate + echo 1 > /proc/sys/kernel/sched_enable_thread_grouping + + # Set Memory parameters + configure_memory_parameters + + ;; + esac + #Enable Memory Features + enable_memory_features + restorecon -R /sys/devices/system/cpu + ;; +esac + +case "$target" in + "msm8953") + + 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 + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + + if [ -f /sys/devices/soc0/platform_subtype_id ]; then + platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id` + fi + + echo 0 > /proc/sys/kernel/sched_boost + + case "$soc_id" in + "293" | "304" | "338" | "351") + + # Start Host based Touch processing + case "$hw_platform" in + "MTP" | "Surf" | "RCM" ) + #if this directory is present, it means that a + #1200p panel is connected to the device. + dir="/sys/bus/i2c/devices/3-0038" + if [ ! -d "$dir" ]; then + start_hbtp + fi + ;; + esac + + if [ $soc_id -eq "338" ]; then + case "$hw_platform" in + "QRD" ) + if [ $platform_subtype_id -eq "1" ]; then + start_hbtp + fi + ;; + esac + fi + + #init task load, restrict wakeups to preferred cluster + echo 15 > /proc/sys/kernel/sched_init_task_load + + for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor + do + echo "cpufreq" > $devfreq_gov + done + + for devfreq_gov in /sys/class/devfreq/soc:qcom,cpubw/governor + do + echo "bw_hwmon" > $devfreq_gov + for cpu_io_percent in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/io_percent + do + echo 34 > $cpu_io_percent + done + for cpu_guard_band in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/guard_band_mbps + do + echo 0 > $cpu_guard_band + done + for cpu_hist_memory in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/hist_memory + do + echo 20 > $cpu_hist_memory + done + for cpu_hyst_length in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_length + do + echo 10 > $cpu_hyst_length + done + for cpu_idle_mbps in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/idle_mbps + do + echo 1600 > $cpu_idle_mbps + done + for cpu_low_power_delay in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/low_power_delay + do + echo 20 > $cpu_low_power_delay + done + for cpu_low_power_io_percent in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/low_power_io_percent + do + echo 34 > $cpu_low_power_io_percent + done + for cpu_mbps_zones in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/mbps_zones + do + echo "1611 3221 5859 6445 7104" > $cpu_mbps_zones + done + for cpu_sample_ms in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/sample_ms + do + echo 4 > $cpu_sample_ms + done + for cpu_up_scale in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/up_scale + do + echo 250 > $cpu_up_scale + done + for cpu_min_freq in /sys/class/devfreq/soc:qcom,cpubw/min_freq + do + echo 1611 > $cpu_min_freq + done + done + + for gpu_bimc_io_percent in /sys/class/devfreq/soc:qcom,gpubw/bw_hwmon/io_percent + do + echo 40 > $gpu_bimc_io_percent + done + + # disable thermal & BCL core_control to update interactive gov settings + echo 0 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + bcl_hotplug_mask=`cat $hotplug_mask` + echo 0 > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + bcl_soc_hotplug_mask=`cat $hotplug_soc_mask` + echo 0 > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + + #if the kernel version >=4.9,use the schedutil governor + KernelVersionStr=`cat /proc/sys/kernel/osrelease` + KernelVersionS=${KernelVersionStr:2:2} + KernelVersionA=${KernelVersionStr:0:1} + KernelVersionB=${KernelVersionS%.*} + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 9 ]; then + 8953_sched_dcvs_eas + else + 8953_sched_dcvs_hmp + fi + echo 652800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + + # 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 + echo 1 > /sys/devices/system/cpu/cpu5/online + echo 1 > /sys/devices/system/cpu/cpu6/online + echo 1 > /sys/devices/system/cpu/cpu7/online + + # Enable low power modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + # re-enable thermal & BCL core_control now + echo 1 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + echo $bcl_hotplug_mask > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + echo $bcl_soc_hotplug_mask > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + + # SMP scheduler + echo 85 > /proc/sys/kernel/sched_upmigrate + echo 85 > /proc/sys/kernel/sched_downmigrate + + # Set Memory parameters + configure_memory_parameters + ;; + esac + case "$soc_id" in + "349" | "350") + + # Start Host based Touch processing + case "$hw_platform" in + "MTP" | "Surf" | "RCM" | "QRD" ) + start_hbtp + ;; + esac + + for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor + do + echo "cpufreq" > $devfreq_gov + done + for cpubw in /sys/class/devfreq/*qcom,cpubw* + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo "1611 3221 5859 6445 7104" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 34 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + # Configure DCC module to capture critical register contents when device crashes + for DCC_PATH in /sys/bus/platform/devices/*.dcc* + do + echo 0 > $DCC_PATH/enable + echo cap > $DCC_PATH/func_type + echo sram > $DCC_PATH/data_sink + echo 1 > $DCC_PATH/config_reset + + # Register specifies APC CPR closed-loop settled voltage for current voltage corner + echo 0xb1d2c18 1 > $DCC_PATH/config + + # Register specifies SW programmed open-loop voltage for current voltage corner + echo 0xb1d2900 1 > $DCC_PATH/config + + # Register specifies APM switch settings and APM FSM state + echo 0xb1112b0 1 > $DCC_PATH/config + + # Register specifies CPR mode change state and also #online cores input to CPR HW + echo 0xb018798 1 > $DCC_PATH/config + + echo 1 > $DCC_PATH/enable + done + + # disable thermal & BCL core_control to update interactive gov settings + echo 0 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + bcl_hotplug_mask=`cat $hotplug_mask` + echo 0 > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + bcl_soc_hotplug_mask=`cat $hotplug_soc_mask` + echo 0 > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + + # configure governor settings for little cluster + echo 1 > /sys/devices/system/cpu/cpu0/online + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us + echo 1363200 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + #default value for hispeed_load is 90, for sdm632 it should be 85 + echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load + # sched_load_boost as -6 is equivalent to target load as 85. + echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost + + # configure governor settings for big cluster + echo 1 > /sys/devices/system/cpu/cpu4/online + echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/rate_limit_us + echo 1401600 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq + #default value for hispeed_load is 90, for sdm632 it should be 85 + echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_load + # sched_load_boost as -6 is equivalent to target load as 85. + echo -6 > /sys/devices/system/cpu/cpu4/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu5/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost + + echo 614400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 633600 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + + # cpuset settings + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + # choose idle CPU for top app tasks + echo 1 > /dev/stune/top-app/schedtune.prefer_idle + + # re-enable thermal & BCL core_control now + echo 1 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + echo $bcl_hotplug_mask > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + echo $bcl_soc_hotplug_mask > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + + # Disable Core control + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable + echo 0 > /sys/devices/system/cpu/cpu4/core_ctl/enable + + # 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 + echo 1 > /sys/devices/system/cpu/cpu5/online + echo 1 > /sys/devices/system/cpu/cpu6/online + echo 1 > /sys/devices/system/cpu/cpu7/online + + # Enable low power modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + # Set Memory parameters + configure_memory_parameters + + # Setting b.L scheduler parameters + echo 76 > /proc/sys/kernel/sched_downmigrate + echo 86 > /proc/sys/kernel/sched_upmigrate + echo 80 > /proc/sys/kernel/sched_group_downmigrate + echo 90 > /proc/sys/kernel/sched_group_upmigrate + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + + # Enable min frequency adjustment for big cluster + if [ -f /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_cluster ]; then + echo "4-7" > /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_cluster + fi + echo 1 > /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_adjust + + ;; + esac + ;; +esac + +case "$target" in + "msm8937") + + 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 + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + if [ -f /sys/devices/soc0/platform_subtype_id ]; then + platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id` + fi + + # Socid 386 = Pukeena + case "$soc_id" in + "303" | "307" | "308" | "309" | "320" | "386" | "436") + + # Start Host based Touch processing + case "$hw_platform" in + "MTP" ) + start_hbtp + ;; + esac + + case "$hw_platform" in + "Surf" | "RCM" ) + if [ $platform_subtype_id -ne "4" ]; then + start_hbtp + fi + ;; + esac + # Apply Scheduler and Governor settings for 8917 / 8920 + + echo 20000000 > /proc/sys/kernel/sched_ravg_window + + #disable sched_boost in 8917 + echo 0 > /proc/sys/kernel/sched_boost + + # core_ctl is not needed for 8917. Disable it. + disable_core_ctl + + for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor + do + echo "cpufreq" > $devfreq_gov + done + + for devfreq_gov in /sys/class/devfreq/soc:qcom,cpubw/governor + do + echo "bw_hwmon" > $devfreq_gov + for cpu_io_percent in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/io_percent + do + echo 20 > $cpu_io_percent + done + for cpu_guard_band in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/guard_band_mbps + do + echo 30 > $cpu_guard_band + done + done + + for gpu_bimc_io_percent in /sys/class/devfreq/soc: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 + + KernelVersionStr=`cat /proc/sys/kernel/osrelease` + KernelVersionS=${KernelVersionStr:2:2} + KernelVersionA=${KernelVersionStr:0:1} + KernelVersionB=${KernelVersionS%.*} + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 9 ]; then + 8917_sched_dcvs_eas + else + 8917_sched_dcvs_hmp + fi + echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + # re-enable thermal core_control now + echo 1 > /sys/module/msm_thermal/core_control/enabled + + # Disable L2-GDHS low power modes + echo N > /sys/module/lpm_levels/perf/perf-l2-gdhs/idle_enabled + echo N > /sys/module/lpm_levels/perf/perf-l2-gdhs/suspend_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 + + # Enable low power modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + # Set rps mask + echo 2 > /sys/class/net/rmnet0/queues/rx-0/rps_cpus + + # Enable dynamic clock gating + echo 1 > /sys/module/lpm_levels/lpm_workarounds/dynamic_clock_gating + # Enable timer migration to little cluster + echo 1 > /proc/sys/kernel/power_aware_timer_migration + # Set Memory parameters + configure_memory_parameters + ;; + *) + ;; + esac + + case "$soc_id" in + "294" | "295" | "313" ) + + # Start Host based Touch processing + case "$hw_platform" in + "MTP" | "Surf" | "RCM" ) + start_hbtp + ;; + esac + + # Apply Scheduler and Governor settings for 8937/8940 + + # HMP scheduler settings + echo 3 > /proc/sys/kernel/sched_window_stats_policy + echo 3 > /proc/sys/kernel/sched_ravg_hist_size + echo 20000000 > /proc/sys/kernel/sched_ravg_window + + #disable sched_boost in 8937 + echo 0 > /proc/sys/kernel/sched_boost + + for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor + do + echo "cpufreq" > $devfreq_gov + done + + for devfreq_gov in /sys/class/devfreq/soc:qcom,cpubw/governor + do + echo "bw_hwmon" > $devfreq_gov + for cpu_io_percent in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/io_percent + do + echo 20 > $cpu_io_percent + done + for cpu_guard_band in /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/guard_band_mbps + do + echo 30 > $cpu_guard_band + done + done + + for gpu_bimc_io_percent in /sys/class/devfreq/soc:qcom,gpubw/bw_hwmon/io_percent + do + echo 40 > $gpu_bimc_io_percent + done + + # disable thermal core_control to update interactive gov and core_ctl settings + echo 0 > /sys/module/msm_thermal/core_control/enabled + + KernelVersionStr=`cat /proc/sys/kernel/osrelease` + KernelVersionS=${KernelVersionStr:2:2} + KernelVersionA=${KernelVersionStr:0:1} + KernelVersionB=${KernelVersionS%.*} + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 9 ]; then + 8937_sched_dcvs_eas + else + 8937_sched_dcvs_hmp + fi + echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 768000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + # Disable L2-GDHS low power modes + echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-gdhs/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-gdhs/suspend_enabled + echo N > /sys/module/lpm_levels/system/perf/perf-l2-gdhs/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/perf-l2-gdhs/suspend_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/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 + + # Enable low power modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + # HMP scheduler (big.Little cluster related) settings + echo 93 > /proc/sys/kernel/sched_upmigrate + echo 83 > /proc/sys/kernel/sched_downmigrate + + # Enable core control + 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 + echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster + + # re-enable thermal core_control + echo 1 > /sys/module/msm_thermal/core_control/enabled + + # Enable dynamic clock gating + echo 1 > /sys/module/lpm_levels/lpm_workarounds/dynamic_clock_gating + # Enable timer migration to little cluster + echo 1 > /proc/sys/kernel/power_aware_timer_migration + # Set Memory parameters + configure_memory_parameters + ;; + *) + + ;; + esac + + case "$soc_id" in + "354" | "364" | "353" | "363" ) + + # Start Host based Touch processing + case "$hw_platform" in + "MTP" | "Surf" | "RCM" | "QRD" ) + start_hbtp + ;; + esac + + # Apply settings for sdm429/sda429/sdm439/sda439 + + for cpubw in /sys/class/devfreq/*qcom,mincpubw* + do + echo "cpufreq" > $cpubw/governor + done + + for cpubw in /sys/class/devfreq/*qcom,cpubw* + do + echo "bw_hwmon" > $cpubw/governor + echo 20 > $cpubw/bw_hwmon/io_percent + echo 30 > $cpubw/bw_hwmon/guard_band_mbps + done + + for gpu_bimc_io_percent in /sys/class/devfreq/soc:qcom,gpubw/bw_hwmon/io_percent + do + echo 40 > $gpu_bimc_io_percent + done + + case "$soc_id" in + "353" | "363" ) + # Apply settings for sdm439/sda439 + # configure schedutil governor settings + # enable governor for perf cluster + echo 1 > /sys/devices/system/cpu/cpu0/online + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us + #set the hispeed_freq + echo 1497600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load + echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + # sched_load_boost as -6 is equivalent to target load as 85. + echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost + + ## enable governor for power cluster + echo 1 > /sys/devices/system/cpu/cpu4/online + echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/rate_limit_us + #set the hispeed_freq + echo 998400 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq + echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_load + echo 768000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + # sched_load_boost as -6 is equivalent to target load as 85. + echo -6 > /sys/devices/system/cpu/cpu4/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu5/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost + + # EAS scheduler (big.Little cluster related) settings + echo 93 > /proc/sys/kernel/sched_upmigrate + echo 83 > /proc/sys/kernel/sched_downmigrate + echo 140 > /proc/sys/kernel/sched_group_upmigrate + echo 120 > /proc/sys/kernel/sched_group_downmigrate + + # cpuset settings + #echo 0-3 > /dev/cpuset/background/cpus + #echo 0-3 > /dev/cpuset/system-background/cpus + + # 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 + echo 1 > /sys/devices/system/cpu/cpu5/online + echo 1 > /sys/devices/system/cpu/cpu6/online + echo 1 > /sys/devices/system/cpu/cpu7/online + + # Enable core control + 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 + echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster + echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres + + # Big cluster min frequency adjust settings + if [ -f /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_cluster ]; then + echo "0-3" > /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_cluster + fi + echo 1305600 > /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_floor + ;; + *) + # Apply settings for sdm429/sda429 + # configure schedutil governor settings + echo 1 > /sys/devices/system/cpu/cpu0/online + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us + #set the hispeed_freq + echo 1305600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load + echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + # sched_load_boost as -6 is equivalent to target load as 85. + echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost + + # 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 + + # Set Memory parameters + configure_memory_parameters + + #disable sched_boost + echo 0 > /proc/sys/kernel/sched_boost + + # Disable L2-GDHS low power modes + echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-gdhs/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-gdhs/suspend_enabled + echo N > /sys/module/lpm_levels/system/perf/perf-l2-gdhs/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/perf-l2-gdhs/suspend_enabled + + # Enable low power modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + case "$soc_id" in + "353" | "363" ) + echo 1 > /sys/module/big_cluster_min_freq_adjust/parameters/min_freq_adjust + ;; + esac + ;; + esac + + case "$soc_id" in + "386" | "436") + + # Start Host based Touch processing + case "$hw_platform" in + "QRD" ) + start_hbtp + ;; + esac + ;; + esac + ;; +esac + +case "$target" in + "sdm660") + + # Set the default IRQ affinity to the primary cluster. When a + # CPU is isolated/hotplugged, the IRQ affinity is adjusted + # to one of the CPU from the default IRQ affinity mask. + echo f > /proc/irq/default_smp_affinity + + 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 + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + + panel=`cat /sys/class/graphics/fb0/modes` + if [ "${panel:5:1}" == "x" ]; then + panel=${panel:2:3} + else + panel=${panel:2:4} + fi + + if [ $panel -gt 1080 ]; then + echo 2 > /proc/sys/kernel/sched_window_stats_policy + echo 5 > /proc/sys/kernel/sched_ravg_hist_size + else + echo 3 > /proc/sys/kernel/sched_window_stats_policy + echo 3 > /proc/sys/kernel/sched_ravg_hist_size + fi + #Apply settings for sdm660, sdm636,sda636 + case "$soc_id" in + "317" | "324" | "325" | "326" | "345" | "346" ) + + echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres + echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms + echo 1 > /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster + echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres + + # Setting b.L scheduler parameters + echo 96 > /proc/sys/kernel/sched_upmigrate + echo 90 > /proc/sys/kernel/sched_downmigrate + echo 140 > /proc/sys/kernel/sched_group_upmigrate + echo 120 > /proc/sys/kernel/sched_group_downmigrate + echo 0 > /proc/sys/kernel/sched_select_prev_cpu_us + echo 400000 > /proc/sys/kernel/sched_freq_inc_notify + echo 400000 > /proc/sys/kernel/sched_freq_dec_notify + echo 5 > /proc/sys/kernel/sched_spill_nr_run + echo 1 > /proc/sys/kernel/sched_restrict_cluster_spill + echo 100000 > /proc/sys/kernel/sched_short_burst_ns + echo 1 > /proc/sys/kernel/sched_prefer_sync_wakee_to_waker + echo 20 > /proc/sys/kernel/sched_small_wakee_task_load + + # cpuset settings + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + # disable thermal bcl hotplug to switch governor + echo 0 > /sys/module/msm_thermal/core_control/enabled + + # online CPU0 + echo 1 > /sys/devices/system/cpu/cpu0/online + # 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 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif + echo "19000 1401600:39000" > /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 1401600 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy + echo "85 1747200:95" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads + echo 39000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis + echo 633600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/fast_ramp_down + # online CPU4 + echo 1 > /sys/devices/system/cpu/cpu4/online + # 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 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif + echo "19000 1401600:39000" > /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 1401600 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy + echo "85 1401600:90 2150400:95" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads + echo 39000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time + echo 59000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis + echo 1113600 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/ignore_hispeed_on_notif + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/fast_ramp_down + + # bring all cores online + echo 1 > /sys/devices/system/cpu/cpu0/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 + echo 1 > /sys/devices/system/cpu/cpu5/online + echo 1 > /sys/devices/system/cpu/cpu6/online + echo 1 > /sys/devices/system/cpu/cpu7/online + + # configure LPM + echo N > /sys/module/lpm_levels/system/pwr/cpu0/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu1/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu2/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu3/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu4/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu5/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu6/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu7/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-dynret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/perf-l2-dynret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/perf-l2-ret/idle_enabled + # enable LPM + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + # re-enable thermal and BCL hotplug + echo 1 > /sys/module/msm_thermal/core_control/enabled + + # Set Memory parameters + configure_memory_parameters + + # Enable bus-dcvs + for cpubw in /sys/class/devfreq/*qcom,cpubw* + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo 762 > $cpubw/min_freq + echo "1525 3143 5859 7759 9887 10327 11863 13763" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 85 > $cpubw/bw_hwmon/io_percent + echo 100 > $cpubw/bw_hwmon/decay_rate + echo 50 > $cpubw/bw_hwmon/bw_step + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/low_power_ceil_mbps + echo 34 > $cpubw/bw_hwmon/low_power_io_percent + echo 20 > $cpubw/bw_hwmon/low_power_delay + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for memlat in /sys/class/devfreq/*qcom,memlat-cpu* + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor + + # Start cdsprpcd only for sdm660 and disable for sdm630 + start vendor.cdsprpcd + + # Start Host based Touch processing + case "$hw_platform" in + "MTP" | "Surf" | "RCM" | "QRD" ) + start_hbtp + ;; + esac + ;; + esac + #Apply settings for sdm630 and Tahaa + case "$soc_id" in + "318" | "327" | "385" ) + + # Start Host based Touch processing + case "$hw_platform" in + "MTP" | "Surf" | "RCM" | "QRD" ) + start_hbtp + ;; + esac + + # Setting b.L scheduler parameters + echo 85 > /proc/sys/kernel/sched_upmigrate + echo 85 > /proc/sys/kernel/sched_downmigrate + echo 900 > /proc/sys/kernel/sched_group_upmigrate + echo 900 > /proc/sys/kernel/sched_group_downmigrate + echo 0 > /proc/sys/kernel/sched_select_prev_cpu_us + echo 400000 > /proc/sys/kernel/sched_freq_inc_notify + echo 400000 > /proc/sys/kernel/sched_freq_dec_notify + echo 3 > /proc/sys/kernel/sched_spill_nr_run + + #init task load, restrict wakeups to preferred cluster + echo 15 > /proc/sys/kernel/sched_init_task_load + echo 1 > /proc/sys/kernel/sched_restrict_cluster_spill + echo 50000 > /proc/sys/kernel/sched_short_burst_ns + + # cpuset settings + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + # disable thermal bcl hotplug to switch governor + echo 0 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + bcl_hotplug_mask=`cat $hotplug_mask` + echo 0 > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + bcl_soc_hotplug_mask=`cat $hotplug_soc_mask` + echo 0 > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + + # online CPU0 + echo 1 > /sys/devices/system/cpu/cpu0/online + # configure governor settings for Big cluster(CPU0 to CPU3) + echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + 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 "19000 1344000: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 1344000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy + echo "85 1344000:80" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads + echo 39000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis + echo 787200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif + + # online CPU4 + echo 1 > /sys/devices/system/cpu/cpu4/online + # configure governor settings for Little cluster(CPU4 to CPU7) + echo "interactive" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor + 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 "19000 1094400:39000" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay + echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load + echo 20000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate + echo 1094400 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy + echo "85 1094400:80" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads + echo 39000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis + echo 614400 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/ignore_hispeed_on_notif + + # bring all cores online + echo 1 > /sys/devices/system/cpu/cpu0/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 + echo 1 > /sys/devices/system/cpu/cpu5/online + echo 1 > /sys/devices/system/cpu/cpu6/online + echo 1 > /sys/devices/system/cpu/cpu7/online + + # configure LPM + echo N > /sys/module/lpm_levels/system/perf/cpu0/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu1/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu2/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu3/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu4/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu5/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu6/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu7/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-dynret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/perf-l2-dynret/idle_enabled + # enable LPM + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + # re-enable thermal and BCL hotplug + echo 1 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + echo $bcl_hotplug_mask > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + echo $bcl_soc_hotplug_mask > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + + # Set Memory parameters + configure_memory_parameters + + # Enable bus-dcvs + for cpubw in /sys/class/devfreq/*qcom,cpubw* + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo 762 > $cpubw/min_freq + echo "1525 3143 4173 5195 5859 7759 9887 10327" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 85 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 100 > $cpubw/bw_hwmon/decay_rate + echo 50 > $cpubw/bw_hwmon/bw_step + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/low_power_ceil_mbps + echo 50 > $cpubw/bw_hwmon/low_power_io_percent + echo 20 > $cpubw/bw_hwmon/low_power_delay + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for memlat in /sys/class/devfreq/*qcom,memlat-cpu* + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor + ;; + esac + ;; +esac + +case "$target" in + "sdm710") + + #Apply settings for sdm710 + # Set the default IRQ affinity to the silver cluster. When a + # CPU is isolated/hotplugged, the IRQ affinity is adjusted + # to one of the CPU from the default IRQ affinity mask. + echo 3f > /proc/irq/default_smp_affinity + + 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 + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + + case "$soc_id" in + "336" | "337" | "347" | "360" | "393" ) + + # Start Host based Touch processing + case "$hw_platform" in + "MTP" | "Surf" | "RCM" | "QRD" ) + start_hbtp + ;; + esac + + # Core control parameters on silver + echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred + echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus + echo 60 > /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 + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster + echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres + + # Setting b.L scheduler parameters + echo 96 > /proc/sys/kernel/sched_upmigrate + echo 90 > /proc/sys/kernel/sched_downmigrate + echo 140 > /proc/sys/kernel/sched_group_upmigrate + echo 120 > /proc/sys/kernel/sched_group_downmigrate + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + + # configure governor settings for little cluster + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us + echo 1209600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + + # configure governor settings for big cluster + echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/rate_limit_us + echo 1344000 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq + echo 652800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq + + # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable. + echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost + echo 85 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load + + echo "0:1209600" > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + + # Set Memory parameters + configure_memory_parameters + + # Enable bus-dcvs + for cpubw in /sys/class/devfreq/*qcom,cpubw* + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo "1144 1720 2086 2929 3879 5931 6881" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 68 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + #Enable mem_latency governor for DDR scaling + for memlat in /sys/class/devfreq/*qcom,memlat-cpu* + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Enable mem_latency governor for L3 scaling + for memlat in /sys/class/devfreq/*qcom,l3-cpu* + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Enable userspace governor for L3 cdsp nodes + for l3cdsp in /sys/class/devfreq/*qcom,l3-cdsp* + do + echo "userspace" > $l3cdsp/governor + chown -h system $l3cdsp/userspace/set_freq + done + + echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor + + # Disable CPU Retention + echo N > /sys/module/lpm_levels/L3/cpu0/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu1/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu2/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu3/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu4/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu5/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu6/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu7/ret/idle_enabled + + # cpuset parameters + echo 0-5 > /dev/cpuset/background/cpus + echo 0-5 > /dev/cpuset/system-background/cpus + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # Turn on sleep modes. + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + ;; + esac + ;; +esac + +case "$target" in + "trinket") + + 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 + "394" ) + + # Core control parameters on big + echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus + echo 40 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres + echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres + echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms + echo 1 > /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster + echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres + + # Setting b.L scheduler parameters + echo 67 > /proc/sys/kernel/sched_downmigrate + echo 77 > /proc/sys/kernel/sched_upmigrate + echo 85 > /proc/sys/kernel/sched_group_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + + # cpuset settings + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + + # configure governor settings for little cluster + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us + echo 1305600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + echo 614400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + + # configure governor settings for big cluster + echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us + echo 1401600 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq + echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + + # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable. + echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu4/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu5/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost + echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load + echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_load + + # Set Memory parameters + configure_memory_parameters + + # Enable bus-dcvs + ddr_type=`od -An -tx /proc/device-tree/memory/ddr_device_type` + ddr_type4="07" + ddr_type3="05" + + for device in /sys/devices/platform/soc + do + for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo 762 > $cpubw/min_freq + if [ ${ddr_type:4:2} == $ddr_type4 ]; then + # LPDDR4 + echo "2288 3440 4173 5195 5859 7759 10322 11863 13763" > $cpubw/bw_hwmon/mbps_zones + echo 85 > $cpubw/bw_hwmon/io_percent + fi + if [ ${ddr_type:4:2} == $ddr_type3 ]; then + # LPDDR3 + echo "1525 3440 5195 5859 7102" > $cpubw/bw_hwmon/mbps_zones + echo 34 > $cpubw/bw_hwmon/io_percent + fi + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 90 > $cpubw/bw_hwmon/decay_rate + echo 190 > $cpubw/bw_hwmon/bw_step + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + for latfloor in $device/*cpu*-ddr-latfloor*/devfreq/*cpu-ddr-latfloor* + do + echo "compute" > $latfloor/governor + echo 10 > $latfloor/polling_interval + done + + done + + # colcoation v3 disabled + echo 0 > /proc/sys/kernel/sched_min_task_util_for_boost + echo 0 > /proc/sys/kernel/sched_min_task_util_for_colocation + echo 0 > /proc/sys/kernel/sched_little_cluster_coloc_fmin_khz + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # Turn on sleep modes. + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + ;; + esac + ;; +esac + +case "$target" in + "sm6150") + + #Apply settings for sm6150 + # Set the default IRQ affinity to the silver cluster. When a + # CPU is isolated/hotplugged, the IRQ affinity is adjusted + # to one of the CPU from the default IRQ affinity mask. + echo 3f > /proc/irq/default_smp_affinity + + 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 + "355" | "369" | "377" | "380" | "384" ) + target_type=`getprop ro.hardware.type` + if [ "$target_type" == "automotive" ]; then + # update frequencies + configure_sku_parameters + sku_identified=`getprop vendor.sku_identified` + else + sku_identified=0 + fi + + # Core control parameters on silver + echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred + echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus + echo 60 > /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 + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster + echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres + echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable + + + # Setting b.L scheduler parameters + # default sched up and down migrate values are 90 and 85 + echo 65 > /proc/sys/kernel/sched_downmigrate + echo 71 > /proc/sys/kernel/sched_upmigrate + # default sched up and down migrate values are 100 and 95 + echo 85 > /proc/sys/kernel/sched_group_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + + # colocation v3 settings + echo 740000 > /proc/sys/kernel/sched_little_cluster_coloc_fmin_khz + + + # configure governor settings for little cluster + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us + echo 1209600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + if [ $sku_identified != 1 ]; then + echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + fi + + # configure governor settings for big cluster + echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us + echo 1209600 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq + if [ $sku_identified != 1 ]; then + echo 768000 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq + fi + + # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable. + echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost + echo 85 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load + + echo "0:1209600" > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + + # Set Memory parameters + configure_memory_parameters + + # Enable bus-dcvs + for device in /sys/devices/platform/soc + do + for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo "2288 4577 7110 9155 12298 14236" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 68 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + echo 40 > $llccbw/polling_interval + echo "1144 1720 2086 2929 3879 5931 6881" > $llccbw/bw_hwmon/mbps_zones + echo 4 > $llccbw/bw_hwmon/sample_ms + echo 68 > $llccbw/bw_hwmon/io_percent + echo 20 > $llccbw/bw_hwmon/hist_memory + echo 0 > $llccbw/bw_hwmon/hyst_length + echo 80 > $llccbw/bw_hwmon/down_thres + echo 0 > $llccbw/bw_hwmon/guard_band_mbps + echo 250 > $llccbw/bw_hwmon/up_scale + echo 1600 > $llccbw/bw_hwmon/idle_mbps + done + + #Enable mem_latency governor for L3, LLCC, and DDR scaling + for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Gold L3 ratio ceil + echo 4000 > /sys/class/devfreq/soc:qcom,cpu6-cpu-l3-lat/mem_latency/ratio_ceil + + #Enable cdspl3 governor for L3 cdsp nodes + for l3cdsp in $device/*cdsp-cdsp-l3-lat/devfreq/*cdsp-cdsp-l3-lat + do + echo "cdspl3" > $l3cdsp/governor + done + + #Enable compute governor for gold latfloor + for latfloor in $device/*cpu*-ddr-latfloor*/devfreq/*cpu-ddr-latfloor* + do + echo "compute" > $latfloor/governor + echo 10 > $latfloor/polling_interval + done + + done + # cpuset parameters + echo 0-5 > /dev/cpuset/background/cpus + echo 0-5 > /dev/cpuset/system-background/cpus + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # Turn on sleep modes. + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + ;; + esac + + #Apply settings for moorea + case "$soc_id" in + "365" | "366" ) + + # Core control parameters on silver + echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred + echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus + echo 60 > /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 + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster + echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres + echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable + + # Setting b.L scheduler parameters + # default sched up and down migrate values are 71 and 65 + echo 65 > /proc/sys/kernel/sched_downmigrate + echo 71 > /proc/sys/kernel/sched_upmigrate + # default sched up and down migrate values are 100 and 95 + echo 85 > /proc/sys/kernel/sched_group_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + + #colocation v3 settings + echo 740000 > /proc/sys/kernel/sched_little_cluster_coloc_fmin_khz + + # configure governor settings for little cluster + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us + echo 1248000 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + + # configure governor settings for big cluster + echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us + echo 1324600 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq + echo 652800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq + + # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable. + echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost + echo 85 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load + + echo "0:1248000" > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + + # Set Memory parameters + configure_memory_parameters + + # Enable bus-dcvs + for device in /sys/devices/platform/soc + do + for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo "2288 4577 7110 9155 12298 14236" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 68 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + echo 40 > $llccbw/polling_interval + echo "1144 1720 2086 2929 3879 5931 6881" > $llccbw/bw_hwmon/mbps_zones + echo 4 > $llccbw/bw_hwmon/sample_ms + echo 68 > $llccbw/bw_hwmon/io_percent + echo 20 > $llccbw/bw_hwmon/hist_memory + echo 0 > $llccbw/bw_hwmon/hyst_length + echo 80 > $llccbw/bw_hwmon/down_thres + echo 0 > $llccbw/bw_hwmon/guard_band_mbps + echo 250 > $llccbw/bw_hwmon/up_scale + echo 1600 > $llccbw/bw_hwmon/idle_mbps + done + + for npubw in $device/*npu-npu-ddr-bw/devfreq/*npu-npu-ddr-bw + do + echo 1 > /sys/devices/virtual/npu/msm_npu/pwr + echo "bw_hwmon" > $npubw/governor + echo 40 > $npubw/polling_interval + echo "1144 1720 2086 2929 3879 5931 6881" > $npubw/bw_hwmon/mbps_zones + echo 4 > $npubw/bw_hwmon/sample_ms + echo 80 > $npubw/bw_hwmon/io_percent + echo 20 > $npubw/bw_hwmon/hist_memory + echo 10 > $npubw/bw_hwmon/hyst_length + echo 30 > $npubw/bw_hwmon/down_thres + echo 0 > $npubw/bw_hwmon/guard_band_mbps + echo 250 > $npubw/bw_hwmon/up_scale + echo 0 > $npubw/bw_hwmon/idle_mbps + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + + #Enable mem_latency governor for L3, LLCC, and DDR scaling + for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Gold L3 ratio ceil + echo 4000 > /sys/class/devfreq/soc:qcom,cpu6-cpu-l3-lat/mem_latency/ratio_ceil + + #Enable cdspl3 governor for L3 cdsp nodes + for l3cdsp in $device/*cdsp-cdsp-l3-lat/devfreq/*cdsp-cdsp-l3-lat + do + echo "cdspl3" > $l3cdsp/governor + done + + #Enable compute governor for gold latfloor + for latfloor in $device/*cpu*-ddr-latfloor*/devfreq/*cpu-ddr-latfloor* + do + echo "compute" > $latfloor/governor + echo 10 > $latfloor/polling_interval + done + + done + + # cpuset parameters + echo 0-5 > /dev/cpuset/background/cpus + echo 0-5 > /dev/cpuset/system-background/cpus + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # Turn on sleep modes. + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + ;; + esac + + ;; +esac + + +case "$target" in + "lito") + + # Core control parameters on silver + echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred + echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres + echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres + echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres + echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms + + # Disable Core control on gold, prime + echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable + echo 0 > /sys/devices/system/cpu/cpu7/core_ctl/enable + + # Setting b.L scheduler parameters + echo 65 85 > /proc/sys/kernel/sched_downmigrate + echo 71 95 > /proc/sys/kernel/sched_upmigrate + echo 85 > /proc/sys/kernel/sched_group_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + echo 0 > /proc/sys/kernel/sched_coloc_busy_hyst_ns + echo 0 > /proc/sys/kernel/sched_coloc_busy_hysteresis_enable_cpus + echo 0 > /proc/sys/kernel/sched_coloc_busy_hyst_max_ms + + # disable unfiltering + echo 20000000 > /proc/sys/kernel/sched_task_unfilter_period + echo 1 > /proc/sys/kernel/sched_task_unfilter_nr_windows + + # configure governor settings for silver cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us + echo 1228800 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl + echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + echo 650000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq + + # configure governor settings for gold cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/down_rate_limit_us + echo 1228800 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq + echo 85 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load + echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost + echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/pl + echo 672000 > /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/rtg_boost_freq + + # configure governor settings for gold+ cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy7/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/down_rate_limit_us + echo 1228800 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq + echo 85 > /sys/devices/system/cpu/cpu7/cpufreq/schedutil/hispeed_load + echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/pl + echo 672000 > /sys/devices/system/cpu/cpufreq/policy7/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/rtg_boost_freq + + # colocation v3 settings + echo 51 > /proc/sys/kernel/sched_min_task_util_for_boost + echo 35 > /proc/sys/kernel/sched_min_task_util_for_colocation + + # Enable conservative pl + echo 1 > /proc/sys/kernel/sched_conservative_pl + + echo "0:1228800" > /sys/devices/system/cpu/cpu_boost/input_boost_freq + echo 40 > /sys/devices/system/cpu/cpu_boost/input_boost_ms + + # Set Memory parameters + configure_memory_parameters + + if [ `cat /sys/devices/soc0/revision` == "2.0" ]; then + # r2.0 related changes + echo "0:1075200" > /sys/devices/system/cpu/cpu_boost/input_boost_freq + echo 610000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq + echo 1075200 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + echo 1152000 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq + echo 1401600 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq + echo 614400 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + echo 652800 > /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq + echo 806400 > /sys/devices/system/cpu/cpufreq/policy7/scaling_min_freq + echo 83 > /proc/sys/kernel/sched_asym_cap_sibling_freq_match_pct + fi + + # Enable bus-dcvs + for device in /sys/devices/platform/soc + do + for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo "2288 4577 7110 9155 12298 14236 16265" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 68 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + echo 50 > $llccbw/polling_interval + echo "1144 1720 2086 2929 3879 5931 6881 7980" > $llccbw/bw_hwmon/mbps_zones + echo 4 > $llccbw/bw_hwmon/sample_ms + echo 68 > $llccbw/bw_hwmon/io_percent + echo 20 > $llccbw/bw_hwmon/hist_memory + echo 0 > $llccbw/bw_hwmon/hyst_length + echo 80 > $llccbw/bw_hwmon/down_thres + echo 0 > $llccbw/bw_hwmon/guard_band_mbps + echo 250 > $llccbw/bw_hwmon/up_scale + echo 1600 > $llccbw/bw_hwmon/idle_mbps + done + + for npubw in $device/*npu*-ddr-bw/devfreq/*npu*-ddr-bw + do + echo 1 > /sys/devices/virtual/npu/msm_npu/pwr + echo "bw_hwmon" > $npubw/governor + echo 40 > $npubw/polling_interval + echo "1144 1720 2086 2929 3879 5931 6881 7980" > $npubw/bw_hwmon/mbps_zones + echo 4 > $npubw/bw_hwmon/sample_ms + echo 80 > $npubw/bw_hwmon/io_percent + echo 20 > $npubw/bw_hwmon/hist_memory + echo 10 > $npubw/bw_hwmon/hyst_length + echo 30 > $npubw/bw_hwmon/down_thres + echo 0 > $npubw/bw_hwmon/guard_band_mbps + echo 250 > $npubw/bw_hwmon/up_scale + echo 0 > $npubw/bw_hwmon/idle_mbps + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + + for npullccbw in $device/*npu*-llcc-bw/devfreq/*npu*-llcc-bw + do + echo 1 > /sys/devices/virtual/npu/msm_npu/pwr + echo "bw_hwmon" > $npullccbw/governor + echo 40 > $npullccbw/polling_interval + echo "2288 4577 7110 9155 12298 14236 16265" > $npullccbw/bw_hwmon/mbps_zones + echo 4 > $npullccbw/bw_hwmon/sample_ms + echo 100 > $npullccbw/bw_hwmon/io_percent + echo 20 > $npullccbw/bw_hwmon/hist_memory + echo 10 > $npullccbw/bw_hwmon/hyst_length + echo 30 > $npullccbw/bw_hwmon/down_thres + echo 0 > $npullccbw/bw_hwmon/guard_band_mbps + echo 250 > $npullccbw/bw_hwmon/up_scale + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + + #Enable mem_latency governor for L3, LLCC, and DDR scaling + for memlat in $device/*qcom,devfreq-l3/*cpu*-lat/devfreq/*cpu*-lat + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Enable cdspl3 governor for L3 cdsp nodes + for l3cdsp in $device/*qcom,devfreq-l3/*cdsp-l3-lat/devfreq/*cdsp-l3-lat + do + echo "cdspl3" > $l3cdsp/governor + done + + #Enable mem_latency governor for LLCC and DDR scaling + for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Gold L3 ratio ceil + for l3gold in $device/*qcom,devfreq-l3/*cpu6-cpu-l3-lat/devfreq/*cpu6-cpu-l3-lat + do + echo 4000 > $l3gold/mem_latency/ratio_ceil + done + + #Prime L3 ratio ceil + for l3prime in $device/*qcom,devfreq-l3/*cpu7-cpu-l3-lat/devfreq/*cpu7-cpu-l3-lat + do + echo 4000 > $l3prime/mem_latency/ratio_ceil + done + + #Enable compute governor for gold latfloor + for latfloor in $device/*cpu*-ddr-latfloor*/devfreq/*cpu-ddr-latfloor* + do + echo "compute" > $latfloor/governor + echo 10 > $latfloor/polling_interval + done + done + + # cpuset parameters + echo 0-5 > /dev/cpuset/background/cpus + echo 0-5 > /dev/cpuset/system-background/cpus + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # Turn on sleep modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + ;; +esac + +#Apply settings for atoll +case "$target" in + "atoll") + + # Core control parameters on silver + echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred + echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus + echo 60 > /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 + echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres + echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable + + # Setting b.L scheduler parameters + # default sched up and down migrate values are 95 and 85 + echo 65 > /proc/sys/kernel/sched_downmigrate + echo 71 > /proc/sys/kernel/sched_upmigrate + # default sched up and down migrate values are 100 and 95 + echo 85 > /proc/sys/kernel/sched_group_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + + #colocation v3 settings + echo 740000 > /proc/sys/kernel/sched_little_cluster_coloc_fmin_khz + + # configure governor settings for little cluster + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us + echo 1248000 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + + # configure governor settings for big cluster + echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us + echo 1267200 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq + echo 652800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq + + # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable. + echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost + echo 85 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load + + # Enable conservative pl + echo 1 > /proc/sys/kernel/sched_conservative_pl + + echo "0:1324800" > /sys/module/cpu_boost/parameters/input_boost_freq + echo 120 > /sys/module/cpu_boost/parameters/input_boost_ms + echo "0:0 1:0 2:0 3:0 4:1804800 5:0 6:0 7:2208000" > /sys/module/cpu_boost/parameters/powerkey_input_boost_freq + echo 400 > /sys/module/cpu_boost/parameters/powerkey_input_boost_ms + + # Set Memory parameters + configure_memory_parameters + + # Enable bus-dcvs + for device in /sys/devices/platform/soc + do + for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo "2288 4577 7110 9155 12298 14236" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 68 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + echo 40 > $llccbw/polling_interval + echo "1144 1720 2086 2929 3879 5931 6881 8137" > $llccbw/bw_hwmon/mbps_zones + echo 4 > $llccbw/bw_hwmon/sample_ms + echo 68 > $llccbw/bw_hwmon/io_percent + echo 20 > $llccbw/bw_hwmon/hist_memory + echo 0 > $llccbw/bw_hwmon/hyst_length + echo 80 > $llccbw/bw_hwmon/down_thres + echo 0 > $llccbw/bw_hwmon/guard_band_mbps + echo 250 > $llccbw/bw_hwmon/up_scale + echo 1600 > $llccbw/bw_hwmon/idle_mbps + done + + for npubw in $device/*npu*-npu-ddr-bw/devfreq/*npu*-npu-ddr-bw + do + echo 1 > /sys/devices/virtual/npu/msm_npu/pwr + echo "bw_hwmon" > $npubw/governor + echo 40 > $npubw/polling_interval + echo "1144 1720 2086 2929 3879 5931 6881 8137" > $npubw/bw_hwmon/mbps_zones + echo 4 > $npubw/bw_hwmon/sample_ms + echo 80 > $npubw/bw_hwmon/io_percent + echo 20 > $npubw/bw_hwmon/hist_memory + echo 10 > $npubw/bw_hwmon/hyst_length + echo 30 > $npubw/bw_hwmon/down_thres + echo 0 > $npubw/bw_hwmon/guard_band_mbps + echo 250 > $npubw/bw_hwmon/up_scale + echo 0 > $npubw/bw_hwmon/idle_mbps + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + + #Enable mem_latency governor for L3, LLCC, and DDR scaling + for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Enable cdspl3 governor for L3 cdsp nodes + for l3cdsp in $device/*cdsp-cdsp-l3-lat/devfreq/*cdsp-cdsp-l3-lat + do + echo "cdspl3" > $l3cdsp/governor + done + + #Gold L3 ratio ceil + echo 4000 > /sys/class/devfreq/soc:qcom,cpu6-cpu-l3-lat/mem_latency/ratio_ceil + + #Enable compute governor for gold latfloor + for latfloor in $device/*cpu*-ddr-latfloor*/devfreq/*cpu-ddr-latfloor* + do + echo "compute" > $latfloor/governor + echo 10 > $latfloor/polling_interval + done + + done + + # cpuset parameters + echo 0-2 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + echo 0-2,4-7 > /dev/cpuset/foreground/cpus + echo 0-7 > /dev/cpuset/top-app/cpus + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # Turn on sleep modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + ;; +esac + + +case "$target" in + "bengal") + + 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 + "417" ) + + # Core control is temporarily disabled till bring up + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable + echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus + # Core control parameters on big + echo 40 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres + echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres + echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms + echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres + + # Setting b.L scheduler parameters + echo 67 > /proc/sys/kernel/sched_downmigrate + echo 77 > /proc/sys/kernel/sched_upmigrate + echo 85 > /proc/sys/kernel/sched_group_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + + # cpuset settings + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + + # configure governor settings for little cluster + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us + echo 1305600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + echo 614400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rtg_boost_freq + + # configure governor settings for big cluster + echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_rate_limit_us + echo 1401600 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq + echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/rtg_boost_freq + + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + + # sched_load_boost as -6 is equivalent to target load as 85. It is per cpu tunable. + echo -6 > /sys/devices/system/cpu/cpu0/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu1/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu2/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu3/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu4/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu5/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost + echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost + echo 85 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_load + echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_load + + # Set Memory parameters + configure_memory_parameters + + # Enable bus-dcvs + ddr_type=`od -An -tx /proc/device-tree/memory/ddr_device_type` + ddr_type4="07" + ddr_type3="05" + + for device in /sys/devices/platform/soc + do + for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo 762 > $cpubw/min_freq + if [ ${ddr_type:4:2} == $ddr_type4 ]; then + # LPDDR4 + echo "2288 3440 4173 5195 5859 7759 10322 11863 13763" > $cpubw/bw_hwmon/mbps_zones + echo 85 > $cpubw/bw_hwmon/io_percent + fi + if [ ${ddr_type:4:2} == $ddr_type3 ]; then + # LPDDR3 + echo "1525 3440 5195 5859 7102" > $cpubw/bw_hwmon/mbps_zones + echo 34 > $cpubw/bw_hwmon/io_percent + fi + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 90 > $cpubw/bw_hwmon/decay_rate + echo 190 > $cpubw/bw_hwmon/bw_step + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + for latfloor in $device/*cpu*-ddr-latfloor*/devfreq/*cpu-ddr-latfloor* + do + echo "compute" > $latfloor/governor + echo 10 > $latfloor/polling_interval + done + + done + + # colcoation v3 disabled + echo 0 > /proc/sys/kernel/sched_min_task_util_for_boost + echo 0 > /proc/sys/kernel/sched_min_task_util_for_colocation + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # Turn on sleep modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + ;; + esac + ;; +esac + +case "$target" in + "qcs605") + + #Apply settings for qcs605 + # Set the default IRQ affinity to the silver cluster. When a + # CPU is isolated/hotplugged, the IRQ affinity is adjusted + # to one of the CPU from the default IRQ affinity mask. + echo 3f > /proc/irq/default_smp_affinity + + 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 + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + + if [ -f /sys/devices/soc0/platform_subtype_id ]; then + platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id` + fi + + case "$soc_id" in + "347" ) + + # Start Host based Touch processing + case "$hw_platform" in + "Surf" | "RCM" | "QRD" ) + start_hbtp + ;; + "MTP" ) + if [ $platform_subtype_id != 5 ]; then + start_hbtp + fi + ;; + esac + + # Core control parameters on silver + echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus + echo 60 > /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 + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster + echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres + + # Setting b.L scheduler parameters + echo 96 > /proc/sys/kernel/sched_upmigrate + echo 90 > /proc/sys/kernel/sched_downmigrate + echo 140 > /proc/sys/kernel/sched_group_upmigrate + echo 120 > /proc/sys/kernel/sched_group_downmigrate + + # configure governor settings for little cluster + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us + echo 1209600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + + # configure governor settings for big cluster + echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/rate_limit_us + echo 1344000 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq + echo 825600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq + + echo "0:1209600" > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + + # Enable bus-dcvs + for cpubw in /sys/class/devfreq/*qcom,cpubw* + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo "1144 1720 2086 2929 3879 5931 6881" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 68 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 0 > $cpubw/bw_hwmon/hyst_length + echo 80 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/low_power_ceil_mbps + echo 68 > $cpubw/bw_hwmon/low_power_io_percent + echo 20 > $cpubw/bw_hwmon/low_power_delay + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + #Enable mem_latency governor for DDR scaling + for memlat in /sys/class/devfreq/*qcom,memlat-cpu* + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Enable mem_latency governor for L3 scaling + for memlat in /sys/class/devfreq/*qcom,l3-cpu* + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor + + # cpuset parameters + echo 0-5 > /dev/cpuset/background/cpus + echo 0-5 > /dev/cpuset/system-background/cpus + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # Turn on sleep modes. + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + echo 100 > /proc/sys/vm/swappiness + ;; + esac + ;; +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 + 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 + "msm8992") + # disable thermal bcl hotplug to switch governor + 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 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 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif + echo 19000 > /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 960000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy + echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads + echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time + echo 80000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis + echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + # online CPU4 + echo 1 > /sys/devices/system/cpu/cpu4/online + # 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 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif + echo 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 1536000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy + echo 85 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads + echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time + echo 80000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis + echo 384000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + # re-enable thermal and BCL hotplug + 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 $bcl_soc_hotplug_mask > /sys/devices/soc.*/qcom,bcl.*/hotplug_soc_mask + echo -n enable > /sys/devices/soc.*/qcom,bcl.*/mode + # plugin remaining A57s + echo 1 > /sys/devices/system/cpu/cpu5/online + # input boost configuration + echo 0:1248000 > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + # 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 + #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 + "msm8994") + # ensure at most one A57 is online when thermal hotplug is disabled + echo 0 > /sys/devices/system/cpu/cpu5/online + echo 0 > /sys/devices/system/cpu/cpu6/online + echo 0 > /sys/devices/system/cpu/cpu7/online + # in case CPU4 is online, limit its frequency + echo 960000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + # Limit A57 max freq from msm_perf module in case CPU 4 is offline + echo "4:960000 5:960000 6:960000 7:960000" > /sys/module/msm_performance/parameters/cpu_max_freq + # disable thermal bcl hotplug to switch governor + echo 0 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + bcl_hotplug_mask=`cat $hotplug_mask` + echo 0 > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + bcl_soc_hotplug_mask=`cat $hotplug_soc_mask` + echo 0 > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + # 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 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif + echo 19000 > /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 960000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy + echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads + echo 40000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time + echo 80000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis + echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + # online CPU4 + echo 1 > /sys/devices/system/cpu/cpu4/online + # Best effort limiting for first time boot if msm_performance module is absent + echo 960000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_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 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif + echo "19000 1400000:39000 1700000: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 1248000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy + echo "85 1500000:90 1800000:70" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads + echo 40000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time + echo 80000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis + echo 384000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + # restore A57's max + cat /sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_max_freq > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + # re-enable thermal and BCL hotplug + echo 1 > /sys/module/msm_thermal/core_control/enabled + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n disable > $mode + done + for hotplug_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_mask + do + echo $bcl_hotplug_mask > $hotplug_mask + done + for hotplug_soc_mask in /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask + do + echo $bcl_soc_hotplug_mask > $hotplug_soc_mask + done + for mode in /sys/devices/soc.0/qcom,bcl.*/mode + do + echo -n enable > $mode + done + # plugin remaining A57s + 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 + # Restore CPU 4 max freq from msm_performance + echo "4:4294967295 5:4294967295 6:4294967295 7:4294967295" > /sys/module/msm_performance/parameters/cpu_max_freq + # input boost configuration + echo 0:1344000 > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + # Setting b.L scheduler parameters + echo 1 > /proc/sys/kernel/sched_migration_fixup + echo 30 > /proc/sys/kernel/sched_small_task + echo 20 > /proc/sys/kernel/sched_mostly_idle_load + echo 3 > /proc/sys/kernel/sched_mostly_idle_nr_run + echo 99 > /proc/sys/kernel/sched_upmigrate + echo 85 > /proc/sys/kernel/sched_downmigrate + echo 400000 > /proc/sys/kernel/sched_freq_inc_notify + echo 400000 > /proc/sys/kernel/sched_freq_dec_notify + #enable rps static configuration + echo 8 > /sys/class/net/rmnet_ipa0/queues/rx-0/rps_cpus + for devfreq_gov in /sys/class/devfreq/qcom,cpubw*/governor + do + echo "bw_hwmon" > $devfreq_gov + done + ;; +esac + +case "$target" in + "msm8996") + # disable thermal bcl hotplug to switch governor + echo 0 > /sys/module/msm_thermal/core_control/enabled + echo -n disable > /sys/devices/soc/soc:qcom,bcl/mode + bcl_hotplug_mask=`cat /sys/devices/soc/soc:qcom,bcl/hotplug_mask` + echo 0 > /sys/devices/soc/soc:qcom,bcl/hotplug_mask + bcl_soc_hotplug_mask=`cat /sys/devices/soc/soc:qcom,bcl/hotplug_soc_mask` + echo 0 > /sys/devices/soc/soc:qcom,bcl/hotplug_soc_mask + echo -n enable > /sys/devices/soc/soc:qcom,bcl/mode + # set sync wakee policy tunable + echo 1 > /proc/sys/kernel/sched_prefer_sync_wakee_to_waker + # 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 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif + echo 19000 > /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 960000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy + echo 80 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads + echo 19000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time + echo 79000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis + echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif + # online CPU2 + echo 1 > /sys/devices/system/cpu/cpu2/online + # configure governor settings for big cluster + echo "interactive" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor + echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/use_sched_load + echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/use_migration_notif + echo "19000 1400000:39000 1700000:19000 2100000:79000" > /sys/devices/system/cpu/cpu2/cpufreq/interactive/above_hispeed_delay + echo 90 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/go_hispeed_load + echo 20000 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/timer_rate + echo 1248000 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/io_is_busy + echo "85 1500000:90 1800000:70 2100000:95" > /sys/devices/system/cpu/cpu2/cpufreq/interactive/target_loads + echo 19000 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/min_sample_time + echo 79000 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/max_freq_hysteresis + echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq + echo 1 > /sys/devices/system/cpu/cpu2/cpufreq/interactive/ignore_hispeed_on_notif + # re-enable thermal and BCL hotplug + echo 1 > /sys/module/msm_thermal/core_control/enabled + echo -n disable > /sys/devices/soc/soc:qcom,bcl/mode + echo $bcl_hotplug_mask > /sys/devices/soc/soc:qcom,bcl/hotplug_mask + echo $bcl_soc_hotplug_mask > /sys/devices/soc/soc:qcom,bcl/hotplug_soc_mask + echo -n enable > /sys/devices/soc/soc:qcom,bcl/mode + # input boost configuration + echo "0:1324800 2:1324800" > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + # Setting b.L scheduler parameters + echo 0 > /proc/sys/kernel/sched_boost + echo 1 > /proc/sys/kernel/sched_migration_fixup + echo 45 > /proc/sys/kernel/sched_downmigrate + echo 45 > /proc/sys/kernel/sched_upmigrate + echo 400000 > /proc/sys/kernel/sched_freq_inc_notify + echo 400000 > /proc/sys/kernel/sched_freq_dec_notify + echo 3 > /proc/sys/kernel/sched_spill_nr_run + echo 100 > /proc/sys/kernel/sched_init_task_load + # Enable bus-dcvs + for cpubw in /sys/class/devfreq/*qcom,cpubw* + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo 1525 > $cpubw/min_freq + echo "1525 5195 11863 13763" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 34 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 10 > $cpubw/bw_hwmon/hyst_length + echo 0 > $cpubw/bw_hwmon/low_power_ceil_mbps + echo 34 > $cpubw/bw_hwmon/low_power_io_percent + echo 20 > $cpubw/bw_hwmon/low_power_delay + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for memlat in /sys/class/devfreq/*qcom,memlat-cpu* + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + done + echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor + + soc_revision=`cat /sys/devices/soc0/revision` + if [ "$soc_revision" == "2.0" ]; then + #Disable suspend for v2.0 + echo pwr_dbg > /sys/power/wake_lock + elif [ "$soc_revision" == "2.1" ]; then + # Enable C4.D4.E4.M3 LPM modes + # Disable D3 state + echo 0 > /sys/module/lpm_levels/system/pwr/pwr-l2-gdhs/idle_enabled + echo 0 > /sys/module/lpm_levels/system/perf/perf-l2-gdhs/idle_enabled + # Disable DEF-FPC mode + echo N > /sys/module/lpm_levels/system/pwr/cpu0/fpc-def/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu1/fpc-def/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu2/fpc-def/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu3/fpc-def/idle_enabled + else + # Enable all LPMs by default + # This will enable C4, D4, D3, E4 and M3 LPMs + echo N > /sys/module/lpm_levels/parameters/sleep_disabled + fi + echo N > /sys/module/lpm_levels/parameters/sleep_disabled + # Starting io prefetcher service + start iop + + # Set Memory parameters + configure_memory_parameters + ;; +esac + +case "$target" in + "sdm845") + + # Set the default IRQ affinity to the silver cluster. When a + # CPU is isolated/hotplugged, the IRQ affinity is adjusted + # to one of the CPU from the default IRQ affinity mask. + echo f > /proc/irq/default_smp_affinity + + 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 + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + fi + + if [ -f /sys/devices/soc0/platform_subtype_id ]; then + platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id` + fi + + case "$soc_id" in + "321" | "341") + # Start Host based Touch processing + case "$hw_platform" in + "QRD" ) + case "$platform_subtype_id" in + "32") #QVR845 do nothing + ;; + *) + start_hbtp + ;; + esac + ;; + *) + start_hbtp + ;; + esac + ;; + esac + # Core control parameters + echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres + echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms + echo 1 > /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster + echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres + + # Setting b.L scheduler parameters + echo 95 > /proc/sys/kernel/sched_upmigrate + echo 85 > /proc/sys/kernel/sched_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + echo 95 > /proc/sys/kernel/sched_group_downmigrate + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + + # configure governor settings for little cluster + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us + echo 1209600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/pl + echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + + # configure governor settings for big cluster + echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/rate_limit_us + echo 1574400 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/pl + echo "0:1324800" > /sys/module/cpu_boost/parameters/input_boost_freq + echo 120 > /sys/module/cpu_boost/parameters/input_boost_ms + # Limit the min frequency to 825MHz + echo 825000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + + # Enable oom_reaper + echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper + + # Enable bus-dcvs + for cpubw in /sys/class/devfreq/*qcom,cpubw* + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo "2288 4577 6500 8132 9155 10681" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 50 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 10 > $cpubw/bw_hwmon/hyst_length + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for llccbw in /sys/class/devfreq/*qcom,llccbw* + do + echo "bw_hwmon" > $llccbw/governor + echo 50 > $llccbw/polling_interval + echo "1720 2929 3879 5931 6881" > $llccbw/bw_hwmon/mbps_zones + echo 4 > $llccbw/bw_hwmon/sample_ms + echo 80 > $llccbw/bw_hwmon/io_percent + echo 20 > $llccbw/bw_hwmon/hist_memory + echo 10 > $llccbw/bw_hwmon/hyst_length + echo 0 > $llccbw/bw_hwmon/guard_band_mbps + echo 250 > $llccbw/bw_hwmon/up_scale + echo 1600 > $llccbw/bw_hwmon/idle_mbps + done + + #Enable mem_latency governor for DDR scaling + for memlat in /sys/class/devfreq/*qcom,memlat-cpu* + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Enable mem_latency governor for L3 scaling + for memlat in /sys/class/devfreq/*qcom,l3-cpu* + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Enable userspace governor for L3 cdsp nodes + for l3cdsp in /sys/class/devfreq/*qcom,l3-cdsp* + do + echo "userspace" > $l3cdsp/governor + chown -h system $l3cdsp/userspace/set_freq + done + + #Gold L3 ratio ceil + echo 4000 > /sys/class/devfreq/soc:qcom,l3-cpu4/mem_latency/ratio_ceil + + echo "compute" > /sys/class/devfreq/soc:qcom,mincpubw/governor + echo 10 > /sys/class/devfreq/soc:qcom,mincpubw/polling_interval + + # cpuset parameters + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + # Disable CPU Retention + echo N > /sys/module/lpm_levels/L3/cpu0/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu1/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu2/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu3/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu4/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu5/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu6/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/cpu7/ret/idle_enabled + echo N > /sys/module/lpm_levels/L3/l3-dyn-ret/idle_enabled + # Turn on sleep modes. + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + echo 100 > /proc/sys/vm/swappiness + echo 120 > /proc/sys/vm/watermark_scale_factor + ;; +esac + +case "$target" in + "msmnile") + # Core control parameters for gold + echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres + echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms + echo 3 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres + + # Core control parameters for gold+ + echo 0 > /sys/devices/system/cpu/cpu7/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres + echo 30 > /sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu7/core_ctl/offline_delay_ms + echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/task_thres + # Controls how many more tasks should be eligible to run on gold CPUs + # w.r.t number of gold CPUs available to trigger assist (max number of + # tasks eligible to run on previous cluster minus number of CPUs in + # the previous cluster). + # + # Setting to 1 by default which means there should be at least + # 4 tasks eligible to run on gold cluster (tasks running on gold cores + # plus misfit tasks on silver cores) to trigger assitance from gold+. + echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/nr_prev_assist_thresh + + # Disable Core control on silver + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable + + # Setting b.L scheduler parameters + echo 95 95 > /proc/sys/kernel/sched_upmigrate + echo 85 85 > /proc/sys/kernel/sched_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + echo 10 > /proc/sys/kernel/sched_group_downmigrate + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + + # cpuset parameters + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # configure governor settings for silver cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us + echo 1209600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + echo 1 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl + + # configure governor settings for gold cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us + echo 1612800 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl + + # configure governor settings for gold+ cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy7/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us + echo 1612800 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/pl + + # configure input boost settings + echo "0:1324800" > /sys/module/cpu_boost/parameters/input_boost_freq + echo 120 > /sys/module/cpu_boost/parameters/input_boost_ms + + # Disable wsf, beacause we are using efk. + # wsf Range : 1..1000 So set to bare minimum value 1. + echo 1 > /proc/sys/vm/watermark_scale_factor + + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + # Enable oom_reaper + if [ -f /sys/module/lowmemorykiller/parameters/oom_reaper ]; then + echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper + else + echo 1 > /proc/sys/vm/reap_mem_on_sigkill + fi + + # Enable bus-dcvs + for device in /sys/devices/platform/soc + do + for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw + do + echo "bw_hwmon" > $cpubw/governor + echo 40 > $cpubw/polling_interval + echo "2288 4577 7110 9155 12298 14236 15258" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 50 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 10 > $cpubw/bw_hwmon/hyst_length + echo 30 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + echo 14236 > $cpubw/max_freq + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + echo 40 > $llccbw/polling_interval + echo "1720 2929 3879 5931 6881 7980" > $llccbw/bw_hwmon/mbps_zones + echo 4 > $llccbw/bw_hwmon/sample_ms + echo 80 > $llccbw/bw_hwmon/io_percent + echo 20 > $llccbw/bw_hwmon/hist_memory + echo 10 > $llccbw/bw_hwmon/hyst_length + echo 30 > $llccbw/bw_hwmon/down_thres + echo 0 > $llccbw/bw_hwmon/guard_band_mbps + echo 250 > $llccbw/bw_hwmon/up_scale + echo 1600 > $llccbw/bw_hwmon/idle_mbps + echo 6881 > $llccbw/max_freq + done + + for npubw in $device/*npu-npu-ddr-bw/devfreq/*npu-npu-ddr-bw + do + echo 1 > /sys/devices/virtual/npu/msm_npu/pwr + echo "bw_hwmon" > $npubw/governor + echo 40 > $npubw/polling_interval + echo "1720 2929 3879 5931 6881 7980" > $npubw/bw_hwmon/mbps_zones + echo 4 > $npubw/bw_hwmon/sample_ms + echo 80 > $npubw/bw_hwmon/io_percent + echo 20 > $npubw/bw_hwmon/hist_memory + echo 6 > $npubw/bw_hwmon/hyst_length + echo 30 > $npubw/bw_hwmon/down_thres + echo 0 > $npubw/bw_hwmon/guard_band_mbps + echo 250 > $npubw/bw_hwmon/up_scale + echo 0 > $npubw/bw_hwmon/idle_mbps + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + + #Enable mem_latency governor for L3, LLCC, and DDR scaling + for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Enable userspace governor for L3 cdsp nodes + for l3cdsp in $device/*cdsp-cdsp-l3-lat/devfreq/*cdsp-cdsp-l3-lat + do + echo "cdspl3" > $l3cdsp/governor + done + + #Enable compute governor for gold latfloor + for latfloor in $device/*cpu-ddr-latfloor*/devfreq/*cpu-ddr-latfloor* + do + echo "compute" > $latfloor/governor + echo 10 > $latfloor/polling_interval + done + + #Gold L3 ratio ceil + for l3gold in $device/*cpu4-cpu-l3-lat/devfreq/*cpu4-cpu-l3-lat + do + echo 4000 > $l3gold/mem_latency/ratio_ceil + done + + #Prime L3 ratio ceil + for l3prime in $device/*cpu7-cpu-l3-lat/devfreq/*cpu7-cpu-l3-lat + do + echo 20000 > $l3prime/mem_latency/ratio_ceil + done + done + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + + if [ -f /sys/devices/soc0/platform_subtype_id ]; then + platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id` + fi + + case "$hw_platform" in + "MTP" | "Surf" | "RCM" ) + # Start Host based Touch processing + case "$platform_subtype_id" in + "0" | "1" | "2" | "4") + start_hbtp + ;; + esac + ;; + "HDK" ) + if [ -d /sys/kernel/hbtpsensor ] ; then + start_hbtp + fi + ;; + esac + + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + configure_memory_parameters + target_type=`getprop ro.hardware.type` + if [ "$target_type" == "automotive" ]; then + # update frequencies + configure_automotive_sku_parameters + fi + + ;; +esac + +case "$target" in + "sdmshrike") + # Core control parameters for gold + echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres + echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms + echo 3 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres + + # Core control parameters for gold+ + echo 0 > /sys/devices/system/cpu/cpu7/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres + echo 30 > /sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu7/core_ctl/offline_delay_ms + echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/task_thres + # Controls how many more tasks should be eligible to run on gold CPUs + # w.r.t number of gold CPUs available to trigger assist (max number of + # tasks eligible to run on previous cluster minus number of CPUs in + # the previous cluster). + # + # Setting to 1 by default which means there should be at least + # 4 tasks eligible to run on gold cluster (tasks running on gold cores + # plus misfit tasks on silver cores) to trigger assitance from gold+. + echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/nr_prev_assist_thresh + + # Disable Core control on silver + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable + + # Setting b.L scheduler parameters + echo 95 95 > /proc/sys/kernel/sched_upmigrate + echo 85 85 > /proc/sys/kernel/sched_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + echo 10 > /proc/sys/kernel/sched_group_downmigrate + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + + # cpuset parameters + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # configure governor settings for silver cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us + echo 1209600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + echo 1 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl + + # configure governor settings for gold cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/down_rate_limit_us + echo 1612800 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl + + # configure governor settings for gold+ cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy7/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/down_rate_limit_us + echo 1612800 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/pl + + # configure input boost settings + echo "0:1324800" > /sys/module/cpu_boost/parameters/input_boost_freq + echo 120 > /sys/module/cpu_boost/parameters/input_boost_ms + + # Disable wsf, beacause we are using efk. + # wsf Range : 1..1000 So set to bare minimum value 1. + echo 1 > /proc/sys/vm/watermark_scale_factor + + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + # Enable oom_reaper + if [ -f /sys/module/lowmemorykiller/parameters/oom_reaper ]; then + echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper + else + echo 1 > /proc/sys/vm/reap_mem_on_sigkill + fi + + # Enable bus-dcvs + for device in /sys/devices/platform/soc + do + for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw + do + echo "bw_hwmon" > $cpubw/governor + echo 40 > $cpubw/polling_interval + echo "2288 4577 7110 9155 12298 14236 15258" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 50 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 10 > $cpubw/bw_hwmon/hyst_length + echo 30 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + echo 14236 > $cpubw/max_freq + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + echo 40 > $llccbw/polling_interval + echo "1720 2929 3879 5931 6881 7980" > $llccbw/bw_hwmon/mbps_zones + echo 4 > $llccbw/bw_hwmon/sample_ms + echo 80 > $llccbw/bw_hwmon/io_percent + echo 20 > $llccbw/bw_hwmon/hist_memory + echo 10 > $llccbw/bw_hwmon/hyst_length + echo 30 > $llccbw/bw_hwmon/down_thres + echo 0 > $llccbw/bw_hwmon/guard_band_mbps + echo 250 > $llccbw/bw_hwmon/up_scale + echo 1600 > $llccbw/bw_hwmon/idle_mbps + echo 6881 > $llccbw/max_freq + done + + for npubw in $device/*npu-npu-ddr-bw/devfreq/*npu-npu-ddr-bw + do + echo 1 > /sys/devices/virtual/npu/msm_npu/pwr + echo "bw_hwmon" > $npubw/governor + echo 40 > $npubw/polling_interval + echo "1720 2929 3879 5931 6881 7980" > $npubw/bw_hwmon/mbps_zones + echo 4 > $npubw/bw_hwmon/sample_ms + echo 80 > $npubw/bw_hwmon/io_percent + echo 20 > $npubw/bw_hwmon/hist_memory + echo 6 > $npubw/bw_hwmon/hyst_length + echo 30 > $npubw/bw_hwmon/down_thres + echo 0 > $npubw/bw_hwmon/guard_band_mbps + echo 250 > $npubw/bw_hwmon/up_scale + echo 0 > $npubw/bw_hwmon/idle_mbps + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + + #Enable mem_latency governor for L3, LLCC, and DDR scaling + for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Enable userspace governor for L3 cdsp nodes + for l3cdsp in $device/*cdsp-cdsp-l3-lat/devfreq/*cdsp-cdsp-l3-lat + do + echo "cdspl3" > $l3cdsp/governor + done + + #Enable compute governor for gold latfloor + for latfloor in $device/*cpu-ddr-latfloor*/devfreq/*cpu-ddr-latfloor* + do + echo "compute" > $latfloor/governor + echo 10 > $latfloor/polling_interval + done + + #Gold L3 ratio ceil + for l3gold in $device/*cpu4-cpu-l3-lat/devfreq/*cpu4-cpu-l3-lat + do + echo 4000 > $l3gold/mem_latency/ratio_ceil + done + + #Prime L3 ratio ceil + for l3prime in $device/*cpu7-cpu-l3-lat/devfreq/*cpu7-cpu-l3-lat + do + echo 20000 > $l3prime/mem_latency/ratio_ceil + done + done + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + + if [ -f /sys/devices/soc0/platform_subtype_id ]; then + platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id` + fi + + case "$hw_platform" in + "MTP" | "Surf" | "RCM" ) + # Start Host based Touch processing + case "$platform_subtype_id" in + "0" | "1") + start_hbtp + ;; + esac + ;; + "HDK" ) + if [ -d /sys/kernel/hbtpsensor ] ; then + start_hbtp + fi + ;; + esac + + #Setting the min and max supported frequencies + reg_val=`cat /sys/devices/platform/soc/780130.qfprom/qfprom0/nvmem | od -An -t d4` + feature_id=$(((reg_val >> 20) & 0xFF)) + + #Setting the min supported frequencies + echo 1113600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 1113600 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq + echo 1113600 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq + echo 1113600 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq + echo 1171200 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 1171200 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq + echo 1171200 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq + echo 1171200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq + #setting min gpu freq to 392 MHz + echo 4 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel + if [ $feature_id == 0 ]; then + echo "feature_id is 0 for SA8185P" + + #setting max gpu freq to 530 MHz + echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel + echo {class:ddr, res:fixed, val: 1804} > /sys/kernel/debug/aop_send_message + elif [ $feature_id == 1 ]; then + echo "feature_id is 1 for SA8195P" + + #setting max gpu freq to 670 MHz + echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel + echo {class:ddr, res:fixed, val: 2092} > /sys/kernel/debug/aop_send_message + else + echo "unknown feature_id value" $feature_id + fi + + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + configure_memory_parameters + ;; +esac + +case "$target" in + "kona") + + ddr_type=`od -An -tx /proc/device-tree/memory/ddr_device_type` + ddr_type4="07" + ddr_type5="08" + + # Core control parameters for gold + echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres + echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms + echo 3 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres + + # Core control parameters for gold+ + echo 0 > /sys/devices/system/cpu/cpu7/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres + echo 30 > /sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu7/core_ctl/offline_delay_ms + echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/task_thres + # Controls how many more tasks should be eligible to run on gold CPUs + # w.r.t number of gold CPUs available to trigger assist (max number of + # tasks eligible to run on previous cluster minus number of CPUs in + # the previous cluster). + # + # Setting to 1 by default which means there should be at least + # 4 tasks eligible to run on gold cluster (tasks running on gold cores + # plus misfit tasks on silver cores) to trigger assitance from gold+. + echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/nr_prev_assist_thresh + + # Disable Core control on silver + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable + + # Setting b.L scheduler parameters + echo 95 95 > /proc/sys/kernel/sched_upmigrate + echo 85 85 > /proc/sys/kernel/sched_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + echo 85 > /proc/sys/kernel/sched_group_downmigrate + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + echo 400000000 > /proc/sys/kernel/sched_coloc_downmigrate_ns + + # cpuset parameters + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # configure governor settings for silver cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us + if [ `cat /sys/devices/soc0/revision` == "2.0" ]; then + echo 1248000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + else + echo 1228800 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + fi + echo 691200 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + echo 1 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl + + # configure input boost settings + echo "0:1324800" > /sys/devices/system/cpu/cpu_boost/input_boost_freq + echo 120 > /sys/devices/system/cpu/cpu_boost/input_boost_ms + + # configure governor settings for gold cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/down_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us + echo 1574400 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl + + # configure governor settings for gold+ cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy7/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/down_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/up_rate_limit_us + if [ `cat /sys/devices/soc0/revision` == "2.0" ]; then + echo 1632000 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq + else + echo 1612800 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq + fi + echo 1 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/pl + + # Enable bus-dcvs + for device in /sys/devices/platform/soc + do + for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw + do + echo "bw_hwmon" > $cpubw/governor + echo 40 > $cpubw/polling_interval + echo "4577 7110 9155 12298 14236 15258" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 50 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 10 > $cpubw/bw_hwmon/hyst_length + echo 30 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + echo 14236 > $cpubw/max_freq + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + echo 40 > $llccbw/polling_interval + if [ ${ddr_type:4:2} == $ddr_type4 ]; then + echo "1720 2086 2929 3879 5161 5931 6881 7980" > $llccbw/bw_hwmon/mbps_zones + elif [ ${ddr_type:4:2} == $ddr_type5 ]; then + echo "1720 2086 2929 3879 5931 6881 7980 10437" > $llccbw/bw_hwmon/mbps_zones + fi + echo 4 > $llccbw/bw_hwmon/sample_ms + echo 80 > $llccbw/bw_hwmon/io_percent + echo 20 > $llccbw/bw_hwmon/hist_memory + echo 10 > $llccbw/bw_hwmon/hyst_length + echo 30 > $llccbw/bw_hwmon/down_thres + echo 0 > $llccbw/bw_hwmon/guard_band_mbps + echo 250 > $llccbw/bw_hwmon/up_scale + echo 1600 > $llccbw/bw_hwmon/idle_mbps + echo 6881 > $llccbw/max_freq + done + + for npubw in $device/*npu*-ddr-bw/devfreq/*npu*-ddr-bw + do + echo 1 > /sys/devices/virtual/npu/msm_npu/pwr + echo "bw_hwmon" > $npubw/governor + echo 40 > $npubw/polling_interval + if [ ${ddr_type:4:2} == $ddr_type4 ]; then + echo "1720 2086 2929 3879 5931 6881 7980" > $npubw/bw_hwmon/mbps_zones + elif [ ${ddr_type:4:2} == $ddr_type5 ]; then + echo "1720 2086 2929 3879 5931 6881 7980 10437" > $npubw/bw_hwmon/mbps_zones + fi + echo 4 > $npubw/bw_hwmon/sample_ms + echo 160 > $npubw/bw_hwmon/io_percent + echo 20 > $npubw/bw_hwmon/hist_memory + echo 10 > $npubw/bw_hwmon/hyst_length + echo 30 > $npubw/bw_hwmon/down_thres + echo 0 > $npubw/bw_hwmon/guard_band_mbps + echo 250 > $npubw/bw_hwmon/up_scale + echo 1600 > $npubw/bw_hwmon/idle_mbps + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + + for npullccbw in $device/*npu*-llcc-bw/devfreq/*npu*-llcc-bw + do + echo 1 > /sys/devices/virtual/npu/msm_npu/pwr + echo "bw_hwmon" > $npullccbw/governor + echo 40 > $npullccbw/polling_interval + echo "4577 7110 9155 12298 14236 15258" > $npullccbw/bw_hwmon/mbps_zones + echo 4 > $npullccbw/bw_hwmon/sample_ms + echo 160 > $npullccbw/bw_hwmon/io_percent + echo 20 > $npullccbw/bw_hwmon/hist_memory + echo 10 > $npullccbw/bw_hwmon/hyst_length + echo 30 > $npullccbw/bw_hwmon/down_thres + echo 0 > $npullccbw/bw_hwmon/guard_band_mbps + echo 250 > $npullccbw/bw_hwmon/up_scale + echo 1600 > $npullccbw/bw_hwmon/idle_mbps + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + #Enable mem_latency governor for L3 scaling + for memlat in $device/*qcom,devfreq-l3/*cpu*-lat/devfreq/*cpu*-lat + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Enable cdspl3 governor for L3 cdsp nodes + for l3cdsp in $device/*qcom,devfreq-l3/*cdsp-l3-lat/devfreq/*cdsp-l3-lat + do + echo "cdspl3" > $l3cdsp/governor + done + + #Enable mem_latency governor for LLCC and DDR scaling + for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Enable compute governor for gold latfloor + for latfloor in $device/*cpu-ddr-latfloor*/devfreq/*cpu-ddr-latfloor* + do + echo "compute" > $latfloor/governor + echo 10 > $latfloor/polling_interval + done + + #Gold L3 ratio ceil + for l3gold in $device/*qcom,devfreq-l3/*cpu4-cpu-l3-lat/devfreq/*cpu4-cpu-l3-lat + do + echo 4000 > $l3gold/mem_latency/ratio_ceil + done + + #Prime L3 ratio ceil + for l3prime in $device/*qcom,devfreq-l3/*cpu7-cpu-l3-lat/devfreq/*cpu7-cpu-l3-lat + do + echo 20000 > $l3prime/mem_latency/ratio_ceil + done + + #Enable mem_latency governor for qoslat + for qoslat in $device/*qoslat/devfreq/*qoslat + do + echo "mem_latency" > $qoslat/governor + echo 10 > $qoslat/polling_interval + echo 50 > $qoslat/mem_latency/ratio_ceil + done + done + echo N > /sys/module/lpm_levels/parameters/sleep_disabled + configure_memory_parameters + ;; +esac + +case "$target" in + "msm8998" | "apq8098_latv") + + echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres + echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms + echo 1 > /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster + echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres + + # Setting b.L scheduler parameters + echo 1 > /proc/sys/kernel/sched_migration_fixup + echo 95 > /proc/sys/kernel/sched_upmigrate + echo 90 > /proc/sys/kernel/sched_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + echo 95 > /proc/sys/kernel/sched_group_downmigrate + echo 0 > /proc/sys/kernel/sched_select_prev_cpu_us + echo 400000 > /proc/sys/kernel/sched_freq_inc_notify + echo 400000 > /proc/sys/kernel/sched_freq_dec_notify + echo 5 > /proc/sys/kernel/sched_spill_nr_run + echo 1 > /proc/sys/kernel/sched_restrict_cluster_spill + echo 1 > /proc/sys/kernel/sched_prefer_sync_wakee_to_waker + start iop + + # disable thermal bcl hotplug to switch governor + echo 0 > /sys/module/msm_thermal/core_control/enabled + + # online CPU0 + echo 1 > /sys/devices/system/cpu/cpu0/online + # 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 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif + echo 19000 > /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 1248000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy + echo "83 1804800:95" > /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads + echo 19000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time + echo 79000 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis + echo 518400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif + # online CPU4 + echo 1 > /sys/devices/system/cpu/cpu4/online + # 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 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif + echo 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 1574400 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy + echo "83 1939200:90 2016000:95" > /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads + echo 19000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time + echo 79000 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis + echo 806400 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 1 > /sys/devices/system/cpu/cpu4/cpufreq/interactive/ignore_hispeed_on_notif + + # re-enable thermal and BCL hotplug + echo 1 > /sys/module/msm_thermal/core_control/enabled + + # Enable input boost configuration + echo "0:1324800" > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + # Enable bus-dcvs + for cpubw in /sys/class/devfreq/*qcom,cpubw* + do + echo "bw_hwmon" > $cpubw/governor + echo 50 > $cpubw/polling_interval + echo 1525 > $cpubw/min_freq + echo "3143 5859 11863 13763" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 34 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 10 > $cpubw/bw_hwmon/hyst_length + echo 0 > $cpubw/bw_hwmon/low_power_ceil_mbps + echo 34 > $cpubw/bw_hwmon/low_power_io_percent + echo 20 > $cpubw/bw_hwmon/low_power_delay + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + for memlat in /sys/class/devfreq/*qcom,memlat-cpu* + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + echo "cpufreq" > /sys/class/devfreq/soc:qcom,mincpubw/governor + 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 + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + + if [ -f /sys/devices/soc0/platform_version ]; then + platform_version=`cat /sys/devices/soc0/platform_version` + platform_major_version=$((10#${platform_version}>>16)) + fi + + if [ -f /sys/devices/soc0/platform_subtype_id ]; then + platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id` + fi + + case "$soc_id" in + "292") #msm8998 apq8098_latv + # Start Host based Touch processing + case "$hw_platform" in + "QRD") + case "$platform_subtype_id" in + "0") + start_hbtp + ;; + "16") + if [ $platform_major_version -lt 6 ]; then + start_hbtp + fi + ;; + esac + + ;; + esac + ;; + esac + + echo N > /sys/module/lpm_levels/system/pwr/cpu0/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu1/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu2/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/cpu3/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu4/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu5/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu6/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/cpu7/ret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-dynret/idle_enabled + echo N > /sys/module/lpm_levels/system/pwr/pwr-l2-ret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/perf-l2-dynret/idle_enabled + echo N > /sys/module/lpm_levels/system/perf/perf-l2-ret/idle_enabled + echo N > /sys/module/lpm_levels/parameters/sleep_disabled + + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + echo 0 > /proc/sys/kernel/sched_boost + + # Set Memory parameters + configure_memory_parameters + ;; +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 + + # HMP scheduler settings for 8909 similiar to 8917 + echo 3 > /proc/sys/kernel/sched_window_stats_policy + echo 3 > /proc/sys/kernel/sched_ravg_hist_size + + echo 1 > /proc/sys/kernel/sched_restrict_tasks_spread + + 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 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 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 + + # 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 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 "29000 1094400:49000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay + echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load + echo 30000 > /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 + + # 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 + for cpu_bimc_bw_step in /sys/class/devfreq/*qcom,cpubw*/bw_hwmon/bw_step + do + echo 60 > $cpu_bimc_bw_step + done + for cpu_guard_band_mbps in /sys/class/devfreq/*qcom,cpubw*/bw_hwmon/guard_band_mbps + do + echo 30 > $cpu_guard_band_mbps + 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 + for gpu_bimc_bw_step in /sys/class/devfreq/*qcom,gpubw*/bw_hwmon/bw_step + do + echo 60 > $gpu_bimc_bw_step + done + for gpu_bimc_guard_band_mbps in /sys/class/devfreq/*qcom,gpubw*/bw_hwmon/guard_band_mbps + do + echo 30 > $gpu_bimc_guard_band_mbps + done + + # Set Memory parameters + configure_memory_parameters + restorecon -R /sys/devices/system/cpu + ;; +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 vendor.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 + ;; + "msm8974") + start mpdecision + echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb + ;; + "msm8909" | "msm8916" | "msm8937" | "msm8952" | "msm8953" | "msm8994" | "msm8992" | "msm8996" | "msm8998" | "sdm660" | "apq8098_latv" | "sdm845" | "sdm710" | "qcs605" |"msmnile" | "sdmshrike" |"msmsteppe" | "sm6150" | "kona" | "lito" | "trinket" | "atoll" | "bengal" ) + setprop vendor.post_boot.parsed 1 + ;; + "apq8084") + rm /data/system/perfd/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 + +# Let kernel know our image version/variant/crm_version +if [ -f /sys/devices/soc0/select_image ]; then + 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 +fi + +# Change console log level as per console config property +console_config=`getprop persist.console.silent.config` +case "$console_config" in + "1") + echo "Enable console config to $console_config" + echo 0 > /proc/sys/kernel/printk + ;; + *) + echo "Enable console config to $console_config" + ;; +esac + +# Parse misc partition path and set property +misc_link=$(ls -l /dev/block/bootdevice/by-name/misc) +real_path=${misc_link##*>} +setprop persist.vendor.mmi.misc_dev_path $real_path diff --git a/rootdir/bin/init.qcom.sdio.sh b/rootdir/bin/init.qcom.sdio.sh new file mode 100644 index 0000000..df77745 --- /dev/null +++ b/rootdir/bin/init.qcom.sdio.sh @@ -0,0 +1,78 @@ +#! /vendor/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/bin/init.qcom.sensors.sh b/rootdir/bin/init.qcom.sensors.sh new file mode 100644 index 0000000..daf7de2 --- /dev/null +++ b/rootdir/bin/init.qcom.sensors.sh @@ -0,0 +1,45 @@ +#!/vendor/bin/sh +# Copyright (c) 2015,2018 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. +# + +# +# Function to start sensors for SSC enabled platforms +# +start_sensors() +{ + + chmod -h 664 /persist/sensors/sensors_settings + chown -h -R system.system /persist/sensors + start vendor.sensors.qti + + # Only for SLPI + if [ -c /dev/msm_dsps -o -c /dev/sensors ] ; then + start vendor.sensors + fi +} + +start_sensors diff --git a/rootdir/bin/init.qcom.sh b/rootdir/bin/init.qcom.sh new file mode 100644 index 0000000..02c0394 --- /dev/null +++ b/rootdir/bin/init.qcom.sh @@ -0,0 +1,465 @@ +#! /vendor/bin/sh + +# Copyright (c) 2009-2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of The Linux Foundation nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +target=`getprop ro.board.platform` +low_ram=`getprop ro.config.low_ram` +if [ -f /sys/devices/soc0/soc_id ]; then + platformid=`cat /sys/devices/soc0/soc_id` +else + platformid=`cat /sys/devices/system/soc/soc0/id` +fi + +start_battery_monitor() +{ + if ls /sys/bus/spmi/devices/qpnp-bms-*/fcc_data ; then + chown -h root.system /sys/module/pm8921_bms/parameters/* + chown -h root.system /sys/module/qpnp_bms/parameters/* + chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_data + chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_temp + chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_chgcyl + chmod 0660 /sys/module/qpnp_bms/parameters/* + chmod 0660 /sys/module/pm8921_bms/parameters/* + mkdir -p /data/bms + chown -h root.system /data/bms + chmod 0770 /data/bms + start battery_monitor + fi +} + +start_charger_monitor() +{ + if ls /sys/module/qpnp_charger/parameters/charger_monitor; then + chown -h root.system /sys/module/qpnp_charger/parameters/* + chown -h root.system /sys/class/power_supply/battery/input_current_max + chown -h root.system /sys/class/power_supply/battery/input_current_trim + chown -h root.system /sys/class/power_supply/battery/input_current_settled + chown -h root.system /sys/class/power_supply/battery/voltage_min + chmod 0664 /sys/class/power_supply/battery/input_current_max + chmod 0664 /sys/class/power_supply/battery/input_current_trim + chmod 0664 /sys/class/power_supply/battery/input_current_settled + chmod 0664 /sys/class/power_supply/battery/voltage_min + chmod 0664 /sys/module/qpnp_charger/parameters/charger_monitor + start charger_monitor + fi +} + +start_vm_bms() +{ + if [ -e /dev/vm_bms ]; then + chown -h root.system /sys/class/power_supply/bms/current_now + chown -h root.system /sys/class/power_supply/bms/voltage_ocv + chmod 0664 /sys/class/power_supply/bms/current_now + chmod 0664 /sys/class/power_supply/bms/voltage_ocv + start vm_bms + fi +} + +start_msm_irqbalance_8939() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + case "$platformid" in + "239" | "293" | "294" | "295" | "304" | "338" | "313" | "353" | "354") + start vendor.msm_irqbalance;; + "349" | "350" ) + start vendor.msm_irqbal_lb;; + esac + fi +} + +start_msm_irqbalance_msmnile() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + start vendor.msm_irqbalance + fi +} + +start_msm_irqbalance_kona() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + start vendor.msm_irqbalance + fi +} + +start_msm_irqbalance_lito() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + start vendor.msm_irqbalance + fi +} + +start_msm_irqbalance_atoll() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + start vendor.msm_irqbalance + fi +} + +start_msm_irqbalance660() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + case "$platformid" in + "317" | "321" | "324" | "325" | "326" | "336" | "345" | "346" | "360" | "393") + start vendor.msm_irqbalance;; + "318" | "327" | "385") + start vendor.msm_irqbl_sdm630;; + esac + fi +} + +start_msm_irqbalance() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + start vendor.msm_irqbalance + fi +} + +baseband=`getprop ro.baseband` +echo 1 > /proc/sys/net/ipv6/conf/default/accept_ra_defrtr + +case "$baseband" in + "svlte2a") + start bridgemgrd + ;; +esac + +case "$target" in + "msm7630_surf" | "msm7630_1x" | "msm7630_fusion") + if [ -f /sys/devices/soc0/hw_platform ]; then + value=`cat /sys/devices/soc0/hw_platform` + else + value=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + case "$value" in + "Fluid") + start profiler_daemon;; + esac + ;; + "msm8660" ) + if [ -f /sys/devices/soc0/hw_platform ]; then + platformvalue=`cat /sys/devices/soc0/hw_platform` + else + platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + case "$platformvalue" in + "Fluid") + start profiler_daemon;; + esac + ;; + "msm8960") + case "$baseband" in + "msm") + start_battery_monitor;; + esac + + if [ -f /sys/devices/soc0/hw_platform ]; then + platformvalue=`cat /sys/devices/soc0/hw_platform` + else + platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + case "$platformvalue" in + "Fluid") + start profiler_daemon;; + "Liquid") + start profiler_daemon;; + esac + ;; + "msm8974") + platformvalue=`cat /sys/devices/soc0/hw_platform` + case "$platformvalue" in + "Fluid") + start profiler_daemon;; + "Liquid") + start profiler_daemon;; + esac + case "$baseband" in + "msm") + start_battery_monitor + ;; + esac + start_charger_monitor + ;; + "sdm660") + 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 + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + + case "$soc_id" in + "317" | "324" | "325" | "326" | "318" | "327" ) + case "$hw_platform" in + "Surf") + setprop qemu.hw.mainkeys 0 + ;; + "MTP") + setprop qemu.hw.mainkeys 0 + ;; + "RCM") + setprop qemu.hw.mainkeys 0 + ;; + "QRD") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + esac + start_msm_irqbalance660 + ;; + "apq8084") + platformvalue=`cat /sys/devices/soc0/hw_platform` + case "$platformvalue" in + "Fluid") + start profiler_daemon;; + "Liquid") + start profiler_daemon;; + esac + ;; + "msm8226") + start_charger_monitor + ;; + "msm8610") + start_charger_monitor + ;; + "msm8916") + start_vm_bms + start_msm_irqbalance_8939 + 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 + + 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") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + "MTP") + case "$platform_subtype_id" in + "3") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + esac + ;; + esac + ;; + "msm8994" | "msm8992" | "msm8998" | "apq8098_latv" | "sdm845" | "sdm710" | "qcs605" | "sm6150" | "trinket" | "bengal") + start_msm_irqbalance + ;; + "msm8996") + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + fi + case "$hw_platform" in + "MTP" | "CDP") + #Loop through the sysfs nodes and determine the correct sysfs to change the permission and ownership. + for count in 0 1 2 3 4 5 6 7 8 9 10 + do + dir="/sys/devices/soc/75ba000.i2c/i2c-12/12-0020/input/input"$count + if [ -d "$dir" ]; then + chmod 0660 $dir/secure_touch_enable + chmod 0440 $dir/secure_touch + chown system.drmrpc $dir/secure_touch_enable + chown system.drmrpc $dir/secure_touch + break + fi + done + ;; + esac + ;; + "msm8909") + start_vm_bms + ;; + "msmnile") + start_msm_irqbalance_msmnile + ;; + "kona") + start_msm_irqbalance_kona + ;; + "lito") + start_msm_irqbalance_lito + ;; + "atoll") + start_msm_irqbalance_atoll + ;; + "msm8937") + start_msm_irqbalance_8939 + 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 + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + if [ "$low_ram" != "true" ]; then + case "$soc_id" in + "294" | "295" | "303" | "307" | "308" | "309" | "313" | "320" | "353" | "354" | "363" | "364") + case "$hw_platform" in + "Surf") + setprop qemu.hw.mainkeys 0 + ;; + "MTP") + setprop qemu.hw.mainkeys 0 + ;; + "RCM") + setprop qemu.hw.mainkeys 0 + ;; + "QRD") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + esac + fi + ;; + "msm8953") + start_msm_irqbalance_8939 + 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 + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + case "$soc_id" in + "293" | "304" | "338" | "351" | "349" | "350" ) + case "$hw_platform" in + "Surf") + setprop qemu.hw.mainkeys 0 + ;; + "MTP") + setprop qemu.hw.mainkeys 0 + ;; + "RCM") + setprop qemu.hw.mainkeys 0 + ;; + "QRD") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + esac + ;; + "sdm710") + 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 + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + case "$soc_id" in + "336" | "337" | "347" | "360" | "393" ) + case "$hw_platform" in + "Surf") + setprop qemu.hw.mainkeys 0 + ;; + "MTP") + setprop qemu.hw.mainkeys 0 + ;; + "RCM") + setprop qemu.hw.mainkeys 0 + ;; + "QRD") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + esac + ;; +esac + +# +# Make modem config folder and copy firmware config to that folder for RIL +# +if [ -f /data/vendor/modem_config/ver_info.txt ]; then + prev_version_info=`cat /data/vendor/modem_config/ver_info.txt` +else + prev_version_info="" +fi + +cur_version_info=`cat /vendor/firmware_mnt/verinfo/ver_info.txt` +if [ ! -f /vendor/firmware_mnt/verinfo/ver_info.txt -o "$prev_version_info" != "$cur_version_info" ]; then + # add W for group recursively before delete + chmod g+w -R /data/vendor/modem_config/* + rm -rf /data/vendor/modem_config/* + # preserve the read only mode for all subdir and files + cp --preserve=m -dr /vendor/firmware_mnt/image/modem_pr/mcfg/configs/* /data/vendor/modem_config + cp --preserve=m -d /vendor/firmware_mnt/verinfo/ver_info.txt /data/vendor/modem_config/ + cp --preserve=m -d /vendor/firmware_mnt/image/modem_pr/mbn_ota.txt /data/vendor/modem_config/ + # the group must be root, otherwise this script could not add "W" for group recursively + chown -hR radio.root /data/vendor/modem_config/* +fi +chmod g-w /data/vendor/modem_config +setprop ro.vendor.ril.mbn_copy_completed 1 + +#check build variant for printk logging +#current default minimum boot-time-default +buildvariant=`getprop ro.build.type` +case "$buildvariant" in + "userdebug" | "eng") + #set default loglevel to KERN_INFO + echo "6 6 1 7" > /proc/sys/kernel/printk + ;; + *) + #set default loglevel to KERN_WARNING + echo "4 4 1 4" > /proc/sys/kernel/printk + ;; +esac diff --git a/rootdir/bin/init.qcom.usb.sh b/rootdir/bin/init.qcom.usb.sh new file mode 100644 index 0000000..870c487 --- /dev/null +++ b/rootdir/bin/init.qcom.usb.sh @@ -0,0 +1,250 @@ +#!/vendor/bin/sh +# Copyright (c) 2012-2018, 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. +# +# + +# Set platform variables +soc_hwplatform=`cat /sys/devices/soc0/hw_platform 2> /dev/null` +soc_machine=`cat /sys/devices/soc0/machine 2> /dev/null` +soc_machine=${soc_machine:0:2} +soc_id=`cat /sys/devices/soc0/soc_id 2> /dev/null` + +# +# Check ESOC for external modem +# +# Note: currently only a single MDM/SDX is supported +# +esoc_name=`cat /sys/bus/esoc/devices/esoc0/esoc_name 2> /dev/null` + +target=`getprop ro.board.platform` + +if [ -f /sys/class/android_usb/f_mass_storage/lun/nofua ]; then + echo 1 > /sys/class/android_usb/f_mass_storage/lun/nofua +fi + +# +# Override USB default composition +# +# If USB persist config not set, set default configuration + +fota_oem =`getprop ro.fota.oem` +debuggable=`getprop ro.debuggable` + +if [ "$(getprop persist.vendor.usb.config)" == "" -a \ + "$(getprop init.svc.vendor.usb-gadget-hal-1-0)" != "running" ]; then + if [ "$esoc_name" != "" ]; then + setprop persist.vendor.usb.config diag,diag_mdm,qdss,qdss_mdm,serial_cdev,dpl,rmnet,adb + else + case "$(getprop ro.baseband)" in + "apq") + setprop persist.vendor.usb.config diag,adb + ;; + *) + case "$soc_hwplatform" in + "Dragon" | "SBC") + setprop persist.vendor.usb.config diag,adb + ;; + *) + case "$soc_machine" in + "SA") + setprop persist.vendor.usb.config diag,adb + ;; + *) + case "$target" in + "msm8996") + setprop persist.vendor.usb.config diag,serial_cdev,serial_tty,rmnet_ipa,mass_storage,adb + ;; + "msm8909") + setprop persist.vendor.usb.config diag,serial_smd,rmnet_qti_bam,adb + ;; + "msm8937") + if [ -d /config/usb_gadget ]; then + setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,adb + else + case "$soc_id" in + "313" | "320") + setprop persist.vendor.usb.config diag,serial_smd,rmnet_ipa,adb + ;; + *) + setprop persist.vendor.usb.config diag,serial_smd,rmnet_qti_bam,adb + ;; + esac + fi + ;; + "msm8953") + if [ -d /config/usb_gadget ]; then + setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,adb + else + setprop persist.vendor.usb.config diag,serial_smd,rmnet_ipa,adb + fi + ;; + "msm8998" | "sdm660" | "apq8098_latv") + setprop persist.vendor.usb.config diag,serial_cdev,rmnet,adb + ;; + "sdm845" | "sdm710") + setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,adb + ;; + "msmnile" | "sm6150" | "trinket" | "lito" | "atoll" | "bengal" | "curtana" | "curtanacn" | "durandal" | "excalibur" | "joyeuse" | "gram") + case "$debuggable" in + "1") + setprop persist.vendor.usb.config adb + ;; + *) + setprop persist.vendor.usb.config none + ;; + esac + ;; + *) + setprop persist.vendor.usb.config diag,adb + ;; + esac + ;; + esac + ;; + esac + ;; + esac + fi +fi + +# Start peripheral mode on primary USB controllers for Automotive platforms +case "$soc_machine" in + "SA") + if [ -f /sys/bus/platform/devices/a600000.ssusb/mode ]; then + default_mode=`cat /sys/bus/platform/devices/a600000.ssusb/mode` + case "$default_mode" in + "none") + echo peripheral > /sys/bus/platform/devices/a600000.ssusb/mode + ;; + esac + fi + ;; +esac + +# set rndis transport to BAM2BAM_IPA for 8920 and 8940 +if [ "$target" == "msm8937" ]; then + if [ ! -d /config/usb_gadget ]; then + case "$soc_id" in + "313" | "320") + echo BAM2BAM_IPA > /sys/class/android_usb/android0/f_rndis_qc/rndis_transports + ;; + *) + ;; + esac + fi +fi + +# check configfs is mounted or not +if [ -d /config/usb_gadget ]; then + # Chip-serial is used for unique MSM identification in Product string + msm_serial=`cat /sys/devices/soc0/serial_number`; + msm_serial_hex=`printf %08X $msm_serial` + machine_type=`cat /sys/devices/soc0/machine` + product_string="$machine_type-$soc_hwplatform _SN:$msm_serial_hex" + echo "$product_string" > /config/usb_gadget/g1/strings/0x409/product + + # ADB requires valid iSerialNumber; if ro.serialno is missing, use dummy + serialnumber=`cat /config/usb_gadget/g1/strings/0x409/serialnumber 2> /dev/null` + if [ "$serialnumber" == "" ]; then + serialno=1234567 + echo $serialno > /config/usb_gadget/g1/strings/0x409/serialnumber + fi + setprop vendor.usb.configfs 1 +fi + +# +# Initialize RNDIS Diag option. If unset, set it to 'none'. +# +diag_extra=`getprop persist.vendor.usb.config.extra` +if [ "$diag_extra" == "" ]; then + setprop persist.vendor.usb.config.extra none +fi + +# enable rps cpus on msm8937 target +setprop vendor.usb.rps_mask 0 +case "$soc_id" in + "294" | "295" | "353" | "354") + setprop vendor.usb.rps_mask 40 + ;; +esac + +# +# Initialize UVC conifguration. +# +if [ -d /config/usb_gadget/g1/functions/uvc.0 ]; then + cd /config/usb_gadget/g1/functions/uvc.0 + + echo 3072 > streaming_maxpacket + echo 1 > streaming_maxburst + mkdir control/header/h + ln -s control/header/h control/class/fs/ + ln -s control/header/h control/class/ss + + mkdir -p streaming/uncompressed/u/360p + echo "666666\n1000000\n5000000\n" > streaming/uncompressed/u/360p/dwFrameInterval + + mkdir -p streaming/uncompressed/u/720p + echo 1280 > streaming/uncompressed/u/720p/wWidth + echo 720 > streaming/uncompressed/u/720p/wWidth + echo 29491200 > streaming/uncompressed/u/720p/dwMinBitRate + echo 29491200 > streaming/uncompressed/u/720p/dwMaxBitRate + echo 1843200 > streaming/uncompressed/u/720p/dwMaxVideoFrameBufferSize + echo 5000000 > streaming/uncompressed/u/720p/dwDefaultFrameInterval + echo "5000000\n" > streaming/uncompressed/u/720p/dwFrameInterval + + mkdir -p streaming/mjpeg/m/360p + echo "666666\n1000000\n5000000\n" > streaming/mjpeg/m/360p/dwFrameInterval + + mkdir -p streaming/mjpeg/m/720p + echo 1280 > streaming/mjpeg/m/720p/wWidth + echo 720 > streaming/mjpeg/m/720p/wWidth + echo 29491200 > streaming/mjpeg/m/720p/dwMinBitRate + echo 29491200 > streaming/mjpeg/m/720p/dwMaxBitRate + echo 1843200 > streaming/mjpeg/m/720p/dwMaxVideoFrameBufferSize + echo 5000000 > streaming/mjpeg/m/720p/dwDefaultFrameInterval + echo "5000000\n" > streaming/mjpeg/m/720p/dwFrameInterval + + echo 0x04 > /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/bmaControls + + mkdir -p streaming/h264/h/960p + echo 1920 > streaming/h264/h/960p/wWidth + echo 960 > streaming/h264/h/960p/wWidth + echo 40 > streaming/h264/h/960p/bLevelIDC + echo "333667\n" > streaming/h264/h/960p/dwFrameInterval + + mkdir -p streaming/h264/h/1920p + echo "333667\n" > streaming/h264/h/1920p/dwFrameInterval + + mkdir streaming/header/h + ln -s streaming/uncompressed/u streaming/header/h + ln -s streaming/mjpeg/m streaming/header/h + ln -s streaming/h264/h streaming/header/h + ln -s streaming/header/h streaming/class/fs/ + ln -s streaming/header/h streaming/class/hs/ + ln -s streaming/header/h streaming/class/ss/ +fi diff --git a/rootdir/bin/init.qti.chg_policy.sh b/rootdir/bin/init.qti.chg_policy.sh new file mode 100644 index 0000000..01ff0fd --- /dev/null +++ b/rootdir/bin/init.qti.chg_policy.sh @@ -0,0 +1,29 @@ +#! /vendor/bin/sh + +# +# Copyright (c) 2019 Qualcomm Technologies, Inc. +# All Rights Reserved. +# Confidential and Proprietary - Qualcomm Technologies, Inc. +# +# Copyright (c) 2019 The Linux Foundation. All rights reserved. +# + +export PATH=/vendor/bin + +prefix="/sys/class/" +#List of folder for ownership update +arr=( "power_supply/battery/" "power_supply/usb/" "power_supply/main/" "power_supply/charge_pump_master/" "power_supply/pc_port/" "power_supply/dc/" "power_supply/bms/" "power_supply/parallel/" "usbpd/usbpd0/" "qc-vdm/" "charge_pump/" "qcom-battery/" ) +for i in "${arr[@]}" +do + for j in `ls "$prefix""$i"` + do + #skip directories to prevent possible security issues. + if [[ -d "$prefix""$i""$j" ]] + then + continue + else + chown -h system.system "$prefix""$i""$j" + fi + done +done +setprop persist.vendor.hvdcp_opti.start 1 diff --git a/rootdir/bin/init.qti.fm.sh b/rootdir/bin/init.qti.fm.sh new file mode 100644 index 0000000..9c73685 --- /dev/null +++ b/rootdir/bin/init.qti.fm.sh @@ -0,0 +1,70 @@ +#!/vendor/bin/sh +# Copyright (c) 2019 Qualcomm Technologies, Inc. +# All Rights Reserved. +# Confidential and Proprietary - Qualcomm Technologies, Inc. +# +# Copyright (c) 2009-2011, 2015, 2017 The Linux Foundation. All rights reserved. +# + +setprop vendor.hw.fm.init 0 + +mode=`getprop vendor.hw.fm.mode` +version=199217 + +LOG_TAG="qti-fm" +LOG_NAME="${0}:" + +loge () +{ + /vendor/bin/log -t $LOG_TAG -p e "$LOG_NAME $@" +} + +logi () +{ + /vendor/bin/log -t $LOG_TAG -p i "$LOG_NAME $@" +} + +failed () +{ + loge "$1: exit code $2" + exit $2 +} + +logi "In FM shell Script" +logi "mode: $mode" +logi "Version : $version" + +#$fm_qsoc_patches +# +case $mode in + "normal") + logi "inserting the radio transport module" + echo 1 > /sys/module/radio_iris_transport/parameters/fmsmd_set + /vendor/bin/fm_qsoc_patches $version 0 + ;; + "wa_enable") + /vendor/bin/fm_qsoc_patches $version 1 + ;; + "wa_disable") + /vendor/bin/fm_qsoc_patches $version 2 + ;; + *) + logi "Shell: Default case" + /vendor/bin/fm_qsoc_patches $version 0 + ;; +esac + +exit_code_fm_qsoc_patches=$? + +case $exit_code_fm_qsoc_patches in + 0) + logi "FM QSoC calibration and firmware download succeeded" + ;; + *) + failed "FM QSoC firmware download and/or calibration failed" $exit_code_fm_qsoc_patches + ;; +esac + +setprop vendor.hw.fm.init 1 + +exit 0 diff --git a/rootdir/bin/init.qti.ims.sh b/rootdir/bin/init.qti.ims.sh new file mode 100644 index 0000000..26cd396 --- /dev/null +++ b/rootdir/bin/init.qti.ims.sh @@ -0,0 +1,57 @@ +#! /vendor/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. +# +# + +dir0=/data +trigger_file=$dir0/ims_disabled +ims_disabled=`getprop persist.vendor.ims.disabled` +target=`getprop ro.build.product` + +#if [ ! -e $trigger_file ]; then +# for future use in doing conditional debugging +#else +# +#fi +echo "$ims_disabled" +echo "$target" + +if [ "$ims_disabled" = "0" ]; then + echo "ims will be enabled" + setprop vendor.service.qti.ims.enabled 1 + exit +fi + +if [ "$ims_disabled" = "1" ] || [ "$target" = "msm8909_512" ]; then + echo "ims is disabled" + setprop vendor.service.qti.ims.enabled 0 +else + echo "ims is enabled" + setprop vendor.service.qti.ims.enabled 1 +fi diff --git a/rootdir/etc/init.msm.usb.configfs.rc b/rootdir/etc/init.msm.usb.configfs.rc new file mode 100644 index 0000000..0525890 --- /dev/null +++ b/rootdir/etc/init.msm.usb.configfs.rc @@ -0,0 +1,1416 @@ +# Copyright (c) 2016-2018, 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. +# + +# USB compositions +on property:sys.usb.config=none && property:sys.usb.configfs=1 + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + +on property:sys.usb.config=mass_storage && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "msc" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xFF20 + symlink /config/usb_gadget/g1/functions/mass_storage.0 /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=mass_storage,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mass_storage,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb_msc" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xFF28 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/mass_storage.0 /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x901D + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x900E + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,rmnet,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,serial_cdev,rmnet,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Default composition" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x9091 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f4 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,rmnet && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Default comp without ADB" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x9092 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,serial_cdev_nmea,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,serial_cdev,serial_cdev_nmea,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_dun_nmea_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x9020 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/cser.nmea.1 /config/usb_gadget/g1/configs/b.1/f4 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:vendor.usb.tethering=true + write /sys/class/net/rndis0/queues/rx-0/rps_cpus ${vendor.usb.rps_mask} + +on property:sys.usb.config=rndis + setprop sys.usb.config rndis,${persist.vendor.usb.config.extra} + +on property:sys.usb.config=rndis,none && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xFF80 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,sec && property:sys.usb.configfs=1 + write /config/usb_gadget/g2/configs/b.1/strings/0x409/configuration "rndis" + rm /config/usb_gadget/g2/configs/b.1/f1 + write /config/usb_gadget/g2/idVendor 0x05C6 + write /config/usb_gadget/g2/idProduct 0xF00E + symlink /config/usb_gadget/g2/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g2/configs/b.1/f1 + write /config/usb_gadget/g2/UDC ${persist.vendor.usb.controller.secondary} + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,adb + setprop sys.usb.config rndis,${persist.vendor.usb.config.extra},adb + +on property:sys.usb.config=rndis,none,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,none,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xFF88 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=rndis,diag && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x902C + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,diag,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,diag,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x902D + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=rndis,serial_cdev && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_dun" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90B3 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,serial_cdev,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,serial_cdev,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_dun_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90B4 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=rndis,serial_cdev,diag && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_dun_diag" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90B5 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,serial_cdev,diag,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,serial_cdev,diag,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_dun_diag" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90B6 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f4 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=mtp,diag && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_diag" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x901B + symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=mtp,diag,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,diag,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp_diag_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x903A + symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,qdss && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_qdss" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x904A + write /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name}/enable_debug_inface 1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name} /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,qdss,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,qdss,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_qdss_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x9060 + write /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name}/enable_debug_inface 1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name} /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,qdss,rmnet && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_qdss_rmnet" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x9083 + write /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name}/enable_debug_inface 1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name} /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,qdss,rmnet,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,qdss,rmnet,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_qdss_rmnet_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x9084 + write /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name}/enable_debug_inface 1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name} /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f4 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=rndis,diag,qdss && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag_qdss" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x9081 + write /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name}/enable_debug_inface 1 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=rndis,diag,qdss,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,diag,qdss,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag_qdss_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x9082 + write /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name}/enable_debug_inface 1 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f4 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=ncm && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ncm" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0xA4A1 + symlink /config/usb_gadget/g1/functions/ncm.0 /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=ncm,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ncm,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ncm_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x908C + symlink /config/usb_gadget/g1/functions/ncm.0 /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_dun" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x9004 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,adb,serial_cdev && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,adb,serial_cdev && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_adb_dun" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x901f + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,rmnet,dpl && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_dun_rmnet_dpl" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90b7 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f4 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,rmnet,dpl,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,serial_cdev,rmnet,dpl,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_dun_rmnet_dpl_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90b8 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f5 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=rndis,diag,dpl && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag_dpl" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90bf + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,diag,dpl,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,diag,dpl,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag_dpl_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90c0 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f4 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=ccid && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ccid" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90CE + symlink /config/usb_gadget/g1/functions/ccid.ccid /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=ccid,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ccid,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ccid_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90CF + symlink /config/usb_gadget/g1/functions/ccid.ccid /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=ccid,diag && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ccid_diag" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90D0 + symlink /config/usb_gadget/g1/functions/ccid.ccid /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=ccid,diag,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ccid,diag,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "ccid_diag_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90D1 + symlink /config/usb_gadget/g1/functions/ccid.ccid /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,rmnet,ccid && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_dun_rmnet_ccid" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90D2 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/ccid.ccid /config/usb_gadget/g1/configs/b.1/f4 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,rmnet,ccid,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,serial_cdev,rmnet,ccid,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_dun_rmnet_ccid_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90D3 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/ccid.ccid /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f5 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,qdss,qdss_mdm,serial_cdev,serial_cdev_mdm,rmnet && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_mdm,qdss_qdss_mdm_dun_dun_mdm_rmnet" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90D7 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/qdss.qdss_mdm /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/cser.dun.2 /config/usb_gadget/g1/configs/b.1/f6 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f7 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,qdss,qdss_mdm,serial_cdev,serial_cdev_mdm,rmnet,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,diag_mdm,qdss,qdss_mdm,serial_cdev,serial_cdev_mdm,rmnet,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_mdm,qdss_qdss_mdm_dun_dun_mdm_rmnet_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90D8 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/qdss.qdss_mdm /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/cser.dun.2 /config/usb_gadget/g1/configs/b.1/f6 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f7 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f8 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,qdss,qdss_mdm,serial_cdev,serial_cdev_mdm,dpl,rmnet && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_mdm,qdss_qdss_mdm_dun_dun_mdm_dpl_rmnet" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90DD + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/qdss.qdss_mdm /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/cser.dun.2 /config/usb_gadget/g1/configs/b.1/f6 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f7 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f8 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,qdss,qdss_mdm,serial_cdev,serial_cdev_mdm,dpl,rmnet,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,diag_mdm,qdss,qdss_mdm,serial_cdev,serial_cdev_mdm,dpl,rmnet,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_mdm,qdss_qdss_mdm_dun_dun_mdm_dpl_rmnet_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90DE + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/qdss.qdss_mdm /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/cser.dun.2 /config/usb_gadget/g1/configs/b.1/f6 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f7 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f8 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,rmnet,dpl,qdss && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_dun_rmnet_dpl_qdss" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90DC + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name} /config/usb_gadget/g1/configs/b.1/f5 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,rmnet,dpl,qdss,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,serial_cdev,rmnet,dpl,qdss,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_dun_rmnet_dpl_qdss_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90DB + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/qdss.${vendor.usb.qdss.inst.name} /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f6 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,uac2,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,uac2,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_uac2_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90CA + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/uac2.0 /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,uac2 && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_uac2" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x901C + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/uac2.0 /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,uvc,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,uvc,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_uvc_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90CB + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/uvc.0 /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,uvc && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_uvc" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90DF + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/uvc.0 /config/usb_gadget/g1/configs/b.1/f2 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,uac2,uvc,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,uac2,uvc,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_uac2_uvc_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90CC + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/uac2.0 /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/uvc.0 /config/usb_gadget/g1/configs/b.1/f4 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,uac2,uvc && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_uac2_uvc" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90E0 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/uac2.0 /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/uvc.0 /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,diag_mdm,qdss,qdss_mdm,serial_cdev,dpl,rmnet && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_mdm_qdss_qdss_mdm_dun_dpl_rmnet" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90E4 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/qdss.qdss_mdm /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f6 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f7 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,qdss,qdss_mdm,serial_cdev,dpl,rmnet,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,diag_mdm,qdss,qdss_mdm,serial_cdev,dpl,rmnet,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_mdm_qdss_qdss_mdm_dun_dpl_rmnet_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90E5 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/qdss.qdss_mdm /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f6 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f7 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f8 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,diag,diag_mdm,qdss,qdss_mdm,serial_cdev,dpl && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag_diag_mdm_qdss_qdss_mdm_dun_dpl" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90E6 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/qdss.qdss_mdm /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f6 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f7 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,diag,diag_mdm,qdss,qdss_mdm,serial_cdev,dpl,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,diag,diag_mdm,qdss,qdss_mdm,serial_cdev,dpl,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag_diag_mdm_qdss_qdss_mdm_dun_dpl_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90E7 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/qdss.qdss_mdm /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f6 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f7 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f8 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=diag,diag_mdm,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,diag_mdm,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_mdm_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90D9 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,diag_mdm,diag_mdm2,qdss,qdss_mdm,serial_cdev,dpl,rmnet && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_mdm_diag_mdm2_qdss_qdss_mdm_dun_dpl_rmnet" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90F6 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm2 /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/qdss.qdss_mdm /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f6 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f7 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f8 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,diag_mdm2,qdss,qdss_mdm,serial_cdev,dpl,rmnet,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,diag_mdm,diag_mdm2,qdss,qdss_mdm,serial_cdev,dpl,rmnet,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_mdm_diag_mdm2_qdss_qdss_mdm_dun_dpl_rmnet_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90F7 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm2 /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/qdss.qdss_mdm /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f6 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f7 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.rmnet.inst.name} /config/usb_gadget/g1/configs/b.1/f8 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,diag,diag_mdm,diag_mdm2,qdss,qdss_mdm,serial_cdev,dpl && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag_diag_mdm_diag_mdm2_qdss_qdss_mdm_dun_dpl" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90F8 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm2 /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/qdss.qdss_mdm /config/usb_gadget/g1/configs/b.1/f6 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f7 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f8 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,diag,diag_mdm,diag_mdm2,qdss,qdss_mdm,serial_cdev,dpl,adb && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,diag,diag_mdm,diag_mdm2,qdss,qdss_mdm,serial_cdev,dpl,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis_diag_diag_mdm_diag_mdm2_qdss_qdss_mdm_dun_dpl_adb" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x90F9 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rndis.func.name}.rndis /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm2 /config/usb_gadget/g1/configs/b.1/f4 + symlink /config/usb_gadget/g1/functions/qdss.qdss /config/usb_gadget/g1/configs/b.1/f5 + symlink /config/usb_gadget/g1/functions/qdss.qdss_mdm /config/usb_gadget/g1/configs/b.1/f6 + symlink /config/usb_gadget/g1/functions/cser.dun.0 /config/usb_gadget/g1/configs/b.1/f7 + symlink /config/usb_gadget/g1/functions/${vendor.usb.rmnet.func.name}.${vendor.usb.dpl.inst.name} /config/usb_gadget/g1/configs/b.1/f8 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=diag,diag_mdm,ccid && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_mdm_ccid" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x9045 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/ccid.ccid /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,adb,ccid && property:sys.usb.configfs=1 + start adbd + +on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,diag_mdm,adb,ccid && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_mdm_adb_ccid" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + rm /config/usb_gadget/g1/configs/b.1/f4 + rm /config/usb_gadget/g1/configs/b.1/f5 + rm /config/usb_gadget/g1/configs/b.1/f6 + rm /config/usb_gadget/g1/configs/b.1/f7 + rm /config/usb_gadget/g1/configs/b.1/f8 + rm /config/usb_gadget/g1/configs/b.1/f9 + write /config/usb_gadget/g1/idVendor 0x05C6 + write /config/usb_gadget/g1/idProduct 0x9044 + symlink /config/usb_gadget/g1/functions/diag.diag /config/usb_gadget/g1/configs/b.1/f1 + symlink /config/usb_gadget/g1/functions/diag.diag_mdm /config/usb_gadget/g1/configs/b.1/f2 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3 + symlink /config/usb_gadget/g1/functions/ccid.ccid /config/usb_gadget/g1/configs/b.1/f4 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xFF08 + +on property:sys.usb.config=mtp && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xFF40 + +on property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xFF48 + +on property:sys.usb.config=ptp && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xFF10 + +on property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x2717 + write /config/usb_gadget/g1/idProduct 0xFF18 + +on property:sys.usb.config=accessory && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x2d00 + +on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x2d01 + +on property:sys.usb.config=audio_source && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x2d02 + +on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x2d03 + +on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x2d04 + +on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x2d05 + +on property:sys.usb.config=midi && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x4ee8 + +on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0x4ee9 + +on property:vendor.usb.eud=1 + write /config/usb_gadget/g1/configs/b.1/MaxPower 1 + write /sys/module/eud/parameters/enable 1 + write /sys/kernel/debug/pmic-votable/USB_ICL/force_active 1 + write /sys/kernel/debug/pmic-votable/USB_ICL/force_val 500 + +on property:vendor.usb.eud=0 + write /sys/kernel/debug/pmic-votable/USB_ICL/force_active 0 + write /sys/kernel/debug/pmic-votable/USB_ICL/force_val 0 + write /config/usb_gadget/g1/configs/b.1/MaxPower 0 + write /sys/module/eud/parameters/enable 0 diff --git a/rootdir/etc/init.qcom.factory.rc b/rootdir/etc/init.qcom.factory.rc new file mode 100644 index 0000000..6c490e4 --- /dev/null +++ b/rootdir/etc/init.qcom.factory.rc @@ -0,0 +1,255 @@ +# +# Copyright (c) 2009-2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of The Linux Foundation nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +# Define fastmmi +service fastmmi /system/bin/mmi + user root + group root + disabled + +service vendor.mmid /vendor/bin/mmid + user root + group root + disabled + +service mmi_diag /system/bin/mmi_diag + class main + user root + group root oem_2901 + disabled + +on property:vendor.sys.boot_mode=ffbm + write ${persist.vendor.mmi.misc_dev_path} "ffbm-01" + +on property:vendor.sys.boot_mode=qmmi + write ${persist.vendor.mmi.misc_dev_path} "ffbm-02" + +on property:vendor.sys.boot_mode=normal + write ${persist.vendor.mmi.misc_dev_path} "normal" + +# Creating a scratch storage on /data for factory testing. +on factory-fs && property:ro.bootmode=ffbm-00 + mount tmpfs tmpfs /data + +on factory-fs && property:ro.bootmode=ffbm-01 + mount tmpfs tmpfs /data + +# aligned the usb port with system standard, otherwise if only diag be added +# Then in QMMI mode, the whole Andoid be booted, but due to the ro.bootmode is +# not normal/unknow, then when it apply the default funcs, it will turn to MTP +# which cause the diag/Wwan/modem port all be lost in qmmi mode. Details: +# UsbDeviceManager.java---->getDefaultFunctions and trySetEnabledFunctions +on property:persist.vendor.usb.config=* + setprop persist.sys.usb.ffbm-02.func ${persist.vendor.usb.config} + +on mmi && property:ro.bootmode=ffbm-00 + # ======================================================== + # This is FFBM only settings. + # ======================================================== + #mkdir for factory data files. + mkdir /mnt/vendor/persist/FTM_AP 0750 system system + + start fastmmi + # start qcom-post-boot to set the misc partition path property value + start qcom-post-boot + start mmi_diag + +on mmi && property:ro.bootmode=ffbm-01 + # ======================================================== + # This is FFBM only settings. + # ======================================================== + #mkdir for factory data files. + mkdir /mnt/vendor/persist/FTM_AP 0750 system system + + start fastmmi + ## start qcom-post-boot to set the misc partition path property value + start qcom-post-boot + start mmi_diag + +on property:persist.vendor.usb.config=* && property:ro.bootmode=ffbm-00 + setprop sys.usb.config ${persist.vendor.usb.config} + +on property:persist.vendor.usb.config=* && property:ro.bootmode=ffbm-01 + setprop sys.usb.config ${persist.vendor.usb.config} + +on property:persist.vendor.usb.config=* && property:ro.bootmode=ffbm-02 + setprop sys.usb.config ${persist.vendor.usb.config} + +on ffbm + trigger early-fs + trigger factory-fs + trigger fs + trigger post-fs + + # Mount fstab in init.{$device}.rc by mount_all with '--late' parameter + # to only mount entries with 'latemount'. This is needed if '--early' is + # specified in the previous mount_all command on the fs stage. + # With /system mounted and properties form /system + /factory available, + # some services can be started. + trigger late-fs + + # Now we can mount /data. File encryption requires keymaster to decrypt + # /data, which in turn can only be loaded when system properties are present. + trigger post-fs-data + + # Now we can start zygote for devices with file based encryption + trigger zygote-start + + # Load persist properties and override properties (if enabled) from /data. + trigger load_persist_props_action + + # Remove a file to wake up anything waiting for firmware. + trigger firmware_mounts_complete + + trigger early-boot + trigger boot + trigger mmi + + +# ======================================================== +# Start for audio TC +# ======================================================== + +service vendor.audio_tc53 /vendor/bin/mm-audio-ftm -tc 53 + user audio + group audio + disabled + oneshot + + +service vendor.audio_tc51 /vendor/bin/mm-audio-ftm -tc 51 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc56 /vendor/bin/mm-audio-ftm -tc 56 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc222 /vendor/bin/mm-audio-ftm -tc 222 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc228 /vendor/bin/mm-audio-ftm -tc 228 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc229 /vendor/bin/mm-audio-ftm -tc 229 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc230 /vendor/bin/mm-audio-ftm -tc 230 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc225 /vendor/bin/mm-audio-ftm -tc 225 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc246 /vendor/bin/mm-audio-ftm -tc 246 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc247 /vendor/bin/mm-audio-ftm -tc 247 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc250 /vendor/bin/mm-audio-ftm -tc 250 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc251 /vendor/bin/mm-audio-ftm -tc 251 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc252 /vendor/bin/mm-audio-ftm -tc 252 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc253 /vendor/bin/mm-audio-ftm -tc 253 + user audio + group audio + disabled + oneshot + +service vendor.audio_tc11 /vendor/bin/mm-audio-ftm -tc 11 -file /data/vendor/audio/ftm_headset_mic_record.wav + user audio + group audio + disabled + oneshot + +service vendor.audio_tc101 /vendor/bin/mm-audio-ftm -tc 101 -file /data/vendor/audio/ftm_mic1_record.wav + user audio + group audio + disabled + oneshot + +service vendor.audio_tc102 /vendor/bin/mm-audio-ftm -tc 102 -file /data/vendor/audio/ftm_mic2_record.wav + user audio + group audio + disabled + oneshot + +service vendor.audio_tc103 /vendor/bin/mm-audio-ftm -tc 103 -file /data/vendor/audio/ftm_mic3_record.wav + user audio + group audio + disabled + oneshot + +service vendor.audio_tc104 /vendor/bin/mm-audio-ftm -tc 104 -file /data/vendor/audio/ftm_mic4_record.wav + user audio + group audio + disabled + oneshot + +# ======================================================== +# End for audio TC +# ======================================================== diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc new file mode 100644 index 0000000..51e99b8 --- /dev/null +++ b/rootdir/etc/init.qcom.rc @@ -0,0 +1,1164 @@ +# Copyright (c) 2009-2012, 2014-2019, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of The Linux Foundation nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +import /vendor/etc/init/hw/init.qcom.usb.rc +import /vendor/etc/init/hw/init.msm.usb.configfs.rc +import /vendor/etc/init/hw/init.target.rc +import /vendor/etc/init/hw/init.qcom.factory.rc +import /vendor/etc/init/hw/init.qcom.test.rc + +on early-init + mount debugfs debugfs /sys/kernel/debug + chmod 0755 /sys/kernel/debug + + # create symlink for vendor mount points + symlink /vendor/firmware_mnt /firmware + symlink /vendor/bt_firmware /bt_firmware + symlink /vendor/dsp /dsp + + # Change ownership of hw_recovery related nodes + chown system graphics /sys/kernel/debug/dri/0/debug/dump + chown system graphics /sys/kernel/debug/dri/0/debug/recovery_reg + chown system graphics /sys/kernel/debug/dri/0/debug/recovery_dbgbus + chown system graphics /sys/kernel/debug/dri/0/debug/recovery_vbif_dbgbus + + # Change ownership of sw_sync node + chown system graphics /sys/kernel/debug/sync/sw_sync + chmod 0666 /sys/kernel/debug/sync/sw_sync + + chown root system /dev/kmsg + chmod 0620 /dev/kmsg + # Load WIGIG platform driver + exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -a -d /vendor/lib/modules msm_11ad_proxy + +on init + + # Support legacy paths + symlink /sdcard /mnt/sdcard + symlink /sdcard /storage/sdcard0 + + # Create cgroup mount point for memory + mkdir /sys/fs/cgroup/memory/bg 0750 root system + write /sys/fs/cgroup/memory/bg/memory.swappiness 140 + write /sys/fs/cgroup/memory/bg/memory.move_charge_at_immigrate 1 + chown root system /sys/fs/cgroup/memory/bg/tasks + chmod 0660 /sys/fs/cgroup/memory/bg/tasks + +on post-fs + chmod 0755 /sys/kernel/debug/tracing + chmod 0660 /sys/class/leds/red/brightness + chown system system /sys/class/leds/red/brightness + +on early-boot + # set RLIMIT_MEMLOCK to 64MB + setrlimit 8 67108864 67108864 + # Allow subsystem (modem etc) debugging + write /sys/kernel/debug/bootkpi/kpi_values "M - Start adsp" + write /sys/kernel/boot_adsp/boot 1 + write /sys/kernel/boot_cdsp/boot 1 + write /sys/devices/virtual/npu/msm_npu/boot 1 + write /sys/kernel/boot_slpi/boot 1 + write /sys/devices/virtual/cvp/cvp/boot 1 + exec u:r:qti_init_shell:s0 -- /vendor/bin/init.qcom.early_boot.sh + exec u:r:qti_init_shell:s0 -- /vendor/bin/init.qti.can.sh + + # for backward compatibility + chown system system /persist/sensors + chown system system /persist/sensors/registry + chown system system /persist/sensors/registry/registry + chown system system /persist/sensors/registry/registry/sensors_registry + chown system system /persist/sensors/sensors_settings + chown system system /persist/sensors/registry/config + chmod 0664 /persist/sensors/sensors_settings + + chown system system /mnt/vendor/persist/sensors + chown system system /mnt/vendor/persist/sensors/sns.reg + chown system system /mnt/vendor/persist/sensors/sensors_list.txt + chown system system /mnt/vendor/persist/sensors/registry + chown system system /mnt/vendor/persist/sensors/registry/registry + chown system system /mnt/vendor/persist/sensors/registry/registry/sensors_registry + chown system system /mnt/vendor/persist/sensors/sensors_settings + chown system system /mnt/vendor/persist/sensors/registry/sns_reg_config + chown system system /mnt/vendor/persist/sensors/registry/sns_reg_version + chown system system /mnt/vendor/persist/sensors/registry/config + chmod 0664 /mnt/vendor/persist/sensors/sensors_settings + + chown system system /mnt/vendor/persist/data/pfm/licenses + chmod 0775 /mnt/vendor/persist/data/pfm/licenses + +on boot + chown bluetooth bluetooth /sys/module/bluetooth_power/parameters/power + chown bluetooth net_bt /sys/class/rfkill/rfkill0/type + chown bluetooth net_bt /sys/class/rfkill/rfkill0/state + chown bluetooth bluetooth /proc/bluetooth/sleep/proto + chown bluetooth bluetooth /sys/module/hci_uart/parameters/ath_lpm + chown bluetooth bluetooth /sys/module/hci_uart/parameters/ath_btwrite + chown system system /sys/module/sco/parameters/disable_esco + chown bluetooth bluetooth /sys/module/hci_smd/parameters/hcismd_set + chown system system /sys/module/msm_core/parameters/polling_interval + chown system system /sys/module/msm_core/parameters/disabled + chown system system /sys/kernel/debug/msm_core/enable + chown system system /sys/kernel/debug/msm_core/ptable + chown system system /sys/kernel/boot_slpi/ssr + chown system system /sys/module/radio_iris_transport/parameters/fmsmd_set + chmod 0660 /sys/module/bluetooth_power/parameters/power + chmod 0660 /sys/module/hci_smd/parameters/hcismd_set + chmod 0660 /sys/module/radio_iris_transport/parameters/fmsmd_set + chmod 0660 /sys/class/rfkill/rfkill0/state + chmod 0660 /proc/bluetooth/sleep/proto + chown bluetooth net_bt /dev/ttyHS0 + chmod 0660 /sys/module/hci_uart/parameters/ath_lpm + chmod 0660 /sys/module/hci_uart/parameters/ath_btwrite + chmod 0660 /dev/ttyHS0 + chown bluetooth bluetooth /sys/devices/platform/msm_serial_hs.0/clock + chmod 0660 /sys/devices/platform/msm_serial_hs.0/clock + + chmod 0660 /dev/ttyHS2 + chown bluetooth bluetooth /dev/ttyHS2 + + chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo + chmod 0660 /sys/class/rfkill/rfkill0/device/extldo + #define back flash and front flash + chmod 0660 /sys/class/leds/led:flash_0/brightness + chmod 0660 /sys/class/leds/led:flash_1/brightness + chmod 0660 /sys/class/leds/led:flash_2/brightness + chmod 0660 /sys/class/leds/led:torch_0/brightness + chmod 0660 /sys/class/leds/led:torch_1/brightness + chmod 0660 /sys/class/leds/led:torch_2/brightness + chmod 0660 /sys/class/leds/led:switch_0/brightness + chmod 0660 /sys/class/leds/led:switch_1/brightness + chmod 0660 /sys/class/leds/flashlight/brightness + chmod 0777 /sys/class/ant_class/ant_state + chmod 0777 /sys/class/ant_div_class/ant_div_state + chown system system /sys/class/leds/led:flash_0/brightness + chown system system /sys/class/leds/led:flash_1/brightness + chown system system /sys/class/leds/led:flash_2/brightness + chown system system /sys/class/leds/led:torch_0/brightness + chown system system /sys/class/leds/led:torch_1/brightness + chown system system /sys/class/leds/led:torch_2/brightness + chown system system /sys/class/leds/led:switch_0/brightness + chown system system /sys/class/leds/led:switch_1/brightness + chown system system /sys/class/leds/flashlight/brightness + chown system system /sys/class/ant_class/ant_state + chown system system /sys/class/ant_div_class/ant_div_state + # This location is used by QCRIL to host UNIX domain + # socket files used for internal IPC within QCRIL + # modules + mkdir /dev/socket/qmux_radio 0770 radio radio + chmod 2770 /dev/socket/qmux_radio + + mkdir /persist/drm 0770 system system + mkdir /persist/bluetooth 0770 bluetooth bluetooth + mkdir /persist/misc 0770 system system + mkdir /persist/alarm 0770 system system + mkdir /mnt/vendor/persist/time 0770 system system + mkdir /mnt/vendor/persist/secnvm 0770 system system + mkdir /mnt/vendor/persist/iar_db 0770 system system + mkdir /mnt/vendor/spunvm 0770 system system + + #Create WIGIG socket area + mkdir /dev/socket/wigig 0770 wifi wifi + + setprop wifi.interface wlan0 + + setprop persist.bluetooth.a2dp_offload.disabled false + + setprop ro.telephony.call_ring.multiple false + + #enable camera read sensors data + setprop persist.camera.gyro.disable 0 + + #Remove SUID bit for iproute2 ip tool + chmod 0755 /system/bin/ip + + + chmod 0444 /sys/devices/platform/msm_hsusb/gadget/usb_state + + setprop net.tcp.2g_init_rwnd 10 + + # To prevent out of order acknowledgements from making + # connection tracking to treat them as not belonging to + # the connection they belong to. + # Otherwise, a weird issue happens in which some long + # connections on high-throughput links get dropped when + # an ack packet comes out of order + write /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal 1 + + # Set the console loglevel to < KERN_INFO + # Set the default message loglevel to KERN_INFO + write /proc/sys/kernel/printk "6 6 1 7" + + # Allow access for CCID command/response timeout configuration + chown system system /sys/module/ccid_bridge/parameters/bulk_msg_timeout + + # bond0 used by FST Manager + chown wifi wifi /sys/class/net/bond0/bonding/queue_id + + # Allow access to emmc rawdump block partition and dload sysfs node + chown root system /dev/block/bootdevice/by-name/rawdump + chmod 0660 /dev/block/bootdevice/by-name/rawdump + chown root system /sys/kernel/dload/emmc_dload + chmod 0660 /sys/kernel/dload/emmc_dload + chown root system /dev/block/bootdevice/by-name/ramdump + chmod 0660 /dev/block/bootdevice/by-name/ramdump + chown root system /sys/kernel/dload/dload_mode + chmod 0660 /sys/kernel/dload/dload_mode + + chown system system /sys/class/backlight/panel0-backlight/brightness + chown system system /sys/class/backlight/panel0-backlight/max_brightness + chown system system /sys/class/backlight/panel1-backlight/brightness + chown system system /sys/class/backlight/panel1-backlight/max_brightness + + # Allow access to sensors device attributes + chown system system /sys/class/sensors/MPU6050-accel/enable + chown system system /sys/class/sensors/MPU6050-accel/poll_delay + chown system system /sys/class/sensors/MPU6050-gyro/enable + chown system system /sys/class/sensors/MPU6050-gyro/poll_delay + chown system system /sys/class/sensors/apds9930-light/enable + chown system system /sys/class/sensors/apds9930-light/poll_delay + chown system system /sys/class/sensors/apds9930-proximity/enable + chown system system /sys/class/sensors/apds9930-proximity/poll_delay + + # Create directory used for display + # for backward compatibility + mkdir /persist/display 0770 system graphics + mkdir /mnt/vendor/persist/display 0770 system graphics + + # Create vpp directory + mkdir /mnt/vendor/persist/vpp 0770 media media + + + # Create hvdcp_opti directory + mkdir /mnt/vendor/persist/hvdcp_opti 0770 root system + + # Create pa-cal driver directory lct-20181009 + mkdir /mnt/vendor/persist/audio 0770 audio audio + + #Create camera directory + mkdir /mnt/vendor/persist/camera 0755 system cameraserver + + #sensors log dir + mkdir /data/vendor/sensors + chown system system /data/vendor/sensors + +# msm specific files that need to be created on /data +on post-fs-data + mkdir /data/vendor/misc 01771 system system + + # Create directory used for dump collection + mkdir /data/vendor/ssrdump 0770 root system + + # Create directory used by display clients + mkdir /data/vendor/display 0770 system graphics + + # Change lm related dirs + mkdir /data/vendor/lm 0700 root root + + # Create directory used by media clients + mkdir /data/vendor/media 0770 mediacodec media + + # Create /data/vendor/tzstorage directory for SFS listener + mkdir /data/vendor/tzstorage 0770 system system + + # Create directory for apps access via QTEEConnector + mkdir /data/vendor/qtee 0770 system system + + #Create folder of camera + mkdir /data/vendor/camera 0770 camera camera + + + #Create directory for tftp + mkdir /data/vendor/tombstones 0771 system system + mkdir /data/vendor/tombstones/rfs 0771 system system + + mkdir /data/vendor/ramdump 0771 root system + mkdir /data/vendor/bluetooth 0770 bluetooth bluetooth + mkdir /data/vendor/ramdump/bluetooth 0770 bluetooth bluetooth + + # Create the directories used by the Wireless subsystem + mkdir /data/vendor/wifi 0770 wifi wifi + mkdir /data/vendor/wifi/sockets 0770 wifi wifi + mkdir /data/vendor/wifi/hostapd 0770 wifi wifi + mkdir /data/vendor/wifi/hostapd/ctrl 0770 wifi wifi + mkdir /data/vendor/wifi/wpa_supplicant 0770 wifi wifi + mkdir /data/vendor/wifi/wigig_hostapd 0770 wifi wifi + mkdir /data/vendor/wifi/wpa 0770 wifi wifi + mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi + + # Create the directories used by WiGig Sensing + mkdir /data/vendor/sensing 0770 system wifi + + # Create the directories used by CnE subsystem + mkdir /data/vendor/connectivity 0771 radio radio + chown radio radio /data/vendor/connectivity + + # Create directory used by audio subsystem + mkdir /data/vendor/audio 0770 audio audio + + # Create directory used by audio cit + mkdir /data/vendor/cit 0770 system system + + # Create directory for audio delta files + mkdir /data/vendor/audio/acdbdata 0770 media audio + mkdir /data/vendor/audio/acdbdata/delta 0770 media audio + + # Create directory for radio + mkdir /data/vendor/radio 0770 system radio + rm /data/vendor/radio/shmbus + + # Create directory for modem_config + mkdir /data/vendor/modem_config 0570 radio root + + # Mounting of persist is moved to 'on emmc-fs' and 'on fs' sections + # We chown/chmod /persist again so because mount is run as root + defaults + chown root system /persist + chmod 0771 /persist + chown system system /persist/WCNSS_qcom_wlan_nv.bin + chmod 0664 /sys/devices/platform/msm_sdcc.1/polling + chmod 0664 /sys/devices/platform/msm_sdcc.2/polling + chmod 0664 /sys/devices/platform/msm_sdcc.3/polling + chmod 0664 /sys/devices/platform/msm_sdcc.4/polling + + # Chown polling nodes as needed from UI running on system server + chown system system /sys/devices/platform/msm_sdcc.1/polling + chown system system /sys/devices/platform/msm_sdcc.2/polling + chown system system /sys/devices/platform/msm_sdcc.3/polling + chown system system /sys/devices/platform/msm_sdcc.4/polling + + #Create the symlink to qcn wpa_supplicant folder for ar6000 wpa_supplicant + mkdir /data/system 0775 system system + #symlink /data/misc/wifi/wpa_supplicant /data/system/wpa_supplicant + + #Create directories for Location services + mkdir /data/vendor/location 0770 gps gps + mkdir /data/vendor/location/mq 0770 gps gps + mkdir /data/vendor/location/xtwifi 0770 gps gps + mkdir /dev/socket/location 0770 gps gps + mkdir /dev/socket/location/mq 0770 gps gps + mkdir /dev/socket/location/xtra 0770 gps gps + + #Create directories for wifihal services + mkdir /dev/socket/wifihal 0770 wifi wifi + chmod 2770 /dev/socket/wifihal + + #Create directory for FOTA + mkdir /data/fota 0771 + chown system system /data/fota + + #Create directory for hostapd + mkdir /data/hostapd 0770 system wifi + + # Create /data/time folder for time-services + mkdir /data/vendor/time/ 0700 system system + + setprop vold.post_fs_data_done 1 + + #Create a folder for SRS to be able to create a usercfg file + #mkdir /data/data/media 0770 media media + + #Create FM dir for patchdownloader + mkdir /data/vendor/fm 0770 system system + chmod 0770 /data/vendor/fm + + #Create PERFD deamon related dirs + mkdir /data/vendor/perfd 0770 root system + chmod 2770 /data/vendor/perfd + rm /data/vendor/perfd/default_values + + mkdir /data/vendor/secure_element 0777 system system + + #Create IOP deamon related dirs + mkdir /data/vendor/iop 0700 root system + + # Mark the copy complete flag to not completed + write /data/vendor/radio/copy_complete 0 + chown radio radio /data/vendor/radio/copy_complete + chmod 0660 /data/vendor/radio/copy_complete + + # copy prebuilt qcril.db files always + copy /vendor/radio/qcril_database/qcril.db /data/vendor/radio/qcril_prebuilt.db + chown radio radio /data/vendor/radio/qcril_prebuilt.db + chmod 0660 /data/vendor/radio/qcril_prebuilt.db + # File flags for prebuilt ril db file + write /data/vendor/radio/prebuilt_db_support 1 + chown radio radio /data/vendor/radio/prebuilt_db_support + chmod 0400 /data/vendor/radio/prebuilt_db_support + write /data/vendor/radio/db_check_done 0 + chown radio radio /data/vendor/radio/db_check_done + chmod 0660 /data/vendor/radio/db_check_done + + # qti-logkit data + mkdir /data/vendor/qti-logkit/ 0771 system system + mkdir /data/vendor/qti-logkit/shared-privileged/ 2770 system system + mkdir /data/vendor/qti-logkit/shared-public/ 2770 system diag + mkdir /data/vendor/qti-logkit/socket-privileged/ 2770 system system + mkdir /data/vendor/qti-logkit/socket-public/ 2750 system diag + mkdir /data/vendor/qti-logkit/logdata/ 2750 system shell + + #Create SWAP related dirs + mkdir /data/vendor/swap 0770 root system + chmod 2770 /data/vendor/swap + + # set aggressive read ahead for dm-0 and dm-1 during boot up + write /sys/block/dm-0/queue/read_ahead_kb 2048 + write /sys/block/dm-1/queue/read_ahead_kb 2048 + write /sys/block/dm-2/queue/read_ahead_kb 2048 + + # Create vpp directory + mkdir /data/vendor/vpp 0770 media media + + #Create dir for TUI + mkdir /data/vendor/tui 0700 system drmrpc + + #Start move time data to /data/vendor once post-fs-data done + start vendor.move_time_data + +service nqnfcinfo /system/vendor/bin/nqnfcinfo + class late_start + group nfc + user system + oneshot + +service iop /system/vendor/bin/iop + class main + user root + group root + disabled + socket iop seqpacket 0666 root system + +service qcomsysd /system/vendor/bin/qcom-system-daemon + class main + user root + group root diag oem_2901 + disabled + +on property:persist.vendor.qcomsysd.enabled=1 + enable qcomsysd + +on property:persist.vendor.qcomsysd.enabled=0 + stop qcomsysd + +service vendor.ssr_setup /system/vendor/bin/ssr_setup + oneshot + disabled + +service vendor.ss_ramdump /system/vendor/bin/subsystem_ramdump + class main + user system + group system + disabled + +on property:ro.vendor.iocgrp.config=1 + mkdir /dev/blkio + mount cgroup none /dev/blkio blkio + chown system system /dev/blkio + chown system system /dev/blkio/tasks + chmod 0664 /dev/blkio/tasks + mkdir /dev/blkio/bg 0755 system system + chown system system /dev/blkio/bg/tasks + chmod 0664 /dev/blkio/bg/tasks + write /dev/blkio/blkio.weight 1000 + write /dev/blkio/bg/blkio.weight 100 + +on property:persist.sys.ssr.enable_debug=* + write /sys/module/subsystem_restart/parameters/enable_debug ${persist.sys.ssr.enable_debug} + +on property:persist.sys.mba_boot_timeout=* + write /sys/module/pil_msa/parameters/pbl_mba_boot_timeout_ms ${persist.sys.mba_boot_timeout} + +on property:persist.sys.modem_auth_timeout=* + write /sys/module/pil_msa/parameters/modem_auth_timeout_ms ${persist.sys.modem_auth_timeout} + +on property:persist.sys.pil_proxy_timeout=* + write /sys/module/peripheral_loader/parameters/proxy_timeout_ms ${persist.sys.pil_proxy_timeout} + +on property:persist.vendor.ssr.restart_level=* + start vendor.ssr_setup + +on property:persist.vendor.ssr.enable_ramdumps=1 + write /sys/module/subsystem_restart/parameters/enable_ramdumps 1 + mkdir /data/vendor/ramdump_ssr 770 system system + start vendor.ss_ramdump + +on property:persist.vendor.ssr.enable_ramdumps=0 + write /sys/module/subsystem_restart/parameters/enable_ramdumps 0 + +on property:persist.vendor.sys.rawdump_copy=1 + write /sys/kernel/dload/emmc_dload 1 + +on property:persist.vendor.sys.rawdump_copy=0 + write /sys/kernel/dload/emmc_dload 0 + +on property:sys.boot_completed=1 + write /dev/kmsg "Boot completed " + #Reset read ahead for dm-0, dm-1 and dm-2 to 512kb + write /sys/block/dm-0/queue/read_ahead_kb 512 + write /sys/block/dm-1/queue/read_ahead_kb 512 + write /sys/block/dm-2/queue/read_ahead_kb 512 + #WDSP FW boot sysfs node used by STHAL + chown media audio /sys/kernel/wdsp0/boot + chown media audio /sys/kernel/wcd_cpe0/fw_name + +on property:persist.vendor.radio.atfwd.start=false + stop vendor.atfwd + +on property:vendor.radio.atfwd.start=false + stop vendor.atfwd + +# corefile limit +on property:persist.debug.trace=1 + mkdir /data/core 0777 root root + write /proc/sys/kernel/core_pattern "/data/core/%E.%p.%e" + +on property:init.svc.wpa_supplicant=stopped + stop dhcpcd + +on property:vendor.bluetooth.dun.status=running + start vendor.bt-dun + +on property:vendor.bluetooth.dun.status=stopped + stop vendor.bt-dun + +on property:ro.bluetooth.ftm_enabled=true + start ftmd + +on property:vendor.bluetooth.startbtlogger=true + start vendor.bt_logger + +on property:vendor.bluetooth.startbtlogger=false + stop vendor.bt_logger + +on property:vendor.media.target.version=* + setprop vendor.sys.media.target.version ${vendor.media.target.version} + +service qcom-c_core-sh /vendor/bin/init.qcom.class_core.sh + class core + user root + oneshot + +service qcom-c_main-sh /vendor/bin/init.class_main.sh + class main + user root + group root system + oneshot + +on property:vold.decrypt=trigger_restart_framework + start qcom-c_main-sh + start wcnss-service + +on property:persist.env.fastdorm.enabled=true + setprop persist.radio.data_no_toggle 1 + +service vendor.qrtr-ns /vendor/bin/qrtr-ns -f + class core + user vendor_qrtr + group vendor_qrtr + capabilities NET_BIND_SERVICE + +service irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config" + class core + user root + oneshot + +service vendor.bt-dun /system/bin/dun-server /dev/smd7 /dev/rfcomm0 + class late_start + user bluetooth + group bluetooth net_bt_admin inet + disabled + oneshot + +service vendor.bt_logger /system/bin/bt_logger + user bluetooth + group bluetooth net_bt_admin sdcard_rw sdcard_r media_rw + class late_start + disabled + oneshot + +service ftmd /system/bin/logwrapper /system/bin/ftmdaemon + class late_start + user root + group bluetooth net_bt_admin misc diag net_bt + disabled + oneshot + +service qmiproxy /system/bin/qmiproxy + class main + user radio + group radio diag + disabled + +service vendor.sensors /vendor/bin/sscrpcd sensorspd + class early_hal + user system + group system wakelock + capabilities BLOCK_SUSPEND + +service vendor.sensors.qti /vendor/bin/sensors.qti + class core + user system + group system + disabled + +# Adjust socket buffer to enlarge TCP receive window for high bandwidth +# but only if ro.data.large_tcp_window_size property is set. +on property:ro.data.large_tcp_window_size=true + write /proc/sys/net/ipv4/tcp_adv_win_scale 2 + +on property:sys.sysctl.tcp_adv_win_scale=* + write /proc/sys/net/ipv4/tcp_adv_win_scale ${sys.sysctl.tcp_adv_win_scale} + +service wpa_supplicant /vendor/bin/hw/wpa_supplicant \ + -O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1 -dd \ + -g@android:vendor_wpa_wlan0 +# we will start as root and wpa_supplicant will switch to user wifi +# after setting up the capabilities required for WEXT +# user wifi +# group wifi inet keystore + interface android.hardware.wifi.supplicant@1.0::ISupplicant default + interface android.hardware.wifi.supplicant@1.1::ISupplicant default + class main + socket vendor_wpa_wlan0 dgram 660 wifi wifi + disabled + oneshot + +service vendor.wigig_supplicant /vendor/bin/hw/wpa_supplicant \ + -iwigig0 -Dnl80211 -c/data/vendor/wifi/wigig_supplicant.conf \ + -m/data/vendor/wifi/wigig_p2p_supplicant.conf \ + -O/data/vendor/wifi/wigig_sockets -dd \ + -e/data/vendor/wifi/wigig_entropy.bin -g@android:wigig/wpa_wigig0 \ + -S wigigsvc + # we will start as root and wpa_supplicant will switch to user wifi + # after setting up the capabilities required for WEXT + # user wifi + # group wifi inet keystore + class main + socket wigig/wpa_wigig0 dgram 660 wifi wifi + disabled + oneshot + +# Data Migration +service vendor.move_wifi_data /system/bin/move_wifi_data.sh + class main + user wifi + group wifi + disabled + oneshot + +service wigignpt /vendor/bin/wigignpt + interface vendor.qti.hardware.wigig.netperftuner@1.0::INetPerfTuner default + class hal + socket wigig/wigignpt stream 660 system wifi + user system + group wifi + capabilities NET_ADMIN + disabled + +on property:persist.vendor.wigig.npt.enable=1 + start wigignpt + +service vendor.sensingdaemon /vendor/bin/sensingdaemon + class hal + socket wigig/sensingdaemon stream 660 system wifi + user system + group wifi + disabled + +service dhcpcd_wlan0 /system/bin/dhcpcd -ABKLG + class late_start + disabled + oneshot + +service dhcpcd_bond0 /system/bin/dhcpcd -ABKLG + class late_start + disabled + oneshot + +service dhcpcd_p2p /system/bin/dhcpcd -ABKLG + class late_start + disabled + oneshot + +service dhcpcd_wigig0 /system/bin/dhcpcd -ABKLG + class late_start + disabled + oneshot + +service iprenew_wlan0 /system/bin/dhcpcd -n + class late_start + disabled + oneshot + +service iprenew_bond0 /system/bin/dhcpcd -n + class late_start + disabled + oneshot + +service iprenew_p2p /system/bin/dhcpcd -n + class late_start + disabled + oneshot + +service iprenew_wigig0 /system/bin/dhcpcd -n + class late_start + disabled + oneshot + +service ptt_socket_app /system/vendor/bin/ptt_socket_app -d + class main + user wifi + group wifi system inet net_admin + capabilities NET_ADMIN + oneshot + +service ptt_ffbm /system/vendor/bin/ptt_socket_app -f -d + user root + group root + disabled + oneshot + +service wifi_ftmd /system/vendor/bin/wifi_ftmd + user system + group system inet net_admin + socket wififtmd_server dgram 0660 system system + disabled + oneshot + +on property:vendor.wifi.ftmd.load=true + insmod /system/lib/modules/pronto/pronto_wlan.ko con_mode=5 + +service cnss-daemon /system/vendor/bin/cnss-daemon -n -l + class late_start + user system + group system inet net_admin wifi + capabilities NET_ADMIN + +on property:sys.shutdown.requested=* + write /sys/kernel/shutdown_wlan/shutdown 1 + stop cnss-daemon + +service dhcpcd_bt-pan /system/bin/dhcpcd -BKLG + class late_start + disabled + oneshot + +service iprenew_bt-pan /system/bin/dhcpcd -n + class late_start + disabled + oneshot + +service ssgqmigd /vendor/bin/ssgqmigd + class late_start + user radio + group radio gps system + socket ssgqmig seqpacket 0660 radio inet + +service ssgtzd /vendor/bin/ssgtzd + class late_start + user system + group system + socket ssgtzd stream 0660 system inet + +service mlid /vendor/bin/mlid + class late_start + user gps + group gps + socket mlid stream 0666 gps gps + +service loc_launcher /system/vendor/bin/loc_launcher + class late_start + user gps + group gps + +on property:crypto.driver.load=1 + insmod /system/lib/modules/qce.ko + insmod /system/lib/modules/qcedev.ko + +service drmdiag /system/vendor/bin/drmdiagapp + class late_start + user root + disabled + oneshot + +on property:drmdiag.load=1 + start drmdiag + +on property:drmdiag.load=0 + stop drmdiag + +service qcom-sh /vendor/bin/init.qcom.sh + class late_start + user root + group root system radio + oneshot + +service vendor-sensor-sh /vendor/bin/init.qcom.sensors.sh + class core + user root + oneshot + +service crashdata-sh /vendor/bin/init.qcom.crashdata.sh + class late_start + user root + oneshot + +service qcom-post-boot /vendor/bin/init.qcom.post_boot.sh + class late_start + user root + group root system wakelock graphics + disabled + oneshot + +service wifi-sdio-on /vendor/bin/init.qcom.sdio.sh + class late_start + group wifi inet + disabled + oneshot + +service wifi-crda /vendor/bin/init.crda.sh + class late_start + user root + disabled + oneshot + +on property:sys.boot_completed=1 + start qcom-post-boot + +on property:ro.vendor.ril.mbn_copy_completed=1 + write /data/vendor/radio/copy_complete 1 + +service qvop-daemon /vendor/bin/qvop-daemon + class late_start + user system + group system drmrpc + +service vendor.atfwd /vendor/bin/ATFWD-daemon + class late_start + user system + group system radio + +service hostapd_fst /vendor/bin/hw/hostapd -dd -g /data/vendor/wifi/hostapd/global + class main + capabilities NET_ADMIN NET_RAW + user wifi + group wifi + disabled + oneshot + +service vendor.wigig_hostapd /vendor/bin/hw/hostapd -dd -j wigighostapd /data/vendor/wifi/hostapd/wigig_hostapd.conf + class late_start + capabilities NET_ADMIN NET_RAW + user wifi + group wifi inet keystore + oneshot + disabled + +service ims_regmanager /system/vendor/bin/exe-ims-regmanagerprocessnative + class late_start + group net_bt_admin inet radio wifi + disabled + +on property:persist.ims.regmanager.mode=1 + start ims_regmanager + +on property:ro.data.large_tcp_window_size=true + # Adjust socket buffer to enlarge TCP receive window for high bandwidth (e.g. DO-RevB) + write /proc/sys/net/ipv4/tcp_adv_win_scale 2 + +service battery_monitor /system/bin/battery_monitor + user system + group system + disabled + +service vendor.ril-daemon2 /vendor/bin/hw/rild -c 2 + class main + user radio + disabled + group radio cache inet misc audio sdcard_r sdcard_rw diag oem_2901 log + capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW + +service vendor.ril-daemon3 /vendor/bin/hw/rild -c 3 + class main + user radio + disabled + group radio cache inet misc audio sdcard_r sdcard_rw diag oem_2901 log + capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW + +service profiler_daemon /system/bin/profiler_daemon + class late_start + user root + group root + disabled + +service charger /system/bin/charger + class charger + user system + group system graphics input + capabilities SYS_BOOT + seclabel u:r:charger:s0 + +service vendor.ssr_diag /system/vendor/bin/ssr_diag + class late_start + user system + group system + disabled + +service hvdcp /system/bin/hvdcp + class core + user root + disabled + +on property:persist.usb.hvdcp.detect=true + start hvdcp + +on property:persist.usb.hvdcp.detect=false + stop hvdcp + +service charger_monitor /system/bin/charger_monitor + user root + group root + disabled + +service qbcharger /charger -m 1 + disabled + oneshot + +on property:sys.qbcharger.enable=true + start qbcharger + +on property:sys.qbcharger.enable=false + stop qbcharger + +# service diag_mdlog_start /system/vendor/bin/diag_mdlog +service diag_mdlog_start /system/bin/diag_mdlog_system -n 40 -s 500 + class late_start + user shell +# group system oem_2901 sdcard_rw sdcard_r media_rw + group system diag oem_2901 sdcard_rw sdcard_r media_rw + disabled + oneshot + +#service diag_mdlog_stop /system/vendor/bin/diag_mdlog -k +service diag_mdlog_stop /system/bin/diag_mdlog_system -k + class late_start + user shell +# group system oem_2901 sdcard_rw sdcard_r media_rw + group system diag oem_2901 sdcard_rw sdcard_r media_rw + disabled + oneshot + +on property:persist.vendor.mdlog.enable=true + start diag_mdlog_start +on property:persist.vendor.mdlog.enable=false + start diag_mdlog_stop + +service qlogd /system/xbin/qlogd + socket qlogd stream 0662 system system + class main + disabled +on property:persist.vendor.qlogd=1 + start qlogd +on property:persist.vendor.qlogd=0 + stop qlogd + +service vm_bms /vendor/bin/vm_bms + user root + group root + disabled + +service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /system/vendor/etc/msm_irqbalance.conf + class core + user root + group root + disabled + +service vendor.msm_irqbal_lb /vendor/bin/msm_irqbalance -f /system/vendor/etc/msm_irqbalance_little_big.conf + class core + user root + group root + disabled + +service vendor.msm_irqbl_sdm630 /vendor/bin/msm_irqbalance -f /system/vendor/etc/msm_irqbalance_sdm630.conf + class core + user root + group root + disabled + +# service for USERDEBUG +service vendor.LKCore-dbg /vendor/bin/LKCore + class late_start + oneshot + disabled + user root + group root system log diag net_raw + +service sdlog /system/bin/sdlog + class late_start + user root + disabled + oneshot + +on property:persist.vendor.logd.enable=1 + start sdlog + +on property:persist.vendor.logd.enable=0 + setprop vendor.sdlog.run 0 + stop sdlog + +# service for USER +service vendor.LKCore-rel /vendor/bin/LKCore + class late_start + oneshot + disabled + user system + group system log diag + +service qseeproxydaemon /system/vendor/bin/qseeproxydaemon + class late_start + user system + group system + +service esepmdaemon /system/vendor/bin/esepmdaemon + class core + user system + group nfc + +on charger + setprop persist.sys.usb.config mass_storage + load_system_props + start qcom-post-boot + +#add poweroffhandler +service poweroffhandler /system/vendor/bin/poweroffhandler + class core + user media + group graphics audio + disabled + oneshot + +on property:vendor.display.lcd_density=* + setprop ro.sf.lcd_density ${vendor.display.lcd_density} + +# Logcat dump daemon, dumps logs to logdump partition +service logdumpd /system/bin/logcat -b all -v threadtime -D -w /dev/block/bootdevice/by-name/logdump + class core + writepid /dev/cpuset/system-background/tasks + seclabel u:r:logdumpd:s0 + disabled + +# Logdumpd is enabled only for userdebug non-perf build +on property:ro.logdumpd.enabled=1 + start logdumpd + +service time_daemon /vendor/bin/time_daemon + class main + user system + group system + capabilities SYS_TIME + +# Set vendor-ril lib path based on Meta version +on property:vendor.rild.libpath=* + setprop rild.libpath ${vendor.rild.libpath} + +on property:ro.vendor.radio.noril=* + setprop ro.radio.noril ${ro.vendor.radio.noril} + +service seemp_healthd /vendor/bin/seemp_healthd + class late_start + user system + group system + +service vendor.power_off_alarm /vendor/bin/power_off_alarm + class core + group system + disabled + oneshot + +service vendor.move_time_data /system/bin/move_time_data.sh + class main + user system + group system + disabled + oneshot + +service vendor.hbtp /vendor/bin/hbtp_daemon + class main + user system + group system + capabilities SYS_NICE + disabled + +service chre /vendor/bin/chre + class late_start + user system + group system + socket chre seqpacket 0660 root system + shutdown critical + +on property:vendor.chre.enabled=0 + stop chre + +service bugreport /system/bin/dumpstate -d -p -B -z -o /data/user_de/0/com.android.shell/files/bugreports/bugreport + class main + disabled + oneshot + keycodes 114 115 116 + +#Set GPU Opengles version +on property:vendor.opengles.version=* + setprop ro.opengles.version ${vendor.opengles.version} + +#Set gpu available frequencies property +on property:vendor.gpu.available_frequencies=* + setprop ro.vendor.gpu.available_frequencies ${vendor.gpu.available_frequencies} + +service vendor.audio-hal-2-0 /vendor/bin/hw/android.hardware.audio@2.0-service + override + class hal + user audioserver + # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) + group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct oem_2901 wakelock + capabilities BLOCK_SUSPEND + ioprio rt 4 + writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks + # audioflinger restarts itself when it loses connection with the hal + # and its .rc file has an "onrestart restart audio-hal" rule, thus + # an additional auto-restart from the init process isn't needed. + #2019.11.25 longcheer puqirui add for misound MIUI patch start + socket audio_hw_socket seqpacket 0666 system system + #2019.11.25 longcheer puqirui add for misound MIUI patch end + oneshot + interface android.hardware.audio@5.0::IDevicesFactory default + interface android.hardware.audio@4.0::IDevicesFactory default + interface android.hardware.audio@2.0::IDevicesFactory default + +service vendor.contexthub-hal-1-0 /vendor/bin/hw/android.hardware.contexthub@1.0-service + override + class hal + interface android.hardware.contexthub@1.0::IContexthub default + user system + group system + disabled diff --git a/rootdir/etc/init.qcom.usb.rc b/rootdir/etc/init.qcom.usb.rc new file mode 100644 index 0000000..5b5fe74 --- /dev/null +++ b/rootdir/etc/init.qcom.usb.rc @@ -0,0 +1,1674 @@ +# Copyright (c) 2011-2016, 2018-2019 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. +# + +on charger + mkdir /dev/usb-ffs 0770 shell shell + mkdir /dev/usb-ffs/adb 0770 shell shell + mount configfs none /config + mkdir /config/usb_gadget/g1 0770 shell shell + mkdir /config/usb_gadget/g1/strings/0x409 0770 + write /config/usb_gadget/g1/bcdUSB 0x0200 + write /config/usb_gadget/g1/os_desc/use 1 + write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} + write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} + write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} + mkdir /config/usb_gadget/g1/functions/mass_storage.0 + mkdir /config/usb_gadget/g1/functions/ffs.adb + mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell + mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell + write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 + symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 + mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 + write /sys/class/android_usb/android0/f_ffs/aliases adb + enable vendor.qcom-usb-sh + start vendor.qcom-usb-sh + setprop sys.usb.config mass_storage + +on boot + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + mount configfs none /config + mkdir /config/usb_gadget/g1 0770 + mkdir /config/usb_gadget/g2 0770 + mkdir /config/usb_gadget/g1/strings/0x409 0770 + mkdir /config/usb_gadget/g2/strings/0x409 0770 + write /config/usb_gadget/g1/bcdUSB 0x0200 + write /config/usb_gadget/g2/bcdUSB 0x0200 + write /config/usb_gadget/g1/os_desc/use 1 + write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} + write /config/usb_gadget/g2/strings/0x409/serialnumber ${ro.serialno} + write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} + write /config/usb_gadget/g2/strings/0x409/manufacturer ${ro.product.manufacturer} + write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} + write /config/usb_gadget/g2/strings/0x409/product ${ro.product.model} + mkdir /config/usb_gadget/g1/functions/mass_storage.0 + mkdir /config/usb_gadget/g1/functions/mtp.gs0 + mkdir /config/usb_gadget/g1/functions/ptp.gs1 + mkdir /config/usb_gadget/g1/functions/accessory.gs2 + mkdir /config/usb_gadget/g1/functions/audio_source.gs3 + mkdir /config/usb_gadget/g1/functions/midi.gs5 + mkdir /config/usb_gadget/g1/functions/ffs.adb + mkdir /config/usb_gadget/g1/functions/diag.diag + mkdir /config/usb_gadget/g1/functions/diag.diag_mdm + mkdir /config/usb_gadget/g1/functions/diag.diag_mdm2 + mkdir /config/usb_gadget/g1/functions/cser.dun.0 + mkdir /config/usb_gadget/g1/functions/cser.nmea.1 + mkdir /config/usb_gadget/g1/functions/cser.dun.2 + mkdir /config/usb_gadget/g1/functions/gsi.rmnet + mkdir /config/usb_gadget/g1/functions/gsi.rndis + mkdir /config/usb_gadget/g1/functions/gsi.dpl + mkdir /config/usb_gadget/g1/functions/qdss.qdss + mkdir /config/usb_gadget/g1/functions/qdss.qdss_mdm + mkdir /config/usb_gadget/g1/functions/rndis_bam.rndis + mkdir /config/usb_gadget/g1/functions/rndis.rndis + mkdir /config/usb_gadget/g1/functions/rmnet_bam.rmnet + mkdir /config/usb_gadget/g1/functions/rmnet_bam.dpl + mkdir /config/usb_gadget/g1/functions/rmnet_bam.rmnet_bam_dmux + mkdir /config/usb_gadget/g1/functions/rmnet_bam.dpl_bam_dmux + mkdir /config/usb_gadget/g1/functions/ncm.0 + mkdir /config/usb_gadget/g1/functions/ccid.ccid + mkdir /config/usb_gadget/g1/functions/uac2.0 + mkdir /config/usb_gadget/g1/functions/uvc.0 + mkdir /config/usb_gadget/g1/configs/b.1 0770 + mkdir /config/usb_gadget/g2/configs/b.1 0770 + mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 + mkdir /config/usb_gadget/g2/configs/b.1/strings/0x409 0770 + write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 + write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" + symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 + mkdir /dev/usb-ffs 0775 shell system + mkdir /dev/usb-ffs/adb 0770 shell system + mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=1000,rmode=0770,fmode=0660 + write /sys/class/android_usb/android0/f_ffs/aliases adb + setprop sys.mtp.device_type 2 + setprop vendor.usb.controller ${sys.usb.controller} + enable vendor.qcom-usb-sh + +service vendor.qcom-usb-sh /vendor/bin/init.qcom.usb.sh + class core + user root + oneshot + disabled + +on property:persist.vendor.usb.config=* + setprop persist.sys.usb.config ${persist.vendor.usb.config} + +on property:sys.usb.config=* + setprop vendor.usb.mimode ${persist.sys.usb.config} + exec u:r:qti_init_shell:s0 -- /vendor/bin/init.mi.usb.sh + +on boot && property:ro.boot.usbconfigfs=true + setprop sys.usb.configfs 1 + +on property:vendor.usb.configfs=1 && property:sys.usb.configfs=0 + setprop sys.usb.configfs 1 + +# Following are the parameters required for usb functionality. They provide configurable options like +# product_id/vendor id and allows specifying required functions: +# +# Required parameters: +# +# /sys/class/android_usb/android0/enable: Enables/disables usb composition +# Value: 0 (disable), 1 (enable) +# +# /sys/class/android_usb/android0/idVendor: Stores Vendor ID +# Value: 05c6 (Vendor id for Qualcomm Inc) +# +# /sys/class/android_usb/android0/idProduct: Stores Product id corresponding to usb composition +# Value: 0x9xxx for composite interface, 0xFxxx for single interface +# +# /sys/class/android_usb/android0/f_diag/clients: Stores name of clients representing a diag interface. +# Value: Passed one per interface. e.g. diag[,diag_mdm, diag_qsc, diag_mdm2] +# +# /sys/class/android_usb/android0/functions: Stores name of the function drivers used in usb composition. +# Value: Passed one per function driver. e.g. diag[,adb] +# +#Optional parameters: +# +# /sys/class/android_usb/android0/f_serial/transports: Stores type of underlying transports used to +# communicate to serial interface. +# Value: Passed one per interface. One value represents control and data transport together. +# e.g. smd[,sdio,tty,hsic] +# Only required if serial interface is present. +# +# /sys/class/android_usb/android0/f_serial/transport_names: Stores name of the underlying transports +# used to communicate to serial interface. This is used to distinguish between more than one interface +# using same transport type. +# Value: Passed one per interface. One value represents control and data transport together. +# e.g. serial_hsic[,serial_hsusb] +# Only required for transport type hsic, optional for other transport types. +# +# /sys/class/android_usb/android0/f_rmnet/transports: Stores type of underlying transports used to +# communicate to rmnet interface. +# Value: Passed two per interface as control, data transport type pair. +# e.g. smd,bam[,hsuart,hsuart] +# Only required if rmnet interface is present. +# +# /sys/class/android_usb/android0/f_rmnet/transport_names: Stores name of the underlying transports +# used to communicate to rmnet interface. This is used to distinguish between more than one interface +# using same transport type. +# Value: Passed one per interface. One value represents control and data transport together. +# e.g. rmnet_hsic[,rmnet_hsusb] +# Only required for transport type hsic, optional for other transport types. + +# USB compositions +on property:sys.usb.config=diag,serial_tty,serial_smd && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9002 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports tty,smd + write /sys/class/android_usb/android0/functions diag,serial + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_tty,serial_smd,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9020 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd,tty + write /sys/class/android_usb/android0/functions diag,adb,serial + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 901D + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/functions diag,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 900E + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/functions diag + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,rmnet_bam,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9091 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd + write /sys/class/android_usb/android0/f_rmnet/transports smd,bam + write /sys/class/android_usb/android0/functions diag,serial,rmnet,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,rmnet_qti_bam,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9091 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam + write /sys/class/android_usb/android0/functions diag,serial,rmnet,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,rmnet_bam && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9092 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd + write /sys/class/android_usb/android0/f_rmnet/transports smd,bam + write /sys/class/android_usb/android0/functions diag,serial,rmnet + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,rmnet_qti_bam && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9092 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam + write /sys/class/android_usb/android0/functions diag,serial,rmnet + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,serial_tty,rmnet_ipa,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9025 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports char_bridge,tty + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,serial_tty,rmnet_ipa,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9026 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports char_bridge,tty + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,serial_tty,rmnet_bam,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9025 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd,tty + write /sys/class/android_usb/android0/f_rmnet/transports smd,bam + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,acm_smd,acm_tty,rmnet_bam,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 903D + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_acm/acm_transports smd,tty + write /sys/class/android_usb/android0/f_rmnet/transports smd,bam + write /sys/class/android_usb/android0/functions diag,adb,acm,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,serial_tty,rmnet_bam,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9026 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd,tty + write /sys/class/android_usb/android0/f_rmnet/transports smd,bam + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,acm_smd,acm_tty,rmnet_bam,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 903E + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_acm/acm_transports smd,tty + write /sys/class/android_usb/android0/f_rmnet/transports smd,bam + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,serial_sdio,serial_smd,rmnet_smd_sdio,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9037 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports sdio,smd + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet_smd_sdio,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,acm_sdio,acm_smd,rmnet_smd_sdio,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 903B + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_acm/acm_transports sdio,smd + write /sys/class/android_usb/android0/functions diag,adb,acm,rmnet_smd_sdio,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,serial_sdio,serial_smd,rmnet_smd_sdio,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9038 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports sdio,smd + write /sys/class/android_usb/android0/functions diag,serial,rmnet_smd_sdio,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,acm_sdio,acm_smd,rmnet_smd_sdio,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 903C + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_acm/acm_transports sdio,smd + write /sys/class/android_usb/android0/functions diag,acm,rmnet_smd_sdio,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,serial_sdio,serial_tty,rmnet_sdio,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9031 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports sdio,tty + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet_sdio,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,acm_sdio,acm_tty,rmnet_sdio,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 903B + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_acm/acm_transports sdio,tty + write /sys/class/android_usb/android0/functions diag,adb,acm,rmnet_sdio,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,serial_sdio,serial_tty,rmnet_sdio,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9032 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports sdio,tty + write /sys/class/android_usb/android0/functions diag,serial,rmnet_sdio,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,acm_sdio,acm_tty,rmnet_sdio,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 903C + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_acm/acm_transports sdio,tty + write /sys/class/android_usb/android0/functions diag,acm,rmnet_sdio,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_tty,serial_tty,rmnet_smd,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9025 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports tty,tty + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet_smd,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + start vendor.port-bridge + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,acm_tty,acm_tty,rmnet_smd,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 903D + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_acm/acm_transports tty,tty + write /sys/class/android_usb/android0/functions diag,adb,acm,rmnet_smd,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + start vendor.port-bridge + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_tty,serial_tty,rmnet_smd,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9026 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports tty,tty + write /sys/class/android_usb/android0/functions diag,serial,rmnet_smd,mass_storage + write /sys/class/android_usb/android0/enable 1 + start vendor.port-bridge + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,acm_tty,acm_tty,rmnet_smd,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 903E + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_acm/acm_transports tty,tty + write /sys/class/android_usb/android0/functions diag,serial,rmnet_smd,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,serial_tty,rmnet_smd,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9025 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd,tty + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet_smd,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,acm_smd,acm_tty,rmnet_smd,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 903D + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_acm/acm_transports smd,tty + write /sys/class/android_usb/android0/functions diag,adb,acm,rmnet_smd,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + start vendor.port-bridge + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,serial_tty,rmnet_smd,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9026 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd,tty + write /sys/class/android_usb/android0/functions diag,serial,rmnet_smd,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,acm_smd,acm_tty,rmnet_smd,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 903E + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_acm/acm_transports smd,tty + write /sys/class/android_usb/android0/functions diag,serial,rmnet_smd,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +# RmNet using USB BAM to IPA BAM +on property:sys.usb.config=diag,serial_smd,serial_tty,rmnet_ipa,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9025 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd,tty + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,serial_tty,rmnet_ipa,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9026 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd,tty + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,rmnet_ipa,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9091 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/functions diag,serial,rmnet,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,rmnet_ipa && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9092 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/functions diag,serial,rmnet + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +# Fusion 3 composition +on property:sys.usb.config=diag,serial_hsic,serial_tty,rmnet_hsic,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9025 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports hsic,tty + write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic + write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic + write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage + write /sys/module/mdm_bridge/parameters/rx_rmnet_buffer_size 16384 + write /sys/module/mdm_bridge/parameters/max_rx_urbs 20 + write /sys/module/g_android/parameters/ghsic_data_rx_req_size 16384 + write /sys/module/g_android/parameters/ghsic_data_rmnet_rx_q_size 20 + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +# Fusion 3 composition with diag_mdm and adb +on property:sys.usb.config=diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9031 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports hsic,tty + write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic + write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic + write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage + write /sys/module/mdm_bridge/parameters/rx_rmnet_buffer_size 16384 + write /sys/module/mdm_bridge/parameters/max_rx_urbs 20 + write /sys/module/g_android/parameters/ghsic_data_rx_req_size 16384 + write /sys/module/g_android/parameters/ghsic_data_rmnet_rx_q_size 20 + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +# Fusion 3 composition with diag_mdm +on property:sys.usb.config=diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9032 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports hsic,tty + write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic + write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic + write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage + write /sys/module/mdm_bridge/parameters/rx_rmnet_buffer_size 16384 + write /sys/module/mdm_bridge/parameters/max_rx_urbs 20 + write /sys/module/g_android/parameters/ghsic_data_rx_req_size 16384 + write /sys/module/g_android/parameters/ghsic_data_rmnet_rx_q_size 20 + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +# Fusion 3 DSDA composition with adb +on property:sys.usb.config=diag,diag_mdm,diag_qsc,serial_hsic,serial_hsuart,rmnet_hsic,rmnet_hsuart,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9065 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm,diag_qsc + write /sys/class/android_usb/android0/f_serial/transports hsic,hsuart + write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic,serial_hsuart + write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic,hsuart,hsuart + write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic,rmnet_hsuart + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage + write /sys/module/mdm_bridge/parameters/rx_rmnet_buffer_size 16384 + write /sys/module/mdm_bridge/parameters/max_rx_urbs 20 + write /sys/module/g_android/parameters/ghsic_data_rx_req_size 16384 + write /sys/module/g_android/parameters/ghsic_data_rmnet_rx_q_size 20 + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +# Fusion 3 DSDA composition without adb +on property:sys.usb.config=diag,diag_mdm,diag_qsc,serial_hsic,serial_hsuart,rmnet_hsic,rmnet_hsuart,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9066 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm,diag_qsc + write /sys/class/android_usb/android0/f_serial/transports hsic,hsuart + write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic,serial_hsuart + write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic,hsuart,hsuart + write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic,rmnet_hsuart + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage + write /sys/module/mdm_bridge/parameters/rx_rmnet_buffer_size 16384 + write /sys/module/mdm_bridge/parameters/max_rx_urbs 20 + write /sys/module/g_android/parameters/ghsic_data_rx_req_size 16384 + write /sys/module/g_android/parameters/ghsic_data_rmnet_rx_q_size 20 + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +# Fusion 3 DSDA2 composition with adb +on property:sys.usb.config=diag,diag_mdm,diag_mdm2,serial_hsic,serial_hsusb,rmnet_hsic,rmnet_hsusb,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9065 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm,diag_mdm2 + write /sys/class/android_usb/android0/f_serial/transports hsic,hsic + write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic,serial_hsusb + write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic,hsic,hsic + write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic,rmnet_hsusb + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage + write /sys/module/mdm_bridge/parameters/rx_rmnet_buffer_size 16384 + write /sys/module/mdm_bridge/parameters/max_rx_urbs 20 + write /sys/module/g_android/parameters/ghsic_data_rx_req_size 16384 + write /sys/module/g_android/parameters/ghsic_data_rmnet_rx_q_size 20 + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +# Fusion 3 DSDA2 composition without adb +on property:sys.usb.config=diag,diag_mdm,diag_mdm2,serial_hsic,serial_hsusb,rmnet_hsic,rmnet_hsusb,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9066 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm,diag_mdm2 + write /sys/class/android_usb/android0/f_serial/transports hsic,hsic + write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic,serial_hsusb + write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic,hsic,hsic + write /sys/class/android_usb/android0/f_rmnet/transport_names rmnet_hsic,rmnet_hsusb + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage + write /sys/module/mdm_bridge/parameters/rx_rmnet_buffer_size 16384 + write /sys/module/mdm_bridge/parameters/max_rx_urbs 20 + write /sys/module/g_android/parameters/ghsic_data_rx_req_size 16384 + write /sys/module/g_android/parameters/ghsic_data_rmnet_rx_q_size 20 + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +# Fusion PCIe composition with diag_mdm and adb +# Serial & RmNet bridged in userspace with tty and qti/ether +on property:sys.usb.config=diag,diag_mdm,serial_tty,rmnet_qti_ether,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9035 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports tty + write /sys/class/android_usb/android0/f_rmnet/transports qti,ether + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +# Fusion PCIe composition with diag_mdm +# Serial & RmNet bridged in userspace with tty and qti/ether +on property:sys.usb.config=diag,diag_mdm,serial_hsic,rmnet_hsic,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9036 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports tty + write /sys/class/android_usb/android0/f_rmnet/transports qti,ether + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +# Fusion HSIC/PCIe Hybrid composition with diag_mdm and adb +# RmNet is bridged over PCIe using qti,ether ctrl/data transports +on property:sys.usb.config=diag,diag_mdm,serial_hsic,rmnet_qti_ether,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9035 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports hsic + write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic + write /sys/class/android_usb/android0/f_rmnet/transports qti,ether + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +# Fusion HSIC/PCIe Hybrid composition with diag_mdm +# RmNet is bridged over PCIe using qti,ether ctrl/data transports +on property:sys.usb.config=diag,diag_mdm,serial_hsic,rmnet_hsic,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9036 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports hsic + write /sys/class/android_usb/android0/f_serial/transport_names serial_hsic + write /sys/class/android_usb/android0/f_rmnet/transports qti,ether + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +# Fusion PCIe composition with diag_mdm +# Serial & RmNet bridged in userspace with port bridge and qti/ether +on property:sys.usb.config=diag,diag_mdm,serial_cdev,rmnet_qti_ether,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9036 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports char_bridge + write /sys/class/android_usb/android0/f_rmnet/transports qti,ether + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,serial_cdev,rmnet_qti_ether,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9035 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports char_bridge + write /sys/class/android_usb/android0/f_rmnet/transports qti,ether + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +# Fusion 2.2 composition with diag_qsc and adb +on property:sys.usb.config=diag,diag_qsc,serial_smd,serial_tty,serial_hsuart,rmnet_hsuart,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9053 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_qsc + write /sys/class/android_usb/android0/f_serial/transports smd,tty,hsuart + write /sys/class/android_usb/android0/f_rmnet/transports smd,bam,hsuart,hsuart + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +# Fusion 2.2 composition with diag_qsc +on property:sys.usb.config=diag,diag_qsc,serial_smd,serial_tty,serial_hsuart,rmnet_hsuart,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9054 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_qsc + write /sys/class/android_usb/android0/f_serial/transports smd,tty,hsuart + write /sys/class/android_usb/android0/f_rmnet/transports smd,bam,hsuart,hsuart + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:vendor.usb.tethering=true + write /sys/class/net/rndis0/queues/rx-0/rps_cpus ${vendor.usb.rps_mask} + +on property:sys.usb.config=rndis + setprop sys.usb.config rndis,${persist.vendor.usb.config.extra} + +on property:sys.usb.config=rndis,none && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct F00E + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/functions rndis + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,adb && property:sys.usb.configfs=0 + setprop sys.usb.config rndis,${persist.vendor.usb.config.extra},adb + +on property:sys.usb.config=rndis,none,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9024 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/functions rndis,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=rndis,diag && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 902C + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/functions rndis,diag + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,diag,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 902D + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/functions rndis,diag,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state rndis,adb + +# DPL is implemented using QDSS +on property:sys.usb.config=rndis,diag,dpl && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90BF + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_qdss/debug_intf 0 + write /sys/class/android_usb/android0/f_qdss/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions rndis,diag,qdss + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state rndis + +# DPL is implemented using QDSS +on property:sys.usb.config=rndis,diag,dpl,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90C0 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_qdss/debug_intf 0 + write /sys/class/android_usb/android0/f_qdss/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions rndis,diag,qdss,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=rndis,serial_smd && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B3 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_serial/transports smd + write /sys/class/android_usb/android0/functions rndis,serial + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,serial_smd,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B4 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_serial/transports smd + write /sys/class/android_usb/android0/functions rndis,serial,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=rndis,serial_smd,diag && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B5 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd + write /sys/class/android_usb/android0/functions rndis,serial,diag + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,serial_smd,diag,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B6 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd + write /sys/class/android_usb/android0/functions rndis,serial,diag,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=rndis,serial_cdev,diag && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B5 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports char_bridge + write /sys/class/android_usb/android0/functions rndis,serial,diag + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,serial_cdev,diag,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B6 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports char_bridge + write /sys/class/android_usb/android0/functions rndis,serial,diag,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=rndis,diag,diag_mdm && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9041 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/functions rndis,diag + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,diag,diag_mdm,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9042 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/functions rndis,diag,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=rndis,diag,diag_mdm,diag_qsc && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9086 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm,diag_qsc + write /sys/class/android_usb/android0/functions rndis,diag + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state rndis + +on property:sys.usb.config=rndis,diag,diag_mdm,diag_qsc,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9087 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm,diag_qsc + write /sys/class/android_usb/android0/functions rndis,diag,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state rndis,adb + +on property:sys.usb.config=ptp && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 904D + write /sys/class/android_usb/android0/functions ptp + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=ptp,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 904E + write /sys/class/android_usb/android0/functions ptp,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=mtp && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct F003 + write /sys/class/android_usb/android0/functions mtp + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=mtp,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9039 + write /sys/class/android_usb/android0/functions mtp,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=mtp,diag && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 901B + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/functions mtp,diag + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=mtp,diag,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 903A + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/functions mtp,diag,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=mtp,diag,diag_mdm && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9040 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/functions mtp,diag + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=mtp,diag,diag_mdm,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 903F + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/functions mtp,diag,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=mtp,diag,diag_mdm,diag_qsc && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9088 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm,diag_qsc + write /sys/class/android_usb/android0/functions mtp,diag + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=mtp,diag,diag_mdm,diag_qsc,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9089 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm,diag_qsc + write /sys/class/android_usb/android0/functions mtp,diag,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,ccid && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9045 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/functions diag,ccid + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,ccid,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9044 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/functions diag,adb,ccid + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9015 + write /sys/class/android_usb/android0/functions adb,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +#Mass-storage only composition +on property:sys.usb.config=mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct F000 + write /sys/class/android_usb/android0/functions mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,qdss && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 904A + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions diag,qdss + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,qdss,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9060 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions diag,qdss,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,qdss && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9099 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions diag,qdss + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,qdss,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9098 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions diag,qdss,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,qdss,rmnet_bam && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9083 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_rmnet/transports smd,bam + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions diag,qdss,rmnet + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,qdss,rmnet_qti_bam && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9083 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions diag,qdss,rmnet + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,qdss,rmnet_bam,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9084 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_rmnet/transports smd,bam + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions diag,qdss,adb,rmnet + write /sys/module/dwc3/parameters/tx_fifo_resize_enable 1 + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,qdss,rmnet_qti_bam,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9084 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions diag,qdss,adb,rmnet + write /sys/module/dwc3/parameters/tx_fifo_resize_enable 1 + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,qdss,rmnet_ipa && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9083 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions diag,qdss,rmnet + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,qdss,rmnet_ipa,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9084 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions diag,qdss,adb,rmnet + write /sys/module/dwc3/parameters/tx_fifo_resize_enable 1 + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,qdss,rmnet_hsic && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 909B + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions diag,qdss,rmnet + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,qdss,rmnet_hsic,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 909A + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions diag,qdss,adb,rmnet + write /sys/module/dwc3/parameters/tx_fifo_resize_enable 1 + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,qdss_apq,qdss_mdm,rmnet_hsic && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90A3 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic + write /sys/class/android_usb/android0/f_qdss/debug_intf 0 + write /sys/class/android_usb/android0/f_qdss/transports bam,hsic + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam,qdss_hsic + write /sys/class/android_usb/android0/functions diag,qdss,rmnet + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,qdss_apq,qdss_mdm,rmnet_hsic,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90A2 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_rmnet/transports hsic,hsic + write /sys/class/android_usb/android0/f_qdss/debug_intf 0 + write /sys/class/android_usb/android0/f_qdss/transports bam,hsic + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam,qdss_hsic + write /sys/class/android_usb/android0/functions diag,qdss,adb,rmnet + write /sys/module/dwc3/parameters/tx_fifo_resize_enable 1 + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=rndis,diag,qdss && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9081 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions rndis,diag,qdss + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=rndis,diag,qdss,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 9082 + write /sys/class/android_usb/android0/f_rndis/wceis 1 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_qdss/debug_intf 1 + write /sys/class/android_usb/android0/f_qdss/transports bam + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/functions rndis,diag,qdss,adb + write /sys/module/dwc3/parameters/tx_fifo_resize_enable 1 + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +# same as 9025, plus data packet logging (DPL) using QDSS +on property:sys.usb.config=diag,serial_smd,serial_tty,rmnet_ipa,mass_storage,dpl,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90AD + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd,tty +# DPL is implemented using QDSS + write /sys/class/android_usb/android0/f_qdss/debug_intf 0 + write /sys/class/android_usb/android0/f_qdss/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage,qdss + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +# same as 9026, plus data packet logging (DPL) +on property:sys.usb.config=diag,serial_smd,serial_tty,rmnet_ipa,mass_storage,dpl && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B0 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd,tty +# DPL is implemented using QDSS + write /sys/class/android_usb/android0/f_qdss/debug_intf 0 + write /sys/class/android_usb/android0/f_qdss/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage,qdss + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,serial_tty,rmnet_ipa,mass_storage,dpl,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90AD + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports char_bridge,tty +# DPL is implemented using QDSS + write /sys/class/android_usb/android0/f_qdss/debug_intf 0 + write /sys/class/android_usb/android0/f_qdss/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,mass_storage,qdss + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_cdev,serial_tty,rmnet_ipa,mass_storage,dpl && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B0 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports char_bridge,tty +# DPL is implemented using QDSS + write /sys/class/android_usb/android0/f_qdss/debug_intf 0 + write /sys/class/android_usb/android0/f_qdss/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/functions diag,serial,rmnet,mass_storage,qdss + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=ncm && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 0525 + write /sys/class/android_usb/android0/idProduct A4A1 + write /sys/class/android_usb/android0/functions ncm + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=ncm,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 908C + write /sys/class/android_usb/android0/functions ncm,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=charging && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct F006 + write /sys/class/android_usb/android0/functions charging + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,rmnet_qti_bam,dpl_qti_bam_dmux && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B7 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam + write /sys/class/android_usb/android0/f_qdss/transports qti,bam_dmux + write /sys/class/android_usb/android0/functions diag,serial,rmnet,qdss + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,rmnet_qti_bam,dpl_qti_bam_dmux,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B8 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam + write /sys/class/android_usb/android0/f_qdss/transports qti,bam_dmux + write /sys/class/android_usb/android0/functions diag,serial,rmnet,qdss,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_cnss,serial_smd,serial_tty,rmnet_bam,mass_storage,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B2 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_cnss + write /sys/class/android_usb/android0/f_serial/transports smd,tty + write /sys/class/android_usb/android0/f_rmnet/transports smd,bam + write /sys/class/android_usb/android0/functions diag,diag_cnss,adb,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_cnss,serial_smd,serial_tty,rmnet_bam,mass_storage && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B3 + write /sys/class/android_usb/android0/f_diag/clients diag,diag_cnss + write /sys/class/android_usb/android0/f_serial/transports smd,tty + write /sys/class/android_usb/android0/f_rmnet/transports smd,bam + write /sys/class/android_usb/android0/functions diag,diag_cnss,serial,rmnet,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=midi && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90BA + write /sys/class/android_usb/android0/functions midi + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=midi,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90BB + write /sys/class/android_usb/android0/functions midi,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,rmnet_ipa,dpl && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B7 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd +# DPL is implemented using QDSS + write /sys/class/android_usb/android0/f_qdss/debug_intf 0 + write /sys/class/android_usb/android0/f_qdss/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/functions diag,serial,rmnet,qdss + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,serial_smd,rmnet_ipa,dpl,adb && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/iSerial ${ro.serialno} + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90B8 + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/f_serial/transports smd +# DPL is implemented using QDSS + write /sys/class/android_usb/android0/f_qdss/debug_intf 0 + write /sys/class/android_usb/android0/f_qdss/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_bam + write /sys/class/android_usb/android0/f_rmnet/transports qti,bam2bam_ipa + write /sys/class/android_usb/android0/functions diag,serial,rmnet,qdss,adb + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,serial_tty,rmnet_qti_ether,dpl_ether,mass_storage,adb + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90AE + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports tty + write /sys/class/android_usb/android0/f_rmnet/transports qti,ether + write /sys/class/android_usb/android0/f_qdss/debug_intf 0 + write /sys/class/android_usb/android0/f_qdss/transports qti,ether + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_dpl + write /sys/class/android_usb/android0/functions diag,adb,serial,rmnet,qdss,mass_storage + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,diag_mdm,serial_tty,rmnet_qti_ether,dpl_ether,mass_storage + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90AF + write /sys/class/android_usb/android0/f_diag/clients diag,diag_mdm + write /sys/class/android_usb/android0/f_serial/transports tty + write /sys/class/android_usb/android0/f_rmnet/transports qti,ether + write /sys/class/android_usb/android0/f_qdss/debug_intf 0 + write /sys/class/android_usb/android0/f_qdss/transports qti,ether + write /sys/class/android_usb/android0/f_qdss/transport_names qdss_dpl + write /sys/class/android_usb/android0/functions diag,serial,rmnet,qdss,mass_storage + write /sys/class/android_usb/android0/enable 1 + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,adb,uac2 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90CA + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/functions diag,adb,uac2_func + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,adb,video && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90CB + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/functions diag,adb,video + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=diag,adb,uac2,video && property:sys.usb.configfs=0 + write /sys/class/android_usb/android0/enable 0 + write /sys/class/android_usb/android0/idVendor 05C6 + write /sys/class/android_usb/android0/idProduct 90CC + write /sys/class/android_usb/android0/f_diag/clients diag + write /sys/class/android_usb/android0/functions diag,adb,uac2_func,video + write /sys/class/android_usb/android0/enable 1 + start adbd + setprop sys.usb.state ${sys.usb.config} + diff --git a/rootdir/etc/init.target.rc b/rootdir/etc/init.target.rc new file mode 100644 index 0000000..c8f915f --- /dev/null +++ b/rootdir/etc/init.target.rc @@ -0,0 +1,752 @@ +# Copyright (c) 2013-2018, 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. +# +# + +import /vendor/etc/init/init.batterysecret.rc +import init.mishow.ctl.rc +import /vendor/etc/init/init.batteryd.rc + +on early-init + exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -a -d /vendor/lib/modules audio_q6_pdr audio_q6_notifier audio_snd_event audio_apr audio_adsp_loader audio_q6 audio_native audio_usf audio_pinctrl_lpi audio_swr audio_platform audio_hdmi audio_stub audio_wcd_core audio_wsa881x audio_bolero_cdc audio_wsa_macro audio_va_macro audio_rx_macro audio_tx_macro audio_wcd937x audio_wcd937x_slave audio_wcd938x audio_wcd938x_slave audio_tas2562 audio_machine_atoll + write /proc/sys/kernel/sched_boost 1 + mkdir /dsp 0771 media media + mkdir /firmware 0771 system system + mkdir /bt_firmware 0771 system system + symlink /data/tombstones /tombstones + +on init + write /dev/stune/foreground/schedtune.sched_boost_no_override 1 + write /dev/stune/top-app/schedtune.sched_boost_no_override 1 + write /dev/stune/schedtune.colocate 0 + write /dev/stune/background/schedtune.colocate 0 + write /dev/stune/system-background/schedtune.colocate 0 + write /dev/stune/foreground/schedtune.colocate 0 + write /dev/stune/top-app/schedtune.colocate 1 + write /sys/module/qpnp_rtc/parameters/poweron_alarm 1 + wait /dev/block/platform/soc/${ro.boot.bootdevice} + symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice + +on early-fs + start vold + +on fs + start hwservicemanager + mount_all /vendor/etc/fstab.qcom --early + chown root system /mnt/vendor/persist + chmod 0771 /mnt/vendor/persist + restorecon_recursive /mnt/vendor/persist + mkdir /mnt/vendor/persist/data 0700 system system + mkdir /mnt/vendor/persist/subsys 0770 root system + mkdir /mnt/vendor/persist/audio 0755 system system + mkdir /mnt/vendor/persist/haptics 0755 system system + mkdir /mnt/vendor/persist/stability 0755 system system + mkdir /mnt/vendor/persist/misys 0755 system system + #+ add for watermark + mkdir /mnt/vendor/persist/camera 0777 root root + + chmod 0664 /sys/class/thermal/thermal_message/sconfig + chown system system /sys/class/thermal/thermal_message/sconfig + chmod 0666 /sys/class/thermal/thermal_message/temp_state + chown system system /sys/class/thermal/thermal_message/temp_state + +on post-fs + # set RLIMIT_MEMLOCK to 64MB + setrlimit 8 67108864 67108864 + write /dev/ipa 1 + +on late-fs + wait_for_prop hwservicemanager.ready true + exec_start wait_for_keymaster + mount_all /vendor/etc/fstab.qcom --late + +service sec_nvm /vendor/bin/sec_nvm + class core + user system + group system + +on post-fs-data + mkdir /data/tombstones 0771 system system + mkdir /tombstones/modem 0771 system system + mkdir /tombstones/lpass 0771 system system + mkdir /tombstones/wcnss 0771 system system + mkdir /tombstones/dsps 0771 system system + mkdir /data/vendor/hbtp 0750 system system + mkdir /persist/qti_fp 0700 system system + mkdir /data/vendor/nnhal 0700 system system + mkdir /data/vendor/touchpad 0775 system system + + mkdir /data/vendor/thermal 0771 root system + mkdir /data/vendor/thermal/config 0771 root system + mkdir /data/vendor/mac_addr 0771 system system + + mkdir /data/vendor/wlan_logs 0770 system wifi + mkdir /data/vendor/nfc 0770 nfc nfc +# For cpusets initialize for Silver Only first and then Silver + Gold +# Silver Only configuration cannot work with 0-7 +#Creat charger log + mkdir /data/vendor/charge_logger 0771 system system + +on boot + chown system system /sys/kernel/hbtp/display_pwr + start rmt_storage + start rfs_access + write /dev/cpuset/top-app/cpus 0-3 + write /dev/cpuset/foreground/cpus 0-3 + write /dev/cpuset/foreground/boost/cpus 0-3 + write /dev/cpuset/background/cpus 0-3 + write /dev/cpuset/system-background/cpus 0-3 + write /dev/cpuset/top-app/cpus 0-7 + write /dev/cpuset/foreground/cpus 0-7 + write /dev/cpuset/foreground/boost/cpus 0-7 + write /dev/cpuset/background/cpus 0-7 + write /dev/cpuset/system-background/cpus 0-7 + + #Set the vbus_offset_mv to 1.04v + setprop persist.vendor.cp.vbus_offset_mv 1040 + +# Add a cpuset for the camera daemon +# We want all cores for camera + mkdir /dev/cpuset/camera-daemon + write /dev/cpuset/camera-daemon/cpus 0-7 + write /dev/cpuset/camera-daemon/mems 0 + chown cameraserver cameraserver /dev/cpuset/camera-daemon + chown cameraserver cameraserver /dev/cpuset/camera-daemon/tasks + chmod 0660 /dev/cpuset/camera-daemon/tasks + +# access permissions for fingerprint + chown system system /sys/bus/platform/devices/soc/soc:fpc1020/irq + chown system system /sys/bus/platform/devices/soc/soc:fpc1020/wakeup_enable + chown system system /sys/bus/platform/devices/soc/soc:fpc1020/modalias + chmod 0666 /dev/qseecom + chmod 0644 /dev/goodix_fp + chown system system /dev/goodix_fp + +#add runin factory charging test + chmod 0777 /sys/class/power_supply/battery/input_suspend + chmod 0777 /sys/class/power_supply/battery/charging_enabled + chmod 0777 /sys/class/power_supply/usb/typec_cc_orientation + chown system system /sys/class/power_supply/battery/input_suspend + chown system system /sys/class/power_supply/battery/charging_enabled + chown system system /sys/class/power_supply/usb/typec_cc_orientation + + chmod 0666 sys/devices/platform/soc/890000.i2c/i2c-1/1-005a/cali + chmod 0666 sys/devices/platform/soc/890000.i2c/i2c-1/1-005a/cali_save + chmod 0666 sys/devices/platform/soc/890000.i2c/i2c-1/1-005a/f0_save + chmod 0666 sys/devices/platform/soc/890000.i2c/i2c-1/1-005a/osc_save + chmod 0666 sys/devices/platform/soc/890000.i2c/i2c-1/1-005a/osc_cali + +#Load WLAN driver + insmod /vendor/lib/modules/qca_cld3_wlan.ko + +#Load exfat driver + insmod /vendor/lib/modules/exfat.ko + +#USB controller configuration + setprop vendor.usb.rndis.func.name "gsi" + setprop vendor.usb.rmnet.func.name "gsi" + setprop vendor.usb.rmnet.inst.name "rmnet" + setprop vendor.usb.dpl.inst.name "dpl" + setprop vendor.usb.qdss.inst.name "qdss" + +#start camera server as daemon +#service qcamerasvr /system/bin/mm-qcamera-daemon +# class late_start +# user camera +# group camera system inet input graphics +#pd-mapper +service vendor.pd_mapper /vendor/bin/pd-mapper + class core + user system + group system + +#Peripheral manager +service vendor.per_mgr /vendor/bin/pm-service + class core + user system + group system + ioprio rt 4 + +service vendor.per_proxy /vendor/bin/pm-proxy + class core + user system + group system + disabled + + +on property:init.svc.vendor.per_mgr=running + start vendor.per_proxy + +on property:sys.shutdown.requested=* + stop vendor.per_proxy + +on charger + mkdir /mnt/vendor/persist + chown root system /mnt/vendor/persist + chmod 0771 /mnt/vendor/persist + mkdir /mnt/vendor/persist/subsys 0770 root system + start vendor.power_off_alarm + setprop sys.usb.controller a600000.dwc3 + setprop sys.usb.configfs 1 + chown system system /sys/class/leds/red/brightness + chmod 0666 /sys/class/leds/red/brightness + mkdir /data/vendor/charge_logger 0771 system system + start charge_logger + start vendor.power_off_alarm + + #Set the vbus_offset_mv to 1.04v + setprop persist.vendor.cp.vbus_offset_mv 1040 + +on property:vendor.display.lcd_density=640 + setprop dalvik.vm.heapgrowthlimit 512m + +on property:vendor.display.lcd_density=560 + setprop dalvik.vm.heapgrowthlimit 256m + +on property:vendor.display.lcd_density=480 + setprop dalvik.vm.heapgrowthlimit 128m + +on property:vendor.display.lcd_density=240 + setprop dalvik.vm.heapgrowthlimit 96m + +on property:vendor.display.lcd_density=160 + setprop dalvik.vm.heapgrowthlimit 96m + +## import cne init file +#on post-fs +# export LD_PRELOAD /vendor/lib/libNimsWrap.so +# +## Allow usb charging to be disabled peristently +#on property:persist.usb.chgdisabled=1 +# write /sys/class/power_supply/battery/charging_enabled 0 +# +#on property:persist.usb.chgdisabled=0 +# write /sys/class/power_supply/battery/charging_enabled 1 + +# add charge_logger service for dump charge message +service charge_logger /vendor/bin/charge_logger + class last_start + user system + group system system wakelock + disabled + oneshot + +on property:sys.boot_completed=1 + start charge_logger + +#qiaojinpeng @20191118 QR_code feature +service nv_mac /vendor/bin/nv_mac + class late_start + user system + group system inet net_raw wifi + oneshot + +on property:sys.boot_completed=1 + start nv_mac +#end + +service vibrator_calibration /vendor/bin/vibrator_calibration + class late_start + user system + group system + oneshot + +on property:sys.boot_completed=1 + start vibrator_calibration + +service spdaemon /vendor/bin/spdaemon + class core + user system + group system + +#service qosmgrd /system/bin/qosmgr /system/etc/qosmgr_rules.xml +# user system +# group system +# disabled +# + +#service security-check1 /sbin/security_boot_check system +# class core +# oneshot +# +#service security-check2 /sbin/security_boot_check recovery +# class core +# oneshot +# +#service time_daemon /system/vendor/bin/time_daemon +# class late_start +# user root +# group root + +#service audiod /vendor/bin/audiod +# class late_start +# user system +# group system +# +#service usf_tester /vendor/bin/usf_tester +# user system +# group system inet +# disabled +# +#service usf_epos /vendor/bin/usf_epos +# user system +# group system inet +# disabled +# +#service usf_gesture /vendor/bin/usf_gesture +# user system +# group system inet +# disabled +# + +#service usf_sync_gesture /system/bin/usf_sync_gesture +# user system +# group system inet +# disabled +# + +#service usf_p2p /system/bin/usf_p2p +# user system +# group system inet +# disabled +# +#service usf_hovering /vendor/bin/usf_hovering +# user system +# group system inet +# disabled +# +#service usf_proximity /system/bin/usf_proximity +# user system +# group system inet +# disabled +# +#service usf-post-boot /system/vendor/bin/sh /system/etc/usf_post_boot.sh +# class late_start +# user root +# disabled +# oneshot +# +#on property:init.svc.bootanim=stopped +# start usf-post-boot +# +# +#on boot +# insmod /system/lib/modules/adsprpc.ko +# insmod /system/lib/modules/mhi.ko +## access permission for secure touch +# chmod 0660 /sys/devices/f9966000.i2c/i2c-1/1-004a/secure_touch_enable +# chmod 0440 /sys/devices/f9966000.i2c/i2c-1/1-004a/secure_touch +# chmod 0660 /sys/devices/f9966000.i2c/i2c-1/1-0020/secure_touch_enable +# chmod 0440 /sys/devices/f9966000.i2c/i2c-1/1-0020/secure_touch +# chown system drmrpc /sys/devices/f9966000.i2c/i2c-1/1-004a/secure_touch_enable +# chown system drmrpc /sys/devices/f9966000.i2c/i2c-1/1-004a/secure_touch +# chown system drmrpc /sys/devices/f9966000.i2c/i2c-1/1-0020/secure_touch_enable +# chown system drmrpc /sys/devices/f9966000.i2c/i2c-1/1-0020/secure_touch +# +# +# +## imsqmidaemon starts with root and UID will be downgraded to RADIO. +service vendor.imsqmidaemon /system/vendor/bin/imsqmidaemon + class main + user radio + socket ims_qmid stream 0660 system radio + group radio log diag + +# imsdatadaemon starts with root and UID will be downgraded to RADIO. +service vendor.imsdatadaemon /system/vendor/bin/imsdatadaemon + class main + user radio + socket ims_datad stream 0660 system radio + group radio wifi inet log diag + disabled + +#service mdm_helper /system/bin/mdm_helper +# class core +# onrestart setprop ro.service.mdm_helper_restarted "true" +# disabled +# +#service mdm_helper_proxy /system/bin/mdm_helper_proxy +# class core +# disabled +# +#service mdm_launcher /system/bin/sh /init.mdm.sh +# class main +# oneshot +# +#service qcamerasvr /system/bin/mm-qcamera-daemon +# class late_start +# user camera +# group camera system inet input graphics +# +# Stop mdm_helper_proxy in case of shutdown +#on property:sys.shutdown.requested=* +# stop mdm_helper_proxy +# +# Stop mdm_helper_proxy on APQ target +#on property:ro.radio.noril=yes +# stop mdm_helper_proxy +# +#on property:persist.airplane.mode.pwr.svg=enabled +# setprop ro.mdm_helper_proxy_req false +# +#on property:init.svc.ril-daemon=running +# setprop ro.mdm_helper_proxy_req true +# +## Start mdm_helper_proxy +#on property:ro.mdm_helper_proxy_req=true +# start mdm_helper_proxy +# +## QCA1530 SoC core detect +#service gnss-detect /system/vendor/bin/gnss.qca1530.sh detect +# class core +# oneshot +# +## QCA1530 SoC late_start group trigger +#service gnss-init /system/vendor/bin/gnss.qca1530.sh init +# class late_start +# oneshot +# +## QCA1530 SoC Service Daemon +#service gnss-svcd /system/vendor/bin/gnss.qca1530.sh start +# class late_start +# user root +# group gps system qcom_diag diag log inet net_raw +# disabled + +service vendor.imsrcsservice /system/vendor/bin/imsrcsd + class main + user radio + group radio diag inet log + +on property:vendor.ims.QMI_DAEMON_STATUS=1 + start vendor.imsdatadaemon + +#on property:vold.decrypt=trigger_restart_framework +# start vendor.cnss_diag + +service vendor.cnss_diag /system/vendor/bin/cnss_diag -q -f -t HELIUM + class main + user system + group system wifi inet sdcard_rw media_rw diag + disabled + +service vendor.ims_rtp_daemon /system/vendor/bin/ims_rtp_daemon + class main + user radio + group radio vendor_qti_diag inet log + +on property:vendor.ims.DATA_DAEMON_STATUS=1 + restart vendor.ims_rtp_daemon + +service ppd /vendor/bin/mm-pp-dpps + class late_start + user system + group system graphics + socket pps stream 0660 system system + disabled + +on property:init.svc.hwcomposer-2-1=stopped + stop ppd + +on property:init.svc.hwcomposer-2-1=running + start ppd + +on property:init.svc.hwcomposer-2-1=restarting + stop ppd + +on property:ro.boot.multisim_config=* + setprop persist.radio.multisim.config ${ro.boot.multisim_config} + +#service nqs /system/bin/nqs +# class late_start +# socket nqs_qsb_comm stream 660 system system +# user system +# group drmrpc +# +#service adsprpcd /system/vendor/bin/adsprpcd +# class main +# user media +# group media +# +##Start picture quality tuning service +#service vqttoolservice /system/bin/vqttoolservice +# class late_start +# socket vqtss stream 0660 system system +# user system +# group system + +service hbtp /system/vendor/bin/hbtp_daemon + class main + user system + group system + disabled + +service qfp-daemon /vendor/bin/qfp-daemon + class late_start + user system + group system drmrpc diag input + +service energy-awareness /system/vendor/bin/energy-awareness + class main + user system + group system + oneshot + +service smcinvoked /system/bin/smcinvoked + class main + user system + group system + +# smart pa cal add by lct +service smart-pa-cal /vendor/bin/FactoryApp -r -t 25 + user root + group root audio + disabled + oneshot + +on property:odm.pa-cal=0 + stop smart-pa-cal + +on property:odm.pa-cal=1 + start smart-pa-cal + +service smart-pa-test /vendor/bin/FactoryApp -f -t 25 + user root + group root audio + disabled + oneshot + +on property:odm.pa-test=0 + stop smart-pa-test + +on property:odm.pa-test=1 + start smart-pa-test + +service tinyhostless_loop /system/bin/tinyhostless -D 0 -P 30 -C 31 -p 256 -n 2 -c 1 -r 48000 + user root + group root audio + disabled + oneshot + +# Add for mic2 to speaker loopback test lct_20190501 +service tinyhostless_spk /system/bin/tinyhostless -D 0 -P 40 -C 31 -p 256 -n 2 -c 1 -r 48000 + user root + group root audio + disabled + oneshot + +service loopback_spk_start /vendor/bin/loopback.sh 1 1 + user root + group root audio + disabled + oneshot + +service loopback_spk_stop /vendor/bin/loopback.sh 1 0 + user root + group root audio + disabled + oneshot + +on property:odm.loopback-spk=1 + start loopback_spk_start + +on property:odm.loopback-spk=0 + start loopback_spk_stop + +#add thermal call node + +on property:odm.thermallct.isincall=1 + write /sys/class/power_supply/battery/device/thermalcall 1 + +on property:odm.thermallct.isincall=0 + write /sys/class/power_supply/battery/device/thermalcall 0 + +#2019.12.30 tianyajun add pocket mode +on property:odm.pocket.mode.keygurad.locked=1 + write /proc/tp_palm 1 + +on property:odm.pocket.mode.keygurad.locked=0 + write /proc/tp_palm 0 + +#Add tools for wifi RF test and start by dial *#*#2008#*#* on 20191031 +service openwifi_L /vendor/bin/sh /vendor/bin/wifitest.sh + oneshot + disabled + +service closewifi_L /vendor/bin/sh /vendor/bin/wifitest_close.sh + oneshot + disabled + +on property:odm.openwifi_L=1 + start openwifi_L +on property:odm.closewifi_L=1 + start closewifi_L + +service wifiFtmdaemon /vendor/bin/ftmdaemon -dd -n + oneshot + disabled + +on property:vendor.sys.wifiFtmdaemon=1 + start wifiFtmdaemon +on property:vendor.sys.wifiFtmdaemon=0 + stop wifiFtmdaemon + +service myftmftm /vendor/bin/sh /vendor/bin/myftm.agent.sh + oneshot + disabled +on property:vendor.sys.myftm=1 + start myftmftm + +#End on 20191031 + +#add tools for bt RF test and start by dial *#*#2008#*#* on 20191031 +service wdsdaemon /vendor/bin/wdsdaemon -su + user root + group root + oneshot + disabled + +on property:odm.start_wdsdaemon=1 + start wdsdaemon +on property:odm.start_wdsdaemon=0 + stop wdsdaemon + +service blueduttest /vendor/bin/sh /vendor/bin/bluedut.sh + class late_start + user root + group root + disabled + oneshot + +service btclose /vendor/bin/sh /vendor/bin/bt_close.sh + user root + group root + oneshot + disabled + +on property:odm.closebt=1 + start btclose + +#End on 20191031 + +#add for wifi 9434 log +service vendor.tcpdump /system/bin/tcpdump_v2 -i any -W 2 -C 2 -s 134 -w /data/vendor/wlan_logs/tcpdump.pcap + class main + user root + group root wifi inet sdcard_rw media_rw diag + disabled + oneshot + +service sniffer /system/bin/tcpdump_v2 -i wlan0 -w /sdcard/wlan_logs/sniffer.pcap + class main + user root + group root + disabled + oneshot + +on property:sys.user.0.ce_available=true + start vendor.cnss_diag + start vendor.tcpdump + +service startpktlog /system/vendor/bin/iwpriv wlan0 pktlog 2 + class main + user root + group root + disabled + oneshot + +service stoppktlog /system/vendor/bin/iwpriv wlan0 pktlog 0 + class main + user root + group root + disabled + oneshot + + +#lcd feature ++{ +on property:sys.display_hbm=1 + write /sys/devices/platform/soc/soc:qcom,dsi-display/dsi_display_hbm 1 + +on property:sys.display_hbm=2 + write /sys/devices/platform/soc/soc:qcom,dsi-display/dsi_display_hbm 2 + +on property:sys.display_hbm=3 + write /sys/devices/platform/soc/soc:qcom,dsi-display/dsi_display_hbm 3 + +on property:sys.display_hbm=0 + write /sys/devices/platform/soc/soc:qcom,dsi-display/dsi_display_hbm 0 + +#2019.12.02 longcheer zhaoxiangxiang add for cabc start +on property:persist.sys.display_cabc=1 + write /sys/devices/platform/soc/soc:qcom,dsi-display/dsi_display_cabc 1 + +on property:persist.sys.display_cabc=0 + write /sys/devices/platform/soc/soc:qcom,dsi-display/dsi_display_cabc 2 + +on property:persist.sys.display_cabc_movie=1 + write /sys/devices/platform/soc/soc:qcom,dsi-display/dsi_display_cabc_movie 1 + +on property:persist.sys.display_cabc_still=1 + write /sys/devices/platform/soc/soc:qcom,dsi-display/dsi_display_cabc_still 1 +#2019.12.02 longcheer zhaoxiangxiang add for cabc end + +#service sviswitch add begin +service sviswitch /vendor/bin/sviswitch + user root + group root + disabled + oneshot + +#2019.11.27 longcheer xupengcheng edit for sunlight policy +on property:odm.svi.enable=on + start sviswitch + +#2019.11.27 longcheer xupengcheng edit for sunlight policy +on property:odm.svi.enable=off + start sviswitch +#service sviswitch add end +#lcd feature ++} + +# touch settings +on property:vendor.tp_grip_area=90 + write /proc/tp_grip_area 90 +on property:vendor.tp_grip_area=270 + write /proc/tp_grip_area 270 +on property:vendor.tp_grip_area=0 + write /proc/tp_grip_area 0 +on property:vendor.tp_grip_area=1 + write /proc/tp_grip_area 1 +on property:vendor.tp_grip_area=180 + write /proc/tp_grip_area 180 +#2019.11.25 longcheer puqirui add for misound MIUI patch start +service audioshell_service /vendor/bin/audioshell_service + oneshot + disabled + +on property:ro.vendor.miui.region=* + start audioshell_service +#2019.11.25 longcheer puqirui add for misound MIUI patch end