Re: [PATCH v3 3/4] power: supply: bq24190_charger: Add support for "charge_types" property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024-12-09 21:40:50+0100, Hans de Goede wrote:
> 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.
> 
> Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>

Reviewed-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>

> ---
>  drivers/power/supply/bq24190_charger.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
> index 2b393eb5c282..0101aaca1a97 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 */
> -- 
> 2.47.1
> 




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux