danten.io

ath9k: WiFi Power Saving for Atheros 802.11n

How to enable power saving for your Atheros ath9k Wifi card and squeeze out more battery life.

You want to keep your system free of binary blobs and any non-free firmware that has to be loaded from userspace. With most of today’s modern hardware, that’s no easy task.

You use an ath9k card. No binary blobs. Your WiFi.

When it comes to WiFi cards, you’ll find that you really don’t have too many options if you want to keep your system as binary blob free as possible. One of the few devices out there that comes to mind are the Atheros 802.11n cards that use the free open source ath9k driver.

Even though they might not really keep up with more modern WiFi cards in terms of speed and throughput, I can warmly recommend these firmware-free little things:

They’re easy to use, align with my values and give me peace of mind.

You can simply use your Linux system without being dependent on binary blobs or proprietary drivers-firmware for something as vital as your networking interface.

Power Saving Mode with Atheros 802.11n

So when working on my laptop, I tend to be away from power outlets once in a while, and I generally do my best to squeeze out a little more battery time from my system.

A first step when optimizing your laptop battery is to use powertop by simply doing that $apt install powertop and fire it up. Read the powertop man page for more.

Now, when it comes to optimizations, I realized that on my ThinkPad x230 the WiFi wlan0 device couldn’t really be set to power saving mode.

So how to active power saving for the Atheros 802.11n using the ath9k FOSS driver?

First, list the possible kernel module parameters by doing a:

$ /sbin/modinfo ath9k

You see the power saving option? Fine, we’ll go on a remove the module from the Linux kernel, which will also disable any active WiFi connection you have on that interface, like this:

$ modprobe -r ath9k

Then we simply load it up again, this time with power saving option enabled:

$ modprobe ath9k ps_enable=1

Fire up powertop again, and you should be able to set the power saving mode for your WiFi card.

Once you can confirm that this works just like you want it, you can make this change permanent. Just add options ath9k ps_enable=1 to /etc/modprobe.d/ath9kps.conf and you’re good to go.

Take a mental note of your change or - as you obviously should do - log it, so that just in case you bump into any unexpected WiFi issues down the road you can easily reload the default setting.

For me, enabling power saving mode on the athk9 actually makes a tangible difference for my setup, and I manage to run this 10 year old x230 on like 6W, with a 6 cell battery giving it enough juice for a 8-12 hours or so. But of course you always bring a spare backup battery, yes? So I’d halt the box, swap out the removable battery and boot up using my spare backup. Set to go for another 8-10 hours.

The ThinkPad x230 is an amazing device and a highly powerful machine. It’s one of the few laptops that make great daily drivers and also run Coreboot and a neutralized Intel ME.

So how do you get one? It’s easy. First you’d get a 2nd hand ThinkPad x230 from a trusted source or supplier, they come around for really cheap on places like eBay. Then read all them manuals and tinker, flash the x230 with Coreboot…or just send it to the fine folks over at the ThinkPad Coreboot Installation Service by vikings.net, who provide us with the following good service:

We’ll flash your laptop with coreboot, neutralize the Intel ME backdoor, do a hardware check and renew the CPU thermal paste.

If you have the funds simply buy a sleek Vikings ThinkPad x230 and live happily ever after.

That’d be a story for some other night.

:wq!

#Debian #WiFi