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 voltage value
83                2 - scaled voltage based on an optional resistor divider
84                    and optional offset
85            $ref: /schemas/types.yaml#/definitions/uint32
86            enum: [0, 1, 2]
87
88          gw,voltage-divider-ohms:
89            description: Values of resistors for divider on raw ADC input
90            maxItems: 2
91            items:
92             minimum: 1000
93             maximum: 1000000
94
95          gw,voltage-offset-microvolt:
96            description: |
97              A positive voltage offset to apply to a raw ADC
98              (i.e. to compensate for a diode drop).
99            minimum: 0
100            maximum: 1000000
101
102        required:
103          - gw,mode
104          - reg
105          - label
106
107    required:
108      - compatible
109      - "#address-cells"
110      - "#size-cells"
111
112patternProperties:
113  "^fan-controller@[0-9a-f]+$":
114    type: object
115    description: Optional fan controller
116
117    properties:
118      compatible:
119        const: gw,gsc-fan
120
121      "#address-cells":
122        const: 1
123
124      "#size-cells":
125        const: 0
126
127      reg:
128        description: The fan controller base address
129        maxItems: 1
130
131    required:
132      - compatible
133      - reg
134      - "#address-cells"
135      - "#size-cells"
136
137required:
138  - compatible
139  - reg
140  - interrupts
141  - interrupt-controller
142  - "#interrupt-cells"
143  - "#address-cells"
144  - "#size-cells"
145
146examples:
147  - |
148    #include <dt-bindings/gpio/gpio.h>
149    i2c {
150        #address-cells = <1>;
151        #size-cells = <0>;
152
153        gsc@20 {
154            compatible = "gw,gsc";
155            reg = <0x20>;
156            interrupt-parent = <&gpio1>;
157            interrupts = <4 GPIO_ACTIVE_LOW>;
158            interrupt-controller;
159            #interrupt-cells = <1>;
160            #address-cells = <1>;
161            #size-cells = <0>;
162
163            adc {
164                compatible = "gw,gsc-adc";
165                #address-cells = <1>;
166                #size-cells = <0>;
167
168                channel@0 { /* A0: Board Temperature */
169                    reg = <0x00>;
170                    label = "temp";
171                    gw,mode = <0>;
172                };
173
174                channel@2 { /* A1: Input Voltage (raw ADC) */
175                    reg = <0x02>;
176                    label = "vdd_vin";
177                    gw,mode = <1>;
178                    gw,voltage-divider-ohms = <22100 1000>;
179                    gw,voltage-offset-microvolt = <800000>;
180                };
181
182                channel@b { /* A2: Battery voltage */
183                    reg = <0x0b>;
184                    label = "vdd_bat";
185                    gw,mode = <1>;
186                };
187            };
188
189            fan-controller@2c {
190                #address-cells = <1>;
191                #size-cells = <0>;
192                compatible = "gw,gsc-fan";
193                reg = <0x2c>;
194            };
195        };
196    };
197