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