xref: /linux/Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml (revision 48dea9a700c8728cc31a1dd44588b97578de86ee)
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
147examples:
148  - |
149    #include <dt-bindings/gpio/gpio.h>
150    i2c {
151        #address-cells = <1>;
152        #size-cells = <0>;
153
154        gsc@20 {
155            compatible = "gw,gsc";
156            reg = <0x20>;
157            interrupt-parent = <&gpio1>;
158            interrupts = <4 GPIO_ACTIVE_LOW>;
159            interrupt-controller;
160            #interrupt-cells = <1>;
161            #address-cells = <1>;
162            #size-cells = <0>;
163
164            adc {
165                compatible = "gw,gsc-adc";
166                #address-cells = <1>;
167                #size-cells = <0>;
168
169                channel@0 { /* A0: Board Temperature */
170                    reg = <0x00>;
171                    label = "temp";
172                    gw,mode = <0>;
173                };
174
175                channel@2 { /* A1: Input Voltage (raw ADC) */
176                    reg = <0x02>;
177                    label = "vdd_vin";
178                    gw,mode = <1>;
179                    gw,voltage-divider-ohms = <22100 1000>;
180                    gw,voltage-offset-microvolt = <800000>;
181                };
182
183                channel@b { /* A2: Battery voltage */
184                    reg = <0x0b>;
185                    label = "vdd_bat";
186                    gw,mode = <1>;
187                };
188            };
189
190            fan-controller@2c {
191                #address-cells = <1>;
192                #size-cells = <0>;
193                compatible = "gw,gsc-fan";
194                reg = <0x2c>;
195            };
196        };
197    };
198