sm8350-common: Update init scripts from OOS 11.2.5.5

Change-Id: Ia4e798ae3c5cbdb7246669b833c75e7058efa523
This commit is contained in:
Bruno Martins 2021-05-25 23:59:05 +01:00
parent 7c98da93ba
commit b2e66f9cc7
27 changed files with 2045 additions and 670 deletions

View file

@ -33,12 +33,12 @@
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 ril-daemon
stop vendor.ril-daemon
stop vendor.qcrild
esac
@ -86,12 +86,10 @@ case "$baseband" in
if [ "$qcrild_status" = "true" ]; then
# Make sure both rild, qcrild are not running at same time.
# This is possible with vanilla aosp system image.
stop ril-daemon
stop vendor.ril-daemon
start vendor.qcrild
else
start ril-daemon
start vendor.ril-daemon
fi
@ -129,11 +127,15 @@ case "$baseband" in
case "$datamode" in
"tethered")
start vendor.dataqti
start vendor.dataadpl
if [ "$low_ram" != "true" ]; then
start vendor.dataadpl
fi
;;
"concurrent")
start vendor.dataqti
start vendor.dataadpl
if [ "$low_ram" != "true" ]; then
start vendor.dataadpl
fi
;;
*)
;;

View file

@ -0,0 +1,591 @@
#=============================================================================
# Copyright (c) 2020 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.
#=============================================================================
function configure_zram_parameters() {
postboot_running=$(getprop vendor.sys.memplus.postboot 0)
if [ $postboot_running == 3 ];then
return
fi
MemTotalStr=`cat /proc/meminfo | grep MemTotal`
MemTotal=${MemTotalStr:16:8}
low_ram=`getprop ro.config.low_ram`
# Zram disk - 75% for Go and < 2GB devices .
# 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
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
}
# huangwen.chen@OPTI, 2020/05/14, add for zram writeback
function configure_zram_writeback() {
# get backing storage size, unit: MB
backing_dev_size=$(getprop persist.vendor.zwriteback.backing_dev_size 2048)
case $backing_dev_size in
[1-9])
;;
[1-9][0-9]*)
;;
*)
backing_dev_size=2048
;;
esac
dump_switch=$(getprop persist.vendor.zwriteback.backup)
wb_file="/data/vendor/swap/zram_wb"
if [[ -f $wb_file && $dump_switch == 1 ]];then
rm -f "/data/vendor/swap/zram_wb.old"
mv $wb_file "/data/vendor/swap/zram_wb.old"
fi
# create backing storage
# check if dd command success
ret=$(dd if=/dev/zero of=/data/vendor/swap/zram_wb bs=1m count=$backing_dev_size 2>&1)
if [ $? -ne 0 ];then
rm -f /data/vendor/swap/zram_wb
echo "memplus $ret" > /dev/kmsg
return 1
fi
# check if attaching file success
losetup -f
loop_device=$(losetup -f -s /data/vendor/swap/zram_wb 2>&1)
if [ $? -ne 0 ];then
rm -f /data/vendor/swap/zram_wb
echo "memplus $loop_device" > /dev/kmsg
return 1
fi
echo $loop_device > /sys/block/zram0/backing_dev
mem_limit=$(getprop persist.vendor.zwriteback.mem_limit)
case $mem_limit in
[1-9])
mem_limit="${mem_limit}M"
;;
[1-9][0-9]*)
mem_limit="${mem_limit}M"
;;
*)
mem_limit="1G"
;;
esac
echo $mem_limit > /sys/block/zram0/mem_limit
}
# bin.zhong@ASTI, 2019/10/12, add for memplus
function configure_memplus_parameters() {
bootmode=`getprop ro.vendor.factory.mode`
if [ "$bootmode" == "ftm" ] || [ "$bootmode" == "wlan" ] || [ "$bootmode" == "rf" ];then
return
fi
if [ ! $memplus_post_config ];then
return
fi
setprop vendor.sys.memplus.postboot 1
memplus=`getprop persist.vendor.memplus.enable`
case "$memplus" in
"0")
# diable swapspace
rm /data/vendor/swap/swapfile
echo "memplus swapoff start" > /dev/kmsg
ret=$(swapoff /dev/block/zram0 2>&1)
if [ $? -ne 0 ];then
echo "memplus $ret" > /dev/kmsg
return
fi
echo "memplus swapoff done" > /dev/kmsg
;;
"1")
# enable memplus
rm /data/vendor/swap/swapfile
# reset zram swapspace
# huangwen.chen@OPTI, 2020/07/10 check if swapoff success
echo "memplus swapoff start" > /dev/kmsg
ret=$(swapoff /dev/block/zram0 2>&1)
if [ $? -ne 0 ];then
echo "memplus $ret" > /dev/kmsg
return
fi
echo "memplus swapoff done" > /dev/kmsg
echo 1 > /sys/block/zram0/reset
# huangwen.chen@OPTI, 2020/05/21 set zram disksize by property
disksize=$(getprop persist.vendor.zwriteback.disksize 4096)
case $disksize in
[1-9])
disksize="${disksize}M"
;;
[1-9][0-9]*)
disksize="${disksize}M"
;;
*)
disksize="2100M"
;;
esac
# huangwen.chen@OPTI, 2020/05/14 add for zram writeback
# check if ZRAM_WRITEBACK_CONFIG enable
writeback_file="/sys/block/zram0/writeback"
zwriteback=$(getprop persist.vendor.zwriteback.enable 1)
if [[ -f $writeback_file && $zwriteback == 1 ]];then
configure_zram_writeback
# check if configure_zram_writeback success
if [ $? -ne 0 ];then
echo 0 > /sys/block/zram0/mem_limit
fi
else
rm -f /data/vendor/swap/zram_wb
disksize="2100M"
echo 0 > /sys/block/zram0/mem_limit
fi
echo $disksize > /sys/block/zram0/disksize
mkswap /dev/block/zram0
echo "memplus swapon start" > /dev/kmsg
swapon /dev/block/zram0 -p 32758
if [ $? -eq 0 ]; then
echo 1 > /sys/module/memplus_core/parameters/memory_plus_enabled
fi
echo "memplus swapon done" > /dev/kmsg
;;
*)
#enable kswapd
rm /data/vendor/swap/swapfile
# reset zram swapspace
# huangwen.chen@OPTI, 2020/07/10 check if swapoff success
echo "memplus swapoff start" > /dev/kmsg
ret=$(swapoff /dev/block/zram0 2>&1)
if [ $? -ne 0 ];then
echo "memplus $ret" > /dev/kmsg
return
fi
echo "memplus swapoff done" > /dev/kmsg
echo 1 > /sys/block/zram0/reset
echo lz4 > /sys/block/zram0/comp_algorithm
# huangwen.chen@OPTI, 2020/05/21 set zram disksize by property
disksize=$(getprop persist.vendor.zwriteback.disksize 4096)
case $disksize in
[1-9])
disksize="${disksize}M"
;;
[1-9][0-9]*)
disksize="${disksize}M"
;;
*)
disksize="2100M"
;;
esac
# huangwen.chen@OPTI, 2020/05/14 add for zram writeback
# check if ZRAM_WRITEBACK_CONFIG enable
writeback_file="/sys/block/zram0/writeback"
zwriteback=$(getprop persist.vendor.zwriteback.enable 1)
if [[ -f $writeback_file && $zwriteback == 1 ]];then
configure_zram_writeback
if [ $? -ne 0 ];then
echo 0 > /sys/block/zram0/mem_limit
fi
else
rm -f /data/vendor/swap/zram_wb
disksize="2100M"
echo 0 > /sys/block/zram0/mem_limit
fi
echo $disksize > /sys/block/zram0/disksize
mkswap /dev/block/zram0
echo "memplus swapon start" > /dev/kmsg
swapon /dev/block/zram0 -p 32758
if [ $? -eq 0 ]; then
echo 0 > /sys/module/memplus_core/parameters/memory_plus_enabled
fi
echo "memplus swapon done" > /dev/kmsg
;;
esac
setprop vendor.sys.memplus.postboot 2
}
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.
#
MemTotalStr=`cat /proc/meminfo | grep MemTotal`
MemTotal=${MemTotalStr:16:8}
configure_zram_parameters
configure_read_ahead_kb_values
echo 0 > /proc/sys/vm/page-cluster
echo 100 > /proc/sys/vm/swappiness
# set watermark_scale_factor = 36MB * 1024 * 1024 * 10 / MemTotal
factor=`expr 377487360 / $MemTotal`
echo $factor > /proc/sys/vm/watermark_scale_factor
# set min_free_kbytes = 32MB
echo 32768 > /proc/sys/vm/min_free_kbytes
}
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
echo 39000000 39000000 39000000 39000000 39000000 39000000 39000000 5000000 > /proc/sys/kernel/sched_coloc_busy_hyst_cpu_ns
echo 240 > /proc/sys/kernel/sched_coloc_busy_hysteresis_enable_cpus
echo 10 10 10 10 10 10 10 95 > /proc/sys/kernel/sched_coloc_busy_hyst_cpu_busy_pct
# set the threshold for low latency task boost feature which prioritize
# binder activity tasks
echo 325 > /proc/sys/kernel/walt_low_latency_task_threshold
# cpuset parameters
echo 0-3 > /dev/cpuset/background/cpus
echo 0-3 > /dev/cpuset/system-background/cpus
# jared.wu@OPTIMIZATION, 2020/09/22, Make foreground run on cpu 0-6
echo 0-6 > /dev/cpuset/foreground/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 == "1.0" ]; then
echo 1190400 > /sys/devices/system/cpu/cpufreq/policy0/schedutil/hispeed_freq
else
echo 1209600 > /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
if [ $rev == "1.0" ]; then
echo "0:1382800" > /sys/devices/system/cpu/cpu_boost/input_boost_freq
else
echo "0:1305600" > /sys/devices/system/cpu/cpu_boost/input_boost_freq
fi
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
if [ $rev == "1.0" ]; then
echo 1497600 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq
else
echo 1555200 > /sys/devices/system/cpu/cpufreq/policy4/schedutil/hispeed_freq
fi
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 == "1.0" ]; then
echo 1536000 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq
else
echo 1670400 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq
fi
echo 1 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/pl
# tedlin, chown sysfs node to system
chown -R system:system /sys/devices/system/cpu/cpufreq/policy0/schedutil/target_loads
chown -R system:system /sys/devices/system/cpu/cpufreq/policy4/schedutil/target_loads
chown -R system:system /sys/devices/system/cpu/cpufreq/policy7/schedutil/target_loads
# configure bus-dcvs
for device in /sys/devices/platform/soc
do
for cpubw in $device/*cpu-cpu-llcc-bw/devfreq/*cpu-cpu-llcc-bw
do
cat $cpubw/available_frequencies | cut -d " " -f 1 > $cpubw/min_freq
echo "4577 7110 9155 12298 14236 15258" > $cpubw/bw_hwmon/mbps_zones
echo 4 > $cpubw/bw_hwmon/sample_ms
echo 80 > $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 12298 > $cpubw/max_freq
echo 40 > $cpubw/polling_interval
done
for llccbw in $device/*cpu-llcc-ddr-bw/devfreq/*cpu-llcc-ddr-bw
do
cat $llccbw/available_frequencies | cut -d " " -f 1 > $llccbw/min_freq
if [ ${ddr_type:4:2} == $ddr_type4 ]; then
echo "1720 2086 2929 3879 5931 6515 8136" > $llccbw/bw_hwmon/mbps_zones
elif [ ${ddr_type:4:2} == $ddr_type5 ]; then
echo "1720 2086 2929 3879 6515 7980 12191" > $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 6515 > $llccbw/max_freq
echo 40 > $llccbw/polling_interval
done
for l3bw in $device/*snoop-l3-bw/devfreq/*snoop-l3-bw
do
cat $l3bw/available_frequencies | cut -d " " -f 1 > $l3bw/min_freq
echo 4 > $l3bw/bw_hwmon/sample_ms
echo 10 > $l3bw/bw_hwmon/io_percent
echo 20 > $l3bw/bw_hwmon/hist_memory
echo 10 > $l3bw/bw_hwmon/hyst_length
echo 0 > $l3bw/bw_hwmon/down_thres
echo 0 > $l3bw/bw_hwmon/guard_band_mbps
echo 0 > $l3bw/bw_hwmon/up_scale
echo 1600 > $l3bw/bw_hwmon/idle_mbps
echo 9155 > $l3bw/max_freq
echo 40 > $l3bw/polling_interval
done
# configure mem_latency settings for LLCC and DDR scaling and qoslat
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
# configure compute settings for gold latfloor
for latfloor in $device/*cpu4-cpu*latfloor/devfreq/*cpu4-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 prime latfloor
for latfloor in $device/*cpu7-cpu*latfloor/devfreq/*cpu7-cpu*latfloor
do
cat $latfloor/available_frequencies | cut -d " " -f 1 > $latfloor/min_freq
echo 8 > $latfloor/polling_interval
echo 25000 > $latfloor/mem_latency/ratio_ceil
done
# CPU4 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
# CPU5 L3 ratio ceil
for l3gold in $device/*cpu5-cpu-l3-lat/devfreq/*cpu5-cpu-l3-lat
do
echo 4000 > $l3gold/mem_latency/ratio_ceil
done
# 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
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
# qoslat ratio ceil
for qoslat in $device/*qoslat/devfreq/*qoslat
do
echo 50 > $qoslat/mem_latency/ratio_ceil
done
done
echo N > /sys/module/lpm_levels/parameters/sleep_disabled
echo deep > /sys/power/mem_sleep
# Enable fsc.
echo 1 > /sys/module/fsc/parameters/enable
configure_memory_parameters
# bin.zhong@ASTI, 2019/10/12, add for memplus
memplus_post_config=1
# huangwen.chen@OPTI, 2020/07/10, excute on first boot.
postboot_running=$(getprop vendor.sys.memplus.postboot 0)
if [ $postboot_running != 3 ];then
configure_memplus_parameters
fi
# Let kernel know our image version/variant/crm_version
if [ -f /sys/devices/soc0/select_image ]; then
image_version="10:"
image_version+=`getprop ro.build.id`
image_version+=":"
image_version+=`getprop ro.build.version.incremental`
image_variant=`getprop ro.product.name`
image_variant+="-"
image_variant+=`getprop ro.build.type`
oem_version=`getprop ro.build.version.codename`
echo 10 > /sys/devices/soc0/select_image
echo $image_version > /sys/devices/soc0/image_version
echo $image_variant > /sys/devices/soc0/image_variant
echo $oem_version > /sys/devices/soc0/image_crm_version
fi
# Change console log level as per console config property
console_config=`getprop persist.console.silent.config`
case "$console_config" in
"1")
echo "Enable console config to $console_config"
echo 0 > /proc/sys/kernel/printk
;;
*)
echo "Enable console config to $console_config"
;;
esac
setprop vendor.post_boot.parsed 1
# UFS add component info
UFS_PN=`cat /sys/devices/platform/soc/1d84000.ufshc/string_descriptors/product_name`
UFS_VENDOR=`cat /sys/devices/platform/soc/1d84000.ufshc/string_descriptors/manufacturer_name`
UFS_VERSION=`cat /sys/devices/platform/soc/1d84000.ufshc/string_descriptors/product_revision`
UFS_INFO="UFS "`echo ${UFS_PN} | tr -d "\r"`" "`echo ${UFS_VENDOR} | tr -d "\r"`" "`echo ${UFS_VERSION} | tr -d "\r"`
echo ${UFS_INFO}> /sys/project_info/add_component
#liochen@SYSTEM, 2020/11/02, Add for enable ufs performance
echo 0 > /sys/class/scsi_host/host0/../../../clkscale_enable

View file

@ -3,6 +3,7 @@
export PATH=/vendor/bin
prefix="/sys/class/oplus_chg"
call_on_name="call_on"
if [[ -d "$prefix" ]]
then
@ -15,8 +16,14 @@ then
then
continue
else
chown -h system.system "$prefix"/"$i"/"$j"
if [[ "$j" == "$call_on_name" ]]
then
chown -h radio.radio "$prefix"/"$i"/"$j"
else
chown -h system.system "$prefix"/"$i"/"$j"
fi
fi
done
done
fi
fi

View file

@ -262,10 +262,11 @@ case "$target" in
log -t BOOT -p i "SDM429 early_boot prop set for: HwID '$soc_hwid'"
fi
;;
303|307|308|309|320)
303|307|308|309|320|386|436)
# Vulkan is not supported for 8917 variants
setprop vendor.opengles.version 196608
setprop persist.graphics.vulkan.disable true
setprop vendor.gralloc.disable_ahardware_buffer 1
;;
*)
setprop vendor.opengles.version 196608
@ -342,6 +343,13 @@ case "$target" in
441)
setprop vendor.fastrpc.disable.cdsprpcd.daemon 1
setprop vendor.gralloc.disable_ubwc 1
# 196609 is decimal for 0x30001 to report version 3.1
setprop vendor.opengles.version 196609
;;
471)
#scuba APQ
setprop vendor.gralloc.disable_ubwc 1
;;
esac
;;
@ -390,6 +398,9 @@ case "$target" in
;;
esac
;;
"holi")
setprop vendor.media.target_variant "_holi"
;;
esac
baseband=`getprop ro.baseband`

View file

@ -32,7 +32,8 @@ function 8953_sched_dcvs_eas()
#governor settings
echo 1 > /sys/devices/system/cpu/cpu0/online
echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 0 > /sys/devices/system/cpu/cpufreq/schedutil/rate_limit_us
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
@ -44,7 +45,8 @@ function 8917_sched_dcvs_eas()
#governor settings
echo 1 > /sys/devices/system/cpu/cpu0/online
echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 0 > /sys/devices/system/cpu/cpufreq/schedutil/rate_limit_us
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
@ -56,7 +58,8 @@ function 8937_sched_dcvs_eas()
# enable governor for perf cluster
echo 1 > /sys/devices/system/cpu/cpu0/online
echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us
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
@ -64,7 +67,8 @@ function 8937_sched_dcvs_eas()
## enable governor for power cluster
echo 1 > /sys/devices/system/cpu/cpu4/online
echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/rate_limit_us
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
@ -132,8 +136,9 @@ if [ $feature_id == 6 ]; then
echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/min_freq
echo 1017600000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/max_freq
echo 3 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
echo {class:ddr, res:fixed, val: 1016} > /sys/kernel/debug/aop_send_message
echo {class:ddr, res:capped, val: 1016} > /sys/kernel/debug/aop_send_message
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
@ -157,9 +162,10 @@ elif [ $feature_id == 5 ]; then
echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/min_freq
echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/max_freq
echo 2 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
echo {class:ddr, res:fixed, val: 1333} > /sys/kernel/debug/aop_send_message
echo {class:ddr, res:capped, val: 1333} > /sys/kernel/debug/aop_send_message
setprop vendor.sku_identified 1
elif [ $feature_id == 4 || $feature_id == 3 ]; then
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
@ -182,10 +188,11 @@ elif [ $feature_id == 4 || $feature_id == 3 ]; then
echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/min_freq
echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/max_freq
echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
echo {class:ddr, res:fixed, val: 1555} > /sys/kernel/debug/aop_send_message
echo {class:ddr, res:capped, val: 1555} > /sys/kernel/debug/aop_send_message
setprop vendor.sku_identified 1
setprop vendor.sku_name "SA6155"
else
echo "unknown feature_id value" $feature_id
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
@ -207,8 +214,9 @@ else
echo 940800000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/min_freq
echo 1363200000 > /sys/class/devfreq/soc\:qcom,cpu6-cpu-l3-lat/max_freq
echo 0 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
echo {class:ddr, res:fixed, val: 1555} > /sys/kernel/debug/aop_send_message
echo {class:ddr, res:capped, val: 1555} > /sys/kernel/debug/aop_send_message
setprop vendor.sku_identified 1
setprop vendor.sku_name "SA6155"
fi
}
@ -470,22 +478,48 @@ function sdm660_sched_interactive_dcvs() {
function sdm660_sched_schedutil_dcvs() {
# 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
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/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
# 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
echo "0:1401600" > /sys/module/cpu_boost/parameters/input_boost_freq
echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
#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
@ -520,24 +554,37 @@ function sdm660_sched_schedutil_dcvs() {
echo 1600 > $cpubw/bw_hwmon/idle_mbps
done
for memlat in $device/*cpu*-lat/devfreq/*cpu*-lat
do
echo "mem_latency" > $memlat/governor
echo 10 > $memlat/polling_interval
echo 400 > $memlat/mem_latency/ratio_ceil
done
for latfloor in $device/*cpu*-ddr-latfloor*/devfreq/*cpu-ddr-latfloor*
do
echo "compute" > $latfloor/governor
echo 10 > $latfloor/polling_interval
done
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}
@ -547,12 +594,17 @@ function configure_zram_parameters() {
# Zram disk - 75% for Go devices.
# For 512MB Go device, size = 384MB, set same for Non-Go.
# For 1GB Go device, size = 768MB, set same for Non-Go.
# For >=2GB Non-Go devices, size = 50% of RAM size. Limit the size to 4GB.
# 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"
let zRamSizeMB="( $RamSizeGB * 1024 ) / 2"
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
@ -567,14 +619,7 @@ function configure_zram_parameters() {
if [ -f /sys/block/zram0/use_dedup ]; then
echo 1 > /sys/block/zram0/use_dedup
fi
if [ $MemTotal -le 524288 ]; then
echo 402653184 > /sys/block/zram0/disksize
elif [ $MemTotal -le 1048576 ]; then
echo 805306368 > /sys/block/zram0/disksize
else
zramDiskSize=$zRamSizeMB$diskSizeUnit
echo $zramDiskSize > /sys/block/zram0/disksize
fi
echo "$zRamSizeMB""$diskSizeUnit" > /sys/block/zram0/disksize
# ZRAM may use more memory than it saves if SLAB_STORE_USER
# debug option is enabled.
@ -643,56 +688,6 @@ function enable_swap() {
fi
}
# bin.zhong@ASTI, 2019/10/12, add for memplus
function configure_memplus_parameters() {
bootmode=`getprop ro.vendor.factory.mode`
if [ "$bootmode" == "ftm" ] || [ "$bootmode" == "wlan" ] || [ "$bootmode" == "rf" ];then
return
fi
if [ ! $memplus_post_config ];then
return
fi
setprop vendor.sys.memplus.postboot 1
memplus=`getprop persist.vendor.memplus.enable`
case "$memplus" in
"0")
# diable swapspace
rm /data/vendor/swap/swapfile
swapoff /dev/block/zram0
;;
"1")
# enable memplus
rm /data/vendor/swap/swapfile
# reset zram swapspace
swapoff /dev/block/zram0
echo 1 > /sys/block/zram0/reset
echo 2202009600 > /sys/block/zram0/disksize
echo 0 > /sys/block/zram0/mem_limit
mkswap /dev/block/zram0
swapon /dev/block/zram0 -p 32758
if [ $? -eq 0 ]; then
echo 1 > /sys/module/memplus_core/parameters/memory_plus_enabled
fi
;;
*)
#enable kswapd
rm /data/vendor/swap/swapfile
# reset zram swapspace
swapoff /dev/block/zram0
echo 1 > /sys/block/zram0/reset
echo lz4 > /sys/block/zram0/comp_algorithm
echo 2202009600 > /sys/block/zram0/disksize
echo 0 > /sys/block/zram0/mem_limit
mkswap /dev/block/zram0
swapon /dev/block/zram0 -p 32758
if [ $? -eq 0 ]; then
echo 0 > /sys/module/memplus_core/parameters/memory_plus_enabled
fi
;;
esac
setprop vendor.sys.memplus.postboot 2
}
function configure_memory_parameters() {
# Set Memory parameters.
#
@ -716,7 +711,7 @@ function configure_memory_parameters() {
ProductName=`getprop ro.product.name`
low_ram=`getprop ro.config.low_ram`
if [ "$ProductName" == "msmnile" ] || [ "$ProductName" == "kona" ] ; then
if [ "$ProductName" == "msmnile" ] || [ "$ProductName" == "kona" ] || [ "$ProductName" == "sdmshrike_au" ]; then
# Enable ZRAM
configure_zram_parameters
configure_read_ahead_kb_values
@ -724,11 +719,9 @@ if [ "$ProductName" == "msmnile" ] || [ "$ProductName" == "kona" ] ; then
echo 100 > /proc/sys/vm/swappiness
else
arch_type=`uname -m`
MemTotalStr=`cat /proc/meminfo | grep MemTotal`
MemTotal=${MemTotalStr:16:8}
# Set parameters for 32-bit Go targets.
if [ $MemTotal -le 1048576 ] && [ "$low_ram" == "true" ]; then
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
@ -786,9 +779,9 @@ else
echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper
fi
if [ "$ProductName" != "bengal_32" ]; then
#bengal_32 has appcompaction enabled. So not needed
# Set PPR parametersi for other targets
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
@ -815,6 +808,16 @@ else
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
@ -822,12 +825,7 @@ else
# Disable wsf for all targets beacause we are using efk.
# wsf Range : 1..1000 So set to bare minimum value 1.
# set watermark_scale_factor = 36MB * 1024 * 1024 * 10 / MemTotal
factor=`expr 377487360 / $MemTotal`
echo $factor > /proc/sys/vm/watermark_scale_factor
# set min_free_kbytes = 32MB
echo 32768 > /proc/sys/vm/min_free_kbytes
echo 1 > /proc/sys/vm/watermark_scale_factor
configure_zram_parameters
@ -2155,10 +2153,6 @@ case "$target" in
done
#if the kernel version >=4.9,use the schedutil governor
KernelVersionStr=`cat /proc/sys/kernel/osrelease`
KernelVersionS=${KernelVersionStr:2:2}
KernelVersionA=${KernelVersionStr:0:1}
KernelVersionB=${KernelVersionS%.*}
if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 9 ]; then
8953_sched_dcvs_eas
else
@ -2281,7 +2275,8 @@ case "$target" in
# configure governor settings for little cluster
echo 1 > /sys/devices/system/cpu/cpu0/online
echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us
echo 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
@ -2294,7 +2289,8 @@ case "$target" in
# configure governor settings for big cluster
echo 1 > /sys/devices/system/cpu/cpu4/online
echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/rate_limit_us
echo 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
@ -2441,10 +2437,6 @@ case "$target" in
# disable thermal core_control to update interactive gov settings
echo 0 > /sys/module/msm_thermal/core_control/enabled
KernelVersionStr=`cat /proc/sys/kernel/osrelease`
KernelVersionS=${KernelVersionStr:2:2}
KernelVersionA=${KernelVersionStr:0:1}
KernelVersionB=${KernelVersionS%.*}
if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 9 ]; then
8917_sched_dcvs_eas
else
@ -2526,10 +2518,6 @@ case "$target" in
# disable thermal core_control to update interactive gov and core_ctl settings
echo 0 > /sys/module/msm_thermal/core_control/enabled
KernelVersionStr=`cat /proc/sys/kernel/osrelease`
KernelVersionS=${KernelVersionStr:2:2}
KernelVersionA=${KernelVersionStr:0:1}
KernelVersionB=${KernelVersionS%.*}
if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 9 ]; then
8937_sched_dcvs_eas
else
@ -2618,7 +2606,9 @@ case "$target" in
# enable governor for perf cluster
echo 1 > /sys/devices/system/cpu/cpu0/online
echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us
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
@ -2632,7 +2622,9 @@ case "$target" in
## enable governor for power cluster
echo 1 > /sys/devices/system/cpu/cpu4/online
echo "schedutil" > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
echo 0 > /sys/devices/system/cpu/cpu4/cpufreq/schedutil/rate_limit_us
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
@ -2682,7 +2674,9 @@ case "$target" in
# configure schedutil governor settings
echo 1 > /sys/devices/system/cpu/cpu0/online
echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us
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
@ -2764,12 +2758,14 @@ case "$target" in
panel=${panel:2:4}
fi
if [ $panel -gt 1080 ]; then
echo 2 > /proc/sys/kernel/sched_window_stats_policy
echo 5 > /proc/sys/kernel/sched_ravg_hist_size
else
echo 3 > /proc/sys/kernel/sched_window_stats_policy
echo 3 > /proc/sys/kernel/sched_ravg_hist_size
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
@ -2793,10 +2789,6 @@ case "$target" in
echo 0-3 > /dev/cpuset/system-background/cpus
#if the kernel version >=4.14,use the schedutil governor
KernelVersionStr=`cat /proc/sys/kernel/osrelease`
KernelVersionS=${KernelVersionStr:2:2}
KernelVersionA=${KernelVersionStr:0:1}
KernelVersionB=${KernelVersionS%.*}
if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 14 ]; then
sdm660_sched_schedutil_dcvs
else
@ -2831,6 +2823,9 @@ case "$target" in
;;
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
@ -3498,7 +3493,7 @@ case "$target" in
fi
case "$soc_id" in
"400" | "440" )
"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
@ -3569,8 +3564,7 @@ case "$target" in
# Set Memory parameters
configure_memory_parameters
rev=`cat /sys/devices/soc0/revision`
if [ $rev == "2.0" ] || [ $rev == "2.0.2" ]; then
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
@ -3785,7 +3779,6 @@ case "$target" in
do
echo 1 > /sys/devices/virtual/npu/msm_npu/pwr
echo "bw_hwmon" > $npullccbw/governor
echo 40 > $npullccbw/polling_interval
echo "2288 4577 7110 9155 12298 14236 16265" > $npullccbw/bw_hwmon/mbps_zones
echo 4 > $npullccbw/bw_hwmon/sample_ms
echo 100 > $npullccbw/bw_hwmon/io_percent
@ -3794,6 +3787,7 @@ case "$target" in
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
@ -3824,7 +3818,7 @@ case "$target" in
fi
case "$soc_id" in
"417" | "420" | "444" | "445" )
"417" | "420" | "444" | "445" | "469" | "470" )
# Core control is temporarily disabled till bring up
echo 0 > /sys/devices/system/cpu/cpu0/core_ctl/enable
@ -3862,6 +3856,9 @@ case "$target" in
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.
@ -4004,7 +4001,7 @@ case "$target" in
done
# Disable low power modes. Enable it after LPM stable
echo 1 > /sys/module/lpm_levels/parameters/sleep_disabled
echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
;;
esac
@ -4982,6 +4979,242 @@ case "$target" in
;;
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 {class:ddr, res:capped, val: 1804} > /sys/kernel/debug/aop_send_message
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 {class:ddr, res:capped, val: 2092} > /sys/kernel/debug/aop_send_message
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`
@ -5027,8 +5260,6 @@ case "$target" in
echo 0-3 > /dev/cpuset/background/cpus
echo 0-3 > /dev/cpuset/system-background/cpus
echo 0-6 > /dev/cpuset/foreground/cpus
# Turn off scheduler boost at the end
echo 0 > /proc/sys/kernel/sched_boost
@ -5066,11 +5297,6 @@ case "$target" in
fi
echo 1 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/pl
# ifdef VENDOR_EDIT
# yankelong@BSP, 2019/5/8/, add for Enable ufs performance.
echo 0 > /sys/class/scsi_host/host0/../../../clkscale_enable
# endif VENDOR_EDIT
# Enable bus-dcvs
for device in /sys/devices/platform/soc
do
@ -5153,12 +5379,7 @@ case "$target" in
setprop vendor.dcvs.prop 0
setprop vendor.dcvs.prop 1
echo N > /sys/module/lpm_levels/parameters/sleep_disabled
# Enable fsc.
echo 1 > /sys/module/fsc/parameters/enable
configure_memory_parameters
# bin.zhong@ASTI, 2019/10/12, add for memplus
memplus_post_config=1
;;
esac
@ -5457,7 +5678,7 @@ case "$target" in
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" | "lahaina" )
"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")
@ -5561,9 +5782,19 @@ case "$console_config" in
;;
esac
##qcom arg relese.
#echo 80 > /sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres
#echo 50 > /sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres
#echo 90 99 > /proc/sys/kernel/sched_upmigrate
#echo 80 90 > /proc/sys/kernel/sched_downmigrate
#echo 0 > /sys/devices/system/cpu/cpu7/cpufreq/schedutil/pl
#echo 1420800 > /sys/devices/system/cpu/cpufreq/policy7/schedutil/hispeed_freq
##echo -10 > /sys/devices/system/cpu/cpu4/sched_load_boost
##echo -10 > /sys/devices/system/cpu/cpu5/sched_load_boost
##echo -10 > /sys/devices/system/cpu/cpu6/sched_load_boost
#echo -19 > /sys/devices/system/cpu/cpu7/sched_load_boost
# 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
# bin.zhong@ASTI, 2019/10/12, add for memplus
configure_memplus_parameters

View file

@ -456,10 +456,10 @@ buildvariant=`getprop ro.build.type`
case "$buildvariant" in
"userdebug" | "eng")
#set default loglevel to KERN_INFO
echo "6 6 1 7" > /proc/sys/kernel/printk
echo "3 6 1 7" > /proc/sys/kernel/printk
;;
*)
#set default loglevel to KERN_WARNING
echo "4 4 1 4" > /proc/sys/kernel/printk
echo "3 4 1 4" > /proc/sys/kernel/printk
;;
esac

View file

@ -51,10 +51,7 @@ if [ "$(getprop persist.vendor.usb.config)" == "" -a "$(getprop ro.build.type)"
"$(getprop init.svc.vendor.usb-gadget-hal-1-0)" != "running" ]; then
if [ "$esoc_name" != "" ]; then
setprop persist.vendor.usb.config diag,diag_mdm,qdss,qdss_mdm,serial_cdev,dpl,rmnet,adb
#BSP add for 5G diag port config
setprop persist.vendor.sdx50m.online 1
else
setprop persist.vendor.sdx50m.online 0
case "$(getprop ro.baseband)" in
"apq")
setprop persist.vendor.usb.config diag,adb
@ -104,7 +101,7 @@ if [ "$(getprop persist.vendor.usb.config)" == "" -a "$(getprop ro.build.type)"
"sdm845" | "sdm710")
setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,adb
;;
"msmnile" | "sm6150" | "trinket" | "lito" | "atoll" | "bengal" | "lahaina")
"msmnile" | "sm6150" | "trinket" | "lito" | "atoll" | "bengal" | "lahaina" | "holi")
setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,qdss,adb
;;
*)
@ -146,17 +143,7 @@ if [ -d /config/usb_gadget ]; then
msm_serial=`cat /sys/devices/soc0/serial_number`;
msm_serial_hex=`printf %08X $msm_serial`
machine_type=`cat /sys/devices/soc0/machine`
#ifdef VENDOR_EDIT
#Fix product name for Android Auto/Ubuntu
product_string=`getprop ro.product.model`
if [ "$product_string" == "" ]; then
product_string="OnePlus"
fi
#else
#product_string="$machine_type-$soc_hwplatform _SN:$msm_serial_hex"
#endif
echo "$product_string" > /config/usb_gadget/g1/strings/0x409/product
setprop vendor.usb.product_string "$product_string"
setprop vendor.usb.product_string "$machine_type-$soc_hwplatform _SN:$msm_serial_hex"
# ADB requires valid iSerialNumber; if ro.serialno is missing, use dummy
serialnumber=`cat /config/usb_gadget/g1/strings/0x409/serialnumber 2> /dev/null`
@ -238,13 +225,19 @@ if [ -d /config/usb_gadget/g1/functions/uvc.0 ]; then
ln -s streaming/header/h streaming/class/hs/
ln -s streaming/header/h streaming/class/ss/
fi
#ifdef VENDOR_EDIT
#Enable diag and adb for FTM
boot_mode=`getprop ro.boot.ftm_mode`
echo "boot_mode: $boot_mode" > /dev/kmsg
case "$boot_mode" in
"ftm_at" | "ftm_rf" | "ftm_wlan" | "ftm_mos")
"ftm_rf" | "ftm_wlan" | "ftm_mos")
setprop sys.usb.config diag,adb
setprop persist.sys.usb.config diag,adb
echo "peripheral" > /sys/devices/platform/soc/a600000.ssusb/mode
echo "AFTER boot_mode: diag,adb" > /dev/kmsg
esac
case "$boot_mode" in
"ftm_at")
setprop sys.usb.config diag,adb
setprop persist.sys.usb.config diag,adb
echo "AFTER boot_mode: diag,adb" > /dev/kmsg

View file

@ -12,27 +12,37 @@ export PATH=/vendor/bin
soc_id=`getprop ro.vendor.qti.soc_id`
if [ "$soc_id" -eq 415 ] || [ "$soc_id" -eq 439 ] || [ "$soc_id" -eq 450 ]; then
setprop persist.vendor.hvdcp_opti.start 0
rm -rf /mnt/vendor/persist/hvdcp_opti
setprop persist.vendor.hvdcp_opti.start 2
exit 0
fi
prefix="/sys/class/"
#List of folder for ownership update
arr=( "power_supply/battery/" "power_supply/usb/" "power_supply/main/" "power_supply/charge_pump_master/" "power_supply/pc_port/" "power_supply/dc/" "power_supply/bms/" "power_supply/parallel/" "usbpd/usbpd0/" "qc-vdm/" "charge_pump/" "qcom-battery/" )
for i in "${arr[@]}"
do
for j in `ls "$prefix""$i"`
do
#skip directories to prevent possible security issues.
if [[ -d "$prefix""$i""$j" ]]
then
continue
else
chown -h system.system "$prefix""$i""$j"
fi
done
done
if [ "$soc_id" -eq 441 ] || [ "$soc_id" -eq 471 ]; then
#Scuba does not support usb-pd or charge pumps
find /sys/class/power_supply/battery/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/bms/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/main/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/usb/ -type f -maxdepth 1 | xargs chown system.system
else
find /sys/class/power_supply/battery/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/bms/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/main/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/usb/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/charge_pump_master/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/pc_port/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/dc/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/parallel/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/usbpd/usbpd0/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/qc-vdm/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/charge_pump/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/qcom-battery/ -type f -maxdepth 1 | xargs chown system.system
#@bsp, 2020/05/11, remove hvdcp_opti service
#setprop persist.vendor.hvdcp_opti.start 1
for i in 0 1 2 3 4 5 6 7 8 9
do
devname=`cat /sys/bus/iio/devices/iio:device$i/name`
if [[ "$devname" == *smb* ]] || [[ "$devname" == *qg* ]] || [[ "$devname" == *div2_cp* ]]; then
find /sys/bus/iio/devices/iio:device$i/ -type f -maxdepth 1 | xargs chown system.system
fi
done
fi
setprop persist.vendor.hvdcp_opti.start 1

48
rootdir/bin/init.qti.kernel.sh Executable file
View file

@ -0,0 +1,48 @@
#! /vendor/bin/sh
#=============================================================================
# Copyright (c) 2019-2020 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.
#=============================================================================
verify_pasr_support()
{
if [ -d /sys/kernel/mem-offline ]; then
setprop vendor.pasr.enabled true
fi
}
start_msm_irqbalance()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
start vendor.msm_irqbalance
fi
}
start_msm_irqbalance
verify_pasr_support

43
rootdir/bin/vendor_modprobe.sh Executable file
View file

@ -0,0 +1,43 @@
#! /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`
# insmod op_cmdline before other modules
CMD_LINE=`cat /proc/cmdline`
${MODPROBE} -a -b -d ${MODULES_PATH} op_cmdline.ko op_cmdline="\"${CMD_LINE}\""
${MODPROBE} -a -b -d ${GKI_MOD_PATH} op_cmdline.ko op_cmdline="\"${CMD_LINE}\""
# 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