[G2 and Desire Z Android Development] nik3r:
Changelog

NIKER's UnderVolting Tools Manual

Friendly warning: If you use this guide with any ROM or Kernel other than EliteMod and need to ask a question here - mention your ROM and Kernel in your post or I can't help you.

Be aware: This guide and the default voltage file assume you are using EliteKernel, other kernels will require different starting point voltage table.

Introduction:

By undervolting I mean decreasing voltages at which your CPU operates on specific frequencies.

If done properly, this can lead to dramatic increase of battery life with no performance loss, it also decreases CPU temperatures.

If done wrong, this can lead to freezes, graphic stuttering under heavy load or unability to boot without reflashing. Do a nandroid backup NOW!

I take no responsibility for your modifications, burned CPUs due to too high voltage and/or frequency, data loss, nuclear explosions, your girlfriend breaking up with you etc. You know the drill.

You should know this takes time - a lot of time. I spent 3 long evenings optimizing my table but I didn't have these tools to help.

You should also know this has to be done just once and you can reap the benefits of insane battery life with any ROM or kernel that supports undervolting - forever.

Essentials:

I am assuming you have a Windows PC at hand. SetCPU installed (disable profiles and on boot for safety), YouTube installed and Angry Birds or similar graphically intensive game of your liking for stability testing.

Next download the UV_TOOLS package I provided above, extract it somewhere and let me explain what each file does:

tools folder just contains ADB essentials and a simple free unix-capable text editor

voltages.txt - this is THE file you are going to edit and consequently THE file you never want to lose after you are done.

voltages.default.txt - this is a copy of the starting point for your convenience

start_edit.bat - this will open the voltages.txt file in an improved text editor capable of unix line endings, we are going to use this editor to make modifications to the voltage table within voltages.txt. Windows notepad is not sufficient for this task!

undervolt_temp.bat, undervolt_temp_periodic.bat - these two files are your best friends, they will push the voltages.txt to your device and apply it temporarily. It's effects will be lost after reboot. Periodic variation will push the file every 10 seconds, allowing you to always have the latest saved version of your voltage table on your device. Some may prefer the normal variant that will only re-push on a keystroke.

undervolt_persistent.bat - be careful with this baby, it does the same job as undervolt_temp.bat, but permanently so, simple reboot will no longer save your ass after you use this. You don't need to wait until you have all 4548648 frequencies optimized but do not use this unless you are pretty sure you have a stable voltage table.

remove_screwup.bat - did you just use undervolt_persistent.bat and your vision threw it back in your face and wouldn't boot? This will save you - 100% guaranteed.

Step by step guide:

First send your girlfriend to sleep, get a huge cup of tea, kick back, run a movie and connect your device, this is gonna be a long night and a lot of reboots.

Do a nandroid backup. Copy it to your PC, **** happens and we don't want that.

Run start_edit.bat - voltages.txt will open, this is not the stock voltage table, it is my own table with +25 overvolt added to every entry. Let's take a look:

echo '245760 900' > ./vdd_levels

...this says that for frequency of 245MHz the voltage will be 900mV. Valid voltages for vision are ranging from 750 to 1525.

Our objective is to find the LOWEST stable voltage for each frequency (yes - I know there's a lot of them). If you set it too low, your device will freeze and you will need to pull the battery and reboot (suggest removing your battery cover now). Too high frequency should not freeze your device but they will increase operational temperatures slightly and of course battery drain.

As I said the provided voltages.txt is specific for my device with slight overvolt, so let's see if your device can handle it or not - run undervolt_temp.bat to push and activate the default table. SetCPU to 122-1036 ondemand. Now if by now the device haven't froze, it's a good sign.

Next step we will test stability - connect to wifi and disconnect charger. Run youtube app, run a demanding test video with high quality - in high quality mode. The video should not stutter weirdly and the device should not freeze. Actually everyting should be pretty much normal. After 30s try to run your game instead for a half minute. After that hit the power button, let the device sleep for 30s and then try to wake it from standby. Should any of these steps fail, edit the voltages.txt, increase all the voltages by 25, push the changes and try the stabily test again.

Everything went smoothly? Well congratulation, you have taken the first step towards awesomeness. These settings should already improve your battery life compared to stock.

But we want moar battery! There's never enough when it comes to battery life. Well here it comes.

Take frequency 122880, it is the lowest ever used by your device out of standby. We currently have it set to 825, so let's try 800. Save the file and push the voltages to the device if you're not using periodic updater. Now SetCPU to 122-192 ondemand- it will be slow and tedious, frequencies below 768 can't run videos well so just play with your device a bit and watch for a total freeze. Short freezes that fix themselves are to be expected at those speeds. The good thing is, if your device starts suffering from sleep of death - the culprit is most likely one of these two frequencies - remember that.

Everything went well? Set all frequencies below 122880 to 800 as well. If not, leave them all at 825. Going any lower than 775 is asking for a sleep of death - just don't :)

Don't forget to always save voltages (floppy button) and then push them using the bat or use the periodic update - otherwise your changes have no effect, obviously.

Now move to the next frequency 192000 and set it -25 to 850. Leave SetCPU at 122-192 ondemand- we always want two adjacent frequencies switching while testing - it is during this frequency change when the device is most likely to freeze. It also triangulates the problem to these two frequencies, making it easy to fix a problem. Test stability by whatever means - no videos yet. If everything works you can try for 825.

Do this for every frequency up to 768.

Undervolt 122-192 then 245-368 then 768-806.

By now you have the sleep frequencies covered and your device should last incredibly long on standby.

Now optimize each and every frequency up to the maximum you want to use on daily basis. For 768MHz and more use additional video stress test.

Hints:

Never lower voltage more than 25 at a time between tests.

Always test with ondemand between previous and current frequency to ensure stability.

Consequently never lower more than two adjacent frequencies in one step - and even that is unsafe (but twice as fast, obviously), missing one unstable frequency means long and tedious testing process to find the culprit - you have been warned so don't try to cheat :D

Best tests for stability are streaming movies, they stress every component to the limits much more than any synthetic test. Even when SetCPU stability tests succeed, video streams tend to have much lower tolerance for low voltages - the video will stutter before it's even low enough to freeze whole device, do not underestimate this. Also do not mistake buffer stuttering for a CPU problem, the device would eventually freeze if it's CPU, stay close to your wifi AP.

Secondary test could be a game that doesn't stress the device as much - that will test frequency switching. Angry birds worked well for me and its fun :D

SetCPU profiles:

when you've finally built your own stable undervolting table up to your maximum desired frequency, you can maximize the impact of your hard work on battery by aligning the max frequencies to your specific voltage peaks. (example: if there are 3 different frequencies stable on the same voltage, always use only the fastest of the group)

Does your table look like this?

echo '368640 875' > ./vdd_levels
echo '768000 875' > ./vdd_levels

In this case always use 768 instead of 368 in setCPU where possible!

Higher frequency will do same work much faster

and in turn the CPU can sleep longer - saving battery.