1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4
5$id: http://devicetree.org/schemas/hwmon/nuvoton,nct7802.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: Nuvoton NCT7802Y Hardware Monitoring IC
9
10maintainers:
11  - Guenter Roeck <linux@roeck-us.net>
12
13description: |
14  The NCT7802Y is a hardware monitor IC which supports one on-die and up to
15  5 remote temperature sensors with SMBus interface.
16
17  Datasheets:
18    https://www.nuvoton.com/export/resource-files/Nuvoton_NCT7802Y_Datasheet_V12.pdf
19
20additionalProperties: false
21
22properties:
23  compatible:
24    enum:
25      - nuvoton,nct7802
26
27  reg:
28    maxItems: 1
29
30  "#address-cells":
31    const: 1
32
33  "#size-cells":
34    const: 0
35
36patternProperties:
37  "^channel@[0-3]$":
38    type: object
39
40    additionalProperties: false
41
42    properties:
43      reg:
44        items:
45          - enum:
46              - 0    # Local Temperature Sensor ("LTD")
47              - 1    # Remote Temperature Sensor or Voltage Sensor 1 ("RTD1")
48              - 2    # Remote Temperature Sensor or Voltage Sensor 2 ("RTD2")
49              - 3    # Remote Temperature Sensor or Voltage Sensor 3 ("RTD3")
50
51      sensor-type:
52        items:
53          - enum:
54              - temperature
55              - voltage
56
57      temperature-mode:
58        items:
59          - enum:
60              - thermistor
61              - thermal-diode
62
63    required:
64      - reg
65
66    allOf:
67      # For channels RTD1, RTD2 and RTD3, require sensor-type to be set.
68      # Otherwise (for all other channels), do not allow temperature-mode to be
69      # set.
70      - if:
71          properties:
72            reg:
73              items:
74                - enum:
75                    - 1
76                    - 2
77                    - 3
78        then:
79          required:
80            - sensor-type
81        else:
82          not:
83            required:
84              - sensor-type
85
86      # For channels RTD1 and RTD2 and if sensor-type is "temperature", require
87      # temperature-mode to be set. Otherwise (for all other channels or
88      # sensor-type settings), do not allow temperature-mode to be set
89      - if:
90          properties:
91            reg:
92              items:
93                - enum:
94                    - 1
95                    - 2
96            sensor-type:
97              items:
98                - enum:
99                    - temperature
100        then:
101          required:
102            - temperature-mode
103        else:
104          not:
105            required:
106              - temperature-mode
107
108required:
109  - compatible
110  - reg
111
112examples:
113  - |
114    i2c {
115        #address-cells = <1>;
116        #size-cells = <0>;
117
118        nct7802@28 {
119            compatible = "nuvoton,nct7802";
120            reg = <0x28>;
121
122            #address-cells = <1>;
123            #size-cells = <0>;
124
125            channel@0 { /* LTD */
126                reg = <0>;
127            };
128
129            channel@1 { /* RTD1 */
130                reg = <1>;
131                sensor-type = "voltage";
132            };
133
134            channel@2 { /* RTD2 */
135                reg = <2>;
136                sensor-type = "temperature";
137                temperature-mode = "thermal-diode";
138            };
139
140            channel@3 { /* RTD3 */
141                reg = <3>;
142                sensor-type = "temperature";
143            };
144        };
145    };
146