Skip to content

power: supply: max17042: support Maxim MAX77759 fuel gauge

André Draszik linux-devicetree linux-pm lkml stable 3 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected] change-id 20260226-max77759-fg-0f4bf0816ced

Versions newest first

  1. v3 Latest11 patches 1 replyApplied
  2. v211 patches 5 repliesSuperseded
  3. v111 patches 1 replySuperseded

Changes in v3 from the cover letter

- update commit message patch 5 (dev_err_probe)
- drop stray comment patch 6 (overflow)
- add Fixes tag to patch 6 (overflow) (Pete)
- collect tags
- Link to v2: https://lore.kernel.org/r/[email protected]

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/11dt-bindings: power: supply: max17042: add support for max77759Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml+2 -10 replies
2/11dt-bindings: power: supply: max17042: support shunt-resistor-micro-ohmsDocumentation/devicetree/bindings/power/supply/maxim,max17042.yaml+6 -00 replies
3/11dt-bindings: power: supply: max17042: drop formatting specifier |Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml+6 -60 replies
4/11power: supply: max17042: fix a comment typo (then -> than)drivers/power/supply/max17042_battery.c+1 -10 replies
5/11power: supply: max17042: use dev_err_probe() where appropriatedrivers/power/supply/max17042_battery.c+9 -120 replies
6/11power: supply: max17042: avoid overflow when determining healthdrivers/power/supply/max17042_battery.c+1 -10 replies
7/11power: supply: max17042: time to empty is meaningless when chargingdrivers/power/supply/max17042_battery.c+4 -00 replies
8/11power: supply: max17042: support standard shunt-resistor-micro-ohms DT propertydrivers/power/supply/max17042_battery.c+5 -10 replies
9/11power: supply: max17042: initial support for Maxim MAX77759drivers/power/supply/max17042_battery.c include/linux/power/max17042_battery.h+77 -60 replies
10/11power: supply: max17042: consider task period (max77759)drivers/power/supply/max17042_battery.c include/linux/power/max17042_battery.h+21 -00 replies
11/11power: supply: max17042: report time to full (max17055 & max77759)drivers/power/supply/max17042_battery.c+16 -00 replies

Reviews trailers per patch

10 of 11 patches have a Reviewed-by or Acked-by.

PatchPeter GriffinConor Dooley
1/11R-b A-b
2/11R-b A-b
3/11A-b
4/11R-b
5/11R-b
6/11
7/11R-b
8/11R-b
9/11R-b
10/11R-b
11/11R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/11] power: supply: max17042: support Maxim MAX77759 fuel gauge

Hi,

This series adds support for the fuel gauge integrated into the Maxim MAX77759, which is a companion PMIC intended for use in mobile phones and tablets and is used on Google Pixel 6 and 6 Pro (oriole and raven).

Amongst others, the PMIC contains a fuel gauge employing the Maxim ModelGauge m5 algorithm, that is similar to the ones supported by the max17042 driver and binding.

The Maxim ModelGauge m5 algorithm, as well as previous generations like m3 on max17047/max17050, requires the host to save/restore some register values across power cycles to maintain full accuracy. Extending the driver for such support is out of scope in this initial series.

The series starts with binding updates, followed by driver updates and improvements in preparation for finally adding max77759 support.

A DT update for Pixel 6 has been posted in
https://lore.kernel.org/all/[email protected]/

Note: While there was a previous attempt to add support for this fuel gauge via a new driver [1], development seems to have come to a halt, and extending this driver here seems more appropriate. The patches here are unrelated to that other attempt, other than supporting the same device.

Test results:

    $ ./test_power_supply_properties.sh max170xx_battery
    TAP version 13
    1..33
    # Testing device max170xx_battery
    ok 1 max170xx_battery.exists
    ok 2 max170xx_battery.uevent.NAME
    ok 3 max170xx_battery.sysfs.type
    ok 4 max170xx_battery.uevent.TYPE
    ok 5 max170xx_battery.sysfs.usb_type # SKIP
    ok 6 max170xx_battery.sysfs.online # SKIP
    # Reported: '1' ()
    ok 7 max170xx_battery.sysfs.present
    # Reported: 'Unknown'
    ok 8 max170xx_battery.sysfs.status
    # Reported: '92' % ()
    ok 9 max170xx_battery.sysfs.capacity
    ok 10 max170xx_battery.sysfs.capacity_level # SKIP
    ok 11 max170xx_battery.sysfs.model_name # SKIP
    ok 12 max170xx_battery.sysfs.manufacturer # SKIP
    ok 13 max170xx_battery.sysfs.serial_number # SKIP
    # Reported: 'Li-ion'
    ok 14 max170xx_battery.sysfs.technology
    # Reported: '36032' ()
    ok 15 max170xx_battery.sysfs.cycle_count
    # Reported: 'System'
    ok 16 max170xx_battery.sysfs.scope
    ok 17 max170xx_battery.sysfs.input_current_limit # SKIP
    ok 18 max170xx_battery.sysfs.input_voltage_limit # SKIP
    # Reported: '4323906' uV (4.32391 V)
    ok 19 max170xx_battery.sysfs.voltage_now
    # Reported: '3660000' uV (3.66 V)
    ok 20 max170xx_battery.sysfs.voltage_min
    # Reported: '4320000' uV (4.32 V)
    ok 21 max170xx_battery.sysfs.voltage_max
    # Reported: '3300000' uV (3.3 V)
    ok 22 max170xx_battery.sysfs.voltage_min_design
    ok 23 max170xx_battery.sysfs.voltage_max_design # SKIP
    # Reported: '289687' uA (289.687 mA)
    ok 24 max170xx_battery.sysfs.current_now
    ok 25 max170xx_battery.sysfs.current_max # SKIP
    # Reported: '3942000' uAh (3.942 Ah)
    ok 26 max170xx_battery.sysfs.charge_now
    # Reported: '4330000' uAh (4.33 Ah)
    ok 27 max170xx_battery.sysfs.charge_full
    # Reported: '4524000' uAh (4.524 Ah)
    ok 28 max170xx_battery.sysfs.charge_full_design
    ok 29 max170xx_battery.sysfs.power_now # SKIP
    ok 30 max170xx_battery.sysfs.energy_now # SKIP
    ok 31 max170xx_battery.sysfs.energy_full # SKIP
    ok 32 max170xx_battery.sysfs.energy_full_design # SKIP
    ok 33 max170xx_battery.sysfs.energy_full_design # SKIP
    # 15 skipped test(s) detected.  Consider enabling relevant config options to improve coverage.
    # Totals: pass:18 fail:0 xfail:0 xpass:0 skip:15 error:0

Cheers,
Andre'

---
Changes in v3:
- update commit message patch 5 (dev_err_probe)
- drop stray comment patch 6 (overflow)
- add Fixes tag to patch 6 (overflow) (Pete)
- collect tags
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- collect tags
- update commit message subject prefix of patch 10 to avoid duplication
- patch 11 (time to full reporting):
- limit to max17055 & max77759, the datasheet for max17047 and
max17050 describes the register as 'reserved'. I was mislead by the comment and enum ordering in max17042_battery.h
- report as POWER_SUPPLY_PROP_TIME_TO_FULL_NOW (not _AVG). The
max17050 datasheet is a bit clearer than the max77759 one on that.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
André Draszik (11):
dt-bindings: power: supply: max17042: add support for max77759
dt-bindings: power: supply: max17042: support shunt-resistor-micro-ohms
dt-bindings: power: supply: max17042: drop formatting specifier |
power: supply: max17042: fix a comment typo (then -> than)
power: supply: max17042: use dev_err_probe() where appropriate
power: supply: max17042: avoid overflow when determining health
power: supply: max17042: time to empty is meaningless when charging
power: supply: max17042: support standard shunt-resistor-micro-ohms DT property
power: supply: max17042: initial support for Maxim MAX77759
power: supply: max17042: consider task period (max77759)
power: supply: max17042: report time to full (max17055 & max77759)

 .../bindings/power/supply/maxim,max17042.yaml      |  21 ++--
 drivers/power/supply/max17042_battery.c            | 130 ++++++++++++++++++---
 include/linux/power/max17042_battery.h             |  25 +++-
 3 files changed, 148 insertions(+), 28 deletions(-)

---
base-commit: 3fa5e5702a82d259897bd7e209469bc06368bf31
change-id: 20260226-max77759-fg-0f4bf0816ced

Best regards,

Signature · 1 line
André Draszik <[email protected]>