Getting Better Battery Life on the Samsung Princeton in Ubuntu 11.10

A few weeks ago I purchased a Samsung Princeton from Staples when they were having their fire-sale for $350.  At $350, it seemed like a steal.  I wasn’t super happy with the device when I first got it, but now that I’ve had some time to do some minor upgrades and tweaking, I am extremely happy with this device.

The first thing I did when I got the device was install Ubuntu 11.10 (Oneric Oncelot).  I’m a big Linux fan and now that I’m doing web development using an open source stack I’m free to use Linux on my machines instead of Windows.  The only downfall to Linux is the battery life.  On both my main laptop (a Samsung Chronos 7) and the Princeton battery life half what I can get in Windows.  I was determined to keep Linux on this device so I set out to get the maximum battery life on this device.

The following information is based purely on what I have found to work best for my machine.  I can’t guarantee this work for you or your machine but hopefully it can at least guide you in the right direction.  I have made some minor hardware upgrades to the laptop since I purchased it.  This included an extended battery I found on eBay, an Intel 320 series SSD and 8GB of RAM.  While the SSD and extended battery will give me better battery life, the tweaks I made are still generic enough that they should improve battery life on any machine.

I had read that the 3.2 kernel series had some nice power improvements, especially for Intel devices.  There are some PCIe ASPM (power management for PCI Express devices) issues in the mainline 3.2 kernel, but ubuntu has applied the fixes from the 3.3 kernel in their 3.2 kernel tree that will be included with Ubuntu 12.04.  PCIe ASPM is a huge battery saver so it was definitely something I knew I needed to have working properly.  There is a lot of documentation out there on the various issues and I highly recommend reading this article from Phoronix.  This article is based on the 2.6 kernel series but the issue haven’t changed much since then.  A Google search will bring up plenty more reading.

After cloning the Precise kernel from git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git I compiled a custom kernel tailored for the Samsung Princeton. Ubuntu kernels are good out of the box, however they include a ton of stuff I either don’t use, or is not needed for my machine.  I could spend an entire blog post on the decisions I made and why I made them, but for now I will just link to the config file I use.  I’m a make menuconfig kind of guy (which goes against the recommended way to compile an Ubuntu kernel) so you may have to change the config if you want to use the “Ubuntu way.”

Once the new kernel was up and running successfully, I turned my attention towards kernel command line arguments that are designed for better battery life.  After much research and reading I decided to use the four arguments I had found.  I changed the GRUB_CMDLINE_LINUX_DEFAULTS line in /etc/default/grub to the following:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pcie_aspm=force i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1"

The first parameter is pretty straightforward, pcie_aspm=force.  What this does is to force the PCIe ASPM even if the BIOS tells the system it’s not supported.  This allows Linux to use the full power saving features of the PCIe devices in the laptop.  I have no idea if the Princeton suffers from this bug but I did notice a difference in battery when I applied that argument to the kernel.

The next kernel parameter i915.i915_enable_rc6=1 has some arguments around it’s use.  The parameter allows the GPU to enter a low power state when the GPU is idling.  That sounds great, but the caveat is it can also cause the GPU to use more power when running, albeit it at better performance.  It appears that it only uses more power when doing OpenGL or 3D things (at least from the information I could find), which I never do, however there seems to not be a lot of consensus on the matter.  I did notice a significant drop in power according to powertop with this parameter so I decided to keep it for now.  RC6 is not enabled by default because on some systems it can cause the GPU to hang.  In my limited testing I have not had any GPU hangs on the Princeton, so it does not appear that this laptop suffers from that bug.

The kernel option i915.i915_enable_fbc enables the frame-buffer compression (FBC) for the i915 graphics driver.  FBC, as you might guess, will compress the buffer that is being rendered on the screen.  This means less memory has to be used to for screen refreshes, which will lead to less power consumption.  This parameter is not enabled by default because on some systems the screen does not repaint properly when using a window manager that uses compositing (such as compiz).  However as with the i915_enable_rc6 parameter, this does not seem to be the case for the Princeton in my testing.

Finally, I added the i915.lvds_downclock=1 parameter.  This will enable the LVDS refresh rate to run at a slower clock speed.  Under-clocking usually has a positive impact on power consumption and definitely helps in this case.  This parameter is not enabled by default because on systems that do not support the down-clocking the screen can flicker while you are using the machine.  I have noticed zero flickers so far on the Princeton.

If you are interested in reading more about the kernel parameters, including benchmarks, I recommend reading this article on Phoronix.  It does a great job of explaining the parameters in more detail and provides an exhaustive list of benchmarks for all the parameters.

The final piece to the puzzle of better battery life is optimizing the system for power consumption while disconnected from the wall.  I will be posting another blog soon on what I did under Ubuntu 11.10.

Comments are closed.