2010-07-15

N900 - How to overclock the processor speed of N900

The N900 is a flexible mobile phone that runs Maemo operating system. It should not be compare as a mobile phone but rather as a mobile tablet with an extra function, phone. As my previous post introduction, it comes with a large display, keyboard & a snappy processor. Because of Maemo, now it even allows processor overclocking.

By overclocking to 850mhz, I've noticed that the average battery usage life have increase up to 30%. From an average of 3 days per charge to less then 5 days per charge. And of cause, because the processor is running faster then the default 600mhz, it boosts the response of application execution. To anyone that is interested in overclocking this phone, this post will show how to overclock the N900 to 850mhz which I find this speed is a balanced between speed & battery life. Anything higher then this might spoil the phone. You've been warned.

Here's how to overclock the processor of N900 :

  1. Install the application "kernel-power-settings" in "App manager".
  2. Reboot the phone by turning it off, then on again.
  3. Escalate to root privilege :
    sudo gainroot
  4. Check the current processor speed, do :
    awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
  5. Check the available speed to overclock :
    awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
  6. This is how to overclock the phone to 850mhz :
    echo 850000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq | echo ""
  7. Repeat step 4 to check again the processor speed

If all goes well, the phone should be running at 850mhz. Here's a script taken from the Maemo wiki on how to display debug information of the phone :
  1. Loads the Battery Information kernel module for the script to extract battery information :
    modprobe bq27x00_battery
  2. Create the script named "debug_info" :
    vim debug_info
    then insert the following :
    #!/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"
  3. Make the script executable :
    chmod 700 debug_info
  4. Execute it :
    ./debug_info
  5. Sample output :
    /home/user# ./debug_info 
    
    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
    
    1150 MHz        unused
    1100 MHz        unused
    1000 MHz        unused
    950 MHz         unused
    900 MHz         unused
    850 MHz         5.7 %           20.3 %
    805 MHz         0.0 %           0.1 %
    750 MHz         0.1 %           0.5 %
    700 MHz         0.1 %           0.6 %
    600 MHz         4.6 %           42.6 %
    550 MHz         0.1 %           1.0 %
    500 MHz         3.5 %           54.9 %
    250 MHz         85.8 %
    125 MHz         unused
    
    Current frequency:   250 MHz
    Idle frequency:      250 MHz
    Kernel:              2.6.28.10power-omap1
    kernel-maemo:        
    Uptime:              1:06
    Load:                0.72, 0.44, 0.27
    Boot reason:         sw_rst
    Temperature:         34 C

If you've noticed, the Current frequency & Idle frequency are at 250mhz. This is normal as most of the time of my phone is running nothing so the idle speed of the processor drops to 250% to conserve battery. But this speed will increase (on demand) to 850mhz when required, e.g. starting of an application or playing video on Youtube.

After overclocking the phone, you should try to run a dozen of apps simultaneously to try how snappy it is. Of cause, constantly pushing the processor to run at 850mhz will make the battery drain faster. But isn't it cool to compare to other phone how powerful N900 is!

Namaste !!!

4 comments:

Unknown said...

I notice after rebooting my phone each time, my MHz goes back to 600. Do I have to run this script to overclock every time I shut down the phone?? Or is there a tick I'm not doing here? Please advise.

Thanks!

Gajendra Singh said...

I could not find the application "kernel-power-settings" in "App manager".

I have all the repositories enabled.

Pranjal said...

@Anthony: Dude, after following all the steps, you have to type in "sync" (without the quotes) in the xterminal. This will save your settings and make them permanent.

Pranjal said...

@Anthony: Dude, you need to type in "sync" (without the quotes) after following the step 6 to save your overclocked frequency and make it permanent.