Thus it would be nice to have some way for the user to individually adjust the bus speed to match the overclocking capabilities of their device. Unfortunately with TEUV the bus speed has to be defined on compilation time thus the only way would be to release different versions with different bus speeds which, frankly, would be a pain in the ass. So I implemented a way to change the bus speed on-the-fly while the device is running. In contrast to TEUV not only the bus speed for the maximum frequency but for all states is increased by the same percentage (might change this later, especially for the minimum state).
In '/sys/class/misc/liveoc' change the performance by passing a value from 100 to 120 to 'oc_value' (100 = stock performance, 120 = +20% performance; 100 is default). The bus speed and frequencies for all states will be adjusted accordingly.
I am currently running my Nexus with an increased performance +10% using the stock frequencies 100->110, 200->220, 400->440, 800->880 and 1000->1100 and after increasing the voltage for the maximum state by
Changes to the source: http://www.pastie.org/2634833
The sleep frequency is also adjusted according to the selected OC value, so a proper sleep frequency is chosen when the device is suspended.
Bug fix: http://www.pastie.org/2635644
When OC value is changed, the minimum and maximum frequency limits set by the user are adjusted according to the new frequencies.
Made sure the bus speeds and frequencies are not changed while a frequency change is currently ongoing.
Instead of a spin lock (which leads to problems) we use a mutex to make sure the bus and frequencies are not changed while a frequency change is ongoing.
If no mutex lock can be obtained, an error value is returned to inform the caller that the frequency was not changed.
1. Reverting back to mutex_lock to make sure no important request like enabling/disabling further frequency changes are skipped.
2. The mutex is unlocked before the CPUfreq stats are resetted. With the above modification this seems necessary to avoid lockups when changing the OC value.
3. The frequencies and bus speed are updated only when the selected OC value actually did change.
Maximum OC value increased to 150.
No further patches will be published here. I have set up a git repo for all my tweaks. Each mod has its own branch to keep the tweaks cleanly separated and one can simply pull the latest patches from the corresponding branch.
Thanks to Morfic for his help.