1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: "http://devicetree.org/schemas/power/supply/summit,smb347-charger.yaml#"
5$schema: "http://devicetree.org/meta-schemas/core.yaml#"
6
7title: Battery charger driver for SMB345, SMB347 and SMB358
8
9maintainers:
10  - David Heidelberg <david@ixit.cz>
11  - Dmitry Osipenko <digetx@gmail.com>
12
13properties:
14  compatible:
15    enum:
16      - summit,smb345
17      - summit,smb347
18      - summit,smb358
19
20  reg:
21    maxItems: 1
22
23  interrupts:
24    maxItems: 1
25
26  monitored-battery:
27    description: phandle to the battery node
28    $ref: /schemas/types.yaml#/definitions/phandle
29
30  summit,enable-usb-charging:
31    type: boolean
32    description: Enable charging through USB.
33
34  summit,enable-otg-charging:
35    type: boolean
36    description: Provide power for USB OTG
37
38  summit,enable-mains-charging:
39    type: boolean
40    description: Enable charging through mains
41
42  summit,enable-charge-control:
43    description: Enable charging control
44    $ref: /schemas/types.yaml#/definitions/uint32
45    enum:
46      - 0 # SMB3XX_CHG_ENABLE_SW SW (I2C interface)
47      - 1 # SMB3XX_CHG_ENABLE_PIN_ACTIVE_LOW Pin control (Active Low)
48      - 2 # SMB3XX_CHG_ENABLE_PIN_ACTIVE_HIGH Pin control (Active High)
49
50  summit,fast-voltage-threshold-microvolt:
51    description: Voltage threshold to transit to fast charge mode (in uV)
52    minimum: 2400000
53    maximum: 3000000
54
55  summit,mains-current-limit-microamp:
56    description: Maximum input current from AC/DC input (in uA)
57
58  summit,usb-current-limit-microamp:
59    description: Maximum input current from USB input (in uA)
60
61  summit,charge-current-compensation-microamp:
62    description: Charge current compensation (in uA)
63
64  summit,chip-temperature-threshold-celsius:
65    description: Chip temperature for thermal regulation in °C.
66    enum: [100, 110, 120, 130]
67
68  summit,soft-compensation-method:
69    description: Soft temperature limit compensation method
70    $ref: /schemas/types.yaml#/definitions/uint32
71    enum:
72      - 0 # SMB3XX_SOFT_TEMP_COMPENSATE_NONE Compensation none
73      - 1 # SMB3XX_SOFT_TEMP_COMPENSATE_CURRENT Current compensation
74      - 2 # SMB3XX_SOFT_TEMP_COMPENSATE_VOLTAGE Voltage compensation
75
76allOf:
77  - if:
78      properties:
79        compatible:
80          enum:
81            - summit,smb345
82            - summit,smb358
83
84    then:
85      properties:
86        summit,mains-current-limit-microamp:
87          enum: [ 300000, 500000, 700000, 1000000,
88                  1500000, 1800000, 2000000]
89
90        summit,usb-current-limit-microamp:
91          enum: [ 300000, 500000, 700000, 1000000,
92                  1500000, 1800000, 2000000]
93
94        summit,charge-current-compensation-microamp:
95          enum: [200000, 450000, 600000, 900000]
96
97    else:
98      properties:
99        summit,mains-current-limit-microamp:
100          enum: [ 300000, 500000, 700000, 900000, 1200000,
101                  1500000, 1800000, 2000000, 2200000, 2500000]
102
103        summit,usb-current-limit-microamp:
104          enum: [ 300000, 500000, 700000, 900000, 1200000,
105                  1500000, 1800000, 2000000, 2200000, 2500000]
106
107        summit,charge-current-compensation-microamp:
108          enum: [250000, 700000, 900000, 1200000]
109
110required:
111  - compatible
112  - reg
113
114anyOf:
115  - required:
116      - summit,enable-usb-charging
117  - required:
118      - summit,enable-otg-charging
119  - required:
120      - summit,enable-mains-charging
121
122additionalProperties: false
123
124examples:
125  - |
126    #include <dt-bindings/power/summit,smb347-charger.h>
127
128    i2c {
129        #address-cells = <1>;
130        #size-cells = <0>;
131
132        charger@7f {
133            compatible = "summit,smb347";
134            reg = <0x7f>;
135
136            summit,enable-charge-control = <SMB3XX_CHG_ENABLE_PIN_ACTIVE_HIGH>;
137            summit,chip-temperature-threshold-celsius = <110>;
138            summit,mains-current-limit-microamp = <2000000>;
139            summit,usb-current-limit-microamp = <500000>;
140            summit,enable-usb-charging;
141            summit,enable-mains-charging;
142
143            monitored-battery = <&battery>;
144        };
145    };
146
147    battery: battery-cell {
148        compatible = "simple-battery";
149        constant-charge-current-max-microamp = <1800000>;
150        operating-range-celsius = <0 45>;
151        alert-celsius = <3 42>;
152    };
153