diff options
Diffstat (limited to 'rootdir')
-rw-r--r-- | rootdir/Android.mk | 124 | ||||
-rwxr-xr-x | rootdir/bin/init.class_main.sh | 155 | ||||
-rwxr-xr-x | rootdir/bin/init.kernel.post_boot-blair.sh | 249 | ||||
-rwxr-xr-x | rootdir/bin/init.kernel.post_boot-holi.sh | 246 | ||||
-rwxr-xr-x | rootdir/bin/init.kernel.post_boot.sh | 49 | ||||
-rwxr-xr-x | rootdir/bin/init.mi.btmac.sh | 21 | ||||
-rwxr-xr-x | rootdir/bin/init.qcom.post_boot.sh | 6235 | ||||
-rwxr-xr-x | rootdir/bin/init.qcom.sh | 465 | ||||
-rwxr-xr-x | rootdir/bin/vendor_modprobe.sh | 38 | ||||
-rw-r--r-- | rootdir/etc/charger_fstab.qti | 33 | ||||
-rw-r--r-- | rootdir/etc/fstab.default | 51 | ||||
-rw-r--r-- | rootdir/etc/fstab.emmc | 51 | ||||
-rw-r--r-- | rootdir/etc/init.batterysecret.rc | 31 | ||||
-rw-r--r-- | rootdir/etc/init.nfc.rc | 15 | ||||
-rw-r--r-- | rootdir/etc/init.qcom.rc | 1581 | ||||
-rw-r--r-- | rootdir/etc/init.qti.kernel.rc | 175 | ||||
-rw-r--r-- | rootdir/etc/init.qti.ufs.rc | 30 | ||||
-rw-r--r-- | rootdir/etc/init.recovery.qcom.rc | 38 | ||||
-rw-r--r-- | rootdir/etc/init.target.rc | 286 | ||||
-rw-r--r-- | rootdir/etc/ueventd.qcom.rc | 507 |
20 files changed, 10380 insertions, 0 deletions
diff --git a/rootdir/Android.mk b/rootdir/Android.mk new file mode 100644 index 0000000..7552c69 --- /dev/null +++ b/rootdir/Android.mk @@ -0,0 +1,124 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +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_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := init.mi.btmac.sh +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := bin/init.mi.btmac.sh +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) +include $(BUILD_PREBUILT) + + +include $(CLEAR_VARS) +LOCAL_MODULE := init.kernel.post_boot.sh +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := bin/init.kernel.post_boot.sh +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := init.kernel.post_boot-blair.sh +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := bin/init.kernel.post_boot-blair.sh +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := init.kernel.post_boot-holi.sh +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := bin/init.kernel.post_boot-holi.sh +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) +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_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := init.qcom.post_boot.sh +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := bin/init.qcom.post_boot.sh +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := vendor_modprobe.sh +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := bin/vendor_modprobe.sh +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := init.batterysecret.rc +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := etc/init.batterysecret.rc +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := init.nfc.rc +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := etc/init.nfc.rc +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := init.qcom.rc +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +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.qti.kernel.rc +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := etc/init.qti.kernel.rc +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := init.qti.ufs.rc +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := etc/init.qti.ufs.rc +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := init.target.rc +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := etc/init.target.rc +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := ueventd.qcom.rc +LOCAL_MODULE_STEM := ueventd.rc +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := etc/ueventd.qcom.rc +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR) +include $(BUILD_PREBUILT) diff --git a/rootdir/bin/init.class_main.sh b/rootdir/bin/init.class_main.sh new file mode 100755 index 0000000..05c3251 --- /dev/null +++ b/rootdir/bin/init.class_main.sh @@ -0,0 +1,155 @@ +#! /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` +low_ram=`getprop ro.config.low_ram` +qcrild_status=true + +case "$baseband" in + "apq" | "sda" | "qcs" ) + setprop ro.vendor.radio.noril yes + 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 vendor.ril-daemon + + start vendor.qcrild + else + 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 + if [ "$low_ram" != "true" ]; then + start vendor.dataadpl + fi + ;; + "concurrent") + start vendor.dataqti + if [ "$low_ram" != "true" ]; then + start vendor.dataadpl + fi + ;; + *) + ;; + 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.kernel.post_boot-blair.sh b/rootdir/bin/init.kernel.post_boot-blair.sh new file mode 100755 index 0000000..0c52026 --- /dev/null +++ b/rootdir/bin/init.kernel.post_boot-blair.sh @@ -0,0 +1,249 @@ +#============================================================================= +# Copyright (c) 2021 Qualcomm Technologies, Inc. +# All Rights Reserved. +# Confidential and Proprietary - Qualcomm Technologies, Inc. +# +# Copyright (c) 2012-2013, 2016-2020, 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. +#============================================================================= + +function configure_zram_parameters() { + MemTotalStr=`cat /proc/meminfo | grep MemTotal` + MemTotal=${MemTotalStr:16:8} + + # Zram disk - 75% for < 2GB devices . + # For >2GB devices, size = 50% of RAM size. Limit the size to 4GB. + + let RamSizeGB="( $MemTotal / 1048576 ) + 1" + diskSizeUnit=M + if [ $RamSizeGB -le 2 ]; then + let zRamSizeMB="( $RamSizeGB * 1024 ) * 3 / 4" + else + let zRamSizeMB="( $RamSizeGB * 1024 ) / 2" + fi + + # use MB avoid 32 bit overflow + if [ $zRamSizeMB -gt 4096 ]; then + let zRamSizeMB=4096 + fi + + if [ -f /sys/block/zram0/disksize ]; then + if [ -f /sys/block/zram0/use_dedup ]; then + echo 1 > /sys/block/zram0/use_dedup + fi + echo "$zRamSizeMB""$diskSizeUnit" > /sys/block/zram0/disksize + + # ZRAM may use more memory than it saves if SLAB_STORE_USER + # debug option is enabled. + if [ -e /sys/kernel/slab/zs_handle ]; then + echo 0 > /sys/kernel/slab/zs_handle/store_user + fi + if [ -e /sys/kernel/slab/zspage ]; then + echo 0 > /sys/kernel/slab/zspage/store_user + 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} + + dmpts=$(ls /sys/block/*/queue/read_ahead_kb | grep -e dm -e mmc) + + # Set 128 for <= 3GB & + # set 512 for >= 4GB targets. + if [ $MemTotal -le 3145728 ]; then + ra_kb=128 + else + ra_kb=512 + fi + if [ -f /sys/block/mmcblk0/bdi/read_ahead_kb ]; then + echo $ra_kb > /sys/block/mmcblk0/bdi/read_ahead_kb + fi + if [ -f /sys/block/mmcblk0rpmb/bdi/read_ahead_kb ]; then + echo $ra_kb > /sys/block/mmcblk0rpmb/bdi/read_ahead_kb + fi + for dm in $dmpts; do + echo $ra_kb > $dm + done +} + +function configure_memory_parameters() { + MemTotalStr=`cat /proc/meminfo | grep MemTotal` + MemTotal=${MemTotalStr:16:8} + # Set Memory parameters. + + # Set swappiness to 100 for all targets + 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 + # Disable the feature of watermark boost for 8G and below device + if [ $MemTotal -le 8388608 ]; then + echo 0 > /proc/sys/vm/watermark_boost_factor + fi + configure_zram_parameters + configure_read_ahead_kb_values + + #Spawn 2 kswapd threads which can help in fast reclaiming of pages + echo 2 > /proc/sys/vm/kswapd_threads +} + +# Core control parameters for 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 + +# Enable Core control for Silver +echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/enable + +# Disable Core control on gold +echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable + +# Setting b.L scheduler parameters +echo 65 > /proc/sys/kernel/sched_downmigrate +echo 71 > /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_hysteresis_enable_cpus +echo 0 > /proc/sys/kernel/sched_busy_hysteresis_enable_cpus +echo 5 > /proc/sys/kernel/sched_ravg_window_nr_ticks + +# disable unfiltering +echo 20000000 > /proc/sys/kernel/sched_task_unfilter_period + +# cpuset parameters +echo 0-2 > /dev/cpuset/background/cpus +echo 0-3 > /dev/cpuset/system-background/cpus +echo 4-7 > /dev/cpuset/foreground/boost/cpus +echo 0-2,4-7 > /dev/cpuset/foreground/cpus +echo 0-7 > /dev/cpuset/top-app/cpus + +# Turn off scheduler boost at the end +echo 0 > /proc/sys/kernel/sched_boost + +# 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 +echo 1113600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq +echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_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/down_rate_limit_us +echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/up_rate_limit_us +echo 1228800 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq +echo 691200 > /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq + +# Colocation V3 settings +echo 680000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq +echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/rtg_boost_freq +echo 51 > /proc/sys/kernel/sched_min_task_util_for_boost +echo 35 > /proc/sys/kernel/sched_min_task_util_for_colocation + +# 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/cpufreq/policy6/schedutil/hispeed_load + +# configure input boost settings +echo "0:1804800" > /sys/devices/system/cpu/cpu_boost/input_boost_freq +echo 120 > /sys/devices/system/cpu/cpu_boost/input_boost_ms + +# Enable bus-dcvs +for device in /sys/devices/platform/soc +do + for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw + do + cat $cpubw/available_frequencies | cut -d " " -f 1 > $cpubw/min_freq + echo "bw_hwmon" > $cpubw/governor + echo "762 1144 1720 2086 2597 2929 3879 5161 5931 6881 7980" > $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 + echo 40 > $cpubw/polling_interval + done + + # configure compute settings for silver latfloor + for latfloor in $device/*cpu0-cpu*latfloor/devfreq/*cpu0-cpu*latfloor + do + cat $latfloor/available_frequencies | cut -d " " -f 1 > $latfloor/min_freq + echo 8 > $latfloor/polling_interval + done + + # configure compute settings for gold latfloor + for latfloor in $device/*cpu6-cpu*latfloor/devfreq/*cpu6-cpu*latfloor + do + cat $latfloor/available_frequencies | cut -d " " -f 1 > $latfloor/min_freq + echo 8 > $latfloor/polling_interval + done + + # configure mem_latency settings for DDR scaling + for memlat in $device/*lat/devfreq/*lat + do + cat $memlat/available_frequencies | cut -d " " -f 1 > $memlat/min_freq + echo 8 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Gold CPU6 L3 ratio ceil + for l3gold in $device/*cpu6-cpu-l3-lat/devfreq/*cpu6-cpu-l3-lat + do + echo 4000 > $l3gold/mem_latency/ratio_ceil + echo 25000 > $l3gold/mem_latency/wb_filter_ratio + echo 60 > $l3gold/mem_latency/wb_pct_thres + done + + #Gold CPU7 L3 ratio ceil + for l3gold in $device/*cpu7-cpu-l3-lat/devfreq/*cpu7-cpu-l3-lat + do + echo 4000 > $l3gold/mem_latency/ratio_ceil + echo 25000 > $l3gold/mem_latency/wb_filter_ratio + echo 60 > $l3gold/mem_latency/wb_pct_thres + done + +done + +echo N > /sys/module/lpm_levels/parameters/sleep_disabled + +configure_memory_parameters + +setprop vendor.post_boot.parsed 1 diff --git a/rootdir/bin/init.kernel.post_boot-holi.sh b/rootdir/bin/init.kernel.post_boot-holi.sh new file mode 100755 index 0000000..7ee3ae8 --- /dev/null +++ b/rootdir/bin/init.kernel.post_boot-holi.sh @@ -0,0 +1,246 @@ +#============================================================================= +# Copyright (c) 2020-2021 Qualcomm Technologies, Inc. +# All Rights Reserved. +# Confidential and Proprietary - Qualcomm Technologies, Inc. +# +# Copyright (c) 2012-2013, 2016-2020, 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. +#============================================================================= + +function configure_zram_parameters() { + MemTotalStr=`cat /proc/meminfo | grep MemTotal` + MemTotal=${MemTotalStr:16:8} + + # Zram disk - 75% for < 2GB devices . + # For >2GB devices, size = 50% of RAM size. Limit the size to 4GB. + + let RamSizeGB="( $MemTotal / 1048576 ) + 1" + diskSizeUnit=M + if [ $RamSizeGB -le 2 ]; then + let zRamSizeMB="( $RamSizeGB * 1024 ) * 3 / 4" + else + let zRamSizeMB="( $RamSizeGB * 1024 ) / 2" + fi + + # use MB avoid 32 bit overflow + if [ $zRamSizeMB -gt 4096 ]; then + let zRamSizeMB=4096 + fi + + if [ -f /sys/block/zram0/disksize ]; then + if [ -f /sys/block/zram0/use_dedup ]; then + echo 1 > /sys/block/zram0/use_dedup + fi + echo "$zRamSizeMB""$diskSizeUnit" > /sys/block/zram0/disksize + + # ZRAM may use more memory than it saves if SLAB_STORE_USER + # debug option is enabled. + if [ -e /sys/kernel/slab/zs_handle ]; then + echo 0 > /sys/kernel/slab/zs_handle/store_user + fi + if [ -e /sys/kernel/slab/zspage ]; then + echo 0 > /sys/kernel/slab/zspage/store_user + 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} + + dmpts=$(ls /sys/block/*/queue/read_ahead_kb | grep -e dm -e mmc) + + # Set 128 for <= 3GB & + # set 512 for >= 4GB targets. + if [ $MemTotal -le 3145728 ]; then + ra_kb=128 + else + ra_kb=512 + fi + if [ -f /sys/block/mmcblk0/bdi/read_ahead_kb ]; then + echo $ra_kb > /sys/block/mmcblk0/bdi/read_ahead_kb + fi + if [ -f /sys/block/mmcblk0rpmb/bdi/read_ahead_kb ]; then + echo $ra_kb > /sys/block/mmcblk0rpmb/bdi/read_ahead_kb + fi + for dm in $dmpts; do + echo $ra_kb > $dm + done +} + +function configure_memory_parameters() { + MemTotalStr=`cat /proc/meminfo | grep MemTotal` + MemTotal=${MemTotalStr:16:8} + # Set Memory parameters. + + # Set swappiness to 100 for all targets + 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 + # Disable the feature of watermark boost for 8G and below device + if [ $MemTotal -le 8388608 ]; then + echo 0 > /proc/sys/vm/watermark_boost_factor + fi + configure_zram_parameters + configure_read_ahead_kb_values + + #Spawn 2 kswapd threads which can help in fast reclaiming of pages + echo 2 > /proc/sys/vm/kswapd_threads +} + +# Core control parameters for 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 + +# Enable Core control for Silver +echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/enable + +# Disable Core control on gold +echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable + +# Setting b.L scheduler parameters +echo 65 > /proc/sys/kernel/sched_downmigrate +echo 71 > /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_hysteresis_enable_cpus +echo 0 > /proc/sys/kernel/sched_busy_hysteresis_enable_cpus +echo 5 > /proc/sys/kernel/sched_ravg_window_nr_ticks + +# disable unfiltering +echo 20000000 > /proc/sys/kernel/sched_task_unfilter_period + +# 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 + +# 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 +echo 1190400 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq +echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_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/down_rate_limit_us +echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/up_rate_limit_us +echo 1248000 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq +echo 768000 > /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq + +# Colocation V3 settings +echo 680000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq +echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/rtg_boost_freq +echo 51 > /proc/sys/kernel/sched_min_task_util_for_boost +echo 35 > /proc/sys/kernel/sched_min_task_util_for_colocation + +# 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/cpufreq/policy6/schedutil/hispeed_load + +# configure input boost settings +echo "0:1190400" > /sys/devices/system/cpu/cpu_boost/input_boost_freq +echo 120 > /sys/devices/system/cpu/cpu_boost/input_boost_ms + +# Enable bus-dcvs +for device in /sys/devices/platform/soc +do + for cpubw in $device/*cpu-cpu-ddr-bw/devfreq/*cpu-cpu-ddr-bw + do + cat $cpubw/available_frequencies | cut -d " " -f 1 > $cpubw/min_freq + echo "bw_hwmon" > $cpubw/governor + echo "1144 1720 2086 2929 3879 5931 6881 8137" > $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 + echo 40 > $cpubw/polling_interval + done + + # configure compute settings for silver latfloor + for latfloor in $device/*cpu0-cpu*latfloor/devfreq/*cpu0-cpu*latfloor + do + cat $latfloor/available_frequencies | cut -d " " -f 1 > $latfloor/min_freq + echo 8 > $latfloor/polling_interval + done + + # configure compute settings for gold latfloor + for latfloor in $device/*cpu6-cpu*latfloor/devfreq/*cpu6-cpu*latfloor + do + cat $latfloor/available_frequencies | cut -d " " -f 1 > $latfloor/min_freq + echo 8 > $latfloor/polling_interval + done + + # configure mem_latency settings for DDR scaling + for memlat in $device/*lat/devfreq/*lat + do + cat $memlat/available_frequencies | cut -d " " -f 1 > $memlat/min_freq + echo 8 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Gold CPU6 L3 ratio ceil + for l3gold in $device/*cpu6-cpu-l3-lat/devfreq/*cpu6-cpu-l3-lat + do + echo 4000 > $l3gold/mem_latency/ratio_ceil + echo 25000 > $l3gold/mem_latency/wb_filter_ratio + echo 60 > $l3gold/mem_latency/wb_pct_thres + done + + #Gold CPU7 L3 ratio ceil + for l3gold in $device/*cpu7-cpu-l3-lat/devfreq/*cpu7-cpu-l3-lat + do + echo 4000 > $l3gold/mem_latency/ratio_ceil + echo 25000 > $l3gold/mem_latency/wb_filter_ratio + echo 60 > $l3gold/mem_latency/wb_pct_thres + done + +done + +echo N > /sys/module/lpm_levels/parameters/sleep_disabled + +configure_memory_parameters + +setprop vendor.post_boot.parsed 1 diff --git a/rootdir/bin/init.kernel.post_boot.sh b/rootdir/bin/init.kernel.post_boot.sh new file mode 100755 index 0000000..32468d9 --- /dev/null +++ b/rootdir/bin/init.kernel.post_boot.sh @@ -0,0 +1,49 @@ +#============================================================================= +# Copyright (c) 2020-2021 Qualcomm Technologies, Inc. +# All Rights Reserved. +# Confidential and Proprietary - Qualcomm Technologies, Inc. +# +# Copyright (c) 2012-2013, 2016-2020, 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. +#============================================================================= + +if [ -f /sys/devices/soc0/chip_family ]; then + chipfamily=`cat /sys/devices/soc0/chip_family` +fi + +case "$chipfamily" in + "0x73") + /vendor/bin/sh /vendor/bin/init.kernel.post_boot-holi.sh + ;; + + "0x7c") + /vendor/bin/sh /vendor/bin/init.kernel.post_boot-blair.sh + ;; + *) + echo "***WARNING***: Invalid chip family\n\t No postboot settings applied!!\n" + ;; +esac diff --git a/rootdir/bin/init.mi.btmac.sh b/rootdir/bin/init.mi.btmac.sh new file mode 100755 index 0000000..66ec4b2 --- /dev/null +++ b/rootdir/bin/init.mi.btmac.sh @@ -0,0 +1,21 @@ +#!/vendor/bin/sh +# Copyright (C) 2021 KudProject Development +# SPDX-License-Identifier: GPL-3.0-or-later OR Apache-2.0 + +LOG_TAG="MiSetBtMac" +logi () { log -t "$LOG_TAG" -p i "$@"; } + +# hex binary containing mac address +BT_MAC_HEX_PATH="/data/vendor/mac_addr/bt.mac"; +if [ ! -f "$BT_MAC_HEX_PATH" ]; then + logi "bt.mac file not found, exiting" + exit +fi + +# raw mac address without colons +RAW_MAC=$(xxd -p "$BT_MAC_HEX_PATH"); +# convert it into format recognized by bluetooth hal +DEC_MAC=$(echo "$RAW_MAC" | sed 's!^M$!!;s!\-!!g;s!\.!!g;s!\(..\)!\1:!g;s!:$!!') +# set the mac address using persist property +setprop persist.vendor.service.bdroid.bdaddr "$DEC_MAC" +logi "bt.mac file found, setting mac addr" diff --git a/rootdir/bin/init.qcom.post_boot.sh b/rootdir/bin/init.qcom.post_boot.sh new file mode 100755 index 0000000..3a1eb13 --- /dev/null +++ b/rootdir/bin/init.qcom.post_boot.sh @@ -0,0 +1,6235 @@ +#! /vendor/bin/sh + +# Copyright (c) 2012-2013, 2016-2020, 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() +{ + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + #governor settings + echo 1 > /sys/devices/system/cpu/cpu0/online + 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 + #set the hispeed_freq + echo 1401600 > /sys/devices/system/cpu/cpufreq/policy0/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/policy0/schedutil/hispeed_load + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq + + echo 652800 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + + #input boost params + echo 1401600 > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + + # 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 + + # Enable bus-dcvs + 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 34 > $cpubw/bw_hwmon/io_percent + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 10 > $cpubw/bw_hwmon/hyst_length + echo 1600 > $cpubw/bw_hwmon/idle_mbps + echo 20 > $cpubw/bw_hwmon/low_power_delay + echo 34 > $cpubw/bw_hwmon/low_power_io_percent + echo "1611 3221 5859 6445 7104" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1611 > $cpubw/min_freq + done + done + else + #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/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/schedutil/down_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 + + echo 652800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + + fi +} + +function 8917_sched_dcvs_eas() +{ + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + #governor settings + echo 1 > /sys/devices/system/cpu/cpu0/online + 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 + #set the hispeed_freq + echo 1094400 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + #default value for hispeed_load is 90, for 8917 it should be 85 + echo 85 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_load + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq + + echo 960000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + + #input boost params + echo 1094400 > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + + # 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 + + # Enable bus-dcvs + 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 20 > $cpubw/bw_hwmon/io_percent + echo 30 > $cpubw/bw_hwmon/guard_band_mbps + done + done + else + #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/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/schedutil/down_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 + + echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + fi + + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + fi +} + +function 8937_sched_dcvs_eas() +{ + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + # enable governor for perf cluster + echo 1 > /sys/devices/system/cpu/cpu0/online + 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 + #set the hispeed_freq + echo 1094400 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + #default value for hispeed_load is 90, for 8937 it should be 85 + echo 85 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_load + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq + + echo 960000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + + ## enable governor for power cluster + echo 1 > /sys/devices/system/cpu/cpu4/online + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor + #set the hispeed_freq + echo 768000 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq + #default value for hispeed_load is 90, for 8937 it should be 85 + echo 85 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_load + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/rtg_boost_freq + + echo 768000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq + + #input boost params + echo 109440 > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + + # 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 + + # Enable bus-dcvs + 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 20 > $cpubw/bw_hwmon/io_percent + echo 30 > $cpubw/bw_hwmon/guard_band_mbps + done + done + else + # 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/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_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/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_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 + + echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 768000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + fi + + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + fi +} + +function configure_automotive_sku_parameters() { + + echo 1036800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 1171200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq + echo 1785600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq + echo 902400000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/min_freq + echo 902400000 > /sys/class/devfreq/18321110.qcom,cpu4-cpu-l3-lat/min_freq + echo 902400000 > /sys/class/devfreq/18321110.qcom,cpu7-cpu-l3-lat/min_freq + echo 1612800000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/max_freq + echo 1612800000 > /sys/class/devfreq/18321110.qcom,cpu4-cpu-l3-lat/max_freq + echo 1612800000 > /sys/class/devfreq/18321110.qcom,cpu7-cpu-l3-lat/max_freq + echo 902400000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/min_freq + echo 902400000 > /sys/class/devfreq/soc\:qcom,cpu4-cpu-l3-lat/min_freq + echo 902400000 > /sys/class/devfreq/soc\:qcom,cpu7-cpu-l3-lat/min_freq + echo 1612800000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq + echo 1612800000 > /sys/class/devfreq/soc\:qcom,cpu4-cpu-l3-lat/max_freq + echo 1612800000 > /sys/class/devfreq/soc\:qcom,cpu7-cpu-l3-lat/max_freq + +#read feature id from nvram +reg_val=`cat /sys/devices/platform/soc/780130.qfprom/qfprom0/nvmem | od -An -t d4` +feature_id=$(((reg_val >> 20) & 0xFF)) +log -t BOOT -p i "feature id '$feature_id'" +if [ $feature_id == 0 ]; then + echo " SKU Configured : SA8155P" + echo 2131200 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + echo 2419200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq + echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel +elif [ $feature_id == 1 ]; then + echo "SKU Configured : SA8150P" + echo 1920000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + echo 2227200 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq + echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel +else + echo "unknown feature_id value" $feature_id +fi +} + +function configure_automotive_sku_parameters_sa8195() { + + #Setting the min supported frequencies + echo 1113600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 1171200 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/min_freq + echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu4-cpu-l3-lat/min_freq + echo 1651200000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/max_freq + echo 1651200000 > /sys/class/devfreq/18321110.qcom,cpu4-cpu-l3-lat/max_freq + 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 + echo 1651200000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq + echo 1651200000 > /sys/class/devfreq/soc\:qcom,cpu4-cpu-l3-lat/max_freq + + #read feature id + reg_val=`cat /sys/devices/platform/soc/780130.qfprom/qfprom0/nvmem | od -An -t d4` + feature_id=$(((reg_val >> 20) & 0xFF)) + + #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 SA8195AA" + + #setting max cpu freq to 2.496GHz + echo 2496000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + #setting max gpu freq to 530 MHz + echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel + echo 1804 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq + elif [ $feature_id == 1 ] || [ $feature_id == 2 ]; then + echo "feature_id is 1 for external SA8195AB" + echo "feature_id is 2 for internal SA8195AB" + + #setting max cpu freq to 2.496GHz + echo 2496000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + #setting max gpu freq to 670 MHz + echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel + echo 2092 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq + elif [ $feature_id == 3 ]; then + echo "feature_id is 3 for external SA8195AC" + else + echo "unknown feature_id value" $feature_id + fi +} + +function configure_sku_parameters() { + +#read feature id from nvram +reg_val=`cat /sys/devices/platform/soc/780130.qfprom/qfprom0/nvmem | od -An -t d4` +feature_id=$(((reg_val >> 20) & 0xFF)) +log -t BOOT -p i "feature id '$feature_id'" +if [ $feature_id == 6 ]; then + echo " SKU Configured : SA6145" + echo 748800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_min_freq + echo 1017600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq + echo 1017600 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_min_freq + echo 748800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq + echo 748800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq + echo 748800 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq + echo 748800 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq + echo 748800 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + echo 748800 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_max_freq + echo 1017600 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_max_freq + echo 1017600 > /sys/devices/system/cpu/cpu7/cpufreq/scaling_max_freq + echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/min_freq + echo 1017600000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/max_freq + echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/min_freq + echo 1017600000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/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 1016 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq + setprop vendor.sku_identified 1 + setprop vendor.sku_name "SA6145" +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/18321110.qcom,cpu0-cpu-l3-lat/min_freq + echo 1363200000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/max_freq + echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/min_freq + echo 1363200000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/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 1333 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq + setprop vendor.sku_identified 1 + setprop vendor.sku_name "SA6150" +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/18321110.qcom,cpu0-cpu-l3-lat/min_freq + echo 1363200000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/max_freq + echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/min_freq + echo 1363200000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/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 1555 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq + setprop vendor.sku_identified 1 + setprop vendor.sku_name "SA6155" +else + 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/18321110.qcom,cpu0-cpu-l3-lat/min_freq + echo 1363200000 > /sys/class/devfreq/18321110.qcom,cpu0-cpu-l3-lat/max_freq + echo 940800000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/min_freq + echo 1363200000 > /sys/class/devfreq/18321110.qcom,cpu6-cpu-l3-lat/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 1555 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq + setprop vendor.sku_identified 1 + setprop vendor.sku_name "SA6155" +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 + +} + +function sdm660_sched_interactive_dcvs() { + + 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 + + # 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 + + # re-enable thermal and BCL hotplug + echo 1 > /sys/module/msm_thermal/core_control/enabled + + # 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 +} + +function sdm660_sched_schedutil_dcvs() { + + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + # configure governor settings for little 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 1401600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl + echo 633600 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + echo 902400 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq + + # configure governor settings for big 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 1401600 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl + echo 1113600 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/rtg_boost_freq + else + # 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 1401600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_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 + fi + + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + + #if the kernel version >=4.19,set input_boost_freq accordingly + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + echo "0:1401600" > /sys/devices/system/cpu/cpu_boost/input_boost_freq + echo 40 > /sys/devices/system/cpu/cpu_boost/input_boost_ms + else + echo "0:1401600" > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + fi + + # 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 + + # Enable bus-dcvs + 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 + 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/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + done + + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -le 14 ]; then + 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 + fi + done + + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + fi + +} + +target=`getprop ro.board.platform` + +KernelVersionStr=`cat /proc/sys/kernel/osrelease` +KernelVersionS=${KernelVersionStr:2:2} +KernelVersionA=${KernelVersionStr:0:1} +KernelVersionB=${KernelVersionS%.*} + +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 Go device, size = 1536MB, 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. + + let RamSizeGB="( $MemTotal / 1048576 ) + 1" + diskSizeUnit=M + if [ $RamSizeGB -le 2 ]; then + let zRamSizeMB="( $RamSizeGB * 1024 ) * 3 / 4" + else + let zRamSizeMB="( $RamSizeGB * 1024 ) / 2" + fi + + # use MB avoid 32 bit overflow + if [ $zRamSizeMB -gt 4096 ]; then + let zRamSizeMB=4096 + 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 + echo "$zRamSizeMB""$diskSizeUnit" > /sys/block/zram0/disksize + + # ZRAM may use more memory than it saves if SLAB_STORE_USER + # debug option is enabled. + if [ -e /sys/kernel/slab/zs_handle ]; then + echo 0 > /sys/kernel/slab/zs_handle/store_user + fi + if [ -e /sys/kernel/slab/zspage ]; then + echo 0 > /sys/kernel/slab/zspage/store_user + 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} + + dmpts=$(ls /sys/block/*/queue/read_ahead_kb | grep -e dm -e mmc) + + # 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/mmcblk0rpmb/bdi/read_ahead_kb + for dm in $dmpts; do + echo 128 > $dm + done + else + echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb + echo 512 > /sys/block/mmcblk0rpmb/bdi/read_ahead_kb + for dm in $dmpts; do + echo 512 > $dm + done + 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 disable_ppr() +{ + if [ -f /sys/module/process_reclaim/parameters/enable_process_reclaim ]; then + echo 0 > /sys/module/process_reclaim/parameters/enable_process_reclaim + 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` + + # Set parameters for 32-bit Go targets. + if [ "$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 + + if [[ "$ProductName" != "bengal"* ]]; then + #bengal has appcompaction enabled. So not needed + # Set PPR parameters for other targets + 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 + fi + + if [[ "$ProductName" == "bengal"* ]]; then + #Set PPR nomap parameters for bengal targets + 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 0 > /sys/module/process_reclaim/parameters/per_swap_size + echo 7680 > /sys/module/process_reclaim/parameters/tsk_nomap_swap_sz + 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 + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 9 ]; then + 8953_sched_dcvs_eas + else + 8953_sched_dcvs_hmp + echo 652800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + fi + + # 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 + + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + disable_ppr + fi + ;; + 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/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_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/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 + #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 + + if [ $KernelVersionA -le 4 ] && [ $KernelVersionB -le 9 ]; then + 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 + fi + + # disable thermal core_control to update interactive gov settings + echo 0 > /sys/module/msm_thermal/core_control/enabled + + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 9 ]; then + 8917_sched_dcvs_eas + else + 8917_sched_dcvs_hmp + echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + fi + + # 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 + + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + disable_ppr + fi + ;; + *) + ;; + 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 + + if [ $KernelVersionA -le 4 ] && [ $KernelVersionB -le 9 ]; then + 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 + fi + + # disable thermal core_control to update interactive gov and core_ctl settings + echo 0 > /sys/module/msm_thermal/core_control/enabled + + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 9 ]; then + 8937_sched_dcvs_eas + else + 8937_sched_dcvs_hmp + echo 960000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 768000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + fi + # 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 + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + disable_ppr + fi + ;; + *) + + ;; + 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 + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + + 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 20 > $cpubw/bw_hwmon/io_percent + echo 30 > $cpubw/bw_hwmon/guard_band_mbps + done + done + else + 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 + fi + + case "$soc_id" in + "353" | "363" ) + # Apply settings for sdm439/sda439 + echo 1 > /sys/devices/system/cpu/cpu0/online + echo 1 > /sys/devices/system/cpu/cpu4/online + + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + + # configure schedutil governor settings + # enable governor for perf 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 + + #set the hispeed_freq + echo 1497600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + echo 80 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_load + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq + echo 960000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + + #input boost params + echo 1497600 > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + + ## enable governor for power 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 + + #set the hispeed_freq + echo 998400 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq + echo 85 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_load + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/rtg_boost_freq + echo 768000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq + else + # configure schedutil governor settings + # enable governor for perf 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 + + #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 + + ## enable governor for power 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 + + #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 + fi + + # 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 + 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 + + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + + 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 + + #set the hispeed_freq + echo 1305600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + echo 80 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_load + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq + echo 960000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + #input boost params + + echo 1305600 > /sys/module/cpu_boost/parameters/input_boost_freq + echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms + else + 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 + + #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 + fi + + # 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 + + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then + disable_ppr + fi + + #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 [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -le 14 ]; then + 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 + 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 + + # cpuset settings + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + #if the kernel version >=4.14,use the schedutil governor + if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 14 ]; then + sdm660_sched_schedutil_dcvs + else + sdm660_sched_interactive_dcvs + fi + + # Set Memory parameters + configure_memory_parameters + + # enable LPM + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + # 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 + + # Disable cdsprpcd daemon for sdm630 + setprop vendor.fastrpc.disable.cdsprpcd.daemon 1 + + # 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" | "467" | "468" ) + + # 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 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 + echo 50 > $cpubw/polling_interval + done + + done + + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + + # 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 "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 + echo 50 > $cpubw/polling_interval + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + 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 + echo 40 > $llccbw/polling_interval + done + done + + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + + # 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 "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 + echo 50 > $cpubw/polling_interval + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + 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 + echo 40 > $llccbw/polling_interval + 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 "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 40 > $npubw/polling_interval + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + done + + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + + # 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") + + #Apply settings for lito + if [ -f /sys/devices/soc0/soc_id ]; then + soc_id=`cat /sys/devices/soc0/soc_id` + fi + + case "$soc_id" in + "400" | "440" | "476" ) + # Core control parameters on silver + echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred + echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres + echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres + echo 8 > /sys/devices/system/cpu/cpu0/core_ctl/task_thres + echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms + + # Disable Core control on gold, prime + echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable + echo 0 > /sys/devices/system/cpu/cpu7/core_ctl/enable + + # Setting b.L scheduler parameters + echo 65 85 > /proc/sys/kernel/sched_downmigrate + echo 71 95 > /proc/sys/kernel/sched_upmigrate + echo 85 > /proc/sys/kernel/sched_group_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + echo 0 > /proc/sys/kernel/sched_coloc_busy_hyst_ns + echo 0 > /proc/sys/kernel/sched_coloc_busy_hysteresis_enable_cpus + echo 0 > /proc/sys/kernel/sched_coloc_busy_hyst_max_ms + + # disable unfiltering + echo 20000000 > /proc/sys/kernel/sched_task_unfilter_period + echo 1 > /proc/sys/kernel/sched_task_unfilter_nr_windows + + # configure governor settings for silver cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us + echo 1228800 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl + echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + echo 650000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq + + # configure governor settings for gold cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/down_rate_limit_us + echo 1228800 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/hispeed_freq + echo 85 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load + echo -6 > /sys/devices/system/cpu/cpu6/sched_load_boost + echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/pl + echo 672000 > /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/rtg_boost_freq + + # configure governor settings for gold+ cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy7/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/down_rate_limit_us + echo 1228800 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq + echo 85 > /sys/devices/system/cpu/cpu7/cpufreq/schedutil/hispeed_load + echo -6 > /sys/devices/system/cpu/cpu7/sched_load_boost + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/pl + echo 672000 > /sys/devices/system/cpu/cpufreq/policy7/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/rtg_boost_freq + + # colocation v3 settings + echo 51 > /proc/sys/kernel/sched_min_task_util_for_boost + echo 35 > /proc/sys/kernel/sched_min_task_util_for_colocation + + # Enable conservative pl + echo 1 > /proc/sys/kernel/sched_conservative_pl + + echo "0:1228800" > /sys/devices/system/cpu/cpu_boost/input_boost_freq + echo 120 > /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 "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 + echo 50 > $cpubw/polling_interval + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + 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 + echo 50 > $llccbw/polling_interval + 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 "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 40 > $npubw/polling_interval + 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 "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 40 > $npullccbw/polling_interval + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + done + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 0 + setprop vendor.dcvs.prop 1 + + # 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 lagoon + case "$soc_id" in + "434" | "459" ) + + # 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 + + # Disable Core control on gold + echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable + + + # disable unfiltering + echo 20000000 > /proc/sys/kernel/sched_task_unfilter_period + + # 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 + 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 + + # 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 1248000 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq + echo 652800 > /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq + + #colocation v3 settings + echo 740000 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/rtg_boost_freq + echo 0 > /sys/devices/system/cpu/cpufreq/policy6/schedutil/rtg_boost_freq + echo 51 > /proc/sys/kernel/sched_min_task_util_for_boost + + # 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/devices/system/cpu/cpu_boost/input_boost_freq + echo 120 > /sys/devices/system/cpu/cpu_boost/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 "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 + echo 50 > $cpubw/polling_interval + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + 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 + echo 40 > $llccbw/polling_interval + 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 "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 40 > $npubw/polling_interval + 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 "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 40 > $npullccbw/polling_interval + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + done + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + + # 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 off sleep modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + ;; + esac +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" | "420" | "444" | "445" | "469" | "470" ) + + # Core control is temporarily disabled till bring up + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable + echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus + # Core control parameters on big + echo 40 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres + echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres + echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms + echo 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres + + # Setting b.L scheduler parameters + echo 67 > /proc/sys/kernel/sched_downmigrate + echo 77 > /proc/sys/kernel/sched_upmigrate + echo 85 > /proc/sys/kernel/sched_group_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + + # cpuset settings + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + + # configure governor settings for little cluster + echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us + echo 1305600 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + echo 614400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rtg_boost_freq + + # configure governor settings for big cluster + echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_rate_limit_us + echo 1401600 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/hispeed_freq + echo 1056000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/rtg_boost_freq + + echo "0:1017600" > /sys/devices/system/cpu/cpu_boost/input_boost_freq + echo 80 > /sys/devices/system/cpu/cpu_boost/input_boost_ms + + 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 + + done + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + + # colcoation v3 disabled + echo 0 > /proc/sys/kernel/sched_min_task_util_for_boost + echo 0 > /proc/sys/kernel/sched_min_task_util_for_colocation + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # Turn on sleep modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + ;; + esac + + #power/perf tunings for khaje + case "$soc_id" in + "518" ) + + # Core control parameters on big + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable + 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 4 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres + + # Setting b.L scheduler parameters + echo 65 > /proc/sys/kernel/sched_downmigrate + echo 71 > /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 1516800 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq + echo 691200 > /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 1344000 > /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 "0:1190000" > /sys/devices/system/cpu/cpu_boost/input_boost_freq + echo 80 > /sys/devices/system/cpu/cpu_boost/input_boost_ms + + 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 + + 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 + echo "2288 3440 4173 5195 5859 7759 10322 11863 13763 15960" > $cpubw/bw_hwmon/mbps_zones + echo 85 > $cpubw/bw_hwmon/io_percent + 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 + + done + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + + # colcoation v3 disabled + echo 0 > /proc/sys/kernel/sched_min_task_util_for_boost + echo 0 > /proc/sys/kernel/sched_min_task_util_for_colocation + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # Turn on sleep modes + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + + ;; + esac + + # Scuba perf/power tunings + case "$soc_id" in + "441" | "471" | "473" | "474" ) + + # Quad-core device. disable core_ctl + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable + + # Configure schedutil governor settings + 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 + + # sched_load_boost as -6 is equivalent to target load as 85. + echo 0 > /proc/sys/kernel/sched_boost + 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 85 > /sys/devices/system/cpu/cpu0/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 + + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + + done + + # Disable low power modes. Enable it after LPM stable + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + ;; + esac + + ;; +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 + + 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 "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 + echo 50 > $cpubw/polling_interval + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + 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 + echo 40 > $llccbw/polling_interval + 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 "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 40 > $npubw/polling_interval + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + + done + + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + + # 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 + "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") + # cpuset parameters + target_varient=`getprop ro.build.product` + if [ "$target_varient" == "msmnile_gvmq" ]; then + echo 4-7 > /dev/cpuset/background/cpus + echo 4-7 > /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 + # 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 + + # 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 + # Enable oom_reaper + echo 1 > /proc/sys/vm/reap_mem_on_sigkill + + else + # 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 + + 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 + + # 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 "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 + echo 40 > $cpubw/polling_interval + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + 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 + echo 40 > $llccbw/polling_interval + 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 "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 40 > $npubw/polling_interval + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + done + + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 1 + + 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" | "3" | "4") + start_hbtp + ;; + esac + ;; + "HDK" ) + if [ -d /sys/kernel/hbtpsensor ] ; then + start_hbtp + fi + ;; + esac + + echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled + configure_memory_parameters + target_type=`getprop ro.hardware.type` + if [ -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 [ "$target_type" == "automotive" ]; then + # update frequencies + if [ "$soc_id" == "340" ] | [ "$soc_id" == "405" ]; then #sa8195 + configure_automotive_sku_parameters_sa8195 + else #sa8155 + configure_automotive_sku_parameters + fi + fi + fi + ;; +esac + +case "$target" in + "sdmshrike") + # Core control parameters for gold + echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres + echo 30 > /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms + echo 3 > /sys/devices/system/cpu/cpu4/core_ctl/task_thres + + # Core control parameters for gold+ + echo 0 > /sys/devices/system/cpu/cpu7/core_ctl/min_cpus + echo 60 > /sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres + echo 30 > /sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres + echo 100 > /sys/devices/system/cpu/cpu7/core_ctl/offline_delay_ms + echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/task_thres + # Controls how many more tasks should be eligible to run on gold CPUs + # w.r.t number of gold CPUs available to trigger assist (max number of + # tasks eligible to run on previous cluster minus number of CPUs in + # the previous cluster). + # + # Setting to 1 by default which means there should be at least + # 4 tasks eligible to run on gold cluster (tasks running on gold cores + # plus misfit tasks on silver cores) to trigger assitance from gold+. + echo 1 > /sys/devices/system/cpu/cpu7/core_ctl/nr_prev_assist_thresh + + # Disable Core control on silver + echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable + + # Setting b.L scheduler parameters + echo 95 95 > /proc/sys/kernel/sched_upmigrate + echo 85 85 > /proc/sys/kernel/sched_downmigrate + echo 100 > /proc/sys/kernel/sched_group_upmigrate + echo 10 > /proc/sys/kernel/sched_group_downmigrate + echo 1 > /proc/sys/kernel/sched_walt_rotate_big_tasks + + # cpuset parameters + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + # Turn off scheduler boost at the end + echo 0 > /proc/sys/kernel/sched_boost + + # configure governor settings for silver cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us + echo 1209600 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq + echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + echo 1 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/pl + + # configure governor settings for gold cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/down_rate_limit_us + echo 1612800 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/pl + + # configure governor settings for gold+ cluster + echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy7/scaling_governor + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/up_rate_limit_us + echo 0 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/down_rate_limit_us + echo 1612800 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq + echo 1 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/pl + + # configure input boost settings + echo "0:1324800" > /sys/module/cpu_boost/parameters/input_boost_freq + echo 120 > /sys/module/cpu_boost/parameters/input_boost_ms + + # Disable wsf, beacause we are using efk. + # wsf Range : 1..1000 So set to bare minimum value 1. + echo 1 > /proc/sys/vm/watermark_scale_factor + + echo 0-3 > /dev/cpuset/background/cpus + echo 0-3 > /dev/cpuset/system-background/cpus + + # Enable oom_reaper + if [ -f /sys/module/lowmemorykiller/parameters/oom_reaper ]; then + echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper + else + echo 1 > /proc/sys/vm/reap_mem_on_sigkill + fi + + # Enable bus-dcvs + for device in /sys/devices/platform/soc + do + for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw + do + echo "bw_hwmon" > $cpubw/governor + echo 40 > $cpubw/polling_interval + echo "2288 4577 7110 9155 12298 14236 15258" > $cpubw/bw_hwmon/mbps_zones + echo 4 > $cpubw/bw_hwmon/sample_ms + echo 50 > $cpubw/bw_hwmon/io_percent + echo 20 > $cpubw/bw_hwmon/hist_memory + echo 10 > $cpubw/bw_hwmon/hyst_length + echo 30 > $cpubw/bw_hwmon/down_thres + echo 0 > $cpubw/bw_hwmon/guard_band_mbps + echo 250 > $cpubw/bw_hwmon/up_scale + echo 1600 > $cpubw/bw_hwmon/idle_mbps + echo 14236 > $cpubw/max_freq + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + echo 40 > $llccbw/polling_interval + echo "1720 2929 3879 5931 6881 7980" > $llccbw/bw_hwmon/mbps_zones + echo 4 > $llccbw/bw_hwmon/sample_ms + echo 80 > $llccbw/bw_hwmon/io_percent + echo 20 > $llccbw/bw_hwmon/hist_memory + echo 10 > $llccbw/bw_hwmon/hyst_length + echo 30 > $llccbw/bw_hwmon/down_thres + echo 0 > $llccbw/bw_hwmon/guard_band_mbps + echo 250 > $llccbw/bw_hwmon/up_scale + echo 1600 > $llccbw/bw_hwmon/idle_mbps + echo 6881 > $llccbw/max_freq + done + + for npubw in $device/*npu-npu-ddr-bw/devfreq/*npu-npu-ddr-bw + do + echo 1 > /sys/devices/virtual/npu/msm_npu/pwr + echo "bw_hwmon" > $npubw/governor + echo 40 > $npubw/polling_interval + echo "1720 2929 3879 5931 6881 7980" > $npubw/bw_hwmon/mbps_zones + echo 4 > $npubw/bw_hwmon/sample_ms + echo 80 > $npubw/bw_hwmon/io_percent + echo 20 > $npubw/bw_hwmon/hist_memory + echo 6 > $npubw/bw_hwmon/hyst_length + echo 30 > $npubw/bw_hwmon/down_thres + echo 0 > $npubw/bw_hwmon/guard_band_mbps + echo 250 > $npubw/bw_hwmon/up_scale + echo 0 > $npubw/bw_hwmon/idle_mbps + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + + #Enable mem_latency governor for L3, LLCC, and DDR scaling + for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat + do + echo "mem_latency" > $memlat/governor + echo 10 > $memlat/polling_interval + echo 400 > $memlat/mem_latency/ratio_ceil + done + + #Enable userspace governor for L3 cdsp nodes + for l3cdsp in $device/*cdsp-cdsp-l3-lat/devfreq/*cdsp-cdsp-l3-lat + do + echo "cdspl3" > $l3cdsp/governor + done + + #Enable compute governor for gold latfloor + for latfloor in $device/*cpu-ddr-latfloor*/devfreq/*cpu-ddr-latfloor* + do + echo "compute" > $latfloor/governor + echo 10 > $latfloor/polling_interval + done + + #Gold L3 ratio ceil + for l3gold in $device/*cpu4-cpu-l3-lat/devfreq/*cpu4-cpu-l3-lat + do + echo 4000 > $l3gold/mem_latency/ratio_ceil + done + + #Prime L3 ratio ceil + for l3prime in $device/*cpu7-cpu-l3-lat/devfreq/*cpu7-cpu-l3-lat + do + echo 20000 > $l3prime/mem_latency/ratio_ceil + done + done + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + + if [ -f /sys/devices/soc0/platform_subtype_id ]; then + platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id` + fi + + case "$hw_platform" in + "MTP" | "Surf" | "RCM" ) + # Start Host based Touch processing + case "$platform_subtype_id" in + "0" | "1") + start_hbtp + ;; + esac + ;; + "HDK" ) + if [ -d /sys/kernel/hbtpsensor ] ; then + start_hbtp + fi + ;; + esac + + #Setting the min and max supported frequencies + reg_val=`cat /sys/devices/platform/soc/780130.qfprom/qfprom0/nvmem | od -An -t d4` + feature_id=$(((reg_val >> 20) & 0xFF)) + + #Setting the min supported frequencies + echo 1113600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 1171200 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq + 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 + echo 1651200000 > /sys/class/devfreq/soc\:qcom,cpu0-cpu-l3-lat/max_freq + echo 1651200000 > /sys/class/devfreq/soc\:qcom,cpu4-cpu-l3-lat/max_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 SA8195AA" + + #setting max cpu freq to 2.496GHz + echo 2496000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + #setting max gpu freq to 530 MHz + echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel + echo 1804 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq + elif [ $feature_id == 1 ] || [ $feature_id == 2 ]; then + echo "feature_id is 1 for external SA8195AB" + echo "feature_id is 2 for internal SA8195AB" + + #setting max cpu freq to 2.496GHz + echo 2496000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq + #setting max gpu freq to 670 MHz + echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel + echo 2092 > /sys/devices/platform/soc/soc:aop-set-ddr-freq/set_ddr_capped_freq + elif [ $feature_id == 3 ]; then + echo "feature_id is 3 for external SA8195AC" + 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") + rev=`cat /sys/devices/soc0/revision` + 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 [ $rev == "2.0" ] || [ $rev == "2.1" ]; 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 [ $rev == "2.0" ] || [ $rev == "2.1" ]; 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 "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 + echo 40 > $cpubw/polling_interval + done + + for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw + do + echo "bw_hwmon" > $llccbw/governor + 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 + echo 40 > $llccbw/polling_interval + 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 + 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 40 > $npubw/polling_interval + 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 "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 40 > $npullccbw/polling_interval + echo 0 > /sys/devices/virtual/npu/msm_npu/pwr + done + done + # memlat specific settings are moved to seperate file under + # device/target specific folder + setprop vendor.dcvs.prop 0 + setprop vendor.dcvs.prop 1 + 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" | "msmsteppe" | "sm6150" | "kona" | "lito" | "trinket" | "atoll" | "bengal" | "sdmshrike") + setprop vendor.post_boot.parsed 1 + ;; + "apq8084") + rm /data/system/perfd/default_values + start mpdecision + echo 512 > /sys/block/mmcblk0/bdi/read_ahead_kb + echo 512 > /sys/block/sda/bdi/read_ahead_kb + echo 512 > /sys/block/sdb/bdi/read_ahead_kb + echo 512 > /sys/block/sdc/bdi/read_ahead_kb + echo 512 > /sys/block/sdd/bdi/read_ahead_kb + echo 512 > /sys/block/sde/bdi/read_ahead_kb + echo 512 > /sys/block/sdf/bdi/read_ahead_kb + echo 512 > /sys/block/sdg/bdi/read_ahead_kb + echo 512 > /sys/block/sdh/bdi/read_ahead_kb + ;; + "msm7627a") + if [ -f /sys/devices/soc0/soc_id ]; then + soc_id=`cat /sys/devices/soc0/soc_id` + else + soc_id=`cat /sys/devices/system/soc/soc0/id` + fi + case "$soc_id" in + "127" | "128" | "129") + start mpdecision + ;; + esac + ;; +esac + +# Enable Power modes and set the CPU Freq Sampling rates +case "$target" in + "msm7627a") + start qosmgrd + echo 1 > /sys/module/pm2/modes/cpu0/standalone_power_collapse/idle_enabled + echo 1 > /sys/module/pm2/modes/cpu1/standalone_power_collapse/idle_enabled + echo 1 > /sys/module/pm2/modes/cpu0/standalone_power_collapse/suspend_enabled + echo 1 > /sys/module/pm2/modes/cpu1/standalone_power_collapse/suspend_enabled + #SuspendPC: + echo 1 > /sys/module/pm2/modes/cpu0/power_collapse/suspend_enabled + #IdlePC: + echo 1 > /sys/module/pm2/modes/cpu0/power_collapse/idle_enabled + echo 25000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate + ;; +esac + +# Change adj level and min_free_kbytes setting for lowmemory killer to kick in +case "$target" in + "msm7627a") + echo 0,1,2,4,9,12 > /sys/module/lowmemorykiller/parameters/adj + echo 5120 > /proc/sys/vm/min_free_kbytes + ;; +esac + +# Install AdrenoTest.apk if not already installed +if [ -f /data/prebuilt/AdrenoTest.apk ]; then + if [ ! -d /data/data/com.qualcomm.adrenotest ]; then + pm install /data/prebuilt/AdrenoTest.apk + fi +fi + +# Install SWE_Browser.apk if not already installed +if [ -f /data/prebuilt/SWE_AndroidBrowser.apk ]; then + if [ ! -d /data/data/com.android.swe.browser ]; then + pm install /data/prebuilt/SWE_AndroidBrowser.apk + fi +fi + +# Change adj level and min_free_kbytes setting for lowmemory killer to kick in +case "$target" in + "msm8660") + start qosmgrd + echo 0,1,2,4,9,12 > /sys/module/lowmemorykiller/parameters/adj + echo 5120 > /proc/sys/vm/min_free_kbytes + ;; +esac +# Let kernel know our image version/variant/crm_version +if [ -f /sys/devices/soc0/select_image ]; then + image_version="10:" + image_version+=`getprop ro.build.id` + image_version+=":" + image_version+=`getprop ro.build.version.incremental` + image_variant=`getprop ro.product.name` + image_variant+="-" + image_variant+=`getprop ro.build.type` + oem_version=`getprop ro.build.version.codename` + echo 10 > /sys/devices/soc0/select_image + echo $image_version > /sys/devices/soc0/image_version + echo $image_variant > /sys/devices/soc0/image_variant + echo $oem_version > /sys/devices/soc0/image_crm_version +fi + +# Change console log level as per console config property +console_config=`getprop persist.vendor.console.silent.config` +case "$console_config" in + "1") + echo "Enable console config to $console_config" + echo 0 > /proc/sys/kernel/printk + ;; + *) + echo "Enable console config to $console_config" + ;; +esac + +# Parse misc partition path and set property +misc_link=$(ls -l /dev/block/bootdevice/by-name/misc) +real_path=${misc_link##*>} +setprop persist.vendor.mmi.misc_dev_path $real_path diff --git a/rootdir/bin/init.qcom.sh b/rootdir/bin/init.qcom.sh new file mode 100755 index 0000000..b80e98a --- /dev/null +++ b/rootdir/bin/init.qcom.sh @@ -0,0 +1,465 @@ +#! /vendor/bin/sh + +# Copyright (c) 2009-2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of The Linux Foundation nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +target=`getprop ro.board.platform` +low_ram=`getprop ro.config.low_ram` +if [ -f /sys/devices/soc0/soc_id ]; then + platformid=`cat /sys/devices/soc0/soc_id` +else + platformid=`cat /sys/devices/system/soc/soc0/id` +fi + +start_battery_monitor() +{ + if ls /sys/bus/spmi/devices/qpnp-bms-*/fcc_data ; then + chown -h root.system /sys/module/pm8921_bms/parameters/* + chown -h root.system /sys/module/qpnp_bms/parameters/* + chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_data + chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_temp + chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_chgcyl + chmod 0660 /sys/module/qpnp_bms/parameters/* + chmod 0660 /sys/module/pm8921_bms/parameters/* + mkdir -p /data/bms + chown -h root.system /data/bms + chmod 0770 /data/bms + start battery_monitor + fi +} + +start_charger_monitor() +{ + if ls /sys/module/qpnp_charger/parameters/charger_monitor; then + chown -h root.system /sys/module/qpnp_charger/parameters/* + chown -h root.system /sys/class/power_supply/battery/input_current_max + chown -h root.system /sys/class/power_supply/battery/input_current_trim + chown -h root.system /sys/class/power_supply/battery/input_current_settled + chown -h root.system /sys/class/power_supply/battery/voltage_min + chmod 0664 /sys/class/power_supply/battery/input_current_max + chmod 0664 /sys/class/power_supply/battery/input_current_trim + chmod 0664 /sys/class/power_supply/battery/input_current_settled + chmod 0664 /sys/class/power_supply/battery/voltage_min + chmod 0664 /sys/module/qpnp_charger/parameters/charger_monitor + start charger_monitor + fi +} + +start_vm_bms() +{ + if [ -e /dev/vm_bms ]; then + chown -h root.system /sys/class/power_supply/bms/current_now + chown -h root.system /sys/class/power_supply/bms/voltage_ocv + chmod 0664 /sys/class/power_supply/bms/current_now + chmod 0664 /sys/class/power_supply/bms/voltage_ocv + start vm_bms + fi +} + +start_msm_irqbalance_8939() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + case "$platformid" in + "239" | "293" | "294" | "295" | "304" | "338" | "313" | "353" | "354") + start vendor.msm_irqbalance;; + "349" | "350" ) + start vendor.msm_irqbal_lb;; + esac + fi +} + +start_msm_irqbalance_msmnile() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + start vendor.msm_irqbalance + fi +} + +start_msm_irqbalance_kona() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + start vendor.msm_irqbalance + fi +} + +start_msm_irqbalance_lito() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + start vendor.msm_irqbalance + fi +} + +start_msm_irqbalance_atoll() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + start vendor.msm_irqbalance + fi +} + +start_msm_irqbalance660() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + case "$platformid" in + "317" | "321" | "324" | "325" | "326" | "336" | "345" | "346" | "360" | "393") + start vendor.msm_irqbalance;; + "318" | "327" | "385") + start vendor.msm_irqbl_sdm630;; + esac + fi +} + +start_msm_irqbalance() +{ + if [ -f /vendor/bin/msm_irqbalance ]; then + start vendor.msm_irqbalance + fi +} + +baseband=`getprop ro.baseband` +echo 1 > /proc/sys/net/ipv6/conf/default/accept_ra_defrtr + +case "$baseband" in + "svlte2a") + start bridgemgrd + ;; +esac + +case "$target" in + "msm7630_surf" | "msm7630_1x" | "msm7630_fusion") + if [ -f /sys/devices/soc0/hw_platform ]; then + value=`cat /sys/devices/soc0/hw_platform` + else + value=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + case "$value" in + "Fluid") + start profiler_daemon;; + esac + ;; + "msm8660" ) + if [ -f /sys/devices/soc0/hw_platform ]; then + platformvalue=`cat /sys/devices/soc0/hw_platform` + else + platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + case "$platformvalue" in + "Fluid") + start profiler_daemon;; + esac + ;; + "msm8960") + case "$baseband" in + "msm") + start_battery_monitor;; + esac + + if [ -f /sys/devices/soc0/hw_platform ]; then + platformvalue=`cat /sys/devices/soc0/hw_platform` + else + platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + case "$platformvalue" in + "Fluid") + start profiler_daemon;; + "Liquid") + start profiler_daemon;; + esac + ;; + "msm8974") + platformvalue=`cat /sys/devices/soc0/hw_platform` + case "$platformvalue" in + "Fluid") + start profiler_daemon;; + "Liquid") + start profiler_daemon;; + esac + case "$baseband" in + "msm") + start_battery_monitor + ;; + esac + start_charger_monitor + ;; + "sdm660") + if [ -f /sys/devices/soc0/soc_id ]; then + soc_id=`cat /sys/devices/soc0/soc_id` + else + soc_id=`cat /sys/devices/system/soc/soc0/id` + fi + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + + case "$soc_id" in + "317" | "324" | "325" | "326" | "318" | "327" ) + case "$hw_platform" in + "Surf") + setprop qemu.hw.mainkeys 0 + ;; + "MTP") + setprop qemu.hw.mainkeys 0 + ;; + "RCM") + setprop qemu.hw.mainkeys 0 + ;; + "QRD") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + esac + start_msm_irqbalance660 + ;; + "apq8084") + platformvalue=`cat /sys/devices/soc0/hw_platform` + case "$platformvalue" in + "Fluid") + start profiler_daemon;; + "Liquid") + start profiler_daemon;; + esac + ;; + "msm8226") + start_charger_monitor + ;; + "msm8610") + start_charger_monitor + ;; + "msm8916") + start_vm_bms + start_msm_irqbalance_8939 + if [ -f /sys/devices/soc0/soc_id ]; then + soc_id=`cat /sys/devices/soc0/soc_id` + else + soc_id=`cat /sys/devices/system/soc/soc0/id` + fi + + if [ -f /sys/devices/soc0/platform_subtype_id ]; then + platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id` + fi + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + fi + case "$soc_id" in + "239") + case "$hw_platform" in + "Surf") + case "$platform_subtype_id" in + "1") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + "MTP") + case "$platform_subtype_id" in + "3") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + esac + ;; + esac + ;; + "msm8994" | "msm8992" | "msm8998" | "apq8098_latv" | "sdm845" | "sdm710" | "qcs605" | "sm6150" | "trinket" | "bengal") + start_msm_irqbalance + ;; + "msm8996") + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + fi + case "$hw_platform" in + "MTP" | "CDP") + #Loop through the sysfs nodes and determine the correct sysfs to change the permission and ownership. + for count in 0 1 2 3 4 5 6 7 8 9 10 + do + dir="/sys/devices/soc/75ba000.i2c/i2c-12/12-0020/input/input"$count + if [ -d "$dir" ]; then + chmod 0660 $dir/secure_touch_enable + chmod 0440 $dir/secure_touch + chown system.drmrpc $dir/secure_touch_enable + chown system.drmrpc $dir/secure_touch + break + fi + done + ;; + esac + ;; + "msm8909") + start_vm_bms + ;; + "msmnile") + start_msm_irqbalance_msmnile + ;; + "kona") + start_msm_irqbalance_kona + ;; + "lito") + start_msm_irqbalance_lito + ;; + "atoll") + start_msm_irqbalance_atoll + ;; + "msm8937") + start_msm_irqbalance_8939 + if [ -f /sys/devices/soc0/soc_id ]; then + soc_id=`cat /sys/devices/soc0/soc_id` + else + soc_id=`cat /sys/devices/system/soc/soc0/id` + fi + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + if [ "$low_ram" != "true" ]; then + case "$soc_id" in + "294" | "295" | "303" | "307" | "308" | "309" | "313" | "320" | "353" | "354" | "363" | "364") + case "$hw_platform" in + "Surf") + setprop qemu.hw.mainkeys 0 + ;; + "MTP") + setprop qemu.hw.mainkeys 0 + ;; + "RCM") + setprop qemu.hw.mainkeys 0 + ;; + "QRD") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + esac + fi + ;; + "msm8953") + start_msm_irqbalance_8939 + if [ -f /sys/devices/soc0/soc_id ]; then + soc_id=`cat /sys/devices/soc0/soc_id` + else + soc_id=`cat /sys/devices/system/soc/soc0/id` + fi + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + case "$soc_id" in + "293" | "304" | "338" | "351" | "349" | "350" ) + case "$hw_platform" in + "Surf") + setprop qemu.hw.mainkeys 0 + ;; + "MTP") + setprop qemu.hw.mainkeys 0 + ;; + "RCM") + setprop qemu.hw.mainkeys 0 + ;; + "QRD") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + esac + ;; + "sdm710") + if [ -f /sys/devices/soc0/soc_id ]; then + soc_id=`cat /sys/devices/soc0/soc_id` + else + soc_id=`cat /sys/devices/system/soc/soc0/id` + fi + + if [ -f /sys/devices/soc0/hw_platform ]; then + hw_platform=`cat /sys/devices/soc0/hw_platform` + else + hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform` + fi + case "$soc_id" in + "336" | "337" | "347" | "360" | "393" ) + case "$hw_platform" in + "Surf") + setprop qemu.hw.mainkeys 0 + ;; + "MTP") + setprop qemu.hw.mainkeys 0 + ;; + "RCM") + setprop qemu.hw.mainkeys 0 + ;; + "QRD") + setprop qemu.hw.mainkeys 0 + ;; + esac + ;; + esac + ;; +esac + +# +# Make modem config folder and copy firmware config to that folder for RIL +# +if [ -f /data/vendor/modem_config/ver_info.txt ]; then + prev_version_info=`cat /data/vendor/modem_config/ver_info.txt` +else + prev_version_info="" +fi + +cur_version_info=`cat /vendor/firmware_mnt/verinfo/ver_info.txt` +if [ ! -f /vendor/firmware_mnt/verinfo/ver_info.txt -o "$prev_version_info" != "$cur_version_info" ]; then + # add W for group recursively before delete + chmod g+w -R /data/vendor/modem_config/* + rm -rf /data/vendor/modem_config/* + # preserve the read only mode for all subdir and files + cp --preserve=m -dr /vendor/firmware_mnt/image/modem_pr/mcfg/configs/* /data/vendor/modem_config + cp --preserve=m -d /vendor/firmware_mnt/verinfo/ver_info.txt /data/vendor/modem_config/ + cp --preserve=m -d /vendor/firmware_mnt/image/modem_pr/mbn_ota.txt /data/vendor/modem_config/ + # the group must be root, otherwise this script could not add "W" for group recursively + chown -hR radio.root /data/vendor/modem_config/* +fi +chmod g-w /data/vendor/modem_config +setprop ro.vendor.ril.mbn_copy_completed 1 + +#check build variant for printk logging +#current default minimum boot-time-default +buildvariant=`getprop ro.build.type` +case "$buildvariant" in + "userdebug" | "eng") + #set default loglevel to KERN_INFO + echo "4 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/vendor_modprobe.sh b/rootdir/bin/vendor_modprobe.sh new file mode 100755 index 0000000..cb54050 --- /dev/null +++ b/rootdir/bin/vendor_modprobe.sh @@ -0,0 +1,38 @@ +#! /vendor/bin/sh +#============================================================================= +# Copyright (c) 2019-2020 Qualcomm Technologies, Inc. +# All Rights Reserved. +# Confidential and Proprietary - Qualcomm Technologies, Inc. +#============================================================================= + +#default to /vendor/lib/modules +MODULES_PATH="/vendor/lib/modules/" +GKI_MOD_PATH="/vendor/lib/modules/5.4-gki" + +MODPROBE="/vendor/bin/modprobe" +MODULES=`${MODPROBE} -d ${MODULES_PATH} -l` + +# Find the first non-blacklisted module and try +# inserting it. If insertion fails the module is not +# compatible with the current kernel. Change the modules +# directory to gki. +for MODULE in ${MODULES}; do + cat ${MODULES_PATH}/modules.blocklist | grep $MODULE + if [ $? -ne 0 ]; then + break + fi +done + +${MODPROBE} -a -b -d ${MODULES_PATH} ${MODULE} +if [ $? -ne 0 ];then + MODULES_PATH=$GKI_MOD_PATH + MODULES=`${MODPROBE} -d ${MODULES_PATH} -l` +fi + +# Iterate over module list and modprobe them in background. +for MODULE in ${MODULES}; do + ${MODPROBE} -a -b -d ${MODULES_PATH} ${MODULE} & +done + +# Wait until all the modprobes are finished +wait diff --git a/rootdir/etc/charger_fstab.qti b/rootdir/etc/charger_fstab.qti new file mode 100644 index 0000000..87dd4a9 --- /dev/null +++ b/rootdir/etc/charger_fstab.qti @@ -0,0 +1,33 @@ +# Copyright (c) 2019 - 2020, 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. + +# Android fstab file. +# The filesystem that contains the filesystem checker binary (typically /system) cannot +# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK + +#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> +/dev/block/bootdevice/by-name/modem /vendor/firmware_mnt vfat ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait,slotselect diff --git a/rootdir/etc/fstab.default b/rootdir/etc/fstab.default new file mode 100644 index 0000000..ada9eb1 --- /dev/null +++ b/rootdir/etc/fstab.default @@ -0,0 +1,51 @@ +# Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted (subject to the limitations in the +# disclaimer below) 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. +# +# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE +# GRANTED BY THIS LICENSE. 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 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. + +# Android fstab file. +# The filesystem that contains the filesystem checker binary (typically /system) cannot +# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK + +#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> +system /system ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,avb_keys=/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey +system_ext /system_ext ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta_system,logical,first_stage_mount +product /product ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta_system,logical,first_stage_mount +vendor /vendor ext4 ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount +odm /odm ext4 ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount +/dev/block/by-name/metadata /metadata ext4 noatime,nosuid,nodev,discard wait,check,formattable,first_stage_mount +/dev/block/bootdevice/by-name/persist /mnt/vendor/persist ext4 noatime,nosuid,nodev,barrier=1 wait,check +/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,inlinecrypt,reserve_root=32768,resgid=1065,fsync_mode=nobarrier latemount,wait,check,formattable,fileencryption=aes-256-xts:aes-256-cts:v2+inlinecrypt_optimized+wrappedkey_v0,keydirectory=/metadata/vold/metadata_encryption,metadata_encryption=aes-256-xts:wrappedkey_v0,quota,reservedsize=128M,checkpoint=fs +/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults +/devices/platform/soc/4784000.sdhci/mmc_host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,encryptable=footer +/devices/platform/soc/*.ssusb/*.dwc3/xhci-hcd.*.auto* /storage/usbotg vfat nosuid,nodev wait,voldmanaged=usbotg:auto +/dev/block/bootdevice/by-name/modem /vendor/firmware_mnt vfat ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait,slotselect +/dev/block/bootdevice/by-name/dsp /vendor/dsp ext4 ro,nosuid,nodev,barrier=1 wait,slotselect +/dev/block/bootdevice/by-name/bluetooth /vendor/bt_firmware vfat ro,shortname=lower,uid=1002,gid=3002,dmask=227,fmask=337,context=u:object_r:bt_firmware_file:s0 wait,slotselect diff --git a/rootdir/etc/fstab.emmc b/rootdir/etc/fstab.emmc new file mode 100644 index 0000000..9e20177 --- /dev/null +++ b/rootdir/etc/fstab.emmc @@ -0,0 +1,51 @@ +# Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted (subject to the limitations in the +# disclaimer below) 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. +# +# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE +# GRANTED BY THIS LICENSE. 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 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. + +# Android fstab file. +# The filesystem that contains the filesystem checker binary (typically /system) cannot +# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK + +#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> +system /system ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,avb_keys=/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey +system_ext /system_ext ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta_system,logical,first_stage_mount +product /product ext4 ro,barrier=1,discard wait,slotselect,avb=vbmeta_system,logical,first_stage_mount +vendor /vendor ext4 ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount +odm /odm ext4 ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount +/dev/block/by-name/metadata /metadata ext4 noatime,nosuid,nodev,discard wait,check,formattable,first_stage_mount +/dev/block/bootdevice/by-name/persist /mnt/vendor/persist ext4 noatime,nosuid,nodev,barrier=1 wait,check +/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,inlinecrypt,reserve_root=32768,resgid=1065,fsync_mode=nobarrier latemount,wait,check,formattable,fileencryption=aes-256-xts:aes-256-cts:v2+emmc_optimized+wrappedkey_v0,metadata_encryption=aes-256-xts:wrappedkey_v0,keydirectory=/metadata/vold/metadata_encryption,quota,reservedsize=128M,checkpoint=fs +/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults +/devices/platform/soc/4784000.sdhci/mmc_host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,encryptable=footer +/devices/platform/soc/*.ssusb/*.dwc3/xhci-hcd.*.auto* /storage/usbotg vfat nosuid,nodev wait,voldmanaged=usbotg:auto +/dev/block/bootdevice/by-name/modem /vendor/firmware_mnt vfat ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait,slotselect +/dev/block/bootdevice/by-name/dsp /vendor/dsp ext4 ro,nosuid,nodev,barrier=1 wait,slotselect +/dev/block/bootdevice/by-name/bluetooth /vendor/bt_firmware vfat ro,shortname=lower,uid=1002,gid=3002,dmask=227,fmask=337,context=u:object_r:bt_firmware_file:s0 wait,slotselect diff --git a/rootdir/etc/init.batterysecret.rc b/rootdir/etc/init.batterysecret.rc new file mode 100644 index 0000000..abfc11a --- /dev/null +++ b/rootdir/etc/init.batterysecret.rc @@ -0,0 +1,31 @@ +on property:sys.boot_completed=1 + chmod 0664 /sys/class/Charging_Adapter/pd_adapter/usbpd_verifed + chmod 0664 /sys/class/Charging_Adapter/pd_adapter/request_vdm_cmd + chmod 0664 /sys/class/Charging_Adapter/pd_adapter/verify_process + chmod 0664 /sys/class/qcom-battery/odm_battery/pd_auth + chmod 0664 /sys/class/qcom-battery/odm_battery/verify_digest + chmod 0664 /sys/class/qcom-battery/odm_battery/real_type + chmod 0664 /sys/class/qcom-battery/odm_battery/authentic + chmod 0664 /sys/class/qcom-battery/odm_battery/input_suspend + +service batterysecret /vendor/bin/batterysecret + class last_start + user root + group system system wakelock + disabled + seclabel u:r:batterysecret:s0 + +on property:sys.boot_completed=1 + start batterysecret + +#run batterysecret in off-charge mode +on charger + start batterysecret + chmod 0664 /sys/class/Charging_Adapter/pd_adapter/usbpd_verifed + chmod 0664 /sys/class/Charging_Adapter/pd_adapter/request_vdm_cmd + chmod 0664 /sys/class/Charging_Adapter/pd_adapter/verify_process + chmod 0664 /sys/class/qcom-battery/odm_battery/pd_auth + chmod 0664 /sys/class/qcom-battery/odm_battery/verify_digest + chmod 0664 /sys/class/qcom-battery/odm_battery/real_type + chmod 0664 /sys/class/qcom-battery/odm_battery/authentic + chmod 0664 /sys/class/qcom-battery/odm_battery/input_suspend diff --git a/rootdir/etc/init.nfc.rc b/rootdir/etc/init.nfc.rc new file mode 100644 index 0000000..895fcee --- /dev/null +++ b/rootdir/etc/init.nfc.rc @@ -0,0 +1,15 @@ +# +# Copyright (C) 2021 The LineageOS Project +# +# SPDX-License-Identifier: Apache-2.0 +# + +service vendor.nfc_hal_service /vendor/bin/hw/android.hardware.nfc@1.2-service + override + class hal + user nfc + group nfc + disabled + +on boot && property:ro.boot.product.hardware.sku=nfc + enable vendor.nfc_hal_service diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc new file mode 100644 index 0000000..19736f4 --- /dev/null +++ b/rootdir/etc/init.qcom.rc @@ -0,0 +1,1581 @@ +# Copyright (c) 2009-2012, 2014-2020, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of The Linux Foundation nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +import /vendor/etc/init/hw/init.nfc.rc +import /vendor/etc/init/hw/init.qti.ufs.rc +import /vendor/etc/init/hw/init.qcom.usb.rc +import /vendor/etc/init/hw/init.qcom.test.rc +import /vendor/etc/init/hw/init.target.rc +import /vendor/etc/init/hw/init.qcom.factory.rc + +on early-init + mount debugfs debugfs /sys/kernel/debug + chmod 0755 /sys/kernel/debug + mount tracefs tracefs /sys/kernel/tracing + chmod 0755 /sys/kernel/tracing + + # create symlink for vendor mount points + symlink /vendor/firmware_mnt /firmware + symlink /vendor/bt_firmware /bt_firmware + symlink /vendor/dsp /dsp + + # Change ownership of hw_recovery related nodes + chown system graphics /sys/kernel/debug/dri/0/debug/dump + chown system graphics /sys/kernel/debug/dri/0/debug/recovery_reg + chown system graphics /sys/kernel/debug/dri/0/debug/recovery_dbgbus + chown system graphics /sys/kernel/debug/dri/0/debug/recovery_vbif_dbgbus + chown system graphics /sys/kernel/debug/dri/0/debug/recovery_dsi_dbgbus + + # Change ownership of sysfs power control node + chown system graphics /sys/class/drm/card0/device/power/control + + # Change ownership of sw_sync node + chown system graphics /sys/kernel/debug/sync/sw_sync + chmod 0666 /sys/kernel/debug/sync/sw_sync + + #Disable UFS clock scaling + write /sys/bus/platform/devices/1d84000.ufshc/clkscale_enable 0 + + chown root system /dev/kmsg + chmod 0620 /dev/kmsg + # Load WIGIG platform driver + exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -a -d /vendor/lib/modules msm_11ad_proxy + +on init + + # Support legacy paths + symlink /sdcard /mnt/sdcard + symlink /sdcard /storage/sdcard0 + + # Create cgroup mount point for memory + mkdir /sys/fs/cgroup/memory/bg 0750 root system + write /sys/fs/cgroup/memory/bg/memory.swappiness 140 + write /sys/fs/cgroup/memory/bg/memory.move_charge_at_immigrate 1 + chown root system /sys/fs/cgroup/memory/bg/tasks + chmod 0660 /sys/fs/cgroup/memory/bg/tasks + + #ExtR HONGMI-90103,jiyanan.wt,ADD,20211130,enbale WLAN PD restart + write /sys/bus/msm_subsys/devices/subsys2/restart_level related + +on post-fs + chmod 0755 /sys/kernel/debug/tracing + +on early-boot + # set RLIMIT_MEMLOCK to 64MB + setrlimit 8 67108864 67108864 + # Allow subsystem (modem etc) debugging + 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/devices/virtual/cvp/cvp/boot 1 + exec u:r:vendor_qti_init_shell:s0 -- /vendor/bin/init.qcom.early_boot.sh + exec u:r:vendor_qti_init_shell:s0 -- /vendor/bin/init.qti.can.sh + setprop ro.sf.lcd_density ${vendor.display.lcd_density} + + chown system system /mnt/vendor/persist/data/pfm/licenses + chmod 0775 /mnt/vendor/persist/data/pfm/licenses + chown system system /mnt/vendor/persist/data/pfm/licenses/store_0 + chmod 0664 /mnt/vendor/persist/data/pfm/licenses/store_0 + chown system system /mnt/vendor/persist/data/pfm/licenses/store_1 + chmod 0664 /mnt/vendor/persist/data/pfm/licenses/store_1 + chown system system /mnt/vendor/persist/data/pfm/licenses/store_2 + chmod 0664 /mnt/vendor/persist/data/pfm/licenses/store_2 + chown system system /mnt/vendor/persist/data/pfm/licenses/store_3 + chmod 0664 /mnt/vendor/persist/data/pfm/licenses/store_3 + chown system system /mnt/vendor/persist/data/pfm/licenses/store_4 + chmod 0664 /mnt/vendor/persist/data/pfm/licenses/store_4 + +on boot + chown bluetooth bluetooth /sys/module/bluetooth_power/parameters/power + chown bluetooth net_bt /sys/class/rfkill/rfkill0/type + chown bluetooth net_bt /sys/class/rfkill/rfkill0/state + chown bluetooth bluetooth /proc/bluetooth/sleep/proto + chown bluetooth bluetooth /sys/module/hci_uart/parameters/ath_lpm + chown bluetooth bluetooth /sys/module/hci_uart/parameters/ath_btwrite + chown system system /sys/module/sco/parameters/disable_esco + chown bluetooth bluetooth /sys/module/hci_smd/parameters/hcismd_set + chown system system /sys/module/msm_core/parameters/polling_interval + chown system system /sys/module/msm_core/parameters/disabled + chown system system /sys/kernel/debug/msm_core/enable + chown system system /sys/kernel/debug/msm_core/ptable + chown system system /sys/kernel/boot_slpi/ssr + chown system system /sys/module/radio_iris_transport/parameters/fmsmd_set + chmod 0660 /sys/module/bluetooth_power/parameters/power + chmod 0660 /sys/module/hci_smd/parameters/hcismd_set + chmod 0660 /sys/module/radio_iris_transport/parameters/fmsmd_set + chmod 0660 /sys/class/rfkill/rfkill0/state + chmod 0660 /proc/bluetooth/sleep/proto + chown bluetooth net_bt /dev/ttyHS0 + chmod 0660 /sys/module/hci_uart/parameters/ath_lpm + chmod 0660 /sys/module/hci_uart/parameters/ath_btwrite + chmod 0660 /dev/ttyHS0 + chown bluetooth bluetooth /sys/devices/platform/msm_serial_hs.0/clock + chmod 0660 /sys/devices/platform/msm_serial_hs.0/clock + + chmod 0660 /dev/ttyHS2 + chown bluetooth bluetooth /dev/ttyHS2 + + chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo + chmod 0660 /sys/class/rfkill/rfkill0/device/extldo + + # This location is used by QCRIL to host UNIX domain + # socket files used for internal IPC within QCRIL + # modules + mkdir /dev/socket/qmux_radio 0770 radio radio + chmod 2770 /dev/socket/qmux_radio + + mkdir /persist/drm 0770 system system + mkdir /persist/bluetooth 0770 bluetooth bluetooth + mkdir /persist/misc 0770 system system + mkdir /persist/alarm 0770 system system + mkdir /mnt/vendor/persist/time 0770 system system + mkdir /mnt/vendor/persist/secnvm 0770 system system + mkdir /mnt/vendor/persist/iar_db 0770 system system + mkdir /mnt/vendor/spunvm 0770 system system + + #Create WIGIG socket area + mkdir /dev/socket/wigig 0770 wifi wifi + + setprop wifi.interface wlan0 + + setprop persist.bluetooth.a2dp_offload.disabled false + + setprop ro.telephony.call_ring.multiple false + + #Remove SUID bit for iproute2 ip tool + chmod 0755 /system/bin/ip + + + chmod 0444 /sys/devices/platform/msm_hsusb/gadget/usb_state + + setprop net.tcp.2g_init_rwnd 10 + + # To prevent out of order acknowledgements from making + # connection tracking to treat them as not belonging to + # the connection they belong to. + # Otherwise, a weird issue happens in which some long + # connections on high-throughput links get dropped when + # an ack packet comes out of order + write /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal 1 + + # Set the console loglevel to < KERN_WARN + # Set the default message loglevel to KERN_INFO + write /proc/sys/kernel/printk "4 6 1 7" + + # Allow access for CCID command/response timeout configuration + chown system system /sys/module/ccid_bridge/parameters/bulk_msg_timeout + + # bond0 used by FST Manager + chown wifi wifi /sys/class/net/bond0/bonding/queue_id + + # Allow access to emmc rawdump block partition and dload sysfs node + chown root system /dev/block/bootdevice/by-name/rawdump + chmod 0660 /dev/block/bootdevice/by-name/rawdump + chown root system /sys/kernel/dload/emmc_dload + chmod 0660 /sys/kernel/dload/emmc_dload + chown root system /dev/block/bootdevice/by-name/ramdump + chmod 0660 /dev/block/bootdevice/by-name/ramdump + chown root system /sys/kernel/dload/dload_mode + chmod 0660 /sys/kernel/dload/dload_mode + + chown system system /sys/class/backlight/panel0-backlight/brightness + chown system system /sys/class/backlight/panel0-backlight/max_brightness + chown system system /sys/class/backlight/panel1-backlight/brightness + chown system system /sys/class/backlight/panel1-backlight/max_brightness + + # Allow access to sensors device attributes + chown system system /sys/class/sensors/MPU6050-accel/enable + chown system system /sys/class/sensors/MPU6050-accel/poll_delay + chown system system /sys/class/sensors/MPU6050-gyro/enable + chown system system /sys/class/sensors/MPU6050-gyro/poll_delay + chown system system /sys/class/sensors/apds9930-light/enable + chown system system /sys/class/sensors/apds9930-light/poll_delay + chown system system /sys/class/sensors/apds9930-proximity/enable + chown system system /sys/class/sensors/apds9930-proximity/poll_delay + + # Create directory used for display + # for backward compatibility + mkdir /persist/display 0770 system graphics + mkdir /mnt/vendor/persist/display 0770 system graphics + + # Create vpp directory + mkdir /mnt/vendor/persist/vpp 0770 media media + + + # Create hvdcp_opti directory + mkdir /mnt/vendor/persist/hvdcp_opti 0770 root system + + # limit discard size to 128MB in order to avoid long IO latency + write /sys/block/sda/queue/discard_max_bytes 134217728 + + chmod 0777 /sys/bus/coresight/devices/coresight-tmc-etr/block_size + chmod 0777 /dev/byte-cntr + + #enable coresight for diag_mdlog_system over qdss + write /sys/bus/coresight/devices/coresight-tmc-etr/buffer_size 0x2000000 + write /sys/bus/coresight/devices/coresight-tmc-etr/enable_sink 1 + write /sys/bus/coresight/devices/coresight-stm/enable_source 1 + write /sys/bus/coresight/devices/coresight-stm/hwevent_enable 0 + +# msm specific files that need to be created on /data +on post-fs-data + mkdir /data/vendor/misc 01771 system system + + # Create directory used for dump collection + mkdir /data/vendor/ssrdump 0770 root system + + # Create directory used by display clients + mkdir /data/vendor/display 0770 system graphics + + # Change lm related dirs + mkdir /data/vendor/lm 0700 root root + + # Create directory used by powermodule + mkdir /data/vendor/pwr 0700 root root + + # Create directory used by media clients + mkdir /data/vendor/media 0770 mediacodec media + + # Create /data/vendor/tzstorage directory for SFS listener + mkdir /data/vendor/tzstorage 0770 system system + + # Create directory for apps access via QTEEConnector + mkdir /data/vendor/qtee 0770 system system + + #Create folder of camera + mkdir /data/vendor/camera 0770 camera camera + + + #Create directory for tftp + mkdir /data/vendor/tombstones 0771 system system + mkdir /data/vendor/tombstones/rfs 0771 system system + + mkdir /data/vendor/ramdump 0771 root system + mkdir /data/vendor/bluetooth 0770 bluetooth bluetooth + mkdir /data/vendor/ramdump/bluetooth 0770 bluetooth bluetooth + + # Create the directories used by the Wireless subsystem + mkdir /data/vendor/wifi 0770 wifi wifi + mkdir /data/vendor/wifi/sockets 0770 wifi wifi + mkdir /data/vendor/wifi/hostapd 0770 wifi wifi + mkdir /data/vendor/wifi/hostapd/ctrl 0770 wifi wifi + mkdir /data/vendor/wifi/wpa_supplicant 0770 wifi wifi + mkdir /data/vendor/wifi/wigig_hostapd 0770 wifi wifi + mkdir /data/vendor/wifi/wpa 0770 wifi wifi + mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi + mkdir /data/vendor/wlan_logs_t 0770 system wifi + + #ExtR HONGMI-99227, jiyanan.wt, 20210903,ADD, generate bt/wlan addr file + mkdir /data/vendor/mac_addr 0775 root system + + # Create the directories used by WiGig Sensing + mkdir /data/vendor/sensing 0770 system wifi + + # Create the directories used by CnE subsystem + mkdir /data/vendor/connectivity 0771 radio radio + chown radio radio /data/vendor/connectivity + + # Create directory used by audio subsystem + mkdir /data/vendor/audio 0770 audio audio + + # Create directory for audio delta files + mkdir /data/vendor/audio/acdbdata 0770 media audio + mkdir /data/vendor/audio/acdbdata/delta 0770 media audio + + # Create directory for radio + mkdir /data/vendor/radio 0770 system radio + rm /data/vendor/radio/shmbus + + # Create directory for modem_config + mkdir /data/vendor/modem_config 0570 radio root + + # Mounting of persist is moved to 'on emmc-fs' and 'on fs' sections + # We chown/chmod /persist again so because mount is run as root + defaults + chown root system /persist + chmod 0771 /persist + chown system system /persist/WCNSS_qcom_wlan_nv.bin + chmod 0664 /sys/devices/platform/msm_sdcc.1/polling + chmod 0664 /sys/devices/platform/msm_sdcc.2/polling + chmod 0664 /sys/devices/platform/msm_sdcc.3/polling + chmod 0664 /sys/devices/platform/msm_sdcc.4/polling + + # Chown polling nodes as needed from UI running on system server + chown system system /sys/devices/platform/msm_sdcc.1/polling + chown system system /sys/devices/platform/msm_sdcc.2/polling + chown system system /sys/devices/platform/msm_sdcc.3/polling + chown system system /sys/devices/platform/msm_sdcc.4/polling + + #Create the symlink to qcn wpa_supplicant folder for ar6000 wpa_supplicant + #symlink /data/misc/wifi/wpa_supplicant /data/system/wpa_supplicant + + #Add for ir + chown system system /dev/ir_spi + chmod 0666 /dev/ir_spi + + #Create directories for Location services + mkdir /data/vendor/location 0770 gps gps + mkdir /data/vendor/location/mq 0770 gps gps + mkdir /data/vendor/location/xtwifi 0770 gps gps + mkdir /dev/socket/location 0770 gps gps + mkdir /dev/socket/location/mq 0770 gps gps + mkdir /dev/socket/location/xtra 0770 gps gps + mkdir /dev/socket/location/dgnss 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 a folder for SRS to be able to create a usercfg file + #mkdir /data/data/media 0770 media media + + #Create FM dir for patchdownloader + mkdir /data/vendor/fm 0770 system system + chmod 0770 /data/vendor/fm + + #Create PERFD deamon related dirs + mkdir /data/vendor/perfd 0770 root system + chmod 2770 /data/vendor/perfd + rm /data/vendor/perfd/default_values + + mkdir /data/vendor/secure_element 0777 system system + + #Create IOP deamon related dirs + mkdir /data/vendor/iop 0700 root system + + # Mark the copy complete flag to not completed + write /data/vendor/radio/copy_complete 0 + chown radio radio /data/vendor/radio/copy_complete + chmod 0660 /data/vendor/radio/copy_complete + + # copy prebuilt qcril.db files always + copy /vendor/radio/qcril_database/qcril.db /data/vendor/radio/qcril_prebuilt.db + chown radio radio /data/vendor/radio/qcril_prebuilt.db + chmod 0660 /data/vendor/radio/qcril_prebuilt.db + copy /vendor/radio/qcril_database/qcrilNr.db /data/vendor/radio/qcrilNr_prebuilt.db + copy /vendor/etc/qcril_database/qcrilNr.db /data/vendor/radio/qcrilNr_prebuilt.db + chown radio radio /data/vendor/radio/qcrilNr_prebuilt.db + chmod 0660 /data/vendor/radio/qcrilNr_prebuilt.db + + # File flags for prebuilt ril db file + write /data/vendor/radio/prebuilt_db_support 1 + chown radio radio /data/vendor/radio/prebuilt_db_support + chmod 0400 /data/vendor/radio/prebuilt_db_support + write /data/vendor/radio/db_check_done 0 + chown radio radio /data/vendor/radio/db_check_done + chmod 0660 /data/vendor/radio/db_check_done + + # qti-logkit data + mkdir /data/vendor/qti-logkit/ 0771 system system + mkdir /data/vendor/qti-logkit/shared-privileged/ 2770 system system + mkdir /data/vendor/qti-logkit/shared-public/ 2770 system diag + mkdir /data/vendor/qti-logkit/socket-privileged/ 2770 system system + mkdir /data/vendor/qti-logkit/socket-public/ 2750 system diag + mkdir /data/vendor/qti-logkit/logdata/ 2750 system shell + + #Create SWAP related dirs + mkdir /data/vendor/swap 0770 root system + chmod 2770 /data/vendor/swap + + # set aggressive read ahead for dm-0 and dm-1 during boot up + write /sys/block/dm-0/queue/read_ahead_kb 2048 + write /sys/block/dm-1/queue/read_ahead_kb 2048 + write /sys/block/dm-2/queue/read_ahead_kb 2048 + + # Create vpp directory + mkdir /data/vendor/vpp 0770 media media + + #Create dir for TUI + mkdir /data/vendor/tui 0700 system drmrpc + + #Create dir for dolby + mkdir /data/vendor/dolby 0770 media media + +service nqnfcinfo /system/vendor/bin/nqnfcinfo + class late_start + group nfc + user system + oneshot + +service iop /system/vendor/bin/iop + class main + user root + group root + disabled + socket iop seqpacket 0666 root system + +service qcomsysd /system/vendor/bin/qcom-system-daemon + class main + user root + group root diag oem_2901 + disabled + +on property:persist.vendor.qcomsysd.enabled=1 + enable qcomsysd + +on property:persist.vendor.qcomsysd.enabled=0 + stop qcomsysd + +service vendor.ssr_setup /system/vendor/bin/ssr_setup + oneshot + disabled + +service vendor.ss_ramdump /system/bin/subsystem_ramdump_system 2 + class main +# user system + group system bluetooth sdcard_rw everybody + ioprio rt 4 + disabled + +on property:ro.vendor.iocgrp.config=1 + mkdir /dev/blkio + mount cgroup none /dev/blkio blkio + chown system system /dev/blkio + chown system system /dev/blkio/tasks + chmod 0664 /dev/blkio/tasks + mkdir /dev/blkio/bg 0755 system system + chown system system /dev/blkio/bg/tasks + chmod 0664 /dev/blkio/bg/tasks + write /dev/blkio/blkio.weight 1000 + write /dev/blkio/bg/blkio.weight 100 + +on property:persist.sys.ssr.enable_debug=* + write /sys/module/subsystem_restart/parameters/enable_debug ${persist.sys.ssr.enable_debug} + +on property:persist.sys.mba_boot_timeout=* + write /sys/module/pil_msa/parameters/pbl_mba_boot_timeout_ms ${persist.sys.mba_boot_timeout} + +on property:persist.sys.modem_auth_timeout=* + write /sys/module/pil_msa/parameters/modem_auth_timeout_ms ${persist.sys.modem_auth_timeout} + +on property:persist.sys.pil_proxy_timeout=* + write /sys/module/peripheral_loader/parameters/proxy_timeout_ms ${persist.sys.pil_proxy_timeout} + +on property:persist.vendor.ssr.restart_level=* + start vendor.ssr_setup + +on property:persist.vendor.ssr.enable_ramdumps=1 + write /sys/module/subsystem_restart/parameters/enable_ramdumps 1 + mkdir /data/vendor/ramdump_ssr 770 system system +# start vendor.ss_ramdump + +on property:persist.vendor.ssr.enable_ramdumps=0 + write /sys/module/subsystem_restart/parameters/enable_ramdumps 0 + +on property:persist.vendor.sys.rawdump_copy=1 + write /sys/kernel/dload/emmc_dload 1 + +on property:persist.vendor.sys.rawdump_copy=0 + write /sys/kernel/dload/emmc_dload 0 + +on property:sys.boot_completed=1 + write /dev/kmsg "Boot completed " + #Enable UFS clock scaling back + write /sys/bus/platform/devices/1d84000.ufshc/clkscale_enable 1 + #Reset read ahead for dm-0 and dm-1 to 512kb + write /sys/block/dm-0/queue/read_ahead_kb 512 + write /sys/block/dm-1/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 + #Reinit lmkd to reconfigure lmkd properties + setprop lmkd.reinit 1 + write /sys/kernel/dload/dload_mode "both" + write /sys/kernel/dload/emmc_dload 1 + +on property:persist.vendor.radio.atfwd.start=false + stop vendor.atfwd + +on property:vendor.radio.atfwd.start=false + stop vendor.atfwd + +# corefile limit +on property:persist.debug.trace=1 + mkdir /data/core 0777 root root + write /proc/sys/kernel/core_pattern "/data/core/core-%e-%p" + +on property:vendor.media.target.version=* + setprop vendor.sys.media.target.version ${vendor.media.target.version} + +on property:vendor.netflix.bsp_rev=* + setprop ro.netflix.bsp_rev ${vendor.netflix.bsp_rev} + +on property:vendor.media.target_variant=* + setprop ro.media.xml_variant.codecs ${vendor.media.target_variant} + setprop ro.media.xml_variant.codecs_performance ${vendor.media.target_variant} + +service qcom-c_core-sh /vendor/bin/init.qcom.class_core.sh + class core + user root + oneshot + +service qcom-c_main-sh /vendor/bin/init.class_main.sh + class main + user root + group root system + oneshot + +on property:vold.decrypt=trigger_restart_framework + start qcom-c_main-sh + start wcnss-service + +service vendor.qrtr-ns /vendor/bin/qrtr-ns -f + class core + user vendor_qrtr + group vendor_qrtr + capabilities NET_BIND_SERVICE + +service irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config" + class core + user root + oneshot + +service qmiproxy /system/bin/qmiproxy + class main + user radio + group radio diag + disabled + +service vendor.wigig_supplicant /vendor/bin/hw/wpa_supplicant \ + -iwigig0 -Dnl80211 -c/data/vendor/wifi/wigig_supplicant.conf \ + -m/data/vendor/wifi/wigig_p2p_supplicant.conf \ + -O/data/vendor/wifi/wigig_sockets -dd \ + -e/data/vendor/wifi/wigig_entropy.bin -g@android:wigig/wpa_wigig0 \ + -S wigigsvc + # we will start as root and wpa_supplicant will switch to user wifi + # after setting up the capabilities required for WEXT + # user wifi + # group wifi inet keystore + class main + socket wigig/wpa_wigig0 dgram 660 wifi wifi + disabled + oneshot + +# Data Migration +service vendor.move_wifi_data /system/bin/move_wifi_data.sh + class main + user wifi + group wifi + disabled + oneshot + +service wigignpt /vendor/bin/wigignpt + class hal + socket wigig/wigignpt stream 660 system wifi + user system + group wifi + capabilities NET_ADMIN + disabled + +on property:persist.vendor.wigig.npt.enable=1 + start wigignpt + +service vendor.sensingdaemon /vendor/bin/sensingdaemon + class hal + socket wigig/sensingdaemon stream 660 system wifi + user system + group wifi + disabled + +service dhcpcd_wlan0 /system/bin/dhcpcd -ABKLG + class late_start + disabled + oneshot + +service dhcpcd_bond0 /system/bin/dhcpcd -ABKLG + class late_start + disabled + oneshot + +service dhcpcd_p2p /system/bin/dhcpcd -ABKLG + class late_start + disabled + oneshot + +service dhcpcd_wigig0 /system/bin/dhcpcd -ABKLG + class late_start + disabled + oneshot + +service iprenew_wlan0 /system/bin/dhcpcd -n + class late_start + disabled + oneshot + +service iprenew_bond0 /system/bin/dhcpcd -n + class late_start + disabled + oneshot + +service iprenew_p2p /system/bin/dhcpcd -n + class late_start + disabled + oneshot + +service iprenew_wigig0 /system/bin/dhcpcd -n + class late_start + disabled + oneshot + +#+ExtR HONGMI-89895 jiyanan 20210922 add for capture wifi full log start +service vendor.cnss_diag /vendor/bin/cnss_diag -q -f + class late_start + user system + group system wifi inet net_admin sdcard_rw media_rw diag + disabled + oneshot + +service vendor.tcpdump /vendor/bin/tcpdump -i any -W 2 -C 2 -s 134 -w /data/vendor/wlan_logs_t/tcpdump.pcap + class main + disabled + oneshot + +service sniffer /vendor/bin/tcpdump -i wlan0 -w /data/vendor/wlan_logs_t/sniffer.pcap + class main + disabled + oneshot + +on property:vendor.wififulllog.value=true + chmod 0664 /data/vendor/wlan_logs_t/tcpdump.pcap0 + chown system root /data/vendor/wlan_logs_t/tcpdump.pcap0 + start vendor.cnss_diag + start vendor.tcpdump + +on property:vendor.wififulllog.value=false + stop vendor.cnss_diag + stop vendor.tcpdump + chmod 0664 /data/vendor/wlan_logs_t/tcpdump.pcap0 + chown system root /data/vendor/wlan_logs_t/tcpdump.pcap0 + chmod 0664 /data/vendor/wlan_logs_t/tcpdump.pcap1 + chown system root /data/vendor/wlan_logs_t/tcpdump.pcap1 + chmod 0664 /data/vendor/wlan_logs_t/tcpdump.pcap2 + chown system root /data/vendor/wlan_logs_t/tcpdump.pcap2 + chmod 0664 /data/vendor/wlan_logs_t/tcpdump.pcap3 + chown system root /data/vendor/wlan_logs_t/tcpdump.pcap3 + chmod 0664 /data/vendor/wlan_logs_t/tcpdump.pcap4 + chown system root /data/vendor/wlan_logs_t/tcpdump.pcap4 + chmod 0664 /data/vendor/wlan_logs_t/tcpdump.pcap5 + chown system root /data/vendor/wlan_logs_t/tcpdump.pcap5 + chmod 0664 /data/vendor/wlan_logs_t/tcpdump.pcap6 + chown system root /data/vendor/wlan_logs_t/tcpdump.pcap6 + chmod 0664 /data/vendor/wlan_logs_t/tcpdump.pcap7 + chown system root /data/vendor/wlan_logs_t/tcpdump.pcap7 + chmod 0664 /data/vendor/wlan_logs_t/tcpdump.pcap8 + chown system root /data/vendor/wlan_logs_t/tcpdump.pcap8 + chmod 0664 /data/vendor/wlan_logs_t/tcpdump.pcap9 + chown system root /data/vendor/wlan_logs_t/tcpdump.pcap9 + chmod 0664 /data/vendor/wlan_logs_t/tcpdump.pcap10 + chown system root /data/vendor/wlan_logs_t/tcpdump.pcap10 + +service startpktlog /system/bin/iwpriv wlan0 pktlog 2 + class main + user root + group root + disabled + oneshot + +service stoppktlog /system/bin/iwpriv wlan0 pktlog 0 + class main + user root + group root + disabled + oneshot + +on property:wifi.pktlog.debug.0.chen=false + start stoppktlog + +on property:wifi.pktlog.debug.0.chen=true + start startpktlog +#-ExtR HONGMI-89895 jiyanan 20210922 add for capture wifi full log start + +#+ExtB HONGMI-89820,liupeng.wt.Add,20211011 add wifi sar + +#india k6s +#2g head sar +on property:vendor.sysctl.tx=1 + stop wpa_cli01 + stop wpa_cli02 + stop wpa_cli03 + stop wpa_cli04 + stop wpa_cli05 + stop wpa_cli06 + start wpa_cli01 +service wpa_cli01 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 29 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#india k6s +#2g body sar +on property:vendor.sysctl.tx=2 + stop wpa_cli01 + stop wpa_cli02 + stop wpa_cli03 + stop wpa_cli04 + stop wpa_cli05 + stop wpa_cli06 + start wpa_cli02 +service wpa_cli02 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 37 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#india k6s +#2g restore +on property:vendor.sysctl.tx=3 + stop wpa_cli01 + stop wpa_cli02 + stop wpa_cli03 + stop wpa_cli04 + stop wpa_cli05 + stop wpa_cli06 + start wpa_cli03 +service wpa_cli03 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 37 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#india k6s +#5g head sar +on property:vendor.sysctl.tx=4 + stop wpa_cli01 + stop wpa_cli02 + stop wpa_cli03 + stop wpa_cli04 + stop wpa_cli05 + stop wpa_cli06 + start wpa_cli04 +service wpa_cli04 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 23 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#india k6s +#5g body sar +on property:vendor.sysctl.tx=5 + stop wpa_cli01 + stop wpa_cli02 + stop wpa_cli03 + stop wpa_cli04 + stop wpa_cli05 + stop wpa_cli06 + start wpa_cli05 +service wpa_cli05 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 32 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#india k6s +#5g restore +on property:vendor.sysctl.tx=6 + stop wpa_cli01 + stop wpa_cli02 + stop wpa_cli03 + stop wpa_cli04 + stop wpa_cli05 + stop wpa_cli06 + start wpa_cli06 +service wpa_cli06 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 32 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#india k6p +#2g head sar +on property:vendor.sysctl.tx=11 + stop wpa_cli11 + stop wpa_cli12 + stop wpa_cli13 + stop wpa_cli14 + stop wpa_cli15 + stop wpa_cli16 + start wpa_cli11 +service wpa_cli11 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 29 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#india k6p +#2g body sar +on property:vendor.sysctl.tx=12 + stop wpa_cli11 + stop wpa_cli12 + stop wpa_cli13 + stop wpa_cli14 + stop wpa_cli15 + stop wpa_cli16 + start wpa_cli12 +service wpa_cli12 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 37 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#india k6p +#2g restore +on property:vendor.sysctl.tx=13 + stop wpa_cli11 + stop wpa_cli12 + stop wpa_cli13 + stop wpa_cli14 + stop wpa_cli15 + stop wpa_cli16 + start wpa_cli13 +service wpa_cli13 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 37 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#india k6p +#5g head sar +on property:vendor.sysctl.tx=14 + stop wpa_cli11 + stop wpa_cli12 + stop wpa_cli13 + stop wpa_cli14 + stop wpa_cli15 + stop wpa_cli16 + start wpa_cli14 +service wpa_cli14 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 20 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#india k6p +#5g body sar +on property:vendor.sysctl.tx=15 + stop wpa_cli11 + stop wpa_cli12 + stop wpa_cli13 + stop wpa_cli14 + stop wpa_cli15 + stop wpa_cli16 + start wpa_cli15 +service wpa_cli15 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 28 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#india k6p +#5g restore +on property:vendor.sysctl.tx=16 + stop wpa_cli11 + stop wpa_cli12 + stop wpa_cli13 + stop wpa_cli14 + stop wpa_cli15 + stop wpa_cli16 + start wpa_cli16 +service wpa_cli16 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 28 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#CN k6s +#2g head sar +on property:vendor.sysctl.tx=21 + stop wpa_cli21 + stop wpa_cli22 + stop wpa_cli23 + stop wpa_cli24 + stop wpa_cli25 + stop wpa_cli26 + start wpa_cli21 +service wpa_cli21 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 33 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#CN k6s +#2g body sar +on property:vendor.sysctl.tx=22 + stop wpa_cli21 + stop wpa_cli22 + stop wpa_cli23 + stop wpa_cli24 + stop wpa_cli25 + stop wpa_cli26 + start wpa_cli22 +service wpa_cli22 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 38 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#CN k6s +#2g restore +on property:vendor.sysctl.tx=23 + stop wpa_cli21 + stop wpa_cli22 + stop wpa_cli23 + stop wpa_cli24 + stop wpa_cli25 + stop wpa_cli26 + start wpa_cli23 +service wpa_cli23 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 38 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#CN k6s +#5g head sar +on property:vendor.sysctl.tx=24 + stop wpa_cli21 + stop wpa_cli22 + stop wpa_cli23 + stop wpa_cli24 + stop wpa_cli25 + stop wpa_cli26 + start wpa_cli24 +service wpa_cli24 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 27 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#CN k6s +#5g body sar +on property:vendor.sysctl.tx=25 + stop wpa_cli21 + stop wpa_cli22 + stop wpa_cli23 + stop wpa_cli24 + stop wpa_cli25 + stop wpa_cli26 + start wpa_cli25 +service wpa_cli25 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 36 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#CN k6s +#5g restore +on property:vendor.sysctl.tx=26 + stop wpa_cli21 + stop wpa_cli22 + stop wpa_cli23 + stop wpa_cli24 + stop wpa_cli25 + stop wpa_cli26 + start wpa_cli26 +service wpa_cli26 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 36 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#JP k6s +#2g head sar +on property:vendor.sysctl.tx=31 + stop wpa_cli31 + stop wpa_cli32 + stop wpa_cli33 + stop wpa_cli34 + stop wpa_cli35 + stop wpa_cli36 + start wpa_cli31 +service wpa_cli31 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 24 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#JP k6s +#2g body sar +on property:vendor.sysctl.tx=32 + stop wpa_cli31 + stop wpa_cli32 + stop wpa_cli33 + stop wpa_cli34 + stop wpa_cli35 + stop wpa_cli36 + start wpa_cli32 +service wpa_cli32 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 37 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#JP k6s +#2g restore +on property:vendor.sysctl.tx=33 + stop wpa_cli31 + stop wpa_cli32 + stop wpa_cli33 + stop wpa_cli34 + stop wpa_cli35 + stop wpa_cli36 + start wpa_cli33 +service wpa_cli33 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 37 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#JP k6s +#5g head sar +on property:vendor.sysctl.tx=34 + stop wpa_cli31 + stop wpa_cli32 + stop wpa_cli33 + stop wpa_cli34 + stop wpa_cli35 + stop wpa_cli36 + start wpa_cli34 +service wpa_cli34 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 19 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#JP k6s +#5g body sar +on property:vendor.sysctl.tx=35 + stop wpa_cli31 + stop wpa_cli32 + stop wpa_cli33 + stop wpa_cli34 + stop wpa_cli35 + stop wpa_cli36 + start wpa_cli35 +service wpa_cli35 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 32 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#JP k6s +#5g restore +on property:vendor.sysctl.tx=36 + stop wpa_cli31 + stop wpa_cli32 + stop wpa_cli33 + stop wpa_cli34 + stop wpa_cli35 + stop wpa_cli36 + start wpa_cli36 +service wpa_cli36 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 32 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#GL k6s +#2g head sar +on property:vendor.sysctl.tx=41 + stop wpa_cli41 + stop wpa_cli42 + stop wpa_cli43 + stop wpa_cli44 + stop wpa_cli45 + stop wpa_cli46 + start wpa_cli41 +service wpa_cli41 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 24 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#GL k6s +#2g body sar +on property:vendor.sysctl.tx=42 + stop wpa_cli41 + stop wpa_cli42 + stop wpa_cli43 + stop wpa_cli44 + stop wpa_cli45 + stop wpa_cli46 + start wpa_cli42 +service wpa_cli42 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 37 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#GL k6s +#2g restore +on property:vendor.sysctl.tx=43 + stop wpa_cli41 + stop wpa_cli42 + stop wpa_cli43 + stop wpa_cli44 + stop wpa_cli45 + stop wpa_cli46 + start wpa_cli43 +service wpa_cli43 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 37 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#GL k6s +#5g head sar +on property:vendor.sysctl.tx=44 + stop wpa_cli41 + stop wpa_cli42 + stop wpa_cli43 + stop wpa_cli44 + stop wpa_cli45 + stop wpa_cli46 + start wpa_cli44 +service wpa_cli44 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 19 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#GL k6s +#5g body sar +on property:vendor.sysctl.tx=45 + stop wpa_cli41 + stop wpa_cli42 + stop wpa_cli43 + stop wpa_cli44 + stop wpa_cli45 + stop wpa_cli46 + start wpa_cli45 +service wpa_cli45 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 32 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#GL k6s +#5g restore +on property:vendor.sysctl.tx=46 + stop wpa_cli41 + stop wpa_cli42 + stop wpa_cli43 + stop wpa_cli44 + stop wpa_cli45 + stop wpa_cli46 + start wpa_cli46 +service wpa_cli46 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 32 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + +#KR k6s no sar power +#2g head sar +on property:vendor.sysctl.tx=51 + start wpa_cli51 +service wpa_cli51 /vendor/bin/wpa_cli driver SET_TX_POWER_CALLING 8 + class main + user root + group root + disabled + oneshot + seclabel u:r:sar:s0 + + +#-ExtB HONGMI-89820,liupeng.wt.Add,20211011 add wifi sar + +service ptt_socket_app /system/vendor/bin/ptt_socket_app -d + class main + user wifi + group wifi system inet net_admin + capabilities NET_ADMIN + oneshot + +service ptt_ffbm /system/vendor/bin/ptt_socket_app -f -d + user root + group root + disabled + oneshot + +service wifi_ftmd /system/vendor/bin/wifi_ftmd + user system + group system inet net_admin + socket wififtmd_server dgram 0660 system system + disabled + oneshot + +on property:vendor.wifi.ftmd.load=true + insmod /system/lib/modules/pronto/pronto_wlan.ko con_mode=5 + +service cnss-daemon /system/vendor/bin/cnss-daemon -n -l + class late_start + user system + group system inet net_admin wifi + capabilities NET_ADMIN + +on property:sys.shutdown.requested=* + write /sys/kernel/shutdown_wlan/shutdown 1 + stop cnss-daemon + +service dhcpcd_bt-pan /system/bin/dhcpcd -BKLG + class late_start + disabled + oneshot + +service iprenew_bt-pan /system/bin/dhcpcd -n + class late_start + disabled + oneshot + +service ssgqmigd /vendor/bin/ssgqmigd + class late_start + user radio + group radio gps system + socket ssgqmig seqpacket 0660 radio inet + +service mlid /vendor/bin/mlid + class late_start + user gps + group gps + socket mlid stream 0666 gps gps + +service loc_launcher /system/vendor/bin/loc_launcher + class late_start + user gps + group gps + +service qcom-sh /vendor/bin/init.qcom.sh + class late_start + user root + group root system radio + oneshot +# Remove since is deprecated but throws AVC denial. +# service crashdata-sh /vendor/bin/init.qcom.crashdata.sh +# class late_start +# user root +# oneshot + +service qcom-post-boot /vendor/bin/init.qcom.post_boot.sh + class late_start + user root + group root system wakelock graphics + disabled + oneshot + +service qti-testscripts /system/bin/sh /product/etc/init.qcom.testscripts.sh + class late_start + user root + disabled + oneshot + seclabel u:r:qti-testscripts:s0 + +service wifi-sdio-on /vendor/bin/init.qcom.sdio.sh + class late_start + group wifi inet + disabled + oneshot + +service wifi-crda /vendor/bin/init.crda.sh + class late_start + user root + disabled + oneshot + +on property:sys.boot_completed=1 + start qcom-post-boot + start qti-testscripts + +on property:ro.vendor.ril.mbn_copy_completed=1 + write /data/vendor/radio/copy_complete 1 + +service qvop-daemon /vendor/bin/qvop-daemon + class late_start + user system + group system drmrpc + +service vendor.atfwd /vendor/bin/ATFWD-daemon + class late_start + user system + group system radio + +service hostapd_fst /vendor/bin/hw/hostapd -dd -g /data/vendor/wifi/hostapd/global + class main + capabilities NET_ADMIN NET_RAW + user wifi + group wifi + disabled + oneshot + +service battery_monitor /system/bin/battery_monitor + user system + group system + disabled + +service vendor.ril-daemon2 /vendor/bin/hw/rild -c 2 + class main + user radio + disabled + group radio cache inet misc audio sdcard_r sdcard_rw diag oem_2901 log + capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW + +service vendor.ril-daemon3 /vendor/bin/hw/rild -c 3 + class main + user radio + disabled + group radio cache inet misc audio sdcard_r sdcard_rw diag oem_2901 log + capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW + +service profiler_daemon /system/bin/profiler_daemon + class late_start + user root + group root + disabled + +service charger /system/bin/charger + class charger + user system + group system graphics input + capabilities SYS_BOOT + seclabel u:r:charger:s0 + +service vendor.ssr_diag /system/vendor/bin/ssr_diag + class late_start + user system + group system + disabled + +#HONGMI-102656, wuwenting.wt, modify, 20211012, change diag command +service diag_mdlog_start /system/vendor/bin/diag_mdlog -q 2 -u + class late_start + user shell + group system oem_2901 sdcard_rw sdcard_r media_rw + disabled + oneshot + +service diag_mdlog_stop /system/vendor/bin/diag_mdlog -k + class late_start + user shell + group system oem_2901 sdcard_rw sdcard_r media_rw + disabled + oneshot + +service qlogd /system/xbin/qlogd + socket qlogd stream 0662 system system + class main + disabled +on property:persist.sys.qlogd=1 + start qlogd +on property:persist.sys.qlogd=0 + stop qlogd + +service vm_bms /vendor/bin/vm_bms + user root + group root + disabled + +service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /system/vendor/etc/msm_irqbalance.conf + class core + user root + group root + disabled + +service vendor.msm_irqbal_lb /vendor/bin/msm_irqbalance -f /system/vendor/etc/msm_irqbalance_little_big.conf + class core + user root + group root + disabled + +service vendor.msm_irqbl_sdm630 /vendor/bin/msm_irqbalance -f /system/vendor/etc/msm_irqbalance_sdm630.conf + class core + user root + group root + disabled + +# service for USERDEBUG +service vendor.LKCore-dbg /vendor/bin/LKCore + class late_start + oneshot + disabled + user root + group root system log diag net_raw + +# service for USER +service vendor.LKCore-rel /vendor/bin/LKCore + class late_start + oneshot + disabled + user system + group system log diag + +service qseeproxydaemon /system/vendor/bin/qseeproxydaemon + class late_start + user system + group system + +service esepmdaemon /system/vendor/bin/esepmdaemon + class core + user system + group nfc + +on charger + setprop persist.sys.usb.config mass_storage + start qcom-post-boot + +#add poweroffhandler +service poweroffhandler /system/vendor/bin/poweroffhandler + class core + user media + group graphics audio + disabled + oneshot + +service time_daemon /vendor/bin/time_daemon + class main + user system + group system + capabilities SYS_TIME + +# Set vendor-ril lib path based on Meta version +on property:vendor.rild.libpath=* + setprop rild.libpath ${vendor.rild.libpath} + +on property:ro.vendor.radio.noril=* + setprop ro.radio.noril ${ro.vendor.radio.noril} + +service vendor.power_off_alarm /vendor/bin/power_off_alarm + class core + group system + disabled + oneshot + +service vendor.hbtp /vendor/bin/hbtp_daemon + class main + user system + group system + capabilities SYS_NICE + disabled + +service chre /vendor/bin/chre + class late_start + user system + group system + socket chre seqpacket 0660 root system + shutdown critical + +on property:vendor.chre.enabled=0 + stop chre + +service bugreport /system/bin/dumpstate -d -p -B -z -o /data/user_de/0/com.android.shell/files/bugreports/bugreport + class main + disabled + oneshot + keycodes 114 115 116 + +#Set GPU Opengles version +on property:vendor.opengles.version=* + setprop ro.opengles.version ${vendor.opengles.version} + +#Set gpu available frequencies property +on property:vendor.gpu.available_frequencies=* + setprop ro.vendor.gpu.available_frequencies ${vendor.gpu.available_frequencies} + +service vendor.audio-hal /vendor/bin/hw/android.hardware.audio.service + override + class hal + user audioserver + # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) + group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct oem_2901 wakelock + capabilities BLOCK_SUSPEND + ioprio rt 4 + writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks + socket audio_hw_socket seqpacket 0666 system system + onrestart restart audioserver diff --git a/rootdir/etc/init.qti.kernel.rc b/rootdir/etc/init.qti.kernel.rc new file mode 100644 index 0000000..a1f8c62 --- /dev/null +++ b/rootdir/etc/init.qti.kernel.rc @@ -0,0 +1,175 @@ +#============================================================================= +# Copyright (c) 2019-2021 Qualcomm Technologies, Inc. +# All Rights Reserved. +# Confidential and Proprietary - Qualcomm Technologies, Inc. +# +# Copyright (c) 2009-2012, 2014-2019, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of The Linux Foundation nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= +import /vendor/etc/init/hw/init.qti.kernel.test.rc + +on early-init + mount debugfs debugfs /sys/kernel/debug + chmod 0755 /sys/kernel/debug + + # Mount tracefs in /sys/kernel/tracing as CONFIG_DEBUG_FS might be + # disabled and /sys/kernel/debug/tracing might not be available + mount tracefs tracefs /sys/kernel/tracing + chmod 0755 /sys/kernel/tracing + + chown root system /dev/kmsg + chmod 0620 /dev/kmsg + + write /proc/sys/kernel/sched_boost 1 + + write /proc/sys/kernel/firmware_config/force_sysfs_fallback 1 + +on init + # Create cgroup mount point for memory + mkdir /sys/fs/cgroup/memory/bg 0750 root system + write /sys/fs/cgroup/memory/bg/memory.swappiness 140 + write /sys/fs/cgroup/memory/bg/memory.move_charge_at_immigrate 1 + chown root system /sys/fs/cgroup/memory/bg/tasks + chmod 0660 /sys/fs/cgroup/memory/bg/tasks + + # update scheduler tunables + write /dev/cpuctl/foreground/cpu.uclamp.sched_boost_no_override 1 + write /dev/cpuctl/top-app/cpu.uclamp.sched_boost_no_override 1 + write /dev/cpuctl/background/cpu.uclamp.colocate 0 + write /dev/cpuctl/foreground/cpu.uclamp.colocate 0 + write /dev/cpuctl/top-app/cpu.uclamp.colocate 1 + +on post-fs + chmod 0755 /sys/kernel/debug/tracing + + # set aggressive read ahead for dm-0 and dm-1 during boot up + write /sys/block/dm-0/queue/read_ahead_kb 2048 + write /sys/block/dm-1/queue/read_ahead_kb 2048 + write /sys/block/dm-2/queue/read_ahead_kb 2048 + +on early-boot + # Allow subsystem (modem etc) debugging + write /sys/kernel/boot_adsp/boot 1 + write /sys/kernel/boot_cdsp/boot 1 + write /sys/kernel/boot_slpi/boot 1 + write /sys/devices/virtual/cvp/cvp/boot 1 + +on boot + # Set the console loglevel to < KERN_WARN + # Set the default message loglevel to KERN_INFO + write /proc/sys/kernel/printk "4 6 1 7" + + # 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 + + # set the io-scheduler to bfq on all mq support devices + write /sys/block/sda/queue/scheduler bfq + write /sys/block/sdb/queue/scheduler bfq + write /sys/block/sdc/queue/scheduler bfq + write /sys/block/sdd/queue/scheduler bfq + write /sys/block/sde/queue/scheduler bfq + write /sys/block/sdf/queue/scheduler bfq + write /sys/block/sdg/queue/scheduler bfq + write /sys/block/sdh/queue/scheduler bfq + write /sys/class/block/mmcblk0/queue/scheduler bfq + write /sys/class/block/mmcblk1/queue/scheduler bfq + + # update io-scheduler tunables + write /sys/block/sda/queue/iosched/slice_idle 0 + write /sys/block/sdb/queue/iosched/slice_idle 0 + write /sys/block/sdc/queue/iosched/slice_idle 0 + write /sys/block/sdd/queue/iosched/slice_idle 0 + write /sys/block/sde/queue/iosched/slice_idle 0 + write /sys/block/sdf/queue/iosched/slice_idle 0 + write /sys/block/sdg/queue/iosched/slice_idle 0 + write /sys/block/sdh/queue/iosched/slice_idle 0 + write /sys/class/block/mmcblk0/queue/iosched/slice_idle 0 + write /sys/class/block/mmcblk1/queue/iosched/slice_idle 0 + +on post-fs-data + # Create directory used for dump collection + mkdir /data/vendor/ssrdump 0770 root system + +on property:persist.sys.ssr.enable_debug=* + write /sys/module/subsys_pil_tz/parameters/enable_debug ${persist.sys.ssr.enable_debug} + +on property:persist.sys.mba_boot_timeout=* + write /sys/module/pil_msa/parameters/pbl_mba_boot_timeout_ms ${persist.sys.mba_boot_timeout} + +on property:persist.sys.modem_auth_timeout=* + write /sys/module/pil_msa/parameters/modem_auth_timeout_ms ${persist.sys.modem_auth_timeout} + +on property:persist.sys.pil_proxy_timeout=* + write /sys/module/peripheral_loader/parameters/proxy_timeout_ms ${persist.sys.pil_proxy_timeout} + +on property:persist.vendor.ssr.enable_ramdumps=1 + write /sys/module/subsystem_restart/parameters/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 + +service kernel-boot /vendor/bin/sh /vendor/bin/init.qti.kernel.sh + class core + user root + group root + disabled + oneshot + +service kernel-post-boot /vendor/bin/sh /vendor/bin/init.kernel.post_boot.sh + class core + user root + group root system wakelock graphics + disabled + oneshot + +on property:sys.boot_completed=1 + write /dev/kmsg "Boot completed " + #Reset read ahead for dm-0, dm-1 and dm-2 to 512kb + write /sys/block/dm-0/queue/read_ahead_kb 512 + write /sys/block/dm-1/queue/read_ahead_kb 512 + write /sys/block/dm-2/queue/read_ahead_kb 512 + write /proc/sys/vm/page-cluster 0 + start kernel-boot + start kernel-post-boot + +service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /system/vendor/etc/msm_irqbalance.conf + class core + user root + group root + disabled diff --git a/rootdir/etc/init.qti.ufs.rc b/rootdir/etc/init.qti.ufs.rc new file mode 100644 index 0000000..a37e55e --- /dev/null +++ b/rootdir/etc/init.qti.ufs.rc @@ -0,0 +1,30 @@ +# Copyright (c) 2011-2016, 2018-2020 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. +# + +on init + exec u:r:vendor-qti-testscripts:s0 -- /vendor/bin/sh /vendor/bin/init.qti.ufs.debug.sh diff --git a/rootdir/etc/init.recovery.qcom.rc b/rootdir/etc/init.recovery.qcom.rc new file mode 100644 index 0000000..edb5bd3 --- /dev/null +++ b/rootdir/etc/init.recovery.qcom.rc @@ -0,0 +1,38 @@ +# Copyright (c) 2017-2018,2020 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 + setprop sys.usb.configfs 1 + +on property:ro.boot.usbcontroller=* + setprop sys.usb.controller ${ro.boot.usbcontroller} + write /sys/class/udc/${ro.boot.usbcontroller}/device/../mode peripheral + +on fs + wait /dev/block/platform/soc/${ro.boot.bootdevice} + symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
\ No newline at end of file diff --git a/rootdir/etc/init.target.rc b/rootdir/etc/init.target.rc new file mode 100644 index 0000000..38c9a9f --- /dev/null +++ b/rootdir/etc/init.target.rc @@ -0,0 +1,286 @@ + +# Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# +import /vendor/etc/init/init.mishow.ctl.rc +import /vendor/etc/init/init.charge_logger.rc +import /vendor/etc/init/hw/init.qti.kernel.rc + +on early-init + exec u:r:vendor_modprobe:s0 -- /vendor/bin/vendor_modprobe.sh + exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -a -d /vendor/lib/modules q6_pdr_dlkm q6_notifier_dlkm snd_event_dlkm apr_dlkm adsp_loader_dlkm q6_dlkm native_dlkm pinctrl_lpi_dlkm swr_dlkm platform_dlkm stub_dlkm wcd_core_dlkm wsa881x_analog_dlkm bolero_cdc_dlkm va_macro_dlkm rx_macro_dlkm tx_macro_dlkm bt_fm_slim wcd938x_dlkm wcd938x_slave_dlkm wcd937x_dlkm wcd937x_slave_dlkm aw882xx_dlkm fs19xx_dlkm machine_dlkm radio-i2c-rtc6226-qca cdsprm + wait /sys/devices/soc0/soc_id + +on init + # Scheduler uclamp + mkdir /dev/cpuctl/foreground + mkdir /dev/cpuctl/background + mkdir /dev/cpuctl/top-app + mkdir /dev/cpuctl/rt + chown system system /dev/cpuctl + chown system system /dev/cpuctl/foreground + chown system system /dev/cpuctl/background + chown system system /dev/cpuctl/top-app + chown system system /dev/cpuctl/rt + chown system system /dev/cpuctl/tasks + chown system system /dev/cpuctl/foreground/tasks + chown system system /dev/cpuctl/background/tasks + chown system system /dev/cpuctl/top-app/tasks + chown system system /dev/cpuctl/rt/tasks + chmod 0664 /dev/cpuctl/tasks + chmod 0664 /dev/cpuctl/foreground/tasks + chmod 0664 /dev/cpuctl/background/tasks + chmod 0664 /dev/cpuctl/top-app/tasks + chmod 0664 /dev/cpuctl/rt/tasks + write /dev/cpuctl/foreground/cpu.rt_runtime_us 950000 + write /dev/cpuctl/background/cpu.rt_runtime_us 950000 + write /dev/cpuctl/top-app/cpu.rt_runtime_us 950000 + write /dev/cpuctl/rt/cpu.rt_runtime_us 950000 + + wait /dev/block/platform/soc/${ro.boot.bootdevice} + symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice + start logd + + #+chk99786, tanghongnian.wt, add, 20211029, for battery charging off if CALL_STATE_OFFHOOK + chown system system /sys/class/qcom-battery/charging_call_state + chmod 0660 /sys/class/qcom-battery/charging_call_state + #-chk99786, tanghongnian.wt, add, 20211029, for battery charging off if CALL_STATE_OFFHOOK + +on early-fs + start vold + +on fs + start hwservicemanager + mount_all --early + chown root system /mnt/vendor/persist + chmod 0771 /mnt/vendor/persist + restorecon_recursive /mnt/vendor/persist + mkdir /mnt/vendor/persist/data 0700 system system + mount ext4 /dev/block/bootdevice/by-name/rescue /mnt/rescue noatime + restorecon_recursive /mnt/rescue + +on post-fs + # set RLIMIT_MEMLOCK to 64MB + setrlimit 8 67108864 67108864 + +on property:ro.factory_mode=1 && property:sys.boot_completed=1 + chown system system /data/local/tmp + chmod 0777 /data/local/tmp + chmod 0666 /dev/block/sda9 + +on late-fs + wait_for_prop hwservicemanager.ready true + #exec_start wait_for_keymaster + start console + mount_all --late + +on post-fs-data + mkdir /vendor/data/tombstones 0771 system system +#ExtR HONGMI-90116,wufa@wingtech.com,add,20210908,add mi_thermal + mkdir /data/vendor/thermal 0771 root system + mkdir /data/vendor/thermal/config 0771 root system + chmod 0644 /dev/elliptic0 + chmod 0644 /dev/elliptic1 + chmod 0660 /dev/ir_spi + chown system system /dev/ir_spi + mkdir /data/vendor/wlan_logs 0777 root shell + +on early-boot + start vendor.sensors + +on boot + # DT2W + chown system system /proc/tp_gesture + chmod 0644 /proc/tp_gesture + + write /dev/cpuset/audio-app/cpus 1-2 + # Add a cpuset for the camera daemon + # We want all cores for camera + mkdir /dev/cpuset/camera-daemon + write /dev/cpuset/camera-daemon/cpus 0-7 + write /dev/cpuset/camera-daemon/mems 0 + chown cameraserver cameraserver /dev/cpuset/camera-daemon + chown cameraserver cameraserver /dev/cpuset/camera-daemon/tasks + chmod 0660 /dev/cpuset/camera-daemon/tasks + #USB controller configuration + setprop vendor.usb.rndis.func.name "gsi" + setprop vendor.usb.rmnet.func.name "gsi" + setprop vendor.usb.rmnet.inst.name "rmnet" + setprop vendor.usb.dpl.inst.name "dpl" + setprop vendor.usb.qdss.inst.name "qdss_mdm" + setprop vendor.usb.controller 4e00000.dwc3 +#bug 676383, zhangsen1@wingtech.com, 20210807, modify audio bringup smartpa + mkdir /mnt/vendor/persist/audio 0777 system system + mkdir /vendor/firmware/awinic/ + mkdir /mnt/vendor/persist/audio 0777 system system + chmod 0666 /sys/bus/i2c/drivers/aw882xx_smartpa/3-0034/cali + chmod 0666 /sys/bus/i2c/drivers/aw882xx_smartpa/3-0034/cali_f0 + chmod 0666 /sys/bus/i2c/drivers/aw882xx_smartpa/3-0034/cali_re + chmod 0666 /sys/bus/i2c/drivers/aw882xx_smartpa/3-0034/dsp_re + chmod 0666 /sys/bus/i2c/drivers/aw882xx_smartpa/3-0035/cali + chmod 0666 /sys/bus/i2c/drivers/aw882xx_smartpa/3-0035/cali_f0 + chmod 0666 /sys/bus/i2c/drivers/aw882xx_smartpa/3-0035/cali_re + chmod 0666 /sys/bus/i2c/drivers/aw882xx_smartpa/3-0035/dsp_re + +#bug 676383, zhangsen1@wingtech.com, 20210828, modify audio bringup smartpa + mkdir /vendor/firmware/fsm1962/ + + chmod 0666 /sys/bus/i2c/drivers/fs19xx/3-0036/cali_f0 + chmod 0666 /sys/bus/i2c/drivers/fs19xx/3-0036/cali_re + + chmod 0666 /sys/bus/i2c/drivers/fs19xx/3-0037/cali_f0 + chmod 0666 /sys/bus/i2c/drivers/fs19xx/3-0037/cali_re + + chmod 0644 /mnt/vendor/persist/audio/aw_cali.bin + chmod 0644 /mnt/vendor/persist/audio/fsm_calib.bin + + #ExtR HONGMI-90116,wufa@wingtech.com,add,20210908,add mi_thermal + chown system system /sys/class/thermal/thermal_message/sconfig + +# add dual + mkdir /mnt/vendor/persist/camera 0777 system system + chmod 0666 /mnt/vendor/persist/camera/rear_dc_cal_wu.bin + chmod 0666 /data/vendor/camera/com.xiaomi.dcal.wu.data + +#xiechongchong01 test + chmod 0777 /proc/tp_palm + chown system system /proc/tp_palm + +#add perm for calib + chmod 0777 /data/vendor/camera + +on property:vendor.display.lcd_density=560 + setprop dalvik.vm.heapgrowthlimit 256m + +on property:vendor.display.lcd_density=640 + setprop dalvik.vm.heapgrowthlimit 512m + +on boot && property:persist.vendor.usb.controller.default=* + setprop vendor.usb.controller ${persist.vendor.usb.controller.default} + +on charger + mount_all /vendor/etc/charger_fstab.qti --early + write /sys/kernel/boot_adsp/boot 1 + #restart charger after ADSP is out of reset + #restart charger + start vendor.power_off_alarm + setprop sys.usb.controller 4e00000.dwc3 + setprop sys.usb.configfs 1 + #+ExtR HONGMI-90116,wufa@wingtech.com,add,20210908,add mi_thermal + start mi_thermald + #-ExtR HONGMI-90116,wufa@wingtech.com,add,20210908,add mi_thermal + +#+ExtR HONGMI-90162,zhangb02@wingtech.com,add,20211003,add misound +service audioshell_service /vendor/bin/audioshell_service + oneshot + disabled + +on property:ro.vendor.miui.region=* + start audioshell_service +#-ExtR HONGMI-90162,zhangbo2@wingtech.com,add,20211003,add misound + +#pd-mapper +service vendor.pd_mapper /vendor/bin/pd-mapper + class core + user system + group system + +#Peripheral manager +service vendor.per_mgr /vendor/bin/pm-service + class core + user system + group system + ioprio rt 4 + +service vendor.per_proxy /vendor/bin/pm-proxy + class core + user system + group system + disabled + +#service vendor.mdm_helper /vendor/bin/mdm_helper +# class core +# group system wakelock +# disabled + +service vendor.mdm_launcher /vendor/bin/sh /vendor/bin/init.mdm.sh + class core + oneshot + +on property:init.svc.vendor.per_mgr=running + start vendor.per_proxy + +on property:sys.shutdown.requested=* + stop vendor.per_proxy + +on property:vold.decrypt=trigger_restart_framework + start vendor.cnss_diag + +service vendor.cnss_diag /system/vendor/bin/cnss_diag -q -f -t HELIUM + class main + user system + group system wifi inet sdcard_rw media_rw diag + oneshot + +#ExtR HONGMI-90116,wufa@wingtech.com,add,20210908,add mi_thermal +service mi_thermald /system/vendor/bin/mi_thermald + class main + user root + group system + seclabel u:r:mi_thermald:s0 +#-ExtR HONGMI-90116,wufa@wingtech.com,add,20210908,add mi_thermal + +service svi_on /vendor/bin/ppd "svi:on" + class main + group root system + oneshot + disabled + +on property:init.svc.vendor.nv_mac=stopped + start vendor.btmac-sh + +service vendor.btmac-sh /vendor/bin/init.mi.btmac.sh + class late_start + user system + group system bluetooth wifi + oneshot + disabled + +on property:ro.vendor.display.svi=1 && property:sys.boot_completed=1 + start svi_on + +service checknv /system/bin/checknv + class main + user root + group root system + oneshot + seclabel u:r:checknv:s0 + +# Sync attribute value between system and vendor +on property:persist.sys.mcc.mnc=* + setprop persist.vendor.mcc.mnc ${persist.sys.mcc.mnc} diff --git a/rootdir/etc/ueventd.qcom.rc b/rootdir/etc/ueventd.qcom.rc new file mode 100644 index 0000000..04e5708 --- /dev/null +++ b/rootdir/etc/ueventd.qcom.rc @@ -0,0 +1,507 @@ +# Copyright (c) 2012-2015, 2017-2020, 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. +# + +# Firmware directory Path +# Below macro will be read by uevent and path will +# be added to search path for firmware loading +firmware_directories /vendor/firmware_mnt/image/ + +# the DIAG device node is not world writable/readable. +/dev/diag 0660 system oem_2901 +/dev/mhi_*_pipe_4 0660 system system + +/dev/genlock 0666 system system +/dev/wlan 0660 wifi wifi +/dev/kgsl 0666 system system +/dev/kgsl-3d0 0666 system system +/dev/kgsl-2d0 0666 root root +/dev/kgsl-2d1 0666 root root +/dev/ion 0664 system system +/dev/membuf 0664 system system +/dev/rtc0 0660 system system +/dev/smd0 0660 system system +/dev/smd4 0660 system system +/dev/smd_cxm_qmi 0640 radio radio +/dev/smd5 0660 system system +/dev/smd6 0660 system system +/dev/smd7 0660 bluetooth bluetooth +/dev/ccid_bridge 0660 system system +/dev/ipa 0660 radio radio +/dev/wwan_ioctl 0660 radio radio +/dev/ipaNatTable 0660 radio radio +/dev/rmnet_ctrl 0660 usb usb +/dev/dpl_ctrl 0660 usb usb +/dev/ipa_odl_ctl 0660 radio radio +/dev/ipa_adpl 0660 system oem_2905 +/dev/synx_device 0660 root camera +/dev/hab 0666 system system +/dev/hgsl 0666 system system +/dev/iio:device* 0664 system system + +#permissions for UFS RPMB BSG device node +/dev/0:0:0:49476 0600 system system + +#permissions for CSVT +/dev/smd11 0660 radio radio + +#permsissions for BT/FM +/dev/smd2 0660 bluetooth bluetooth +/dev/smd3 0660 bluetooth bluetooth +/dev/btpower 0660 bluetooth system + +#permissions for pta +/dev/pta 0660 system system + +/dev/radio0 0640 system system +/dev/rfcomm0 0660 bluetooth bluetooth +/dev/ttyUSB0 0660 bluetooth bluetooth +/dev/smdcntl0 0640 radio radio +/dev/smdcntl1 0640 radio radio +/dev/smdcntl2 0640 radio radio +/dev/smdcntl3 0640 radio radio +/dev/smdcntl4 0640 radio radio +/dev/smdcntl5 0640 radio radio +/dev/smdcntl6 0640 radio radio +/dev/smdcntl7 0640 radio radio +/dev/smdcntl8 0640 radio radio +/dev/smdcnt_rev0 0640 radio radio +/dev/smdcnt_rev1 0640 radio radio +/dev/smdcnt_rev2 0640 radio radio +/dev/smdcnt_rev3 0640 radio radio +/dev/smdcnt_rev4 0640 radio radio +/dev/smdcnt_rev5 0640 radio radio +/dev/smdcnt_rev6 0640 radio radio +/dev/smdcnt_rev7 0640 radio radio +/dev/smdcnt_rev8 0640 radio radio +/dev/smuxctl32 0640 radio radio +/dev/sdioctl0 0640 radio radio +/dev/sdioctl1 0640 radio radio +/dev/sdioctl2 0640 radio radio +/dev/sdioctl3 0640 radio radio +/dev/sdioctl4 0640 radio radio +/dev/sdioctl5 0640 radio radio +/dev/sdioctl6 0640 radio radio +/dev/sdioctl7 0640 radio radio +/dev/sdioctl8 0640 radio radio +/dev/rmnet_mux_ctrl 0640 radio radio +/dev/hsicctl0 0640 radio radio +/dev/hsicctl1 0640 radio radio +/dev/hsicctl2 0640 radio radio +/dev/hsicctl3 0640 radio radio +/dev/hsicctl4 0640 radio radio +/dev/hsicctl5 0640 radio radio +/dev/hsicctl6 0640 radio radio +/dev/hsicctl7 0640 radio radio +/dev/hsicctl8 0640 radio radio +/dev/hsicctl9 0640 radio radio +/dev/hsicctl10 0640 radio radio +/dev/hsicctl11 0640 radio radio +/dev/hsicctl12 0640 radio radio +/dev/hsicctl13 0640 radio radio +/dev/hsicctl14 0640 radio radio +/dev/hsicctl15 0640 radio radio +/dev/hsicctl16 0640 radio radio +/dev/mhi_*_pipe_14 0640 radio radio +/dev/mhi_*_pipe_16 0640 radio radio +/dev/mhi_*_pipe_32 0640 radio radio +/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 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/sp_keymaster_ssr 0660 system system +/dev/sec_nvm_* 0660 system system +/dev/cryptoapp 0660 system system +/dev/spdaemon_ssr 0660 system system +/dev/spu_hal_ssr 0660 system system +/dev/iuicc* 0660 system system +/dev/gemini0 0660 system camera +/dev/jpeg0 0660 system camera +/dev/jpeg1 0660 system camera +/dev/jpeg2 0660 system camera +/dev/jpeg3 0660 system camera +/dev/adsprpc-smd 0664 system system +/dev/adsprpc-smd-secure 0644 system system +/dev/system_health_monitor 0644 radio system +/dev/mdss_rotator 0664 system 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 +/dev/bus/usb/001/002 0660 system system +/dev/bus/usb/001/003 0660 system system +/dev/bus/usb/001/004 0660 system system +/dev/bus/usb/001/005 0660 system system +/dev/bus/usb/002/002 0660 system system +/dev/bus/usb/002/003 0660 system system +/dev/bus/usb/002/004 0660 system system +/dev/bus/usb/002/005 0660 system system +/dev/bus/usb/003/002 0660 system system +/dev/bus/usb/003/003 0660 system system +/dev/bus/usb/003/004 0660 system system +/dev/bus/usb/003/005 0660 system system +/dev/hidraw0 0660 system system +/dev/hidraw1 0660 system system +/dev/hidraw2 0660 system system +/dev/hidraw3 0660 system system +/dev/hidraw4 0660 system system +/dev/hidraw5 0660 system system +/dev/hidraw6 0660 system system +/dev/hidraw7 0660 system system +/dev/hidraw8 0660 system system +/dev/hidraw9 0660 system system + +#goodix fingerprint +/dev/goodix_fp 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 +/sys/devices/platform/soc/*.qcom,icnss/net/wlan*/queues/rx-* rps_cpus 0660 system system +/sys/devices/platform/soc/1c00000.qcom,pcie/pci0000:00/0000:00:00.0/0000:01:00.0/net/wlan*/queues/rx-* rps_cpus 0660 system system +/sys/devices/platform/soc/17a10040.qcom,wcn6750/net/wlan*/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 +/dev/msm_vidc_reg 0660 system audio +/dev/msm_vidc_dec 0660 system audio +/dev/msm_vidc_dec_sec 0660 system audio +/dev/msm_vidc_enc 0660 system audio +/dev/msm_rotator 0660 system system +/dev/hw_random 0600 root root +/dev/sdsprpc-smd 0660 system system + +#permissions for audio +/dev/wcd_dsp0_control 0660 system audio +/dev/wcd-dsp-glink 0660 system audio +/dev/audio_slimslave 0660 system audio +/dev/msm_qcelp 0660 system audio +/dev/msm_evrc 0660 system audio +/dev/msm_wma 0660 system audio +/dev/msm_wmapro 0660 system audio +/dev/msm_alac 0660 system audio +/dev/msm_ape 0660 system audio +/dev/msm_amrnb 0660 system audio +/dev/msm_amrwb 0660 system audio +/dev/msm_amrwbplus 0660 system audio +/dev/msm_aac 0660 system audio +/dev/msm_multi_aac 0660 system audio +/dev/msm_aac_in 0660 system audio +/dev/msm_qcelp_in 0660 system audio +/dev/msm_evrc_in 0660 system audio +/dev/msm_amrnb_in 0660 system audio +/dev/msm_amrwb_in 0660 system audio +/dev/msm_a2dp_in 0660 system audio +/dev/msm_ac3 0660 system audio +/dev/msm_audio_cal 0660 system audio +/dev/msm_hweffects 0660 system audio +/dev/msm_cad 0660 system audio +/dev/msm_fm 0660 system audio +/dev/msm_mvs 0660 system audio +/dev/msm_pcm_lp_dec 0660 system audio +/dev/msm_preproc_ctl 0660 system audio +/dev/msm_rtac 0660 system audio +/dev/msm_voicememo 0660 system audio +/dev/ttyHSL1 0660 system system +/dev/ttyHS1 0660 system system +/dev/mdm 0660 system radio +/sys/devices/virtual/smdpkt/smdcntl* open_timeout 0664 radio radio +/dev/sdio_tty_ciq_00 0660 system system +/dev/tty_sdio_00 0660 system system +/dev/ttyGS0 0660 system system +/dev/i2c-5 0660 media media +/dev/avtimer 0660 system audio +/dev/spidev2.0 0660 system audio +/dev/spidev22.0 0660 system audio +/dev/spidev10.0 0660 system audio + +# DVB devices +/dev/dvb/adapter0/demux* 0440 media media +/dev/dvb/adapter0/dvr* 0660 media media +/dev/dvb/adapter0/video* 0660 media media + +# Broadcast devices +/dev/tsc_mux0 0660 media media +/dev/tsc_ci0 0660 media media + +# sensors +/dev/sensors 0660 system system +/sys/devices/i2c-12/12-* pollrate_ms 0664 system system +/sys/devices/f9925000.i2c/i2c-0/0-* enable 0660 input system +/sys/devices/f9925000.i2c/i2c-0/0-* poll_delay 0660 input system +/sys/devices/soc.0/78b6000.i2c/i2c-0/0-* enable 0660 input system +/sys/devices/soc.0/78b6000.i2c/i2c-0/0-* poll_delay 0660 input system +/sys/devices/soc.0/78b6000.i2c/i2c-0/0-* enable_wakeup 0660 input system +/sys/devices/soc.0/78b6000.i2c/i2c-0/0-* max_latency 0660 input system +/sys/devices/soc.0/78b6000.i2c/i2c-0/0-* flush 0660 input system +/sys/devices/soc.0/78b6000.i2c/i2c-0/0-* calibrate 0660 input system +/sys/devices/soc.0/78b5000.i2c/i2c-1/1-* enable 0660 input system +/sys/devices/soc.0/78b5000.i2c/i2c-1/1-* poll_delay 0660 input system +/sys/devices/soc.0/78b5000.i2c/i2c-1/1-* enable_wakeup 0660 input system +/sys/devices/soc.0/78b5000.i2c/i2c-1/1-* max_latency 0660 input system +/sys/devices/soc.0/78b5000.i2c/i2c-1/1-* flush 0660 input system +/sys/devices/soc.0/78b5000.i2c/i2c-1/1-* calibrate 0660 input system +/sys/devices/virtual/optical_sensors/proximity ps_adc 0660 input system +/sys/devices/virtual/optical_sensors/proximity ps_poll_delay 0660 input system +/sys/devices/virtual/optical_sensors/lightsensor ls_auto 0660 input system +/sys/devices/virtual/optical_sensors/lightsensor ls_poll_delay 0660 input system +/sys/devices/virtual/input/input* poll 0660 input system +/sys/devices/virtual/input/input* pollrate_ms 0660 input system +/sys/devices/soc/78b7000.i2c/i2c-3/3-0020/input/input* secure_touch 0440 system drmrpc +/sys/devices/soc/78b7000.i2c/i2c-3/3-0020/input/input* secure_touch_enable 0660 system drmrpc +/sys/devices/soc/78b7000.i2c/i2c-3/3-0038/input/input* secure_touch 0440 system drmrpc +/sys/devices/soc/78b7000.i2c/i2c-3/3-0038/input/input* secure_touch_enable 0660 system drmrpc +/sys/devices/soc/78b7000.i2c/i2c-3/3-004b/input/input* secure_touch 0440 system drmrpc +/sys/devices/soc/78b7000.i2c/i2c-3/3-004b/input/input* secure_touch_enable 0660 system drmrpc +/sys/devices/soc/c179000.i2c/i2c-5/5-0020/input/input* secure_touch 0440 system drmrpc +/sys/devices/soc/c179000.i2c/i2c-5/5-0020/input/input* secure_touch_enable 0660 system drmrpc +/sys/devices/platform/soc/a98000.i2c/i2c-2/2-0020/input/input* secure_touch 0440 system drmrpc +/sys/devices/platform/soc/a98000.i2c/i2c-2/2-0020/input/input* secure_touch_enable 0660 system drmrpc +/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 + +# GNSS Device premissions +/dev/gnss_sirf 0660 gps gps + +# laser sensor access +/sys/devices/virtual/input/input* enable_ps_sensor 0660 system input +/sys/devices/virtual/input/input* set_delay_ms 0660 system input +/sys/devices/virtual/input/input* do_flush 0660 system input + +# vm_bms +/dev/vm_bms 0660 system system +/dev/battery_data 0660 system system + +# wlan +/dev/wcnss_wlan 0660 system system +/dev/wcnss_ctrl 0660 system system +/sys/devices/soc/600000.qcom,pcie/pci0000:00/0000:00:00.0/0000:01:00.0/net/wlan0/queues/rx-* rps_cpus 0660 system system +/sys/devices/soc/600000.qcom,pcie/pci0000:00/0000:00:00.0/0000:01:00.0/net/p2p0/queues/rx-* rps_cpus 0660 system system + +# wigig +/sys/bus/pci/drivers/wil6210* 0000:01:00.0/wil6210/fst_link_loss 0660 wifi wifi +/sys/bus/pci/drivers/wil6210* 0000:01:00.0/wil6210/thermal_throttling 0660 system system +/sys/bus/pci/drivers/wil6210* 0000:01:00.0/wil6210/snr_thresh 0660 wifi wifi +/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 + +#nfc permissions +/dev/nfc-nci 0660 nfc nfc +/dev/nq-nci 0660 nfc nfc +/dev/assd 0660 nfc nfc + +# UIO devices +/dev/uio0 0660 system system +/dev/uio1 0660 system system +/dev/uio2 0660 system system + +# SSR devices +/dev/subsys_* 0640 system system + +# Ultrasound device +/dev/usf1 0660 system system + +# Ramdump devices +/dev/ramdump* 0640 system system + +# Fingerprint device +/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 +/dev/hbtp_vm 0660 system system + +# Add device block for FRP +/dev/block/platform/soc/7824900.sdhci/by-name/config 0600 system system +/dev/block/platform/soc/7464900.sdhci/by-name/frp 0600 system system +/dev/block/platform/soc/624000.ufshc/by-name/frp 0600 system system +/dev/block/platform/soc/1da4000.ufshc/by-name/frp 0600 system system +/dev/block/platform/soc/c0c4000.sdhci/by-name/frp 0600 system system +/dev/block/platform/soc/1d84000.ufshc/by-name/frp 0600 system system +/dev/block/platform/soc/7c4000.sdhci/by-name/frp 0600 system system +/dev/block/platform/soc/4744000.sdhci/by-name/frp 0600 system system +/dev/block/platform/soc/4804000.ufshc/by-name/frp 0600 system system + +# This is temporary while using SD card for initial bring-up +/dev/block/platform/soc/8804000.sdhci/by-name/frp 0600 system system + +# Kmsg device +/dev/kmsg 0620 root system + +#bug636798, xuxinyu@wt, 20210724,add hardware info +#hardwareinfo +/dev/hardwareinfo 0660 root system + +# LED class devices +/sys/class/leds/red delay_on 0640 system system +/sys/class/leds/red delay_off 0640 system system +/sys/class/leds/red breath 0640 system system +/sys/class/leds/red trigger 0640 system system +/sys/class/leds/green delay_on 0640 system system +/sys/class/leds/green delay_off 0640 system system +/sys/class/leds/green breath 0640 system system +/sys/class/leds/green trigger 0640 system system +/sys/class/leds/blue delay_on 0640 system system +/sys/class/leds/blue delay_off 0640 system system +/sys/class/leds/blue breath 0640 system system +/sys/class/leds/blue trigger 0640 system system + +# NPU device +/dev/msm_npu 0644 system system + +# USB role switch +/sys/class/dual_role_usb/* data_role 0660 system system +/sys/class/dual_role_usb/* power_role 0660 system system +/sys/class/dual_role_usb/* mode 0660 system system + +#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 +/sys/class/graphics/fb* vendor_name 0664 system graphics +/sys/class/graphics/fb* product_description 0664 system graphics +/sys/class/graphics/fb* video_mode 0664 system graphics +/sys/class/graphics/fb* format_3d 0664 system graphics +/sys/class/graphics/fb* s3d_mode 0664 system graphics +/sys/class/graphics/fb* dynamic_fps 0664 system graphics +/sys/class/graphics/fb* msm_fb_dfps_mode 0664 system graphics +/sys/class/graphics/fb* hdr_stream 0664 system graphics +/sys/class/graphics/fb* cec/enable 0664 system graphics +/sys/class/graphics/fb* cec/logical_addr 0664 system graphics +/sys/class/graphics/fb* cec/rd_msg 0664 system graphics +/sys/class/graphics/fb* pa 0664 system graphics +/sys/class/graphics/fb* cec/wr_msg 0600 system graphics +/sys/class/graphics/fb* hdcp/tp 0664 system graphics +/sys/class/graphics/fb* hdcp2p2/min_level_change 0660 system graphics +/sys/class/graphics/fb* hdmi_audio_cb 0600 audioserver audio + +/sys/class/graphics/fb* lineptr_value 0664 system graphics +/sys/class/graphics/fb* msm_fb_persist_mode 0664 system graphics + +/sys/class/graphics/fb0 idle_time 0664 system graphics +/sys/class/graphics/fb0 dynamic_fps 0664 system graphics +/sys/class/graphics/fb0 dyn_pu 0664 system graphics +/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/devices/platform/soc/ae00000.qcom,mdss_mdp power/control 0664 system graphics + +#asm330 sensor +#common sensors files +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* buffer/enable 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* buffer/length 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* buffer/watermark 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* discharded_samples 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* current_timestamp_clock 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* hwfifo_flush 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* hwfifo_watermark 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* hwfifo_watermark_max 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* mount_matrix 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* name 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* sampling_frequency 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* sampling_frequency_available 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_timestamp_en 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_timestamp_index 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_timestamp_type 0664 system system + +# standard iio accel attributes +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_accel_scale_available 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_accel_x_raw 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_accel_x_scale 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_accel_y_raw 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_accel_y_scale 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_accel_z_raw 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_accel_z_scale 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_accel_x_en 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_accel_x_index 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_accel_x_type 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_accel_y_en 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_accel_y_index 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_accel_y_type 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_accel_z_en 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_accel_z_index 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_accel_z_type 0664 system system + +# standard iio gyro attributes +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_anglvel_scale_available 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_anglvel_x_raw 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_anglvel_x_scale 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_anglvel_y_raw 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_anglvel_y_scale 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_anglvel_z_raw 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_anglvel_z_scale 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_anglvel_x_en 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_anglvel_x_index 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_anglvel_x_type 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_anglvel_y_en 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_anglvel_y_index 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_anglvel_y_type 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_anglvel_z_en 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_anglvel_z_index 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* scan_elements/in_anglvel_z_type 0664 system system + + +# standard iio temp attributes +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_temp_offset 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_temp_raw 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_temp_scale 0664 system system +/sys/devices/platform/soc/*.i2c/i2c-*/*-*/iio:device* in_temp_scale_available 0664 system system |