|
| 1 | +# Copyright (c) 2025 Microchip Technology Inc. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +description: | |
| 5 | + Binding for the Microchip Comparator driver supporting AC G1 peripherals. |
| 6 | +
|
| 7 | +compatible: "microchip,ac-g1-comparator" |
| 8 | + |
| 9 | +include: |
| 10 | + - name: base.yaml |
| 11 | + - name: pinctrl-device.yaml |
| 12 | + |
| 13 | +properties: |
| 14 | + reg: |
| 15 | + required: true |
| 16 | + description: | |
| 17 | + Base address of AC peripheral and its size |
| 18 | +
|
| 19 | + comparator-channel: |
| 20 | + required: true |
| 21 | + type: int |
| 22 | + enum: [0, 1] |
| 23 | + description: | |
| 24 | + Comparator channel index (0 or 1). |
| 25 | +
|
| 26 | + interrupt-enable: |
| 27 | + type: boolean |
| 28 | + description: | |
| 29 | + Enable interrupt generation for the comparator channel. |
| 30 | +
|
| 31 | + single-shot-mode: |
| 32 | + type: boolean |
| 33 | + description: | |
| 34 | + Enable single-shot mode operation. When enabled, the comparator performs a single comparison |
| 35 | + and disables itself. This must be disabled for continuous-mode features like hysteresis. |
| 36 | +
|
| 37 | + positive-mux-input: |
| 38 | + type: string |
| 39 | + enum: ["pin0", "pin1", "pin2", "pin3", "vscale"] |
| 40 | + description: | |
| 41 | + Positive input source selection (MUXPOS): |
| 42 | + - pin0: I/O pin 0 (0x0) |
| 43 | + - pin1: I/O pin 1 (0x1) |
| 44 | + - pin2: I/O pin 2 (0x2) |
| 45 | + - pin3: I/O pin 3 (0x3) |
| 46 | + - vscale: VDDANA scaler (0x4) |
| 47 | +
|
| 48 | + negative-mux-input: |
| 49 | + type: string |
| 50 | + enum: ["pin0", "pin1", "pin2", "pin3", "gnd", "vscale", "bandgap", "dac"] |
| 51 | + description: | |
| 52 | + Negative input source selection (MUXNEG): |
| 53 | + - pin0: I/O pin 0 (0x0) |
| 54 | + - pin1: I/O pin 1 (0x1) |
| 55 | + - pin2: I/O pin 2 (0x2) |
| 56 | + - pin3: I/O pin 3 (0x3) |
| 57 | + - gnd: Ground (0x4) |
| 58 | + - vscale: VDDANA scaler (0x5) |
| 59 | + - bandgap: Internal bandgap voltage (0x6) |
| 60 | + - dac: DAC output (0x7) |
| 61 | +
|
| 62 | + vddana-scale-value: |
| 63 | + type: int |
| 64 | + default: 0 |
| 65 | + description: | |
| 66 | + VSCALE = (VDDANA * (value + 1)) / 64 |
| 67 | + Only used when either positive or negative input is configured as "vscale". |
| 68 | + Valid range: 0 to 63 |
| 69 | +
|
| 70 | + output-mode: |
| 71 | + type: string |
| 72 | + enum: ["off", "async", "sync"] |
| 73 | + default: "off" |
| 74 | + description: | |
| 75 | + Comparator output routing mode: |
| 76 | + - off: Output is not routed to COMPn I/O pin (0x0) |
| 77 | + - async: Asynchronous output is routed (0x1) |
| 78 | + - sync: Synchronous filtered output is routed (0x2) |
| 79 | +
|
| 80 | + interrupt-selection: |
| 81 | + type: string |
| 82 | + enum: ["toggle", "rising", "falling", "eoc"] |
| 83 | + default: "toggle" |
| 84 | + description: | |
| 85 | + Interrupt generation condition: |
| 86 | + - toggle: Interrupt on any toggle of the comparator output (0x0) |
| 87 | + - rising: Interrupt on rising edge of the comparator output (0x1) |
| 88 | + - falling: Interrupt on falling edge of the comparator output (0x2) |
| 89 | + - eoc: Interrupt on end of comparison (valid only in single-shot mode) (0x3) |
| 90 | +
|
| 91 | + run-standby: |
| 92 | + type: boolean |
| 93 | + description: | |
| 94 | + Keep the comparator running in standby mode (when the core is sleeping). |
| 95 | +
|
| 96 | + hysteresis-enable: |
| 97 | + type: boolean |
| 98 | + description: | |
| 99 | + Enable hysteresis on comparator output. |
| 100 | + This is only valid when single-shot mode is disabled (i.e., in continuous mode). |
| 101 | +
|
| 102 | + hysteresis-level: |
| 103 | + type: string |
| 104 | + enum: ["hyst50", "hyst100", "hyst150"] |
| 105 | + default: "hyst50" |
| 106 | + description: | |
| 107 | + Hysteresis voltage level to apply when hysteresis is enabled: |
| 108 | + - hyst50: 50 mV (0x0) |
| 109 | + - hyst100: 100 mV (0x1) |
| 110 | + - hyst150: 150 mV (0x2) |
| 111 | +
|
| 112 | + This setting is effective only if hysteresis is enabled and single-shot mode is disabled. |
| 113 | +
|
| 114 | + filter-length: |
| 115 | + type: string |
| 116 | + enum: ["off", "maj3", "maj5"] |
| 117 | + default: "off" |
| 118 | + description: | |
| 119 | + Output filtering (debounce) mode: |
| 120 | + - off: No filtering (0x0) |
| 121 | + - maj3: 3-bit majority filter (2 of 3) (0x1) |
| 122 | + - maj5: 5-bit majority filter (3 of 5) (0x2) |
| 123 | +
|
| 124 | + swap-inputs: |
| 125 | + type: boolean |
| 126 | + description: | |
| 127 | + Swap the comparator inputs and invert the output: |
| 128 | + - false: MUXPOS → positive input, MUXNEG → negative input |
| 129 | + - true: MUXNEG → positive input, MUXPOS → negative input (output inverted) |
| 130 | +
|
| 131 | + This can be used for offset cancellation. |
| 132 | + It must be configured before enabling the comparator. |
| 133 | +
|
| 134 | + event-input-enable: |
| 135 | + type: boolean |
| 136 | + description: | |
| 137 | + Enable the event input path for the comparator. |
| 138 | +
|
| 139 | + event-output-enable: |
| 140 | + type: boolean |
| 141 | + description: | |
| 142 | + Enable the event output path for the comparator. |
0 commit comments