Skip to contentSkip to conversation

power: supply: Add support for Maxim MAX8971 charger

PATCH Superseded Svyatoslav Ryhel 3 participants 15 messages Feb 26, 2025 – Mar 3, 2025

Subsystems (2)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 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 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

 .../bindings/power/supply/maxim,max8971.yaml  | 140 ++++
 drivers/power/supply/Kconfig                  |  14 +
 drivers/power/supply/Makefile                 |   1 +
 drivers/power/supply/max8971_charger.c        | 690 ++++++++++++++++++
 4 files changed, 845 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 v2 1/2 dt-bindings: power: supply: Document Maxim MAX8971 charger

Add bindings for Maxim MAX8971 charger.

---
 .../bindings/power/supply/maxim,max8971.yaml  | 140 ++++++++++++++++++
 1 file changed, 140 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +140 -0
new file mode 100644
index 000000000000..91d9fec1d46a
@@ -0,0 +1,140 @@
+# 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
+
+  maxim,fcharge-current-limit-microamp:
+    description:
+      Fast-Charge current limit
+    minimum: 250000
+    default: 500000
+    maximum: 1550000
+
+  maxim,fcharge-timer-hours:
+    description:
+      Fast-Charge timer in hours. Setting this value 3 and lower or 11 and higher
+      will disable Fast-Charge timer.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 5
+
+  maxim,fcharge-rst-threshold-high:
+    description:
+      Set Fast-Charge reset threshold to -100 mV
+    type: boolean
+
+  maxim,in-current-limit-microamp:
+    description:
+      Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,topoff-timer-minutes:
+    description:
+      Top-Off timer minutes
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 10, 20, 30, 40, 50, 60, 70]
+    default: 30
+
+  maxim,topoff-current-threshold-microamp:
+    description:
+      Top-Off current threshold
+    enum: [50000, 100000, 150000, 200000]
+    default: 50000
+
+  maxim,fcharge-usb-current-limit-microamp:
+    description:
+      Fast-Charge USB current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,fcharge-ac-current-limit-microamp:
+    description:
+      Fast-Charge AC current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,usb-in-current-limit-microamp:
+    description:
+      USB Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,ac-in-current-limit-microamp:
+    description:
+      AC Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  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>;
+
+            maxim,fcharge-ac-current-limit-microamp = <900000>;
+            maxim,fcharge-timer-hours = <0>;
+
+            maxim,fcharge-rst-threshold-high;
+            maxim,ac-in-current-limit-microamp = <1200000>;
+
+            maxim,topoff-timer-minutes = <0>;
+            maxim,topoff-current-threshold-microamp = <200000>;
+
+            port {
+                charger_input: endpoint {
+                    remote-endpoint = <&extcon_output>;
+                };
+            };
+        };
+    };
+...
Signature · 1 line
2.43.0
#2 lore raw

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

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 41

Quoted 13 lines · Svyatoslav Ryhel
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +13 -0
+  maxim,fcharge-current-limit-microamp:
+    description:
+      Fast-Charge current limit
+    minimum: 250000
+    default: 500000
+    maximum: 1550000
+
+  maxim,fcharge-timer-hours:
+    description:
+      Fast-Charge timer in hours. Setting this value 3 and lower or 11 and higher
+      will disable Fast-Charge timer.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 5

You still did not answer why this is board specific. This was rejected in the past because of that reason and nothing here changed. Nothing will change without detailed explanation, so use other interfaces if you need user-space to configure it (see other drivers, e.g. maxim)

Quoted 9 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +9 -0
+
+  maxim,fcharge-rst-threshold-high:
+    description:
+      Set Fast-Charge reset threshold to -100 mV
+    type: boolean
+
+  maxim,in-current-limit-microamp:
+    description:
+      Input current limit

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 60

Quoted 10 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +10 -0
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,topoff-timer-minutes:
+    description:
+      Top-Off timer minutes
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 10, 20, 30, 40, 50, 60, 70]
+    default: 30

Same.

Quoted 24 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +24 -0
+
+  maxim,topoff-current-threshold-microamp:
+    description:
+      Top-Off current threshold
+    enum: [50000, 100000, 150000, 200000]
+    default: 50000
+
+  maxim,fcharge-usb-current-limit-microamp:
+    description:
+      Fast-Charge USB current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,fcharge-ac-current-limit-microamp:
+    description:
+      Fast-Charge AC current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,usb-in-current-limit-microamp:
+    description:
+      USB Input current limit

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 94

Quoted 10 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +10 -0
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,ac-in-current-limit-microamp:
+    description:
+      AC Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000

Half of these properties as well are not suitable and duplicate existing sysfs interface.

And for remaining, still no battery.

Best regards,
Krzysztof

#3 lore raw

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

чт, 27 лют. 2025 р. о 12:45 Krzysztof Kozlowski <[email protected]> пише:

Quoted 72 lines · Svyatoslav Ryhel

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 41

Quoted 13 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +13 -0
+  maxim,fcharge-current-limit-microamp:
+    description:
+      Fast-Charge current limit
+    minimum: 250000
+    default: 500000
+    maximum: 1550000
+
+  maxim,fcharge-timer-hours:
+    description:
+      Fast-Charge timer in hours. Setting this value 3 and lower or 11 and higher
+      will disable Fast-Charge timer.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 5

You still did not answer why this is board specific. This was rejected in the past because of that reason and nothing here changed. Nothing will change without detailed explanation, so use other interfaces if you need user-space to configure it (see other drivers, e.g. maxim)

Quoted 9 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +9 -0
+
+  maxim,fcharge-rst-threshold-high:
+    description:
+      Set Fast-Charge reset threshold to -100 mV
+    type: boolean
+
+  maxim,in-current-limit-microamp:
+    description:
+      Input current limit

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 60

Quoted 10 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +10 -0
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,topoff-timer-minutes:
+    description:
+      Top-Off timer minutes
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 10, 20, 30, 40, 50, 60, 70]
+    default: 30

Same.

Quoted 29 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +29 -0
+
+  maxim,topoff-current-threshold-microamp:
+    description:
+      Top-Off current threshold
+    enum: [50000, 100000, 150000, 200000]
+    default: 50000
+
+  maxim,fcharge-usb-current-limit-microamp:
+    description:
+      Fast-Charge USB current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,fcharge-ac-current-limit-microamp:
+    description:
+      Fast-Charge AC current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,usb-in-current-limit-microamp:
+    description:
+      USB Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,ac-in-current-limit-microamp:
Quoted 9 lines

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 94

Quoted 5 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +5 -0
+    description:
+      AC Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000

Half of these properties as well are not suitable and duplicate existing sysfs interface.

All these properties allow configure the charger to suit the device on which it is used. None of them are required but are a nice addition. Why you are denying me an ability to fully utilize hardware I have and tune it to the device? All those values represent hardware registers which can be customized for the device, not for the end user to mess with.

Quoted 2 lines

And for remaining, still no battery.

reference to power-supply IS included, hence the battery option is there as well.

Quoted 3 lines

Best regards,
Krzysztof

#4 lore raw

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

Quoted 1 line · Svyatoslav Ryhel
Quoted 1 line
Quoted 1 line

+

Please kindly trim the replies from unnecessary context. It makes it much easier to find new content.

Quoted 18 lines
Quoted 14 lines

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 94

Quoted 13 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +13 -0
+  maxim,usb-in-current-limit-microamp:
+    description:
+      USB Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,ac-in-current-limit-microamp:
+    description:
+      AC Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
Quoted 3 lines

Half of these properties as well are not suitable and duplicate existing sysfs interface.

Quoted 6 lines

All these properties allow configure the charger to suit the device on which it is used. None of them are required but are a nice addition. Why you are denying me an ability to fully utilize hardware I have and tune it to the device? All those values represent hardware registers which can be customized for the device, not for the end user to mess with.

Because you put user-space choice or OS policy into the DT and DT is not for that.

Quoted 6 lines
Quoted 3 lines

And for remaining, still no battery.

reference to power-supply IS included, hence the battery option is there as well.

I don't see it being used at all and you explicitly duplicated properties which means that reference is redundant and should be dropped with such binding. So how did you solve my request to add reference which then you make redundant? Add reference and use it.

Best regards,
Krzysztof

#5 lore raw

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

пн, 3 бер. 2025 р. о 09:54 Krzysztof Kozlowski <[email protected]> пише:

Quoted 32 lines · Svyatoslav Ryhel
Quoted 1 line
Quoted 1 line
Quoted 1 line

+

Please kindly trim the replies from unnecessary context. It makes it much easier to find new content.

Quoted 18 lines
Quoted 14 lines

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 94

Quoted 13 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +13 -0
+  maxim,usb-in-current-limit-microamp:
+    description:
+      USB Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,ac-in-current-limit-microamp:
+    description:
+      AC Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
Quoted 3 lines

Half of these properties as well are not suitable and duplicate existing sysfs interface.

Quoted 6 lines

All these properties allow configure the charger to suit the device on which it is used. None of them are required but are a nice addition. Why you are denying me an ability to fully utilize hardware I have and tune it to the device? All those values represent hardware registers which can be customized for the device, not for the end user to mess with.

Quoted 3 lines

Because you put user-space choice or OS policy into the DT and DT is not for that.

Those are NOT user-space choice or OS policy those are vendor configuration for a specific device and are NOT and NEVER were exposed to user configurations EVER. User messing with those may lead to device breaking.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

And for remaining, still no battery.

Quoted 8 lines
Quoted 2 lines

reference to power-supply IS included, hence the battery option is there as well.

I don't see it being used at all and you explicitly duplicated properties which means that reference is redundant and should be dropped with such binding. So how did you solve my request to add reference which then you make redundant? Add reference and use it.

Which properties I have duplicated?

Quoted 2 lines

Best regards,
Krzysztof

#6 lore raw

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

Quoted 33 lines · Svyatoslav Ryhel

пн, 3 бер. 2025 р. о 09:54 Krzysztof Kozlowski <[email protected]> пише:

Quoted 32 lines · Svyatoslav Ryhel
Quoted 1 line
Quoted 1 line
Quoted 1 line

+

Please kindly trim the replies from unnecessary context. It makes it much easier to find new content.

Quoted 24 lines
Quoted 14 lines

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 94

Quoted 13 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +13 -0
+  maxim,usb-in-current-limit-microamp:
+    description:
+      USB Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,ac-in-current-limit-microamp:
+    description:
+      AC Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
Quoted 3 lines

Half of these properties as well are not suitable and duplicate existing sysfs interface.

All these properties allow configure the charger to suit the device on which it is used. None of them are required but are a nice addition. Why you are denying me an ability to fully utilize hardware I have and tune it to the device? All those values represent hardware registers which can be customized for the device, not for the end user to mess with.

Quoted 6 lines
Quoted 3 lines

Because you put user-space choice or OS policy into the DT and DT is not for that.

Those are NOT user-space choice or OS policy those are vendor configuration for a specific device and are NOT and NEVER were exposed

Then look at existing devices. We had these discussions in the past and these are usually exposed to user-space.

Quoted 10 lines

to user configurations EVER. User messing with those may lead to device breaking.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

And for remaining, still no battery.

reference to power-supply IS included, hence the battery option is there as well.

Quoted 7 lines
Quoted 5 lines

I don't see it being used at all and you explicitly duplicated properties which means that reference is redundant and should be dropped with such binding. So how did you solve my request to add reference which then you make redundant? Add reference and use it.

Which properties I have duplicated?

All the current limits.

Quoted 3 lines
Quoted 3 lines

Best regards,
Krzysztof

Best regards,
Krzysztof

#7 lore raw

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

пн, 3 бер. 2025 р. о 10:18 Krzysztof Kozlowski <[email protected]> пише:

Quoted 39 lines · Svyatoslav Ryhel
Quoted 37 lines

пн, 3 бер. 2025 р. о 09:54 Krzysztof Kozlowski <[email protected]> пише:

Quoted 35 lines · Svyatoslav Ryhel
Quoted 1 line
Quoted 1 line
Quoted 1 line

+

Please kindly trim the replies from unnecessary context. It makes it much easier to find new content.

Quoted 18 lines
Quoted 14 lines

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 94

Quoted 13 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +13 -0
+  maxim,usb-in-current-limit-microamp:
+    description:
+      USB Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,ac-in-current-limit-microamp:
+    description:
+      AC Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
Quoted 3 lines

Half of these properties as well are not suitable and duplicate existing sysfs interface.

Quoted 6 lines

All these properties allow configure the charger to suit the device on which it is used. None of them are required but are a nice addition. Why you are denying me an ability to fully utilize hardware I have and tune it to the device? All those values represent hardware registers which can be customized for the device, not for the end user to mess with.

Because you put user-space choice or OS policy into the DT and DT is not for that.

Quoted 6 lines
Quoted 2 lines

Those are NOT user-space choice or OS policy those are vendor configuration for a specific device and are NOT and NEVER were exposed

Then look at existing devices. We had these discussions in the past and these are usually exposed to user-space.

Provide an example, where there is same or similar configuration.

Quoted 16 lines
Quoted 16 lines

to user configurations EVER. User messing with those may lead to device breaking.

Quoted 12 lines
Quoted 6 lines
Quoted 3 lines

And for remaining, still no battery.

reference to power-supply IS included, hence the battery option is there as well.

I don't see it being used at all and you explicitly duplicated properties which means that reference is redundant and should be dropped with such binding. So how did you solve my request to add reference which then you make redundant? Add reference and use it.

Quoted 4 lines
Quoted 1 line

Which properties I have duplicated?

All the current limits.

Those are blank works, show me an example of such duplication.

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

Best regards,
Krzysztof

Best regards,
Krzysztof

#8 lore raw

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

Quoted 40 lines · Svyatoslav Ryhel

пн, 3 бер. 2025 р. о 10:18 Krzysztof Kozlowski <[email protected]> пише:

Quoted 39 lines · Svyatoslav Ryhel
Quoted 37 lines

пн, 3 бер. 2025 р. о 09:54 Krzysztof Kozlowski <[email protected]> пише:

Quoted 35 lines · Svyatoslav Ryhel
Quoted 1 line
Quoted 1 line
Quoted 1 line

+

Please kindly trim the replies from unnecessary context. It makes it much easier to find new content.

Quoted 18 lines
Quoted 14 lines

Review

Quoted 13 lines
(quoted diff) +13 -0
+  maxim,usb-in-current-limit-microamp:
+    description:
+      USB Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,ac-in-current-limit-microamp:
+    description:
+      AC Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
Quoted 3 lines

Half of these properties as well are not suitable and duplicate existing sysfs interface.

Quoted 6 lines

All these properties allow configure the charger to suit the device on which it is used. None of them are required but are a nice addition. Why you are denying me an ability to fully utilize hardware I have and tune it to the device? All those values represent hardware registers which can be customized for the device, not for the end user to mess with.

Because you put user-space choice or OS policy into the DT and DT is not for that.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Those are NOT user-space choice or OS policy those are vendor configuration for a specific device and are NOT and NEVER were exposed

Then look at existing devices. We had these discussions in the past and these are usually exposed to user-space.

Provide an example, where there is same or similar configuration.

If you tried even a bit, you would easily find them by grep for timer/hours/minutes.

You do not even try but put this work on maintainer.

Do the homework and try a bit harder instead of pushing this on me.

Best regards,
Krzysztof

#9 lore raw

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

In reply to Krzysztof Kozlowski

чт, 27 лют. 2025 р. о 12:45 Krzysztof Kozlowski <[email protected]> пише:

Quoted 16 lines · Svyatoslav Ryhel

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 41

Quoted 13 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +13 -0
+  maxim,fcharge-current-limit-microamp:
+    description:
+      Fast-Charge current limit
+    minimum: 250000
+    default: 500000
+    maximum: 1550000
+
+  maxim,fcharge-timer-hours:
+    description:
+      Fast-Charge timer in hours. Setting this value 3 and lower or 11 and higher
+      will disable Fast-Charge timer.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 5
Quoted 5 lines

You still did not answer why this is board specific. This was rejected in the past because of that reason and nothing here changed. Nothing will change without detailed explanation, so use other interfaces if you need user-space to configure it (see other drivers, e.g. maxim)

Btw, I have used this awesome example you have provided. Take a look

https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml?h=v6.14-rc4

Oh, I wonder why it uses so much values which duplicate battery? I know, it lacks battery, I assume that is why?

Quoted 65 lines
Quoted 9 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +9 -0
+
+  maxim,fcharge-rst-threshold-high:
+    description:
+      Set Fast-Charge reset threshold to -100 mV
+    type: boolean
+
+  maxim,in-current-limit-microamp:
+    description:
+      Input current limit

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 60

Quoted 10 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +10 -0
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,topoff-timer-minutes:
+    description:
+      Top-Off timer minutes
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 10, 20, 30, 40, 50, 60, 70]
+    default: 30

Same.

Quoted 24 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +24 -0
+
+  maxim,topoff-current-threshold-microamp:
+    description:
+      Top-Off current threshold
+    enum: [50000, 100000, 150000, 200000]
+    default: 50000
+
+  maxim,fcharge-usb-current-limit-microamp:
+    description:
+      Fast-Charge USB current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,fcharge-ac-current-limit-microamp:
+    description:
+      Fast-Charge AC current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,usb-in-current-limit-microamp:
+    description:
+      USB Input current limit

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 94

Quoted 10 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +10 -0
+    minimum: 100000
+    default: 500000
+    maximum: 1500000
+
+  maxim,ac-in-current-limit-microamp:
+    description:
+      AC Input current limit
+    minimum: 100000
+    default: 500000
+    maximum: 1500000

Half of these properties as well are not suitable and duplicate existing sysfs interface.

And for remaining, still no battery.

Best regards,
Krzysztof

#10 lore raw

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

Quoted 17 lines · Svyatoslav Ryhel

чт, 27 лют. 2025 р. о 12:45 Krzysztof Kozlowski <[email protected]> пише:

Quoted 16 lines · Svyatoslav Ryhel
Quoted 13 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +13 -0
+  maxim,fcharge-current-limit-microamp:
+    description:
+      Fast-Charge current limit
+    minimum: 250000
+    default: 500000
+    maximum: 1550000
+
+  maxim,fcharge-timer-hours:
+    description:
+      Fast-Charge timer in hours. Setting this value 3 and lower or 11 and higher
+      will disable Fast-Charge timer.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 5
Quoted 7 lines
Quoted 5 lines

You still did not answer why this is board specific. This was rejected in the past because of that reason and nothing here changed. Nothing will change without detailed explanation, so use other interfaces if you need user-space to configure it (see other drivers, e.g. maxim)

Btw, I have used this awesome example you have provided. Take a look

Where did I provide this example?

Quoted 2 lines

https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml?h=v6.14-rc4

I opened it and I do not see anything about time. Please point to specific line.

But regardless, how did I propose to use 12 year old binding? Where did I suggest that one?

Quoted 3 lines

Oh, I wonder why it uses so much values which duplicate battery? I know, it lacks battery, I assume that is why?

No. You added to DT something which is not a hardware property, but user-space choice or policy.

Best regards,
Krzysztof

#11 lore raw

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

пн, 3 бер. 2025 р. о 09:52 Krzysztof Kozlowski <[email protected]> пише:

Quoted 25 lines · Svyatoslav Ryhel
Quoted 23 lines

чт, 27 лют. 2025 р. о 12:45 Krzysztof Kozlowski <[email protected]> пише:

Quoted 21 lines · Svyatoslav Ryhel

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 41

Quoted 13 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +13 -0
+  maxim,fcharge-current-limit-microamp:
+    description:
+      Fast-Charge current limit
+    minimum: 250000
+    default: 500000
+    maximum: 1550000
+
+  maxim,fcharge-timer-hours:
+    description:
+      Fast-Charge timer in hours. Setting this value 3 and lower or 11 and higher
+      will disable Fast-Charge timer.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 5

You still did not answer why this is board specific. This was rejected in the past because of that reason and nothing here changed. Nothing will change without detailed explanation, so use other interfaces if you need user-space to configure it (see other drivers, e.g. maxim)

Quoted 4 lines
Quoted 1 line

Btw, I have used this awesome example you have provided. Take a look

Where did I provide this example?

Its presence in the docs is an example on its no? You have explicitly told to check other maxim devices, I did so, they all have similar set of convifurations.

Quoted 10 lines
Quoted 2 lines

https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml?h=v6.14-rc4

I opened it and I do not see anything about time. Please point to specific line.

But regardless, how did I propose to use 12 year old binding? Where did I suggest that one?

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

Oh, I wonder why it uses so much values which duplicate battery? I know, it lacks battery, I assume that is why?

No. You added to DT something which is not a hardware property, but user-space choice or policy.

It is NOT a user-space choice or policy!

Quoted 4 lines

Best regards,
Krzysztof

#12 lore raw

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

Quoted 22 lines · Svyatoslav Ryhel

пн, 3 бер. 2025 р. о 09:52 Krzysztof Kozlowski <[email protected]> пише:

Quoted 21 lines · Svyatoslav Ryhel
Quoted 19 lines

чт, 27 лют. 2025 р. о 12:45 Krzysztof Kozlowski <[email protected]> пише:

Quoted 18 lines · Svyatoslav Ryhel

Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml line 41

Quoted 13 lines
Documentation/devicetree/bindings/power/supply/maxim,max8971.yaml new file +13 -0
+  maxim,fcharge-current-limit-microamp:
+    description:
+      Fast-Charge current limit
+    minimum: 250000
+    default: 500000
+    maximum: 1550000
+
+  maxim,fcharge-timer-hours:
+    description:
+      Fast-Charge timer in hours. Setting this value 3 and lower or 11 and higher
+      will disable Fast-Charge timer.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 5

You still did not answer why this is board specific. This was rejected in the past because of that reason and nothing here changed. Nothing

Where are the arguments to existing/previous decisions?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

will change without detailed explanation, so use other interfaces if you

Again, where is detailed explanation why time is determined per board, unlike previously agreed that it is not?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

need user-space to configure it (see other drivers, e.g. maxim)

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Btw, I have used this awesome example you have provided. Take a look

Where did I provide this example?

Its presence in the docs is an example on its no? You have explicitly told to check other maxim devices, I did so, they all have similar set of convifurations.

Choose rather later or latest, not 12 YO, binding as an example.

Quoted 11 lines
Quoted 11 lines
Quoted 3 lines

https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml?h=v6.14-rc4

I opened it and I do not see anything about time. Please point to specific line.

But regardless, how did I propose to use 12 year old binding? Where did I suggest that one?

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Oh, I wonder why it uses so much values which duplicate battery? I know, it lacks battery, I assume that is why?

No. You added to DT something which is not a hardware property, but user-space choice or policy.

It is NOT a user-space choice or policy!

Previous discussions on the lists - since you mention 12 year old binding, so also discussions 12 years ago - determined that they are closer to them than board configuration.

I already said - this was rejected in the past - so now I am repeating myself.

You did not bring any arguments just keep repeating "no", so I suggest reading previous discussions and coming with arguments against them.

Best regards,
Krzysztof

#13 lore raw

PATCH v2 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.

---
 drivers/power/supply/Kconfig           |  14 +
 drivers/power/supply/Makefile          |   1 +
 drivers/power/supply/max8971_charger.c | 690 +++++++++++++++++++++++++
 3 files changed, 705 insertions(+)
 create mode 100644 drivers/power/supply/max8971_charger.c
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 +690 -0

690 lines not on this page · raw message

Signature · 1 line
2.43.0
#14 lore raw
kernel test robot noticed the following build warnings:

Hi Svyatoslav,

kernel test robot noticed the following build warnings:

[auto build test WARNING on sre-power-supply/for-next]
[also build test WARNING on robh/for-next krzk-dt/for-next linus/master v6.14-rc4 next-20250227] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Svyatoslav-Ryhel/dt-bindings-power-supply-Document-Maxim-MAX8971-charger/20250226-174046
base:   https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
patch link:    https://lore.kernel.org/r/20250226093700.44726-3-clamor95%40gmail.com
patch subject: [PATCH v2 2/2] power: supply: Add support for Maxim MAX8971 charger
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20250227/[email protected]/config)
compiler: s390-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250227/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/power/supply/max8971_charger.c:653:12: warning: 'max8971_resume' defined but not used [-Wunused-function]

653 | static int max8971_resume(struct device *dev)
| ^~~~~~~~~~~~~~

vim +/max8971_resume +653 drivers/power/supply/max8971_charger.c

652

 > 653	static int max8971_resume(struct device *dev)

654 {
655 struct i2c_client *client = to_i2c_client(dev);
656 struct max8971_data *priv = i2c_get_clientdata(client);
657
658 irq_wake_thread(client->irq, priv);
659
660 return 0;
661 }
662

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki