mbox series

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

Message ID 20240303-power_supply-charge_behaviour_prop-v2-0-8ebb0a7c2409@weissschuh.net (mailing list archive)
Headers show
Series power: supply: core: align charge_behaviour format with docs | expand

Message

Thomas Weißschuh March 3, 2024, 3:31 p.m. UTC
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@weissschuh.net>
---
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@weissschuh.net

---
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,