[PATCH v2 0/4] power: supply: core: align charge_behaviour format with docs

From: Thomas Weißschuh
Date: Sun Mar 03 2024 - 10:31:49 EST


The original submission of the charge_behaviour property did not
implement proper formatting in the default formatting handler in
power_supply_sysfs.c.

At that time it was not a problem because the only provider of the UAPI,
thinkpad_acpi, did its own formatting.

Now there is an in-tree driver, mm8013, and out-of-tree driver which use
the normal power-supply properties and are affected by the wrong
formatting.
In this revision the handling of CHARGE_BEHAVIOUR in mm8013 is dropped
as it is not the correct API for it to use.
That change was not tested by me as I don't have the hardware.

Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
Changes in v2:
- Simplify the backwards-compatibility logic (adds a preparatory patch)
- Extend test-power to also handle writing of charge_behaviour
- Drop incorrect CHARGE_BEHAVIOUR from mm8013 driver
- Replace special CHARGE_BEHAVIOUR_AVAILABLE property with bitmask in
struct power_supply_desc
- Link to v1: https://lore.kernel.org/r/20240204-power_supply-charge_behaviour_prop-v1-0-06a20c958f96@xxxxxxxxxxxxxx

---
Thomas Weißschuh (4):
power: supply: mm8013: fix "not charging" detection
power: supply: core: ease special formatting implementations
power: supply: core: fix charge_behaviour formatting
power: supply: test-power: implement charge_behaviour property

drivers/power/supply/mm8013.c | 13 ++-----------
drivers/power/supply/power_supply_sysfs.c | 32 +++++++++++++++++++++++++------
drivers/power/supply/test_power.c | 31 ++++++++++++++++++++++++++++++
include/linux/power_supply.h | 1 +
4 files changed, 60 insertions(+), 17 deletions(-)
---
base-commit: 04b8076df2534f08bb4190f90a24e0f7f8930aca
change-id: 20230929-power_supply-charge_behaviour_prop-10ccfd96a666

Best regards,
--
Thomas Weißschuh <linux@xxxxxxxxxxxxxx>