Skip to content

Instantly share code, notes, and snippets.

@andreyv
Created November 1, 2022 16:51
Show Gist options
  • Save andreyv/d6ae8dd2ef98fc665dd1b6c8dc38a013 to your computer and use it in GitHub Desktop.
Save andreyv/d6ae8dd2ef98fc665dd1b6c8dc38a013 to your computer and use it in GitHub Desktop.
Battery charge control for Jolla C
SUBSYSTEM=="power_supply", KERNEL=="battery", ATTR{capacity}=="[8-9][0-9]|100", ATTR{charging_enabled}=="1", ATTR{charging_enabled}="0"
SUBSYSTEM=="power_supply", KERNEL=="battery", ATTR{capacity}=="[0-9]|[1-6][0-9]", ATTR{charging_enabled}=="0", ATTR{charging_enabled}="1"
These udev rules stop charging the battery at 80% and resume charging below 70%.
However, once charging stops, the battery starts discharging even when connected
to a charger. I have not yet found a way to enable trickle charging with the
qpnp-linear-charger driver. There seems to be a "qcom,float-charge" Devicetree
property, which may or may not be relevant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment