Re: [ibm-acpi-devel] [PATCH 0/4] power: supply: add charge_behaviour property (force-discharge, inhibit-charge)

From: Kevin Locke
Date: Thu Nov 25 2021 - 13:25:35 EST


On Wed, 2021-11-24 at 00:27 +0100, Thomas Weißschuh wrote:
> this series adds support for the charge_behaviour property to the power
> subsystem and thinkpad_acpi driver.

Wonderful! Thanks for working on this.

I can confirm inhibit-charge and force-discharge states work with
patch v2 on v5.16-rc2 on a T430 (2342-CTO) with BIOS G1ETC2WW (2.82 ),
EC G1HT36WW and a single battery. Most behavior is as expected:

- With force-discharge, status becomes "Discharging" and energy_now
drops over time while AC remains connected.
- With inhibit-charge, status becomes "Unknown" and energy_now is
stable over time, even when not fully charged.
- With auto, status becomes "Charging" and energy_now rises over time.
- charge_behaviour takes precedence over
charge_control_{start,end}_threshold: status remains
Discharging/Unknown when below the start threshold, either due to
discharge or threshold change.
- charge_behaviour is preserved over soft reboot.
- inhibit-charge/auto are preserved across battery removal and
reinsertion.
- inhibit-charge/auto are preserved across s2ram (S3).
- With force-discharge, if the battery is removed, the machine
immediately powers off.

Some behavior is a little surprising:

- charge_behaviour can not be set to force-discharge if AC is
disconnected (EIO). If charge_behaviour is force-discharge when AC
is disconnected, it changes to auto, unlike inhibit-charge.
- charge_behavior force-discharge is not preserved across s2ram (S3),
unlike inhibit-charge.
- charge_behaviour is not preserved across hard reset (unlike charge
thresholds). Interestingly, it appears that inhibit-charge is
preserved across power-off (no charging is observed while powered
off) but not power-on, even though it is preserved across soft
reboot, as noted above.

I assume the behavior is under the control of the EC, so these aren't
criticisms of the patch. Just some observations.

Tested-by: Kevin Locke <kevin@xxxxxxxxxxxxxxx>

Thanks again,
Kevin