[RFC PATCH 0/3] power: supply: read-only CellWise CW2017 monitor for Redmi Go

From: Kupreenko Danila

Date: Thu Oct 29 2026 - 13:58:11 EST


Add a read-only power_supply driver for the CellWise CW2017 fuel gauge,
its Devicetree binding, and the Xiaomi Redmi Go (tiare) I2C node.

Unlike CW2015, CW2017 has a different register map and battery profile
protocol. The driver requires a gauge already initialized with a valid
battery profile; it reads voltage, integer SOC and temperature but never
writes CONFIG, changes the battery profile or resets the chip. Charging
status is unknown; presence is not inferred.

The CW2017 source is an independent implementation assisted by Codex
(GPT-6). Firefly was consulted later as a behavioral reference, not as
a source of copied code. AI assistance is disclosed in commit trailers.

Hardware testing on Xiaomi Redmi Go (tiare), postmarketOS, Linux
7.1.3-msm89x7 with a module built from the same RFC driver source (R5):
- module auto-loaded and bound to I2C device 2-0063;
- running srcversion matched the locally built R5 module;
- capacity, voltage and temperature appeared in power_supply sysfs;
- three consecutive measurements remained accessible;
- udevadm monitor observed kernel power_supply change events, including
changes in voltage and temperature, with roughly 30-second cadence.

Mainline 7.3 ARM64 build/MODPOST, targeted DT/schema validation, sparse
and host mock regressions with sanitizers passed. The mainline kernel
itself has NOT been booted on Redmi Go. Hardware PM/unbind, power cost,
calibration, temperature-source provenance and induced I2C error recovery
remain untested. The source operates as a monitor, not a safety controller.

Open review questions include policy for already-initialized gauges,
3-attempt probe retries, nominal 30-second polling and up to 300-second
backoff after failures, and event frequency with small voltage changes.

This is the first PUBLIC RFC; preceding revisions remained local.

Kupreenko Danila (3):
dt-bindings: power: supply: add CellWise CW2017 fuel gauge
power: supply: add read-only CW2017 battery monitor
arm64: dts: qcom: tiare: describe CW2017 fuel gauge

.../power/supply/cellwise,cw2017.yaml | 52 +++
MAINTAINERS | 7 +
.../boot/dts/qcom/msm8917-xiaomi-tiare.dts | 9 +
drivers/power/supply/Kconfig | 14 +
drivers/power/supply/Makefile | 1 +
drivers/power/supply/cw2017_battery.c | 370 ++++++++++++++++++
6 files changed, 453 insertions(+)
create mode 100644 Documentation/devicetree/bindings/power/supply/cellwise,cw2017.yaml
create mode 100644 drivers/power/supply/cw2017_battery.c

base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8
--
2.56.0