sm6150-common: rootdir: Create qcom power init script

Signed-off-by: Shashank Patil <9945shashank@gmail.com>
Signed-off-by: donjohanliebert <donjohanliebert@gmail.com>
This commit is contained in:
itsshashanksp 2024-06-24 11:47:10 +05:30 committed by donjohanliebert
parent ac9a7f1d03
commit 70b396c675
5 changed files with 200 additions and 112 deletions

View File

@ -78,12 +78,6 @@ function configure_memory_parameters() {
echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper echo 1 > /sys/module/lowmemorykiller/parameters/oom_reaper
} }
# 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 if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id` soc_id=`cat /sys/devices/soc0/soc_id`
else else
@ -93,30 +87,6 @@ fi
case "$soc_id" in case "$soc_id" in
"355" | "369" | "377" | "380" | "384" ) "355" | "369" | "377" | "380" | "384" )
# Setting b.L scheduler parameters
echo 25 > /proc/sys/kernel/sched_downmigrate_boosted
echo 25 > /proc/sys/kernel/sched_upmigrate_boosted
echo 85 > /proc/sys/kernel/sched_downmigrate
echo 95 > /proc/sys/kernel/sched_upmigrate
# configure governor settings for little cluster
echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 500 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
# configure governor settings for big cluster
echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor
echo 500 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us
echo 20000 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us
# Configure default schedTune value for foreground/top-app
echo 1 > /dev/stune/foreground/schedtune.prefer_idle
echo 10 > /dev/stune/top-app/schedtune.boost
echo 1 > /dev/stune/top-app/schedtune.prefer_idle
# Set Memory parameters
configure_memory_parameters
# Enable bus-dcvs # Enable bus-dcvs
for device in /sys/devices/platform/soc for device in /sys/devices/platform/soc
do do
@ -174,50 +144,12 @@ case "$soc_id" in
echo 10 > $latfloor/polling_interval echo 10 > $latfloor/polling_interval
done done
done done
# cpuset parameters
echo 0-7 > /dev/cpuset/top-app/cpus
echo 0-5,7 > /dev/cpuset/foreground/cpus
echo 4-5 > /dev/cpuset/background/cpus
echo 2-5 > /dev/cpuset/system-background/cpus
echo 2-5 > /dev/cpuset/restricted/cpus
# Enable idle state listener
echo 1 > /sys/class/drm/card0/device/idle_encoder_mask
echo 100 > /sys/class/drm/card0/device/idle_timeout_ms
# Turn on sleep modes.
echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
;; ;;
esac esac
case "$soc_id" in case "$soc_id" in
"365" | "366" ) "365" | "366" )
# Setting b.L scheduler parameters
echo 25 > /proc/sys/kernel/sched_downmigrate_boosted
echo 25 > /proc/sys/kernel/sched_upmigrate_boosted
echo 85 > /proc/sys/kernel/sched_downmigrate
echo 95 > /proc/sys/kernel/sched_upmigrate
# configure governor settings for little cluster
echo "schedutil" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 500 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
# configure governor settings for big cluster
echo "schedutil" > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor
echo 500 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us
echo 20000 > /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us
# Configure default schedTune value for foreground/top-app
echo 1 > /dev/stune/foreground/schedtune.prefer_idle
echo 10 > /dev/stune/top-app/schedtune.boost
echo 1 > /dev/stune/top-app/schedtune.prefer_idle
# Set Memory parameters
configure_memory_parameters
# Enable bus-dcvs # Enable bus-dcvs
for device in /sys/devices/platform/soc for device in /sys/devices/platform/soc
do do
@ -292,24 +224,8 @@ case "$soc_id" in
echo 10 > $latfloor/polling_interval echo 10 > $latfloor/polling_interval
done done
done done
# cpuset parameters
echo 0-7 > /dev/cpuset/top-app/cpus
echo 0-5,7 > /dev/cpuset/foreground/cpus
echo 4-5 > /dev/cpuset/background/cpus
echo 2-5 > /dev/cpuset/system-background/cpus
echo 2-5 > /dev/cpuset/restricted/cpus
# Enable idle state listener
echo 1 > /sys/class/drm/card0/device/idle_encoder_mask
echo 100 > /sys/class/drm/card0/device/idle_timeout_ms
# Turn on sleep modes.
echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
;; ;;
esac esac
# Enable PowerHAL hint processing # Set Memory parameters
setprop vendor.powerhal.init 1 configure_memory_parameters
setprop vendor.post_boot.parsed 1

View File

@ -0,0 +1,195 @@
# 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
# 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 10
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

View File

@ -27,6 +27,7 @@
import /vendor/etc/init/hw/init.qcom.usb.rc import /vendor/etc/init/hw/init.qcom.usb.rc
import /vendor/etc/init/hw/init.target.rc import /vendor/etc/init/hw/init.target.rc
import /vendor/etc/init/hw/init.qcom.power.rc
on early-init on early-init
# Change ownership of sysfs power control node # Change ownership of sysfs power control node
@ -258,19 +259,6 @@ service vendor.loc_launcher /vendor/bin/loc_launcher
on property:persist.sys.xtra-daemon.enabled=* on property:persist.sys.xtra-daemon.enabled=*
restart vendor.loc_launcher restart vendor.loc_launcher
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
on property:ro.vendor.ril.mbn_copy_completed=1 on property:ro.vendor.ril.mbn_copy_completed=1
write /data/vendor/radio/copy_complete 1 write /data/vendor/radio/copy_complete 1

View File

@ -43,18 +43,6 @@ on init
write /sys/module/qpnp_rtc/parameters/poweron_alarm 1 write /sys/module/qpnp_rtc/parameters/poweron_alarm 1
# Boot time fs tuning
write /sys/block/sda/queue/iostats 0
write /sys/block/sda/queue/scheduler cfq
write /sys/block/sda/queue/iosched/slice_idle 0
write /sys/block/sda/queue/read_ahead_kb 2048
write /sys/block/sda/queue/nr_requests 256
write /sys/block/sde/queue/iostats 0
write /sys/block/sde/queue/scheduler cfq
write /sys/block/sde/queue/iosched/slice_idle 0
write /sys/block/sde/queue/read_ahead_kb 2048
write /sys/block/sde/queue/nr_requests 256
# ZRAM setup # ZRAM setup
write /sys/block/zram0/comp_algorithm lz4 write /sys/block/zram0/comp_algorithm lz4
write /proc/sys/vm/page-cluster 0 write /proc/sys/vm/page-cluster 0

View File

@ -184,7 +184,8 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/rootdir/etc/init.qcom.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.qcom.rc \ $(LOCAL_PATH)/rootdir/etc/init.qcom.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.qcom.rc \
$(LOCAL_PATH)/rootdir/etc/init.qcom.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.qcom.usb.rc \ $(LOCAL_PATH)/rootdir/etc/init.qcom.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.qcom.usb.rc \
$(LOCAL_PATH)/rootdir/etc/init.target.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.target.rc $(LOCAL_PATH)/rootdir/etc/init.target.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.target.rc \
$(LOCAL_PATH)/rootdir/etc/init.qcom.power.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.qcom.power.rc
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/rootdir/bin/init.qcom.post_boot.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.post_boot.sh \ $(LOCAL_PATH)/rootdir/bin/init.qcom.post_boot.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.post_boot.sh \