xref: /freebsd/sys/contrib/device-tree/Bindings/mfd/gateworks-gsc.yaml (revision ebacd8013fe5f7fdf9f6a5b286f6680dd2891036)
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    description: Optional hardware monitoring module
50
51    properties:
52      compatible:
53        const: gw,gsc-adc
54
55      "#address-cells":
56        const: 1
57
58      "#size-cells":
59        const: 0
60
61    patternProperties:
62      "^channel@[0-9]+$":
63        type: object
64        description: |
65          Properties for a single ADC which can report cooked values
66          (i.e. temperature sensor based on thermister), raw values
67          (i.e. voltage rail with a pre-scaling resistor divider).
68
69        properties:
70          reg:
71            description: Register of the ADC
72            maxItems: 1
73
74          label:
75            description: Name of the ADC input
76
77          gw,mode:
78            description: |
79              conversion mode:
80                0 - temperature, in C*10
81                1 - pre-scaled 24-bit voltage value
82                2 - scaled voltage based on an optional resistor divider
83                    and optional offset
84                3 - pre-scaled 16-bit voltage value
85                4 - fan tach input to report RPM's
86            $ref: /schemas/types.yaml#/definitions/uint32
87            enum: [0, 1, 2, 3, 4]
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