Skip to contentSkip to conversation

power: supply: Add support for Maxim MAX8971 charger

PATCH Superseded Svyatoslav Ryhel 2 participants 5 messages Mar 20, 2025 – Apr 8, 2025

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover power: supply: Add support for Maxim MAX8971 charger

The MAX8971 is a compact, high-frequency, high-efficiency switch-mode charger for a one-cell lithium-ion (Li+) battery.

---
Changes on switching from v4 to v5:
- revert schema to v3
- removed i2c_client from driver data
- removed max8971_supplied_to
- swapped power_supply_config filling .of_node with .fwnode
- attr group liked to power_supply_config
- added ABI properties description

Changes on switching from v3 to v4:
- swap graph with connector phandle

Changes on switching from v2 to v3:
- fast_charge_timer, top_off_threshold_current and top_off_timer converted to device attributes. Other vendor properties removed.
- removed max8971_config
- removed unneded functions and definitions along vendor props removal
- added __maybe_unused for resume function

Changes on switching from v1 to v2:
- swap phandle with graph for extcon
- added power-supply ref
---

Svyatoslav Ryhel (2):
dt-bindings: power: supply: Document Maxim MAX8971 charger
power: supply: Add support for Maxim MAX8971 charger

 Documentation/ABI/testing/sysfs-class-power   |  43 +
 .../bindings/power/supply/maxim,max8971.yaml  |  68 ++
 drivers/power/supply/Kconfig                  |  14 +
 drivers/power/supply/Makefile                 |   1 +
 drivers/power/supply/max8971_charger.c        | 750 ++++++++++++++++++
 5 files changed, 876 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml
 create mode 100644 drivers/power/supply/max8971_charger.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH v5 1/2 dt-bindings: power: supply: Document Maxim MAX8971 charger

Add bindings for Maxim MAX8971 charger.

---
 .../bindings/power/supply/maxim,max8971.yaml  | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +68 -0
new file mode 100644
index 000000000000..2244cc3d45a6
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/maxim,max8971.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim MAX8971 IC charger
+
+maintainers:
+  - Svyatoslav Ryhel <[email protected]>
+
+description:
+  The MAX8971 is a compact, high-frequency, high-efficiency switch-mode charger
+  for a one-cell lithium-ion (Li+) battery.
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: maxim,max8971
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  monitored-battery: true
+
+  port:
+    description:
+      An optional port node to link the extcon device to detect type of plug.
+    $ref: /schemas/graph.yaml#/properties/port
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        charger@35 {
+            compatible = "maxim,max8971";
+            reg = <0x35>;
+
+            interrupt-parent = <&gpio>;
+            interrupts = <74 IRQ_TYPE_LEVEL_LOW>;
+
+            monitored-battery = <&battery>;
+
+            port {
+                charger_input: endpoint {
+                    remote-endpoint = <&extcon_output>;
+                };
+            };
+        };
+    };
+...
Signature · 1 line
2.43.0
Reviewed-by on v5 1/2
#2 lore raw

Re: [PATCH v5 1/2] dt-bindings: power: supply: Document Maxim MAX8971 charger

Quoted 7 lines · Svyatoslav Ryhel

Add bindings for Maxim MAX8971 charger.

---
 .../bindings/power/supply/maxim,max8971.yaml  | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml

Best regards,
Krzysztof

#3 lore raw

PATCH v5 2/2 power: supply: Add support for Maxim MAX8971 charger

In reply to Svyatoslav Ryhel

The MAX8971 is a compact, high-frequency, high-efficiency switch-mode charger for a one-cell lithium-ion (Li+) battery.

---
 Documentation/ABI/testing/sysfs-class-power |  43 ++
 drivers/power/supply/Kconfig                |  14 +
 drivers/power/supply/Makefile               |   1 +
 drivers/power/supply/max8971_charger.c      | 750 ++++++++++++++++++++
 4 files changed, 808 insertions(+)
 create mode 100644 drivers/power/supply/max8971_charger.c
Documentation/ABI/testing/sysfs-class-power +43 -0
index 45180b62d426..9053431def5f 100644
@@ -793,3 +793,46 @@ Description:
 
 		Access: Read
 		Valid values: 1-31
+
+What:		/sys/class/power_supply/max8971-charger/fast_charge_timer
+Date:		March 2025
+KernelVersion:	6.14.0
+Contact:	Svyatoslav Ryhel <[email protected]>
+Description:
+		This entry shows and sets the maximum time the max8971
+		charger operates in fast-charge mode. When the timer expires
+		the device will terminate fast-charge mode (charging current
+		will drop to 0 A) and will trigger interrupt.
+
+		Valid values:
+
+		- 4 - 10 (hours), step by 1
+		- 0: disabled.
+
+What:		/sys/class/power_supply/max8971-charger/top_off_threshold_current
+Date:		March 2025
+KernelVersion:	6.14.0
+Contact:	Svyatoslav Ryhel <[email protected]>
+Description:
+		This entry shows and sets the charging current threshold for
+		entering top-off charging mode. When charging current in fast
+		charge mode drops below this value, the charger will trigger
+		interrupt and start top-off charging mode.
+
+		Valid values:
+
+		- 50000 - 200000 (microamps), step by 50000 (rounded down)
+
+What:		/sys/class/power_supply/max8971-charger/top_off_timer
+Date:		March 2025
+KernelVersion:	6.14.0
+Contact:	Svyatoslav Ryhel <[email protected]>
+Description:
+		This entry shows and sets the maximum time the max8971
+		charger operates in top-off charge mode. When the timer expires
+		the device will terminate top-off charge mode (charging current
+		will drop to 0 A) and will trigger interrupt.
+
+		Valid values:
+
+		- 0 - 70 (minutes), step by 10 (rounded down)
drivers/power/supply/Kconfig +14 -0
index 9f2eef6787f7..7c86116c2947 100644
@@ -595,6 +595,20 @@ config CHARGER_MAX77976
 	  This driver can also be built as a module. If so, the module will be
 	  called max77976_charger.
 
+config CHARGER_MAX8971
+	tristate "Maxim MAX8971 battery charger driver"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  The MAX8971 is a compact, high-frequency, high-efficiency switch-mode
+	  charger for a one-cell lithium-ion (Li+) battery. It delivers up to
+	  1.55A of current to the battery from inputs up to 7.5V and withstands
+	  transient inputs up to 22V.
+
+	  Say Y to enable support for the Maxim MAX8971 battery charger.
+	  This driver can also be built as a module. If so, the module will be
+	  called max8971_charger.
+
 config CHARGER_MAX8997
 	tristate "Maxim MAX8997/MAX8966 PMIC battery charger driver"
 	depends on MFD_MAX8997 && REGULATOR_MAX8997
drivers/power/supply/Makefile +1 -0
index 59c4a9f40d28..8fa051ff87ff 100644
@@ -81,6 +81,7 @@ obj-$(CONFIG_CHARGER_DETECTOR_MAX14656)	+= max14656_charger_detector.o
 obj-$(CONFIG_CHARGER_MAX77650)	+= max77650-charger.o
 obj-$(CONFIG_CHARGER_MAX77693)	+= max77693_charger.o
 obj-$(CONFIG_CHARGER_MAX77976)	+= max77976_charger.o
+obj-$(CONFIG_CHARGER_MAX8971)	+= max8971_charger.o
 obj-$(CONFIG_CHARGER_MAX8997)	+= max8997_charger.o
 obj-$(CONFIG_CHARGER_MAX8998)	+= max8998_charger.o
 obj-$(CONFIG_CHARGER_MP2629)	+= mp2629_charger.o
drivers/power/supply/max8971_charger.c new file +750 -0

750 lines not on this page · raw message

Signature · 1 line
2.43.0
#4 lore raw

чт, 20 бер. 2025 р. о 09:30 Svyatoslav Ryhel <[email protected]> пише:

Quoted 4 lines

The MAX8971 is a compact, high-frequency, high-efficiency switch-mode charger for a one-cell lithium-ion (Li+) battery.

Quoted 9 lines
---
 Documentation/ABI/testing/sysfs-class-power |  43 ++
 drivers/power/supply/Kconfig                |  14 +
 drivers/power/supply/Makefile               |   1 +
 drivers/power/supply/max8971_charger.c      | 750 ++++++++++++++++++++
 4 files changed, 808 insertions(+)
 create mode 100644 drivers/power/supply/max8971_charger.c

These patches had no activity/feedback from maintainers for a while, so, in case they got lost in the depths of email box, this is a friendly reminder that they are still relevant and I would like them to move on.

Best regards,
Svyatoslav R.