12eb4d8dcSEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0
22eb4d8dcSEmmanuel Vadot%YAML 1.2
32eb4d8dcSEmmanuel Vadot---
4b97ee269SEmmanuel Vadot$id: http://devicetree.org/schemas/power/supply/maxim,max17040.yaml#
5b97ee269SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
62eb4d8dcSEmmanuel Vadot
72eb4d8dcSEmmanuel Vadottitle: Maxim 17040 fuel gauge series
82eb4d8dcSEmmanuel Vadot
92eb4d8dcSEmmanuel Vadotmaintainers:
102eb4d8dcSEmmanuel Vadot  - Sebastian Reichel <sre@kernel.org>
112eb4d8dcSEmmanuel Vadot
122eb4d8dcSEmmanuel VadotallOf:
132eb4d8dcSEmmanuel Vadot  - $ref: power-supply.yaml#
142eb4d8dcSEmmanuel Vadot
152eb4d8dcSEmmanuel Vadotproperties:
162eb4d8dcSEmmanuel Vadot  compatible:
172eb4d8dcSEmmanuel Vadot    enum:
182eb4d8dcSEmmanuel Vadot      - maxim,max17040
192eb4d8dcSEmmanuel Vadot      - maxim,max17041
202eb4d8dcSEmmanuel Vadot      - maxim,max17043
212eb4d8dcSEmmanuel Vadot      - maxim,max17044
222eb4d8dcSEmmanuel Vadot      - maxim,max17048
232eb4d8dcSEmmanuel Vadot      - maxim,max17049
242eb4d8dcSEmmanuel Vadot      - maxim,max17058
252eb4d8dcSEmmanuel Vadot      - maxim,max17059
262eb4d8dcSEmmanuel Vadot      - maxim,max77836-battery
272eb4d8dcSEmmanuel Vadot
282eb4d8dcSEmmanuel Vadot  reg:
292eb4d8dcSEmmanuel Vadot    maxItems: 1
302eb4d8dcSEmmanuel Vadot
312eb4d8dcSEmmanuel Vadot  maxim,alert-low-soc-level:
322eb4d8dcSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
332eb4d8dcSEmmanuel Vadot    minimum: 1
342eb4d8dcSEmmanuel Vadot    maximum: 32
352eb4d8dcSEmmanuel Vadot    description: |
362eb4d8dcSEmmanuel Vadot      The alert threshold that sets the state of charge level (%) where an interrupt is generated.
372eb4d8dcSEmmanuel Vadot      If skipped the power up default value of 4 (%) will be used.
382eb4d8dcSEmmanuel Vadot
392eb4d8dcSEmmanuel Vadot  maxim,double-soc:
402eb4d8dcSEmmanuel Vadot    type: boolean
412eb4d8dcSEmmanuel Vadot    description: |
422eb4d8dcSEmmanuel Vadot      Certain devices return double the capacity.
432eb4d8dcSEmmanuel Vadot      Specify this to divide the reported value in 2 and thus normalize it.
442eb4d8dcSEmmanuel Vadot      SoC == State of Charge == Capacity.
452eb4d8dcSEmmanuel Vadot
462eb4d8dcSEmmanuel Vadot  maxim,rcomp:
47e67e8565SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint8-array
48e67e8565SEmmanuel Vadot    minItems: 1
49e67e8565SEmmanuel Vadot    maxItems: 2
502eb4d8dcSEmmanuel Vadot    description: |
512eb4d8dcSEmmanuel Vadot      A value to compensate readings for various battery chemistries and operating temperatures.
522eb4d8dcSEmmanuel Vadot      max17040,41 have 2 byte rcomp, default to 0x97 0x00.
532eb4d8dcSEmmanuel Vadot      All other devices have one byte rcomp, default to 0x97.
542eb4d8dcSEmmanuel Vadot
552eb4d8dcSEmmanuel Vadot  interrupts:
562eb4d8dcSEmmanuel Vadot    maxItems: 1
572eb4d8dcSEmmanuel Vadot
58*84943d6fSEmmanuel Vadot  io-channels:
59*84943d6fSEmmanuel Vadot    items:
60*84943d6fSEmmanuel Vadot      - description: battery temperature
61*84943d6fSEmmanuel Vadot
62*84943d6fSEmmanuel Vadot  io-channel-names:
63*84943d6fSEmmanuel Vadot    items:
64*84943d6fSEmmanuel Vadot      - const: temp
65*84943d6fSEmmanuel Vadot
662eb4d8dcSEmmanuel Vadot  wakeup-source:
672eb4d8dcSEmmanuel Vadot    type: boolean
682eb4d8dcSEmmanuel Vadot    description: |
692eb4d8dcSEmmanuel Vadot      Use this property to use alert low SoC level interrupt as wake up source.
702eb4d8dcSEmmanuel Vadot
712eb4d8dcSEmmanuel Vadotrequired:
722eb4d8dcSEmmanuel Vadot  - compatible
732eb4d8dcSEmmanuel Vadot  - reg
742eb4d8dcSEmmanuel Vadot
758cc087a1SEmmanuel VadotunevaluatedProperties: false
762eb4d8dcSEmmanuel Vadot
772eb4d8dcSEmmanuel Vadotexamples:
782eb4d8dcSEmmanuel Vadot  - |
79fac71e4eSEmmanuel Vadot    i2c {
802eb4d8dcSEmmanuel Vadot      #address-cells = <1>;
812eb4d8dcSEmmanuel Vadot      #size-cells = <0>;
822eb4d8dcSEmmanuel Vadot
832eb4d8dcSEmmanuel Vadot      battery@36 {
842eb4d8dcSEmmanuel Vadot        compatible = "maxim,max17048";
852eb4d8dcSEmmanuel Vadot        reg = <0x36>;
862eb4d8dcSEmmanuel Vadot        maxim,rcomp = /bits/ 8 <0x56>;
872eb4d8dcSEmmanuel Vadot        maxim,alert-low-soc-level = <10>;
882eb4d8dcSEmmanuel Vadot        maxim,double-soc;
892eb4d8dcSEmmanuel Vadot      };
902eb4d8dcSEmmanuel Vadot    };
912eb4d8dcSEmmanuel Vadot  - |
922eb4d8dcSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
93fac71e4eSEmmanuel Vadot    i2c {
942eb4d8dcSEmmanuel Vadot      #address-cells = <1>;
952eb4d8dcSEmmanuel Vadot      #size-cells = <0>;
962eb4d8dcSEmmanuel Vadot
972eb4d8dcSEmmanuel Vadot      battery@36 {
982eb4d8dcSEmmanuel Vadot        compatible = "maxim,max77836-battery";
992eb4d8dcSEmmanuel Vadot        reg = <0x36>;
1002eb4d8dcSEmmanuel Vadot        maxim,alert-low-soc-level = <10>;
1012eb4d8dcSEmmanuel Vadot        interrupt-parent = <&gpio7>;
1025956d97fSEmmanuel Vadot        interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
1032eb4d8dcSEmmanuel Vadot        wakeup-source;
1042eb4d8dcSEmmanuel Vadot      };
1052eb4d8dcSEmmanuel Vadot    };
106*84943d6fSEmmanuel Vadot  - |
107*84943d6fSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
108*84943d6fSEmmanuel Vadot    i2c {
109*84943d6fSEmmanuel Vadot      #address-cells = <1>;
110*84943d6fSEmmanuel Vadot      #size-cells = <0>;
111*84943d6fSEmmanuel Vadot
112*84943d6fSEmmanuel Vadot      fuel-gauge@36 {
113*84943d6fSEmmanuel Vadot        compatible = "maxim,max17043";
114*84943d6fSEmmanuel Vadot        reg = <0x36>;
115*84943d6fSEmmanuel Vadot
116*84943d6fSEmmanuel Vadot        interrupt-parent = <&gpio>;
117*84943d6fSEmmanuel Vadot        interrupts = <144 IRQ_TYPE_EDGE_FALLING>;
118*84943d6fSEmmanuel Vadot
119*84943d6fSEmmanuel Vadot        monitored-battery = <&battery>;
120*84943d6fSEmmanuel Vadot        power-supplies = <&charger>;
121*84943d6fSEmmanuel Vadot
122*84943d6fSEmmanuel Vadot        io-channels = <&adc 8>;
123*84943d6fSEmmanuel Vadot        io-channel-names = "temp";
124*84943d6fSEmmanuel Vadot
125*84943d6fSEmmanuel Vadot        maxim,alert-low-soc-level = <10>;
126*84943d6fSEmmanuel Vadot        wakeup-source;
127*84943d6fSEmmanuel Vadot      };
128*84943d6fSEmmanuel Vadot    };
129