1# Copyright (c) 2025 Renesas Electronics Corporation
2# SPDX-License-Identifier: Apache-2.0
3
4description: |
5  Renesas RA ACMPHS (High-Speed Analog COMParator) Controller
6
7  The following example displays the minimum node layout:
8
9    acmphs_global: acmphs_global@deadbeef {
10            ...
11
12            acmphs0: acmphs0 {
13                    compatible = "renesas,ra-acmphs";
14                    channel = <0>;
15                    status = "disabled";
16            };
17    };
18
19  Enabling the comparator controller node requires setting the minimum
20  default configuration of the comparator. This includes selecting the
21  positive and negative inputs, and routing them using pinctrl:
22
23  Note: A set of pinctrl for the default comparator controller node is
24  already defined on each board that supported comparator. Please check
25  the boards pinctrl before defining it.
26
27  &pinctrl {
28          acmphs_ivref0: acmphs_ivref0 {
29                  group1 {
30                          /* IVREF0 */
31                          psels = <RA_PSEL(RA_PSEL_ACMPHS, ..., ...)>;
32                          renesas,analog-enable;
33                  };
34          };
35
36          acmphs0_ivcmp0: acmphs0_ivcmp0 {
37                  group1 {
38                          /* CH0 IVCMP0 */
39                          psels = <RA_PSEL(RA_PSEL_ACMPHS, ..., ...)>;
40                          renesas,analog-enable;
41                  };
42          };
43  };
44
45  &acmphs_global {
46          status = "okay";
47
48          acmphs0 {
49                  pinctrl-0 = <&acmphs_ivref0 &acmphs0_ivcmp0>;
50                  pinctrl-names = "default";
51                  interrupts = <90 12>;
52                  interrupt-names = "hs";
53                  reference-input-source = "ivref0";
54                  compare-input-source = "ivcmp0";
55                  status = "okay";
56          };
57  };
58
59compatible: "renesas,ra-acmphs"
60
61include: [base.yaml, pinctrl-device.yaml]
62
63properties:
64  channel:
65    type: int
66    required: true
67
68  interrupts:
69    description: |
70      IRQ number and priority to use for interrupt Comparator:
71      - "hs": generated on valid edge detection from comparison result
72      Note: when this interrupts property is not defined, none of the trigger APIs
73            can be used (set_trigger, set_trigger_callback, trigger_is_pending).
74
75  reference-input-source:
76    type: string
77    required: true
78    enum:
79      - "ivref0"
80      - "ivref1"
81      - "ivref2"
82      - "ivref3"
83    description: |
84      Select the Analog reference voltage source.
85      Note: ivref2 is connected to Vref
86            ivref3 is connected to DA0 (DAC)
87            If either of these is selected, there is no need to configure pinsel for pinctrl.
88
89  compare-input-source:
90    type: string
91    required: true
92    enum:
93      - "ivcmp0"
94      - "ivcmp1"
95      - "ivcmp2"
96      - "ivcmp3"
97    description: |
98      Select the Analog compare voltage source.
99      Note: ivcmp1 is connected to DA0 (DAC)
100            If ivcmp1 is selected, there is no need to configure pinsel for pinctrl.
101
102  noise-filter:
103    type: int
104    enum: [1, 8, 16, 32]
105    default: 32
106    description: |
107      Select the PCLK divisor for the hardware digital debounce filter.
108      Larger divisors provide a longer debounce and take longer for the output to update.
109
110  output-invert-polarity:
111    type: boolean
112    description: |
113      When enabled comparator output is inverted.
114
115  pin-output-enable:
116    type: boolean
117    description: |
118      Turn this on to enable the CMPOUTn signal for this channel.
119      The CMPOUTn signal for each channel is OR'd together and the result is output to VCOUT.
120