Overclocking

(Remarks)
m (Reverted edits by 84.247.45.105 (Talk) to last revision by sixwheeledbeast)
 
(81 intermediate revisions not shown)
Line 1: Line 1:
-
=Overclocking=
+
==Reminders==
-
This page is about overclocking the N900.
+
This page is about overclocking and undervolting 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''
+
Overclocking is discussed in [http://talk.maemo.org/showthread.php?t=39753 this thread]. Benchmark results can be found [http://talk.maemo.org/showthread.php?p=605189 here]. If you're more interested in power saving read [http://talk.maemo.org/showthread.php?t=49654 this].
-
Overclocking is discussed in [http://talk.maemo.org/showthread.php?t=39753 this thread].
+
This guide focuses on kernel-power v50 and above, as it introduces improvements in stability and maximum supported frequency for SmartReflex, making it highly desirable for a Maemo system that is overclocked 24/7.
-
Benchmark results can be found [http://talk.maemo.org/showthread.php?p=605189 here].
+
-
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<br>
+
* Overclocking WILL VOID YOUR WARRANTY. Your warranty does not cover running the device beyond the specifications.
-
- The lifetime of your device will get reduced<br>
+
* The lifetime of your device WILL get reduced as a result of [[:wikipedia:Electromigration]]
-
- You could lose the data in your device (file system corruption)<br>
+
* Your device might not perform properly - bizarre bugs and corruption may result from the CPU being physically unable to cope with higher frequencies (see the next point)
-
- Every device is an individual, what is stable for others might not be for you<br>
+
* All devices are not made equal - some may be able to handle 1.15GHz daily just fine, while some may be unstable even at 720MHz.
-
- If you encounter ANY unusual problems, lower your clock frequency<br>
+
* You do it at your own responsibility. No whining afterwards. If you're unsure, don't do it.
-
- You do it at your own responsibility. No whining afterwards. If you're unsure, don't do it.<br>
+
* Nokia's overclocking warning: 500 MHz is the normal frequency. Everything above is not good for your device, even with the stock kernel.
-
- [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>
+
* 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]
+
-
=Available kernels=
+
==Lifetime, warranty and damage==
-
Overclocking requires installation of a custom kernel.
+
* The expected lifetime '''all''' devices is limited due to wear.
-
There are two types of kernels:
+
* It is usually much longer (several years) than the warranty period, so that even with heavy use within the specifications it would not fail before warranty ends.
-
# modified PR1.1 kernels by Lehto and others. The only difference to the stock Nokia kernel is that the change the available hardcoded frequencies.
+
* 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.
-
# 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 an 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 catalouge.
+
* Excessive 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. See [[#Undervolting and voltage tables]] for an explanation why undervolting in fact won't help anything due to chip using SmartReflex Technology (which can not be disabled).
 +
* 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. Or you decide to acquire thorough electronics engineer's understanding of the issue, and study TI's papers regarding SmartReflex™ and how it works - then all the evidence for damage positively done is there already.
 +
* Therefore, if you are unsure and you want to avoid potential damages, do not overclock!
-
== Installation of Lehto's PR1.1 kernels ==
+
==Overclocking, bugzilla & errors==
-
[http://talk.maemo.org/showpost.php?p=594200&postcount=309 Lehto's Kernels]
+
* Running a device overclocked for long periods of time could produce unwanted side effects, even persisting ones that won't revert when overclocking is stopped. If you are experiencing errors following overclocking and intend to report those errors to talk.maemo.org or bugzilla, please consider the following :
 +
** Errors induced by overclocking will not always appear to be as such.
 +
** It will be considered a good idea to reproduce your error / problem on a device which has never been overclocked AT ALL, before proceeding with actions regarding your problem.
 +
** In the event you have decided to file a bug report or open a thread about your problem, please add a note to that report, mentioning that you are or previously were in fact running your device overclocked.  Please also provide details about the period and amount of overclocking used.
 +
* The reason for these requirements is that there are many problems pending for developer's attention. It is a huge waste of time to try and trace down an error without knowing all the facts, just to find out in the end that the particular problem was caused by a damaged hardware. If the developers know about it, they can take it into account and won't rule out a 1+1=3 problem on the reporter's device during their analysis.
-
[http://talk.maemo.org/showpost.php?p=595582&postcount=774 talk.maemo.org: Jakiman's Overclock Guide / Summary]
+
==Additional information and hints==
-
== Installation of titan's enhanced kernels ==
+
* The stock Nokia kernel uses the following frequencies: 250, 500, 550 and 600 MHz.
-
This kernel makes it possible 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).
+
* The CPU does '''NOT IDLE''' at the lowest frequency (250 MHz) but it '''SLEEPS''' at 0 MHz! 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.
-
WARNING: Overclocking may damage your device and is at your own risk! It may void your warranty and destroy your data. You have been warned.
+
* Setting the lowest frequency to 125 MHz does NOT improve battery life. In fact, many people noticed worse battery life, instability and worse responsiveness,
 +
* The Phone app is closed-source and broken. During a phone call, the device's frequency [http://talk.maemo.org/showpost.php?p=601691&postcount=1823 is locked to 600MHz]. This may be a bug, and it affects all kernels for Fremantle. After a phone call, it sets the maximum to 600 Mhz and the minimum to 250 MHz (or 125 MHz if available) regardless of the frequencies you have set. There are some workarounds present in kernel-power, however the bug may still occasionally manifest.
 +
* When connected via USB the device locks the minimum frequency to 500 Mhz.
 +
* By default the device is configured to use 125 MHz as the lowest frequency but it not enabled in the kernel [https://bugs.maemo.org/show_bug.cgi?id=7116 pmconfig bug]
 +
* 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 800 MHz frequency was selected. Ignore it.
 +
* 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'''!
 +
* The internal temperature sensor may be read by using the command "cat /sys/devices/platform/omap34xx_temp/temp1_input"
 +
* '''Note''' that the system does not have an on-die temperature sensor, and the actual CPU temperature may be higher or lower than the reading.
-
[http://talk.maemo.org/showthread.php?t=43420 talk.maemo.org: Discussion of the enhanded kernel]
+
==Installing a modified kernel==
 +
Overclocking and undervolting require installation of a custom kernel.
 +
There are two types of kernels:
-
'''Note:''' all commands on this page must be run as root in X Terminal (install rootsh package and enter "sudo gainroot")
+
===Kernel-Power (recommended)===
 +
[[Kernel_Power|kernel-power]], developed by Titan and maintained by Pali.
 +
They are compatible with [[Maemo 5/PR1.2|PR1.2]] and [[Maemo 5/PR1.3|PR1.3]], contain lots of additional features (IPv6, NAT etc) and bugfixes. In addition, they include a large set of possible frequencies (125 MHz-1.15 GHz) which can be manually set and tested without flashing a new kernel.
-
=== Installation of the more stable [https://maemo.org/packages/package_instance/view/fremantle_extras-testing_free_armel/kernel-power-flasher/2.6.28-maemo24/ kernel (maemo24)] from extras-testing ===
+
The defaults are set to the standard 250-600 MHz range.
-
With this kernel you can change the frequency limits, the voltages and DSP frequencies online.
+
-
It requires firmware PR1.1 or newer.
+
-
# Install the package kernel-power-settings (section system in HAM). It will automatically also install kernel-power-flasher.
+
-
# shutdown and boot again. There's no need for reflashing etc.
+
-
[Configuring_the_kernel_settings read this for configuration]
+
-
=== Installation of the experimental [https://maemo.org/packages/package_instance/view/fremantle_extras-devel_free_armel/kernel-power-flasher/2.6.28-maemo25/ kernel (maemo25)] from extras-devel ===
+
This guide recommends using kernel-power v50, which at the time of writing is available in the [[extras]] catalog. Newer, more experimental kernels may be available through [[extras-testing]] or [[extras-devel]].
-
This kernel version contains additional experimental features and patches.
+
-
Changelogs are posted [https://garage.maemo.org/news/?group_id=1528 here].
+
-
# Install the package "Enhanced kernel for power users" (section system in HAM).
+
-
# shutdown and boot again. There's no need for reflashing etc.
+
-
Read the instructions for the stable kernel for more information.
+
-
=== Upgrade from older versions (< maemo24)  ===
+
====Installing from the repositories====
-
The package was previously called kernel-flasher-maemo.
+
# Open the Application Manager
-
If you have one of the older packages installed it it recommended that you upgrade in X Terminal
+
# Go to the "System" section, and install the package kernel-power-settings. This automatically pulls in the rest of kernel-power as dependencies.
-
sudo gainroot
+
# After successful installation, reboot the device.
-
apt-get install -y kernel-power-flasher
+
-
apt-get remove kernel-flasher-maemo
+
-
If the new kernel still doesn't boot up, try
+
-
apt-get install --reinstall -y kernel-power kernel-power-flasher
+
-
Also try [http://talk.maemo.org/showpost.php?p=608343&postcount=2603 other hints] for deinstalling the old package.
+
-
Make sure you reset /etc/pmconfig to the defaults:
+
===Lehto's Kernel and other legacy kernels===
-
# Power management configuration file
+
Modified [[Maemo 5/PR1.1|PR1.1]] kernels by Lehto and others. The only difference from the stock Nokia kernel is the change of the available hardcoded frequencies.
-
enable_off_mode 1
+
-
sleep_while_idle 1
+
-
sr_vdd1_autocomp 0
+
-
sr_vdd2_autocomp 0
+
-
clocks_off_while_idle 1
+
-
voltage_off_while_idle 1
+
-
scaling_governor ondemand
+
-
scaling_max_freq 600000
+
-
scaling_min_freq 125000
+
-
sleep_ind 1
+
-
=== Deinstallation ===
+
====Flashing from X Terminal====
-
sudo gainroot
+
* do a backup, have a PC nearby and know you are able to flash the N900 with flasher-3.5 - just in case
-
apt-get install --reinstall -y kernel kernel-flasher
+
-
apt-get remove kernel-power kernel-power-modules
+
-
=== Configuring the kernel settings ===
+
# Launch X Terminal, then type<pre>sudo gainroot</pre>
-
[http://talk.maemo.org/showpost.php?p=610967&postcount=2718 read this for more details].
+
# 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'll 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.
-
First verify, that the kernel is actually running:
+
===Reverting to the Stock Kernel===
-
uname -r
+
-
should return "2.6.28.10power-omap1"
+
-
It it does not, you should reboot or try to install again
+
-
apt-get install --reinstall -y kernel-power kernel-power-flasher
+
-
reboot, and test again.
+
-
Make sure the packages ''kernel-power-settings'' and ''rootsh'' are installed.
+
If you want to revert to the stock Nokia kernel, execute:
-
'''All commands need to be run as root user.'''
+
-
If you are normal user in X Terminal either "sudo gainroot" or prepend "sudo" to every command.
+
-
1) to try a configuration (you can replace "ideal" with default, lv, ulv, xlv or specify a file you created based on the template /usr/share/kernel-power-settings/default )
+
  apt-get install --reinstall kernel kernel-flasher
-
  /usr/sbin/kernel-load /usr/share/kernel-power-settings/ideal
+
-
'''Note''': do [[NOT]] modify the files in /usr/share/kernel-power-settings/!
+
-
see '''Creating your own configuration:'' below.
+
-
2) to permanently install a default configuration
+
in X Terminal.
-
rm -f /etc/default/kernel-power
+
-
ln -s /usr/share/kernel-power-settings/ideal /etc/default/kernel-power
+
-
3) or your own config
+
-
rm -f /etc/default/kernel-power
+
-
cp <filename> /etc/default/kernel-power
+
-
4) and to immediately apply it
+
-
sudo /usr/sbin/kernel-load
+
-
'''For beginners:''' first reboot. then try 1) and check whether the device is stable. then do 2).
+
=== Fixing the version information ===
-
'''Creating your own configuration'''
+
If your version information got lost (control panel -> version) you can fix it by reinstalling the package that is listed with:
-
5) copy the template to your mydocs (when not in mass storage mode)
+
  dpkg -l "mp-fremantle*"
-
cp /usr/share/kernel-power-settings/ideal /home/user/MyDocs/kernel.txt
+
for example, "mp-fremantle-generic-pr" (for some firmwares 002 or 003 instead of generic) and then execute:
-
6) edit the file ''/home/user/MyDocs/kernel.txt''. The defaults are
+
  apt-get install --reinstall mp-fremantle-generic-pr
-
  #UP_THRESHOLD=75
+
-
#SAMPLING_RATE=150000
+
-
VDD1_OPPS_VSEL="30 30 38 48 54 48 60 60 60 60 60 60 60 72 72"
+
-
DSP_OPPS_RATE="90 90 180 360 400 430 430 430 430 500 500 500 500 520 520"
+
-
MIN_FREQ=250000
+
-
MAX_FREQ=599000
+
-
SMARTREFLEX_VDD1=0
+
-
SMARTREFLEX_VDD2=0
+
-
For changing the frequency range change MIN_FREQ/MAX_FREQ (see "Temporarly change of the frequency limits" below ).
+
-
Either edit the file with an editor on your device (e.g., leafpad)
+
-
or USB mount it to edit it on the PC. unmount and unplug USB.
+
-
After editing load the configuration with
+
-
  /usr/sbin/kernel-load /home/user/MyDocs/kernel.txt
+
-
and repeat 6) until you're happy.
+
-
7) to permanently install this new configuration
+
==Overclocking==
-
rm -f /etc/default/kernel-power
+
Once you have installed kernel-power, you are ready to start overclocking.
-
cp /home/user/MyDocs/kernel.txt  /etc/default/kernel-power
+
# List available frequencies ("active frequencies")<pre> sudo kernel-config show </pre>
-
/usr/sbin/kernel-load
+
# Select the lowest and highest frequencies to be used from the list of active frequencies,  The kernel will use all '''active frequencies''' between and including those you selected.
 +
# The following command will set the frequencies to stock:<pre> sudo kernel-config limits 250 600 </pre>
 +
# The following command will set the maximum to the highest supported by '''SmartReflex'''. (Note that SmartReflex in kernel-power v50 only works with frequencies up to 900MHz.)<pre> sudo kernel-config limits 250 900 </pre>
 +
# At this point, you should test system stability by launching a few programs, browsing JavaScript-heavy webpages, and playing a movie.
 +
# Should you encounter no reboots, you can save your overclocking profile.<pre> sudo kernel-config save myprofile </pre>
 +
# You can now proceed to set your kernel profile as the default, to be loaded automatically at startup.<pre> sudo kernel-config default myprofile </pre>
-
8) to reset the device to the defaults use
+
==Undervolting==
-
rm -f /etc/default/kernel-power
+
-
/usr/sbin/kernel-load /usr/share/kernel-power-settings/default
+
-
'''Note''': the package automatically detects whether a certain misconfiguration has caused '''reboot loop.'''
+
===SmartReflex===
-
It your device reboots twice within 5 minutes, it will load the default settings (250-600Mhz) so that you can fix or remove the invalid configuration file.
+
-
This also means that, when for some reason you manually reboot too quickly (<5min) your configuration will not be loaded.
+
-
To load it nonetheless run after booting
+
-
/usr/sbin/kernel-load
+
-
=== Temporarly change of the frequency limits ===
+
====Rationale====
-
sudo gainroot
+
Before kernel-power v50, one would normally set voltages per frequency in a configuration file, which required manual testing to determine the lowest voltages possible for a specific frequency. This may result in reboots if the voltage was not set high enough to account for the CPU's power usage at full loads, or power wastage if the voltages were set higher than what is needed for light loads at a certain frequency.
-
echo 250000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+
SmartReflex is a technology which automatically regulates the voltage used for the entire SoC, automatically adapting to lower voltages during light use and increase them during heavy use.
-
echo 599000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+
-
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
+
-
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+
-
The last line shows which values were actually set.
+
-
To set 125MHz use 124999, for 600MHz 599999, for everthing else x000 with x=MHz.
+
-
This setting takes effect immediately and is cleared with the next reboot.
+
-
=== Permanently change of the frequency limits ===
+
====Automatic Undervolting====
-
WARNING: Permanent overclocking is very dangerous!
+
Once kernel-power v50 or higher is installed, enabling it is a matter of doing the following:
 +
# Make a folder for your kernel profiles<pre> mkdir -p ~/.kernel </pre>
 +
# Copy a sane profile to your kernel profile folder<pre> cp /usr/share/kernel-power-settings/default ~/.kernel/myprofile </pre>
 +
# Edit the profile to enable SmartReflex<pre> nano ~/.kernel/myprofile </pre>
 +
# Look for the lines:<pre> SMARTREFLEX_VDD1=0 SMARTREFLEX_VDD2=0</pre>
 +
# Edit them to the following:<pre>SMARTREFLEX_VDD1=1 SMARTREFLEX_VDD2=1</pre>
 +
# Save the file by pressing Ctrl+X, and confirm with Y then press Enter.
 +
# Test the profile<pre> sudo kernel-config load myprofile </pre>
 +
# At this point, you'd want to stress the CPU a bit. Launch a few programs, visit JS-heavy websites, etc.
 +
# If the device does not reboot and you feel safe using the profile, set it as the default.<pre> sudo kernel-config default myprofile </pre>
 +
# Congratulations, the kernel is now doing all the work for you.
-
Install kernel-power-settings and follow [http://talk.maemo.org/showpost.php?p=610967&postcount=2718 those instructions].
+
===Manual Undervolting (Legacy)===
 +
See: http://talk.maemo.org/showpost.php?p=628839&postcount=81
-
=== Battery ===
+
Extract from the post:
-
In kernels version >=maemo20 you can read out the current battery info:
+
-
modprobe bq27x00_battery
+
-
cat /sys/class/power_supply/bq27200-0/capacity
+
-
cat /sys/class/power_supply/bq27200-0/voltage_now
+
-
cat /sys/class/power_supply/bq27200-0/current_now
+
-
cat /sys/class/power_supply/bq27200-0/temp
+
-
*'capacity' value in percentage of battery level.
+
<pre>CPU power consumption (without constants) = leakage + capacitance + switching = voltage^2 + frequency + (voltage^2 * frequency)</pre>
-
*'voltage_now' value in mV of battery voltage level.
+
-
*'current_now' value in mA of battery current consumption. (???)
+
-
*'temp' value in degrees C of battery temperature.
+
-
To remove this kernel module use:
+
One factor reducing CPU lifetime is the current it is running with [[:wikipedia:Dynamic_frequency_scaling|dynamic frequency scaling]].
 +
<pre>CPU dynamic power consumption = capacitance * frequency * voltage^2</pre>
-
modprobe -r bq27x00_battery
+
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. Alas, this claim only holds true for architectures not regulating the real voltage and current in special on chip regulators, like OMAP is known to do for almost every gate in their CPU and other SoC function blocks. TI calls this feature SmartReflex™ and lowering the voltage applied to the whole SoC, like suggested here, only reduces the voltage drop across these regulators, thus no positive effect on [[:wikipedia:Electromigration|electromigration damage]] caused by overclocking is to be expected.
-
or reboot.
+
====Calculating Voltages====
-
=== Holding a kernel version ===
+
According to [http://talk.maemo.org/showpost.php?p=606031&postcount=2375 these calculations], the voltage can be varied in steps of 0.0125 V with values 0-72.
-
It your manually installed kernel should be not upgraded to the one in extras* try [http://talk.maemo.org/showpost.php?p=603915&postcount=2063 this]:
+
The formula is (with x being the kernel parameter value):
-
echo kernel-power-flasher hold | dpkg --set-selections
+
<pre>V = x * 0.0125 + 0.6</pre>
-
echo kernel-power hold | dpkg --set-selections
+
-
echo kernel-power-modules hold | dpkg --set-selections
+
-
to unlock the version:
+
-
echo kernel-power-flasher install | dpkg --set-selections
+
-
echo kernel-power install | dpkg --set-selections
+
-
echo kernel-power-modules install | dpkg --set-selections
+
-
=== Remarks ===
+
Examples:
-
# The screen calibration in settings crashes immediately. It is a known bug in the calibration app, not in the kernel. It's mentioned in the kernel package description and is due to additional evdev (joystick,mouse) support. Just calibrate once with the stock kernel before you install the fully featured kernel.
+
-
# The kernel supports 125MHz but this frequency is [http://talk.maemo.org/showpost.php?p=617488&postcount=3095 disabled by default] in avoid_frequencies. In version <25, it is enabled by specifying "124999", in later versions it is disabled in ''/sys/devices/system/cpu/cpu0/cpufreq/ondemand/avoid_frequencies'' and can be enabled with
+
-
echo > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/avoid_frequencies
+
-
# similarily, individual frequencies can be disabled in >=v25
+
-
echo 125000 250000 750000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/avoid_frequencies
+
-
# even if 125Mhz is disabled, the telephone app will always try to set the minimum freq. to 125Mhz after a phone call, but it is ignored unless you enable 125Mhz.
+
-
# if you enable 125MHz also set  "echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load" [http://talk.maemo.org/showpost.php?p=602687&postcount=185 hint]
+
-
# [http://talk.maemo.org/showpost.php?p=597703&postcount=141 the 125MHz issue]
+
Lowest voltage (x = 0):   0  * 0.0125 + 0.6 = 0    + 0.6 = 0.6 V
-
# Installing another version of the enhanced kernel will just overwrite the older version. The stock kernel modules are preserved so that you can simply reflash the stock kernel via USB.
+
  Highest voltage (x = 72): 72 * 0.0125 + 0.6 = 0.9  + 0.6 = 1.5 V
-
# If you for some reason get errors like this during removal or installation "rm: cannot remove '/lib/modules/2.6.28.10maemo-lv-omap1/modules.*': No such file or directory".try this [http://talk.maemo.org/showpost.php?p=603938&postcount=196 workaround]. There was a bug in one of the early LV kernels but it should be fixed in more recent versions.
+
Random voltage (x = 38): 38 * 0.0125 + 0.6 = 0.475 + 0.6 = 1.075 V
-
# This kernel will not conflict with the future PR1.2 upgrade. The upgrade will, however, overwrite this kernel and you'll have to install it again.
+
-
=Additional information and hints=
+
====Voltage Table====
 +
* V²/us for frequencies 720 and 805 need to be recalculated.
 +
* Bolded steps indicate the first frequency in the kernel which needs overvoltage. ''All frequencies after it are overvolted''.
 +
{|
 +
! Frequency !! Nokia !! LV !! ULV !! XLV !! ideal !! starving
 +
|-
 +
|0 MHz || 30 || 30 || 25 || 30 || 30 || 22
 +
|-
 +
| || 0.975V, 0.000 V²/us || 0.975V, 0.000 V²/us || 0.912V, 0.000 V²/us || 0.975V, 0.000 V²/us || 0.975V, 0.000 V²/us ||
 +
|-
 +
|125 MHz || 30 || 30 || 25 || 20 || 30 || 22
 +
|-
 +
| || 0.975V, 288.906 V²/us || 0.975V, 118.828 V²/us || 0.912V, 103.968 V²/us || 0.975V, 118.828 V²/us || 0.975V, 118.828 V²/us ||
 +
|-
 +
|250 MHz || 38 || 38 || 25 || 30 || 30 || 28
 +
|-
 +
| || 1.075 V, 118.828 V²/us || 1.075 V, 118.828 V²/us || 0.912V, 207.936 V²/us || 0.975V, 237.656 V²/us || 0.975V, 237.656 V²/us ||
 +
|-
 +
|500 MHz || 48 || 48 || 33  || 33 || 30 || 29
 +
|-
 +
| || 1.200 V, 720.000 V²/us || 1.200 V, 720.000 V²/us || 1.012V, 512.072 V²/us || 1.012V, 512.072 V²/us || 0.975V, 475.312 V²/us ||
 +
|-
 +
|550 MHz || '''54''' || 48 || 38 || 38 || 33 || 32
 +
|-
 +
| || 1.275 V, 894.094 V²/us || 1.200 V, 792.000 V²/us || 1.075V, 635.594 V²/us || 1.075V, 635.594 V²/us || 1.012V, 563.279 V²/us ||
 +
|-
 +
|600 MHz || 60 || '''54''' || 38 || 38 || 38 || 34
 +
|-
 +
| || 1.350 V, 1093.500 V²/us || 1.275 V, 975.375 V²/us || 1.075V, 693.375 V²/us || 1.075V, 693.375 V²/us || 1.075V, 693.375 V²/us ||
 +
|-
 +
|720 MHz || || 54 || 45 || 45 || 45 || 42
 +
|-
 +
| || || 1.275 V, 1137.938 V²/us || 1.163 V, 1014.427 V²/us || 1.163 V, 1014.427 V²/us || 1.163 V, 1014.427 V²/us ||
 +
|-
 +
|805 MHz || || 54 || 48 || 48 || 48 || 45
 +
|-
 +
| || || 1.275 V, 1316.756 V²/us || 1.200 V, 1166.400 V²/us || 1.200 V, 1166.400 V²/us || 1.200V, 1166.200 V²/us ||
 +
|-
 +
|850 MHz || || 54 || 48 || 48 || 48 || 46
 +
|-
 +
| || || 1.275 V, 1381.781 V²/us || 1.200 V, 1224.000 V²/us || 1.200 V, 1224.000 V²/us || 1.200V, 1224.000 V²/us ||
 +
|-
 +
|900 MHz || || 54 || '''54''' || '''54''' || '''54''' || 49
 +
|-
 +
| || || 1.275 V, 1463.062 V²/us || 1.275V, 1463.062 V²/us || 1.275V, 1463.062 V²/us || 1.275 V, 1463.062 V²/us ||
 +
|-
 +
|950 MHz || || 54 || 54 || 54 || 54 || 52
 +
|-
 +
| || || 1.275 V, 1544.344 V²/us || 1.275 V, 1544.344 V²/us || 1.275 V, 1544.344 V²/us || 1.275 V, 1544.344 V²/us ||
 +
|-
 +
|1000 MHz || || 60 || 60 || 60 || 60 || 55
 +
|-
 +
| || || 1.350 V, 1822.500 V²/us || 1.350 V, 1822.500 V²/us || 1.350 V, 1822.500 V²/us || 1.350 V, 1822.500 V²/us ||
 +
|-
 +
|1100 MHz || || 72 || 72 || 72 || 72 || 63
 +
|-
 +
| || || 1.500 V, 2475.000 V²/us || 1.500 V, 2475.000 V²/us || 1.500 V, 2475.000 V²/us || 1.500 V, 2475.000 V²/us ||
 +
|-
 +
|1150 MHz || || 72 || 72 || 72 || 72 || 69
 +
|-
 +
| || || 1.500 V, 2700.000 V²/us || 1.500 V, 2700.000 V²/us || 1.500 V, 2700.000 V²/us || 1.500 V, 2700.000 V²/us ||
 +
|}
-
# the frequencies available in the Nokia kernel are: 250, 500, 550 and 600MHz.
+
==Useful scripts==
-
# Nokia [http://talk.maemo.org/showpost.php?p=601691&postcount=1823 locks the device to 600MHz] during phone calls. This may be a bug. It also [http://talk.maemo.org/showpost.php?p=600721&postcount=1720 affects] Lehto's kernels.
+
-
# 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.
+
-
# when connected via USB the device locks the minimum frequency to 500Mhz.
+
-
# By default the device is configured to use 125MHz as the lowest frequency but it not enabled in the kernel [https://bugs.maemo.org/show_bug.cgi?id=7116 pmconfig bug]
+
-
# [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]
+
-
# 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.
+
-
# [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 JOKE!
+
-
# reading one of the temperature sensors "cat /sys/devices/platform/omap34xx_temp/temp1_input"
+
-
=Useful stuff=
+
===Analyze kernel system frequency use percentage===
 +
Written by ''rooted''
-
==Show current CPU frequency==
+
''I've stopped the development of this script and I hope someone will make use of the code. I hope titan includes it in "kernel-config show" or "kernel-config debug". -rooted''
-
awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
+
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.
 +
Temperature may not be listed if you don't have module bq27x00_battery installed or enabled. Also kernel-power version is not listed if you don't use titan's kernel.
-
==Set maximum CPU frequency==
+
<source lang="bash">
 +
#!/bin/sh
-
From root terminal:
+
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`
-
rootsh echo 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq | echo ""
+
echo -e "
 +
TIME_IN_STATE ANALYSING SCRIPT
 +
By rooted (maemo.org)
 +
Revision 7
 +
wiki.maemo.org/Overclocking
-
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
+
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
-
==Script for analyzing time_in_state (by rooted) - rev6==
+
echo -e "
 +
Kernel:                  `uname -r`
 +
kernel-power:            `dpkg -l kernel-power | awk '$2 == "kernel-power" {print $3}'`
 +
kernel-power-settings:  `dpkg -l kernel-power-settings | awk '$2 == "kernel-power-settings" {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` degrees C\n"
 +
</source>
-
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.
+
Output example:
-
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.
+
<pre>TIME_IN_STATE ANALYSING SCRIPT
 +
By rooted (maemo.org)
 +
Revision 7
 +
wiki.maemo.org/Overclocking
-
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.
 
 +
FREQUENCY      USED            WHEN BUSY
-
#!/bin/sh
+
1150 MHz        unused
-
+
1100 MHz        unused
-
currfreq=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq`
+
1000 MHz        unused
-
idlefreq=`awk '{if ($2 > 0) print $1}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | tail -n 1`
+
950 MHz        unused
-
tis1=`awk '{sum += $2} END {print sum}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
+
900 MHz        unused
-
tis2=`awk '$1 == "'"$idlefreq"'" {idle = $2} {sum += $2} END {print sum-idle}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state`
+
850 MHz        unused
-
+
805 MHz        4.5 %          58.9 %
-
echo -e "
+
750 MHz        0.0 %           0.4 %
-
SCRIPT FOR ANALYZING TIME_IN_STATE
+
700 MHz         0.0 %           0.3 %
-
By rooted (maemo.org)
+
600 MHz        0.3 %           3.4 %
-
Revision 6
+
550 MHz        0.0 %           0.5 %
-
+
500 MHz         2.8 %          36.5 %
-
The script is in active development.
+
250 MHz        92.4 %
-
Update your script to current revision from:
+
125 MHz         unused
-
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"
+
 +
Kernel:                  2.6.28.10power37
 +
kernel-power:            2.6.28-maemo37
 +
kernel-power-settings:  0.11
 +
Uptime:                  56 min
 +
Load:                    0.25, 0.12, 0.09
 +
Boot reason:            pwr_key
 +
Temperature:            31 degrees C</pre>
-
Output example:
+
===Analyze kernel system frequency use percentage, including idle mode stats===
 +
Written by ''ArbitRabbit''
-
SCRIPT FOR ANALYZING TIME_IN_STATE
+
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.
-
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)==
+
-
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.
'''scheduler_stats.sh'''
'''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`
-
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'''
+
idle0=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state0/time`
-
Current frequency: 500 MHz
+
idle1=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state1/time`
-
+
-
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.
+
idle2=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state2/time`
-
==Combined helper script (by evilJazz)==
+
idle3=`awk '{printf ("%.0f",$1/1000)}' /sys/devices/system/cpu/cpu0/cpuidle/state3/time`
-
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.
+
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>
-
This script works with the special frequency handling in Titan's kernel.
+
'''Sample Output'''
-
To run this script as user and be able to set the frequencies you will need to install "[[Root_access|rootsh]]" via apt-get.
+
<pre>Current frequency: 500 MHz
-
overclock.sh [max freq] [min freq]
+
Minimum frequency: 500 MHz
-
#!/bin/sh
+
Maximum frequency: 810 MHz
-
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:
+
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>
-
~ $ ./overclock.sh 600 250
+
Known Bugs: Requires the Phone to be booted for an hour or so before it results in decent stats.
-
Current frequency:    250 MHz
+
===Combined helper script===
-
Minimal frequency:    250 MHz
+
Written by ''EvilJazz''
-
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=
+
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.
-
==Installing a modified Kernel==
+
This script works with the special frequency handling in Titan's kernel.
-
===Flashing using PC===
+
To run this script as user and be able to set the frequencies you will need to install "[[Root_access|rootsh]]" via apt-get.
-
1. Power off the N900 completely.
+
overclock.sh [max freq] [min freq]
-
2. Hold "u" on the N900's keyboard, while holding, connect it to the PC via USB cable.
+
<source lang="bash">
 +
#!/bin/sh
 +
max=${1}000
 +
min=${2}000
-
3. You will see usb icon on top right of white Nokia screen.
+
# Handle and rewrite special cases in Titan's kernel...
 +
[ "$max" == "600000" ] && max=599000
 +
[ "$min" == "125000" ] && min=124999
-
4. Now you can let go of "u" on the keyboard.
+
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
-
5. Now use flasher utility with the kernel file located in the same directory.
+
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
 +
</source>
-
flasher-3.5 -k image_file_name -f -R
+
Output example:
 +
<pre>~ $ ./overclock.sh 600 250
-
6. It should take about 1-2 seconds then it'll say Done.
+
Current frequency:    250 MHz
 +
Minimal frequency:    250 MHz
 +
Maximal frequency:    599 MHz
-
7. Now your N900 will show white Nokia screen. (reboot)
+
  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)</pre>
-
8. At this time, you can pull out the USB cable.
+
===Underclock/Overclock when phone is locked/unlocked===
 +
Written by ''Fecn''
-
9. N900 should finish booting up if all goes well.
+
When locked, the limits are changed to 250/500 Mhz to save power - I don't need my phone to be fast when it's sitting there doing nothing. (I did try with 125 Mhz as minimum but it caused an unresponsive touchscreen during incoming phone calls and alarms)
-
10. Test out your phone as usual. (Apps, browser, camera, phone etc etc)
+
When unlocked, the limits are set for overclocking, with the max speed determined by the temperature (1150 Mhz is stable on my phone - your mileage may vary - adjust scripts as required)
-
11. If any abnormal events occur frequently (crash, hang, screen corruption etc), turn it off, flash it to a slower kernel and test again.
+
You need the dbus-scripts package installed for this to work. You also need to add bq27x00_battery to your /etc/modules so that it is loaded at boot time - it needs to be loaded to be able to read the temperature.
-
note: For Windows7 64bit users, you may need to use WindowsXP mode. ([http://www.youtube.com/watch?v=Bx6dblXl2eo Youtube Tutorial])
+
 +
Note by --[[User:joerg_rw|joerg_rw]] 18:03, 2 August 2010 (UTC):
 +
Which temperature are you trying to base that on? Anyway the bq27200 temperature is vastly useless for this purpose, as it is the die (chip) temperature of the battery charge gauge, and neither related to CPU die temperature, nor to battery cell temperature.
-
===Flashing from N900 xterminal===
+
We use the dbus-signalling to follow what the phone is doing and fire off scripts to change the limits accordingly.
-
 
+
-
* do a backup, have a pc nearby and know you are able to flash the n900 with flasher-3.5 - just in case
+
-
 
+
-
0. Launch xterminal app then type sudo gainroot (need rootsh installed)
+
-
 
+
-
1. type
+
-
softupd -vv -s --local
+
-
(thats double v)
+
-
 
+
-
2. open new terminal
+
-
 
+
-
3. type
+
-
flasher --local -f -k <kernel_zimage_file_with_path>
+
-
 
+
-
4. you see the flashing (takes some time)
+
-
 
+
-
5. type "sync" to save changes
+
-
 
+
-
6. type "reboot" and enter to restart
+
-
 
+
-
7. Test out your phone as usual. (Apps, browser, camera, phone etc etc)
+
-
 
+
-
8. 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
+
-
 
+
-
=Voltage tables=
+
-
 
+
-
One factor reducing CPU lifetime is the current it is running with.
+
-
 
+
-
<code>CPU dynamic power = capacitance * frequency * voltage^2</code> (source?)([http://en.wikipedia.org/wiki/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 [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):
+
-
 
+
-
<code>V = x * 0.0125 + 0.6</code>
+
-
 
+
-
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
+
Create the following two 1-line files inside /etc/dbus-scripts.d/ (before you need to install the dbus-scripts package)
-
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.
+
<pre>
 +
Filename: /etc/dbus-scripts.d/locked
 +
/usr/local/bin/underclock * * com.nokia.mce.signal tklock_mode_ind locked
-
==/sys/power/vdd1_opps_vsel values==
+
Filename: /etc/dbus-scripts.d/unlocked
 +
/usr/local/bin/overclock * * com.nokia.mce.signal tklock_mode_ind unlocked
 +
</pre>
-
LV:      "30 30 38 48 48 54 54 54 54 54 54 54 60 72 72"
+
... and then create corresponding scripts that they call inside /usr/local/bin/ ( don't forget to chmod them to executable )
-
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==
+
<pre>
 +
Filename: /usr/local/bin/underclock
 +
#!/bin/sh
 +
kernel-config limits 250 500
-
===Nokia's kernel===
+
Filename: /usr/local/bin/overclock 
 +
#!/bin/sh
 +
TEMP=`cat /sys/class/power_supply/bq27200-0/temp`
 +
echo "Temp is :" $TEMP "C"
 +
MAXSPEED="1150"
 +
if [ $TEMP -gt "38" ] ; then MAXSPEED="1000" ; fi
 +
if [ $TEMP -gt "40" ] ; then MAXSPEED="950" ; fi
 +
if [ $TEMP -gt "43" ] ; then MAXSPEED="850" ; fi
 +
if [ $TEMP -gt "45" ] ; then MAXSPEED="750" ; fi
 +
if [ $TEMP -gt "47" ] ; then MAXSPEED="600" ; fi
 +
echo "Setting max as :" $MAXSPEED "Mhz"
-
VALUE  VOLTAGE  FREQUENCY
+
kernel-config limits 250 $MAXSPEED
-
30    0.975V    0 MHz
+
</pre>
-
30    0.975V    125 MHz
+
-
38    1.075V    250 MHz
+
-
48    1.200V    500 MHz
+
-
54    1.275V    550 MHz
+
-
60    1.350V    600 MHz
+
-
+
-
===titan's LV kernel===
+
-
VALUE  VOLTAGE  FREQUENCY
+
You'll need to restart dbus-scripts for it to see the new configs. I found that the scripts in init.d weren't too good at doing this, so had to kill it manually each time.
-
30    0.975V    0 MHz
+
-
30    0.975V    125 MHz
+
-
38    1.075V    250 MHz
+
-
48    1.200V    500 MHz
+
-
48    1.200V    550 MHz
+
-
54    1.275V    600 MHz
+
-
54    1.275V    700 MHz
+
-
54    1.275V    750 MHz
+
-
54    1.275V    810 MHz
+
-
54    1.275V    850 MHz
+
-
54    1.275V    900 MHz
+
-
54    1.275V    950 MHz
+
-
60    1.350V    1000 MHz
+
-
72    1.500V    1100 MHz
+
-
72    1.500V    1200 MHz
+
-
===titan's ULV kernel===
+
If you want to scale your processor speed according to battery capacity in addition to temperature, use an overclock script something like the following:
-
VALUE  VOLTAGE  FREQUENCY
+
<pre>
-
25    0.912V    0 MHz
+
Filename: /usr/local/bin/overclock
-
25    0.912V    125 MHz
+
#!/bin/sh
-
25    0.912V    250 MHz
+
TEMP=`cat /sys/class/power_supply/bq27200-0/temp`
-
33    1.012V    500 MHz
+
echo "Temp is:" $TEMP "C"
-
38    1.075V    550 MHz
+
MAXSPEED="1150"
-
38     1.075V    600 MHz
+
if [ $TEMP -gt "38" ] ; then MAXSPEED="1000" ; fi
-
45    1.163V    700 MHz
+
if [ $TEMP -gt "40" ] ; then MAXSPEED="950" ; fi
-
45     1.163V    750 MHz
+
if [ $TEMP -gt "43" ] ; then MAXSPEED="850" ; fi
-
48    1.200V    810 MHz
+
if [ $TEMP -gt "45" ] ; then MAXSPEED="750" ; fi
-
48    1.200V    850 MHz
+
if [ $TEMP -gt "47" ] ; then MAXSPEED="600" ; fi
-
54    1.275V    900 MHz
+
-
54    1.275V    950 MHz
+
-
60    1.350V    1000 MHz
+
-
72    1.500V    1100 MHz
+
-
72    1.500V    1200 MHz
+
-
===titan's XLV kernel===
+
BATTERY=`cat /sys/class/power_supply/bq27200-0/capacity`
 +
echo "Battery is:" $BATTERY "% full"
 +
MAXSPEEDTWO="1150"
 +
if [ $BATTERY -lt "60" ] ; then MAXSPEEDTWO="850" ; fi
 +
if [ $BATTERY -lt "40" ] ; then MAXSPEEDTWO="600" ; fi
 +
if [ $BATTERY -lt "25" ] ; then MAXSPEEDTWO="500" ; fi
-
VALUE  VOLTAGE  FREQUENCY
+
if [ $MAXSPEEDTWO -lt $MAXSPEED ] ; then MAXSPEED=$MAXSPEEDTWO ; fi
-
30    0.975V    0 MHz
+
-
20    0.850V    125 MHz
+
-
30    0.975V    250 MHz
+
-
33    1.012V    500 MHz
+
-
38    1.075V    550 MHz
+
-
38    1.075V    600 MHz
+
-
45    1.163V    700 MHz
+
-
45    1.163V    750 MHz
+
-
48    1.200V    810 MHz
+
-
48    1.200V    850 MHz
+
-
54    1.275V    900 MHz
+
-
54    1.275V    950 MHz
+
-
60    1.350V    1000 MHz
+
-
72    1.500V    1100 MHz
+
-
72    1.500V    1150 MHz
+
-
===titan's ideal kernel===
+
echo "Setting max as:" $MAXSPEED "Mhz"
-
VALUE  VOLTAGE  FREQUENCY
+
kernel-config limits 250 $MAXSPEED
-
30    0.975V    0 MHz
+
</pre>
-
30    0.975V    125 MHz
+
-
30    0.975V    250 MHz
+
-
30    0.975V    500 MHz
+
-
33    1.012V    550 MHz
+
-
38    1.075V    600 MHz
+
-
45    1.163V    700 MHz
+
-
45    1.163V    750 MHz
+
-
48    1.200V    810 MHz
+
-
48    1.200V    850 MHz
+
-
54    1.275V    900 MHz
+
-
54    1.275V    950 MHz
+
-
60    1.350V    1000 MHz
+
-
72    1.500V    1100 MHz
+
-
72    1.500V    1150 MHz
+
[[Category:Power users]]
[[Category:Power users]]
 +
[[Category:N900]]

Latest revision as of 00:05, 24 July 2021

Contents

[edit] Reminders

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

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

This guide focuses on kernel-power v50 and above, as it introduces improvements in stability and maximum supported frequency for SmartReflex, making it highly desirable for a Maemo system that is overclocked 24/7.

[edit] Warnings

  • Overclocking WILL VOID YOUR WARRANTY. Your warranty does not cover running the device beyond the specifications.
  • The lifetime of your device WILL get reduced as a result of wikipedia:Electromigration
  • Your device might not perform properly - bizarre bugs and corruption may result from the CPU being physically unable to cope with higher frequencies (see the next point)
  • All devices are not made equal - some may be able to handle 1.15GHz daily just fine, while some may be unstable even at 720MHz.
  • You do it at your own responsibility. No whining afterwards. If you're unsure, don't do it.
  • Nokia's overclocking warning: 500 MHz 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

[edit] Lifetime, warranty and damage

  • The expected lifetime all devices is limited due to wear.
  • It is usually much longer (several years) than 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.
  • Excessive 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. See #Undervolting and voltage tables for an explanation why undervolting in fact won't help anything due to chip using SmartReflex Technology (which can not be disabled).
  • 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. Or you decide to acquire thorough electronics engineer's understanding of the issue, and study TI's papers regarding SmartReflex™ and how it works - then all the evidence for damage positively done is there already.
  • Therefore, if you are unsure and you want to avoid potential damages, do not overclock!

[edit] Overclocking, bugzilla & errors

  • Running a device overclocked for long periods of time could produce unwanted side effects, even persisting ones that won't revert when overclocking is stopped. If you are experiencing errors following overclocking and intend to report those errors to talk.maemo.org or bugzilla, please consider the following :
    • Errors induced by overclocking will not always appear to be as such.
    • It will be considered a good idea to reproduce your error / problem on a device which has never been overclocked AT ALL, before proceeding with actions regarding your problem.
    • In the event you have decided to file a bug report or open a thread about your problem, please add a note to that report, mentioning that you are or previously were in fact running your device overclocked. Please also provide details about the period and amount of overclocking used.
  • The reason for these requirements is that there are many problems pending for developer's attention. It is a huge waste of time to try and trace down an error without knowing all the facts, just to find out in the end that the particular problem was caused by a damaged hardware. If the developers know about it, they can take it into account and won't rule out a 1+1=3 problem on the reporter's device during their analysis.

[edit] Additional information and hints

  • The stock Nokia kernel uses the following frequencies: 250, 500, 550 and 600 MHz.
  • The CPU does NOT IDLE at the lowest frequency (250 MHz) but it SLEEPS at 0 MHz! 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.
  • Setting the lowest frequency to 125 MHz does NOT improve battery life. In fact, many people noticed worse battery life, instability and worse responsiveness,
  • The Phone app is closed-source and broken. During a phone call, the device's frequency is locked to 600MHz. This may be a bug, and it affects all kernels for Fremantle. After a phone call, it sets the maximum to 600 Mhz and the minimum to 250 MHz (or 125 MHz if available) regardless of the frequencies you have set. There are some workarounds present in kernel-power, however the bug may still occasionally manifest.
  • When connected via USB the device locks the minimum frequency to 500 Mhz.
  • By default the device is configured to use 125 MHz as the lowest frequency but it not enabled in the kernel pmconfig bug
  • 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 800 MHz frequency was selected. Ignore it.
  • EvilJazz had photoshopped a picture of a device being overclocked 1.7GHz. It's a prank!
  • The internal temperature sensor may be read by using the command "cat /sys/devices/platform/omap34xx_temp/temp1_input"
  • Note that the system does not have an on-die temperature sensor, and the actual CPU temperature may be higher or lower than the reading.

[edit] Installing a modified kernel

Overclocking and undervolting require installation of a custom kernel. There are two types of kernels:

[edit] Kernel-Power (recommended)

kernel-power, developed by Titan and maintained by Pali. They are compatible with PR1.2 and PR1.3, contain lots of additional features (IPv6, NAT etc) and bugfixes. In addition, they include a large set of possible frequencies (125 MHz-1.15 GHz) which can be manually set and tested without flashing a new kernel.

The defaults are set to the standard 250-600 MHz range.

This guide recommends using kernel-power v50, which at the time of writing is available in the extras catalog. Newer, more experimental kernels may be available through extras-testing or extras-devel.

[edit] Installing from the repositories

  1. Open the Application Manager
  2. Go to the "System" section, and install the package kernel-power-settings. This automatically pulls in the rest of kernel-power as dependencies.
  3. After successful installation, reboot the device.

[edit] Lehto's Kernel and other legacy 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.

[edit] Flashing from X Terminal

  • 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 X Terminal, then type
    sudo gainroot
  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'll 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.

[edit] Reverting to the Stock Kernel

If you want to revert to the stock Nokia kernel, execute:

apt-get install --reinstall kernel kernel-flasher

in X Terminal.

[edit] 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

[edit] Overclocking

Once you have installed kernel-power, you are ready to start overclocking.

  1. List available frequencies ("active frequencies")
     sudo kernel-config show 
  2. Select the lowest and highest frequencies to be used from the list of active frequencies, The kernel will use all active frequencies between and including those you selected.
  3. The following command will set the frequencies to stock:
     sudo kernel-config limits 250 600 
  4. The following command will set the maximum to the highest supported by SmartReflex. (Note that SmartReflex in kernel-power v50 only works with frequencies up to 900MHz.)
     sudo kernel-config limits 250 900 
  5. At this point, you should test system stability by launching a few programs, browsing JavaScript-heavy webpages, and playing a movie.
  6. Should you encounter no reboots, you can save your overclocking profile.
     sudo kernel-config save myprofile 
  7. You can now proceed to set your kernel profile as the default, to be loaded automatically at startup.
     sudo kernel-config default myprofile 

[edit] Undervolting

[edit] SmartReflex

[edit] Rationale

Before kernel-power v50, one would normally set voltages per frequency in a configuration file, which required manual testing to determine the lowest voltages possible for a specific frequency. This may result in reboots if the voltage was not set high enough to account for the CPU's power usage at full loads, or power wastage if the voltages were set higher than what is needed for light loads at a certain frequency. SmartReflex is a technology which automatically regulates the voltage used for the entire SoC, automatically adapting to lower voltages during light use and increase them during heavy use.

[edit] Automatic Undervolting

Once kernel-power v50 or higher is installed, enabling it is a matter of doing the following:

  1. Make a folder for your kernel profiles
     mkdir -p ~/.kernel 
  2. Copy a sane profile to your kernel profile folder
     cp /usr/share/kernel-power-settings/default ~/.kernel/myprofile 
  3. Edit the profile to enable SmartReflex
     nano ~/.kernel/myprofile 
  4. Look for the lines:
     SMARTREFLEX_VDD1=0 SMARTREFLEX_VDD2=0
  5. Edit them to the following:
    SMARTREFLEX_VDD1=1 SMARTREFLEX_VDD2=1
  6. Save the file by pressing Ctrl+X, and confirm with Y then press Enter.
  7. Test the profile
     sudo kernel-config load myprofile 
  8. At this point, you'd want to stress the CPU a bit. Launch a few programs, visit JS-heavy websites, etc.
  9. If the device does not reboot and you feel safe using the profile, set it as the default.
     sudo kernel-config default myprofile 
  10. Congratulations, the kernel is now doing all the work for you.

[edit] Manual Undervolting (Legacy)

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 dynamic frequency scaling.

CPU dynamic power consumption = capacitance * frequency * voltage^2

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. Alas, this claim only holds true for architectures not regulating the real voltage and current in special on chip regulators, like OMAP is known to do for almost every gate in their CPU and other SoC function blocks. TI calls this feature SmartReflex™ and lowering the voltage applied to the whole SoC, like suggested here, only reduces the voltage drop across these regulators, thus no positive effect on electromigration damage caused by overclocking is to be expected.

[edit] Calculating Voltages

According to these 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

[edit] Voltage Table

  • V²/us for frequencies 720 and 805 need to be recalculated.
  • Bolded steps indicate the first frequency in the kernel which needs overvoltage. All frequencies after it are overvolted.
Frequency Nokia LV ULV XLV ideal starving
0 MHz 30 30 25 30 30 22
0.975V, 0.000 V²/us 0.975V, 0.000 V²/us 0.912V, 0.000 V²/us 0.975V, 0.000 V²/us 0.975V, 0.000 V²/us
125 MHz 30 30 25 20 30 22
0.975V, 288.906 V²/us 0.975V, 118.828 V²/us 0.912V, 103.968 V²/us 0.975V, 118.828 V²/us 0.975V, 118.828 V²/us
250 MHz 38 38 25 30 30 28
1.075 V, 118.828 V²/us 1.075 V, 118.828 V²/us 0.912V, 207.936 V²/us 0.975V, 237.656 V²/us 0.975V, 237.656 V²/us
500 MHz 48 48 33 33 30 29
1.200 V, 720.000 V²/us 1.200 V, 720.000 V²/us 1.012V, 512.072 V²/us 1.012V, 512.072 V²/us 0.975V, 475.312 V²/us
550 MHz 54 48 38 38 33 32
1.275 V, 894.094 V²/us 1.200 V, 792.000 V²/us 1.075V, 635.594 V²/us 1.075V, 635.594 V²/us 1.012V, 563.279 V²/us
600 MHz 60 54 38 38 38 34
1.350 V, 1093.500 V²/us 1.275 V, 975.375 V²/us 1.075V, 693.375 V²/us 1.075V, 693.375 V²/us 1.075V, 693.375 V²/us
720 MHz 54 45 45 45 42
1.275 V, 1137.938 V²/us 1.163 V, 1014.427 V²/us 1.163 V, 1014.427 V²/us 1.163 V, 1014.427 V²/us
805 MHz 54 48 48 48 45
1.275 V, 1316.756 V²/us 1.200 V, 1166.400 V²/us 1.200 V, 1166.400 V²/us 1.200V, 1166.200 V²/us
850 MHz 54 48 48 48 46
1.275 V, 1381.781 V²/us 1.200 V, 1224.000 V²/us 1.200 V, 1224.000 V²/us 1.200V, 1224.000 V²/us
900 MHz 54 54 54 54 49
1.275 V, 1463.062 V²/us 1.275V, 1463.062 V²/us 1.275V, 1463.062 V²/us 1.275 V, 1463.062 V²/us
950 MHz 54 54 54 54 52
1.275 V, 1544.344 V²/us 1.275 V, 1544.344 V²/us 1.275 V, 1544.344 V²/us 1.275 V, 1544.344 V²/us
1000 MHz 60 60 60 60 55
1.350 V, 1822.500 V²/us 1.350 V, 1822.500 V²/us 1.350 V, 1822.500 V²/us 1.350 V, 1822.500 V²/us
1100 MHz 72 72 72 72 63
1.500 V, 2475.000 V²/us 1.500 V, 2475.000 V²/us 1.500 V, 2475.000 V²/us 1.500 V, 2475.000 V²/us
1150 MHz 72 72 72 72 69
1.500 V, 2700.000 V²/us 1.500 V, 2700.000 V²/us 1.500 V, 2700.000 V²/us 1.500 V, 2700.000 V²/us

[edit] Useful scripts

[edit] Analyze kernel system frequency use percentage

Written by rooted

I've stopped the development of this script and I hope someone will make use of the code. I hope titan includes it in "kernel-config show" or "kernel-config debug". -rooted

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.

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

#!/bin/sh
 
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 "
TIME_IN_STATE ANALYSING SCRIPT
By rooted (maemo.org)
Revision 7
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 "
Kernel:                  `uname -r`
kernel-power:            `dpkg -l kernel-power | awk '$2 == "kernel-power" {print $3}'`
kernel-power-settings:   `dpkg -l kernel-power-settings | awk '$2 == "kernel-power-settings" {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` degrees C\n"

Output example:

TIME_IN_STATE ANALYSING SCRIPT
By rooted (maemo.org)
Revision 7
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         unused
805 MHz         4.5 %           58.9 %
750 MHz         0.0 %           0.4 %
700 MHz         0.0 %           0.3 %
600 MHz         0.3 %           3.4 %
550 MHz         0.0 %           0.5 %
500 MHz         2.8 %           36.5 %
250 MHz         92.4 %
125 MHz         unused

Kernel:                  2.6.28.10power37
kernel-power:            2.6.28-maemo37
kernel-power-settings:   0.11
Uptime:                  56 min
Load:                    0.25, 0.12, 0.09
Boot reason:             pwr_key
Temperature:             31 degrees C

[edit] Analyze kernel system frequency use percentage, including idle mode stats

Written 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.

[edit] Combined helper script

Written 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)

[edit] Underclock/Overclock when phone is locked/unlocked

Written by Fecn

When locked, the limits are changed to 250/500 Mhz to save power - I don't need my phone to be fast when it's sitting there doing nothing. (I did try with 125 Mhz as minimum but it caused an unresponsive touchscreen during incoming phone calls and alarms)

When unlocked, the limits are set for overclocking, with the max speed determined by the temperature (1150 Mhz is stable on my phone - your mileage may vary - adjust scripts as required)

You need the dbus-scripts package installed for this to work. You also need to add bq27x00_battery to your /etc/modules so that it is loaded at boot time - it needs to be loaded to be able to read the temperature.

Note by --joerg_rw 18:03, 2 August 2010 (UTC): Which temperature are you trying to base that on? Anyway the bq27200 temperature is vastly useless for this purpose, as it is the die (chip) temperature of the battery charge gauge, and neither related to CPU die temperature, nor to battery cell temperature.

We use the dbus-signalling to follow what the phone is doing and fire off scripts to change the limits accordingly.

Create the following two 1-line files inside /etc/dbus-scripts.d/ (before you need to install the dbus-scripts package)

Filename: /etc/dbus-scripts.d/locked 
/usr/local/bin/underclock * * com.nokia.mce.signal tklock_mode_ind locked

Filename: /etc/dbus-scripts.d/unlocked
/usr/local/bin/overclock * * com.nokia.mce.signal tklock_mode_ind unlocked

... and then create corresponding scripts that they call inside /usr/local/bin/ ( don't forget to chmod them to executable )

Filename: /usr/local/bin/underclock 
#!/bin/sh
kernel-config limits 250 500

Filename: /usr/local/bin/overclock  
#!/bin/sh
TEMP=`cat /sys/class/power_supply/bq27200-0/temp`
echo "Temp is :" $TEMP "C"
MAXSPEED="1150"
if [ $TEMP -gt "38" ] ; then MAXSPEED="1000" ; fi
if [ $TEMP -gt "40" ] ; then MAXSPEED="950" ; fi
if [ $TEMP -gt "43" ] ; then MAXSPEED="850" ; fi
if [ $TEMP -gt "45" ] ; then MAXSPEED="750" ; fi
if [ $TEMP -gt "47" ] ; then MAXSPEED="600" ; fi
echo "Setting max as :" $MAXSPEED "Mhz"

kernel-config limits 250 $MAXSPEED

You'll need to restart dbus-scripts for it to see the new configs. I found that the scripts in init.d weren't too good at doing this, so had to kill it manually each time.

If you want to scale your processor speed according to battery capacity in addition to temperature, use an overclock script something like the following:

Filename: /usr/local/bin/overclock
#!/bin/sh
TEMP=`cat /sys/class/power_supply/bq27200-0/temp`
echo "Temp is:" $TEMP "C"
MAXSPEED="1150"
if [ $TEMP -gt "38" ] ; then MAXSPEED="1000" ; fi
if [ $TEMP -gt "40" ] ; then MAXSPEED="950" ; fi
if [ $TEMP -gt "43" ] ; then MAXSPEED="850" ; fi
if [ $TEMP -gt "45" ] ; then MAXSPEED="750" ; fi
if [ $TEMP -gt "47" ] ; then MAXSPEED="600" ; fi

BATTERY=`cat /sys/class/power_supply/bq27200-0/capacity`
echo "Battery is:" $BATTERY "% full"
MAXSPEEDTWO="1150"
if [ $BATTERY -lt "60" ] ; then MAXSPEEDTWO="850" ; fi
if [ $BATTERY -lt "40" ] ; then MAXSPEEDTWO="600" ; fi
if [ $BATTERY -lt "25" ] ; then MAXSPEEDTWO="500" ; fi

if [ $MAXSPEEDTWO -lt $MAXSPEED ] ; then MAXSPEED=$MAXSPEEDTWO ; fi

echo "Setting max as:" $MAXSPEED "Mhz"

kernel-config limits 250 $MAXSPEED