device_xiaomi_sm6150-common/rootdir/etc/init.qcom.power.rc

200 lines
8.1 KiB
Plaintext
Raw Normal View History

# Copyright (c) 2016-2024, Code Aurora Forum. All rights reserved.
# Copyright (c) 2024, Shashank Patil <9945shashank@gmail.com>.
#
# 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 early-init
# Disable EAS
write /proc/sys/kernel/sched_energy_aware 0
# Boot time scheduler tuning
write /dev/stune/schedtune.boost 50
write /dev/stune/schedtune.prefer_idle 1
# Boot time I/O performance tuning
write /sys/block/mmcblk0/queue/scheduler "noop"
write /sys/block/mmcblk0/queue/read_ahead_kb 2048
write /sys/block/mmcblk0/queue/nr_requests 256
write /sys/block/mmcblk0/queue/iostats 0
# Boot time fs tuning
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
write /sys/block/dm-3/queue/read_ahead_kb 2048
write /sys/block/dm-4/queue/read_ahead_kb 2048
write /sys/block/dm-5/queue/read_ahead_kb 2048
write /sys/block/dm-6/queue/read_ahead_kb 2048
write /sys/block/dm-7/queue/read_ahead_kb 2048
write /sys/block/dm-8/queue/read_ahead_kb 2048
write /sys/block/dm-9/queue/read_ahead_kb 2048
write /sys/block/sda/queue/iostats 0
write /sys/block/sda/queue/read_ahead_kb 2048
write /sys/block/sda/queue/nr_requests 256
write /sys/block/sda/queue/iosched/group_idle 0
write /sys/block/sda/queue/iosched/slice_idle 0
write /sys/block/sdb/queue/iostats 0
write /sys/block/sdb/queue/read_ahead_kb 2048
write /sys/block/sdb/queue/nr_requests 256
write /sys/block/sdc/queue/iostats 0
write /sys/block/sdc/queue/read_ahead_kb 2048
write /sys/block/sdc/queue/nr_requests 256
write /sys/block/sdd/queue/iostats 0
write /sys/block/sdd/queue/read_ahead_kb 2048
write /sys/block/sdd/queue/nr_requests 256
write /sys/block/sde/queue/iostats 0
write /sys/block/sde/queue/read_ahead_kb 2048
write /sys/block/sde/queue/nr_requests 256
write /sys/block/sdf/queue/iostats 0
write /sys/block/sdf/queue/read_ahead_kb 2048
write /sys/block/sdf/queue/nr_requests 256
on init
# Report max frequency to unity tasks
write /proc/sys/kernel/sched_lib_name "UnityMain,libunity.so"
write /proc/sys/kernel/sched_lib_mask_force 255
on boot
# Disable console_suspend to get better logging for kernel crashes
write /sys/module/printk/parameters/console_suspend N
# Enable suspend to idle mode to reduce latency during suspend/resume
write /sys/power/mem_sleep "s2idle"
on property:sys.boot_completed=1 && property:init.svc.console=running
# If UART is on, enable console_suspend on boot_complete to save power
write /sys/module/printk/parameters/console_suspend Y
on property:sys.boot_completed=1
setprop vendor.setup.power 1
on property:vendor.setup.power=1
# Restore default I/O performance tuning
write /sys/block/mmcblk0/queue/scheduler "cfq"
write /sys/block/mmcblk0/queue/read_ahead_kb 128
write /sys/block/mmcblk0/queue/nr_requests 128
# Restore default fs tuning
write /sys/block/dm-0/queue/read_ahead_kb 128
write /sys/block/dm-1/queue/read_ahead_kb 128
write /sys/block/dm-2/queue/read_ahead_kb 128
write /sys/block/dm-3/queue/read_ahead_kb 128
write /sys/block/dm-4/queue/read_ahead_kb 128
write /sys/block/dm-5/queue/read_ahead_kb 128
write /sys/block/dm-6/queue/read_ahead_kb 128
write /sys/block/dm-7/queue/read_ahead_kb 128
write /sys/block/dm-8/queue/read_ahead_kb 128
write /sys/block/dm-9/queue/read_ahead_kb 128
write /sys/block/sda/queue/read_ahead_kb 128
write /sys/block/sda/queue/nr_requests 128
write /sys/block/sdb/queue/read_ahead_kb 128
write /sys/block/sdb/queue/nr_requests 128
write /sys/block/sdc/queue/read_ahead_kb 128
write /sys/block/sdc/queue/nr_requests 128
write /sys/block/sdd/queue/read_ahead_kb 128
write /sys/block/sdd/queue/nr_requests 128
write /sys/block/sde/queue/read_ahead_kb 128
write /sys/block/sde/queue/nr_requests 128
write /sys/block/sdf/queue/read_ahead_kb 128
write /sys/block/sdf/queue/nr_requests 128
# Set CPU Min frequencies for little & big cluster
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 576000
write /sys/devices/system/cpu/cpu6/cpufreq/scaling_min_freq 652800
# Configure governor settings for little cluster
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us 500
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us 4000
# Configure governor settings for big cluster
write /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us 500
write /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us 4000
# Set default schedTune
write /dev/stune/schedtune.boost 0
write /dev/stune/schedtune.prefer_idle 0
# Set default schedTune value for foreground, top-app & camera-daemon
write /dev/stune/foreground/schedtune.boost 0
write /dev/stune/foreground/schedtune.prefer_idle 1
write /dev/stune/top-app/schedtune.boost 20
write /dev/stune/top-app/schedtune.prefer_idle 1
write /dev/stune/camera-daemon/schedtune.boost 0
write /dev/stune/camera-daemon/schedtune.prefer_idle 1
# Setup scheduler EAS parameters
write /proc/sys/kernel/sched_child_runs_first 1
write /proc/sys/kernel/sched_upmigrate 95
write /proc/sys/kernel/sched_downmigrate 85
write /proc/sys/kernel/sched_energy_aware 1
# Setup cpusets parameters
write /dev/cpuset/background/cpus 4-5
write /dev/cpuset/camera-daemon/cpus 0-7
write /dev/cpuset/foreground/cpus 0-5,7
write /dev/cpuset/restricted/cpus 2-5
write /dev/cpuset/system-background/cpus 2-5
write /dev/cpuset/top-app/cpus 0-7
# 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 PowerHAL hint processing
setprop vendor.powerhal.init 1
# Enable Post boot parsed
setprop vendor.post_boot.parsed 1
on property:persist.sys.xtra-daemon.enabled=*
service vendor.qcom-sh /vendor/bin/init.qcom.sh
class late_start
user root
group root system radio
oneshot
service vendor.qcom-post-boot /vendor/bin/init.qcom.post_boot.sh
class late_start
user root
group root system wakelock graphics
disabled
oneshot