1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/iio/adc/maxim,max34408.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Maxim MAX34408/MAX34409 current monitors with overcurrent control
8
9maintainers:
10  - Ivan Mikhaylov <fr0st61te@gmail.com>
11
12description: |
13  The MAX34408/MAX34409 are two- and four-channel current monitors that are
14  configured and monitored with a standard I2C/SMBus serial interface. Each
15  unidirectional current sensor offers precision high-side operation with a
16  low full-scale sense voltage. The devices automatically sequence through
17  two or four channels and collect the current-sense samples and average them
18  to reduce the effect of impulse noise. The raw ADC samples are compared to
19  user-programmable digital thresholds to indicate overcurrent conditions.
20  Overcurrent conditions trigger a hardware output to provide an immediate
21  indication to shut down any necessary external circuitry.
22
23  Specifications about the devices can be found at:
24  https://www.analog.com/media/en/technical-documentation/data-sheets/MAX34408-MAX34409.pdf
25
26properties:
27  compatible:
28    enum:
29      - maxim,max34408
30      - maxim,max34409
31
32  "#address-cells":
33    const: 1
34
35  "#size-cells":
36    const: 0
37
38  reg:
39    maxItems: 1
40
41  interrupts:
42    maxItems: 1
43
44  powerdown-gpios:
45    description:
46      Shutdown Output. Open-drain output. This output transitions to high impedance
47      when any of the digital comparator thresholds are exceeded as long as the ENA
48      pin is high.
49    maxItems: 1
50
51  powerdown-status-gpios:
52    description:
53      SHTDN Enable Input. CMOS digital input. Connect to GND to clear the latch and
54      unconditionally deassert (force low) the SHTDN output and reset the shutdown
55      delay. Connect to VDD to enable normal latch operation of the SHTDN output.
56    maxItems: 1
57
58  vdd-supply: true
59
60patternProperties:
61  "^channel@[0-3]$":
62    $ref: adc.yaml
63    type: object
64    description:
65      Represents the internal channels of the ADC.
66
67    properties:
68      reg:
69        items:
70          - minimum: 0
71            maximum: 3
72
73      maxim,rsense-val-micro-ohms:
74        description:
75          Adjust the Rsense value to monitor higher or lower current levels for
76          input.
77        enum: [250, 500, 1000, 5000, 10000, 50000, 100000, 200000, 500000]
78        default: 1000
79
80    required:
81      - reg
82      - maxim,rsense-val-micro-ohms
83
84    unevaluatedProperties: false
85
86required:
87  - compatible
88  - reg
89
90allOf:
91  - if:
92      properties:
93        compatible:
94          contains:
95            const: maxim,max34408
96    then:
97      patternProperties:
98        "^channel@[2-3]$": false
99        "^channel@[0-1]$":
100          properties:
101            reg:
102              maximum: 1
103    else:
104      patternProperties:
105        "^channel@[0-3]$":
106          properties:
107            reg:
108              maximum: 3
109
110additionalProperties: false
111
112examples:
113  - |
114    #include <dt-bindings/gpio/gpio.h>
115
116    i2c {
117        #address-cells = <1>;
118        #size-cells = <0>;
119
120        adc@1e {
121              compatible = "maxim,max34409";
122              reg = <0x1e>;
123              powerdown-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
124              powerdown-status-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
125
126              #address-cells = <1>;
127              #size-cells = <0>;
128
129              channel@0 {
130                  reg = <0x0>;
131                  maxim,rsense-val-micro-ohms = <5000>;
132              };
133
134              channel@1 {
135                  reg = <0x1>;
136                  maxim,rsense-val-micro-ohms = <10000>;
137             };
138        };
139    };
140