Palm Pre Hack To Significantly Extend Battery Life

Okay, we at L337Tech have replace our iPhones out of sheer bordem (had iphone for 2 years and am now bored with it). We now have Palm Pre’s. I love my Palm Pre but was not happy with the battery life. Luckily the Palm Pre is the easiest phone to hack ever. Heck, to access developer mode you type in the konami code, come on thats awesome!! I wrote some code that uses power saving features built into the linux operating system used by the Pre. This has literally increased my battery life by 40%. It is only a matter of time before Palm sees this and writes their own power saving script. But as of right now the Pre has now power saving features so use my code.

This is basically a repost of the work i did in the forums of PreCentral.net

Okay i have been doing extensive testing. I believe i have solved most of the problems related to cpu scaling.

noted problems:
1. Video playback flickers and can be choppy
3. Phone freezes usually in standby or some other low state like listening to pandora in standby.
2. Can force the phone to have a 250mhz minimum instead of 125Mhz minimum

Fixes:
Two new scaling schemes. The first uses 1 second sampling rates and an 11% cpu utilization speed up threshold. The second method uses powersave_bias to turn on the 250mhz minimum (this will cause the phone to quit going down to 125Mhz, it goes down to 250Mhz instead during standby or other lowly states)

The fist scheme fixes video playback and phone freezes during lowly states, but does not fix the 250Mhz minimum problem so you phone will use 125Mhz for its lowly state.

The second scheme fixes phone freezes during lowly states like standby and Pandora, and makes 250Mhz the minimum cpu frequency. This method does not fix video playback flickering issues.

Here is the code:

First scheme (my favorite and the one im currently using)
assumes you are at root@castle:/#

echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 500000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 250000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 11 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate

Second scheme (not my favorite because of video flicker and other reasons i will explain latter but it does utilize the 250mhz low state which is a little snappier than 125Mhz)
assumes you are at root@castle:/#

echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 500000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 250000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 11 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
echo 10000000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias

The main problem with the methods people were doing before is that the chip was switching between low and high state several times over the course of a few second no matter if they were playing a video or pandora. The first scheme above fixes that issue. The second scheme still suffers from this but i tried to lessen its severity by changing the sampling rate to 10 seconds (in reality it seems like 2 seconds durring testing). 10 seconds was the lowest i could go without it wanting to change states from low to high several times in a few seconds. There is something wrong with the powersave_bias function that makes it switch states faster than the sampling rate. I am looking into possible workarounds.

I would have liked to make the speed up threshold 5% but the lowest the up_threshold function would let me choose is 11%. 5% is usually low enough to have the phone running full power during pandora. Your phone is almost always lower than 5% during standby or when not doing anything on your phone.

If you want these codes to stick after a reboot then you will need to prepare a script in vi editor inside you pre’s linux system in the format similar to how they did it at pre dev wiki here

scroll down the page till you see how they made it stick. Just change the code to the codes in the post, but you need to change the format slightly. If you dont know how to do this then you do not need to be trying anything mentioned in this post.

And as always i am not responsible for any damage this may cause you. But the consensus is that the ondemand scaling function is pretty harmless to your phone. Freezes are fixed by unplugging you battery. If you want to be extra careful then just run these codes without making a script. That way when you reboot everything goes back to defaults from palm for the cpu.

If anyone can get powersave_bias stable let me know what you did. I was using trans_table in the /cpufreq/stats folder and also time_in_state within the same folder. Another usefull tool is cpuinfo_cur_freq within the /cpufreq folder. Also use top command to monitor your cpu utilization, this command can be executed anywhere within linux.

I have decided to include some code that will help anyone if they decide to do their own testing of cpu scaling and power save bias. Here is the code I use for testing:

current speed
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
time in different frequencies
cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
number of switches between power states
cat /sys/devices/system/cpu/cpu0/cpufreq/stats/trans_table
current sampling rate
cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
current up threshold
cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
current power save bias
cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias
current max freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
current min freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

turn off power save bias
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias

overclocking
echo 550000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 1500000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate

good luck

-L337Tech

15 Responses to “Palm Pre Hack To Significantly Extend Battery Life”

  1. jregehr Says:

    i just got my phone…how do i put these scripts on it? I know computers and stuff- I am a college student but have no idea how to use these scripts you wrote out. Can you explain it so i can understand? Thanks

  2. Steven Rosson Says:

    You need to gain root access to your Pre before you do this. There are several articles about it: I suggest Googling the phrase “how to root Palm Pre” without quotes for some detailed instructions.

    Once you root it, you should be able to access the shell as root@castle, at which point you can paste these commands.

  3. Chicago Locksmith Says:

    i thinking of switching to the palm pre from blackberry. some tell do it others tell go with iPhone what should i do?

  4. abiezerf Says:

    Go to Precentral.net for details. Install PreWare and right off you can install this with a patch.

  5. Fort Lauderdale Locksmith Says:

    i swtiched from the Palm Pre to the blackberry. The batterey life really sucked.

  6. Kittens Says:

    My friend has bought a iphone recently. He might need this information. I will recommend it to him.

  7. swedish3 Says:

    test

  8. Angelie Says:

    test

  9. teresa Says:

    good.

  10. laptop battery Says:

    High Quality–The laptop batteries and adapter are rigorously tested for voltage, capacity, compatibility and safety to exceed original equipment manufacturer specifications.

  11. jordan shoes Says:

    Hhe article’s content rich variety which make us move for our mood after reading this article. surprise, here you will find what you want! Recently, I found some wedsites which commodity is colorful of fashion. Such as that worth you to see. Believe me these websites wont let you down. cheap uggs

  12. Car Games Says:

    I've been Googling all day and I still don't know which system is better for my site; Disqus or Echo? or even maybe Intense Debate.

  13. uggs outlet Says:

    “Well , the coach outlet view of coach handbags the passage is totally correct ,your details is really reasonable and you guy give us valuable informative post, I totally agree the standpoint of upstairs. I often surfing on this forum when I m free and I find there are so much good information we can learn in this forum!
    nike dunk

  14. ugg boots Says:

    Here elaborates the matter not only extensively but also detailly .I support the
    write's unique louis vuitton bags point.It is useful and benefit to your daily life.You can go those
    sits to know more relate things.They are strongly recommended by friends.Personally
    I feel quite well.

  15. Millerguy Says:

    i would love to get help on increasing the battery life of my phone but i cant seem to get it correct. help would be immensely appreciated

Leave a Reply

You must be logged in to post a comment.