mbox series

[0/2] More AB8500 charging props

Message ID 20211122234141.3356340-1-linus.walleij@linaro.org (mailing list archive)
Headers show
Series More AB8500 charging props | expand

Message

Linus Walleij Nov. 22, 2021, 11:41 p.m. UTC
These two patches begin to put new stuff into the
drivers/power/supply/ab8500_bmdata.c for:

A) battery temperature look-up and interpolation, and
B) maintenance charging

Some design choices can be discussed, so I included some
HWMON etc maintainers.

NTC resistor:

For the battery NTC temperature we should note the existing NTC
driver in drivers/hwmon/ntc_thermistor.c with bindings
in Documentation/devicetree/bindings/hwmon/ntc-thermistor.yaml
which is used for stand-alone NTC resistors.

It is probably possible to try to reuse the hwmon code but I
wanted to see if we have buy-in from the hwmon maintainer first.

If yes, I will try to come up with some way of representing the
NTC resistor in the device tree and use it in-tree from the
charging drivers.

Maintenance charging:

I included an infrastructure for maintenance "charging points"
which constitute of a current, a voltage and a safety timer:

struct power_supply_maintenance_charge_table {
       int charge_current_max_ua;
       int charge_voltage_max_uv;
       int charge_safety_timer_minutes;
};

This is all pretty straight-forward if just adding maintenance
charging.

For the bigger picture, however, a charging point can also
include the existing CC/CV current and voltage and the
precharging current and voltage as two charging points,
possibly without corresponding safety timer. If this is
desired I will rework the patch to refactor the existing
currents and voltages into charging points as well.

Linus Walleij (2):
  power: supply: ab8500: Standardize NTC battery temp
  power: supply: ab8500: Standardize maintenance charging

 drivers/power/supply/ab8500-bm.h         | 30 --------
 drivers/power/supply/ab8500_bmdata.c     | 68 +++++++++-------
 drivers/power/supply/ab8500_btemp.c      | 45 +----------
 drivers/power/supply/ab8500_chargalg.c   | 41 +++++++---
 drivers/power/supply/power_supply_core.c | 63 +++++++++++++++
 include/linux/power_supply.h             | 98 ++++++++++++++++++++++++
 6 files changed, 237 insertions(+), 108 deletions(-)

Comments

Guenter Roeck Nov. 23, 2021, 12:23 a.m. UTC | #1
On 11/22/21 3:41 PM, Linus Walleij wrote:
> These two patches begin to put new stuff into the
> drivers/power/supply/ab8500_bmdata.c for:
> 
> A) battery temperature look-up and interpolation, and
> B) maintenance charging
> 
> Some design choices can be discussed, so I included some
> HWMON etc maintainers.
> 
> NTC resistor:
> 
> For the battery NTC temperature we should note the existing NTC
> driver in drivers/hwmon/ntc_thermistor.c with bindings
> in Documentation/devicetree/bindings/hwmon/ntc-thermistor.yaml
> which is used for stand-alone NTC resistors.
> 
> It is probably possible to try to reuse the hwmon code but I
> wanted to see if we have buy-in from the hwmon maintainer first.
> 
Go ahead; anything that reduces code duplication is desirable.

Guenter