1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/power/supply/maxim,max17040.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Maxim 17040 fuel gauge series
8
9maintainers:
10  - Sebastian Reichel <sre@kernel.org>
11
12allOf:
13  - $ref: power-supply.yaml#
14
15properties:
16  compatible:
17    enum:
18      - maxim,max17040
19      - maxim,max17041
20      - maxim,max17043
21      - maxim,max17044
22      - maxim,max17048
23      - maxim,max17049
24      - maxim,max17058
25      - maxim,max17059
26      - maxim,max77836-battery
27
28  reg:
29    maxItems: 1
30
31  maxim,alert-low-soc-level:
32    $ref: /schemas/types.yaml#/definitions/uint32
33    minimum: 1
34    maximum: 32
35    description: |
36      The alert threshold that sets the state of charge level (%) where an interrupt is generated.
37      If skipped the power up default value of 4 (%) will be used.
38
39  maxim,double-soc:
40    type: boolean
41    description: |
42      Certain devices return double the capacity.
43      Specify this to divide the reported value in 2 and thus normalize it.
44      SoC == State of Charge == Capacity.
45
46  maxim,rcomp:
47    $ref: /schemas/types.yaml#/definitions/uint8-array
48    minItems: 1
49    maxItems: 2
50    description: |
51      A value to compensate readings for various battery chemistries and operating temperatures.
52      max17040,41 have 2 byte rcomp, default to 0x97 0x00.
53      All other devices have one byte rcomp, default to 0x97.
54
55  interrupts:
56    maxItems: 1
57
58  io-channels:
59    items:
60      - description: battery temperature
61
62  io-channel-names:
63    items:
64      - const: temp
65
66  wakeup-source:
67    type: boolean
68    description: |
69      Use this property to use alert low SoC level interrupt as wake up source.
70
71required:
72  - compatible
73  - reg
74
75unevaluatedProperties: false
76
77examples:
78  - |
79    i2c {
80      #address-cells = <1>;
81      #size-cells = <0>;
82
83      battery@36 {
84        compatible = "maxim,max17048";
85        reg = <0x36>;
86        maxim,rcomp = /bits/ 8 <0x56>;
87        maxim,alert-low-soc-level = <10>;
88        maxim,double-soc;
89      };
90    };
91  - |
92    #include <dt-bindings/interrupt-controller/irq.h>
93    i2c {
94      #address-cells = <1>;
95      #size-cells = <0>;
96
97      battery@36 {
98        compatible = "maxim,max77836-battery";
99        reg = <0x36>;
100        maxim,alert-low-soc-level = <10>;
101        interrupt-parent = <&gpio7>;
102        interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
103        wakeup-source;
104      };
105    };
106  - |
107    #include <dt-bindings/interrupt-controller/irq.h>
108    i2c {
109      #address-cells = <1>;
110      #size-cells = <0>;
111
112      fuel-gauge@36 {
113        compatible = "maxim,max17043";
114        reg = <0x36>;
115
116        interrupt-parent = <&gpio>;
117        interrupts = <144 IRQ_TYPE_EDGE_FALLING>;
118
119        monitored-battery = <&battery>;
120        power-supplies = <&charger>;
121
122        io-channels = <&adc 8>;
123        io-channel-names = "temp";
124
125        maxim,alert-low-soc-level = <10>;
126        wakeup-source;
127      };
128    };
129