X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=kernel-power-settings%2Fkernel-config;h=555ff718fc0854e5eb6bc5bf8c21ba27fe80b918;hb=468400592961a09c21297c096b098d7f46a38e30;hp=4dad46cc02fb60e336d9c941b9210b6d2176df53;hpb=bba1c3e050d1c20c77d7b1fd0be139164da27a87;p=kernel-power diff --git a/kernel-power-settings/kernel-config b/kernel-power-settings/kernel-config index 4dad46c..555ff71 100755 --- a/kernel-power-settings/kernel-config +++ b/kernel-power-settings/kernel-config @@ -2,7 +2,7 @@ # kernel configuration script for power user kernel # (c) Copyright 2010 by Thomas Tanner # licensed under GPLv3 -# version 0.2 (7. May 2010) +# version 0.3 (16. May 2010) if test $# -eq 0; then echo "$0 command [options]" @@ -25,10 +25,10 @@ fi cfr=/sys/devices/system/cpu/cpu0/cpufreq cfd=$cfr/ondemand -pwr=/sys/power/ +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. @@ -71,9 +71,11 @@ show|save|savedef) 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 "*) ;; @@ -93,9 +95,15 @@ show|save|savedef) 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 @@ -120,9 +128,13 @@ show|save|savedef) 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) @@ -144,35 +156,37 @@ load|loaddef) source $arg if test -n "$VDD1_OPPS_VSEL" -o -n "$DSP_OPPS_RATE"; then echo "warning: old configuration format detected. please save in the new format." - test -n "$MIN_FREQ" && echo $MIN_FREQ > $cfr/scaling_min_freq - test -n "$MAX_FREQ" && echo $MAX_FREQ > $cfr/scaling_max_freq - test -n "$VDD1_OPPS_VSEL" && echo $VDD1_OPPS_VSEL > $pwr/vdd1_opps_vsel - test -n "$DSP_OPPS_RATE" && echo $DSP_OPPS_RATE > $pwr/dsp_opps_rate + if test -n "$MAX_FREQ"; then + test $MAX_FREQ = 600000 && MAX_FREQ=599000 + echo $MAX_FREQ > $cfr/scaling_max_freq + fi + test -n "$MIN_FREQ" && echo $MIN_FREQ > $cfr/scaling_min_freq + test -n "$MAX_FREQ" && echo $MAX_FREQ > $cfr/scaling_max_freq + test -n "$VDD1_OPPS_VSEL" && echo $VDD1_OPPS_VSEL > $pwr/vdd1_opps_vsel + test -n "$DSP_OPPS_RATE" && echo $DSP_OPPS_RATE > $pwr/dsp_opps_rate test -n "$SMARTREFLEX_VDD1" && echo $SMARTREFLEX_VDD1 > $pwr/sr_vdd1_autocomp - test -n "$SMARTREFLEX_VDD2" && echo $SMARTREFLEX_VDD2 > $pwr/sr_vdd2_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 "$UP_THRESHOLD" && echo $UP_THRESHOLD > $cfd/up_threshold test -n "$SAMPLING_RATE" && echo $SAMPLING_RATE > $cfd/sampling_rate exit 1 fi - #echo $allfreq - #echo $vsel - #echo $rate active= minfreq= maxfreq= - #echo $FREQS for f in $FREQS; do - #echo processing $f freq=`echo $f | cut -d: -f1` f=`echo $f | cut -d: -f2` volt=`echo $f | cut -d, -f1` dsp=`echo $f | cut -d, -f2` - #echo freq $freq volt $volt dsp $dsp if test ! $freq = 0; then 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 @@ -181,7 +195,7 @@ load|loaddef) 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 @@ -198,15 +212,12 @@ load|loaddef) done vsel=$tvsel rate=$trate - #echo $vsel done - #echo vsel $vsel - #echo rate $rate + test -z "$GOVERNOR" && GOVERNOR=ondemand test -n "$MINFREQ" && minfreq=$MINFREQ test -n "$MAXFREQ" && maxfreq=$MAXFREQ test "$minfreq" -gt 100000 && minfreq=$((minfreq/1000)) test "$maxfreq" -gt 100000 && maxfreq=$((maxfreq/1000)) - #echo $minfreq $maxfreq avoid= for f in $allfreq; do if test "$f" -lt $((minfreq*1000)); then @@ -217,18 +228,22 @@ load|loaddef) *) avoid="$avoid $f" ;; esac done - #echo $avoid - 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 echo $((minfreq*1000)) > $cfr/scaling_min_freq 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) @@ -272,6 +287,8 @@ limits) echo "minimum must not be greater than maximum: $limits" exit 1 fi + test $maxfreq = 600000 && maxfreq=599000 + echo $maxfreq > $cfr/scaling_max_freq echo $minfreq > $cfr/scaling_min_freq echo $maxfreq > $cfr/scaling_max_freq echo "the limits were set to [$limits]" @@ -288,19 +305,20 @@ lock) dsp= freq=$((arg*1000)) ifreq= - i=0 - for f in 0 $allfreq; do + i=1 + avoid= + for f in $allfreq; do i=$((i+1)) - test $f = $freq || continue - ifreq=$i - break + if test $f = $freq; then + ifreq=$i + break + fi + avoid="$avoid $f" done if test -z "ifreq"; then echo invalid frequency $freq exit 1 fi - echo $ifreq $altfreq - test -f $cfd/avoid_frequencies && echo > $cfd/avoid_frequencies # enable all freqs echo userspace > $cfr/scaling_governor echo $altfreq > $cfr/scaling_setspeed # temporarily set alternative frequencies volt=$2 @@ -312,7 +330,6 @@ lock) test $i = $ifreq && v=$volt vsel="$vsel $v" done - echo $vsel echo $vsel > $pwr/vdd1_opps_vsel fi dsp=$3 @@ -324,11 +341,17 @@ lock) test $i = $ifreq && r=$dsp dsp="$dsp $r" done - echo $dsp echo $dsp > $pwr/dsp_opps_rate fi echo locking frequency $freq - echo $freq > $cfr/scaling_setspeed + echo ondemand > $cfr/scaling_governor + echo $avoid > $cfd/avoid_frequencies # avoid all other freqs + maxfreq=$freq + test $maxfreq = 600000 && maxfreq=599000 + # min after max? kernel docs are wrong? + echo $maxfreq > $cfr/scaling_max_freq + echo $freq > $cfr/scaling_min_freq + echo $maxfreq > $cfr/scaling_max_freq ;; esac exit 0