STRUCT POWER_SUPPLY_MAINTENANCE_CHARGE_TABLE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct power_supply_maintenance_charge_table(9) πŸ’–

okay bestie, buckle up β€” this one's straight out of the Kernel API Manual and it's literally the glow-up your battery deserves. It's the struct that holds the settings for maintenance charging. πŸ”‹βœ¨


🌸 NAME 🌸

struct power_supply_maintenance_charge_table β€” the settings for maintenance charging. yes, that's the whole vibe. πŸŽ€


✨ SYNOPSIS ✨

struct power_supply_maintenance_charge_table {
    int charge_current_max_ua;
    int charge_voltage_max_uv;
    int charge_safety_timer_minutes;
 };

three ints. that's the whole struct. iconic minimalism. πŸ’…


🫢 Members 🫢

  • charge_current_max_ua β€” the maintenance charging current, the one that keeps your battery topped all the way up as current gets eaten after full charging. and here's the cute part: its buddy charge_voltage_max_uv acts as a safeguard β€” the moment we hit that voltage, the maintenance charging current gets switched off. and if we drop back below that voltage? it comes right back on. it's giving mindful, self-regulating queen. πŸ‘‘
  • charge_voltage_max_uv β€” the maintenance charging voltage, and it's usually a bit lower than constant_charge_voltage_max_uv. we can keep applying this setting's charge_current_max_ua until we climb back up to this voltage. lowkey a whole little push-and-pull situation. 🌊
  • charge_safety_timer_minutes β€” the maintenance charging safety timer, with an expiry time in minutes. so here's the tea: we only use maintenance charging in this setting for a certain amount of time, and then we first move on to the next maintenance charge current and voltage pair in the respective array and wait for the next safety timer timeout β€” or, if we've already reached the last maintenance charging setting, charging gets disabled until we reach charge_restart_voltage_uv, and ordinary CC/CV charging restarts from there. these timers should be chosen to align with the typical discharge curve for the battery. no vibes-based timer choices, bestie. πŸ“Š

πŸ’€ Description πŸ’€

so ordinary CC/CV charging stops charging when the charge current drops below charge_term_current_ua, and then restarts it (if the device is still plugged into the charger, iykyk) at charge_restart_voltage_uv. this happens in most consumer products because the power usage while connected to a charger is not zero, and devices are just not manufactured to draw power directly from the charger β€” instead they will at all times dissipate the battery a little, like the power used in standby mode. 😭

over time that gives you a charge graph that looks like this:

       Energy ^      ...        ...      ...      ...      ...      ...
       ...  |    .   .       .  .     .  .     .  .     .  .     .  .     .  |
       ..     .   ..     .  ..    .  ..    .  ..    .  ..    .  ..  |.
       ..        ..       ..       ..       ..       ..
       +-------------------------------------------------------------------> t

practically, this means the Li-ions are wandering back and forth inside the battery, and that causes degeneration of the battery anode and cathode. πŸ’€ so to prolong the life of the battery, maintenance charging is applied after reaching charge_term_current_ua to hold up the charge in the battery while consuming power β€” which lowers the wear on the battery:

       Energy ^      .......................................  |    .
       ......................  |  ..  |.
       +-------------------------------------------------------------------> t

maintenance charging uses the voltages from this table: a table of settings is traversed using a slightly lower current and voltage than what's used for CC/CV charging. πŸ¦‹ and for safety reasons the maintenance charging will not go on indefinitely β€” we lower the current and voltage with successive maintenance settings, then disable charging completely after we reach the last one, and after that we do not restart charging until we reach charge_restart_voltage_uv (see struct power_supply_battery_info) and restart ordinary CC/CV charging from there. periodt. πŸ”₯

as an example, a Samsung EB425161LA Lithium-Ion battery is CC/CV charged at 900mA to 4340mV, then maintenance charged at 600mA and 4150mV for up to 60 hours, then maintenance charged at 600mA and 4100mV for up to 200 hours. after this the charge cycle is restarted waiting for charge_restart_voltage_uv. the way that's a whole skincare routine for a battery πŸ§–β€β™€οΈπŸ’–

for most mobile electronics this type of maintenance charging is enough for the user to disconnect the device and make use of it before both maintenance charging cycles are complete β€” if the current and voltage has been chosen appropriately. and these need to be determined from battery discharge curves and expected standby current. no guessing, bestie, do your research. πŸ”

if the voltage anyway drops to charge_restart_voltage_uv during maintenance charging, ordinary CC/CV charging gets restarted. this can happen if the device is e.g. actively used during charging, so more current is drawn than the expected stand-by current. also overvoltage protection will be applied as usual. πŸ›‘οΈ


πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./include/linux/power_supply.h struct power_supply_battery_info(9)

and that's the whole page, no cap πŸ’œ this lil gem lives in ./include/linux, dated October 2026, and it's the struct power_supply_maintenance_charge_table(9) era β€” go forth and treat your battery like the main character it is πŸŒˆβ­πŸ“

πŸ“¦ where this page comes from