[Galaxy Ace II Android Development] ace2nutzer:
u mean "dynamic_down_threshold" and static_up_threshold.

As u can see both are read-only instead of read-write, because most of the users simply mess it up with those important tunables .. that's why i don't allow changes here. Using wrong values can have fatal conditions. i.e. it can cause to switch freq and changing cpu voltage up to 50 times* per second!. This is what we don't want. I don't think it can damage hardware using the wrong valaues, but it'll reduce performance and drains more battery.

* (default tmer rate is usually 20.000 = 20 ms, so 1.000 ms / 20 = 50.)

Yes, they are tuned. :)

After Years of development and testing the different cpu governors, i came to the conclusion that "conservative" gov is the best gov for a battery device, anyway, just because to the fact that it works very well and it's a simple gov, i suggest to use it even if not battery powered! :)

Ondemand & interactive gov uses too much max freq, instead to ramp up step by step.

Of course best responsiveness & performance will still deliver ondemand or interactive, but we need to save some power.

Well tuned conservative gov works as well and is aceptable.

Documentation of the different tunables in the different govornors can be found here:

https://github.com/ace2nutzer/Samsu...4.4_cm11/Documentation/cpu-freq/governors.txt

That's very useful for users and devs.

Quick How-to for one Cluster CPU's (one cpu, multicore)

So first of all check available governors and freq's in kernel:

cd /sys/devices/system/cpu/cpu0/cpufreq
cat scaling_available_frequencies
cat scaling_available_governors

If conservative gov isn't there, u should ask the dev if he can rebuild the kernel with added conservative gov.

switch to conservative gov:

echo conservative > scaling_governor

Now we go to the conservative gov in order to adjust tunables:

cd /sys/devices/system/cpu/cpufreq/conservative

show all tunables:

ls

show all Values:

cat *

First the easy ones that can be used on every phone:

ignore_nice_load = 0

sampling_down_factor = 1

sampling_rate = 100000 (check cpu load every 0,1 second)

up_threshold = 70

Now we need to adjust "freq_step" and "down_threshold" ...

for those tunables we need to do some calcualtions based on the previous printed "scaling_available_frequencies"

for freq_step:

check first what's the smallest difference between the steps ... here on ace 2 it's e.g. 1100 and 1150 MHz step .. where the difference is only 50 Mhz .. so we need to make the gov aware to switch freq in 50 Mhz chunks. it uses a percentage of the max freq which is 1300 MHz.

So 1300 MHz * 3% / 100% = 39 MHz which will fit in 50 MHz Chunk.

So it should be:

freq_step = 3

for down_threshold:

Ace 2 uses dynamic_down_threshold, (developed by me) because it's more efficient to use for every step an appropriate down_threshold value.

This is only for powersaving ... but because a default gov without that support, simply uses just one Value for every step, we need only one value .. namely the lowest one ...which will fit for the other steps .. with the drawback to loose some efficiency in power consumption.

So no matter if down_threshold or dynamic_down_threshold ... u'll still need to calculate all the steps one by one to have the appropriate Value for your Phone.

Example for the Ace 2 ... i'll show u only for 400 and 600 MHz Step ... (200 Mhz doesn't need an down_threshold ... because it's already the lowest step)

so:

400 MHz Step:

70% up_threshold * 200 MHz / 400 MHz = 35% minus 10% reserve (to avoid freq switching too often up and down) = 25%

that can be seen here in source code:

https://github.com/ace2nutzer/Samsu...82/drivers/cpufreq/cpufreq_conservative.c#L34

600 MHz Step:

70 * 400 / 600 = 47 - 10 = 37%

and here:

https://github.com/ace2nutzer/Samsu...82/drivers/cpufreq/cpufreq_conservative.c#L35

and so on ....

Ace 2 uses values between 25 and 57 dynamically .. so the lowest would be 25 without dynamic_down_threshold.

Here an example how to add that support in kernel ... the example is for 2 Clusters (2 CPU's):

https://github.com/ace2nutzer/Samsu...mmit/0e8c1f375b9eb127f77c471fcc6724fcd68148b3

but is basically the same principle for one CPU. It's actually initial commit for the S8 ... works already very well, but it still needs some work to split Cluster 0 from Cluster 1. (to reduce extra effort in kernel)