diff --git a/src/scripts/encore-normal b/src/scripts/encore-normal index 7e94656..69575ac 100644 --- a/src/scripts/encore-normal +++ b/src/scripts/encore-normal @@ -18,11 +18,19 @@ apply() { fi } +change_permission() { + if [ -f $2 ]; then + chmod $1 $2 + fi +} + # Disable battery saver module -if grep -qo '[0-9]\+' /sys/module/battery_saver/parameters/enabled; then - apply 0 /sys/module/battery_saver/parameters/enabled -else - apply N /sys/module/battery_saver/parameters/enabled +if [ -f /sys/module/battery_saver/parameters/enabled ]; then + if grep -qo '[0-9]\+' /sys/module/battery_saver/parameters/enabled; then + apply 0 /sys/module/battery_saver/parameters/enabled + else + apply N /sys/module/battery_saver/parameters/enabled + fi fi if [ -f "/sys/kernel/debug/sched_features" ]; then @@ -69,7 +77,7 @@ done & for path in /sys/devices/system/cpu/cpufreq/policy*; do apply "$default_cpu_gov" "$path/scaling_governor" done & -chmod 644 /sys/devices/virtual/thermal/thermal_message/cpu_limits +change_permission 644 /sys/devices/virtual/thermal/thermal_message/cpu_limits apply 1 /sys/devices/system/cpu/cpu1/online # I/O Tweaks @@ -264,4 +272,5 @@ case "$soc" in 5) tensor_tweak ;; esac +wait exit 0 diff --git a/src/scripts/encore-performance b/src/scripts/encore-performance index 2456b91..4b8b9eb 100644 --- a/src/scripts/encore-performance +++ b/src/scripts/encore-performance @@ -13,11 +13,19 @@ apply() { fi } +change_permission() { + if [ -f $2 ]; then + chmod $1 $2 + fi +} + # Disable battery saver module -if grep -qo '[0-9]\+' /sys/module/battery_saver/parameters/enabled; then - apply 0 /sys/module/battery_saver/parameters/enabled -else - apply N /sys/module/battery_saver/parameters/enabled +if [ -f /sys/module/battery_saver/parameters/enabled ]; then + if grep -qo '[0-9]\+' /sys/module/battery_saver/parameters/enabled; then + apply 0 /sys/module/battery_saver/parameters/enabled + else + apply N /sys/module/battery_saver/parameters/enabled + fi fi if [ -f "/sys/kernel/debug/sched_features" ]; then @@ -67,6 +75,7 @@ for path in /sys/devices/system/cpu/cpufreq/policy*; do apply "cpu$(awk '{print $1}' $path/affected_cpus) $cpu_maxfreq" /sys/devices/virtual/thermal/thermal_message/cpu_limits apply "$cpu_maxfreq" $path/scaling_max_freq done & +change_permission 000 /sys/devices/virtual/thermal/thermal_message/cpu_limits apply 1 /sys/devices/system/cpu/cpu1/online # I/O Tweaks @@ -251,4 +260,5 @@ case "$soc" in 5) tensor_tweak ;; esac +wait exit 0 diff --git a/src/scripts/encore-powersave b/src/scripts/encore-powersave index d45d585..9a2fb9b 100644 --- a/src/scripts/encore-powersave +++ b/src/scripts/encore-powersave @@ -14,10 +14,12 @@ apply() { } # Enable battery saver module -if grep -qo '[0-9]\+' /sys/module/battery_saver/parameters/enabled; then - apply 1 /sys/module/battery_saver/parameters/enabled -else - apply Y /sys/module/battery_saver/parameters/enabled +if [ -f /sys/module/battery_saver/parameters/enabled ]; then + if grep -qo '[0-9]\+' /sys/module/battery_saver/parameters/enabled; then + apply 1 /sys/module/battery_saver/parameters/enabled + else + apply Y /sys/module/battery_saver/parameters/enabled + fi fi # Disable cpu1 to save some power @@ -45,8 +47,12 @@ mediatek_tweak() { fi # DRAM frequency - apply "$(cat /sys/devices/platform/10012000.dvfsrc/helio-dvfsrc/dvfsrc_opp_table | grep -o '\[[^]]*\]' | grep -oE '[+-]?[0-9]+' | sort -nr | head -n 1)" /sys/devices/platform/10012000.dvfsrc/helio-dvfsrc/dvfsrc_req_ddr_opp - apply "$(cat /sys/kernel/helio-dvfsrc/dvfsrc_opp_table | grep -o '\[[^]]*\]' | grep -oE '[+-]?[0-9]+' | sort -nr | head -n 1)" /sys/kernel/helio-dvfsrc/dvfsrc_force_vcore_dvfs_opp + if [ -f /sys/devices/platform/10012000.dvfsrc/helio-dvfsrc/dvfsrc_opp_table ]; then + apply "$(cat /sys/devices/platform/10012000.dvfsrc/helio-dvfsrc/dvfsrc_opp_table | grep -o '\[[^]]*\]' | grep -oE '[+-]?[0-9]+' | sort -nr | head -n 1)" /sys/devices/platform/10012000.dvfsrc/helio-dvfsrc/dvfsrc_req_ddr_opp + elif [ -f /sys/kernel/helio-dvfsrc/dvfsrc_opp_table ]; then + apply "$(cat /sys/kernel/helio-dvfsrc/dvfsrc_opp_table | grep -o '\[[^]]*\]' | grep -oE '[+-]?[0-9]+' | sort -nr | head -n 1)" /sys/kernel/helio-dvfsrc/dvfsrc_force_vcore_dvfs_opp + fi + apply "powersave" /sys/class/devfreq/mtk-dvfsrc-devfreq/governor apply "powersave" /sys/devices/platform/soc/1c00f000.dvfsrc/mtk-dvfsrc-devfreq/devfreq/mtk-dvfsrc-devfreq/governor } @@ -168,4 +174,5 @@ case "$soc" in 5) tensor_tweak ;; esac +wait exit 0