Re: [RFC PATCH] axp209 PMIC: setting constant_charge_current to 0 disables battery charging

From: Chen-Yu Tsai
Date: Mon Apr 26 2021 - 04:40:59 EST


Hi,

On Wed, Apr 21, 2021 at 5:05 PM <Hermann.Lauer@xxxxxxxxxxxxxxxxx> wrote:
>
> Dear Maintainers,

First of all, please format the subject line like other commits to the
same file. So that would be:

power: supply: axp20x_battery: <change>

> this proposed patch allows setting constant_charge_current to 0 on axp209
> PMIC to disable charging. constant_charge_current_max with a value of 0 makes
> no sense and should still report the maximum allowed value, so the getter code
> is unrolled for the POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT case.

This is probably not the right way to do it.

The sysfs ABI docs say that some chargers implement a writable "status" sysfs
property to allow disabling the charger [1]. IMO this is the proper place to
enable/disable the charger. POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT only
refers to the "constant current" portion of the charge cycle, and should not
be used to implement full control of the charger.


Regards
ChenYu

[1] https://elixir.bootlin.com/linux/latest/source/Documentation/ABI/testing/sysfs-class-power#L444