Files
device_xiaomi_sdm710-common/rootdir/etc/init.qcom.power.rc
Ivan Vecera 0833af2c38 sdm710-common: rootdir: Move all static parameters to init.qcom.power.rc
Move the rest of static configuration parameters from
init.qcom.post_boot.sh to init.qcom.power.rc.

Change-Id: I18d8aa7bdd4f2807246dafd9c47fc7fb9b65dc71
2024-01-20 14:57:56 +01:00

227 lines
10 KiB
Plaintext

# Copyright (c) 2016, Code Aurora Forum. 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 Code Aurora 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
# Disable UFS powersaving
write /sys/devices/platform/soc/${ro.boot.bootdevice}/clkgate_enable 0
write /sys/devices/platform/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 0
# Bring all cores online
write /sys/devices/system/cpu/cpu0/online 1
write /sys/devices/system/cpu/cpu1/online 1
write /sys/devices/system/cpu/cpu2/online 1
write /sys/devices/system/cpu/cpu3/online 1
write /sys/devices/system/cpu/cpu4/online 1
write /sys/devices/system/cpu/cpu5/online 1
write /sys/devices/system/cpu/cpu6/online 1
write /sys/devices/system/cpu/cpu7/online 1
# Set default schedTune value for foreground/top-app
write /dev/stune/foreground/schedtune.prefer_idle 1
write /dev/stune/top-app/schedtune.boost 10
write /dev/stune/top-app/schedtune.prefer_idle 1
on boot
# Disable console_suspend to get better logging for kernel crashes
write /sys/module/printk/parameters/console_suspend N
on post-fs
# Disable sched autogroup
write /proc/sys/kernel/sched_autogroup_enabled 0
on property:init.svc.vendor.charger=running
# Keep one LITTLE and one big
write /sys/devices/system/cpu/cpu1/online 0
write /sys/devices/system/cpu/cpu2/online 0
write /sys/devices/system/cpu/cpu3/online 0
write /sys/devices/system/cpu/cpu4/online 0
write /sys/devices/system/cpu/cpu5/online 0
write /sys/devices/system/cpu/cpu7/online 0
wait /dev/block/bootdevice
# Enable UFS powersaving
write /sys/devices/platform/soc/${ro.boot.bootdevice}/clkgate_enable 1
write /sys/devices/platform/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1
write /sys/module/msm_thermal/parameters/enabled "N"
symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
mkdir /mnt/vendor/persist
chown root system /mnt/vendor/persist
chmod 0771 /mnt/vendor/persist
mount ext4 /dev/block/bootdevice/by-name/persist /mnt/vendor/persist nosuid nodev barrier=1
mount tmpfs tmpfs /data
start vendor.thermal-engine
on enable-low-power
# 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.
write /proc/irq/default_smp_affinity "3f"
# Core control parameters on silver
write /sys/devices/system/cpu/cpu0/core_ctl/not_preferred "0 0 0 0 1 1"
write /sys/devices/system/cpu/cpu0/core_ctl/min_cpus 4
write /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres 60
write /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres 40
write /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms 100
write /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster 0
write /sys/devices/system/cpu/cpu0/core_ctl/task_thres 8
# Setting b.L scheduler parameters
write /proc/sys/kernel/sched_upmigrate 96
write /proc/sys/kernel/sched_downmigrate 90
write /proc/sys/kernel/sched_group_upmigrate 140
write /proc/sys/kernel/sched_group_downmigrate 120
write /proc/sys/kernel/sched_walt_rotate_big_tasks 1
# Configure governor settings for little cluster
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "schedutil"
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/rate_limit_us 0
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/hispeed_freq 1209600
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 576000
# Configure governor settings for big cluster
write /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor "schedutil"
write /sys/devices/system/cpu/cpu6/cpufreq/schedutil/rate_limit_us 0
write /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_freq 1344000
write /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq 652800
# Set sched_load_boost as -6 that is equivalent to target load as 85.
write /sys/devices/system/cpu/cpu6/sched_load_boost -6
write /sys/devices/system/cpu/cpu7/sched_load_boost -6
write /sys/devices/system/cpu/cpu6/cpufreq/schedutil/hispeed_load 85
write /sys/module/cpu_boost/parameters/input_boost_freq "0:1209600"
write /sys/module/cpu_boost/parameters/input_boost_ms 40
# Memory parameters
# Set per_process_reclaim tuning parameters:
# - vmpressure range: 50-70
# - swap size: 512 pages
write /sys/module/process_reclaim/parameters/min_score_adj 6
write /sys/module/process_reclaim/parameters/enable_process_reclaim 0
write /sys/module/process_reclaim/parameters/pressure_min 50
write /sys/module/process_reclaim/parameters/pressure_max 70
write /sys/module/process_reclaim/parameters/swap_opt_eff 30
write /sys/module/process_reclaim/parameters/per_swap_size 512
# Set allocstall_threshold to 0
write /sys/module/vmpressure/parameters/allocstall_threshold 0
# Set swappiness to 100 for all targets
write /proc/sys/vm/swappiness 100
# Disable wsf because we are using efk.
# wsf Range : 1..1000 So set to bare minimum value 1.
write /proc/sys/vm/watermark_scale_factor 1
# Enable bus-dcvs
write /sys/class/devfreq/soc:qcom,cpubw/governor "bw_hwmon"
write /sys/class/devfreq/soc:qcom,cpubw/polling_interval 50
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/mbps_zones "1144 1720 2086 2929 3879 5931 6881"
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/sample_ms 4
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/io_percent 68
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/hist_memory 20
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_length 0
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/down_thres 80
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/guard_band_mbps 0
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/up_scale 250
write /sys/class/devfreq/soc:qcom,cpubw/bw_hwmon/idle_mbps 1600
# Enable mem_latency governor for DDR scaling
write /sys/class/devfreq/soc:qcom,memlat-cpu0/governor "mem_latency"
write /sys/class/devfreq/soc:qcom,memlat-cpu0/polling_interval 10
write /sys/class/devfreq/soc:qcom,memlat-cpu0/mem_latency/ratio_ceil 400
write /sys/class/devfreq/soc:qcom,memlat-cpu6/governor "mem_latency"
write /sys/class/devfreq/soc:qcom,memlat-cpu6/polling_interval 10
write /sys/class/devfreq/soc:qcom,memlat-cpu6/mem_latency/ratio_ceil 400
# Enable mem_latency governor for L3 scaling
write /sys/class/devfreq/soc:qcom,l3-cpu0/governor "mem_latency"
write /sys/class/devfreq/soc:qcom,l3-cpu0/polling_interval 10
write /sys/class/devfreq/soc:qcom,l3-cpu0/mem_latency/ratio_ceil 400
write /sys/class/devfreq/soc:qcom,l3-cpu6/governor "mem_latency"
write /sys/class/devfreq/soc:qcom,l3-cpu6/polling_interval 10
write /sys/class/devfreq/soc:qcom,l3-cpu6/mem_latency/ratio_ceil 400
# Enable userspace governor for L3 cdsp nodes
write /sys/class/devfreq/soc:qcom,l3-cdsp/governor "userspace"
chown system /sys/class/devfreq/soc:qcom,l3-cdsp/userspace/set_freq
write /sys/class/devfreq/soc:qcom,mincpubw/governor "cpufreq"
# Disable CPU Retention
write /sys/module/lpm_levels/L3/cpu0/ret/idle_enabled "N"
write /sys/module/lpm_levels/L3/cpu1/ret/idle_enabled "N"
write /sys/module/lpm_levels/L3/cpu2/ret/idle_enabled "N"
write /sys/module/lpm_levels/L3/cpu3/ret/idle_enabled "N"
write /sys/module/lpm_levels/L3/cpu4/ret/idle_enabled "N"
write /sys/module/lpm_levels/L3/cpu5/ret/idle_enabled "N"
write /sys/module/lpm_levels/L3/cpu6/ret/idle_enabled "N"
write /sys/module/lpm_levels/L3/cpu7/ret/idle_enabled "N"
# Set cpuset parameters
write /dev/cpuset/background/cpus 4-5
write /dev/cpuset/system-background/cpus 2-5
write /dev/cpuset/foreground/boost/cpus 0-5,7
write /dev/cpuset/foreground/cpus 0-5,7
write /dev/cpuset/top-app/cpus 0-7
write /dev/cpuset/restricted/cpus 2-5
# Turn off scheduler boost at the end
write /proc/sys/kernel/sched_boost 0
# Turn on sleep modes
write /sys/module/lpm_levels/parameters/sleep_disabled 0
# Enable idle state listener
write /sys/class/drm/card0/device/idle_encoder_mask 1
write /sys/class/drm/card0/device/idle_timeout_ms 100
# Enable UFS powersaving
write /sys/devices/platform/soc/${ro.boot.bootdevice}/clkgate_enable 1
write /sys/devices/platform/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1
# Enable PowerHAL hint processing
setprop vendor.powerhal.init 1
on property:sys.boot_completed=1
trigger enable-low-power
# If UART is on, enable console_suspend on boot_complete to save power
on property:sys.boot_completed=1 && property:init.svc.console=running
write /sys/module/printk/parameters/console_suspend Y
on property:init.svc.recovery=running
trigger enable-low-power