1# Copyright (c) 2024 Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4description: |
5  Nordic nRF COMP (analog COMParator)
6
7  This comparator has varying configurations which require varying
8  properties be set in the devicetree.
9
10  The following example displays the minimum node layout:
11
12    comp: comp@deadbeef {
13            compatible = "nordic,nrf-comp";
14            reg = <0xdeadbeef 0x1000>;
15            interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>;
16            status = "disabled";
17    };
18
19  Enabling the comparator node requires setting the default
20  configuration of the comparator.
21
22  The following example displays enabling the comparator in
23  single-ended mode, selecting an internal reference:
24
25    &comp {
26            status = "okay";
27            main-mode = "SE";
28            psel = "AIN0";
29            refsel = "INT_1V2";
30            sp-mode = "NORMAL";
31            th-up = <36>;
32            th-down = <30>;
33            isource = "DISABLED";
34    };
35
36  To select an external reference, select the "AREF"
37  reference and add the external reference:
38
39    &comp {
40            ...
41            refsel = "AREF";
42            extrefsel = "AIN1";
43            ...
44    };
45
46  The following example displays enabling the comparator
47  in differential mode:
48
49    &comp {
50            status = "okay";
51            main-mode = "DIFF";
52            psel = "AIN0";
53            extrefsel = "AIN1";
54            sp-mode = "NORMAL";
55            enable-hyst;
56            isource = "DISABLED";
57    };
58
59compatible: "nordic,nrf-comp"
60
61include: base.yaml
62
63properties:
64  main-mode:
65    type: string
66    enum:
67      - "SE"
68      - "DIFF"
69
70  psel:
71    type: string
72    enum:
73      - "AIN0"
74      - "AIN1"
75      - "AIN2"
76      - "AIN3"
77      - "AIN4"
78      - "AIN5"
79      - "AIN6"
80      - "AIN7"
81      - "VDD_DIV2"
82      - "VDDH_DIV5"
83
84  extrefsel:
85    type: string
86    enum:
87      - "AIN0"
88      - "AIN1"
89      - "AIN2"
90      - "AIN3"
91      - "AIN4"
92      - "AIN5"
93      - "AIN6"
94      - "AIN7"
95
96  refsel:
97    type: string
98    enum:
99      - "INT_1V2"
100      - "INT_1V8"
101      - "INT_2V4"
102      - "AVDDAO1V8"
103      - "VDD"
104      - "AREF"
105
106  enable-hyst:
107    type: boolean
108
109  sp-mode:
110    type: string
111    enum:
112      - "LOW"
113      - "NORMAL"
114      - "HIGH"
115
116  th-up:
117    type: int
118
119  th-down:
120    type: int
121
122  isource:
123    type: string
124    enum:
125      - "DISABLED"
126      - "2UA5"
127      - "5UA"
128      - "10UA"
129