[Atrix 4G Android Development] sendust7:
Custom ICS Battery Save?

I thought about posting this on ICS/JB Kernel Port: http://xdaforums.com/showthread.php?t=2016837 but decided to post here instead:

While evaluating these ROMs in terms of CPU governor settings and battery life, I came upon this code block in /ramdisk:

/ramdisk/init.olympus.rc:

# Power management settings
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 216000
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1200000
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 216000
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq 1200000
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor interactive
write /sys/devices/system/cpu/cpufreq/interactive/go_maxspeed_load 80

The “interactive” governor is perfectly fine for daily use:

“...Instead of sampling the cpu at a specified rate, the governor will scale the cpu frequency up when coming out of idle. When the cpu comes out of idle, a timer is configured to fire within 1-2 ticks. If the cpu is 100% busy from exiting idle to when the timer fires then we assume the cpu is underpowered and ramp to MAX speed.”

But a different governor, e.g. “conservative” combined with shutting down the second CPU core MAY improve battery life at night. I did that, and it SEEMED to improve. But this could have been an illusion.

If you would like to try this out (root is required), just copy/paste the code below via adb or roll it up into a shell script like this:

Link: http://www.mediafire.com/?ykaqqvdigimaqve

chmod 0644 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
echo "conservative" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;

(Can also do this via SetCPU or other CPU manager)...

To set cpu1 offline:

chmod 0644 /sys/devices/system/cpu/cpu1/online;
echo "0" > /sys/devices/system/cpu/cpu1/online;

To verify cpu1 offline:

ls -ld /sys/devices/system/cpu/*;
more /sys/devices/system/cpu/*;

drwxr-xr-x root root 2013-02-16 10:33 cpu0
drwxr-xr-x root root 2013-02-16 10:33 cpu1
drwxr-xr-x root root 2013-02-16 10:33 cpufreq
drwxr-xr-x root root 2013-02-16 10:33 cpuidle
-r--r--r-- root root 4096 2013-02-16 15:11 kernel_max
-r--r--r-- root root 4096 2013-02-16 11:26 offline
-r--r--r-- root root 4096 2013-02-16 11:26 online
-r--r--r-- root root 4096 2013-02-16 15:11 possible
-r--r--r-- root root 4096 2013-02-16 15:11 present
shell@android:/ #

1
1
0
0-1
0-1
shell@android:/ #

The values immediately above correspond to the non-directory entries starting from “kernel_max”. Note the value of “offline” is “1” meaning that “cpu1” is offline. (Note cpu0 is online... It would not be good if both were offline; someone needs to run the show )

Now record the current charge level (%) and let phone go to sleep.

If our average reduction in charge over eight hours is less than 32%, I think we are doing better than before ;)

To return to your previous CPU settings, just reboot.

One thought on "batt-v1.0.sh" (previous post). I think it draws too much battery since it runs continuously (and quite inefficiently). So I'm thinking about modifying it to just snapshot results to log file and then use previously logged results to estimate battery drain. Something like that anyway...

Experimental. Enjoy.