set battery idle on framework machines

Apparently changes made via ectool only survive power off if the laptop
remains plugged in, so in practice we have to set this on every boot.

https://wiki.archlinux.org/title/Framework_Laptop_13#Battery_control

Setting the lower and upper charge percentage to the same value causes
the controller to idle the battery at that percentage. This seems like
it would be better for the long term health of the battery than giving
the battery a range to constantly dis/charge between. It also feels more
like what I'm used to from all my years of Thinkpads and TLP.

I have also set the max charge on my battery to 90% in the BIOS, as per:
https://guides.frame.work/Guide/Enabling+Battery+Saver+Functionality+in+BIOS/392
This commit is contained in:
Pig Monkey 2025-01-14 08:23:17 -08:00
parent 35b94beb41
commit 1d4dc29b73
4 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,5 @@
[Service]
ExecStart=ectool chargecontrol normal 87 87
[Install]
WantedBy=default.target

View file

@ -6,3 +6,8 @@
service:
name: power_monitor.service
state: restarted
- name: restart charge control
service:
name: chargecontrol.service
state: restarted

View file

@ -0,0 +1,27 @@
---
- name: Install fw-ectool-git
kewlfft.aur.aur:
name: fw-ectool-git
become: yes
become_user: "{{ aur.user }}"
tags:
- aur
- framework
- name: Copy charge control service
copy:
src: chargecontrol.service
dest: /etc/systemd/system/
notify:
- reload systemd config
- restart charge control
tags:
- framework
- name: Enable and start charge control service
service:
name: chargecontrol.service
enabled: yes
state: started
tags:
- framework

View file

@ -5,6 +5,9 @@
- include_tasks: tuned.yml
when: power_management is defined and power_management == "tuned"
- include_tasks: framework.yml
when: power_management is defined and power_management == "tuned" and ansible_system_vendor == "Framework"
- name: Install x86_energy_perf_policy
pacman:
name: x86_energy_perf_policy