diff options
author | Hans de Goede <hdegoede@redhat.com> | 2024-12-11 18:44:50 +0100 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2024-12-13 00:39:38 +0100 |
commit | 5d417a5e7ade02a7b75cd886d8afe3e9025e7e25 (patch) | |
tree | 9cc0f623e670994d1c18a0390b16faf54f821f76 /drivers | |
parent | d24bf99214b199c25f9c2cb04b3a4993d1c7ab60 (diff) |
power: supply: bq24190_charger: Add support for "charge_types" property
The bq24190 power_supply class device has a writeable "charge_type"
property, add support for the new "charge_types" property. Reading this
returns a list of supported charge-types with the currently active type
surrounded by square brackets, allowing userspace to find out which
enum power_supply_charge_type values are supported.
This has been tested on a GPD win gaming-handheld.
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20241211174451.355421-4-hdegoede@redhat.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/supply/bq24190_charger.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c index b71e21a0196a..1e49de324181 100644 --- a/drivers/power/supply/bq24190_charger.c +++ b/drivers/power/supply/bq24190_charger.c @@ -1313,6 +1313,7 @@ static int bq24190_charger_get_property(struct power_supply *psy, switch (psp) { case POWER_SUPPLY_PROP_CHARGE_TYPE: + case POWER_SUPPLY_PROP_CHARGE_TYPES: ret = bq24190_charger_get_charge_type(bdi, val); break; case POWER_SUPPLY_PROP_HEALTH: @@ -1393,6 +1394,7 @@ static int bq24190_charger_set_property(struct power_supply *psy, ret = bq24190_charger_set_temp_alert_max(bdi, val); break; case POWER_SUPPLY_PROP_CHARGE_TYPE: + case POWER_SUPPLY_PROP_CHARGE_TYPES: ret = bq24190_charger_set_charge_type(bdi, val); break; case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: @@ -1421,6 +1423,7 @@ static int bq24190_charger_property_is_writeable(struct power_supply *psy, case POWER_SUPPLY_PROP_ONLINE: case POWER_SUPPLY_PROP_TEMP_ALERT_MAX: case POWER_SUPPLY_PROP_CHARGE_TYPE: + case POWER_SUPPLY_PROP_CHARGE_TYPES: case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT: @@ -1469,6 +1472,7 @@ static void bq24190_charger_external_power_changed(struct power_supply *psy) static enum power_supply_property bq24190_charger_properties[] = { POWER_SUPPLY_PROP_CHARGE_TYPE, + POWER_SUPPLY_PROP_CHARGE_TYPES, POWER_SUPPLY_PROP_HEALTH, POWER_SUPPLY_PROP_ONLINE, POWER_SUPPLY_PROP_STATUS, @@ -1498,6 +1502,9 @@ static const struct power_supply_desc bq24190_charger_desc = { .set_property = bq24190_charger_set_property, .property_is_writeable = bq24190_charger_property_is_writeable, .external_power_changed = bq24190_charger_external_power_changed, + .charge_types = BIT(POWER_SUPPLY_CHARGE_TYPE_NONE) | + BIT(POWER_SUPPLY_CHARGE_TYPE_TRICKLE) | + BIT(POWER_SUPPLY_CHARGE_TYPE_FAST), }; /* Battery power supply property routines */ |