[PATCH v6 2/2] dt-bindings: power: supply: add support for MAX77759 fuel gauge

Thomas Antoine via B4 Relay posted 2 patches 2 weeks, 3 days ago
[PATCH v6 2/2] dt-bindings: power: supply: add support for MAX77759 fuel gauge
Posted by Thomas Antoine via B4 Relay 2 weeks, 3 days ago
From: Thomas Antoine <t.antoine@uclouvain.be>

The Maxim MAX77759 is a companion PMIC for USB Type-C. It contains
Battery Charger, Fuel Gauge, temperature sensors, USB Type-C Port
Controller (TCPC), NVMEM, and additional GPIO interfaces

Use max77759-fg compatible to avoid conflict with drivers for other
functions.

The battery node is used to pass the REPCAP and ICHGTERM values
needed for the initialization of the fuel gauge.

The nvmem cells are used to get initialization values and to backup
the learning and the number of cycles. It should work out of the box
with gs101-oriole and gs101-raven which were previously running
Android.

Signed-off-by: Thomas Antoine <t.antoine@uclouvain.be>
---
 .../bindings/power/supply/maxim,max77759.yaml      | 78 ++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..4d45739fcaf26273ec57b60049d6d0421df38efb
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/maxim,max77759.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim Integrated MAX77759 fuel gauge
+
+maintainers:
+  - Thomas Antoine <t.antoine@uclouvain.be>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: maxim,max77759-fg
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  shunt-resistor-micro-ohms:
+    description: The value of the current sense resistor in microohms.
+
+  monitored-battery:
+    description: |
+      The fuel gauge needs the following battery properties:
+      - charge-full-design-microamp-hours
+      - charge-term-current-microamp
+
+  nvmem-cells:
+    maxItems: 1
+    description: |
+      Saved fuel gauge state. This state will be used during the initialization
+      and saved on exit. It must be initialized beforehand.
+      Its layout must be composed of
+        - RCOMP0 (characterization of the open-circuit voltage)
+        - TCOMPO (temperature compensation information)
+        - FULLCAPREP (reported full capacity)
+        - QRTABLE00, QRTABLE10, QRTABLE20, QRTABLE30 (cell capacity information)
+        - cv_mixcap (remaining capacity of the cell without empty compensation)
+        - cv_halftime (time-to-full characterization time constant)
+      They must all be aligned on 2 bytes. A valid CRC8 checksum must
+      also be found at the end (polynomial x^8 + x^2 + x + 1).
+
+  nvmem-cell-names:
+    const: fg_state
+
+required:
+  - compatible
+  - reg
+  - shunt-resistor-micro-ohms
+  - monitored-battery
+  - nvmem-cells
+  - nvmem-cell-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      fuel-gauge@36 {
+        compatible = "maxim,max77759-fg";
+        reg = <0x36>;
+        interrupts-extended = <&gpa9 3 IRQ_TYPE_LEVEL_LOW>;
+        shunt-resistor-micro-ohms = <5000>;
+        monitored-battery = <&battery>;
+        nvmem-cells = <&fg_state>;
+        nvmem-cell-names = "fg_state";
+      };
+    };

-- 
2.51.0
Re: [PATCH v6 2/2] dt-bindings: power: supply: add support for MAX77759 fuel gauge
Posted by Conor Dooley 2 weeks, 2 days ago
On Mon, Sep 15, 2025 at 12:14:11PM +0200, Thomas Antoine via B4 Relay wrote:
> From: Thomas Antoine <t.antoine@uclouvain.be>
> 
> The Maxim MAX77759 is a companion PMIC for USB Type-C. It contains
> Battery Charger, Fuel Gauge, temperature sensors, USB Type-C Port
> Controller (TCPC), NVMEM, and additional GPIO interfaces
> 
> Use max77759-fg compatible to avoid conflict with drivers for other
> functions.
> 
> The battery node is used to pass the REPCAP and ICHGTERM values
> needed for the initialization of the fuel gauge.
> 
> The nvmem cells are used to get initialization values and to backup
> the learning and the number of cycles. It should work out of the box
> with gs101-oriole and gs101-raven which were previously running
> Android.
> 
> Signed-off-by: Thomas Antoine <t.antoine@uclouvain.be>
> ---
>  .../bindings/power/supply/maxim,max77759.yaml      | 78 ++++++++++++++++++++++
>  1 file changed, 78 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..4d45739fcaf26273ec57b60049d6d0421df38efb
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
> @@ -0,0 +1,78 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/supply/maxim,max77759.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Maxim Integrated MAX77759 fuel gauge
> +
> +maintainers:
> +  - Thomas Antoine <t.antoine@uclouvain.be>
> +
> +allOf:
> +  - $ref: power-supply.yaml#
> +
> +properties:
> +  compatible:
> +    const: maxim,max77759-fg

Compatible doesn't match the filename, why?
I assume the "fg" is fuel-gauge, but can this device be anything else?

> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  shunt-resistor-micro-ohms:
> +    description: The value of the current sense resistor in microohms.
> +
> +  monitored-battery:
> +    description: |
> +      The fuel gauge needs the following battery properties:
> +      - charge-full-design-microamp-hours
> +      - charge-term-current-microamp
> +
> +  nvmem-cells:
> +    maxItems: 1
> +    description: |
> +      Saved fuel gauge state. This state will be used during the initialization
> +      and saved on exit. It must be initialized beforehand.
> +      Its layout must be composed of
> +        - RCOMP0 (characterization of the open-circuit voltage)
> +        - TCOMPO (temperature compensation information)
> +        - FULLCAPREP (reported full capacity)
> +        - QRTABLE00, QRTABLE10, QRTABLE20, QRTABLE30 (cell capacity information)
> +        - cv_mixcap (remaining capacity of the cell without empty compensation)
> +        - cv_halftime (time-to-full characterization time constant)
> +      They must all be aligned on 2 bytes. A valid CRC8 checksum must
> +      also be found at the end (polynomial x^8 + x^2 + x + 1).
> +
> +  nvmem-cell-names:
> +    const: fg_state
> +
> +required:
> +  - compatible
> +  - reg
> +  - shunt-resistor-micro-ohms
> +  - monitored-battery
> +  - nvmem-cells
> +  - nvmem-cell-names
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    i2c {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      fuel-gauge@36 {
> +        compatible = "maxim,max77759-fg";
> +        reg = <0x36>;
> +        interrupts-extended = <&gpa9 3 IRQ_TYPE_LEVEL_LOW>;
> +        shunt-resistor-micro-ohms = <5000>;
> +        monitored-battery = <&battery>;
> +        nvmem-cells = <&fg_state>;
> +        nvmem-cell-names = "fg_state";
> +      };
> +    };
> 
> -- 
> 2.51.0
> 
> 
Re: [PATCH v6 2/2] dt-bindings: power: supply: add support for MAX77759 fuel gauge
Posted by Thomas Antoine 2 weeks ago
Hello,


On 9/15/25 7:31 PM, Conor Dooley wrote:
> On Mon, Sep 15, 2025 at 12:14:11PM +0200, Thomas Antoine via B4 Relay wrote:
>> From: Thomas Antoine <t.antoine@uclouvain.be>
>>
>> The Maxim MAX77759 is a companion PMIC for USB Type-C. It contains
>> Battery Charger, Fuel Gauge, temperature sensors, USB Type-C Port
>> Controller (TCPC), NVMEM, and additional GPIO interfaces
>>
>> Use max77759-fg compatible to avoid conflict with drivers for other
>> functions.
>>
>> The battery node is used to pass the REPCAP and ICHGTERM values
>> needed for the initialization of the fuel gauge.
>>
>> The nvmem cells are used to get initialization values and to backup
>> the learning and the number of cycles. It should work out of the box
>> with gs101-oriole and gs101-raven which were previously running
>> Android.
>>
>> Signed-off-by: Thomas Antoine <t.antoine@uclouvain.be>
>> ---
>>  .../bindings/power/supply/maxim,max77759.yaml      | 78 ++++++++++++++++++++++
>>  1 file changed, 78 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..4d45739fcaf26273ec57b60049d6d0421df38efb
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
>> @@ -0,0 +1,78 @@
>> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/power/supply/maxim,max77759.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Maxim Integrated MAX77759 fuel gauge
>> +
>> +maintainers:
>> +  - Thomas Antoine <t.antoine@uclouvain.be>
>> +
>> +allOf:
>> +  - $ref: power-supply.yaml#
>> +
>> +properties:
>> +  compatible:
>> +    const: maxim,max77759-fg
> 
> Compatible doesn't match the filename, why?
> I assume the "fg" is fuel-gauge, but can this device be anything else?

The max77759 is a multifunction chip.
The following compatibles are already used for some of those functions:
- maxim,max77759 (for the pmic)
- maxim,max77759-gpio
- maxim,max77759-nvmem
- maxim,max77759-tcpci

The fuel gauge functionality that is added with this patch is very similar
to the functionality of the max1720x which is why the filename was chosen
to fit other maxim fuel gauge chips pattern.

Maybe it would be better to use the maxim,max77759-battery compatible to
match the filename? It would also fit with the already existing
maxim,max77705-battery and maxim,max77849-battery compatibles.

>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  interrupts:
>> +    maxItems: 1
>> +
>> +  shunt-resistor-micro-ohms:
>> +    description: The value of the current sense resistor in microohms.
>> +
>> +  monitored-battery:
>> +    description: |
>> +      The fuel gauge needs the following battery properties:
>> +      - charge-full-design-microamp-hours
>> +      - charge-term-current-microamp
>> +
>> +  nvmem-cells:
>> +    maxItems: 1
>> +    description: |
>> +      Saved fuel gauge state. This state will be used during the initialization
>> +      and saved on exit. It must be initialized beforehand.
>> +      Its layout must be composed of
>> +        - RCOMP0 (characterization of the open-circuit voltage)
>> +        - TCOMPO (temperature compensation information)
>> +        - FULLCAPREP (reported full capacity)
>> +        - QRTABLE00, QRTABLE10, QRTABLE20, QRTABLE30 (cell capacity information)
>> +        - cv_mixcap (remaining capacity of the cell without empty compensation)
>> +        - cv_halftime (time-to-full characterization time constant)
>> +      They must all be aligned on 2 bytes. A valid CRC8 checksum must
>> +      also be found at the end (polynomial x^8 + x^2 + x + 1).
>> +
>> +  nvmem-cell-names:
>> +    const: fg_state
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - shunt-resistor-micro-ohms
>> +  - monitored-battery
>> +  - nvmem-cells
>> +  - nvmem-cell-names
>> +
>> +unevaluatedProperties: false
>> +
>> +examples:
>> +  - |
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +    i2c {
>> +      #address-cells = <1>;
>> +      #size-cells = <0>;
>> +
>> +      fuel-gauge@36 {
>> +        compatible = "maxim,max77759-fg";
>> +        reg = <0x36>;
>> +        interrupts-extended = <&gpa9 3 IRQ_TYPE_LEVEL_LOW>;
>> +        shunt-resistor-micro-ohms = <5000>;
>> +        monitored-battery = <&battery>;
>> +        nvmem-cells = <&fg_state>;
>> +        nvmem-cell-names = "fg_state";
>> +      };
>> +    };
>>
>> -- 
>> 2.51.0
>>
>>
Re: [PATCH v6 2/2] dt-bindings: power: supply: add support for MAX77759 fuel gauge
Posted by André Draszik 2 weeks ago
Hi,

On Thu, 2025-09-18 at 14:36 +0200, Thomas Antoine wrote:
> Hello,
> 
> 
> On 9/15/25 7:31 PM, Conor Dooley wrote:
> > On Mon, Sep 15, 2025 at 12:14:11PM +0200, Thomas Antoine via B4 Relay wrote:
> > > From: Thomas Antoine <t.antoine@uclouvain.be>
> > > 
> > > The Maxim MAX77759 is a companion PMIC for USB Type-C. It contains
> > > Battery Charger, Fuel Gauge, temperature sensors, USB Type-C Port
> > > Controller (TCPC), NVMEM, and additional GPIO interfaces
> > > 
> > > Use max77759-fg compatible to avoid conflict with drivers for other
> > > functions.
> > > 
> > > The battery node is used to pass the REPCAP and ICHGTERM values
> > > needed for the initialization of the fuel gauge.
> > > 
> > > The nvmem cells are used to get initialization values and to backup
> > > the learning and the number of cycles. It should work out of the box
> > > with gs101-oriole and gs101-raven which were previously running
> > > Android.
> > > 
> > > Signed-off-by: Thomas Antoine <t.antoine@uclouvain.be>
> > > ---
> > >  .../bindings/power/supply/maxim,max77759.yaml      | 78 ++++++++++++++++++++++
> > >  1 file changed, 78 insertions(+)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
> > > b/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
> > > new file mode 100644
> > > index 0000000000000000000000000000000000000000..4d45739fcaf26273ec57b60049d6d0421df38efb
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
> > > @@ -0,0 +1,78 @@
> > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/power/supply/maxim,max77759.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Maxim Integrated MAX77759 fuel gauge
> > > +
> > > +maintainers:
> > > +  - Thomas Antoine <t.antoine@uclouvain.be>
> > > +
> > > +allOf:
> > > +  - $ref: power-supply.yaml#
> > > +
> > > +properties:
> > > +  compatible:
> > > +    const: maxim,max77759-fg
> > 
> > Compatible doesn't match the filename, why?
> > I assume the "fg" is fuel-gauge, but can this device be anything else?
> 
> The max77759 is a multifunction chip.
> The following compatibles are already used for some of those functions:
> - maxim,max77759 (for the pmic)
> - maxim,max77759-gpio
> - maxim,max77759-nvmem
> - maxim,max77759-tcpci
> 
> The fuel gauge functionality that is added with this patch is very similar
> to the functionality of the max1720x which is why the filename was chosen
> to fit other maxim fuel gauge chips pattern.
> 
> Maybe it would be better to use the maxim,max77759-battery compatible to
> match the filename? It would also fit with the already existing
> maxim,max77705-battery and maxim,max77849-battery compatibles.

It also has a (battery) charger, a -battery compatible could be misleading.
The datasheet refers to these subblocks as FG (for fuelgauge) and CHARGER.
I'd suggest keeping those terms.

Additionally, the FG block can also measure temperature and battery ID. For
those, a combination of (top-level) PMIC and FG registers are needed
unfortunately. Which means that the FG should probably be an MFD child
device, even though the FG itself doesn't depend on the top-level. Otherwise
it'd be hard to access the top-level PMIC register.


Cheers,
Andre'
Re: [PATCH v6 2/2] dt-bindings: power: supply: add support for MAX77759 fuel gauge
Posted by Sebastian Reichel 1 week, 6 days ago
Hi,

On Thu, Sep 18, 2025 at 02:02:55PM +0100, André Draszik wrote:
> > On 9/15/25 7:31 PM, Conor Dooley wrote:
> > > On Mon, Sep 15, 2025 at 12:14:11PM +0200, Thomas Antoine via B4 Relay wrote:
> > > > From: Thomas Antoine <t.antoine@uclouvain.be>
> > > > 
> > > > The Maxim MAX77759 is a companion PMIC for USB Type-C. It contains
> > > > Battery Charger, Fuel Gauge, temperature sensors, USB Type-C Port
> > > > Controller (TCPC), NVMEM, and additional GPIO interfaces
> > > > 
> > > > Use max77759-fg compatible to avoid conflict with drivers for other
> > > > functions.
> > > > 
> > > > The battery node is used to pass the REPCAP and ICHGTERM values
> > > > needed for the initialization of the fuel gauge.
> > > > 
> > > > The nvmem cells are used to get initialization values and to backup
> > > > the learning and the number of cycles. It should work out of the box
> > > > with gs101-oriole and gs101-raven which were previously running
> > > > Android.
> > > > 
> > > > Signed-off-by: Thomas Antoine <t.antoine@uclouvain.be>
> > > > ---
> > > >  .../bindings/power/supply/maxim,max77759.yaml      | 78 ++++++++++++++++++++++
> > > >  1 file changed, 78 insertions(+)
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
> > > > b/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
> > > > new file mode 100644
> > > > index 0000000000000000000000000000000000000000..4d45739fcaf26273ec57b60049d6d0421df38efb
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
> > > > @@ -0,0 +1,78 @@
> > > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/power/supply/maxim,max77759.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: Maxim Integrated MAX77759 fuel gauge
> > > > +
> > > > +maintainers:
> > > > +  - Thomas Antoine <t.antoine@uclouvain.be>
> > > > +
> > > > +allOf:
> > > > +  - $ref: power-supply.yaml#
> > > > +
> > > > +properties:
> > > > +  compatible:
> > > > +    const: maxim,max77759-fg
> > > 
> > > Compatible doesn't match the filename, why?
> > > I assume the "fg" is fuel-gauge, but can this device be anything else?
> > 
> > The max77759 is a multifunction chip.
> > The following compatibles are already used for some of those functions:
> > - maxim,max77759 (for the pmic)
> > - maxim,max77759-gpio
> > - maxim,max77759-nvmem
> > - maxim,max77759-tcpci
> > 
> > The fuel gauge functionality that is added with this patch is very similar
> > to the functionality of the max1720x which is why the filename was chosen
> > to fit other maxim fuel gauge chips pattern.
> > 
> > Maybe it would be better to use the maxim,max77759-battery compatible to
> > match the filename? It would also fit with the already existing
> > maxim,max77705-battery and maxim,max77849-battery compatibles.
> 
> It also has a (battery) charger, a -battery compatible could be misleading.
> The datasheet refers to these subblocks as FG (for fuelgauge) and CHARGER.
> I'd suggest keeping those terms.
> 
> Additionally, the FG block can also measure temperature and battery ID. For
> those, a combination of (top-level) PMIC and FG registers are needed
> unfortunately. Which means that the FG should probably be an MFD child
> device, even though the FG itself doesn't depend on the top-level. Otherwise
> it'd be hard to access the top-level PMIC register.

My understanding is, that the FG has a dedicated I2C device address
and thus cannot be a simple MFD child of the PMIC. Did I misunderstood
that part?

Assuming I understood things correctly, I think I suggest to model
things like this for the battery temperature/ID:

i2c {
    pmic: pmic@42 {
        compatible = "maxim,max77759";
        ...

        pmic_adc: adc {
            compatible = "maxim,max77759-adc";
            ...
        };
    };

    fuel-gauge@43 {
        compatible = "maxim,max77759-fg";
        ...
        io-channels = <&pmic_adc MAX77759_ADC_BAT_TEMP>, <&pmic_adc MAX77759_ADC_BAT_ID>;
        io-channel-names = "temperature", "ID";
    };
};

Greetings,

-- Sebastian
Re: [PATCH v6 2/2] dt-bindings: power: supply: add support for MAX77759 fuel gauge
Posted by André Draszik 1 week, 6 days ago
Hi,

On Fri, 2025-09-19 at 00:32 +0200, Sebastian Reichel wrote:
> Hi,
> 
> On Thu, Sep 18, 2025 at 02:02:55PM +0100, André Draszik wrote:
> > 
> > Additionally, the FG block can also measure temperature and battery ID. For
> > those, a combination of (top-level) PMIC and FG registers are needed
> > unfortunately. Which means that the FG should probably be an MFD child
> > device, even though the FG itself doesn't depend on the top-level. Otherwise
> > it'd be hard to access the top-level PMIC register.
> 
> My understanding is, that the FG has a dedicated I2C device address

Yes, that is correct. It also has its own dedicated interrupt output.

> and thus cannot be a simple MFD child of the PMIC.

The core can still create child devices if a child uses a different
i2c address, as already done by the max77759 core driver for the charger
(which e.g. doesn't have its own interrupt). Some MFD other core drivers
also use such an approach.


[...]

> Assuming I understood things correctly, I think I suggest to model
> things like this for the battery temperature/ID:

Nice, yes, that should work - didn't think of that...

Cheers,
Andre'
Re: [PATCH v6 2/2] dt-bindings: power: supply: add support for MAX77759 fuel gauge
Posted by Conor Dooley 2 weeks ago
On Thu, Sep 18, 2025 at 02:02:55PM +0100, André Draszik wrote:
> On Thu, 2025-09-18 at 14:36 +0200, Thomas Antoine wrote:
> > On 9/15/25 7:31 PM, Conor Dooley wrote:
> > > On Mon, Sep 15, 2025 at 12:14:11PM +0200, Thomas Antoine via B4 Relay wrote:
> > > > From: Thomas Antoine <t.antoine@uclouvain.be>
> > > > 
> > > > The Maxim MAX77759 is a companion PMIC for USB Type-C. It contains
> > > > Battery Charger, Fuel Gauge, temperature sensors, USB Type-C Port
> > > > Controller (TCPC), NVMEM, and additional GPIO interfaces
> > > > 
> > > > Use max77759-fg compatible to avoid conflict with drivers for other
> > > > functions.
> > > > 
> > > > The battery node is used to pass the REPCAP and ICHGTERM values
> > > > needed for the initialization of the fuel gauge.
> > > > 
> > > > The nvmem cells are used to get initialization values and to backup
> > > > the learning and the number of cycles. It should work out of the box
> > > > with gs101-oriole and gs101-raven which were previously running
> > > > Android.
> > > > 
> > > > Signed-off-by: Thomas Antoine <t.antoine@uclouvain.be>
> > > > ---
> > > >  .../bindings/power/supply/maxim,max77759.yaml      | 78 ++++++++++++++++++++++
> > > >  1 file changed, 78 insertions(+)
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
> > > > b/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
> > > > new file mode 100644
> > > > index 0000000000000000000000000000000000000000..4d45739fcaf26273ec57b60049d6d0421df38efb
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/power/supply/maxim,max77759.yaml
> > > > @@ -0,0 +1,78 @@
> > > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/power/supply/maxim,max77759.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: Maxim Integrated MAX77759 fuel gauge
> > > > +
> > > > +maintainers:
> > > > +  - Thomas Antoine <t.antoine@uclouvain.be>
> > > > +
> > > > +allOf:
> > > > +  - $ref: power-supply.yaml#
> > > > +
> > > > +properties:
> > > > +  compatible:
> > > > +    const: maxim,max77759-fg
> > > 
> > > Compatible doesn't match the filename, why?
> > > I assume the "fg" is fuel-gauge, but can this device be anything else?
> > 
> > The max77759 is a multifunction chip.
> > The following compatibles are already used for some of those functions:
> > - maxim,max77759 (for the pmic)
> > - maxim,max77759-gpio
> > - maxim,max77759-nvmem
> > - maxim,max77759-tcpci
> > 
> > The fuel gauge functionality that is added with this patch is very similar
> > to the functionality of the max1720x which is why the filename was chosen
> > to fit other maxim fuel gauge chips pattern.
> > 
> > Maybe it would be better to use the maxim,max77759-battery compatible to
> > match the filename? It would also fit with the already existing
> > maxim,max77705-battery and maxim,max77849-battery compatibles.
> 
> It also has a (battery) charger, a -battery compatible could be misleading.
> The datasheet refers to these subblocks as FG (for fuelgauge) and CHARGER.
> I'd suggest keeping those terms.
> 
> Additionally, the FG block can also measure temperature and battery ID. For
> those, a combination of (top-level) PMIC and FG registers are needed
> unfortunately. Which means that the FG should probably be an MFD child
> device, even though the FG itself doesn't depend on the top-level. Otherwise
> it'd be hard to access the top-level PMIC register.

Keeping the -fg is fine, just propagate it to the filename. I dunno
where the -battery came from, since that doesn't match the filename
either.