Skip to content

Commit c3948d0

Browse files
machschmittjic23
authored andcommitted
iio: adc: ad4000: Add support for PulSAR devices
The ADI PulSAR series of single-channel devices comprises differential and pseudo-differential ADCs that don't require any input data from the host controller. By not requiring a data input line, PulSAR devices can operate with a 3-wire only data bus in some setups. The AD4000 series and the single-channel PulSAR series of devices have similar SPI transfer specifications and wiring configurations. Single-channel PulSAR devices are slower than AD4000 and don't have a configuration register. That taken into account, single-channel PulSARs can be supported by the ad4000 driver without any increase in code complexity. Extend the AD4000 driver to also support single-channel PulSAR devices. Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://patch.msgid.link/2bfb904e29914c3dc4905e1c87fcc735575f330d.1733147444.git.marcelo.schmitt@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent fc8f630 commit c3948d0

File tree

1 file changed

+162
-0
lines changed

1 file changed

+162
-0
lines changed

drivers/iio/adc/ad4000.c

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,48 @@ static const struct ad4000_time_spec ad4020_t_spec = {
138138
.t_quiet2_ns = 60,
139139
};
140140

141+
/* AD7983, AD7984 */
142+
static const struct ad4000_time_spec ad7983_t_spec = {
143+
.t_conv_ns = 500,
144+
.t_quiet2_ns = 0,
145+
};
146+
147+
/* AD7980, AD7982 */
148+
static const struct ad4000_time_spec ad7980_t_spec = {
149+
.t_conv_ns = 800,
150+
.t_quiet2_ns = 0,
151+
};
152+
153+
/* AD7946, AD7686, AD7688, AD7988-5, AD7693 */
154+
static const struct ad4000_time_spec ad7686_t_spec = {
155+
.t_conv_ns = 1600,
156+
.t_quiet2_ns = 0,
157+
};
158+
159+
/* AD7690 */
160+
static const struct ad4000_time_spec ad7690_t_spec = {
161+
.t_conv_ns = 2100,
162+
.t_quiet2_ns = 0,
163+
};
164+
165+
/* AD7942, AD7685, AD7687 */
166+
static const struct ad4000_time_spec ad7687_t_spec = {
167+
.t_conv_ns = 3200,
168+
.t_quiet2_ns = 0,
169+
};
170+
171+
/* AD7691 */
172+
static const struct ad4000_time_spec ad7691_t_spec = {
173+
.t_conv_ns = 3700,
174+
.t_quiet2_ns = 0,
175+
};
176+
177+
/* AD7988-1 */
178+
static const struct ad4000_time_spec ad7988_1_t_spec = {
179+
.t_conv_ns = 9500,
180+
.t_quiet2_ns = 0,
181+
};
182+
141183
struct ad4000_chip_info {
142184
const char *dev_name;
143185
struct iio_chan_spec chan_spec[2];
@@ -260,6 +302,96 @@ static const struct ad4000_chip_info adaq4003_chip_info = {
260302
.has_hardware_gain = true,
261303
};
262304

305+
static const struct ad4000_chip_info ad7685_chip_info = {
306+
.dev_name = "ad7685",
307+
.chan_spec = AD4000_PSEUDO_DIFF_CHANNELS('u', 16, 0),
308+
.time_spec = &ad7687_t_spec,
309+
};
310+
311+
static const struct ad4000_chip_info ad7686_chip_info = {
312+
.dev_name = "ad7686",
313+
.chan_spec = AD4000_PSEUDO_DIFF_CHANNELS('u', 16, 0),
314+
.time_spec = &ad7686_t_spec,
315+
};
316+
317+
static const struct ad4000_chip_info ad7687_chip_info = {
318+
.dev_name = "ad7687",
319+
.chan_spec = AD4000_DIFF_CHANNELS('s', 16, 0),
320+
.time_spec = &ad7687_t_spec,
321+
};
322+
323+
static const struct ad4000_chip_info ad7688_chip_info = {
324+
.dev_name = "ad7688",
325+
.chan_spec = AD4000_DIFF_CHANNELS('s', 16, 0),
326+
.time_spec = &ad7686_t_spec,
327+
};
328+
329+
static const struct ad4000_chip_info ad7690_chip_info = {
330+
.dev_name = "ad7690",
331+
.chan_spec = AD4000_DIFF_CHANNELS('s', 18, 0),
332+
.time_spec = &ad7690_t_spec,
333+
};
334+
335+
static const struct ad4000_chip_info ad7691_chip_info = {
336+
.dev_name = "ad7691",
337+
.chan_spec = AD4000_DIFF_CHANNELS('s', 18, 0),
338+
.time_spec = &ad7691_t_spec,
339+
};
340+
341+
static const struct ad4000_chip_info ad7693_chip_info = {
342+
.dev_name = "ad7693",
343+
.chan_spec = AD4000_DIFF_CHANNELS('s', 16, 0),
344+
.time_spec = &ad7686_t_spec,
345+
};
346+
347+
static const struct ad4000_chip_info ad7942_chip_info = {
348+
.dev_name = "ad7942",
349+
.chan_spec = AD4000_PSEUDO_DIFF_CHANNELS('u', 14, 0),
350+
.time_spec = &ad7687_t_spec,
351+
};
352+
353+
static const struct ad4000_chip_info ad7946_chip_info = {
354+
.dev_name = "ad7946",
355+
.chan_spec = AD4000_PSEUDO_DIFF_CHANNELS('u', 14, 0),
356+
.time_spec = &ad7686_t_spec,
357+
};
358+
359+
static const struct ad4000_chip_info ad7980_chip_info = {
360+
.dev_name = "ad7980",
361+
.chan_spec = AD4000_PSEUDO_DIFF_CHANNELS('u', 16, 0),
362+
.time_spec = &ad7980_t_spec,
363+
};
364+
365+
static const struct ad4000_chip_info ad7982_chip_info = {
366+
.dev_name = "ad7982",
367+
.chan_spec = AD4000_DIFF_CHANNELS('s', 18, 0),
368+
.time_spec = &ad7980_t_spec,
369+
};
370+
371+
static const struct ad4000_chip_info ad7983_chip_info = {
372+
.dev_name = "ad7983",
373+
.chan_spec = AD4000_PSEUDO_DIFF_CHANNELS('u', 16, 0),
374+
.time_spec = &ad7983_t_spec,
375+
};
376+
377+
static const struct ad4000_chip_info ad7984_chip_info = {
378+
.dev_name = "ad7984",
379+
.chan_spec = AD4000_DIFF_CHANNELS('s', 18, 0),
380+
.time_spec = &ad7983_t_spec,
381+
};
382+
383+
static const struct ad4000_chip_info ad7988_1_chip_info = {
384+
.dev_name = "ad7988-1",
385+
.chan_spec = AD4000_PSEUDO_DIFF_CHANNELS('u', 16, 0),
386+
.time_spec = &ad7988_1_t_spec,
387+
};
388+
389+
static const struct ad4000_chip_info ad7988_5_chip_info = {
390+
.dev_name = "ad7988-5",
391+
.chan_spec = AD4000_PSEUDO_DIFF_CHANNELS('u', 16, 0),
392+
.time_spec = &ad7686_t_spec,
393+
};
394+
263395
struct ad4000_state {
264396
struct spi_device *spi;
265397
struct gpio_desc *cnv_gpio;
@@ -733,6 +865,21 @@ static const struct spi_device_id ad4000_id[] = {
733865
{ "ad4022", (kernel_ulong_t)&ad4022_chip_info },
734866
{ "adaq4001", (kernel_ulong_t)&adaq4001_chip_info },
735867
{ "adaq4003", (kernel_ulong_t)&adaq4003_chip_info },
868+
{ "ad7685", (kernel_ulong_t)&ad7685_chip_info },
869+
{ "ad7686", (kernel_ulong_t)&ad7686_chip_info },
870+
{ "ad7687", (kernel_ulong_t)&ad7687_chip_info },
871+
{ "ad7688", (kernel_ulong_t)&ad7688_chip_info },
872+
{ "ad7690", (kernel_ulong_t)&ad7690_chip_info },
873+
{ "ad7691", (kernel_ulong_t)&ad7691_chip_info },
874+
{ "ad7693", (kernel_ulong_t)&ad7693_chip_info },
875+
{ "ad7942", (kernel_ulong_t)&ad7942_chip_info },
876+
{ "ad7946", (kernel_ulong_t)&ad7946_chip_info },
877+
{ "ad7980", (kernel_ulong_t)&ad7980_chip_info },
878+
{ "ad7982", (kernel_ulong_t)&ad7982_chip_info },
879+
{ "ad7983", (kernel_ulong_t)&ad7983_chip_info },
880+
{ "ad7984", (kernel_ulong_t)&ad7984_chip_info },
881+
{ "ad7988-1", (kernel_ulong_t)&ad7988_1_chip_info },
882+
{ "ad7988-5", (kernel_ulong_t)&ad7988_5_chip_info },
736883
{ }
737884
};
738885
MODULE_DEVICE_TABLE(spi, ad4000_id);
@@ -754,6 +901,21 @@ static const struct of_device_id ad4000_of_match[] = {
754901
{ .compatible = "adi,ad4022", .data = &ad4022_chip_info },
755902
{ .compatible = "adi,adaq4001", .data = &adaq4001_chip_info },
756903
{ .compatible = "adi,adaq4003", .data = &adaq4003_chip_info },
904+
{ .compatible = "adi,ad7685", .data = &ad7685_chip_info },
905+
{ .compatible = "adi,ad7686", .data = &ad7686_chip_info },
906+
{ .compatible = "adi,ad7687", .data = &ad7687_chip_info },
907+
{ .compatible = "adi,ad7688", .data = &ad7688_chip_info },
908+
{ .compatible = "adi,ad7690", .data = &ad7690_chip_info },
909+
{ .compatible = "adi,ad7691", .data = &ad7691_chip_info },
910+
{ .compatible = "adi,ad7693", .data = &ad7693_chip_info },
911+
{ .compatible = "adi,ad7942", .data = &ad7942_chip_info },
912+
{ .compatible = "adi,ad7946", .data = &ad7946_chip_info },
913+
{ .compatible = "adi,ad7980", .data = &ad7980_chip_info },
914+
{ .compatible = "adi,ad7982", .data = &ad7982_chip_info },
915+
{ .compatible = "adi,ad7983", .data = &ad7983_chip_info },
916+
{ .compatible = "adi,ad7984", .data = &ad7984_chip_info },
917+
{ .compatible = "adi,ad7988-1", .data = &ad7988_1_chip_info },
918+
{ .compatible = "adi,ad7988-5", .data = &ad7988_5_chip_info },
757919
{ }
758920
};
759921
MODULE_DEVICE_TABLE(of, ad4000_of_match);

0 commit comments

Comments
 (0)