1# SPDX-License-Identifier: GPL-2.0
2# Copyright (C) 2021 Sebastian Reichel
3%YAML 1.2
4---
5$id: "http://devicetree.org/schemas/power/supply/stericsson,ab8500-charger.yaml#"
6$schema: "http://devicetree.org/meta-schemas/core.yaml#"
7
8title: AB8500 Charger
9
10maintainers:
11  - Sebastian Reichel <sre@kernel.org>
12
13allOf:
14  - $ref: power-supply.yaml#
15
16properties:
17  compatible:
18    const: stericsson,ab8500-charger
19
20  battery:
21    $ref: /schemas/types.yaml#/definitions/phandle
22    description: phandle to battery node
23
24  vddadc-supply:
25    description: Supply for USB and Main charger
26
27  autopower_cfg:
28    type: boolean
29    description: automatic poweron after powerloss
30
31  interrupts:
32    maxItems: 14
33
34  interrupt-names:
35    items:
36      - const: MAIN_CH_UNPLUG_DET
37      - const: MAIN_CHARGE_PLUG_DET
38      - const: MAIN_EXT_CH_NOT_OK
39      - const: MAIN_CH_TH_PROT_R
40      - const: MAIN_CH_TH_PROT_F
41      - const: VBUS_DET_F
42      - const: VBUS_DET_R
43      - const: USB_LINK_STATUS
44      - const: USB_CH_TH_PROT_R
45      - const: USB_CH_TH_PROT_F
46      - const: USB_CHARGER_NOT_OKR
47      - const: VBUS_OVV
48      - const: CH_WD_EXP
49      - const: VBUS_CH_DROP_END
50
51  io-channels:
52    minItems: 2
53    maxItems: 4
54
55  io-channel-names:
56    oneOf:
57      - items:
58          - const: main_charger_v
59          - const: main_charger_c
60          - const: vbus_v
61          - const: usb_charger_c
62      - items:
63          - const: vbus_v
64          - const: usb_charger_c
65
66
67required:
68  - compatible
69  - battery
70  - vddadc-supply
71  - interrupts
72  - interrupt-names
73  - io-channels
74  - io-channel-names
75
76additionalProperties: false
77
78examples:
79  - |
80    #include <dt-bindings/interrupt-controller/irq.h>
81    pmic {
82      charger {
83        compatible = "stericsson,ab8500-charger";
84        battery = <&ab8500_battery>;
85        vddadc-supply = <&ab8500_ldo_tvout_reg>;
86        interrupts = <10 IRQ_TYPE_LEVEL_HIGH>,
87                     <11 IRQ_TYPE_LEVEL_HIGH>,
88                     <0 IRQ_TYPE_LEVEL_HIGH>,
89                     <107 IRQ_TYPE_LEVEL_HIGH>,
90                     <106 IRQ_TYPE_LEVEL_HIGH>,
91                     <14 IRQ_TYPE_LEVEL_HIGH>,
92                     <15 IRQ_TYPE_LEVEL_HIGH>,
93                     <79 IRQ_TYPE_LEVEL_HIGH>,
94                     <105 IRQ_TYPE_LEVEL_HIGH>,
95                     <104 IRQ_TYPE_LEVEL_HIGH>,
96                     <89 IRQ_TYPE_LEVEL_HIGH>,
97                     <22 IRQ_TYPE_LEVEL_HIGH>,
98                     <21 IRQ_TYPE_LEVEL_HIGH>,
99                     <16 IRQ_TYPE_LEVEL_HIGH>;
100        interrupt-names = "MAIN_CH_UNPLUG_DET",
101                          "MAIN_CHARGE_PLUG_DET",
102                          "MAIN_EXT_CH_NOT_OK",
103                          "MAIN_CH_TH_PROT_R",
104                          "MAIN_CH_TH_PROT_F",
105                          "VBUS_DET_F",
106                          "VBUS_DET_R",
107                          "USB_LINK_STATUS",
108                          "USB_CH_TH_PROT_R",
109                          "USB_CH_TH_PROT_F",
110                          "USB_CHARGER_NOT_OKR",
111                          "VBUS_OVV",
112                          "CH_WD_EXP",
113                          "VBUS_CH_DROP_END";
114        io-channels = <&gpadc 0x03>,
115                      <&gpadc 0x0a>,
116                      <&gpadc 0x09>,
117                      <&gpadc 0x0b>;
118        io-channel-names = "main_charger_v",
119                           "main_charger_c",
120                           "vbus_v",
121                           "usb_charger_c";
122      };
123    };
124