Re: [PATCH v2 1/2] power: supply: cpcap-battery: Add battery type auto detection for mapphone devices

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

 



* Carl Philipp Klemm <philipp@xxxxxxxx> [210424 09:17]:
> > The battery inserted property is still based on the presence of a thermistor, so I don't see how this patch changes the bevior with regards to this use case at all except for that info print. Previously the battery information struct was simply set to the values expected from eb41 no matter what.

OK sounds like I should test these patches with a power supply.

> Vefore writing this patch i did use the below on my xt875, which dose what you ask. maybe this is something you would like to see included in addition to the above? if so i can submitt it aswell:
> 
> [PATCH] power: supply: cpcap-battery: make charge_full_design writeable, so that different/custom batteries can be used.
> 
> Especially usfull on XTT875 where both HW4X and BW8X exsist

Yeah I think for generic batteries we should require that the battery
properties get initialized. Also the type can be li-ion vs li-po, I think
the charge voltage we already have configurable.

Regards,

Tony

> ---
>  drivers/power/supply/cpcap-battery.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
> index be8d8b746f24..6465cb1b084c 100644
> --- a/drivers/power/supply/cpcap-battery.c
> +++ b/drivers/power/supply/cpcap-battery.c
> @@ -769,6 +769,13 @@ static int cpcap_battery_set_property(struct power_supply *psy,
>  
>  		ddata->charge_full = val->intval;
>  
> +		return 0;
> +			case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
> +		if (val->intval < 0)
> +			return -EINVAL;
> +
> +		ddata->config.info.charge_full_design = val->intval;
> +
>  		return 0;
>  	default:
>  		return -EINVAL;
> @@ -783,6 +790,7 @@ static int cpcap_battery_property_is_writeable(struct power_supply *psy,
>  	switch (psp) {
>  	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
>  	case POWER_SUPPLY_PROP_CHARGE_FULL:
> +	case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
>  		return 1;
>  	default:
>  		return 0;
> -- 
> 2.31.0



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux