upgrade :^)

master
Alessandro Mauri 1 year ago
parent 327302a60f
commit 54b0f16f20
  1. 2
      Makefile
  2. 48
      powersave.sh
  3. 7
      undervolt.sh

@ -2,6 +2,8 @@ VERSION = 0.0.1
PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man MANPREFIX = ${PREFIX}/share/man
all: undervolt powersave
undervolt: undervolt.sh undervolt: undervolt.sh
powersave: powersave.sh powersave: powersave.sh

@ -1,8 +1,46 @@
#!/bin/sh #!/bin/sh
GOVERNOR='powersave' GOVERNOR="powersave"
if [ "$1" ]; then apply_lm=true
GOVERNOR="$1"
fi while getopts 'hopPg:' opt; do
case opt in
'h')
echo "Usage: powersave [-hopP] [-g governor]"
echo " -h this message"
echo " -o set governor to ondemand and activate laptop mode"
echo " -p set governor to powersave and activate laptop mode (default)"
echo " -P set governor to performance"
echo " -g governor set governor to the specified value"
exit 0
;;
'o')
GOVERNOR=ondemand
apply_lm=true
;;
'p')
GOVERNOR=powersave
apply_lm=true
;;
'P')
GOVERNOR=performance
apply_lm=false
;;
'g')
GOVERNOR=$OPTARG
apply_lm=false
;;
esac
''
done
shift $((OPTIND-1))
echo "$GOVERNOR" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor echo "$GOVERNOR" > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
if $apply_lm; then
# "5 is a sensible time" https://www.kernel.org/doc/Documentation/laptops/laptop-mode.txt
sysctl 'vm.laptop_mode=5'
else
# disable laptop_mode
sysctl 'vm.laptop_mode=0'
fi

@ -4,7 +4,6 @@
# TODO: check if all the required tools are available # TODO: check if all the required tools are available
CPUS="$(nproc)" CPUS="$(nproc)"
GOVERNOR='ondemand'
# Out your wanted values here # Out your wanted values here
CORE_SPEED_HZ_P0=2300000 # 2.30GHz slightly over the base (2.10GHz) CORE_SPEED_HZ_P0=2300000 # 2.30GHz slightly over the base (2.10GHz)
CORE_SPEED_HZ_P1=1450000 # 1.45GHz CORE_SPEED_HZ_P1=1450000 # 1.45GHz
@ -26,12 +25,6 @@ MAX_TEMP_C=85
# enable cpu frequency boost if available # enable cpu frequency boost if available
echo 1 > /sys/devices/system/cpu/cpufreq/boost echo 1 > /sys/devices/system/cpu/cpufreq/boost
# set governor
for c in $(seq 0 $((CPUS-1)))
do
echo $GOVERNOR > /sys/devices/system/cpu/"cpu$c"/cpufreq/scaling_governor
done
# #
# set voltage # set voltage
# =========== # ===========

Loading…
Cancel
Save