|
|
Subscribe / Log in / New account

power: supply: Add new "charge_types" property

From:  Hans de Goede <hdegoede-AT-redhat.com>
To:  Sebastian Reichel <sre-AT-kernel.org>
Subject:  [PATCH 0/4] power: supply: Add new "charge_types" property
Date:  Sun, 08 Sep 2024 21:22:59 +0200
Message-ID:  <20240908192303.151562-1-hdegoede@redhat.com>
Cc:  Hans de Goede <hdegoede-AT-redhat.com>, Jelle van der Waa <jelle-AT-vdwaa.nl>, Thomas Weißschuh <linux-AT-weissschuh.net>, linux-pm-AT-vger.kernel.org
Archive-link:  Article

Hi,

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

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(-)

-- 
2.46.0




Copyright © 2024, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds