TWRP for Nexus 6 and 9 Available, Unofficial CM12 Alpha for HTC Explorer! – XDA TV

Team Win Recovery Project for the Nexus 6 and Nexus … more

Jolla Tablet Announced: The Second Sailfish OS Device

A little over a year ago, Jolla released its first smartphone with the brand new Jolla … more

Android One Devices Get Unofficial CM12 Port

Android One was initially announced right before Android Lollipop. By releasing these cheap, yet … more

WhatsApp Decides to Protect Your Data

When Facebook bought WhatsApp for the absurdly large sum of $19bn back in February, they took the tech … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Thread Closed

[KERNEL] 1497MHz Permanent overclock kernel with intermediate speeds!

OP coolbho3000

9th November 2010, 08:40 PM   |  #1  
OP Senior Recognized Developer
Thanks Meter: 764
 
886 posts
Join Date:Joined: Dec 2008
More
Now that we have permanent root, we can have even more fun with overclocking. This is an actual kernel, not a module, meaning that there are no scripts to run every time you restart the device, and there are a lot more speeds to choose from, from 806MHz all the way up to 1497MHz.

Just run SetCPU (set on boot will work if you have permanent root!) and set the speed to whatever you want. This is purely an overclocking kernel and is not undervolted, but undervolting is easy for other devs. Just tweak the frequency tables and recompile.

We can now properly changes voltages! With voltage increases, it is possible to push the G2 to absolutely ludicrous speeds. I've limited this kernel to 1497MHz, but I've seen speeds as high as 1.7GHz (!!!) at 1400mV. It scales remarkably in most benchmarks, too. The MSM7x30 chipset is a true overclocking champion.

For safety, this kernel defaults to 806MHz at boot (like overclocking kernels on most other devices). Use SetCPU (in my sig or on the Market) to tweak speeds precisely. (Devs: the max frequency on boot can also be adjusted in the modified cpufreq.c file).

I am not responsible for any damage these instructions or this software may cause!

Installation

I recommend flashing Cyanogen's BaconBits which contains this, more CPU governors, a newer kernel, no wifi bug, and other goodies: http://forum.xda-developers.com/showthread.php?t=834565. The binaries below are not necessary if you flash BaconBits. You'll get the overclock anyway!

Github: https://github.com/coolbho3k/vision_oc_kernel
Binaries: http://pokedev.com/setcpu/vision_oc_kernel_2.zip
Mirror: http://dl.dropbox.com/u/36553/vision_oc_kernel_2.zip

If you want to install using the old method and the binaries I posted above:

Boot into fastboot. Using the fastboot utility, run:

fastboot flash zimage zImage

Where "zImage" is the path to the zImage posted in the zip above.

You'll notice at first that your wifi doesn't work. Don't worry! In Android:

adb push bcm4329.ko /sdcard/bcm4329.ko
adb shell
su
mount -o remount,rw /dev/block/mmcblk0p25 /system
cat /sdcard/bcm4329.ko > /system/lib/modules/bcm4329.ko

EDIT: argh, I keep forgetting our ro.secure is still 1. Fixed the instructions.

Where "bcm4329.ko" is the path to the wifi module posted in the zip above. Then reboot and enjoy.

Have fun guys. This was a lot less of a pain to make than the module and I only had to actually write like three lines of code.

Developers: customizing the overclocked speeds and voltages
Just add lines to the struct acpu_freq_tbl. There are no L values to worry about unlike the 8x50 platform (this time, we automatically detect the required L value), but remember that each speed must be a multiple of 19200. The only thing you need to worry about is the voltage and the VDD_RAW:
Code:
...
{ 1017600, PLL_2,   3, 0,  192000, 1200, VDD_RAW(1200) },
{ 1113600, PLL_2,   3, 0,  192000, 1200, VDD_RAW(1200) },
{ 1209600, PLL_2,   3, 0,  192000, 1200, VDD_RAW(1200) },
{ 1305600, PLL_2,   3, 0,  192000, 1200, VDD_RAW(1200) },
{ 1401600, PLL_2,   3, 0,  192000, 1300, VDD_RAW(1300) },
{ 1497600, PLL_2,   3, 0,  192000, 1300, VDD_RAW(1300) },
...
For a lower voltage, in this case 1100mV, at 1017.6MHz:
Code:
{ 1017600, PLL_2,   3, 0,  192000, 1100, VDD_RAW(1100) },
For 1.7GHz @1400mV (warning: only tested once, and the phone got very hot. I would not recommend this ) edit: actually, 1350mV is the max you can go, I don't know what I was thinking, but this works anyway:
Code:
{ 1708800, PLL_2,   3, 0,  192000, 1400, VDD_RAW(1400) },
Then add the speeds you actually want to use to the freq_table struct, remembering to keep incrementing the first column as you go down.
Code:
...
{ 4, 1017600 },
{ 5, 1113600 },
{ 6, 1209600 },
{ 7, 1305600 },
{ 8, 1401600 },
{ 9, 1497600 },
...
How it works
The G2's CPU speeds are based on the clock output of one of several PLLs. In the default MSM7x30 configuration, the 806.4MHz speed is based on PLL2, which also runs at 806.4MHz by default. (the MSM8x55 is an identical SoC, but runs PLL2 at 1017.6MHz. There is also a 1.2GHz version of the 8x55 floating around somewhere! The stock kernel for the 8x55 reports 1024MHz as the speed, but I think this is off by a few MHz).

So to overclock, we have to change the output of PLL2. The output of PLL2 is based on the speed of TCXO, which runs at 19.2MHz. The output of PLL2 is defined as 19.2 multiplied by an integer at the address MSM_CLK_CTL_BASE + 0x33c, called the L value. By manipulating this multiplier, we can also safely manipulate the output of PLL2, and as a result, safely manipulate the CPU speed when cpufreq switches us to a speed that uses PLL2. I was able to figure out the location of the PLL2 L value using this commit on Code Aurora. Turns out the address is the same as it is on the MSM7200 platform!

My previous kernel module hack that we used did this kind of inelegantly. It wrote a new multiplier to PLL2 and basically corrected cpufreq so that it (correctly) thought that this speed was no longer 806.4MHz. It required the addresses of several data structures in the kernel because it needed to know where to manipulate cpufreq. However, since our module could only change PLL2 once and not every time there is a frequency switch, we could only have one overclocked speed. If we overclocked to 1.42GHz, we lost 806.4MHz and everything in between.

The ability to flash kernels, however, makes our lives a lot easier. Without the need to hack kernel memory to get it to do what we want, overclocking practically requires only four lines of code:

From there, changes to the frequency table to define speeds/voltages is rather trivial.

Code:
#define PLL2_L_VAL_ADDR  (MSM_CLK_CTL_BASE + 0x33)
...
/* Program PLL2 L val for overclocked speeds. */
	if(s->src == PLL_2) {
		writel(s->acpu_clk_khz/19200, PLL2_L_VAL_ADDR);
	}
The above runs during frequency switching. It basically checks if the speed we're switching to runs on PLL2, and if it does, we write the value equal to (clock speed we want)/19200 to the L value address. A much simpler solution, and much more flexible, than the kernel module method. Thank god for permaroot (or just scotty and #g2root)
Last edited by coolbho3000; 12th November 2010 at 03:47 AM.
9th November 2010, 08:43 PM   |  #2  
ChiefzReloaded's Avatar
Recognized Developer
Flag Lebanon, OR
Thanks Meter: 216
 
237 posts
Join Date:Joined: Jan 2010
Donate to Me
More
Ahhh... first post lol.... Thanks man, flashed and works great +1
9th November 2010, 08:50 PM   |  #3  
TL24's Avatar
Senior Member
Minneapolis, MN
Thanks Meter: 17
 
555 posts
Join Date:Joined: Oct 2010
More
Excuse a NOOB - but how do you boot into fastboot? Is that Volume Down + Power Button?

EDIT:

Nevermind I got it, but when I do "adb push bcm4329.ko /system/lib/modules/bcm4329.ko" I get the following:

failed to copy 'bcm4329.ko' to '/system/lib/modules/bcm4329.ko': Permission denied

However I am fully rooted, any ideas?
Last edited by TL24; 9th November 2010 at 09:02 PM.
9th November 2010, 08:54 PM   |  #4  
Senior Member
Thanks Meter: 25
 
263 posts
Join Date:Joined: Mar 2009
thanks for the post.
9th November 2010, 09:03 PM   |  #5  
Senior Member
Thanks Meter: 25
 
263 posts
Join Date:Joined: Mar 2009
Quote:
Originally Posted by TL24

Nevermind I got it, but when I do "adb push bcm4329.ko /system/lib/modules/bcm4329.ko" I get the following:

failed to copy 'bcm4329.ko' to '/system/lib/modules/bcm4329.ko': Permission denied

However I am fully rooted, any ideas?

i get read-only file system. i tried to chmod the modules folder but i get the same error.
9th November 2010, 09:08 PM   |  #6  
OP Senior Recognized Developer
Thanks Meter: 764
 
886 posts
Join Date:Joined: Dec 2008
More
Ah oops, you'll have to remount system as rw first. Adding to topic.
9th November 2010, 09:11 PM   |  #7  
TL24's Avatar
Senior Member
Minneapolis, MN
Thanks Meter: 17
 
555 posts
Join Date:Joined: Oct 2010
More
Quote:
Originally Posted by coolbho3000

Ah oops, you'll have to remount system as rw first. Adding to topic.

Is that while we're still in fastboot?
Last edited by TL24; 9th November 2010 at 09:18 PM.
9th November 2010, 09:16 PM   |  #8  
Senior Member
Thanks Meter: 24
 
406 posts
Join Date:Joined: Sep 2009
More
Works great, thanks!

fastboot just for the zImage

adb push or Root Explorer or Terminal Emulator to cp the wifi file.

I used terminal emulator...

Code:
su
mount -o remount,rw /dev/block/mmcblk0p25 /system
cp /sdcard/bcm4329.ko /system/lib/modules/bcm4329.ko
mount -o remount,ro /dev/block/mmcblk0p25 /system
WiFi is working fine now...
9th November 2010, 09:16 PM   |  #9  
Senior Member
Thanks Meter: 6
 
183 posts
Join Date:Joined: Aug 2009
Quote:
Originally Posted by TL24

Is that while we're stillin fastboot?

I can't get mount to work in adb
9th November 2010, 09:18 PM   |  #10  
OP Senior Recognized Developer
Thanks Meter: 764
 
886 posts
Join Date:Joined: Dec 2008
More
Heh, whoops, did I get the system mount command wrong? Fixed it.

Thread Closed Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes