Monday, January 31, 2011

Advanced overclocking for DroidX

If you know your way around android terminal, overclocking your Droid X without a helper app is really not that difficult.  Here are the steps:
  1. Download and install Milestone Overclock (this is just so you can grab the kernel module).
  2. Find overclock.ko from the milestone directory and move/copy it over to /system/lib/modules.  You can optionally uninstall Milestone Overclock now - you no longer need it.
  3. Run the following script (be sure to substitute A, B, C, D with your own vsels, and W, X, Y, Z with your own frequencies).

    #!/system/bin/sh
    insmod /system/lib/modules/overclock.ko
    echo 0xc05a8dcc > /proc/overclock/mpu_opps_addr
    echo 0xc0048a00 > /proc/overclock/omap2_clk_init_cpufreq_table_addr
    echo 0xc059b258 > /proc/overclock/cpufreq_stats_table_addr
    echo 0xc02d1104 > /proc/overclock/cpufreq_stats_update_addr
    echo D > /proc/overclock/max_vsel
    echo Z00000 > /proc/overclock/max_rate
    echo 1 W00000000 A > /proc/overclock/mpu_opps
    echo 2 X00000000 B > /proc/overclock/mpu_opps
    echo 3 Y00000000 C > /proc/overclock/mpu_opps
    echo 4 Z00000000 D > /proc/overclock/mpu_opps
    echo 0 Z00000 > /proc/overclock/freq_table
    echo 1 Y00000 > /proc/overclock/freq_table
    echo 2 X00000 > /proc/overclock/freq_table
    echo 3 W00000 > /proc/overclock/freq_table
My values: W = 3, X = 6, Y = 9, Z = 12, A = 22, B = 33, C = 48, D = 63

If you want the new settings to stick at boot, you'd want to put the script in /etc/init.d somewhere.  You can name it 99overclock or something like that.

As for how you can determine the best frequencies and vsels, you'll have to experiment.  If you're lazy, I recommend using something like Quickclock - the developer, Paul, is an awesome guy. :)

Finally, here's a nice trick.  The numbers in the following file will tell you your usage pattern per frequency:
/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
Here's an example:
bash-3.2# cat  /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
1200000 1424737
900000 87456
600000 182945
300000 4688410
You will notice that your phone spends most of the time at the lowest clock frequency and rarely will it use the middle ones.  Interesting, but expected.

2 comments:

  1. What exactly does this section of code do,

    echo 0xc05a8dcc > /proc/overclock/mpu_opps_addr
    echo 0xc0048a00 > /proc/overclock/omap2_clk_init_cpufreq_table_addr
    echo 0xc059b258 > /proc/overclock/cpufreq_stats_table_addr
    echo 0xc02d1104 > /proc/overclock/cpufreq_stats_update_addr

    My phone won't overclock with it in there but will without that particularly line of code, i'm confused

    ReplyDelete