Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I am just approaching to the Smart Phone and Android world and have a couple of doubts:

Which modules (and SW or FW?) decide the policies with which power is given to any component of the Smart Phone that requires it?

furthermore

Are power management modules on Smart Phones implemented in the Android OS or in some special dedicated firmware?

Obviously power management must work also if the OS is not yet loaded, but who is responsible of it?

And to what extent can I modify the power management with an application running inside of the OS?

(I hope these questions are not Off-Topic, in case can you please direct me to the correct Stack-Exchange site?)

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Browsing around forums and sites I found out the following answers to my doubts. I'm not completely satisfied but it helped understand more.

Every device's power management depends on some suspend/resume policies that are implemented in the firmware controlling that particular device.

This is very device dependent: how and when each device turns off (suspends itself) and wakes up (resumes) depends on the HW specifications, you have to read the datasheets to understand which particular registries must be manipulated to suspend/resume it.

You can control this stuff via software in the drivers of the devices, inside of the kernel's source code, by accessing some funcions in the form <something>_suspend and <something>_resume.

E.g. From the source code of the kernel of the emulator "goldfish":

in file drivers/video/goldfishfb.c (the driver responsible for the frame buffer)

#ifdef CONFIG_ANDROID_POWER
static void goldfish_fb_early_suspend(android_early_suspend_t *h)
{
    struct goldfish_fb *fb = container_of(h, struct goldfish_fb, early_suspend);
    writel(1, fb->reg_base + FB_SET_BLANK);
}

static void goldfish_fb_late_resume(android_early_suspend_t *h)
{
    struct goldfish_fb *fb = container_of(h, struct goldfish_fb, early_suspend);
    writel(0, fb->reg_base + FB_SET_BLANK);
}
#endif

So the early_suspend writes a 1 in the register FB_SET_BLANK to turn off the screen, or a 0 to turn it back on.

So it seems to me that a process in the application execution environment needs to access and corrupt the devices drivers to manipulate maliciously power management of a device.

share|improve this answer
1  
Sounds interesting. Are you suspecting a virus keeping your device active? Apps can keep wifi and screen and keyboard on from the Java-side, see developer.android.com/reference/android/os/PowerManager.html –  NoBugs May 28 '12 at 17:13
    
@NoBugs - I don't suspect any virus, but maybe I'd be interested in writing one ;D...just kidding!the link is cool..thks –  Matteo May 29 '12 at 6:43
add comment

Power management is determined by governors which set the CPU clock speed according to use. Each clock speed operates at a certain voltage and a lower voltage means less power. If you have root access you can change the governor and the allowed CPU clock speeds. Also there is sleep state into which the CPU will enter when the screen is off and nothing is working in the background. There are probably battery-charging functions that can't be messed with, but everything else can be changed even the cpu and dsp voltages.

share|improve this answer
    
If you have root access you can change the governor and the allowed CPU clock speeds: so you're saying that a simple process having root privileges can decide to slow down CPU and change dsp voltages?When you have time can you please provide a little more structured answer?Thks in advance, I really need your help! –  Matteo May 24 '12 at 13:34
    
You must write a string to /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor . But if you install a custom rom there will be an easy app provided. –  daithib8 May 24 '12 at 16:13
1  
Apps like SetCPU require root, and let you change clockspeed/governor. forum.xda-developers.com/showthread.php?t=505419 –  NoBugs May 24 '12 at 20:13
    
@daithib8 - I've provided an answer too, what do you think about it?Do you know if I've got it right? –  Matteo May 28 '12 at 7:10
    
@NoBugs - I've provided an answer too, what do you think about it?Do you know if I've got it right? –  Matteo May 28 '12 at 7:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.