Skip to content

Commit b7769be

Browse files
dlechnunojsa
authored andcommitted
dt-bindings: iio: adc: add AD4695 and similar ADCs
Add device tree bindings for AD4695 and similar ADCs. Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240711-iio-adc-ad4695-v4-0-c31621113b57@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent de35e0c commit b7769be

File tree

3 files changed

+355
-0
lines changed

3 files changed

+355
-0
lines changed
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/iio/adc/adi,ad4695.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Analog Devices Easy Drive Multiplexed SAR Analog to Digital Converters
8+
9+
maintainers:
10+
- Michael Hennerich <Michael.Hennerich@analog.com>
11+
- Nuno Sá <nuno.sa@analog.com>
12+
13+
description: |
14+
A family of similar multi-channel analog to digital converters with SPI bus.
15+
16+
* https://www.analog.com/en/products/ad4695.html
17+
* https://www.analog.com/en/products/ad4696.html
18+
* https://www.analog.com/en/products/ad4697.html
19+
* https://www.analog.com/en/products/ad4698.html
20+
21+
$ref: /schemas/spi/spi-peripheral-props.yaml#
22+
23+
properties:
24+
compatible:
25+
enum:
26+
- adi,ad4695
27+
- adi,ad4696
28+
- adi,ad4697
29+
- adi,ad4698
30+
31+
reg:
32+
maxItems: 1
33+
34+
spi-max-frequency:
35+
maximum: 80000000
36+
37+
spi-cpol: true
38+
spi-cpha: true
39+
40+
spi-rx-bus-width:
41+
minimum: 1
42+
maximum: 4
43+
44+
avdd-supply:
45+
description: Analog power supply.
46+
47+
vio-supply:
48+
description: I/O pin power supply.
49+
50+
ldo-in-supply:
51+
description: Internal LDO Input. Mutually exclusive with vdd-supply.
52+
53+
vdd-supply:
54+
description: Core power supply. Mutually exclusive with ldo-in-supply.
55+
56+
ref-supply:
57+
description:
58+
External reference voltage. Mutually exclusive with refin-supply.
59+
60+
refin-supply:
61+
description:
62+
Internal reference buffer input. Mutually exclusive with ref-supply.
63+
64+
com-supply:
65+
description: Common voltage supply for pseudo-differential analog inputs.
66+
67+
adi,no-ref-current-limit:
68+
$ref: /schemas/types.yaml#/definitions/flag
69+
description:
70+
When this flag is present, the REF Overvoltage Reduced Current protection
71+
is disabled.
72+
73+
adi,no-ref-high-z:
74+
$ref: /schemas/types.yaml#/definitions/flag
75+
description:
76+
Enable this flag if the ref-supply requires Reference Input High-Z Mode
77+
to be disabled for proper operation.
78+
79+
cnv-gpios:
80+
description: The Convert Input (CNV). If omitted, CNV is tied to SPI CS.
81+
maxItems: 1
82+
83+
reset-gpios:
84+
description: The Reset Input (RESET). Should be configured GPIO_ACTIVE_LOW.
85+
maxItems: 1
86+
87+
interrupts:
88+
minItems: 1
89+
items:
90+
- description: Signal coming from the BSY_ALT_GP0 pin (ALERT or BUSY).
91+
- description: Signal coming from the GP2 pin (ALERT).
92+
- description: Signal coming from the GP3 pin (BUSY).
93+
94+
interrupt-names:
95+
minItems: 1
96+
items:
97+
- const: gp0
98+
- const: gp2
99+
- const: gp3
100+
101+
gpio-controller: true
102+
103+
"#gpio-cells":
104+
const: 2
105+
description: |
106+
The first cell is the GPn number: 0 to 3.
107+
The second cell takes standard GPIO flags.
108+
109+
"#address-cells":
110+
const: 1
111+
112+
"#size-cells":
113+
const: 0
114+
115+
patternProperties:
116+
"^in(?:[13579]|1[135])-supply$":
117+
description:
118+
Optional voltage supply for odd numbered channels when they are used as
119+
the negative input for a pseudo-differential channel.
120+
121+
"^channel@[0-9a-f]$":
122+
type: object
123+
$ref: adc.yaml
124+
unevaluatedProperties: false
125+
description:
126+
Describes each individual channel. In addition the properties defined
127+
below, bipolar from adc.yaml is also supported.
128+
129+
properties:
130+
reg:
131+
maximum: 15
132+
133+
common-mode-channel:
134+
description:
135+
Describes the common mode channel for single channels. 0xFF is REFGND
136+
and OxFE is COM. Macros are available for these values in
137+
dt-bindings/iio/adi,ad4695.h. Values 1 to 15 correspond to INx inputs.
138+
Only odd numbered INx inputs can be used as common mode channels.
139+
items:
140+
enum: [1, 3, 5, 7, 9, 11, 13, 15, 0xFE, 0xFF]
141+
default: 0xFF
142+
143+
adi,no-high-z:
144+
$ref: /schemas/types.yaml#/definitions/flag
145+
description:
146+
Enable this flag if the input pin requires the Analog Input High-Z
147+
Mode to be disabled for proper operation.
148+
149+
required:
150+
- reg
151+
152+
allOf:
153+
# bipolar mode can't be used with REFGND
154+
- if:
155+
properties:
156+
common-mode-channel:
157+
const: 0xFF
158+
then:
159+
properties:
160+
bipolar: false
161+
162+
required:
163+
- compatible
164+
- reg
165+
- avdd-supply
166+
- vio-supply
167+
168+
allOf:
169+
- oneOf:
170+
- required:
171+
- ldo-in-supply
172+
- required:
173+
- vdd-supply
174+
175+
- oneOf:
176+
- required:
177+
- ref-supply
178+
- required:
179+
- refin-supply
180+
181+
# the internal reference buffer always requires high-z mode
182+
- if:
183+
required:
184+
- refin-supply
185+
then:
186+
properties:
187+
adi,no-ref-high-z: false
188+
189+
# limit channels for 8-channel chips
190+
- if:
191+
properties:
192+
compatible:
193+
contains:
194+
enum:
195+
- adi,ad4697
196+
- adi,ad4698
197+
then:
198+
patternProperties:
199+
"^in(?:9|1[135])-supply$": false
200+
"^channel@[0-7]$":
201+
properties:
202+
reg:
203+
maximum: 7
204+
common-mode-channel:
205+
items:
206+
enum: [1, 3, 5, 7, 0xFE, 0xFF]
207+
"^channel@[8-9a-f]$": false
208+
209+
unevaluatedProperties: false
210+
211+
examples:
212+
- |
213+
#include <dt-bindings/gpio/gpio.h>
214+
#include <dt-bindings/iio/adi,ad4695.h>
215+
216+
spi {
217+
#address-cells = <1>;
218+
#size-cells = <0>;
219+
220+
adc@0 {
221+
compatible = "adi,ad4695";
222+
reg = <0>;
223+
spi-cpol;
224+
spi-cpha;
225+
spi-max-frequency = <80000000>;
226+
avdd-supply = <&power_supply>;
227+
ldo-in-supply = <&power_supply>;
228+
vio-supply = <&io_supply>;
229+
refin-supply = <&supply_5V>;
230+
com-supply = <&supply_2V5>;
231+
in3-supply = <&supply_2V5>;
232+
reset-gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
233+
234+
#address-cells = <1>;
235+
#size-cells = <0>;
236+
237+
/* Pseudo-differential channel between IN0 and REFGND. */
238+
channel@0 {
239+
reg = <0>;
240+
};
241+
242+
/* Pseudo-differential channel between IN1 and COM. */
243+
channel@1 {
244+
reg = <1>;
245+
common-mode-channel = <AD4695_COMMON_MODE_COM>;
246+
bipolar;
247+
};
248+
249+
/* Pseudo-differential channel between IN2 and IN3. */
250+
channel@2 {
251+
reg = <2>;
252+
common-mode-channel = <3>;
253+
bipolar;
254+
};
255+
};
256+
};

MAINTAINERS

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,84 @@ trivial patch so apply some common sense.
88
Tips for patch submitters
99
-------------------------
1010

11+
1. Always *test* your changes, however small, on at least 4 or
12+
5 people, preferably many more.
13+
14+
2. Try to release a few ALPHA test versions to the net. Announce
15+
them onto the kernel channel and await results. This is especially
16+
important for device drivers, because often that's the only way
17+
you will find things like the fact version 3 firmware needs
18+
a magic fix you didn't know about, or some clown changed the
19+
chips on a board and not its name. (Don't laugh! Look at the
20+
SMC etherpower for that.)
21+
22+
3. Make sure your changes compile correctly in multiple
23+
configurations. In particular check that changes work both as a
24+
module and built into the kernel.
25+
26+
4. When you are happy with a change make it generally available for
27+
testing and await feedback.
28+
29+
5. Make a patch available to the relevant maintainer in the list. Use
30+
``diff -u`` to make the patch easy to merge. Be prepared to get your
31+
changes sent back with seemingly silly requests about formatting
32+
and variable names. These aren't as silly as they seem. One
33+
job the maintainers (and especially Linus) do is to keep things
34+
looking the same. Sometimes this means that the clever hack in
35+
your driver to get around a problem actually needs to become a
36+
generalized kernel feature ready for next time.
37+
38+
PLEASE check your patch with the automated style checker
39+
(scripts/checkpatch.pl) to catch trivial style violations.
40+
See Documentation/process/coding-style.rst for guidance here.
41+
42+
PLEASE CC: the maintainers and mailing lists that are generated
43+
by ``scripts/get_maintainer.pl.`` The results returned by the
44+
script will be best if you have git installed and are making
45+
your changes in a branch derived from Linus' latest git tree.
46+
See Documentation/process/submitting-patches.rst for details.
47+
48+
PLEASE try to include any credit lines you want added with the
49+
patch. It avoids people being missed off by mistake and makes
50+
it easier to know who wants adding and who doesn't.
51+
52+
PLEASE document known bugs. If it doesn't work for everything
53+
or does something very odd once a month document it.
54+
55+
PLEASE remember that submissions must be made under the terms
56+
of the Linux Foundation certificate of contribution and should
57+
include a Signed-off-by: line. The current version of this
58+
"Developer's Certificate of Origin" (DCO) is listed in the file
59+
Documentation/process/submitting-patches.rst.
60+
61+
6. Make sure you have the right to send any changes you make. If you
62+
do changes at work you may find your employer owns the patch
63+
not you.
64+
65+
7. When sending security related changes or reports to a maintainer
66+
please Cc: security@kernel.org, especially if the maintainer
67+
does not respond. Please keep in mind that the security team is
68+
a small set of people who can be efficient only when working on
69+
verified bugs. Please only Cc: this list when you have identified
70+
that the bug would present a short-term risk to other users if it
71+
were publicly disclosed. For example, reports of address leaks do
72+
not represent an immediate threat and are better handled publicly,
73+
and ideally, should come with a patch proposal. Please do not send
74+
automated reports to this list either. Such bugs will be handled
75+
better and faster in the usual public places. See
76+
Documentation/admin-guide/security-bugs.rst for details.
77+
78+
8. Happy hacking.
79+
List of maintainers and how to submit kernel changes
80+
====================================================
81+
82+
Please try to follow the guidelines below. This will make things
83+
easier on the maintainers. Not all of these guidelines matter for every
84+
trivial patch so apply some common sense.
85+
86+
Tips for patch submitters
87+
-------------------------
88+
1189
1. Always *test* your changes, however small, on at least 4 or
1290
5 people, preferably many more.
1391

@@ -1185,6 +1263,18 @@ F: Documentation/ABI/testing/sysfs-bus-iio-adc-ad4130
11851263
F: Documentation/devicetree/bindings/iio/adc/adi,ad4130.yaml
11861264
F: drivers/iio/adc/ad4130.c
11871265

1266+
ANALOG DEVICES INC AD4695 DRIVER
1267+
M: Michael Hennerich <michael.hennerich@analog.com>
1268+
M: Nuno Sá <nuno.sa@analog.com>
1269+
R: David Lechner <dlechner@baylibre.com>
1270+
L: linux-iio@vger.kernel.org
1271+
S: Supported
1272+
W: https://ez.analog.com/linux-software-drivers
1273+
F: Documentation/devicetree/bindings/iio/adc/adi,ad4695.yaml
1274+
F: Documentation/iio/ad4695.rst
1275+
F: drivers/iio/adc/ad4695.c
1276+
F: include/dt-bindings/iio/adi,ad4695.h
1277+
11881278
ANALOG DEVICES INC AD7192 DRIVER
11891279
M: Alexandru Tachici <alexandru.tachici@analog.com>
11901280
L: linux-iio@vger.kernel.org

include/dt-bindings/iio/adi,ad4695.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2+
3+
#ifndef _DT_BINDINGS_ADI_AD4695_H
4+
#define _DT_BINDINGS_ADI_AD4695_H
5+
6+
#define AD4695_COMMON_MODE_REFGND 0xFF
7+
#define AD4695_COMMON_MODE_COM 0xFE
8+
9+
#endif /* _DT_BINDINGS_ADI_AD4695_H */

0 commit comments

Comments
 (0)