Skip to contentSkip to conversation

power: supply: add support for MAX1720x standalone fuel

PATCH Superseded Dimitri Fedrau 1 participant 3 messages Jun 15, 2024

Subsystems (2)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover power: supply: add support for MAX1720x standalone fuel

Changes to max1721x_battery.c:
- reading manufacturer, model name and serial number is only possible when SBS functions of the IC are enabled.(nNVCfg0.enSBS) Factory default is off. Manufacturer is "Maxim Integrated" and the model name can be derived by register MAX172XX_DEV_NAME. Serial number is not available anymore.
- According to the datasheet MAX172XX_BAT_PRESENT is at BIT(3) not BIT(4). Furthermore the naming is misleading, when BIT(3) is set the battery is not present.
- Removed DeviceName, ManufacturerName and SerialNumber from struct

    max17211_device_info

Dimitri Fedrau (2):
dt-bindings: power: supply: add support for MAX17201/MAX17205 fuel
gauge
power: supply: add support for MAX1720x standalone fuel gauge

 .../bindings/power/supply/maxim,max1720x.yaml |  51 +++
 drivers/power/supply/Kconfig                  |  12 +
 drivers/power/supply/Makefile                 |   1 +
 drivers/power/supply/max1720x_battery.c       | 324 ++++++++++++++++++
 4 files changed, 388 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/maxim,max1720x.yaml
 create mode 100644 drivers/power/supply/max1720x_battery.c
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/2 dt-bindings: power: supply: add support for MAX17201/MAX17205 fuel gauge

Adding documentation for MAXIMs MAX17201/MAX17205 fuel gauge.

---
 .../bindings/power/supply/maxim,max1720x.yaml | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/maxim,max1720x.yaml
Documentation/devicetree/bindings/power/supply/maxim,max1720x.yaml new file +51 -0
new file mode 100644
index 000000000000..4414bc6f214f
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/maxim,max1720x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim MAX1720x fuel gauge
+
+maintainers:
+  - Dimitri Fedrau <[email protected]>
+
+properties:
+  compatible:
+    const: maxim,max1720x
+
+  reg:
+    items:
+      - description: ModelGauge m5 registers
+      - description: Nonvolatile registers
+
+  reg-names:
+    items:
+      - const: m5
+      - const: nvmem
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - reg-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      max17201@36 {
+        compatible = "maxim,max1720x";
+        reg = <0x36>, <0xb>;
+        reg-names = "m5", "nvmem";
+        interrupt-parent = <&gpio0>;
+        interrupts = <31 IRQ_TYPE_LEVEL_LOW>;
+        status = "okay";
+      };
+    };
Signature · 1 line
2.39.2
#2 lore raw

PATCH 2/2 power: supply: add support for MAX1720x standalone fuel gauge

In reply to Dimitri Fedrau

From: Dimitri Fedrau <[email protected]>

The MAX17201 monitor a single cell pack. The MAX17205 monitor and balance a 2S or 3S pack or monitor a multiple-series cell pack. Both device use I2C interface.

---
 drivers/power/supply/Kconfig            |  12 +
 drivers/power/supply/Makefile           |   1 +
 drivers/power/supply/max1720x_battery.c | 324 ++++++++++++++++++++++++
 3 files changed, 337 insertions(+)
 create mode 100644 drivers/power/supply/max1720x_battery.c
drivers/power/supply/Kconfig +12 -0
index 3e31375491d5..e620ae1a9c8b 100644
@@ -402,6 +402,18 @@ config BATTERY_MAX17042
 
 	  Driver can be build as a module (max17042_battery).
 
+config BATTERY_MAX1720X
+tristate "Maxim MAX17201/MAX17205 Fuel Gauge"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  MAX1720x is a family of fuel-gauge systems for lithium-ion (Li+)
+	  batteries in handheld and portable equipment. MAX17201 are
+	  configured to operate with a single lithium cell, the MAX17205
+	  can operate with multiple cells.
+
+	  Say Y to include support for the MAX17201/MAX17205 Fuel Gauges.
+
 config BATTERY_MAX1721X
 	tristate "MAX17211/MAX17215 standalone gas-gauge"
 	depends on W1
drivers/power/supply/Makefile +1 -0
index 58b567278034..6f02d0248826 100644
@@ -52,6 +52,7 @@ obj-$(CONFIG_CHARGER_DA9150)	+= da9150-charger.o
 obj-$(CONFIG_BATTERY_DA9150)	+= da9150-fg.o
 obj-$(CONFIG_BATTERY_MAX17040)	+= max17040_battery.o
 obj-$(CONFIG_BATTERY_MAX17042)	+= max17042_battery.o
+obj-$(CONFIG_BATTERY_MAX1720X)	+= max1720x_battery.o
 obj-$(CONFIG_BATTERY_MAX1721X)	+= max1721x_battery.o
 obj-$(CONFIG_BATTERY_RT5033)	+= rt5033_battery.o
 obj-$(CONFIG_CHARGER_RT5033)	+= rt5033_charger.o
drivers/power/supply/max1720x_battery.c new file +324 -0

324 lines not on this page · raw message

Signature · 1 line
2.39.2