For those that have spent some time using the Macbook Air in OSX, you probably were fond of the 11+ hours of battery life. I for one enjoyed not having to be a battery-watcher. As with all laptops and linux, this combination will never provide as much battery life as Apple’s OSX. However, fear not! We can get as close to it as possible.
Battery life in linux during the writing of this post: 10% =~55min
Disclaimer #1: I am fairly new at understanding all the little pieces that help save power so if you feel something I wrote about is incorrect or have a better way in doing it, please let me know! This post is mostly for my understanding and recording my findings, but felt others could benefit from it.
Disclaimer #2: Do not blindly copy paste what I have written here. Seek to understand it even if I don’t.
The Power Saving Archwiki is a perfect start, where it shows how to create udev scripts and modify kernel parameters via sysctl.d. Due to Step 2 of this post, I’ve removed all of these suggestions from the wiki. However, if you wish, I’ve saved them in my github.
I just enable this service.
[Unit] Description=Powertop tunings [Service] Type=oneshot ExecStart=/usr/bin/powertop --auto-tune [Install] WantedBy=multi-user.target
Read the TLP archwiki and get it installed.
Configure /etc/default/tlp to your preferred setting. I don’t control the cpu freqs as that will be done in step 4. I also use linux-ck so instead of selecting an IO scheduler I leave it commented out. CK patchset uses BFQ. Go take a look at graysky’s repo if you wish to use the CK patched kernel.
A TLP config I am working on is on my github.
Note: I had to edit TLP which was causing an ATA error after suspend. Read about it here.
Install pstate-frequency-git from AUR. This is a handy tool to help control cpu governor, cpu frequency, and turbo boost. For normal day to day stuff leaving it at powersave plan works best for me. That is a min/max of 30% cpu frequency which is 800mhz and no turboboost. When I do something heavier besides browsing, music, weechat, etc. like compiling, then I would bump it to the performance plan. Optionally you can stay in powersave and just increase cpu max from 30% to 100% and enable turbo. Create aliases in your shell for these manual changes. Automatically via udev, this will go from powersave plan on batt and performance plan on ac. To see how to use pstate-frequency, visit the upstream github page with syntax and info here.
Install both items from AUR.
Add to /etc/default/grub
That’s it! The battery life with this setup is not on par with mac osx but it brings enough life where I’m not constantly worrying about the battery life. It also keeps my MBA cool like a pickle. I used to use powerdown but realized development stopped awhile ago. TLP was mentioned to me by Iamikon, so thanks brother for letting me check this out. As always, if you guys feel like there is something better out there, please share!