diff mbox series

power: supply: Explain maintenance charging

Message ID 20220719114131.62470-1-linus.walleij@linaro.org
State Accepted
Commit a1c7c1a40478db4edef8ad0a0c6975c8921088b7
Headers show
Series power: supply: Explain maintenance charging | expand

Commit Message

Linus Walleij July 19, 2022, 11:41 a.m. UTC
In order for everyone to understand clearly why we want to use
maintenance charging for batteries, expand the description with two
diagrams and some text.

Cc: Matti Vaittineen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 include/linux/power_supply.h | 48 +++++++++++++++++++++++++++++++-----
 1 file changed, 42 insertions(+), 6 deletions(-)

Comments

Vaittinen, Matti Aug. 3, 2022, 4:54 a.m. UTC | #1
On 7/19/22 14:41, Linus Walleij wrote:
> In order for everyone to understand clearly why we want to use
> maintenance charging for batteries, expand the description with two
> diagrams and some text.
> 
> Cc: Matti Vaittineen <matti.vaittinen@fi.rohmeurope.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

I guess I am horribly late when catching up with my mailbox after the 
summer... Well, I just wanted to say that I love this patch!

Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Linus Walleij Sept. 10, 2022, 7:01 p.m. UTC | #2
On Tue, Jul 19, 2022 at 1:43 PM Linus Walleij <linus.walleij@linaro.org> wrote:

> In order for everyone to understand clearly why we want to use
> maintenance charging for batteries, expand the description with two
> diagrams and some text.
>
> Cc: Matti Vaittineen <matti.vaittinen@fi.rohmeurope.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Sebastian, could you apply this patch?

I think I sent it in the merge window, so easily missed.

Yours,
Linus Walleij
Sebastian Reichel Sept. 11, 2022, 8:58 a.m. UTC | #3
Hi Linus,

On Sat, Sep 10, 2022 at 09:01:38PM +0200, Linus Walleij wrote:
> On Tue, Jul 19, 2022 at 1:43 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> > In order for everyone to understand clearly why we want to use
> > maintenance charging for batteries, expand the description with two
> > diagrams and some text.
> >
> > Cc: Matti Vaittineen <matti.vaittinen@fi.rohmeurope.com>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Sebastian, could you apply this patch?
> 
> I think I sent it in the merge window, so easily missed.

Yes, merged now. FWIW I did not miss it, but I was busy the last
weeks and did not yet collect power-supply patches.

-- Sebastian
diff mbox series

Patch

diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index cb380c1d9459..aa2c4a7c4826 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -374,9 +374,37 @@  struct power_supply_vbat_ri_table {
  *   These timers should be chosen to align with the typical discharge curve
  *   for the battery.
  *
- * When the main CC/CV charging is complete the battery can optionally be
- * maintenance charged at the voltages from this table: a table of settings is
- * traversed using a slightly lower current and voltage than what is used for
+ * Ordinary CC/CV charging will stop charging when the charge current goes
+ * below charge_term_current_ua, and then restart it (if the device is still
+ * plugged into the charger) 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 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. This will over time give a charge graph
+ * such as this:
+ *
+ * Energy
+ *  ^      ...        ...      ...      ...      ...      ...      ...
+ *  |    .   .       .  .     .  .     .  .     .  .     .  .     .
+ *  |  ..     .   ..     .  ..    .  ..    .  ..    .  ..    .  ..
+ *  |.          ..        ..       ..       ..       ..       ..
+ *  +-------------------------------------------------------------------> t
+ *
+ * Practically this means that the Li-ions are wandering back and forth in the
+ * battery and this causes degeneration of the battery anode and cathode.
+ * 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, thus lowering 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 is used for
  * CC/CV charging. The maintenance charging will for safety reasons not go on
  * indefinately: we lower the current and voltage with successive maintenance
  * settings, then disable charging completely after we reach the last one,
@@ -385,14 +413,22 @@  struct power_supply_vbat_ri_table {
  * ordinary CC/CV charging from there.
  *
  * 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
- * 60 hours, then maintenance charged at 600mA and 4100mV for 200 hours.
+ * 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.
  *
  * 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.
+ * charging cycles are complete, if the current and voltage has been chosen
+ * appropriately. These need to be determined from battery discharge curves
+ * and expected standby current.
+ *
+ * If the voltage anyway drops to charge_restart_voltage_uv during maintenance
+ * charging, ordinary CC/CV charging is 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.
  */
 struct power_supply_maintenance_charge_table {
 	int charge_current_max_ua;