NGnius / PowerTools

Moved to
https://git.ngni.us/NG-SD-Plugins/PowerTools
GNU General Public License v3.0
414 stars 29 forks source link

Battery charge control #23

Closed NGnius closed 2 years ago

NGnius commented 2 years ago

Describe what you'd like to be able to do Control battery charge rate

Describe alternatives you've considered Live with the battery charging settings as-is. Not great for power users, though.

Additional context as root, write to /sys/class/hwmon/hwmon5/maximum_battery_charge_rate (max input current in mA). Range is 250 to 2500, default is 2500. If you write 250 here the battery will charge really slowly while still allowing you to play on AC power

to check input current to the battery right now: /sys/class/power_supply/BAT1/current_now (check input current in uA)

(from https://discord.com/channels/865611969661632521/865651345083203644/1003509877915795507 ) I've discussed this with a couple of people before as well, but this is the first time I decided to actually write it down lol

coolbho3k commented 2 years ago

Disassembly of the Deck's DSDT ACPI table with the CHGR method: https://gist.github.com/coolbho3k/47e4eeb37c8927ff703c40fab2bb4e11#file-steam_deck_dsdt-dsl-L5270

Writing to maximum_battery_charge_rate calls CHGR with the specified argument.

The disassembly is how I know that only 250 <= x <= 2500 works.

Also see drivers/platform/x86/jupiter.c in the kernel tree, where maximum_battery_charge_rate device is defined.

NGnius commented 2 years ago

Thanks again for the work to figure out this API. It's currently working on the main branch, and will be in the next release version.