# kernel configuration script for power user kernel
# (c) Copyright 2010 by Thomas Tanner <maemo@tannerlab.com>
# licensed under GPLv3
-# version 0.2 (7. May 2010)
+# version 0.3 (16. May 2010)
if test $# -eq 0; then
echo "$0 command [options]"
cfr=/sys/devices/system/cpu/cpu0/cpufreq
cfd=$cfr/ondemand
+cfc=$cfr/conservative
pwr=/sys/power
-echo ondemand > $cfr/scaling_governor
-if test -f $cfd/avoid_frequencies -a -f $pwr/vdd1_opps_vsel -a -f $pwr/dsp_opps_rate; then :
+if test -f $pwr/vdd1_opps_vsel -a -f $pwr/dsp_opps_rate; then :
else
echo This kernel version `uname -r` is not supported
echo Please make sure that kernel-power is installed and running.
minfreq=$((`cat $cfr/scaling_min_freq`/1000))
maxfreq=$((`cat $cfr/scaling_max_freq`/1000))
test $maxfreq = 599 && maxfreq=600
- avoid=`cat $cfd/avoid_frequencies`
+ gov=`cat $cfr/scaling_governor`
+ avoid=
+ test $gov = ondemand && avoid=`cat $cfd/avoid_frequencies`
freqs=
- for f in 0 $allfreq; do
+ for f in $allfreq; do
popvsel $vsel
poprate $rate
case " $avoid " in *" $f "*) ;;
echo
echo "active frequencies: $freqs"
echo "SmartReflex" "VDD1=`cat $pwr/sr_vdd1_autocomp`, VDD2=`cat $pwr/sr_vdd2_autocomp`"
- echo -n "ondemand: ignore nice load=" `cat $cfd/ignore_nice_load`
- echo -n ", up threshold=" `cat $cfd/up_threshold`
- echo ", sampling rate=" `cat $cfd/sampling_rate`
+ echo -n "governor $gov:"
+ if test $gov = ondemand; then
+ echo -n " ignore nice load=" `cat $cfd/ignore_nice_load`
+ echo -n ", up threshold=" `cat $cfd/up_threshold`
+ echo -n ", sampling rate=" `cat $cfd/sampling_rate`
+ echo ", powersave bias=" `cat $cfd/powersave_bias`
+ else
+ echo
+ fi
else
test $cmd = save && arg=$1
if test -z "$arg"; then
echo "FREQS=\"$freqs\"" >> $arg
echo "SMARTREFLEX_VDD1=`cat $pwr/sr_vdd1_autocomp`" >> $arg
echo "SMARTREFLEX_VDD2=`cat $pwr/sr_vdd2_autocomp`" >> $arg
- echo "IGNORE_NICE_LOAD=`cat $cfd/ignore_nice_load`" >> $arg
- echo "UP_THRESHOLD=`cat $cfd/up_threshold`" >> $arg
- echo "SAMPLING_RATE=`cat $cfd/sampling_rate`" >> $arg
+ echo "GOVERNOR=$gov" >> $arg
+ if test $gov = ondemand; then
+ echo "IGNORE_NICE_LOAD=`cat $cfd/ignore_nice_load`" >> $arg
+ echo "UP_THRESHOLD=`cat $cfd/up_threshold`" >> $arg
+ echo "SAMPLING_RATE=`cat $cfd/sampling_rate`" >> $arg
+ echo "POWERSAVE_BIAS=`cat $cfd/powersave_bias`" >> $arg
+ fi
fi
;;
load|loaddef)
test -z "$minfreq" -o "$freq" -lt "$minfreq" && minfreq=$freq
test -z "$maxfreq" -o "$freq" -gt "$maxfreq" && maxfreq=$freq
freq=$((freq*1000))
+ if test "$freq" = "750000"; then
+ echo warning: $freq was changed to 720000;
+ freq=720000
+ fi
case " $allfreq " in *" $freq "*) ;;
*) echo warning: $freq not supported; continue ;;
esac
test -z "$volt" && test -z "$dsp" && continue
tvsel=
trate=
- for fr in 0 $allfreq; do
+ for fr in $allfreq; do
if test $fr = $freq; then
popvsel $vsel
poprate $rate
vsel=$tvsel
rate=$trate
done
+ test -z "$GOVERNOR" && GOVERNOR=ondemand
test -n "$MINFREQ" && minfreq=$MINFREQ
test -n "$MAXFREQ" && maxfreq=$MAXFREQ
test "$minfreq" -gt 100000 && minfreq=$((minfreq/1000))
*) avoid="$avoid $f" ;;
esac
done
- echo $avoid > $cfd/avoid_frequencies
+ echo $GOVERNOR > $cfr/scaling_governor
+ if test $GOVERNOR = ondemand; then
+ echo $avoid > $cfd/avoid_frequencies
+ test -n "$IGNORE_NICE_LOAD" && echo $IGNORE_NICE_LOAD > $cfd/ignore_nice_load
+ test -n "$UP_THRESHOLD" && echo $UP_THRESHOLD > $cfd/up_threshold
+ test -n "$SAMPLING_RATE" && echo $SAMPLING_RATE > $cfd/sampling_rate
+ test -n "$POWERSAVE_BIAS" && echo $POWERSAVE_BIAS > $cfd/powersave_bias
+ fi
echo $vsel > $pwr/vdd1_opps_vsel
echo $rate > $pwr/dsp_opps_rate
test $maxfreq = 600 && maxfreq=599
echo $((maxfreq*1000)) > $cfr/scaling_max_freq
test -n "$SMARTREFLEX_VDD1" && echo $SMARTREFLEX_VDD1 > $pwr/sr_vdd1_autocomp
test -n "$SMARTREFLEX_VDD2" && echo $SMARTREFLEX_VDD2 > $pwr/sr_vdd2_autocomp
- test -n "$IGNORE_NICE_LOAD" && echo $IGNORE_NICE_LOAD > $cfd/ignore_nice_load
- test -n "$UP_THRESHOLD" && echo $UP_THRESHOLD > $cfd/up_threshold
- test -n "$SAMPLING_RATE" && echo $SAMPLING_RATE > $cfd/sampling_rate
echo "successfully loaded."
;;
default)