[Q] limit max frequency by script or hardcoded in kernel? - Android Q&A, Help & Troubleshooting

Hi.
Are the minimum and maximum frequencies given by the kernel or given by scripts somewhere on an Android device?
Is it possible to lock the maximum frequency useable by SetCPU to a lower setting than possible by the kernel via a script?
For example an overclocking kernel is used, but a specific device cannot handle overclocked frequencies.

I might be wrong, but I believe hardcoced in kernal

lordofazeroth said:
Hi.
Are the minimum and maximum frequencies given by the kernel or given by scripts somewhere on an Android device?
Is it possible to lock the maximum frequency useable by SetCPU to a lower setting than possible by the kernel via a script?
For example an overclocking kernel is used, but a specific device cannot handle overclocked frequencies.
Click to expand...
Click to collapse
I've completely moved away from apps of any sort to manage voltage, min and max freq, as well as governor behavior and memory optimization. Assuming your kernel supports sysfs, and most custom kernels do, a simply written script will do the job with none of the overhead an app requires. Many kernels already have a script for setting these values and can be edited fairly easily. If you know a little about ADB, creating a whole new one with something like Vim is pretty easy. Then you just push it to /system/etc/init.d and sh it. If you want to edit it on the device, Script Manager works well for that. I have an OC guide in my Q&A thread, second post, that explains some of this in more detail. The link is in my sig.

Related

Setcpu

anyone know how to config this for our atrix? Thanks.
motoatrix said:
anyone know how to config this for our atrix? Thanks.
Click to expand...
Click to collapse
Install 2.1.1a or higher, and select "Nvidia Tegra 2..." as the frequency set. You will not be able to configure it as much as other phones, due to the way the Motorola kernel is built. Not until a super-dev is able to build a custom kernel for the Atrix...
You can't change the governor, but you can still set the minimum/maximum frequencies based on profiles, etc.
u can reduce speed, set screen off profile and reduce speed even more
or u can run it @ 1ghz all the time but the max u'll get is 1 ghz
lindsaytheflint said:
Install 2.1.1a or higher, and select "Nvidia Tegra 2..." as the frequency set. You will not be able to configure it as much as other phones, due to the way the Motorola kernel is built. Not until a super-dev is able to build a custom kernel for the Atrix...
You can't change the governor, but you can still set the minimum/maximum frequencies based on profiles, etc.
Click to expand...
Click to collapse
Yeah because we don't have a modified kernel yet (See bootloader issues) we can do a minimum 216 and max 1000. Profiles work nicely though.
SetCPU increases performance 10%
That's the difference I experienced when I installed it.
lindsaytheflint said:
Install 2.1.1a or higher, and select "Nvidia Tegra 2..." as the frequency set. You will not be able to configure it as much as other phones, due to the way the Motorola kernel is built. Not until a super-dev is able to build a custom kernel for the Atrix...
You can't change the governor, but you can still set the minimum/maximum frequencies based on profiles, etc.
Click to expand...
Click to collapse
Battery savings during under clocking is just great..

[Q] New to all of this

Sorry if this is in the wrong place but I am very new to the rooting and the benefits of rooting. I have recently rooted my evo 4g and while it does work i was wondering if someone could point me in the right direction of what the next step should be. I am currently adding apps that I can install but I am wanting to increase the battery life and in general get more out of my phone. If there are basic tutorials that I could get pointed to that would be awesome or just general advise thanks again - Juse
What do you mean by getting more out of your phone? For now I'll judge you mean performance wise. Let's start with cpu. Download setcpu (my preference) from the market: https://market.android.com/details?id=com.mhuang.overclocking&feature=search_result . This will allow changing cpu frequencies of your device BUT you MUST have a custom kernel installed. This can be done by getting kernel manager (Market link: https://market.android.com/details?id=com.teamwin.kernelmanager.free&feature=search_result ) or simply by flashing a custom rom. The good thing in setcpu is that you can set profiles. I would recommend setting the frequency to the lowest possible with scaling set to conservative when screen is off. For the "getting more out of your phone part", (guessing you mean performance), set the frequency to how high you want (depending on your how extreme and experimental you are) and set scaling to performance. If you want to be on the safe side, check for the recommended cpu frequencies for whichever kernel you get.

[PATCH] cpufreq: frequency range regulation based on screen on/off events

I've implemented a generic cpufreq range regulation based on a previous work proposed by newmail here.
With "generic" I mean that it can work with any cpufreq governor, the whole logic is implemented in the core cpufreq subsystem using early_suspend hooks.
How does it work?
Without this patch set applied, using for example the ondemand governor, the cpu frequency ranges always between 200MHz to 1200MHz (without overclocking/underclocking the device) that are the min and the max frequency supported by the processor.
With this patch set applied the frequency is regulated in the range [min ... max/2] when the screen is off and [max/2 ... max] when the screen is on. If the cpu doesn't support exactly max/2 an appropriate frequency is chosen, as close as possible to the theoretical value (for the GT-I9100 it's 500MHz).
Advantages
This forces background apps to always run at lower frequencies, reducing the power consumption when the phone is not used interactively, and, at the same time, boost the cpu at max speed when used interactively. IOW, it's faster and it drains more battery life when the phone is used interactively, and the battery last longer when the phone runs background tasks.
An additional side-effect using 'ondemand' is that the heuristic always works with shorter ranges, so the cpu ramps up / down faster to the target frequency. The feeling is that everything seems smoother and more responsive. I only tested ondemand for now, but the same logic should apply to the other available governors as well.
Source code
I like to post source code, more than binaries, so in attach you can find only the patches that implement this feature. The patches can be applied on top of the original Samsung kernel - Update2. These patches are also included in my kernel tree on github.
Patch set description
The 1st patch 0001-cpufreq-frequency-regulation-based-on-screen-on-off-.patch, implements the dynamic cpufreq range regulation logic. This patch is totally generic, so theoretically you can use it with any Android device.
The 2nd patch 0002-cpufreq-do-not-forget-min-max-clock-frequency-on-cpu.patch is required by multicore systems with cpu hotplugging enabled. It allows to resume the right frequency range on a cpu when it goes offline and then back online.
The 3rd patch 0003-mach-s5pv310-cpufreq-800MHz-sleep-death-fix.patch is specific for the GT-I9100 hardware. It's the 800MHz sleep death fix: the hardware requires to suspend the cpu always at 800MHz, so with the dynamic cpufreq range regulation this is always needed, independently of the particular governor you're using.
The 4th patch 0004-pm-hotplug-do-not-consider-frequency-in-the-cpu-hotp.patch is specific for the GT-I9100 hardware. It makes the cpu hotplug heuristic independent of the cpu frequency; this is required to properly offline the secondary cpu when screen is on _and_ the dynamic cpufreq range regulation patch is applied.
The 5th patch 0005-pm-hotplug-disable-secondary-cpu-auto-hotplug-when-s.patch is specific for the GT-I9100 hardware. It always sets the secondary cpu offline when the screen is off.
The 6th patch 0006-mach-s5pv310-cpufreq-smooth-scaling.patch is specific for the GT-I9100 hardware. It is needed to fix a wrong behavior with governors that run at a fixed frequency (like 'performance', 'powersave' or 'userspace'). Basically, the low-level driver doesn't allow to switch from a very low frequency to a very high frequency, so in some cases the actual cpu frequency can be different than the frequency requested by the higher layers. This fix introduces a smooth scaling mechanism in the low-level driver that allows to switch to the target frequency incrementally in multiple steps.
Everything is transparent to the higher layers, so in this way we are sure that the actual cpu frequency is always the same value requested by the cpufreq governor. See also the commit in my kernel on github.
NOTE: the last patch (0006-mach-s5pv310-cpufreq-smooth-scaling.patch) is a fix for the low-level cpufreq driver of the GT-I9100 that should be _always_ applied IMHO, even without the dynamic cpufreq range regulation patch.
ChangeLog
v2 -> v3
fix a wrong behavior (cpu stuck at 800MHz) with fixed-frequency governors (i.e, performance, powersave, or userspace).
v1 -> v2
fix: allow to offline the secondary cpu when screen is on
always disable the secondary cpu when screen is off
Looks promising, hope it works well, will sure try it out, but some kernels has almost the same built in...
Great work!
Uploaded a new version of the dynamic frequency range regulation patch.
There're two additional patches in the patch set:
The first patch (0004) is a fix that allows to properly offline the secondary cpu when screen is on.
The other patch (0005) applies the same concept of the dynamic frequency range regulation to the secondary cpu hotplugging: when the screen is off also the secondary cpu (cpu1) is kept offline, when the screen is on the secondary cpu is turned on/off depending on the load on the primary cpu (cpu0).
thanks a lot for your hard work.apply patch without problem, good for battery life.
a developper like me is very happy to have a master developper like you.
thank you very much it looks cool.
a noob question, how will I apply this zip just CWM or what?
arighi: one thing i don't like the freq min is set to 500 mhz . it is too high.
edit:excuse when screen off the freq reach 200 mhz .it's ok perfect and cpu1 is well disable when screen off
edit2: yay1974 ,apply all patch in the order they are all necessary. but this patch is only for developper who compil his kernel.
pixiebob said:
arighi: one thing i don't like the freq min is set to 500 mhz . it is too high.
edit:excuse when screen off the freq reach 200 mhz .it's ok perfect and cpu1 is well disable when screen off
edit2: yay1974 ,apply all patch in the order they are all necessary. but this patch is only for developper who compil his kernel.
Click to expand...
Click to collapse
hmm i see i wish you had a cwm flashable file for this to apply
yay1974: if you wish you can try my own kernel i have apply patch from this thread and some other good stuff(like sched autogroup, etc...).i obtain more 4000 quadrant:
flash with odin or heimdall:
http://www.megaupload.com/?d=TCQFKISK
commit:
https://github.com/pixiebob/pixie-kernel/commits/master
pixiebob said:
yay1974: if you wish you can try my own kernel i have apply patch from this thread and some other good stuff(like sched autogroup, etc...).i obtain more 4000 quadrant:
Click to expand...
Click to collapse
pixiebob, I see you've applied also the CONFIG_FILE_SYNC_DISABLE patch. Be careful to enable this, it may cause loss of data if applications crash in unsafe ways. Probably if you run quadrant in a kernel with CONFIG_FILE_SYNC_DISABLE=y you'll get about 4500-4600. But actually you're just cheating.
what kernels have this built in (if any)
cheers
@arighi great job on the patches... looking forward to more cool stuff from you.
Great patch, thank you.
pongster said:
@arighi great job on the patches... looking forward to more cool stuff from you.
Click to expand...
Click to collapse
Hey pongster, you are always hanging around here!! When can we see your rom running all tweaks and fixes... looking forward to it...
Sent from my GT-I9100
arighi said:
pixiebob, I see you've applied also the CONFIG_FILE_SYNC_DISABLE patch. Be careful to enable this, it may cause loss of data if applications crash in unsafe ways. Probably if you run quadrant in a kernel with CONFIG_FILE_SYNC_DISABLE=y you'll get about 4500-4600. But actually you're just cheating.
Click to expand...
Click to collapse
thanks i will be careful but until by now i didn't have crash
great patch! I was also working on something similar but your patch is so complete that I gave up working and used yours
just a perfect patch!
pongster said:
@arighi great job on the patches... looking forward to more cool stuff from you.
Click to expand...
Click to collapse
Hey Sar ! You here ?!? .. didnt know ... cook some MIUI stuff dude ... I'll help out
v-b-n said:
Hey Sar ! You here ?!? .. didnt know ... cook some MIUI stuff dude ... I'll help out
Click to expand...
Click to collapse
cooking something up... not a MIUI based one though...
PM me
arighi said:
I've implemented a generic cpufreq range regulation based on a previous work proposed by newmail here.
With "generic" I mean that it can work with any cpufreq governor, the whole logic is implemented in the core cpufreq subsystem using early_suspend hooks.
How does it work?
Without this patch set applied, using for example the ondemand governor, the cpu frequency ranges always between 200MHz to 1200MHz (without overclocking/underclocking the device) that are the min and the max frequency supported by the processor.
With this patch set applied the frequency is regulated in the range [min ... max/2] when the screen is off and [max/2 ... max] when the screen is on. If the cpu doesn't support exactly max/2 an appropriate frequency is chosen, as close as possible to the theoretical value (for the GT-I9100 it's 500MHz).
Advantages
This forces background apps to always run at lower frequencies, reducing the power consumption when the phone is not used interactively, and, at the same time, boost the cpu at max speed when used interactively. IOW, it's faster and it drains more battery life when the phone is used interactively, and the battery last longer when the phone runs background tasks.
An additional side-effect using 'ondemand' is that the heuristic always works with shorter ranges, so the cpu ramps up / down faster to the target frequency. The feeling is that everything seems smoother and more responsive. I only tested ondemand for now, but the same logic should apply to the other available governors as well.
Source code
I like to post source code, more than binaries, so in attach you can find only the patches that implement this feature. The patches can be applied on top of the original Samsung kernel - Update2. These patches are also included in my kernel tree on github.
Patch set description
The 1st patch 0001-cpufreq-frequency-regulation-based-on-screen-on-off-.patch, implements the dynamic cpufreq range regulation logic. This patch is totally generic, so theoretically you can use it with any Android device.
The 2nd patch 0002-cpufreq-do-not-forget-min-max-clock-frequency-on-cpu.patch is required by multicore systems with cpu hotplugging enabled. It allows to resume the right frequency range on a cpu when it goes offline and then back online.
The 3rd patch 0003-mach-s5pv310-cpufreq-800MHz-sleep-death-fix.patch is specific for the GT-I9100 hardware. It's the 800MHz sleep death fix: the hardware requires to suspend the cpu always at 800MHz, so with the dynamic cpufreq range regulation this is always needed, independently of the particular governor you're using.
The 4th patch 0004-pm-hotplug-do-not-consider-frequency-in-the-cpu-hotp.patch is specific for the GT-I9100 hardware. It makes the cpu hotplug heuristic independent of the cpu frequency; this is required to properly offline the secondary cpu when screen is on _and_ the dynamic cpufreq range regulation patch is applied.
The 5th patch 0005-pm-hotplug-disable-secondary-cpu-auto-hotplug-when-s.patch is specific for the GT-I9100 hardware. It always sets the secondary cpu offline when the screen is off.
ChangeLog
v1 -> v2
fix: allow to offline the secondary cpu when screen is on
always disable the secondary cpu when screen is off
Click to expand...
Click to collapse
Hi,
Can you make it also for ninphetamine source code?
netchip said:
Hi,
Can you make it also for ninphetamine source code?
Click to expand...
Click to collapse
All the patches apply fine, except patch 0003, because the ninphetamine kernel already has a 800MHz sleep death fix.
The following patch set should apply cleanly (UNTESTED!!!).

[Q] set default cpu frequency question

how to set default cpu frequency without any app.anyone kown it
I don't think the stock kernel can be. For non stock ones like Mac, they are usually adjusted in boot scripts or with apps like set CPU.
Read, Search, Read again, ... Then Ask with Tapatalk 2

[Q] Unable to scale CPU frequency on my Phone

I have a ROOTED chinese brand phone with the MTk6575 CPU (1 GHZ) with android 2.3.6 installed on it, and am trying to improve the phone's battery life by scaling down the CPU frequency. But out of all the apps I have tried (SetCPU, No-Frills, Android Overclock) none of them is able to read the CPU Governor or current CPU frequency. My question is could we change this frequency directly by editing any of the files inside the /system folder or is there any other security setting that prevents these apps from reading or changing the CPU frequencies?
CPU frequency scaling, governor changing, I/O scheduler changing and under/over-volting all require kernel support. In all probability your stock kernel does not have that support, and you can't change kernel unless someone develops one for your phone.
Sent from my Desire HD using xda premium

Categories

Resources