1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/power/supply/ti,lp8727.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Binding for TI/National Semiconductor LP8727 Charger
8
9maintainers:
10  - Sebastian Reichel <sre@kernel.org>
11
12allOf:
13  - $ref: power-supply.yaml#
14
15properties:
16  compatible:
17    const: ti,lp8727
18
19  reg:
20    const: 0x27
21
22  interrupts:
23    maxItems: 1
24
25  debounce-ms:
26    description: interrupt debounce time in ms
27
28patternProperties:
29  '^(ac|usb)$':
30    type: object
31    description: USB/AC charging parameters
32    properties:
33      charger-type:
34        enum:
35          - ac
36          - usb
37
38      eoc-level:
39        $ref: /schemas/types.yaml#/definitions/uint8
40        minimum: 0
41        maximum: 6
42        description: |
43          End of Charge Percentage with the following mapping:
44          0 = 5%, 1 = 10%, 2 = 16%, 3 = 20%, 4 = 25%, 5 = 33%, 6 = 50%
45
46      charging-current:
47        $ref: /schemas/types.yaml#/definitions/uint8
48        minimum: 0
49        maximum: 9
50        description: |
51          Charging current with the following mapping:
52          0 = 90mA, 1 = 100mA, 2 = 400mA, 3 = 450mA, 4 = 500mA, 5 = 600mA,
53          6 = 700mA, 7 = 800mA, 8 = 900mA, 9 = 1000mA
54
55required:
56  - compatible
57  - reg
58
59additionalProperties: false
60
61examples:
62  - |
63    #include <dt-bindings/interrupt-controller/irq.h>
64    i2c0 {
65      #address-cells = <1>;
66      #size-cells = <0>;
67
68      lp8727: charger@27 {
69        compatible = "ti,lp8727";
70        reg = <0x27>;
71        interrupt-parent = <&gpio5>;
72        interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
73        debounce-ms = <300>;
74
75        /* AC charger: 5% EOC and 500mA charging current */
76        ac {
77          charger-type = "ac";
78          eoc-level = /bits/ 8 <0>;
79          charging-current = /bits/ 8 <4>;
80        };
81
82        /* USB charger: 10% EOC and 400mA charging current */
83        usb {
84          charger-type = "usb";
85          eoc-level = /bits/ 8 <1>;
86          charging-current = /bits/ 8 <2>;
87        };
88      };
89    };
90