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
23properties:
24  $nodename:
25    pattern: "gsc@[0-9a-f]{1,2}"
26  compatible:
27    const: gw,gsc
28
29  reg:
30    description: I2C device address
31    maxItems: 1
32
33  interrupts:
34    maxItems: 1
35
36  interrupt-controller: true
37
38  "#interrupt-cells":
39    const: 1
40
41  "#address-cells":
42    const: 1
43
44  "#size-cells":
45    const: 0
46
47  adc:
48    type: object
49    additionalProperties: false
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-9a-f]+$":
64        type: object
65        additionalProperties: false
66        description: |
67          Properties for a single ADC which can report cooked values
68          (i.e. temperature sensor based on thermister), raw values
69          (i.e. voltage rail with a pre-scaling resistor divider).
70
71        properties:
72          reg:
73            description: Register of the ADC
74            maxItems: 1
75
76          label:
77            description: Name of the ADC input
78
79          gw,mode:
80            description: |
81              conversion mode:
82                0 - temperature, in C*10
83                1 - pre-scaled 24-bit voltage value
84                2 - scaled voltage based on an optional resistor divider
85                    and optional offset
86                3 - pre-scaled 16-bit voltage value
87                4 - fan tach input to report RPM's
88            $ref: /schemas/types.yaml#/definitions/uint32
89            enum: [0, 1, 2, 3, 4]
90
91          gw,voltage-divider-ohms:
92            description: Values of resistors for divider on raw ADC input
93            maxItems: 2
94            items:
95              minimum: 1000
96              maximum: 1000000
97
98          gw,voltage-offset-microvolt:
99            description: |
100              A positive voltage offset to apply to a raw ADC
101              (i.e. to compensate for a diode drop).
102            minimum: 0
103            maximum: 1000000
104
105        required:
106          - gw,mode
107          - reg
108          - label
109
110    required:
111      - compatible
112      - "#address-cells"
113      - "#size-cells"
114
115patternProperties:
116  "^fan-controller@[0-9a-f]+$":
117    type: object
118    additionalProperties: false
119    description: Optional fan controller
120
121    properties:
122      compatible:
123        const: gw,gsc-fan
124
125      "#address-cells":
126        const: 1
127
128      "#size-cells":
129        const: 0
130
131      reg:
132        description: The fan controller base address
133        maxItems: 1
134
135    required:
136      - compatible
137      - reg
138      - "#address-cells"
139      - "#size-cells"
140
141required:
142  - compatible
143  - reg
144  - interrupts
145  - interrupt-controller
146  - "#interrupt-cells"
147  - "#address-cells"
148  - "#size-cells"
149
150additionalProperties: false
151
152examples:
153  - |
154    #include <dt-bindings/gpio/gpio.h>
155    #include <dt-bindings/interrupt-controller/irq.h>
156    i2c {
157        #address-cells = <1>;
158        #size-cells = <0>;
159
160        gsc@20 {
161            compatible = "gw,gsc";
162            reg = <0x20>;
163            interrupt-parent = <&gpio1>;
164            interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
165            interrupt-controller;
166            #interrupt-cells = <1>;
167            #address-cells = <1>;
168            #size-cells = <0>;
169
170            adc {
171                compatible = "gw,gsc-adc";
172                #address-cells = <1>;
173                #size-cells = <0>;
174
175                channel@0 { /* A0: Board Temperature */
176                    reg = <0x00>;
177                    label = "temp";
178                    gw,mode = <0>;
179                };
180
181                channel@2 { /* A1: Input Voltage (raw ADC) */
182                    reg = <0x02>;
183                    label = "vdd_vin";
184                    gw,mode = <1>;
185                    gw,voltage-divider-ohms = <22100 1000>;
186                    gw,voltage-offset-microvolt = <800000>;
187                };
188
189                channel@b { /* A2: Battery voltage */
190                    reg = <0x0b>;
191                    label = "vdd_bat";
192                    gw,mode = <1>;
193                };
194            };
195
196            fan-controller@2c {
197                #address-cells = <1>;
198                #size-cells = <0>;
199                compatible = "gw,gsc-fan";
200                reg = <0x2c>;
201            };
202        };
203    };
204