mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] power: supply: add standalone S2MU106 fuel gauge (Samsung Galaxy XCover5)
@ 2026-11-17 10:43 Adil Hüsrev Tepe
  2026-11-17 10:43 ` [PATCH 1/2] dt-bindings: power: supply: add samsung,s2mu106-fuelgauge Adil Hüsrev Tepe
  2026-11-17 10:43 ` [PATCH 2/2] power: supply: s2mu106-fuelgauge: add standalone driver Adil Hüsrev Tepe
  0 siblings, 2 replies; 3+ messages in thread
From: Adil Hüsrev Tepe @ 2026-11-17 10:43 UTC (permalink / raw)
  To: sre, robh, krzk+dt, conor+dt
  Cc: linux-pm, devicetree, linux-kernel, Adil Hüsrev Tepe

This supersedes "[PATCH v1 0/3] power: supply: s2mu005-battery: add
S2MU106" (https://lore.kernel.org/all/20261116074000.355176-1-tadilhusrev@gmail.com/),
which I am withdrawing rather than sending a v2 of.

That series extended s2mu005-battery.c/its binding with a
samsung,s2mu106-fuel-gauge compatible falling back to
samsung,s2mu005-fuel-gauge. Sashiko AI's review pointed out that the
fallback is unsound: a board using it binds through the plain
samsung,s2mu005-fuel-gauge compatible with no guard at all, which
still exercises s2mu005_fg_get_voltage_avg()/get_current_avg()
against MONOUT registers the S2MU106 doesn't have, and the resulting
garbage current_avg can flip the reported POWER_SUPPLY_STATUS. Patch
3/3 of that series added a has_monout flag to keep the S2MU106 match
entry out of that path, but the binding still allowed the unguarded
fallback, which is the actual hole.

Rather than patch around that, this series gives the S2MU106 fuel
gauge its own compatible and its own standalone driver. It only
shares the S2MU005's STATUS/RVBAT/RCURCC/RSOC register layout and
scaling, not its device-tree node shape or its MONOUT path, so there
is nothing to usefully fall back to. samsung,s2mu005-fuel-gauge and
s2mu005-battery.c are untouched by this series.

Both patches were drafted with an AI coding assistant (Claude Code,
Anthropic); I reviewed every line, built both (arm64, 0 warnings),
ran checkpatch --strict and dt_binding_check (clean), and tested the
driver live on a Samsung Galaxy XCover5 (Exynos850; re-confirmed
2026-11-17, kernel 7.4.0-rc1-00023-gdcb8b91fb779+ #30): it probes, and
/sys/class/power_supply/s2mu106-battery/ reports plausible voltage,
capacity and charging-status values that track the device's actual
state, confirmed across a flash/reboot cycle.

Adil Hüsrev Tepe (2):
  dt-bindings: power: supply: add samsung,s2mu106-fuelgauge
  power: supply: s2mu106-fuelgauge: add standalone driver

 .../power/supply/samsung,s2mu106-fuelgauge.yaml | 47 ++++++++
 drivers/power/supply/Kconfig                    |  8 ++
 drivers/power/supply/Makefile                   |  1 +
 drivers/power/supply/s2mu106-fuelgauge.c        | 240 +++++++++++++++++++++++
 4 files changed, 296 insertions(+)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-17 10:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 10:43 [PATCH 0/2] power: supply: add standalone S2MU106 fuel gauge (Samsung Galaxy XCover5) Adil Hüsrev Tepe
2026-11-17 10:43 ` [PATCH 1/2] dt-bindings: power: supply: add samsung,s2mu106-fuelgauge Adil Hüsrev Tepe
2026-11-17 10:43 ` [PATCH 2/2] power: supply: s2mu106-fuelgauge: add standalone driver Adil Hüsrev Tepe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®