1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mfd/gateworks-gsc.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Gateworks System Controller
8
9description: |
10  The Gateworks System Controller (GSC) is a device present across various
11  Gateworks product families that provides a set of system related features
12  such as the following (refer to the board hardware user manuals to see what
13  features are present)
14   - Watchdog Timer
15   - GPIO
16   - Pushbutton controller
17   - Hardware monitor with ADC's for temperature and voltage rails and
18     fan controller
19
20maintainers:
21  - Tim Harvey <tharvey@gateworks.com>
22  - Robert Jones <rjones@gateworks.com>
23
24properties:
25  $nodename:
26    pattern: "gsc@[0-9a-f]{1,2}"
27  compatible:
28    const: gw,gsc
29
30  reg:
31    description: I2C device address
32    maxItems: 1
33
34  interrupts:
35    maxItems: 1
36
37  interrupt-controller: true
38
39  "#interrupt-cells":
40    const: 1
41
42  "#address-cells":
43    const: 1
44
45  "#size-cells":
46    const: 0
47
48  adc:
49    type: object
50    description: Optional hardware monitoring module
51
52    properties:
53      compatible:
54        const: gw,gsc-adc
55
56      "#address-cells":
57        const: 1
58
59      "#size-cells":
60        const: 0
61
62    patternProperties:
63      "^channel@[0-9]+$":
64        type: object
65        description: |
66          Properties for a single ADC which can report cooked values
67          (i.e. temperature sensor based on thermister), raw values
68          (i.e. voltage rail with a pre-scaling resistor divider).
69
70        properties:
71          reg:
72            description: Register of the ADC
73            maxItems: 1
74
75          label:
76            description: Name of the ADC input
77
78          gw,mode:
79            description: |
80              conversion mode:
81                0 - temperature, in C*10
82                1 - pre-scaled 24-bit voltage value
83                2 - scaled voltage based on an optional resistor divider
84                    and optional offset
85                3 - pre-scaled 16-bit voltage value
86            $ref: /schemas/types.yaml#/definitions/uint32
87            enum: [0, 1, 2, 3]
88
89          gw,voltage-divider-ohms:
90            description: Values of resistors for divider on raw ADC input
91            maxItems: 2
92            items:
93              minimum: 1000
94              maximum: 1000000
95
96          gw,voltage-offset-microvolt:
97            description: |
98              A positive voltage offset to apply to a raw ADC
99              (i.e. to compensate for a diode drop).
100            minimum: 0
101            maximum: 1000000
102
103        required:
104          - gw,mode
105          - reg
106          - label
107
108    required:
109      - compatible
110      - "#address-cells"
111      - "#size-cells"
112
113patternProperties:
114  "^fan-controller@[0-9a-f]+$":
115    type: object
116    description: Optional fan controller
117
118    properties:
119      compatible:
120        const: gw,gsc-fan
121
122      "#address-cells":
123        const: 1
124
125      "#size-cells":
126        const: 0
127
128      reg:
129        description: The fan controller base address
130        maxItems: 1
131
132    required:
133      - compatible
134      - reg
135      - "#address-cells"
136      - "#size-cells"
137
138required:
139  - compatible
140  - reg
141  - interrupts
142  - interrupt-controller
143  - "#interrupt-cells"
144  - "#address-cells"
145  - "#size-cells"
146
147additionalProperties: false
148
149examples:
150  - |
151    #include <dt-bindings/gpio/gpio.h>
152    #include <dt-bindings/interrupt-controller/irq.h>
153    i2c {
154        #address-cells = <1>;
155        #size-cells = <0>;
156
157        gsc@20 {
158            compatible = "gw,gsc";
159            reg = <0x20>;
160            interrupt-parent = <&gpio1>;
161            interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
162            interrupt-controller;
163            #interrupt-cells = <1>;
164            #address-cells = <1>;
165            #size-cells = <0>;
166
167            adc {
168                compatible = "gw,gsc-adc";
169                #address-cells = <1>;
170                #size-cells = <0>;
171
172                channel@0 { /* A0: Board Temperature */
173                    reg = <0x00>;
174                    label = "temp";
175                    gw,mode = <0>;
176                };
177
178                channel@2 { /* A1: Input Voltage (raw ADC) */
179                    reg = <0x02>;
180                    label = "vdd_vin";
181                    gw,mode = <1>;
182                    gw,voltage-divider-ohms = <22100 1000>;
183                    gw,voltage-offset-microvolt = <800000>;
184                };
185
186                channel@b { /* A2: Battery voltage */
187                    reg = <0x0b>;
188                    label = "vdd_bat";
189                    gw,mode = <1>;
190                };
191            };
192
193            fan-controller@2c {
194                #address-cells = <1>;
195                #size-cells = <0>;
196                compatible = "gw,gsc-fan";
197                reg = <0x2c>;
198            };
199        };
200    };
201