[Galaxy S I9000 Android Development] raspdeep:
New Directions:

As there will be more tweaks and findings out by xda members, i will not include much tweaks (unless those i run) into my kernel but to release source so others can incorporate my oc/uv into their "all-in-one" kernel threads.

im glad someone took the liberty to add voodoo kernel and hope he eventually get voodoo to merge nicely with modded cwm.

UV control version 2.1 and above

- voltage scaling

- full UV user control via sysfs

- works on all governor

- echo "50 50 150 75 75 100" > /sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table

- column 1 for 1.2ghz, 2 for 1ghz, 3 for 800mhz, 4 for 400mhz, 5 for 200mhz, lastly 100mhz

- values are mV

- Use latest xan's app if you dont want to mess with commands - here

Info:

- based from the jpm froyo 2.6.32.9 kernel drop

- using sztupy ramfs (it has sztupy modded cwm but i did not test all options esp lag fix)

- Mem config based from here - free 341mb

- BLN by Neldar

- sysfs user configurable Undervolt

- FS supports - ext2 / ext4 / JFS

- sourcery 4.4.1 g++ 2009q3

- linpack 16 MFLOPish

- supported frequencies 100/200/400/800/1000/1200

- rooted adb shell

Stock voltage info

1200000 - 1300 (<-added)

1000000 - 1275

800000 - 1200

400000 - 1050

200000 - 950

100000 - 950

Max vdd_arm is 1.31v according to datasheet so dont go crazy OV'ing

To-do

- a lot

How to install:

- download any latest .7z file

- extract .tar from the .7z file

- use odin, load tar file under pda and flash

Credits

- sztupy

- supercurio

- unhelpful

- hardcore

- xan

- neldar

enjoy!

OC / UV 101

This question has been asked a lot so I will try my best to answer this question to my knowledge. Our phone although uses the same hardware, they can vary in terms of stability and performance. I believed even same hardware varies because of production tolerances & variations. Our stock 1ghz system per datasheet should run at 1.2v, however, in the source code, samsung set it at 1.275v. There are a lot of speculation why this happens but my personal believe is due to production fallouts. In production environment, to increase the yield, they increased the voltage to make them more stable. This is the easiest way to increase yield and sound most logical in business standpoint.

Our phones do frequency scaling. Meaning it doesnt stay at a particular frequency all the time, the frequencies fluctuate depending on load and thresholds. At high load, it will go to high frequencies and when low load or idle mode, it will stay around 100-400 range. In this way, you get load balance and uses lesser power.

Back to how adjusting UV to suit your phone. I've enabled via sysfs (/sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table) the ability for user configurable UV, unlocking this allows for UV'ing at all supported frequencies 100/200/400/800/1000/1200mhz. In this table is an array of values in mV, column 1 for 1.2ghz, 2 for 1ghz, 3 for 800mhz, 4 for 400mhz, 5 for 200mhz, lastly 100mhz. What this means is each column allows an UV setting at you can change to suit your phone. In boot up stage, all the values in the array is zero hence no UV'ing. You can set it and here is how it works:

Taking for example, you echo "0 50 50 75 75 100" > /sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table, looking at the stock voltage info I've described above, you will get:

1200000 -> 1300-0 = 1300mV

1000000 -> 1275-50 = 1225mV

800000 -> 1200-50 = 1150mV

400000 -> 1050-75 = 975mV

200000 -> 950-75 = 875mV

100000 -> 950-100 = 850mV

At 1.2ghz, i disabled UV by setting the value to 0. This is because 1.2ghz is already OC'ed so some phones may not be able to run stable so UV'ing makes the situation worst. At 1ghz, i reduced by 50mV, this is trial and error, i wouldnt know if this is stable unless i do some benchmark, run some programs, etc. So the question is "how do i know the UV i set is stable?" You can do this by a few ways. For my case, this is how I do it:

1) Set the voltage for 1ghz at 25mV

2) Use SetCPU to limit max and min scaling frequency to 1ghz

3) Run test, play some media, surf the web, open market place, etc.

4) Run it for 30-45 mins and if it doesnt crash, its good.

5) Increase the mV to 50mV and repeat 2-4 until it hang or crash

6) Find the mV that you phone likes without hanging or crashing then move to 800mhz

For lower frequencies, you can "usually" have higher UV but you cannot use setcpu to test the lower frequencies as the system will run above the max scaling frequencies even if you try to limit it lower (edit: this happens only if min and max frequency is not equal). For example, you limit the max scaling frequencies to 200mhz, it wont stay max at 200mhz but jump higher. The easiest way to test the lower frequencies UV is by letting your phone standby, sleep or do less intensive stuff and see if it runs stable, I believed most phones can do 75mV at 100-200mhz range but you can try more and see how it works out for you.

You can also test the lower frequencies by setting both min and max scaling to the same frequency. However, do note that setting low frequency will be very slow especially if you try it at 100mhz. It may take several seconds just to change apps.

FAQs

Q - What is UV? Why UV?

A - UV stands for Undervolt. The idea is to run at lower than stock voltage at any frequencies hence saving battery and longer battery performance

Q - Does UV also slow down the performance?

A - Theoretically it doesnt but under certain circumstances when the voltage gets too low for the cpu to operate properly, you may encounter some glitches so the idea is not to run it at the all the way down but find a suitable voltage that it doesnt happen. For example, running 75mV is stable but sometimes see some slow down so up it to 50mV and it should run fine.

Q - I am not convinced, I do not want to OC, how can I stop that?

A - Simple, using xan's app, check the box "limit max clock to 1ghz (no overclocking)" or using adb shell echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

Changelog

v300

- ULF v0.4pre

-frequencies supported are 1400/1360/1280/1200/1120/1000/800/400/200/100 (in this order)

- echo 0 0 0 1 0 1 1 1 1 1 > /sys/devices/system/cpu/cpu0/cpufreq/states_enabled_table

- Frequencies state can be enabled by echoing a "1" into the column position (1.4ghz - 1st column, 1.36ghz - 2nd column, 1.28ghz - 3rd column,... etc)

- examples above will enable 1200/1000/800/400/200/100

- At default stage, all the OC frequencies will be disabled so user will have to enable if they want to OC.. it will only run ONCE when scaling start (so using init.d to set the states) but i've added a trigger called /sys/devices/system/cpu/cpu0/cpufreq/update_states which by default will be 0. echoing a 1 will force an update if you want to change the state.

- There will also be UV for each frequencies same as previous version

- Stock voltage

1400000 - 1300 (<- added)

1360000 - 1300 (<- added)

1280000 - 1300 (<- added)

1120000 - 1300 (<- added)

1200000 - 1300 (<-added)

1000000 - 1275

800000 - 1200

400000 - 1050

200000 - 950

100000 - 950

Max vdd_arm is 1.31v according to datasheet so dont go crazy OV'ing

v217 UV alpha

- quick fix on corrupted /system

- /sbin/busybox mount -t rfs -o check=no /dev/block/stl9 /system

Highly Experimental 1.28Ghz / 1.4Ghz kernels v216

- Only for those that know what they are doing - no support

- BACKUP YOUR STUFF

- Disable UV and UV startup script

- Post your benchmark for bragging rights :)

- Linpack 17.9 (1.28Ghz) / 19.8 (1.4Ghz)

v216 UV alpha

- added BLN

- release source for 1.12ghz

v215 UV alpha (1.2ghz and 1.12ghz OC support)

- 100->400mhz fast scaling (less aggressive than v212 for better battery life)

- tweak for faster response

- bootanimation support

- do Linpack benchmark of your current kernel vs my kernel for comparison. Only benchmark 5 mins after system bootup (without USB cable attached)

- Linpack: 13.9-14.2@1ghz, 15.3-15.7@1.12ghz,16.5-16.9@1.2ghz

v212 UV alpha

- hz = 300

- fast scaling speed jump

- tweak for faster response

- fix sztupy's startup script so it will run any files in /etc/init.d at startup

- may use more battery so keep track and let me know

v2.1 UV alpha debug

- full UV user control via sysfs

- works on all governor

- echo "50 50 150 75 75 100" > /sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table

- column 1 for 1.2ghz, 2 for 1ghz, 3 for 800mhz, 4 for 400mhz, 5 for 200mhz, lastly 100mhz

- values are mV

- Use latest xan's app if you dont want to mess with commands - here

v2.0 UV alpha

- PMIC VS UV

- user configurable UV settings (default value = 0 for UVLF and UVHF) for conservative governor only

- /sys/devices/system/cpu/cpu0/cpufreq/conservative/UVLF_mV (for 100-800mhz)

- /sys/devices/system/cpu/cpu0/cpufreq/conservative/UVHF_mV (above 800mhz)

- for example # echo 50 > /sys/devices/system/cpu/cpu0/cpufreq/conservative/UVLF_mV (will UV by 50mV for 100-800mhz)

- for example # echo 25 > /sys/devices/system/cpu/cpu0/cpufreq/conservative/UVHF_mV (will UV by 25mV for 1-1.2ghz)

- If you do not want to mess with commands, use Xan's app for easy GUI control - here

- if you tried 100mV and still doesnt crash, use command method to set higher. my phone crashed when i set 125mV @ UVLF and 75mV @ UVHF

- Hz @ 500

- source patch attached

v1.0 UV alpha

- bug fixes

- optimization flag back to O3

v1.1 alpha

- added JFS

- compile optimization level to O2 from O3

- Mem config based from here - free 341mb

- release alpha patch source code

v1 alpha

- initial release