mbox series

[0/4] power: supply: Add new "charge_types" property

Message ID 20240908192303.151562-1-hdegoede@redhat.com
Headers show
Series power: supply: Add new "charge_types" property | expand

Message

Hans de Goede Sept. 8, 2024, 7:22 p.m. UTC
Hi,

As first discussed here:
https://lore.kernel.org/linux-pm/49993a42-aa91-46bf-acef-4a089db4c2db@redhat.com/

Some power_supply devices have a writable charge_type property, but
userspace cannot know which charge_type values are valid to write.

This series adds a new "charge_types" property, which is identical to
"charge_type" but reading returns a list of supported charge-types with
the currently active type surrounded by square brackets, e.g.:

Fast [Standard] "Long Life"

this allows userspace to find out which charge-types are supported.

Patch 1/4 does some prep work and patch 2/4 is the core implementation
of "charge_types" property support.

Patch 3/4 is a standard psy-driver user of the new "charge_types"
property support. Patch 4/4 shows an ACPI battery extension driver
with support for this property using the new show()/store() helpers.

Note patch 4/4 depends on patches from platform-drivers-x86/for-next
and is marked as RFC because of this. This can be applied later.

This series is based on top of linux-power-supply/for-next.

Regards,

Hans


Hans de Goede (4):
  power: supply: sysfs: Make power_supply_show_enum_with_available()
    deal with labels with a space
  power: supply: core: Add new "charge_types" property
  power: supply: bq24190_charger: Add support for "charge_types"
    property
  platform/x86: dell-laptop: Use power_supply_charge_types_show/_parse()
    helpers

 Documentation/ABI/testing/sysfs-class-power | 15 ++++++
 drivers/platform/x86/dell/dell-laptop.c     | 54 ++++++++++-----------
 drivers/power/supply/bq24190_charger.c      |  7 +++
 drivers/power/supply/power_supply_sysfs.c   | 37 +++++++++++++-
 include/linux/power_supply.h                | 23 ++++++++-
 5 files changed, 105 insertions(+), 31 deletions(-)