Overclocking

(Jakiman's Guide to Overclocking for Newcomers)
(wikify)
Line 1: Line 1:
-
=Overclocking=
+
==Overclocking==
-
This page is about overclocking the N900.
+
This page is about overclocking the [[Nokia N900|N900]]. For the N8x0 see [http://talk.maemo.org/showthread.php?t=12464 this thread on talk.maemo.org]
-
For the N8x0 see [http://talk.maemo.org/showthread.php?t=12464 this]
+
<nowiki>#</nowiki> ''WORK IN PROGRESS, HELP IF YOU WANT''
<nowiki>#</nowiki> ''WORK IN PROGRESS, HELP IF YOU WANT''
Line 10: Line 9:
If you're more interested in power saving read [http://talk.maemo.org/showthread.php?t=49654 this].
If you're more interested in power saving read [http://talk.maemo.org/showthread.php?t=49654 this].
-
=Warnings=
+
==Warnings==
-
- Overclocking WILL VOID YOUR WARRANTY. Your warranty does not cover running the device beyond the specifications.<br>
+
* Overclocking WILL VOID YOUR WARRANTY. Your warranty does not cover running the device beyond the specifications.
-
- The lifetime of your device may get reduced (see below)<br>
+
* The lifetime of your device may get reduced (see below)
-
- Your data might get corrupted (for example, file system corruption)<br>
+
* Your data might get corrupted (for example, file system corruption)
-
- Every device is an individual, what is stable for others might not be for you<br>
+
* Every device is an individual, what is stable for others might not be for you
-
- If you encounter ANY unusual problems, lower your clock frequency<br>
+
* If you encounter ANY unusual problems, lower your clock frequency
-
- You do it at your own responsibility. No whining afterwards. If you're unsure, don't do it.<br>
+
* You do it at your own responsibility. No whining afterwards. If you're unsure, don't do it.
-
- [http://depot.javispedro.com/nit/thewarningtm.jpeg Nokia's overclocking warning]: 500MHz is the normal frequency. Everything above is not good for your device, even with the stock kernel.<br>
+
* [http://depot.javispedro.com/nit/thewarningtm.jpeg Nokia's overclocking warning]: 500MHz is the normal frequency. Everything above is not good for your device, even with the stock kernel.
-
- Igor Stoppa's [http://talk.maemo.org/showpost.php?p=596149&postcount=904 warning] and [http://talk.maemo.org/showpost.php?p=603833&postcount=66 comment]
+
* Igor Stoppa's [http://talk.maemo.org/showpost.php?p=596149&postcount=904 warning] and [http://talk.maemo.org/showpost.php?p=603833&postcount=66 comment]
-
- [http://talk.maemo.org/showpost.php?p=596274&postcount=937 chip vendors specs]
+
* [http://talk.maemo.org/showpost.php?p=596274&postcount=937 chip vendors specs]
-
=Lifetime, warranty and damage=
+
==Lifetime, warranty and damage==
-
- The expected lifetime '''all''' devices is limited due to wear.<br>
+
-
- It is usually much longer (several years) then the warranty period, so that even with heavy use within the specifications it would not fail before warranty ends.<br>
+
-
- With overclocking users may see considerable speed improvements and lower latency in user experience which could extend the actual lifetime (of being used) as the device could keep up with the newer models.<br>
+
-
- Naive overclocking with stock voltages is definitely bad for most components in your device, especially if the device is continuously locked at high frequencies with high load (see TI specs).<br>
+
-
- Specifications give guarantees for the worst-case scenarios that are covered by the warranty. The best-case scenario may be different for every device but is not covered by warranty.<br>
+
-
- However, there is an open debate whether '''mild''' (<40%) overclocking with lower voltages (undervolting) does actually harm or is even less harmful than the stock settings.<br>
+
-
- Evidence for or against damages (esp. with undervolting) in the N900 is currently absent and will probably only be available when the device is no longer on the market.<br>
+
-
- Therefore, if you are unsure and you want to avoid potential damages, do not overclock!<br>
+
-
=Available kernels=
+
* The expected lifetime '''all''' devices is limited due to wear.
 +
* It is usually much longer (several years) then the warranty period, so that even with heavy use within the specifications it would not fail before warranty ends.
 +
* With overclocking users may see considerable speed improvements and lower latency in user experience which could extend the actual lifetime (of being used) as the device could keep up with the newer models.
 +
* Naive overclocking with stock voltages is definitely bad for most components in your device, especially if the device is continuously locked at high frequencies with high load (see TI specs).
 +
* Specifications give guarantees for the worst-case scenarios that are covered by the warranty. The best-case scenario may be different for every device but is not covered by warranty.
 +
* However, there is an open debate whether '''mild''' (<40%) overclocking with lower voltages (undervolting) does actually harm or is even less harmful than the stock settings.
 +
* Evidence for or against damages (esp. with undervolting) in the N900 is currently absent and will probably only be available when the device is no longer on the market.
 +
* Therefore, if you are unsure and you want to avoid potential damages, do not overclock!
-
Overclocking requires installation of a custom kernel.
+
==Available kernels==
-
There are two types of kernels:
+
 
 +
Overclocking requires installation of a custom kernel. There are two types of kernels:
# modified PR1.1 kernels by Lehto and others. The only difference from the stock Nokia kernel is the change of the available hardcoded frequencies.
# modified PR1.1 kernels by Lehto and others. The only difference from the stock Nokia kernel is the change of the available hardcoded frequencies.
-
# enhanced kernels by titan. They are compatible with PR1.2 (!), contain lots of additional features (IPv6, NAT etc) and bugfixes. In addition they include a large set of possible frequencies (125MHz-1.15GHz) which you manually set and try out without flashing a new kernel. The defaults are set to the standard 250-600MHz range. The kernel can be installed via HAM from the extras-devel catalog.
+
# enhanced kernels by titan. They are compatible with PR1.2 (!), contain lots of additional features (IPv6, NAT etc) and bugfixes. In addition they include a large set of possible frequencies (125MHz-1.15GHz) which you manually set and try out without flashing a new kernel. The defaults are set to the standard 250-600MHz range. The kernel can be installed via HAM from the [[extras-devel]] catalog.
-
== Jakiman's Guide to Overclocking for Newcomers ==
+
=== Jakiman's Guide to Overclocking for Newcomers ===
[http://talk.maemo.org/showpost.php?p=595582&postcount=774 Jakiman's Overclock Guide / Summary] (Updated @ May 10th 2010)
[http://talk.maemo.org/showpost.php?p=595582&postcount=774 Jakiman's Overclock Guide / Summary] (Updated @ May 10th 2010)
-
== Installation of Lehto's PR1.1 kernels ==
+
=== Installation of Lehto's PR1.1 kernels ===
[http://talk.maemo.org/showpost.php?p=594200&postcount=309 Lehto's Kernels]
[http://talk.maemo.org/showpost.php?p=594200&postcount=309 Lehto's Kernels]
-
== Installation of titan's enhanced kernels ==
+
=== Installation of titan's enhanced kernels ===
 +
 
This kernel makes it possible to dynamically change the maximum frequency up to 1.15GHz (supported frequencies are 125,250,500,550,600,700,750,805,850,900,950,1000,1100,1150MHz).
This kernel makes it possible to dynamically change the maximum frequency up to 1.15GHz (supported frequencies are 125,250,500,550,600,700,750,805,850,900,950,1000,1100,1150MHz).
Line 54: Line 54:
[http://talk.maemo.org/showthread.php?t=43420 talk.maemo.org: Discussion of the enhanced kernel]
[http://talk.maemo.org/showthread.php?t=43420 talk.maemo.org: Discussion of the enhanced kernel]
-
=Additional information and hints=
+
==Additional information and hints==
# the frequencies available in the Nokia kernel are: 250, 500, 550 and 600MHz.
# the frequencies available in the Nokia kernel are: 250, 500, 550 and 600MHz.
Line 64: Line 64:
# [http://talk.maemo.org/showpost.php?p=599870&postcount=170 improving responsiveness]
# [http://talk.maemo.org/showpost.php?p=599870&postcount=170 improving responsiveness]
# [http://talk.maemo.org/showpost.php?p=599618&postcount=168 safe pmconfig configuration]
# [http://talk.maemo.org/showpost.php?p=599618&postcount=168 safe pmconfig configuration]
-
# the warning "WARNING: at arch/arm/mach-omap2/clock34xx.c:443 omap3_noncore_dpll_set_rate+0x28c/0x2dc()" in the kernel logs (dmesg) only happens if the invalid 800MHz frequency was selected. ignore it.
+
# the warning <pre>WARNING: at arch/arm/mach-omap2/clock34xx.c:443 omap3_noncore_dpll_set_rate+0x28c/0x2dc()</pre> in the kernel logs (dmesg) only happens if the invalid 800MHz frequency was selected. ignore it.
# [http://talk.maemo.org/showpost.php?p=603585&postcount=189 saving more battery power when idle]
# [http://talk.maemo.org/showpost.php?p=603585&postcount=189 saving more battery power when idle]
# EvilJazz had photoshopped a [http://talk.maemo.org/showpost.php?p=605523&postcount=90 picture of a device being overclocked 1.7GHz]. It's a '''prank'''!
# EvilJazz had photoshopped a [http://talk.maemo.org/showpost.php?p=605523&postcount=90 picture of a device being overclocked 1.7GHz]. It's a '''prank'''!
# reading one of the temperature sensors "cat /sys/devices/platform/omap34xx_temp/temp1_input"
# reading one of the temperature sensors "cat /sys/devices/platform/omap34xx_temp/temp1_input"
-
=Useful stuff=
+
==Useful stuff==
-
==Show current CPU frequency==
+
===Show current CPU frequency===
  awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
  awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
-
==Set maximum CPU frequency==
+
===Set maximum CPU frequency===
From root terminal:
From root terminal:
Line 86: Line 86:
  awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
  awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
-
==Script for analyzing time_in_state (by rooted) - rev6==
+
===Script for analyzing time_in_state (by rooted) - rev6===
This script prints percentage of frequencies (states) used and some additional info useful for posting on the forum (debugging). It displays all frequencies, works with all kernels and it is not affected by the bug which resets minimum frequency after phone call.
This script prints percentage of frequencies (states) used and some additional info useful for posting on the forum (debugging). It displays all frequencies, works with all kernels and it is not affected by the bug which resets minimum frequency after phone call.
Line 94: Line 94:
Temperature may not be listed if you don't have module bq27x00_battery installed or enabled. Also kernel-maemo version is not listed if you don't use titan's kernel.
Temperature may not be listed if you don't have module bq27x00_battery installed or enabled. Also kernel-maemo version is not listed if you don't use titan's kernel.
 +
<source lang="bash">
 +
#!/bin/sh
-
#!/bin/sh
+
currfreq=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq`
-
+
idlefreq=`awk '{if ($2 > 0) print $1}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | tail -n 1`
-
currfreq=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq`
+
tis1=`awk '{sum += $2} END {print sum}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
-
idlefreq=`awk '{if ($2 > 0) print $1}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | tail -n 1`
+
tis2=`awk '$1 == "'"$idlefreq"'" {idle = $2} {sum += $2} END {print sum-idle}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
-
tis1=`awk '{sum += $2} END {print sum}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
+
-
tis2=`awk '$1 == "'"$idlefreq"'" {idle = $2} {sum += $2} END {print sum-idle}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
+
-
+
-
echo -e "
+
-
SCRIPT FOR ANALYZING TIME_IN_STATE
+
-
By rooted (maemo.org)
+
-
Revision 6
+
-
+
-
The script is in active development.
+
-
Update your script to current revision from:
+
-
wiki.maemo.org/Overclocking
+
-
+
-
+
-
FREQUENCY\tUSED\t\tWHEN BUSY\n"
+
-
awk '
+
-
{if ($1 >= 1000000)                printf ("%.0f MHz\t",$1/1000); else printf ("%.0f MHz\t\t",$1/1000)}
+
-
{if ($2 == 0)                      printf "unused";              else printf ("%.1f %\t\t",($2*100)/"'"$tis1"'")}
+
-
{if ($2 == 0 || $2/"'"$tis2"'" > 1) printf "\n";                  else printf ("%.1f %\n",($2*100)/"'"$tis2"'")}
+
-
' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
+
-
+
-
echo -e "
+
-
Current frequency:  $(($currfreq/1000)) MHz
+
-
Idle frequency:      $(($idlefreq/1000)) MHz
+
-
Kernel:              `uname -r`
+
-
kernel-maemo:        `dpkg -l kernel* | awk '/kernel-maemo/ {print $3}'`
+
-
Uptime:              `uptime | sed -e 's/.*p *//' -e 's/, l.*//' -e 's/  / /'`
+
-
Load:                `uptime | sed 's/.*e: //'`
+
-
Boot reason:        `cat /proc/bootreason`
+
-
Temperature:        `cat /sys/class/power_supply/bq27200-0/temp` °C\n"
+
 +
echo -e "
 +
SCRIPT FOR ANALYZING TIME_IN_STATE
 +
By rooted (maemo.org)
 +
Revision 6
-
Output example:
+
The script is in active development.
 +
Update your script to current revision from:
 +
http://wiki.maemo.org/Overclocking
-
SCRIPT FOR ANALYZING TIME_IN_STATE
 
-
By rooted (maemo.org)
 
-
Revision 6
 
-
 
-
The script is in active development.
 
-
Update your script to current revision from:
 
-
wiki.maemo.org/Overclocking
 
-
 
-
 
-
FREQUENCY      USED            WHEN BUSY
 
-
 
-
1200 MHz        unused
 
-
1100 MHz        unused
 
-
1000 MHz        unused
 
-
950 MHz        unused
 
-
900 MHz        unused
 
-
850 MHz        unused
 
-
810 MHz        1.6 %          56.7 %
 
-
750 MHz        0.0 %          0.8 %
 
-
700 MHz        0.1 %          1.9 %
 
-
600 MHz        0.0 %          1.5 %
 
-
550 MHz        0.0 %          1.2 %
 
-
500 MHz        1.0 %          37.8 %
 
-
250 MHz        97.3 %
 
-
125 MHz        unused
 
-
 
-
Current frequency:  250 MHz
 
-
Idle frequency:      250 MHz
 
-
Kernel:              2.6.28.10maemo-ulv-omap1
 
-
kernel-maemo:        2.6.28-maemo21
 
-
Uptime:              2 days, 2:27
 
-
Load:                0.11, 0.04, 0.01
 
-
Boot reason:        pwr_key
 
-
Temperature:        25 °C
 
-
==Analyzing time in state, including idle mode stats (by ArbitRabbit)==
+
FREQUENCY\tUSED\t\tWHEN BUSY\n"
-
The following script will show the current frequency and statistics for each state, including time spent in idle mode when the CPU is actually sleeping.  
+
awk '
-
This script works with the special frequency handling in Titan's kernel.
+
{if ($1 >= 1000000)                printf ("%.0f MHz\t",$1/1000); else printf ("%.0f MHz\t\t",$1/1000)}
 +
{if ($2 == 0)                      printf "unused";              else printf ("%.1f %\t\t",($2*100)/"'"$tis1"'")}
 +
{if ($2 == 0 || $2/"'"$tis2"'" > 1) printf "\n";                  else printf ("%.1f %\n",($2*100)/"'"$tis2"'")}
 +
' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
-
To run this script as user and be able to set the frequencies you will need to install "[[Root_access|rootsh]]" via apt-get.
+
echo -e "
 +
Current frequency:  $(($currfreq/1000)) MHz
 +
Idle frequency:      $(($idlefreq/1000)) MHz
 +
Kernel:              `uname -r`
 +
kernel-maemo:        `dpkg -l kernel* | awk '/kernel-maemo/ {print $3}'`
 +
Uptime:              `uptime | sed -e 's/.*p *//' -e 's/, l.*//' -e 's/  / /'`
 +
Load:                `uptime | sed 's/.*e: //'`
 +
Boot reason:        `cat /proc/bootreason`
 +
Temperature:        `cat /sys/class/power_supply/bq27200-0/temp` °C\n"
 +
</source>
-
'''scheduler_stats.sh'''
+
Output example:
-
#!/bin/sh
+
<pre>SCRIPT FOR ANALYZING TIME_IN_STATE
-
awk '{print "\nCurrent frequency: "$1/1000" MHz\n"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
+
By rooted (maemo.org)
-
awk '{print "Minimum frequency: "$1/1000" MHz\n"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+
Revision 6
-
awk '{print "Maximum frequency: "$1/1000" MHz\n"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+
-
+
-
tis1=`awk '{SUM += $2} END {printf("%.0f",SUM/1000)}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
+
-
+
-
idle0=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state0/time`
+
-
+
-
idle1=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state1/time`
+
-
+
-
idle2=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state2/time`
+
-
+
-
idle3=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state3/time`
+
-
+
-
totaltime=$(($idle0+$idle1+$idle2+$idle3+$tis1))
+
-
echo -e "FREQUENCY\tUSED"
+
-
SUM=0
+
-
awk '
+
-
        {
+
-
                printf (($1/1000)" MHz \t");
+
-
                if ($2 == 0)
+
-
                {
+
-
                        printf "0 %\n";
+
-
                }
+
-
                else {
+
-
                        SUM+=$2;
+
-
                        printf("%.3f %\n",($2/10)/"'"$totaltime"'");
+
-
                        }
+
-
        }
+
-
        END{
+
-
        printf ("Time spent in idle mode is %2.2f %\n",(1-((SUM/1000)/"'"$totaltime"'"))*100);
+
-
        }' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
+
-
echo ""
+
-
'''Sample Output'''
+
The script is in active development.
 +
Update your script to current revision from:
 +
http://wiki.maemo.org/Overclocking
-
Current frequency: 500 MHz
 
-
 
-
Minimum frequency: 500 MHz
 
-
 
-
Maximum frequency: 810 MHz
 
-
 
-
FREQUENCY      USED
 
-
1200 MHz        0 %
 
-
1100 MHz        0 %
 
-
1000 MHz        0 %
 
-
950 MHz        0 %
 
-
900 MHz        0 %
 
-
850 MHz        0 %
 
-
810 MHz        0.000 %
 
-
750 MHz        0.000 %
 
-
700 MHz        0.000 %
 
-
600 MHz        0.000 %
 
-
550 MHz        0.000 %
 
-
500 MHz        0.010 %
 
-
Time spent in idle mode is 99.99 %
 
-
Known Bugs: Requires the Phone to be booted for an hour or so before it results in decent stats.
+
FREQUENCY      USED            WHEN BUSY
-
==Combined helper script (by evilJazz)==
+
1200 MHz        unused
 +
1100 MHz        unused
 +
1000 MHz        unused
 +
950 MHz        unused
 +
900 MHz        unused
 +
850 MHz        unused
 +
810 MHz        1.6 %          56.7 %
 +
750 MHz        0.0 %          0.8 %
 +
700 MHz        0.1 %          1.9 %
 +
600 MHz        0.0 %          1.5 %
 +
550 MHz        0.0 %          1.2 %
 +
500 MHz        1.0 %          37.8 %
 +
250 MHz        97.3 %
 +
125 MHz        unused
-
The following script will show the current frequency and statistics. It also accepts two optional parameters that will set the max and/or min frequencies (in MHz unit). Calling the script without these parameters will not set the new clocking. Instead it will just show the current frequencies and statistics.
+
Current frequency:  250 MHz
 +
Idle frequency:      250 MHz
 +
Kernel:              2.6.28.10maemo-ulv-omap1
 +
kernel-maemo:        2.6.28-maemo21
 +
Uptime:              2 days, 2:27
 +
Load:                0.11, 0.04, 0.01
 +
Boot reason:        pwr_key
 +
Temperature:        25 °C</pre>
-
This script works with the special frequency handling in Titan's kernel.
+
===Analyzing time in state, including idle mode stats (by ArbitRabbit)===
 +
 
 +
The following script will show the current frequency and statistics for each state, including time spent in idle mode when the CPU is actually sleeping. This script works with the special frequency handling in Titan's kernel.
To run this script as user and be able to set the frequencies you will need to install "[[Root_access|rootsh]]" via apt-get.
To run this script as user and be able to set the frequencies you will need to install "[[Root_access|rootsh]]" via apt-get.
-
overclock.sh [max freq] [min freq]
+
'''scheduler_stats.sh'''
 +
<source lang="bash">
 +
#!/bin/sh
 +
awk '{print "\nCurrent frequency: "$1/1000" MHz\n"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
 +
awk '{print "Minimum frequency: "$1/1000" MHz\n"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
 +
awk '{print "Maximum frequency: "$1/1000" MHz\n"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
-
#!/bin/sh
+
tis1=`awk '{SUM += $2} END {printf("%.0f",SUM/1000)}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
-
max=${1}000
+
-
min=${2}000
+
-
+
-
# Handle and rewrite special cases in Titan's kernel...
+
-
[ "$max" == "600000" ] && max=599000
+
-
[ "$min" == "125000" ] && min=124999
+
-
+
-
if [ $(id -u) -ne 0 ]; then
+
-
  [ "$max" != "000" ] && echo "echo $max > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" | sudo gainroot
+
-
  [ "$min" != "000" ] && echo "echo $min > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq" | sudo gainroot
+
-
else
+
-
  [ "$max" != "000" ] && echo $max > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+
-
  [ "$min" != "000" ] && echo $min > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+
-
fi
+
-
+
-
awk '{printf("\nCurrent frequency: %7s MHz\n", $1/1000)}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
+
-
awk '{printf("Minimal frequency: %7s MHz\n", $1/1000)}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+
-
awk '{printf("Maximal frequency: %7s MHz\n\n", $1/1000)}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+
-
+
-
sum=$(awk '{SUM += $2} END {print SUM}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state)
+
-
awk '{printf("%7s MHz: %5.1f % (%8d)\n", ($1/1000), ($2 * 100)/"'"$sum"'", $2)}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
+
-
echo
+
-
Output example:
+
idle0=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state0/time`
-
~ $ ./overclock.sh 600 250
+
idle1=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state1/time`
-
Current frequency:    250 MHz
+
idle2=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state2/time`
-
Minimal frequency:    250 MHz
+
-
Maximal frequency:    599 MHz
+
-
+
-
    1200 MHz:  0.0 % (      0)
+
-
    1100 MHz:  0.0 % (      0)
+
-
    1000 MHz:  0.0 % (      0)
+
-
    950 MHz:  0.0 % (      0)
+
-
    900 MHz:  0.2 % (    271)
+
-
    850 MHz:  0.0 % (      0)
+
-
    810 MHz:  0.0 % (      0)
+
-
    750 MHz:  0.0 % (      0)
+
-
    700 MHz:  0.0 % (      0)
+
-
    600 MHz:  9.0 % (  13663)
+
-
    550 MHz:  0.5 % (    701)
+
-
    500 MHz:  15.4 % (  23379)
+
-
    250 MHz:  75.0 % (  114021)
+
-
124.999 MHz:  0.0 % (      0)
+
-
=Changing the Kernel=
+
idle3=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state3/time`
-
==Installing a modified Kernel==
+
totaltime=$(($idle0+$idle1+$idle2+$idle3+$tis1))
 +
echo -e "FREQUENCY\tUSED"
 +
SUM=0
 +
awk '
 +
      {
 +
              printf (($1/1000)" MHz \t");
 +
              if ($2 == 0)
 +
              {
 +
                      printf "0 %\n";
 +
              }
 +
              else {
 +
                      SUM+=$2;
 +
                      printf("%.3f %\n",($2/10)/"'"$totaltime"'");
 +
                      }
 +
      }
 +
      END{
 +
      printf ("Time spent in idle mode is %2.2f %\n",(1-((SUM/1000)/"'"$totaltime"'"))*100);
 +
      }' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
 +
echo ""
 +
</source>
-
===Flashing using PC===
+
'''Sample Output'''
-
1. Power off the N900 completely.
+
<pre>Current frequency: 500 MHz
-
2. Hold "u" on the N900's keyboard, while holding, connect it to the PC via USB cable.
+
Minimum frequency: 500 MHz
-
3. You will see usb icon on top right of white Nokia screen.
+
Maximum frequency: 810 MHz
-
4. Now you can let go of "u" on the keyboard.
+
FREQUENCY      USED
 +
1200 MHz        0 %
 +
1100 MHz        0 %
 +
1000 MHz        0 %
 +
950 MHz        0 %
 +
900 MHz        0 %
 +
850 MHz        0 %
 +
810 MHz        0.000 %
 +
750 MHz        0.000 %
 +
700 MHz        0.000 %
 +
600 MHz        0.000 %
 +
550 MHz        0.000 %
 +
500 MHz        0.010 %
 +
Time spent in idle mode is 99.99 %</pre>
-
5. Now use flasher utility with the kernel file located in the same directory.
+
Known Bugs: Requires the Phone to be booted for an hour or so before it results in decent stats.
 +
===Combined helper script (by evilJazz)===
-
flasher-3.5 -k image_file_name -f -R
+
The following script will show the current frequency and statistics. It also accepts two optional parameters that will set the max and/or min frequencies (in MHz unit). Calling the script without these parameters will not set the new clocking. Instead it will just show the current frequencies and statistics.
 +
This script works with the special frequency handling in Titan's kernel.
-
6. It should take about 1-2 seconds then it'll say Done.
+
To run this script as user and be able to set the frequencies you will need to install "[[Root_access|rootsh]]" via apt-get.
-
7. Now your N900 will show white Nokia screen. (reboot)
+
overclock.sh [max freq] [min freq]
-
8. At this time, you can pull out the USB cable.
+
<source lang="bash">
 +
#!/bin/sh
 +
max=${1}000
 +
min=${2}000
-
9. N900 should finish booting up if all goes well.
+
# Handle and rewrite special cases in Titan's kernel...
 +
[ "$max" == "600000" ] && max=599000
 +
[ "$min" == "125000" ] && min=124999
-
10. Test out your phone as usual. (Apps, browser, camera, phone etc etc)
+
if [ $(id -u) -ne 0 ]; then
 +
  [ "$max" != "000" ] && echo "echo $max > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" | sudo gainroot
 +
  [ "$min" != "000" ] && echo "echo $min > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq" | sudo gainroot
 +
else
 +
  [ "$max" != "000" ] && echo $max > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
 +
  [ "$min" != "000" ] && echo $min > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
 +
fi
-
11. If any abnormal events occur frequently (crash, hang, screen corruption etc), turn it off, flash it to a slower kernel and test again.
+
awk '{printf("\nCurrent frequency: %7s MHz\n", $1/1000)}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
-
note: For Windows7 64bit users, you may need to use WindowsXP mode. ([http://www.youtube.com/watch?v=Bx6dblXl2eo Youtube Tutorial])
+
awk '{printf("Minimal frequency: %7s MHz\n", $1/1000)}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
 +
awk '{printf("Maximal frequency: %7s MHz\n\n", $1/1000)}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
 +
sum=$(awk '{SUM += $2} END {print SUM}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state)
 +
awk '{printf("%7s MHz: %5.1f % (%8d)\n", ($1/1000), ($2 * 100)/"'"$sum"'", $2)}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
 +
echo
 +
</source>
-
===Flashing from N900 xterminal===
+
Output example:
-
* do a backup, have a pc nearby and know you are able to flash the n900 with flasher-3.5 - just in case
+
<pre>~ $ ./overclock.sh 600 250
-
0. Launch xterminal app then type sudo gainroot (need rootsh installed)
+
Current frequency:    250 MHz
 +
Minimal frequency:    250 MHz
 +
Maximal frequency:    599 MHz
-
1. type
+
  1200 MHz:  0.0 % (      0)
-
  softupd -vv -s --local
+
  1100 MHz:  0.0 % (      0)
-
(thats double v)
+
  1000 MHz:  0.0 % (      0)
 +
    950 MHz:  0.0 % (      0)
 +
    900 MHz:  0.2 % (    271)
 +
    850 MHz:  0.0 % (      0)
 +
    810 MHz:  0.0 % (      0)
 +
    750 MHz:  0.0 % (      0)
 +
    700 MHz:  0.0 % (      0)
 +
    600 MHz:  9.0 % (  13663)
 +
    550 MHz:  0.5 % (    701)
 +
    500 MHz: 15.4 % (  23379)
 +
    250 MHz:  75.0 % (  114021)
 +
124.999 MHz:  0.0 % (       0)</pre>
-
2. open new terminal
+
==Changing the Kernel==
-
3. type
+
===Installing a modified Kernel===
-
flasher --local -f -k <kernel_zimage_file_with_path>
+
-
4. you see the flashing (takes some time)
+
====Flashing using PC====
-
5. type "sync" to save changes
+
# Power off the N900 completely.
 +
# Hold "u" on the N900's keyboard, while holding, connect it to the PC via USB cable.
 +
# You will see usb icon on top right of white Nokia screen.
 +
# Now you can let go of "u" on the keyboard.
 +
# Now use flasher utility with the kernel file located in the same directory.<pre>flasher-3.5 -k image_file_name -f -R</pre>
 +
# It should take about 1-2 seconds then it'll say Done.
 +
# Now your N900 will show white Nokia screen. (reboot)
 +
# At this time, you can pull out the USB cable.
 +
# N900 should finish booting up if all goes well.
 +
# Test out your phone as usual. (Apps, browser, camera, phone etc etc)
 +
# If any abnormal events occur frequently (crash, hang, screen corruption etc), turn it off, flash it to a slower kernel and test again.
 +
note: For Windows7 64bit users, you may need to use WindowsXP mode. ([http://www.youtube.com/watch?v=Bx6dblXl2eo Youtube Tutorial])
-
6. type "reboot" and enter to restart
 
-
7. Test out your phone as usual. (Apps, browser, camera, phone etc etc)
+
====Flashing from N900 xterminal====
 +
 
 +
* do a backup, have a pc nearby and know you are able to flash the n900 with flasher-3.5 - just in case
-
8. If any abnormal events occur frequently (crash, hang, screen corruption etc), turn it off, flash it to a slower kernel and test again.
+
# Launch xterminal app then type sudo gainroot (need rootsh installed)
 +
# type:<pre>softupd -vv -s --local</pre>(that is a double v)
 +
# open new terminal
 +
# type:<pre>flasher --local -f -k <kernel_zimage_file_with_path></pre>
 +
# you see the flashing (takes some time)
 +
# type "sync" to save changes
 +
# type "reboot" and enter to restart
 +
# Test out your phone as usual. (Apps, browser, camera, phone etc etc)
 +
# If any abnormal events occur frequently (crash, hang, screen corruption etc), turn it off, flash it to a slower kernel and test again.
'''You are fully responsible for any damage caused by overclocking. Not anyone else.'''
'''You are fully responsible for any damage caused by overclocking. Not anyone else.'''
-
==Reverting to the Original Kernel==
+
===Reverting to the Original Kernel===
If you want to revert to the original kernel, execute:
If you want to revert to the original kernel, execute:
Line 359: Line 337:
  apt-get install --reinstall kernel kernel-flasher
  apt-get install --reinstall kernel kernel-flasher
-
== Fixing the version information ==
+
=== Fixing the version information ===
-
If your version information got lost (control panel -> version) you can fix it by reinstalling the package that is listed with
+
If your version information got lost (control panel -> version) you can fix it by reinstalling the package that is listed with:
  dpkg -l "mp-fremantle*"
  dpkg -l "mp-fremantle*"
-
for example, "mp-fremantle-generic-pr" (for some firmwares 002 or 003 instead of generic) and then execute
+
for example, "mp-fremantle-generic-pr" (for some firmwares 002 or 003 instead of generic) and then execute:
  apt-get install --reinstall mp-fremantle-generic-pr
  apt-get install --reinstall mp-fremantle-generic-pr
-
=Undervolting and voltage tables=
+
==Undervolting and voltage tables==
See: http://talk.maemo.org/showpost.php?p=628839&postcount=81
See: http://talk.maemo.org/showpost.php?p=628839&postcount=81
Line 376: Line 354:
One factor reducing CPU lifetime is the current it is running with.
One factor reducing CPU lifetime is the current it is running with.
-
<code>CPU dynamic power consumption = capacitance * frequency * voltage^2</code> ([http://en.wikipedia.org/wiki/Dynamic_frequency_scaling])
+
<code>CPU dynamic power consumption = capacitance * frequency * voltage^2</code> ([[:wikipedia:Dynamic_frequency_scaling]])
As can be seen from the formula lower voltage plays greater part in CPU consumption than frequency. By reducing the voltage the damage of overclocking can be reduced and the battery life time extended.
As can be seen from the formula lower voltage plays greater part in CPU consumption than frequency. By reducing the voltage the damage of overclocking can be reduced and the battery life time extended.
-
==Calculating voltages==
+
===Calculating voltages===
According to [http://talk.maemo.org/showpost.php?p=606031&postcount=2375 this calculations] the voltage can be varied in steps of 0.0125 V with values 0-72. The formula is (with x being the kernel parameter value):
According to [http://talk.maemo.org/showpost.php?p=606031&postcount=2375 this calculations] the voltage can be varied in steps of 0.0125 V with values 0-72. The formula is (with x being the kernel parameter value):
Line 392: Line 370:
  Random voltage (x = 38):  38 * 0.0125 + 0.6 = 0.475 + 0.6 = 1.075 V
  Random voltage (x = 38):  38 * 0.0125 + 0.6 = 0.475 + 0.6 = 1.075 V
-
==Summary==
+
===Summary===
  FREQUENCY  Nokia  LV    ULV  XLV  ideal
  FREQUENCY  Nokia  LV    ULV  XLV  ideal
Line 414: Line 392:
Note: Asterisks indicate the first frequency in the kernel which needs overvoltage.
Note: Asterisks indicate the first frequency in the kernel which needs overvoltage.
-
==/sys/power/vdd1_opps_vsel values==
+
===/sys/power/vdd1_opps_vsel values===
  LV:      "30 30 38 48 48 54 54 54 54 54 54 54 60 72 72"
  LV:      "30 30 38 48 48 54 54 54 54 54 54 54 60 72 72"
Line 421: Line 399:
  ideal:  "30 30 30 30 33 38 45 45 48 48 54 54 60 72 72"
  ideal:  "30 30 30 30 33 38 45 45 48 48 54 54 60 72 72"
-
==Kernels' specifications==
+
===Kernels' specifications===
-
===Nokia's kernel===
+
====Nokia's kernel====
  VALUE  VOLTAGE  FREQUENCY    DYNAMIC POWER
  VALUE  VOLTAGE  FREQUENCY    DYNAMIC POWER
Line 433: Line 411:
  60    1.350 V  600 MHz      1093.500 V²/us
  60    1.350 V  600 MHz      1093.500 V²/us
-
===titan's LV kernel===
+
====titan's LV kernel====
  VALUE  VOLTAGE  FREQUENCY    DYNAMIC POWER
  VALUE  VOLTAGE  FREQUENCY    DYNAMIC POWER
Line 452: Line 430:
  72    1.500V    1200 MHz      2700.000 V²/us
  72    1.500V    1200 MHz      2700.000 V²/us
-
===titan's ULV kernel===
+
====titan's ULV kernel====
  VALUE  VOLTAGE  FREQUENCY    DYNAMIC POWER
  VALUE  VOLTAGE  FREQUENCY    DYNAMIC POWER
Line 471: Line 449:
  72    1.500V    1200 MHz    2700.000 V²/us
  72    1.500V    1200 MHz    2700.000 V²/us
-
===titan's XLV kernel===
+
====titan's XLV kernel====
  VALUE  VOLTAGE  FREQUENCY    DYNAMIC POWER
  VALUE  VOLTAGE  FREQUENCY    DYNAMIC POWER
Line 490: Line 468:
  72    1.500V    1150 MHz    2587.500 V²/us
  72    1.500V    1150 MHz    2587.500 V²/us
-
===titan's ideal kernel===
+
====titan's ideal kernel====
  VALUE  VOLTAGE  FREQUENCY    DYNAMIC POWER
  VALUE  VOLTAGE  FREQUENCY    DYNAMIC POWER

Revision as of 07:05, 10 May 2010

Contents

Overclocking

This page is about overclocking the N900. For the N8x0 see this thread on talk.maemo.org

# WORK IN PROGRESS, HELP IF YOU WANT

Overclocking is discussed in this thread. Benchmark results can be found here. If you're more interested in power saving read this.

Warnings

  • Overclocking WILL VOID YOUR WARRANTY. Your warranty does not cover running the device beyond the specifications.
  • The lifetime of your device may get reduced (see below)
  • Your data might get corrupted (for example, file system corruption)
  • Every device is an individual, what is stable for others might not be for you
  • If you encounter ANY unusual problems, lower your clock frequency
  • You do it at your own responsibility. No whining afterwards. If you're unsure, don't do it.
  • Nokia's overclocking warning: 500MHz is the normal frequency. Everything above is not good for your device, even with the stock kernel.
  • Igor Stoppa's warning and comment
  • chip vendors specs

Lifetime, warranty and damage

  • The expected lifetime all devices is limited due to wear.
  • It is usually much longer (several years) then the warranty period, so that even with heavy use within the specifications it would not fail before warranty ends.
  • With overclocking users may see considerable speed improvements and lower latency in user experience which could extend the actual lifetime (of being used) as the device could keep up with the newer models.
  • Naive overclocking with stock voltages is definitely bad for most components in your device, especially if the device is continuously locked at high frequencies with high load (see TI specs).
  • Specifications give guarantees for the worst-case scenarios that are covered by the warranty. The best-case scenario may be different for every device but is not covered by warranty.
  • However, there is an open debate whether mild (<40%) overclocking with lower voltages (undervolting) does actually harm or is even less harmful than the stock settings.
  • Evidence for or against damages (esp. with undervolting) in the N900 is currently absent and will probably only be available when the device is no longer on the market.
  • Therefore, if you are unsure and you want to avoid potential damages, do not overclock!

Available kernels

Overclocking requires installation of a custom kernel. There are two types of kernels:

  1. modified PR1.1 kernels by Lehto and others. The only difference from the stock Nokia kernel is the change of the available hardcoded frequencies.
  2. enhanced kernels by titan. They are compatible with PR1.2 (!), contain lots of additional features (IPv6, NAT etc) and bugfixes. In addition they include a large set of possible frequencies (125MHz-1.15GHz) which you manually set and try out without flashing a new kernel. The defaults are set to the standard 250-600MHz range. The kernel can be installed via HAM from the extras-devel catalog.

Jakiman's Guide to Overclocking for Newcomers

Jakiman's Overclock Guide / Summary (Updated @ May 10th 2010)

Installation of Lehto's PR1.1 kernels

Lehto's Kernels

Installation of titan's enhanced kernels

This kernel makes it possible to dynamically change the maximum frequency up to 1.15GHz (supported frequencies are 125,250,500,550,600,700,750,805,850,900,950,1000,1100,1150MHz).

see the separate page for this kernel: Kernel_Power

talk.maemo.org: Discussion of the enhanced kernel

Additional information and hints

  1. the frequencies available in the Nokia kernel are: 250, 500, 550 and 600MHz.
  2. the CPU does NOT IDLE at the lowest frequency (250MHz) but it SLEEPS at 0MHz! Thus reducing the lowest frequency would not reduce power consumption. It is only activated during low workload and may actually consume more power than a higher frequency, as it takes more time to go back to sleep/idle state.
  3. Nokia locks the device to 600MHz during phone calls. This may be a bug. It also affects Lehto's kernels.
  4. the telephone app is closed-source and broken. After a phone call it sets the maximum to 600Mhz and the minimum to 250MHz (or 125MHz if available) irrespective of what you have set before. The are some workarounds in the Kernel-power kernel.
  5. when connected via USB the device locks the minimum frequency to 500Mhz.
  6. By default the device is configured to use 125MHz as the lowest frequency but it not enabled in the kernel pmconfig bug
  7. improving responsiveness
  8. safe pmconfig configuration
  9. the warning
    WARNING: at arch/arm/mach-omap2/clock34xx.c:443 omap3_noncore_dpll_set_rate+0x28c/0x2dc()
    in the kernel logs (dmesg) only happens if the invalid 800MHz frequency was selected. ignore it.
  10. saving more battery power when idle
  11. EvilJazz had photoshopped a picture of a device being overclocked 1.7GHz. It's a prank!
  12. reading one of the temperature sensors "cat /sys/devices/platform/omap34xx_temp/temp1_input"

Useful stuff

Show current CPU frequency

awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq


Set maximum CPU frequency

From root terminal:

rootsh echo 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq | echo ""

Replace 600000 with desired maximum frequency. Pay attention to the two exceptions in titan's kernels (124999 and 599000). The list of available frequencies on your device/kernel can be obtained with command:

awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state

Script for analyzing time_in_state (by rooted) - rev6

This script prints percentage of frequencies (states) used and some additional info useful for posting on the forum (debugging). It displays all frequencies, works with all kernels and it is not affected by the bug which resets minimum frequency after phone call.

The script is in active development. I'm adding new features and resolving bugs if they are reported. Please update your script to newest revision and report if something doesn't work properly.

Temperature may not be listed if you don't have module bq27x00_battery installed or enabled. Also kernel-maemo version is not listed if you don't use titan's kernel.

#!/bin/sh
 
currfreq=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq`
idlefreq=`awk '{if ($2 > 0) print $1}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | tail -n 1`
tis1=`awk '{sum += $2} END {print sum}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
tis2=`awk '$1 == "'"$idlefreq"'" {idle = $2} {sum += $2} END {print sum-idle}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
 
echo -e "
SCRIPT FOR ANALYZING TIME_IN_STATE
By rooted (maemo.org)
Revision 6
 
The script is in active development.
Update your script to current revision from:
http://wiki.maemo.org/Overclocking
 
 
FREQUENCY\tUSED\t\tWHEN BUSY\n"
awk '
{if ($1 >= 1000000)                 printf ("%.0f MHz\t",$1/1000); else printf ("%.0f MHz\t\t",$1/1000)}
{if ($2 == 0)                       printf "unused";               else printf ("%.1f %\t\t",($2*100)/"'"$tis1"'")}
{if ($2 == 0 || $2/"'"$tis2"'" > 1) printf "\n";                   else printf ("%.1f %\n",($2*100)/"'"$tis2"'")}
' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
 
echo -e "
Current frequency:   $(($currfreq/1000)) MHz
Idle frequency:      $(($idlefreq/1000)) MHz
Kernel:              `uname -r`
kernel-maemo:        `dpkg -l kernel* | awk '/kernel-maemo/ {print $3}'`
Uptime:              `uptime | sed -e 's/.*p *//' -e 's/, l.*//' -e 's/  / /'`
Load:                `uptime | sed 's/.*e: //'`
Boot reason:         `cat /proc/bootreason`
Temperature:         `cat /sys/class/power_supply/bq27200-0/temp` °C\n"

Output example:

SCRIPT FOR ANALYZING TIME_IN_STATE
By rooted (maemo.org)
Revision 6

The script is in active development.
Update your script to current revision from:
http://wiki.maemo.org/Overclocking


FREQUENCY       USED            WHEN BUSY

1200 MHz        unused
1100 MHz        unused
1000 MHz        unused
950 MHz         unused
900 MHz         unused
850 MHz         unused
810 MHz         1.6 %           56.7 %
750 MHz         0.0 %           0.8 %
700 MHz         0.1 %           1.9 %
600 MHz         0.0 %           1.5 %
550 MHz         0.0 %           1.2 %
500 MHz         1.0 %           37.8 %
250 MHz         97.3 %
125 MHz         unused

Current frequency:   250 MHz
Idle frequency:      250 MHz
Kernel:              2.6.28.10maemo-ulv-omap1
kernel-maemo:        2.6.28-maemo21
Uptime:              2 days, 2:27
Load:                0.11, 0.04, 0.01
Boot reason:         pwr_key
Temperature:         25 °C

Analyzing time in state, including idle mode stats (by ArbitRabbit)

The following script will show the current frequency and statistics for each state, including time spent in idle mode when the CPU is actually sleeping. This script works with the special frequency handling in Titan's kernel.

To run this script as user and be able to set the frequencies you will need to install "rootsh" via apt-get.

scheduler_stats.sh

#!/bin/sh
awk '{print "\nCurrent frequency: "$1/1000" MHz\n"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
awk '{print "Minimum frequency: "$1/1000" MHz\n"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
awk '{print "Maximum frequency: "$1/1000" MHz\n"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
 
tis1=`awk '{SUM += $2} END {printf("%.0f",SUM/1000)}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
 
idle0=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state0/time`
 
idle1=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state1/time`
 
idle2=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state2/time`
 
idle3=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state3/time`
 
totaltime=$(($idle0+$idle1+$idle2+$idle3+$tis1))
echo -e "FREQUENCY\tUSED"
SUM=0
awk '
       {
               printf (($1/1000)" MHz \t");
               if ($2 == 0)
               {
                       printf "0 %\n";
               }
               else {
                       SUM+=$2;
                       printf("%.3f %\n",($2/10)/"'"$totaltime"'");
                       }
       }
       END{
       printf ("Time spent in idle mode is %2.2f %\n",(1-((SUM/1000)/"'"$totaltime"'"))*100);
       }' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
echo ""

Sample Output

Current frequency: 500 MHz

Minimum frequency: 500 MHz

Maximum frequency: 810 MHz

FREQUENCY       USED
1200 MHz        0 %
1100 MHz        0 %
1000 MHz        0 %
950 MHz         0 %
900 MHz         0 %
850 MHz         0 %
810 MHz         0.000 %
750 MHz         0.000 %
700 MHz         0.000 %
600 MHz         0.000 %
550 MHz         0.000 %
500 MHz         0.010 %
Time spent in idle mode is 99.99 %

Known Bugs: Requires the Phone to be booted for an hour or so before it results in decent stats.

Combined helper script (by evilJazz)

The following script will show the current frequency and statistics. It also accepts two optional parameters that will set the max and/or min frequencies (in MHz unit). Calling the script without these parameters will not set the new clocking. Instead it will just show the current frequencies and statistics.

This script works with the special frequency handling in Titan's kernel.

To run this script as user and be able to set the frequencies you will need to install "rootsh" via apt-get.

overclock.sh [max freq] [min freq]
#!/bin/sh
max=${1}000
min=${2}000
 
# Handle and rewrite special cases in Titan's kernel...
[ "$max" == "600000" ] && max=599000
[ "$min" == "125000" ] && min=124999
 
if [ $(id -u) -ne 0 ]; then
  [ "$max" != "000" ] && echo "echo $max > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" | sudo gainroot
  [ "$min" != "000" ] && echo "echo $min > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq" | sudo gainroot
else
  [ "$max" != "000" ] && echo $max > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
  [ "$min" != "000" ] && echo $min > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
fi
 
awk '{printf("\nCurrent frequency: %7s MHz\n", $1/1000)}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
awk '{printf("Minimal frequency: %7s MHz\n", $1/1000)}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
awk '{printf("Maximal frequency: %7s MHz\n\n", $1/1000)}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
 
sum=$(awk '{SUM += $2} END {print SUM}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state)
awk '{printf("%7s MHz: %5.1f % (%8d)\n", ($1/1000), ($2 * 100)/"'"$sum"'", $2)}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
echo

Output example:

~ $ ./overclock.sh 600 250

Current frequency:     250 MHz
Minimal frequency:     250 MHz
Maximal frequency:     599 MHz

   1200 MHz:   0.0 % (       0)
   1100 MHz:   0.0 % (       0)
   1000 MHz:   0.0 % (       0)
    950 MHz:   0.0 % (       0)
    900 MHz:   0.2 % (     271)
    850 MHz:   0.0 % (       0)
    810 MHz:   0.0 % (       0)
    750 MHz:   0.0 % (       0)
    700 MHz:   0.0 % (       0)
    600 MHz:   9.0 % (   13663)
    550 MHz:   0.5 % (     701)
    500 MHz:  15.4 % (   23379)
    250 MHz:  75.0 % (  114021)
124.999 MHz:   0.0 % (       0)

Changing the Kernel

Installing a modified Kernel

Flashing using PC

  1. Power off the N900 completely.
  2. Hold "u" on the N900's keyboard, while holding, connect it to the PC via USB cable.
  3. You will see usb icon on top right of white Nokia screen.
  4. Now you can let go of "u" on the keyboard.
  5. Now use flasher utility with the kernel file located in the same directory.
    flasher-3.5 -k image_file_name -f -R
  6. It should take about 1-2 seconds then it'll say Done.
  7. Now your N900 will show white Nokia screen. (reboot)
  8. At this time, you can pull out the USB cable.
  9. N900 should finish booting up if all goes well.
  10. Test out your phone as usual. (Apps, browser, camera, phone etc etc)
  11. If any abnormal events occur frequently (crash, hang, screen corruption etc), turn it off, flash it to a slower kernel and test again.

note: For Windows7 64bit users, you may need to use WindowsXP mode. (Youtube Tutorial)


Flashing from N900 xterminal

  • do a backup, have a pc nearby and know you are able to flash the n900 with flasher-3.5 - just in case
  1. Launch xterminal app then type sudo gainroot (need rootsh installed)
  2. type:
    softupd -vv -s --local
    (that is a double v)
  3. open new terminal
  4. type:
    flasher --local -f -k <kernel_zimage_file_with_path>
  5. you see the flashing (takes some time)
  6. type "sync" to save changes
  7. type "reboot" and enter to restart
  8. Test out your phone as usual. (Apps, browser, camera, phone etc etc)
  9. If any abnormal events occur frequently (crash, hang, screen corruption etc), turn it off, flash it to a slower kernel and test again.

You are fully responsible for any damage caused by overclocking. Not anyone else.

Reverting to the Original Kernel

If you want to revert to the original kernel, execute:

apt-get install --reinstall kernel kernel-flasher

Fixing the version information

If your version information got lost (control panel -> version) you can fix it by reinstalling the package that is listed with:

dpkg -l "mp-fremantle*"

for example, "mp-fremantle-generic-pr" (for some firmwares 002 or 003 instead of generic) and then execute:

apt-get install --reinstall mp-fremantle-generic-pr

Undervolting and voltage tables

See: http://talk.maemo.org/showpost.php?p=628839&postcount=81

Extract from the post:

CPU power consumption (without constants) = leakage + capacitance + switching = voltage^2 + frequency + (voltage^2 * frequency)

One factor reducing CPU lifetime is the current it is running with.

CPU dynamic power consumption = capacitance * frequency * voltage^2 (wikipedia:Dynamic_frequency_scaling)

As can be seen from the formula lower voltage plays greater part in CPU consumption than frequency. By reducing the voltage the damage of overclocking can be reduced and the battery life time extended.

Calculating voltages

According to this calculations the voltage can be varied in steps of 0.0125 V with values 0-72. The formula is (with x being the kernel parameter value):

V = x * 0.0125 + 0.6

Examples:

Lowest voltage (x = 0):   0  * 0.0125 + 0.6 = 0     + 0.6 = 0.6 V
Highest voltage (x = 72): 72 * 0.0125 + 0.6 = 0.9   + 0.6 = 1.5 V
Random voltage (x = 38):  38 * 0.0125 + 0.6 = 0.475 + 0.6 = 1.075 V

Summary

FREQUENCY   Nokia   LV    ULV   XLV   ideal
0 MHz       30      30    25    30    30
125 MHz     30      30    25    20    30
250 MHz     38      38    25    30    30
500 MHz     48      48    33    33    30
550 MHz    *54*     48    38    38    33
600 MHz     60     *54*   38    38    38
700 MHz             54    45    45    45
750 MHz             54    45    45    45
810 MHz             54    48    48    48
850 MHz             54    48    48    48
900 MHz             54   *54*  *54*  *54*
950 MHz             54    54    54    54
1000 MHz            60    60    60    60
1100 MHz            72    72    72    72
1150 MHz            72    72    72    72
1200 MHz            72    72    72    72

Note: Asterisks indicate the first frequency in the kernel which needs overvoltage.

/sys/power/vdd1_opps_vsel values

LV:      "30 30 38 48 48 54 54 54 54 54 54 54 60 72 72"
ULV:     "25 25 25 33 38 38 45 45 48 48 54 54 60 72 72"
XLV:     "30 20 30 33 38 38 45 45 48 48 54 54 60 72 72"
ideal:   "30 30 30 30 33 38 45 45 48 48 54 54 60 72 72"

Kernels' specifications

Nokia's kernel

VALUE  VOLTAGE   FREQUENCY     DYNAMIC POWER
30     0.975 V   0 MHz         0.000 V²/us
30     0.975 V   125 MHz       118.828 V²/us
38     1.075 V   250 MHz       288.906 V²/us
48     1.200 V   500 MHz       720.000 V²/us
54     1.275 V   550 MHz       894.094 V²/us
60     1.350 V   600 MHz       1093.500 V²/us

titan's LV kernel

VALUE  VOLTAGE   FREQUENCY     DYNAMIC POWER
30     0.975V    0 MHz         0.000 V²/us
30     0.975V    125 MHz       118.828 V²/us
38     1.075V    250 MHz       288.906 V²/us
48     1.200V    500 MHz       720.000 V²/us
48     1.200V    550 MHz       792.000 V²/us
54     1.275V    600 MHz       975.375 V²/us
54     1.275V    700 MHz       1137.938 V²/us
54     1.275V    750 MHz       1219.219 V²/us
54     1.275V    810 MHz       1316.756 V²/us
54     1.275V    850 MHz       1381.781 V²/us
54     1.275V    900 MHz       1463.062 V²/us
54     1.275V    950 MHz       1544.344 V²/us
60     1.350V    1000 MHz      1822.500 V²/us
72     1.500V    1100 MHz      2475.000 V²/us
72     1.500V    1200 MHz      2700.000 V²/us

titan's ULV kernel

VALUE  VOLTAGE   FREQUENCY    DYNAMIC POWER
25     0.912V    0 MHz        0.000 V²/us
25     0.912V    125 MHz      103.968 V²/us
25     0.912V    250 MHz      207.936 V²/us
33     1.012V    500 MHz      512.072 V²/us
38     1.075V    550 MHz      635.594 V²/us
38     1.075V    600 MHz      693.375 V²/us
45     1.163V    700 MHz      946.798 V²/us
45     1.163V    750 MHz      1014.427 V²/us
48     1.200V    810 MHz      1166.400 V²/us
48     1.200V    850 MHz      1224.000 V²/us
54     1.275V    900 MHz      1463.062 V²/us
54     1.275V    950 MHz      1544.344 V²/us
60     1.350V    1000 MHz     1822.500 V²/us
72     1.500V    1100 MHz     2475.000 V²/us
72     1.500V    1200 MHz     2700.000 V²/us

titan's XLV kernel

VALUE  VOLTAGE   FREQUENCY    DYNAMIC POWER
30     0.975V    0 MHz        0.000 V²/us
20     0.850V    125 MHz      90.312 V²/us
30     0.975V    250 MHz      237.656 V²/us
33     1.012V    500 MHz      512.072 V²/us
38     1.075V    550 MHz      635.594 V²/us
38     1.075V    600 MHz      693.375 V²/us
45     1.163V    700 MHz      946.798 V²/us
45     1.163V    750 MHz      1014.427 V²/us
48     1.200V    810 MHz      1166.400 V²/us
48     1.200V    850 MHz      1224.000 V²/us
54     1.275V    900 MHz      1463.062 V²/us
54     1.275V    950 MHz      1544.344 V²/us
60     1.350V    1000 MHz     1822.500 V²/us
72     1.500V    1100 MHz     2475.000 V²/us
72     1.500V    1150 MHz     2587.500 V²/us

titan's ideal kernel

VALUE  VOLTAGE   FREQUENCY    DYNAMIC POWER
30     0.975V    0 MHz        0.000 V²/us
30     0.975V    125 MHz      118.828 V²/us
30     0.975V    250 MHz      237.656 V²/us
30     0.975V    500 MHz      475.312 V²/us
33     1.012V    550 MHz      563.279 V²/us
38     1.075V    600 MHz      693.375 V²/us
45     1.163V    700 MHz      946.798 V²/us
45     1.163V    750 MHz      1014.427 V²/us
48     1.200V    810 MHz      1166.400 V²/us
48     1.200V    850 MHz      1224.000 V²/us
54     1.275V    900 MHz      1463.062 V²/us
54     1.275V    950 MHz      1544.344 V²/us
60     1.350V    1000 MHz     1822.500 V²/us
72     1.500V    1100 MHz     2475.000 V²/us
72     1.500V    1150 MHz     2587.500 V²/us