Tom Rini | 53633a8 | 2024-02-29 12:33:36 -0500 | [diff] [blame] | 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 | |
| 7 | title: Gateworks System Controller |
| 8 | |
| 9 | description: | |
| 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 | |
| 20 | maintainers: |
| 21 | - Tim Harvey <tharvey@gateworks.com> |
| 22 | |
| 23 | properties: |
| 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 | |
| 115 | patternProperties: |
| 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 | reg: |
| 126 | description: The fan controller base address |
| 127 | maxItems: 1 |
| 128 | |
| 129 | required: |
| 130 | - compatible |
| 131 | - reg |
| 132 | |
| 133 | required: |
| 134 | - compatible |
| 135 | - reg |
| 136 | - interrupts |
| 137 | - interrupt-controller |
| 138 | - "#interrupt-cells" |
| 139 | - "#address-cells" |
| 140 | - "#size-cells" |
| 141 | |
| 142 | additionalProperties: false |
| 143 | |
| 144 | examples: |
| 145 | - | |
| 146 | #include <dt-bindings/gpio/gpio.h> |
| 147 | #include <dt-bindings/interrupt-controller/irq.h> |
| 148 | i2c { |
| 149 | #address-cells = <1>; |
| 150 | #size-cells = <0>; |
| 151 | |
| 152 | gsc@20 { |
| 153 | compatible = "gw,gsc"; |
| 154 | reg = <0x20>; |
| 155 | interrupt-parent = <&gpio1>; |
| 156 | interrupts = <4 IRQ_TYPE_LEVEL_LOW>; |
| 157 | interrupt-controller; |
| 158 | #interrupt-cells = <1>; |
| 159 | #address-cells = <1>; |
| 160 | #size-cells = <0>; |
| 161 | |
| 162 | adc { |
| 163 | compatible = "gw,gsc-adc"; |
| 164 | #address-cells = <1>; |
| 165 | #size-cells = <0>; |
| 166 | |
| 167 | channel@0 { /* A0: Board Temperature */ |
| 168 | reg = <0x00>; |
| 169 | label = "temp"; |
| 170 | gw,mode = <0>; |
| 171 | }; |
| 172 | |
| 173 | channel@2 { /* A1: Input Voltage (raw ADC) */ |
| 174 | reg = <0x02>; |
| 175 | label = "vdd_vin"; |
| 176 | gw,mode = <1>; |
| 177 | gw,voltage-divider-ohms = <22100 1000>; |
| 178 | gw,voltage-offset-microvolt = <800000>; |
| 179 | }; |
| 180 | |
| 181 | channel@b { /* A2: Battery voltage */ |
| 182 | reg = <0x0b>; |
| 183 | label = "vdd_bat"; |
| 184 | gw,mode = <1>; |
| 185 | }; |
| 186 | }; |
| 187 | |
| 188 | fan-controller@2c { |
| 189 | compatible = "gw,gsc-fan"; |
| 190 | reg = <0x2c>; |
| 191 | }; |
| 192 | }; |
| 193 | }; |