#!/bin/sh
#
# Script to install/revert custom cpufreq voltages
# using Linux-PHC patch sysfs interface
# https://www.dedigentoo.org/trac/linux-phc/wiki
#
set -e
TABLE=/sys/devices/system/cpu/cpu0/cpufreq/op_points_table
# default voltages
# this should be changed to the line obtained by
# cat /sys/devices/system/cpu/cpu0/cpufreq/op_points_table
# before changing any of the freq/voltage pairs
DEF="600000:988,800000:1068,1000000:1132,1200000:1212,1400000:1276,1600000:1340"
# custom voltages
MOD="600000:700,800000:732,1000000:796,1200000:876,1400000:956,1600000:1052"
if [ -f $TABLE ]; then
case "$1" in
start)
echo Setting custom cpufreq voltage pairs
echo $MOD > $TABLE
cat $TABLE
;;
stop)
echo Restoring default cpufreq voltage pairs
echo $DEF > $TABLE
cat $TABLE
;;
*)
echo "Usage: $0 {start|stop}"
exit 2
;;
esac
exit 0
else
echo "Linux-PHC sysfs cpufreq voltage table interface does not exist"
exit 1
fi