From c1c7c31fba66a7590eb7eccd79502bbb38f7e248 Mon Sep 17 00:00:00 2001 From: dianlujitao Date: Sun, 2 Feb 2020 12:28:00 +0800 Subject: sdm660-common: Update rootdir from LA.UM.8.2.r1-05100-sdm660.0 Change-Id: I341776245fac44fd462756104cf4decb8506d38e --- rootdir/Android.mk | 30 +- rootdir/bin/init.class_main.sh | 170 -- rootdir/bin/init.qcom.post_boot.sh | 4712 ---------------------------- rootdir/bin/init.qcom.sensors.sh | 45 - rootdir/bin/init.qcom.sh | 435 --- rootdir/bin/init.qcom.usb.sh | 265 -- rootdir/etc/init.class_main.sh | 153 + rootdir/etc/init.msm.usb.configfs.rc | 186 +- rootdir/etc/init.qcom.early_boot.sh | 466 +++ rootdir/etc/init.qcom.post_boot.sh | 5607 ++++++++++++++++++++++++++++++++++ rootdir/etc/init.qcom.rc | 309 +- rootdir/etc/init.qcom.sensors.sh | 45 + rootdir/etc/init.qcom.sh | 465 +++ rootdir/etc/init.qcom.usb.rc | 10 +- rootdir/etc/init.qcom.usb.sh | 242 ++ rootdir/etc/init.recovery.qcom.rc | 60 + rootdir/etc/init.target.rc | 82 +- rootdir/etc/ueventd.qcom.rc | 56 +- sdm660.mk | 5 +- 19 files changed, 7384 insertions(+), 5959 deletions(-) delete mode 100644 rootdir/bin/init.class_main.sh delete mode 100644 rootdir/bin/init.qcom.post_boot.sh delete mode 100644 rootdir/bin/init.qcom.sensors.sh delete mode 100644 rootdir/bin/init.qcom.sh delete mode 100644 rootdir/bin/init.qcom.usb.sh create mode 100644 rootdir/etc/init.class_main.sh create mode 100644 rootdir/etc/init.qcom.early_boot.sh create mode 100644 rootdir/etc/init.qcom.post_boot.sh create mode 100644 rootdir/etc/init.qcom.sensors.sh create mode 100644 rootdir/etc/init.qcom.sh create mode 100644 rootdir/etc/init.qcom.usb.sh create mode 100644 rootdir/etc/init.recovery.qcom.rc mode change 100755 => 100644 rootdir/etc/init.target.rc diff --git a/rootdir/Android.mk b/rootdir/Android.mk index ddffd59..499275d 100644 --- a/rootdir/Android.mk +++ b/rootdir/Android.mk @@ -4,18 +4,18 @@ include $(CLEAR_VARS) # files that live under device/qcom/common/rootdir/etc/ include $(CLEAR_VARS) -LOCAL_MODULE := init.qcom.post_boot.sh +LOCAL_MODULE := init.qcom.early_boot.sh LOCAL_MODULE_TAGS := optional LOCAL_MODULE_CLASS := ETC -LOCAL_SRC_FILES := bin/init.qcom.post_boot.sh +LOCAL_SRC_FILES := etc/init.qcom.early_boot.sh LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) include $(BUILD_PREBUILT) include $(CLEAR_VARS) -LOCAL_MODULE := init.qcom.sensors.sh +LOCAL_MODULE := init.qcom.post_boot.sh LOCAL_MODULE_TAGS := optional LOCAL_MODULE_CLASS := ETC -LOCAL_SRC_FILES := bin/init.qcom.sensors.sh +LOCAL_SRC_FILES := etc/init.qcom.post_boot.sh LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) include $(BUILD_PREBUILT) @@ -27,11 +27,19 @@ LOCAL_SRC_FILES := etc/init.qcom.rc LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw include $(BUILD_PREBUILT) +include $(CLEAR_VARS) +LOCAL_MODULE := init.recovery.qcom.rc +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := etc/init.recovery.qcom.rc +LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) +include $(BUILD_PREBUILT) + include $(CLEAR_VARS) LOCAL_MODULE := init.qcom.sh LOCAL_MODULE_TAGS := optional LOCAL_MODULE_CLASS := ETC -LOCAL_SRC_FILES := bin/init.qcom.sh +LOCAL_SRC_FILES := etc/init.qcom.sh LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) include $(BUILD_PREBUILT) @@ -39,7 +47,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := init.class_main.sh LOCAL_MODULE_TAGS := optional LOCAL_MODULE_CLASS := ETC -LOCAL_SRC_FILES := bin/init.class_main.sh +LOCAL_SRC_FILES := etc/init.class_main.sh LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) include $(BUILD_PREBUILT) @@ -63,7 +71,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := init.qcom.usb.sh LOCAL_MODULE_TAGS := optional LOCAL_MODULE_CLASS := ETC -LOCAL_SRC_FILES := bin/init.qcom.usb.sh +LOCAL_SRC_FILES := etc/init.qcom.usb.sh LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) include $(BUILD_PREBUILT) @@ -76,6 +84,14 @@ LOCAL_SRC_FILES := etc/ueventd.qcom.rc LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR) include $(BUILD_PREBUILT) +include $(CLEAR_VARS) +LOCAL_MODULE := init.qcom.sensors.sh +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := etc/init.qcom.sensors.sh +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) +include $(BUILD_PREBUILT) + include $(CLEAR_VARS) LOCAL_MODULE := init.target.rc LOCAL_MODULE_TAGS := optional diff --git a/rootdir/bin/init.class_main.sh b/rootdir/bin/init.class_main.sh deleted file mode 100644 index cee656e..0000000 --- a/rootdir/bin/init.class_main.sh +++ /dev/null @@ -1,170 +0,0 @@ -#! /vendor/bin/sh - -# 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 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 - start vendor.ipacm -esac - -case "$baseband" in - "sa8") - start vendor.ipacm -esac - -case "$baseband" in - "msm" | "csfb" | "svlte2a" | "mdm" | "mdm2" | "sglte" | "sglte2" | "dsda2" | "unknown" | "dsda3") - start vendor.qmuxd -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 - - start vendor.ipacm-diag - start vendor.ipacm - 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 - start vendor.port-bridge - ;; - "concurrent") - start vendor.dataqti - start vendor.dataadpl - start vendor.netmgrd - start vendor.port-bridge - ;; - *) - start vendor.netmgrd - ;; - 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.qcom.post_boot.sh b/rootdir/bin/init.qcom.post_boot.sh deleted file mode 100644 index 992da7f..0000000 --- a/rootdir/bin/init.qcom.post_boot.sh +++ /dev/null @@ -1,4712 +0,0 @@ -#! /vendor/bin/sh - -# Copyright (c) 2012-2013, 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 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_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 device, size = 1GB - # And enable lz4 zram compression for Go targets. - - if [ "$low_ram" == "true" ]; then - echo lz4 > /sys/block/zram0/comp_algorithm - fi - - if [ -f /sys/block/zram0/disksize ]; then - echo 1 > /sys/block/zram0/use_dedup - if [ $MemTotal -le 524288 ]; then - echo 402653184 > /sys/block/zram0/disksize - elif [ $MemTotal -le 1048576 ]; then - echo 805306368 > /sys/block/zram0/disksize - else - # Set Zram disk size=1GB for >=2GB Non-Go targets. - echo 1073741824 > /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" ]; 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 - 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 1 > /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 - setprop ro.vendor.perf.cores_online 2 - ;; - *) - echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor - echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor - echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor - echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor - echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate - echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold - echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy - echo 2 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor - echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential - echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core - echo 3 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core - echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq - echo 960000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq - echo 1190400 > /sys/devices/system/cpu/cpufreq/ondemand/input_boost - echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load - ;; - esac - echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq - echo 300000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq - echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq - echo 300000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq - chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq - chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq - echo 1 > /sys/module/msm_thermal/core_control/enabled - chown -h root.system /sys/devices/system/cpu/mfreq - chmod -h 220 /sys/devices/system/cpu/mfreq - chown -h root.system /sys/devices/system/cpu/cpu1/online - chown -h root.system /sys/devices/system/cpu/cpu2/online - chown -h root.system /sys/devices/system/cpu/cpu3/online - chmod -h 664 /sys/devices/system/cpu/cpu1/online - chmod -h 664 /sys/devices/system/cpu/cpu2/online - chmod -h 664 /sys/devices/system/cpu/cpu3/online - echo 1 > /dev/cpuctl/apps/cpu.notify_on_migrate - ;; -esac - -case "$target" in - "msm8916") - 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" ) - - # 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" ) - - # 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 - if [ "$soc_id" -eq "317" ]; then - start vendor.cdsprpcd - fi - - # 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 - "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 - "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" | "370" | "371" ) - - # Start Host based Touch processing - case "$hw_platform" in - "MTP" | "Surf" | "RCM" | "QRD" | "HDK" ) - 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 - "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 - "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 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 - - # 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 - - # Set Memory parameters - configure_memory_parameters - ;; - 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 - setprop ro.vendor.perf.cores_online 2 - chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq - chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq - chown -h root.system /sys/devices/system/cpu/mfreq - chmod -h 220 /sys/devices/system/cpu/mfreq - chown -h root.system /sys/devices/system/cpu/cpu1/online - chown -h root.system /sys/devices/system/cpu/cpu2/online - chown -h root.system /sys/devices/system/cpu/cpu3/online - chmod -h 664 /sys/devices/system/cpu/cpu1/online - chmod -h 664 /sys/devices/system/cpu/cpu2/online - chmod -h 664 /sys/devices/system/cpu/cpu3/online - ;; -esac - -case "$target" in - "mpq8092") - echo 4 > /sys/module/lpm_levels/enable_low_power/l2 - echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled - echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled - echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled - echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled - echo 1 > /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled - echo 1 > /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled - echo 1 > /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled - echo 1 > /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled - echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled - echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled - echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled - echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled - echo 1 > /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled - echo 1 > /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled - echo 1 > /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled - echo 1 > /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled - echo 1 > /sys/module/msm_pm/modes/cpu0/retention/idle_enabled - echo 1 > /sys/module/msm_pm/modes/cpu1/retention/idle_enabled - echo 1 > /sys/module/msm_pm/modes/cpu2/retention/idle_enabled - echo 1 > /sys/module/msm_pm/modes/cpu3/retention/idle_enabled - echo 0 > /sys/module/msm_thermal/core_control/enabled - echo 1 > /sys/devices/system/cpu/cpu1/online - echo 1 > /sys/devices/system/cpu/cpu2/online - echo 1 > /sys/devices/system/cpu/cpu3/online - echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor - echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor - echo "ondemand" > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor - echo "ondemand" > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor - echo 50000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate - echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold - echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy - echo 300000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq - echo 300000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq - echo 300000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq - echo 300000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq - echo 1 > /sys/module/msm_thermal/core_control/enabled - chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq - chown -h system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq - chown -h root.system /sys/devices/system/cpu/mfreq - chmod -h 220 /sys/devices/system/cpu/mfreq - chown -h root.system /sys/devices/system/cpu/cpu1/online - chown -h root.system /sys/devices/system/cpu/cpu2/online - chown -h root.system /sys/devices/system/cpu/cpu3/online - chmod -h 664 /sys/devices/system/cpu/cpu1/online - chmod -h 664 /sys/devices/system/cpu/cpu2/online - chmod -h 664 /sys/devices/system/cpu/cpu3/online - ;; -esac - -case "$target" in - "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/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 - - echo 0 > /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 - ;; - "msm8916") - setprop vendor.post_boot.parsed 1 - - if [ -f /sys/devices/soc0/soc_id ]; then - soc_id=`cat /sys/devices/soc0/soc_id` - else - soc_id=`cat /sys/devices/system/soc/soc0/id` - fi - case $soc_id in - "239" | "241" | "263" | "268" | "269" | "270" | "271") - setprop vendor.min_freq_0 960000 - setprop vendor.min_freq_4 800000 - ;; - "206" | "247" | "248" | "249" | "250" | "233" | "240" | "242") - setprop vendor.min_freq_0 800000 - ;; - esac - ;; - "msm8909") - setprop vendor.post_boot.parsed 1 - ;; - "msm8952") - setprop vendor.post_boot.parsed 1 - ;; - "msm8937" | "msm8953") - setprop vendor.post_boot.parsed 1 - - low_ram_enable=`getprop ro.config.low_ram` - - if [ "$low_ram_enable" != "true" ]; then - start gamed - fi - ;; - "msm8974") - start mpdecision - echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb - ;; - "msm8994" | "msm8992" | "msm8996" | "msm8998" | "sdm660" | "apq8098_latv" | "sdm845" | "sdm710" | "msmnile" | "qcs605" | "sm6150" | "trinket") - 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 - -product=`getprop ro.build.product` -case "$product" in - "msmnile_au") - #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)) - - if [ $feature_id == 0 ]; then - echo "feature_id is 0 for SA8155" - echo 1036800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq - echo 1036800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq - echo 1036800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq - echo 1036800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq - echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq - echo 1056000 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq - echo 1056000 > /sys/devices/system/cpu/cpu6/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 - echo 1785600 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq - echo 1785600 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq - echo 1785600 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq - echo 2131200 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq - echo 2131200 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq - echo 2131200 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq - echo 2419200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq - echo 4 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel - echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel - elif [ $feature_id == 1 ]; then - echo "feature_id is 1 for SA8150" - echo 1036800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq - echo 1036800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq - echo 1036800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq - echo 1036800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq - echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq - echo 1056000 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq - echo 1056000 > /sys/devices/system/cpu/cpu6/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 - echo 1785600 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq - echo 1785600 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq - echo 1785600 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq - echo 1920000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq - echo 1920000 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq - echo 1920000 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq - echo 2227200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq - echo 4 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel - echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel - else - echo "unknown feature_id value" $feature_id - fi - ;; - *) - ;; -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 - -# 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.sensors.sh b/rootdir/bin/init.qcom.sensors.sh deleted file mode 100644 index daf7de2..0000000 --- a/rootdir/bin/init.qcom.sensors.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/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 deleted file mode 100644 index 1b811c3..0000000 --- a/rootdir/bin/init.qcom.sh +++ /dev/null @@ -1,435 +0,0 @@ -#! /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_irqbalance660() -{ - if [ -f /vendor/bin/msm_irqbalance ]; then - case "$platformid" in - "317" | "324" | "325" | "326" | "345" | "346") - 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" | "385" ) - 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") - 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 - ;; - "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" | "370" | "371" ) - 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 deleted file mode 100644 index b332530..0000000 --- a/rootdir/bin/init.qcom.usb.sh +++ /dev/null @@ -1,265 +0,0 @@ -#!/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 -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 - "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 - ;; - "msm8996") - if [ -d /config/usb_gadget ]; then - setprop persist.vendor.usb.config diag,serial_cdev,rmnet,adb - else - setprop persist.vendor.usb.config diag,serial_cdev,serial_tty,rmnet_ipa,mass_storage,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") - setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,qdss,adb - ;; - *) - 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 - else - case "$soc_id" in - "313" | "320") - setprop vendor.usb.rndis.func.name "rndis_bam" - setprop vendor.usb.rmnet.func.name "rmnet_bam" - setprop vendor.usb.rmnet.inst.name "rmnet" - setprop vendor.usb.dpl.inst.name "dpl" - ;; - *) - ;; - esac - fi -fi - -if [ "$target" == "msm8996" ]; then - if [ -d /config/usb_gadget ]; then - setprop vendor.usb.rndis.func.name "rndis_bam" - setprop vendor.usb.rmnet.func.name "rmnet_bam" - setprop vendor.usb.rmnet.inst.name "rmnet" - setprop vendor.usb.dpl.inst.name "dpl" - fi -fi - -# check configfs is mounted or not -if [ -d /config/usb_gadget ]; then - product_string=`cat /config/usb_gadget/g1/strings/0x409/product` 2> /dev/null - if [ "product_string" == "" ]; 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 - fi - - # 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 -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/etc/init.class_main.sh b/rootdir/etc/init.class_main.sh new file mode 100644 index 0000000..35e72ef --- /dev/null +++ b/rootdir/etc/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/etc/init.msm.usb.configfs.rc b/rootdir/etc/init.msm.usb.configfs.rc index 2936a14..4b49ccd 100644 --- a/rootdir/etc/init.msm.usb.configfs.rc +++ b/rootdir/etc/init.msm.usb.configfs.rc @@ -205,24 +205,12 @@ on property:sys.usb.config=rndis,none && property:sys.usb.configfs=1 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 - rm /config/usb_gadget/g2/configs/b.1/f2 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,rmnet,sec && property:sys.usb.configfs=1 - write /config/usb_gadget/g2/configs/b.1/strings/0x409/configuration "rndis_rmnet" - rm /config/usb_gadget/g2/configs/b.1/f1 - rm /config/usb_gadget/g2/configs/b.1/f2 - write /config/usb_gadget/g2/idVendor 0x05C6 - write /config/usb_gadget/g2/idProduct 0x90F1 - symlink /config/usb_gadget/g2/functions/rndis.rndis /config/usb_gadget/g2/configs/b.1/f1 - symlink /config/usb_gadget/g2/functions/${vendor.usb.rmnet.func.name}.rmnet /config/usb_gadget/g2/configs/b.1/f2 - 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 @@ -422,9 +410,9 @@ on property:sys.usb.config=diag,qdss && property:sys.usb.configfs=1 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.qdss/enable_debug_inface 1 + 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.qdss /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/f2 write /config/usb_gadget/g1/UDC ${sys.usb.controller} setprop sys.usb.state ${sys.usb.config} @@ -444,9 +432,9 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,qdss,adb && prop 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.qdss/enable_debug_inface 1 + 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.qdss /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/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} @@ -464,9 +452,9 @@ on property:sys.usb.config=diag,qdss,rmnet && property:sys.usb.configfs=1 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.qdss/enable_debug_inface 1 + 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.qdss /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/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} @@ -487,9 +475,9 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,qdss,rmnet,adb & 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.qdss/enable_debug_inface 1 + 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.qdss /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/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} @@ -508,10 +496,10 @@ on property:sys.usb.config=rndis,diag,qdss && property:sys.usb.configfs=1 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.qdss/enable_debug_inface 1 + 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.qdss /config/usb_gadget/g1/configs/b.1/f3 + 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} @@ -531,10 +519,10 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,diag,qdss,adb & 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.qdss/enable_debug_inface 1 + 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.qdss /config/usb_gadget/g1/configs/b.1/f3 + 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} @@ -944,7 +932,7 @@ on property:sys.usb.config=diag,serial_cdev,rmnet,dpl,qdss && property:sys.usb.c 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.qdss /config/usb_gadget/g1/configs/b.1/f5 + 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} @@ -968,7 +956,7 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,serial_cdev,rmne 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.qdss /config/usb_gadget/g1/configs/b.1/f5 + 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} @@ -1217,6 +1205,152 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,diag_mdm,adb && 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 0x18d1 write /config/usb_gadget/g1/idProduct 0x4ee7 diff --git a/rootdir/etc/init.qcom.early_boot.sh b/rootdir/etc/init.qcom.early_boot.sh new file mode 100644 index 0000000..5224b06 --- /dev/null +++ b/rootdir/etc/init.qcom.early_boot.sh @@ -0,0 +1,466 @@ +#! /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 + ;; + "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/etc/init.qcom.post_boot.sh b/rootdir/etc/init.qcom.post_boot.sh new file mode 100644 index 0000000..8dd85a8 --- /dev/null +++ b/rootdir/etc/init.qcom.post_boot.sh @@ -0,0 +1,5607 @@ +#! /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_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 + 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 1 > /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 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: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 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-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 + + +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 4 > /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 off sleep modes till bring up + # sleep modes to be enabled after bring up + echo 1 > /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 + ;; +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" | "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 + +product=`getprop ro.build.product` +case "$product" in + "msmnile_au") + #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)) + + if [ $feature_id == 0 ]; then + echo "feature_id is 0 for SA8155" + echo 1036800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 1036800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq + echo 1036800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq + echo 1036800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq + echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 1056000 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq + echo 1056000 > /sys/devices/system/cpu/cpu6/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 + echo 1785600 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq + echo 1785600 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq + echo 1785600 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq + echo 2131200 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + echo 2131200 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq + echo 2131200 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq + echo 2419200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq + echo 4 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel + echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel + elif [ $feature_id == 1 ]; then + echo "feature_id is 1 for SA8150" + echo 1036800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 1036800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq + echo 1036800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq + echo 1036800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq + echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 1056000 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq + echo 1056000 > /sys/devices/system/cpu/cpu6/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 + echo 1785600 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq + echo 1785600 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq + echo 1785600 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq + echo 1920000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + echo 1920000 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq + echo 1920000 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq + echo 2227200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq + echo 4 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel + echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel + else + echo "unknown feature_id value" $feature_id + fi + ;; + *) + ;; +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/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index c039fa2..426ea48 100644 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -66,9 +66,12 @@ 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 @@ -93,6 +96,9 @@ on early-boot 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 @@ -107,7 +113,6 @@ on boot 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/kernel/boot_adsp/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 @@ -127,15 +132,11 @@ on boot chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo chmod 0660 /sys/class/rfkill/rfkill0/device/extldo - #Create QMUX deamon socket area + # 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 /dev/socket/qmux_audio 0770 media audio - chmod 2770 /dev/socket/qmux_audio - mkdir /dev/socket/qmux_bluetooth 0770 bluetooth bluetooth - chmod 2770 /dev/socket/qmux_bluetooth - mkdir /dev/socket/qmux_gps 0770 gps gps - chmod 2770 /dev/socket/qmux_gps mkdir /persist/drm 0770 system system mkdir /mnt/vendor/persist/bluetooth 0770 bluetooth bluetooth @@ -143,24 +144,26 @@ on boot mkdir /mnt/vendor/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 NETMGR daemon socket area - mkdir /dev/socket/netmgr 0750 radio radio + #Create WIGIG socket area + mkdir /dev/socket/wigig 0770 wifi wifi setprop wifi.interface wlan0 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 - # Assign TCP buffer thresholds to be ceiling value of technology maximums - # Increased technology maximums should be reflected here. - write /proc/sys/net/core/rmem_max 16777216 - write /proc/sys/net/core/wmem_max 8388608 + setprop net.tcp.2g_init_rwnd 10 # To prevent out of order acknowledgements from making # connection tracking to treat them as not belonging to @@ -180,13 +183,20 @@ on boot # 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 @@ -210,6 +220,10 @@ on boot # Create hvdcp_opti directory mkdir /mnt/vendor/persist/hvdcp_opti 0770 root system + #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 @@ -226,12 +240,6 @@ on post-fs-data # Create directory used by media clients mkdir /data/vendor/media 0770 mediacodec media - # create QDMA dropbox - mkdir /data/vendor/qdmastats 0700 system system - mkdir /data/vendor/qdma 0770 system system - mkdir /dev/socket/qdma 0777 system system - chmod 2777 /dev/socket/qdma - # Create /data/vendor/tzstorage directory for SFS listener mkdir /data/vendor/tzstorage 0770 system system @@ -241,8 +249,10 @@ on post-fs-data #Create folder of camera mkdir /data/vendor/camera 0770 camera camera - #Change ownership to system - chown system system /data/vendor/tombstones + + #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 @@ -258,21 +268,8 @@ on post-fs-data mkdir /data/vendor/wifi/wpa 0770 wifi wifi mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi - #create port-bridge log dir - mkdir /data/vendor/port_bridge 0770 radio radio - chmod 0770 /data/vendor/port_bridge - - #create netmgr log dir - mkdir /data/vendor/netmgr 0770 radio radio - chmod 0770 /data/vendor/netmgr - - #create ipacm log dir - mkdir /data/vendor/ipa 0770 radio radio - chmod 0770 /data/vendor/ipa - - #Create QTI dir for logs - mkdir /data/vendor/dataqti 0770 radio radio - chmod 0770 /data/vendor/dataqti + # 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 @@ -287,6 +284,7 @@ on post-fs-data # 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 @@ -308,6 +306,7 @@ on post-fs-data 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 @@ -317,18 +316,17 @@ on post-fs-data mkdir /dev/socket/location 0770 gps gps mkdir /dev/socket/location/mq 0770 gps gps mkdir /dev/socket/location/xtra 0770 gps gps - mkdir /data/vendor/location-partner 0770 gps gps - mkdir /data/vendor/location-partner/dre 0770 gps gps - mkdir /data/vendor/location-partner/ppe 0770 gps gps - mkdir /dev/socket/location 0770 gps gps - mkdir /dev/socket/location/ehub 0770 gps gps + + #Create directories for wifihal services + mkdir /dev/socket/wifihal 0770 wifi wifi + chmod 2770 /dev/socket/wifihal # Create /data/time folder for time-services mkdir /data/vendor/time/ 0700 system system setprop vold.post_fs_data_done 1 - # Create FM dir for patchdownloader + #Create FM dir for patchdownloader mkdir /data/vendor/fm 0770 system system chmod 0770 /data/vendor/fm @@ -380,7 +378,7 @@ on post-fs-data mkdir /data/vendor/vpp 0770 media media #Create dir for TUI - mkdir /data/vendor/tui 0700 system system + mkdir /data/vendor/tui 0700 system drmrpc #Start move time data to /data/vendor once post-fs-data done start vendor.move_time_data @@ -432,17 +430,17 @@ on property:ro.vendor.iocgrp.config=1 write /dev/blkio/blkio.weight 1000 write /dev/blkio/bg/blkio.weight 100 -on property:persist.vendor.sys.ssr.enable_debug=* - write /sys/module/subsystem_restart/parameters/enable_debug ${persist.vendor.sys.ssr.enable_debug} +on property:persist.sys.ssr.enable_debug=* + write /sys/module/subsystem_restart/parameters/enable_debug ${persist.sys.ssr.enable_debug} -on property:persist.vendor.sys.mba_boot_timeout=* - write /sys/module/pil_msa/parameters/pbl_mba_boot_timeout_ms ${persist.vendor.sys.mba_boot_timeout} +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.vendor.sys.modem_auth_timeout=* - write /sys/module/pil_msa/parameters/modem_auth_timeout_ms ${persist.vendor.sys.modem_auth_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.vendor.sys.pil_proxy_timeout=* - write /sys/module/peripheral_loader/parameters/proxy_timeout_ms ${persist.vendor.sys.pil_proxy_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 @@ -455,11 +453,18 @@ on property:persist.vendor.ssr.enable_ramdumps=1 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 and dm-1 to 512kb + #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 @@ -487,18 +492,15 @@ on property:vendor.bluetooth.dun.status=stopped on property:ro.bluetooth.ftm_enabled=true start ftmd -on property:vendor.bluetooth.startbtsnoop=true - start vendor.btsnoop - -on property:vendor.bluetooth.startbtsnoop=false - stop vendor.btsnoop - 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 @@ -507,17 +509,12 @@ service qcom-c_core-sh /vendor/bin/init.qcom.class_core.sh service qcom-c_main-sh /vendor/bin/init.class_main.sh class main user root - oneshot - -service qcom-c_late-sh /vendor/bin/init.class_late.sh - class late_start - user root + group root system oneshot on property:vold.decrypt=trigger_restart_framework start qcom-c_main-sh start wcnss-service - start qcom-c_late-sh on property:persist.env.fastdorm.enabled=true setprop persist.radio.data_no_toggle 1 @@ -533,29 +530,6 @@ service irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config" user root oneshot -service vendor.rmt_storage /vendor/bin/rmt_storage - class core - user root - shutdown critical - ioprio rt 0 - -service vendor.tftp_server /vendor/bin/tftp_server - class core - user root - -on property:vendor.wc_transport.start_hci=true - start vendor.start_hci_filter - -on property:vendor.wc_transport.start_hci=false - stop vendor.start_hci_filter - -service vendor.start_hci_filter /system/vendor/bin/wcnss_filter - class late_start - user bluetooth - group bluetooth diag system wakelock - seclabel u:r:bluetooth:s0 - disabled - service vendor.bt-dun /system/bin/dun-server /dev/smd7 /dev/rfcomm0 class late_start user bluetooth @@ -563,13 +537,6 @@ service vendor.bt-dun /system/bin/dun-server /dev/smd7 /dev/rfcomm0 disabled oneshot -service vendor.btsnoop /system/bin/btsnoop - user bluetooth - group bluetooth net_bt_admin sdcard_rw sdcard_r media_rw - class late_start - disabled - oneshot - service vendor.bt_logger /system/bin/bt_logger user bluetooth group bluetooth net_bt_admin sdcard_rw sdcard_r media_rw @@ -584,60 +551,17 @@ service ftmd /system/bin/logwrapper /system/bin/ftmdaemon disabled oneshot -service vendor.port-bridge /system/vendor/bin/port-bridge - class main - user radio - group radio system inet - disabled - oneshot - service qmiproxy /system/bin/qmiproxy class main user radio group radio diag disabled -# QMUX must be in multiple groups to support external process connections -service vendor.qmuxd /system/vendor/bin/qmuxd - class main - user root - group radio audio bluetooth gps nfc diag - disabled - -service vendor.netmgrd /system/vendor/bin/netmgrd - class main - disabled - -service vendor.ipacm-diag /system/vendor/bin/ipacm-diag - class main - user radio - socket ipacm_log_file dgram 660 radio radio - group radio diag oem_2901 - disabled - -service vendor.ipacm /system/vendor/bin/ipacm - class main - user radio - group radio inet - disabled - -service vendor.dataqti /system/vendor/bin/qti - class main - user radio - group radio oem_2901 diag usb net_admin - disabled - -service vendor.dataadpl /system/vendor/bin/adpl - class main - user radio - group radio oem_2901 diag usb net_admin - disabled - -service vendor.sensors /vendor/bin/sscrpcd - class core +service vendor.sensors /vendor/bin/sscrpcd sensorspd + class early_hal user system - group system - disabled + group system wakelock + capabilities BLOCK_SUSPEND service vendor.sensors.qti /vendor/bin/sensors.qti class core @@ -645,10 +569,6 @@ service vendor.sensors.qti /vendor/bin/sensors.qti group system disabled -on property:ro.vendor.use_data_netmgrd=false - # netmgr not supported on specific target - stop vendor.netmgrd - # 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 @@ -666,7 +586,6 @@ service wpa_supplicant /vendor/bin/hw/wpa_supplicant \ # group wifi inet keystore interface android.hardware.wifi.supplicant@1.0::ISupplicant default interface android.hardware.wifi.supplicant@1.1::ISupplicant default - interface android.hardware.wifi.supplicant@1.2::ISupplicant default class main socket vendor_wpa_wlan0 dgram 660 wifi wifi disabled @@ -676,14 +595,14 @@ 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:wpa_wigig0 \ + -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 wpa_wigig0 dgram 660 wifi wifi + socket wigig/wpa_wigig0 dgram 660 wifi wifi disabled oneshot @@ -695,41 +614,23 @@ service vendor.move_wifi_data /system/bin/move_wifi_data.sh disabled oneshot -# FST Manager with hostapd (softap) - all settings inside ini file -service fstman /vendor/bin/fstman -B -ddd -c /data/vendor/wifi/fstman.ini -a 1 - user wifi - group wifi - capabilities NET_ADMIN NET_RAW - class main - disabled - oneshot - -# FST Manager with supplicant - connect to supplicant socket -service fstman_wlan0 /vendor/bin/fstman -B -ddd -c /data/vendor/wifi/fstman.ini \ - -a 0 @android:vendor_wpa_wlan0 - user wifi - group wifi - capabilities NET_ADMIN NET_RAW - class main - disabled - oneshot - -service wigighalsvc /vendor/bin/wigighalsvc - interface vendor.qti.hardware.wigig.supptunnel@1.0::ISuppTunnelProvider default +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 - # needed for on-demand insmod/rmmod of wigig module - capabilities SYS_MODULE + capabilities NET_ADMIN disabled -service wigignpt /vendor/bin/wigignpt - interface vendor.qti.hardware.wigig.netperftuner@1.0::INetPerfTuner default +on property:persist.vendor.wigig.npt.enable=1 + start wigignpt + +service vendor.sensingdaemon /vendor/bin/sensingdaemon class hal - socket wigignpt stream 660 system wifi + socket wigig/sensingdaemon stream 660 system wifi user system group wifi - capabilities NET_ADMIN disabled service dhcpcd_wlan0 /system/bin/dhcpcd -ABKLG @@ -795,18 +696,6 @@ service wifi_ftmd /system/vendor/bin/wifi_ftmd on property:vendor.wifi.ftmd.load=true insmod /system/lib/modules/pronto/pronto_wlan.ko con_mode=5 -on property:persist.vendor.data.shs_ko_load=1 - exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -a -d /vendor/lib/modules rmnet_shs - -on property:persist.vendor.data.shs_ko_load=0 - exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -r -d /vendor/lib/modules rmnet_shs - -on property:persist.vendor.data.perf_ko_load=1 - exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -a -d /vendor/lib/modules rmnet_perf - -on property:persist.vendor.data.perf_ko_load=0 - exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -r -d /vendor/lib/modules rmnet_perf - service cnss-daemon /system/vendor/bin/cnss-daemon -n -l class late_start user system @@ -845,11 +734,6 @@ service mlid /vendor/bin/mlid group gps socket mlid stream 0666 gps gps -service vendor.qdmastatsd /system/vendor/bin/qdmastatsd - class late_start - user system - group readproc system net_bw_stats radio vendor_rfs_shared - service loc_launcher /system/vendor/bin/loc_launcher class late_start user gps @@ -929,10 +813,8 @@ service vendor.atfwd /vendor/bin/ATFWD-daemon class late_start user system group system radio - disabled service hostapd_fst /vendor/bin/hw/hostapd -dd -g /data/vendor/wifi/hostapd/global - interface android.hardware.wifi.hostapd@1.0::IHostapd default class main capabilities NET_ADMIN NET_RAW user wifi @@ -985,10 +867,12 @@ service profiler_daemon /system/bin/profiler_daemon group root disabled -service charger /charger +service charger /system/bin/charger class charger - group system graphics - seclabel u:r:healthd:s0 + 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 @@ -1107,14 +991,25 @@ service poweroffhandler /system/vendor/bin/poweroffhandler disabled oneshot - on property:vendor.display.lcd_density=* setprop ro.sf.lcd_density ${vendor.display.lcd_density} -service vendor.vppservice /vendor/bin/vppservice +# 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 media - group camera + user system + group system + capabilities SYS_TIME # Set vendor-ril lib path based on Meta version on property:vendor.rild.libpath=* @@ -1155,7 +1050,6 @@ service chre /vendor/bin/chre socket chre seqpacket 0660 root system shutdown critical - on property:vendor.chre.enabled=0 stop chre @@ -1173,18 +1067,12 @@ on property:vendor.opengles.version=* on property:vendor.gpu.available_frequencies=* setprop ro.vendor.gpu.available_frequencies ${vendor.gpu.available_frequencies} -service vendor.wifilearner /system/vendor/bin/wifilearner - class main - user wifi - group wifi - oneshot - 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 system + 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 @@ -1192,6 +1080,7 @@ service vendor.audio-hal-2-0 /vendor/bin/hw/android.hardware.audio@2.0-service # and its .rc file has an "onrestart restart audio-hal" rule, thus # an additional auto-restart from the init process isn't needed. 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 diff --git a/rootdir/etc/init.qcom.sensors.sh b/rootdir/etc/init.qcom.sensors.sh new file mode 100644 index 0000000..daf7de2 --- /dev/null +++ b/rootdir/etc/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/etc/init.qcom.sh b/rootdir/etc/init.qcom.sh new file mode 100644 index 0000000..02c0394 --- /dev/null +++ b/rootdir/etc/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/etc/init.qcom.usb.rc b/rootdir/etc/init.qcom.usb.rc index cd85142..f2c3b0a 100644 --- a/rootdir/etc/init.qcom.usb.rc +++ b/rootdir/etc/init.qcom.usb.rc @@ -1,4 +1,4 @@ -# Copyright (c) 2011-2016, 2018 The Linux Foundation. All rights reserved. +# 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: @@ -30,7 +30,7 @@ on charger 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 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} @@ -73,6 +73,7 @@ on boot 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 @@ -102,7 +103,7 @@ on boot 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.usb.mtp.device_type 2 + setprop sys.mtp.device_type 2 setprop vendor.usb.controller ${sys.usb.controller} enable vendor.qcom-usb-sh @@ -118,6 +119,9 @@ on property:persist.vendor.usb.config=* 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: # diff --git a/rootdir/etc/init.qcom.usb.sh b/rootdir/etc/init.qcom.usb.sh new file mode 100644 index 0000000..caa7052 --- /dev/null +++ b/rootdir/etc/init.qcom.usb.sh @@ -0,0 +1,242 @@ +#!/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 +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") + setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,qdss,adb + ;; + *) + 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 + product_string=`cat /config/usb_gadget/g1/strings/0x409/product` 2> /dev/null + if [ "product_string" == "" ]; 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 + fi + + # 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/etc/init.recovery.qcom.rc b/rootdir/etc/init.recovery.qcom.rc new file mode 100644 index 0000000..71e6ce7 --- /dev/null +++ b/rootdir/etc/init.recovery.qcom.rc @@ -0,0 +1,60 @@ +# Copyright (c) 2017-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. +# + +on init + write /sys/class/backlight/panel0-backlight/brightness 200 + + mkdir /config + mount configfs none /config + mkdir /config/usb_gadget/g1 0770 shell shell + write /config/usb_gadget/g1/bcdUSB 0x0200 + write /config/usb_gadget/g1/idVendor 0x18d1 + write /config/usb_gadget/g1/idProduct 0xd001 + mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell + 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/ffs.adb + write /config/usb_gadget/g1/os_desc/use 1 + write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 + write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" + setprop sys.usb.configfs 1 + +on property:ro.boot.usbcontroller=* + setprop sys.usb.controller ${ro.boot.usbcontroller} + +on property:sys.usb.ffs.ready=1 + mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell + symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 + mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb" + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + +on fs + wait /dev/block/platform/soc/${ro.boot.bootdevice} + symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice diff --git a/rootdir/etc/init.target.rc b/rootdir/etc/init.target.rc old mode 100755 new mode 100644 index 433a0b2..83f0499 --- a/rootdir/etc/init.target.rc +++ b/rootdir/etc/init.target.rc @@ -27,11 +27,6 @@ # # -on early-init - mkdir /firmware 0771 system system - mkdir /bt_firmware 0771 system system - mkdir /dsp 0771 media media - on init write /dev/stune/foreground/schedtune.sched_boost_no_override 1 write /dev/stune/top-app/schedtune.sched_boost_no_override 1 @@ -53,11 +48,9 @@ on fs restorecon_recursive /mnt/vendor/persist write /sys/kernel/boot_adsp/boot 1 - chmod 0664 /sys/class/thermal/thermal_message/sconfig - chown system system /sys/class/thermal/thermal_message/sconfig - on post-fs start vendor.qseecomd + exec - system system -- /vendor/bin/init.qti.qseecomd.sh write /dev/ipa 1 on init @@ -68,10 +61,7 @@ on post-fs-data mkdir /data/tombstones/lpass 0771 system system mkdir /data/tombstones/wcnss 0771 system system mkdir /data/tombstones/dsps 0771 system system -#D2SP has no hbtp feature -# mkdir /data/vendor/hbtp 0750 system system -#end - mkdir /data/vendor/tloc 0700 system drmrpc + mkdir /data/vendor/hbtp 0750 system system on boot start rmt_storage @@ -81,22 +71,36 @@ on boot write /dev/cpuset/foreground/boost/cpus 0-7 write /dev/cpuset/background/cpus 0-7 write /dev/cpuset/system-background/cpus 0-7 - chown system system /mnt/vendor/persist/sensors/sns.reg -#spk pa-cal lct-20180914 - chmod 0664 /dev/tiload_node + ####Regionalization config and prop files#### + chmod 0644 /persist/speccfg/spec + chmod 0644 /persist/speccfg/devicetype + chmod 0644 /persist/speccfg/mbnversion + chmod 0644 /persist/speccfg/.not_triggered + chmod 0644 /persist/speccfg/vendor_ro.prop + chmod 0644 /persist/speccfg/vendor_persist.prop + chmod 0644 /persist/speccfg/submask + chmod 0644 /persist/speccfg/partition + chown system system /persist/speccfg/spec + chown system system /persist/speccfg/devicetype + chown system system /persist/speccfg/mbnversion + chown system system /persist/speccfg/.not_triggered + chown system system /persist/speccfg/vendor_ro.prop + chown system system /persist/speccfg/vendor_persist.prop + chown system system /persist/speccfg/submask + chown system system /persist/speccfg/partition #Create folder dump yuv images while debugging mkdir /data/vendor/camera 0770 camera camera -# DT2W - chown system system /proc/wake_node - chmod 0660 /proc/wake_node +#Load WLAN driver + insmod /vendor/lib/modules/qca_cld3_wlan.ko #USB controller configuration setprop vendor.usb.rndis.func.name "rndis_bam" setprop vendor.usb.rmnet.func.name "rmnet_bam" setprop vendor.usb.rmnet.inst.name "rmnet" setprop vendor.usb.dpl.inst.name "dpl" + setprop vendor.usb.qdss.inst.name "qdss" write /sys/module/usb_f_qcrndis/parameters/rndis_dl_max_xfer_size 15916 setprop sys.usb.configfs 1 @@ -151,16 +155,11 @@ on property:sys.shutdown.requested=* #on property:sys.boot_completed=1 # start qrngp # - service vendor.qseecomd /vendor/bin/qseecomd class core user root group root -#service mpdecision /system/vendor/bin/mpdecision --avg_comp -# user root -# disabled -# #service qosmgrd /system/bin/qosmgr /system/etc/qosmgr_rules.xml # user system # group system @@ -183,11 +182,6 @@ service thermal-engine /system/vendor/bin/thermal-engine # class core # oneshot # -service time_daemon /vendor/bin/time_daemon - class main - user system - group system - capabilities SYS_TIME service adsprpcd_root /vendor/bin/adsprpcd class main @@ -199,13 +193,11 @@ service adsprpcd /vendor/bin/adsprpcd audiopd user media group media -#D2SP has no hbtp feature -#service hbtp /system/vendor/bin/hbtp_daemon -# class main -# user system -# group system -# disabled -#end +service hbtp /system/vendor/bin/hbtp_daemon + class main + user system + group system + disabled service audiod /system/vendor/bin/audiod class late_start @@ -367,14 +359,14 @@ service vendor.pd_mapper /system/vendor/bin/pd-mapper on property:vendor.ims.QMI_DAEMON_STATUS=1 start vendor.imsdatadaemon -#on property:vold.decrypt=trigger_restart_framework -# start cnss_diag +on property:vold.decrypt=trigger_restart_framework + start cnss_diag service 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 + oneshot service vendor.ims_rtp_daemon /system/vendor/bin/ims_rtp_daemon class main @@ -447,23 +439,9 @@ service seempd /system/bin/seempd group system sdcard_rw socket seempdw dgram 0666 system system -service vendor.tlocd /vendor/bin/tloc_daemon - class late_start - user system - group drmrpc gps net_raw - service vendor.hvdcp_opti /system/vendor/bin/hvdcp_opti class main user root group system wakelock -service smcinvoked /system/bin/smcinvoked - class main - user system - group system - -on property:persist.sys.display_srgb=1 - write /sys/class/graphics/fb0/msm_fb_srgb 1 -on property:persist.sys.display_srgb=2 - write /sys/class/graphics/fb0/msm_fb_srgb 2 diff --git a/rootdir/etc/ueventd.qcom.rc b/rootdir/etc/ueventd.qcom.rc index 72f85cc..8677655 100644 --- a/rootdir/etc/ueventd.qcom.rc +++ b/rootdir/etc/ueventd.qcom.rc @@ -55,8 +55,8 @@ firmware_directories /vendor/firmware_mnt/image/ /dev/dpl_ctrl 0660 usb usb /dev/ipa_odl_ctl 0660 radio radio /dev/ipa_adpl 0660 system oem_2905 -/dev/hab 0666 system system /dev/synx_device 0660 root camera +/dev/hab 0666 system system #permissions for CSVT /dev/smd11 0660 radio radio @@ -124,22 +124,27 @@ firmware_directories /vendor/firmware_mnt/image/ /dev/at_usb0 0640 radio radio /dev/at_mdm0 0640 radio radio /dev/video* 0660 system camera +/dev/cvp* 0660 system camera /dev/media* 0660 system camera /dev/v4l-subdev* 0660 system camera /dev/qseecom 0660 system drmrpc /dev/qce 0660 system drmrpc -/dev/smcinvoke 0660 system system +/dev/smcinvoke 0660 system drmrpc /dev/qsee_ipc_irq_spss 0660 system drmrpc /dev/seemplog 0660 system system /dev/pft 0660 system drmrpc /dev/spcom 0660 system system +/dev/spss_utils 0660 system system /dev/sp_kernel 0660 system system +/dev/sp_nvm 0660 system system /dev/sp_ssr 0660 system system /dev/sp_keymaster 0660 system system /dev/sec_nvm_* 0660 system system /dev/cryptoapp 0660 system system /dev/spdaemon_ssr 0660 system system -/dev/cam-hyp-intf* 0660 system camera +/dev/iuicc 0660 system system +/dev/iuicc0 0660 system system +/dev/iuicc1 0660 system system /dev/gemini0 0660 system camera /dev/jpeg0 0660 system camera /dev/jpeg1 0660 system camera @@ -149,20 +154,26 @@ firmware_directories /vendor/firmware_mnt/image/ /dev/adsprpc-smd-secure 0644 system system /dev/system_health_monitor 0644 radio system /dev/mdss_rotator 0664 system system -/dev/cpu_dma_latency 0660 root system #QDSS /dev/byte-cntr 0660 system oem_2902 /dev/mhi_qdss 0660 system oem_2902 /sys/class/qdss_bridge/mhi_qdss mode 0660 system oem_2902 +#qg +/dev/qg 0660 system system +/dev/qg_battery 0660 system system + +#qvr +/dev/qvr_external_sensor_ioctl 0660 system system +/sys/kernel/qvr_external_sensor/fd 0660 system system + # wlan /dev/wcnss_wlan 0660 system system /dev/wcnss_ctrl 0660 system system /sys/devices/soc/a000000.qcom,wcnss-wlan/net/wlan0/queues/rx-* rps_cpus 0660 system system /sys/devices/soc/a000000.qcom,wcnss-wlan/net/p2p0/queues/rx-* rps_cpus 0660 system system /dev/spidev0.0 0660 system audio -/dev/i2c-7 0660 system audio /dev/msm_camera/* 0660 system camera /dev/gemini/ 0660 system camera /dev/mercury0 0660 system camera @@ -214,7 +225,7 @@ firmware_directories /vendor/firmware_mnt/image/ /dev/i2c-5 0660 media media /dev/avtimer 0660 system audio /dev/spidev2.0 0660 system audio - +/dev/aud_pasthru_adsp 0660 system audio # DVB devices /dev/dvb/adapter0/demux* 0440 media media /dev/dvb/adapter0/dvr* 0660 media media @@ -260,24 +271,7 @@ firmware_directories /vendor/firmware_mnt/image/ /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input* secure_touch 0440 system drmrpc /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input* secure_touch_enable 0660 system drmrpc -# native sensors input -/sys/devices/virtual/input/input* enable_int 0660 system input -/sys/devices/virtual/input/input* gyro_op_mode 0660 system input -/sys/devices/virtual/input/input* acc_range 0660 system input -/sys/devices/virtual/input/input* acc_value 0660 system input -/sys/devices/virtual/input/input* gyro_odr 0660 system input -/sys/devices/virtual/input/input* fifo_data_sel 0660 system input -/sys/devices/virtual/input/input* fifo_watermark 0660 system input -/sys/devices/virtual/input/input* enable 0660 system input -/sys/devices/virtual/input/input* acc_odr 0660 system input -/sys/devices/virtual/input/input* temperature 0660 system input -/sys/devices/virtual/input/input* acc_op_mode 0660 system input -/sys/devices/virtual/input/input* fifo_bytecount 0660 system input -/sys/devices/virtual/input/input* gyro_range 0660 system input -/sys/devices/virtual/input/input* gyro_value 0660 system input - -# GNSS PPS Device premissions -/dev/pps* 0660 gps gps +# GNSS Device premissions /dev/gnss_sirf 0660 gps gps # laser sensor access @@ -302,6 +296,7 @@ firmware_directories /vendor/firmware_mnt/image/ /sys/bus/pci/drivers/wil6210* 0000:01:00.0/net/wigig0/queues/rx-0/rps_cpus 0660 system system /sys/bus/pci/drivers/wil6210* 0000:01:00.0/net/wigig0/gro_flush_timeout 0660 system system /sys/devices/virtual/net/bond0 queues/rx-0/rps_cpus 0660 system system +/dev/wigig_sensing 0660 system system #nfc permissions /dev/nfc-nci 0660 nfc nfc @@ -323,7 +318,9 @@ firmware_directories /vendor/firmware_mnt/image/ /dev/ramdump* 0640 system system # Fingerprint device -/dev/qbt1000 0660 system system +/dev/qbt* 0660 system system +/sys/class/fts/touch_aoi aoi_set 0660 root system +/sys/class/fts/touch_aoi power_set 0660 root system #ImproveTouch device /dev/hbtp_input 0660 system system @@ -368,6 +365,8 @@ firmware_directories /vendor/firmware_mnt/image/ #Memory Offline /sys/devices/system/memory/memory* state 0660 system system +/sys/devices/virtual/hdcp/msm_hdcp min_level_change 0664 system graphics + # sys-fs display /sys/class/graphics/fb* hpd 0664 system graphics /sys/class/graphics/fb* res_info 0664 system graphics @@ -397,10 +396,3 @@ firmware_directories /vendor/firmware_mnt/image/ /sys/class/graphics/fb0 modes 0664 system graphics /sys/class/graphics/fb0 mode 0664 system graphics /sys/class/graphics/fb0 msm_cmd_autorefresh_en 0664 system graphics -/sys/class/graphics/fb0 dynamic_bitclk 0664 system graphics - -/sys/devices/virtual/hdcp/msm_hdcp min_level_change 0664 system graphics - -#QG device -/dev/qg 0660 system system -/dev/qg_battery 0660 system system diff --git a/sdm660.mk b/sdm660.mk index 527667a..949eaed 100644 --- a/sdm660.mk +++ b/sdm660.mk @@ -269,13 +269,14 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += \ init.class_main.sh \ init.msm.usb.configfs.rc \ + init.qcom.early_boot.sh \ init.qcom.post_boot.sh \ - init.qcom.sensors.sh \ init.qcom.rc \ + init.qcom.sensors.sh \ init.qcom.sh \ init.qcom.usb.rc \ init.qcom.usb.sh \ - init.qti.fm.sh \ + init.recovery.qcom.rc \ init.target.rc \ ueventd.qcom.rc -- cgit v1.2.3