From 5da5271efd308ea5603376cb8bdd4ff2fce05def Mon Sep 17 00:00:00 2001 From: Joel16 Date: Mon, 20 Jan 2020 10:30:22 -0500 Subject: [PATCH] Clean up ramdisk --- device.mk | 4 - rootdir/Android.mk | 10 ++ rootdir/{bin => etc}/init.qcom.power.sh | 135 +++++++++++++----------- 3 files changed, 82 insertions(+), 67 deletions(-) create mode 100644 rootdir/Android.mk rename rootdir/{bin => etc}/init.qcom.power.sh (56%) diff --git a/device.mk b/device.mk index 1bf4a75..6f5cc33 100644 --- a/device.mk +++ b/device.mk @@ -33,10 +33,6 @@ TARGET_BOOTANIMATION_HALF_RES := true PRODUCT_AAPT_CONFIG := normal PRODUCT_AAPT_PREF_CONFIG := xxhdpi -# Init -PRODUCT_COPY_FILES += \ - $(LOCAL_PATH)/rootdir/bin/init.qcom.power.sh:system/bin/init.qcom.power.sh - # Audio PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/audio/mixer_paths.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths.xml diff --git a/rootdir/Android.mk b/rootdir/Android.mk new file mode 100644 index 0000000..3dc4dc3 --- /dev/null +++ b/rootdir/Android.mk @@ -0,0 +1,10 @@ +LOCAL_PATH := $(call my-dir) + +# Configuration scripts +include $(CLEAR_VARS) +LOCAL_MODULE := init.qcom.power.sh +LOCAL_MODULE_TAGS := optional eng +LOCAL_MODULE_CLASS := EXECUTABLES +LOCAL_SRC_FILES := etc/init.qcom.power.sh +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) +include $(BUILD_PREBUILT) diff --git a/rootdir/bin/init.qcom.power.sh b/rootdir/etc/init.qcom.power.sh similarity index 56% rename from rootdir/bin/init.qcom.power.sh rename to rootdir/etc/init.qcom.power.sh index fc722c9..36ebeb5 100644 --- a/rootdir/bin/init.qcom.power.sh +++ b/rootdir/etc/init.qcom.power.sh @@ -1,4 +1,4 @@ -#!/system/bin/sh +#!/vendor/bin/sh ################################################################################ # helper functions to allow Android init like script @@ -7,10 +7,6 @@ function write() { echo -n $2 > $1 } -function copy() { - cat $1 > $2 -} - function get-set-forall() { for f in $1 ; do cat $f @@ -25,23 +21,42 @@ write /sys/module/msm_thermal/core_control/enabled 0 get-set-forall /sys/devices/soc.0/qcom,bcl.*/mode disable bcl_hotplug_mask=`get-set-forall /sys/devices/soc.0/qcom,bcl.*/hotplug_mask 0` bcl_hotplug_soc_mask=`get-set-forall /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask 0` -get-set-forall /sys/devices/soc.0/qcom,bcl.*/mode enable # some files in /sys/devices/system/cpu are created after the restorecon of # /sys/. These files receive the default label "sysfs". -# Restorecon again to give new files the correct label. restorecon -R /sys/devices/system/cpu # ensure at most one A57 is online when thermal hotplug is disabled +write /sys/devices/system/cpu/cpu4/online 1 write /sys/devices/system/cpu/cpu5/online 0 write /sys/devices/system/cpu/cpu6/online 0 write /sys/devices/system/cpu/cpu7/online 0 -# Best effort limiting for first time boot if msm_performance module is absent -write /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq 960000 +# files in /sys/devices/system/cpu4 are created after enabling cpu4. +# These files receive the default label "sysfs". +# Restorecon again to give new files the correct label. +restorecon -R /sys/devices/system/cpu -# Limit A57 max freq from msm_perf module in case CPU 4 is offline -write /sys/module/msm_performance/parameters/cpu_max_freq "4:960000 5:960000 6:960000 7:960000" +# some files in /sysmodule/msm_performance/parameters are created after the restorecon of +# /sys/. These files receive the default label "sysfs". +restorecon -R /sys/module/msm_performance/parameters + +# Enable CPU retention +write /sys/module/lpm_levels/system/a53/cpu0/retention/idle_enabled 1 +write /sys/module/lpm_levels/system/a53/cpu1/retention/idle_enabled 1 +write /sys/module/lpm_levels/system/a53/cpu2/retention/idle_enabled 1 +write /sys/module/lpm_levels/system/a53/cpu3/retention/idle_enabled 1 +write /sys/module/lpm_levels/system/a57/cpu4/retention/idle_enabled 1 +write /sys/module/lpm_levels/system/a57/cpu5/retention/idle_enabled 1 +write /sys/module/lpm_levels/system/a57/cpu6/retention/idle_enabled 1 +write /sys/module/lpm_levels/system/a57/cpu7/retention/idle_enabled 1 + +# Enable L2 retention +write /sys/module/lpm_levels/system/a53/a53-l2-retention/idle_enabled 1 +write /sys/module/lpm_levels/system/a57/a57-l2-retention/idle_enabled 1 + +# enable LPM +write /sys/module/lpm_levels/parameters/sleep_disabled 0 # configure governor settings for little cluster write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive @@ -50,96 +65,90 @@ write /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load 1 write /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif 1 write /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay 19000 write /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load 90 -write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate 10000 +write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate 20000 write /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq 960000 write /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy 1 -write /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads 85 -write /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time 20000 -write /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis 20000 +write /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads "65 460000:75 960000:80" +write /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time 40000 +write /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis 80000 write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 384000 -# online CPU4 -write /sys/devices/system/cpu/cpu4/online 1 - # configure governor settings for big cluster write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor interactive restorecon -R /sys/devices/system/cpu # must restore after interactive write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load 1 write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif 1 -write /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay "19000 1400000:39000 1700000:19000" +write /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay 19000 write /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load 90 -write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate 10000 +write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate 20000 write /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq 1248000 write /sys/devices/system/cpu/cpu4/cpufreq/interactive/io_is_busy 1 -write /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads "85 1500000:90 1800000:70" +write /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads "70 960000:80 1248000:85" write /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time 40000 -write /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis 20000 -write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_slack 10000 +write /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis 80000 write /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq 384000 -# Enable boost for cgroup's tasks -write /dev/cpuctl/cpu.sched_boost 1 - -# Disallow upmigrate for cgroup's tasks -write /dev/cpuctl/bg_non_interactive/cpu.upmigrate_discourage 1 - -# restore A57's max -copy /sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_max_freq /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq - # plugin remaining A57s write /sys/devices/system/cpu/cpu5/online 1 write /sys/devices/system/cpu/cpu6/online 1 write /sys/devices/system/cpu/cpu7/online 1 -# Restore CPU 4 max freq from msm_performance -write /sys/module/msm_performance/parameters/cpu_max_freq "4:4294967295 5:4294967295 6:4294967295 7:4294967295" - -# input boost configuration -write /sys/module/cpu_boost/parameters/input_boost_freq "0:1344000" -write /sys/module/cpu_boost/parameters/input_boost_ms 40 - # Configure core_ctl module parameters write /sys/devices/system/cpu/cpu4/core_ctl/max_cpus 4 -write /sys/devices/system/cpu/cpu4/core_ctl/min_cpus 1 +write /sys/devices/system/cpu/cpu4/core_ctl/min_cpus 0 write /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres 60 write /sys/devices/system/cpu/cpu4/core_ctl/busy_down_thres 30 -write /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms 100 -write /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster 1 +write /sys/devices/system/cpu/cpu4/core_ctl/offline_delay_ms 100 write /sys/devices/system/cpu/cpu4/core_ctl/task_thres 4 +write /sys/devices/system/cpu/cpu4/core_ctl/is_big_cluster 1 +write /sys/devices/system/cpu/cpu0/core_ctl/max_cpus 4 +write /sys/devices/system/cpu/cpu0/core_ctl/min_cpus 4 +write /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres 0 +write /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres 0 +write /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms 100 +write /sys/devices/system/cpu/cpu0/core_ctl/task_thres 4 +write /sys/devices/system/cpu/cpu0/core_ctl/not_preferred 1 +write /sys/devices/system/cpu/cpu0/core_ctl/is_big_cluster 0 +chown system:system /sys/devices/system/cpu/cpu4/core_ctl/min_cpus +chown system:system /sys/devices/system/cpu/cpu4/core_ctl/max_cpus # Setting B.L scheduler parameters write /proc/sys/kernel/sched_migration_fixup 1 -write /proc/sys/kernel/sched_small_task 60 -write /proc/sys/kernel/sched_upmigrate 99 -write /proc/sys/kernel/sched_downmigrate 90 -write /proc/sys/kernel/sched_init_task_load 30 +write /proc/sys/kernel/sched_small_task 30 +write /proc/sys/kernel/sched_upmigrate 95 +write /proc/sys/kernel/sched_downmigrate 85 +write /proc/sys/kernel/sched_window_stats_policy 2 +write /proc/sys/kernel/sched_ravg_hist_size 5 +get-set-forall /sys/devices/system/cpu/*/sched_mostly_idle_load 20 +get-set-forall /sys/devices/system/cpu/*/sched_mostly_idle_nr_run 3 write /proc/sys/kernel/sched_freq_inc_notify 400000 write /proc/sys/kernel/sched_freq_dec_notify 400000 -get-set-forall /sys/devices/system/cpu/cpu\[0-3\]/sched_mostly_idle_nr_run 5 -get-set-forall /sys/devices/system/cpu/cpu\[0-3\]/sched_mostly_idle_load 60 -get-set-forall /sys/devices/system/cpu/cpu\[0-3\]/sched_mostly_idle_freq 960000 -get-set-forall /sys/devices/system/cpu/cpu\[0-3\]/sched_prefer_idle 0 -get-set-forall /sys/devices/system/cpu/cpu\[4-7\]/sched_mostly_idle_nr_run 3 -get-set-forall /sys/devices/system/cpu/cpu\[4-7\]/sched_mostly_idle_load 20 -get-set-forall /sys/devices/system/cpu/cpu\[4-7\]/sched_mostly_idle_freq 0 -get-set-forall /sys/devices/system/cpu/cpu\[4-7\]/sched_prefer_idle 0 - -# android background processes are set to nice 10. Never schedule these on the a57s. -write /proc/sys/kernel/sched_upmigrate_min_nice 9 +# Enable rps static configuration +write /sys/class/net/rmnet_ipa0/queues/rx-0/rps_cpus 8 -get-set-forall /sys/class/devfreq/qcom,cpubw*/governor bw_hwmon -get-set-forall /sys/class/devfreq/qcom,mincpubw*/governor cpufreq +# Devfreq +get-set-forall /sys/class/devfreq/qcom,cpubw*/governor bw_hwmon +get-set-forall /sys/class/devfreq/qcom,cpubw*/bw_hwmon/io_percent 20 +get-set-forall /sys/class/devfreq/qcom,cpubw*/bw_hwmon/guard_band_mbps 30 +restorecon -R /sys/class/devfreq/qcom,cpubw* +get-set-forall /sys/class/devfreq/qcom,mincpubw.*/governor cpufreq # Disable sched_boost write /proc/sys/kernel/sched_boost 0 +# change GPU initial power level from 305MHz(level 4) to 180MHz(level 5) for power savings +write /sys/class/kgsl/kgsl-3d0/default_pwrlevel 5 + +# set GPU default governor to msm-adreno-tz +write /sys/class/devfreq/fdb00000.qcom,kgsl-3d0/governor msm-adreno-tz + # re-enable thermal and BCL hotplug write /sys/module/msm_thermal/core_control/enabled 1 -get-set-forall /sys/devices/soc.0/qcom,bcl.*/mode disable +get-set-forall /sys/devices/soc.0/qcom,bcl.*/low_threshold_ua 50000 +get-set-forall /sys/devices/soc.0/qcom,bcl.*/high_threshold_ua 4200000 +get-set-forall /sys/devices/soc.0/qcom,bcl.*/vph_low_thresh_uv 3300000 +get-set-forall /sys/devices/soc.0/qcom,bcl.*/vph_high_thresh_uv 4300000 get-set-forall /sys/devices/soc.0/qcom,bcl.*/hotplug_mask $bcl_hotplug_mask get-set-forall /sys/devices/soc.0/qcom,bcl.*/hotplug_soc_mask $bcl_hotplug_soc_mask get-set-forall /sys/devices/soc.0/qcom,bcl.*/mode enable - -# change GPU initial power level from 305MHz(level 4) to 180MHz(level 5) for power savings -write /sys/class/kgsl/kgsl-3d0/default_pwrlevel 5