]> www.infradead.org Git - users/willy/xarray.git/commit
power: supply: core: Add new "charge_types" property
authorHans de Goede <hdegoede@redhat.com>
Wed, 11 Dec 2024 17:44:49 +0000 (18:44 +0100)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 12 Dec 2024 23:39:38 +0000 (00:39 +0100)
commitd24bf99214b199c25f9c2cb04b3a4993d1c7ab60
tree2832737a53eca0b0045e7a9f52db13add46c9100
parent250bbd612bb1103745ea6c891a2a1d5f5e1576a3
power: supply: core: Add new "charge_types" property

Add a new "charge_types" property, this 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 has the advantage over the existing "charge_type" property that this
allows userspace to find out which charge-types are supported for writable
charge_type properties.

Drivers which already support "charge_type" can easily add support for
this by setting power_supply_desc.charge_types to a bitmask representing
valid charge_type values. The existing "charge_type" get_property() and
set_property() code paths can be re-used for "charge_types".

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241211174451.355421-3-hdegoede@redhat.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Documentation/ABI/testing/sysfs-class-power
drivers/power/supply/power_supply_sysfs.c
include/linux/power_supply.h