treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / iio / adc / ad7124.c
blobd9915dc71d1e9ead05a5810eabe21e43b50263e9
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * AD7124 SPI ADC driver
5 * Copyright 2018 Analog Devices Inc.
6 */
7 #include <linux/bitfield.h>
8 #include <linux/clk.h>
9 #include <linux/delay.h>
10 #include <linux/device.h>
11 #include <linux/err.h>
12 #include <linux/interrupt.h>
13 #include <linux/kernel.h>
14 #include <linux/module.h>
15 #include <linux/regulator/consumer.h>
16 #include <linux/spi/spi.h>
18 #include <linux/iio/iio.h>
19 #include <linux/iio/adc/ad_sigma_delta.h>
20 #include <linux/iio/sysfs.h>
22 /* AD7124 registers */
23 #define AD7124_COMMS 0x00
24 #define AD7124_STATUS 0x00
25 #define AD7124_ADC_CONTROL 0x01
26 #define AD7124_DATA 0x02
27 #define AD7124_IO_CONTROL_1 0x03
28 #define AD7124_IO_CONTROL_2 0x04
29 #define AD7124_ID 0x05
30 #define AD7124_ERROR 0x06
31 #define AD7124_ERROR_EN 0x07
32 #define AD7124_MCLK_COUNT 0x08
33 #define AD7124_CHANNEL(x) (0x09 + (x))
34 #define AD7124_CONFIG(x) (0x19 + (x))
35 #define AD7124_FILTER(x) (0x21 + (x))
36 #define AD7124_OFFSET(x) (0x29 + (x))
37 #define AD7124_GAIN(x) (0x31 + (x))
39 /* AD7124_STATUS */
40 #define AD7124_STATUS_POR_FLAG_MSK BIT(4)
42 /* AD7124_ADC_CONTROL */
43 #define AD7124_ADC_CTRL_REF_EN_MSK BIT(8)
44 #define AD7124_ADC_CTRL_REF_EN(x) FIELD_PREP(AD7124_ADC_CTRL_REF_EN_MSK, x)
45 #define AD7124_ADC_CTRL_PWR_MSK GENMASK(7, 6)
46 #define AD7124_ADC_CTRL_PWR(x) FIELD_PREP(AD7124_ADC_CTRL_PWR_MSK, x)
47 #define AD7124_ADC_CTRL_MODE_MSK GENMASK(5, 2)
48 #define AD7124_ADC_CTRL_MODE(x) FIELD_PREP(AD7124_ADC_CTRL_MODE_MSK, x)
50 /* AD7124_CHANNEL_X */
51 #define AD7124_CHANNEL_EN_MSK BIT(15)
52 #define AD7124_CHANNEL_EN(x) FIELD_PREP(AD7124_CHANNEL_EN_MSK, x)
53 #define AD7124_CHANNEL_SETUP_MSK GENMASK(14, 12)
54 #define AD7124_CHANNEL_SETUP(x) FIELD_PREP(AD7124_CHANNEL_SETUP_MSK, x)
55 #define AD7124_CHANNEL_AINP_MSK GENMASK(9, 5)
56 #define AD7124_CHANNEL_AINP(x) FIELD_PREP(AD7124_CHANNEL_AINP_MSK, x)
57 #define AD7124_CHANNEL_AINM_MSK GENMASK(4, 0)
58 #define AD7124_CHANNEL_AINM(x) FIELD_PREP(AD7124_CHANNEL_AINM_MSK, x)
60 /* AD7124_CONFIG_X */
61 #define AD7124_CONFIG_BIPOLAR_MSK BIT(11)
62 #define AD7124_CONFIG_BIPOLAR(x) FIELD_PREP(AD7124_CONFIG_BIPOLAR_MSK, x)
63 #define AD7124_CONFIG_REF_SEL_MSK GENMASK(4, 3)
64 #define AD7124_CONFIG_REF_SEL(x) FIELD_PREP(AD7124_CONFIG_REF_SEL_MSK, x)
65 #define AD7124_CONFIG_PGA_MSK GENMASK(2, 0)
66 #define AD7124_CONFIG_PGA(x) FIELD_PREP(AD7124_CONFIG_PGA_MSK, x)
67 #define AD7124_CONFIG_IN_BUFF_MSK GENMASK(7, 6)
68 #define AD7124_CONFIG_IN_BUFF(x) FIELD_PREP(AD7124_CONFIG_IN_BUFF_MSK, x)
70 /* AD7124_FILTER_X */
71 #define AD7124_FILTER_FS_MSK GENMASK(10, 0)
72 #define AD7124_FILTER_FS(x) FIELD_PREP(AD7124_FILTER_FS_MSK, x)
74 enum ad7124_ids {
75 ID_AD7124_4,
76 ID_AD7124_8,
79 enum ad7124_ref_sel {
80 AD7124_REFIN1,
81 AD7124_REFIN2,
82 AD7124_INT_REF,
83 AD7124_AVDD_REF,
86 enum ad7124_power_mode {
87 AD7124_LOW_POWER,
88 AD7124_MID_POWER,
89 AD7124_FULL_POWER,
92 static const unsigned int ad7124_gain[8] = {
93 1, 2, 4, 8, 16, 32, 64, 128
96 static const int ad7124_master_clk_freq_hz[3] = {
97 [AD7124_LOW_POWER] = 76800,
98 [AD7124_MID_POWER] = 153600,
99 [AD7124_FULL_POWER] = 614400,
102 static const char * const ad7124_ref_names[] = {
103 [AD7124_REFIN1] = "refin1",
104 [AD7124_REFIN2] = "refin2",
105 [AD7124_INT_REF] = "int",
106 [AD7124_AVDD_REF] = "avdd",
109 struct ad7124_chip_info {
110 unsigned int num_inputs;
113 struct ad7124_channel_config {
114 enum ad7124_ref_sel refsel;
115 bool bipolar;
116 bool buf_positive;
117 bool buf_negative;
118 unsigned int ain;
119 unsigned int vref_mv;
120 unsigned int pga_bits;
121 unsigned int odr;
124 struct ad7124_state {
125 const struct ad7124_chip_info *chip_info;
126 struct ad_sigma_delta sd;
127 struct ad7124_channel_config *channel_config;
128 struct regulator *vref[4];
129 struct clk *mclk;
130 unsigned int adc_control;
131 unsigned int num_channels;
134 static const struct iio_chan_spec ad7124_channel_template = {
135 .type = IIO_VOLTAGE,
136 .indexed = 1,
137 .differential = 1,
138 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
139 BIT(IIO_CHAN_INFO_SCALE) |
140 BIT(IIO_CHAN_INFO_OFFSET) |
141 BIT(IIO_CHAN_INFO_SAMP_FREQ),
142 .scan_type = {
143 .sign = 'u',
144 .realbits = 24,
145 .storagebits = 32,
146 .shift = 8,
147 .endianness = IIO_BE,
151 static struct ad7124_chip_info ad7124_chip_info_tbl[] = {
152 [ID_AD7124_4] = {
153 .num_inputs = 8,
155 [ID_AD7124_8] = {
156 .num_inputs = 16,
160 static int ad7124_find_closest_match(const int *array,
161 unsigned int size, int val)
163 int i, idx;
164 unsigned int diff_new, diff_old;
166 diff_old = U32_MAX;
167 idx = 0;
169 for (i = 0; i < size; i++) {
170 diff_new = abs(val - array[i]);
171 if (diff_new < diff_old) {
172 diff_old = diff_new;
173 idx = i;
177 return idx;
180 static int ad7124_spi_write_mask(struct ad7124_state *st,
181 unsigned int addr,
182 unsigned long mask,
183 unsigned int val,
184 unsigned int bytes)
186 unsigned int readval;
187 int ret;
189 ret = ad_sd_read_reg(&st->sd, addr, bytes, &readval);
190 if (ret < 0)
191 return ret;
193 readval &= ~mask;
194 readval |= val;
196 return ad_sd_write_reg(&st->sd, addr, bytes, readval);
199 static int ad7124_set_mode(struct ad_sigma_delta *sd,
200 enum ad_sigma_delta_mode mode)
202 struct ad7124_state *st = container_of(sd, struct ad7124_state, sd);
204 st->adc_control &= ~AD7124_ADC_CTRL_MODE_MSK;
205 st->adc_control |= AD7124_ADC_CTRL_MODE(mode);
207 return ad_sd_write_reg(&st->sd, AD7124_ADC_CONTROL, 2, st->adc_control);
210 static int ad7124_set_channel(struct ad_sigma_delta *sd, unsigned int channel)
212 struct ad7124_state *st = container_of(sd, struct ad7124_state, sd);
213 unsigned int val;
215 val = st->channel_config[channel].ain | AD7124_CHANNEL_EN(1) |
216 AD7124_CHANNEL_SETUP(channel);
218 return ad_sd_write_reg(&st->sd, AD7124_CHANNEL(channel), 2, val);
221 static const struct ad_sigma_delta_info ad7124_sigma_delta_info = {
222 .set_channel = ad7124_set_channel,
223 .set_mode = ad7124_set_mode,
224 .has_registers = true,
225 .addr_shift = 0,
226 .read_mask = BIT(6),
227 .data_reg = AD7124_DATA,
228 .irq_flags = IRQF_TRIGGER_FALLING,
231 static int ad7124_set_channel_odr(struct ad7124_state *st,
232 unsigned int channel,
233 unsigned int odr)
235 unsigned int fclk, odr_sel_bits;
236 int ret;
238 fclk = clk_get_rate(st->mclk);
240 * FS[10:0] = fCLK / (fADC x 32) where:
241 * fADC is the output data rate
242 * fCLK is the master clock frequency
243 * FS[10:0] are the bits in the filter register
244 * FS[10:0] can have a value from 1 to 2047
246 odr_sel_bits = DIV_ROUND_CLOSEST(fclk, odr * 32);
247 if (odr_sel_bits < 1)
248 odr_sel_bits = 1;
249 else if (odr_sel_bits > 2047)
250 odr_sel_bits = 2047;
252 ret = ad7124_spi_write_mask(st, AD7124_FILTER(channel),
253 AD7124_FILTER_FS_MSK,
254 AD7124_FILTER_FS(odr_sel_bits), 3);
255 if (ret < 0)
256 return ret;
257 /* fADC = fCLK / (FS[10:0] x 32) */
258 st->channel_config[channel].odr =
259 DIV_ROUND_CLOSEST(fclk, odr_sel_bits * 32);
261 return 0;
264 static int ad7124_set_channel_gain(struct ad7124_state *st,
265 unsigned int channel,
266 unsigned int gain)
268 unsigned int res;
269 int ret;
271 res = ad7124_find_closest_match(ad7124_gain,
272 ARRAY_SIZE(ad7124_gain), gain);
273 ret = ad7124_spi_write_mask(st, AD7124_CONFIG(channel),
274 AD7124_CONFIG_PGA_MSK,
275 AD7124_CONFIG_PGA(res), 2);
276 if (ret < 0)
277 return ret;
279 st->channel_config[channel].pga_bits = res;
281 return 0;
284 static int ad7124_read_raw(struct iio_dev *indio_dev,
285 struct iio_chan_spec const *chan,
286 int *val, int *val2, long info)
288 struct ad7124_state *st = iio_priv(indio_dev);
289 int idx, ret;
291 switch (info) {
292 case IIO_CHAN_INFO_RAW:
293 ret = ad_sigma_delta_single_conversion(indio_dev, chan, val);
294 if (ret < 0)
295 return ret;
297 /* After the conversion is performed, disable the channel */
298 ret = ad_sd_write_reg(&st->sd,
299 AD7124_CHANNEL(chan->address), 2,
300 st->channel_config[chan->address].ain |
301 AD7124_CHANNEL_EN(0));
302 if (ret < 0)
303 return ret;
305 return IIO_VAL_INT;
306 case IIO_CHAN_INFO_SCALE:
307 idx = st->channel_config[chan->address].pga_bits;
308 *val = st->channel_config[chan->address].vref_mv;
309 if (st->channel_config[chan->address].bipolar)
310 *val2 = chan->scan_type.realbits - 1 + idx;
311 else
312 *val2 = chan->scan_type.realbits + idx;
314 return IIO_VAL_FRACTIONAL_LOG2;
315 case IIO_CHAN_INFO_OFFSET:
316 if (st->channel_config[chan->address].bipolar)
317 *val = -(1 << (chan->scan_type.realbits - 1));
318 else
319 *val = 0;
321 return IIO_VAL_INT;
322 case IIO_CHAN_INFO_SAMP_FREQ:
323 *val = st->channel_config[chan->address].odr;
325 return IIO_VAL_INT;
326 default:
327 return -EINVAL;
331 static int ad7124_write_raw(struct iio_dev *indio_dev,
332 struct iio_chan_spec const *chan,
333 int val, int val2, long info)
335 struct ad7124_state *st = iio_priv(indio_dev);
336 unsigned int res, gain, full_scale, vref;
338 switch (info) {
339 case IIO_CHAN_INFO_SAMP_FREQ:
340 if (val2 != 0)
341 return -EINVAL;
343 return ad7124_set_channel_odr(st, chan->address, val);
344 case IIO_CHAN_INFO_SCALE:
345 if (val != 0)
346 return -EINVAL;
348 if (st->channel_config[chan->address].bipolar)
349 full_scale = 1 << (chan->scan_type.realbits - 1);
350 else
351 full_scale = 1 << chan->scan_type.realbits;
353 vref = st->channel_config[chan->address].vref_mv * 1000000LL;
354 res = DIV_ROUND_CLOSEST(vref, full_scale);
355 gain = DIV_ROUND_CLOSEST(res, val2);
357 return ad7124_set_channel_gain(st, chan->address, gain);
358 default:
359 return -EINVAL;
363 static IIO_CONST_ATTR(in_voltage_scale_available,
364 "0.000001164 0.000002328 0.000004656 0.000009313 0.000018626 0.000037252 0.000074505 0.000149011 0.000298023");
366 static struct attribute *ad7124_attributes[] = {
367 &iio_const_attr_in_voltage_scale_available.dev_attr.attr,
368 NULL,
371 static const struct attribute_group ad7124_attrs_group = {
372 .attrs = ad7124_attributes,
375 static const struct iio_info ad7124_info = {
376 .read_raw = ad7124_read_raw,
377 .write_raw = ad7124_write_raw,
378 .validate_trigger = ad_sd_validate_trigger,
379 .attrs = &ad7124_attrs_group,
382 static int ad7124_soft_reset(struct ad7124_state *st)
384 unsigned int readval, timeout;
385 int ret;
387 ret = ad_sd_reset(&st->sd, 64);
388 if (ret < 0)
389 return ret;
391 timeout = 100;
392 do {
393 ret = ad_sd_read_reg(&st->sd, AD7124_STATUS, 1, &readval);
394 if (ret < 0)
395 return ret;
397 if (!(readval & AD7124_STATUS_POR_FLAG_MSK))
398 return 0;
400 /* The AD7124 requires typically 2ms to power up and settle */
401 usleep_range(100, 2000);
402 } while (--timeout);
404 dev_err(&st->sd.spi->dev, "Soft reset failed\n");
406 return -EIO;
409 static int ad7124_init_channel_vref(struct ad7124_state *st,
410 unsigned int channel_number)
412 unsigned int refsel = st->channel_config[channel_number].refsel;
414 switch (refsel) {
415 case AD7124_REFIN1:
416 case AD7124_REFIN2:
417 case AD7124_AVDD_REF:
418 if (IS_ERR(st->vref[refsel])) {
419 dev_err(&st->sd.spi->dev,
420 "Error, trying to use external voltage reference without a %s regulator.\n",
421 ad7124_ref_names[refsel]);
422 return PTR_ERR(st->vref[refsel]);
424 st->channel_config[channel_number].vref_mv =
425 regulator_get_voltage(st->vref[refsel]);
426 /* Conversion from uV to mV */
427 st->channel_config[channel_number].vref_mv /= 1000;
428 break;
429 case AD7124_INT_REF:
430 st->channel_config[channel_number].vref_mv = 2500;
431 st->adc_control &= ~AD7124_ADC_CTRL_REF_EN_MSK;
432 st->adc_control |= AD7124_ADC_CTRL_REF_EN(1);
433 return ad_sd_write_reg(&st->sd, AD7124_ADC_CONTROL,
434 2, st->adc_control);
435 default:
436 dev_err(&st->sd.spi->dev, "Invalid reference %d\n", refsel);
437 return -EINVAL;
440 return 0;
443 static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev,
444 struct device_node *np)
446 struct ad7124_state *st = iio_priv(indio_dev);
447 struct device_node *child;
448 struct iio_chan_spec *chan;
449 struct ad7124_channel_config *chan_config;
450 unsigned int ain[2], channel = 0, tmp;
451 int ret;
453 st->num_channels = of_get_available_child_count(np);
454 if (!st->num_channels) {
455 dev_err(indio_dev->dev.parent, "no channel children\n");
456 return -ENODEV;
459 chan = devm_kcalloc(indio_dev->dev.parent, st->num_channels,
460 sizeof(*chan), GFP_KERNEL);
461 if (!chan)
462 return -ENOMEM;
464 chan_config = devm_kcalloc(indio_dev->dev.parent, st->num_channels,
465 sizeof(*chan_config), GFP_KERNEL);
466 if (!chan_config)
467 return -ENOMEM;
469 indio_dev->channels = chan;
470 indio_dev->num_channels = st->num_channels;
471 st->channel_config = chan_config;
473 for_each_available_child_of_node(np, child) {
474 ret = of_property_read_u32(child, "reg", &channel);
475 if (ret)
476 goto err;
478 ret = of_property_read_u32_array(child, "diff-channels",
479 ain, 2);
480 if (ret)
481 goto err;
483 st->channel_config[channel].ain = AD7124_CHANNEL_AINP(ain[0]) |
484 AD7124_CHANNEL_AINM(ain[1]);
485 st->channel_config[channel].bipolar =
486 of_property_read_bool(child, "bipolar");
488 ret = of_property_read_u32(child, "adi,reference-select", &tmp);
489 if (ret)
490 st->channel_config[channel].refsel = AD7124_INT_REF;
491 else
492 st->channel_config[channel].refsel = tmp;
494 st->channel_config[channel].buf_positive =
495 of_property_read_bool(child, "adi,buffered-positive");
496 st->channel_config[channel].buf_negative =
497 of_property_read_bool(child, "adi,buffered-negative");
499 chan[channel] = ad7124_channel_template;
500 chan[channel].address = channel;
501 chan[channel].scan_index = channel;
502 chan[channel].channel = ain[0];
503 chan[channel].channel2 = ain[1];
506 return 0;
507 err:
508 of_node_put(child);
510 return ret;
513 static int ad7124_setup(struct ad7124_state *st)
515 unsigned int val, fclk, power_mode;
516 int i, ret, tmp;
518 fclk = clk_get_rate(st->mclk);
519 if (!fclk)
520 return -EINVAL;
522 /* The power mode changes the master clock frequency */
523 power_mode = ad7124_find_closest_match(ad7124_master_clk_freq_hz,
524 ARRAY_SIZE(ad7124_master_clk_freq_hz),
525 fclk);
526 if (fclk != ad7124_master_clk_freq_hz[power_mode]) {
527 ret = clk_set_rate(st->mclk, fclk);
528 if (ret)
529 return ret;
532 /* Set the power mode */
533 st->adc_control &= ~AD7124_ADC_CTRL_PWR_MSK;
534 st->adc_control |= AD7124_ADC_CTRL_PWR(power_mode);
535 ret = ad_sd_write_reg(&st->sd, AD7124_ADC_CONTROL, 2, st->adc_control);
536 if (ret < 0)
537 return ret;
539 for (i = 0; i < st->num_channels; i++) {
540 val = st->channel_config[i].ain | AD7124_CHANNEL_SETUP(i);
541 ret = ad_sd_write_reg(&st->sd, AD7124_CHANNEL(i), 2, val);
542 if (ret < 0)
543 return ret;
545 ret = ad7124_init_channel_vref(st, i);
546 if (ret < 0)
547 return ret;
549 tmp = (st->channel_config[i].buf_positive << 1) +
550 st->channel_config[i].buf_negative;
552 val = AD7124_CONFIG_BIPOLAR(st->channel_config[i].bipolar) |
553 AD7124_CONFIG_REF_SEL(st->channel_config[i].refsel) |
554 AD7124_CONFIG_IN_BUFF(tmp);
555 ret = ad_sd_write_reg(&st->sd, AD7124_CONFIG(i), 2, val);
556 if (ret < 0)
557 return ret;
559 * 9.38 SPS is the minimum output data rate supported
560 * regardless of the selected power mode. Round it up to 10 and
561 * set all the enabled channels to this default value.
563 ret = ad7124_set_channel_odr(st, i, 10);
566 return ret;
569 static int ad7124_probe(struct spi_device *spi)
571 const struct spi_device_id *id;
572 struct ad7124_state *st;
573 struct iio_dev *indio_dev;
574 int i, ret;
576 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
577 if (!indio_dev)
578 return -ENOMEM;
580 st = iio_priv(indio_dev);
582 id = spi_get_device_id(spi);
583 st->chip_info = &ad7124_chip_info_tbl[id->driver_data];
585 ad_sd_init(&st->sd, indio_dev, spi, &ad7124_sigma_delta_info);
587 spi_set_drvdata(spi, indio_dev);
589 indio_dev->dev.parent = &spi->dev;
590 indio_dev->name = spi_get_device_id(spi)->name;
591 indio_dev->modes = INDIO_DIRECT_MODE;
592 indio_dev->info = &ad7124_info;
594 ret = ad7124_of_parse_channel_config(indio_dev, spi->dev.of_node);
595 if (ret < 0)
596 return ret;
598 for (i = 0; i < ARRAY_SIZE(st->vref); i++) {
599 if (i == AD7124_INT_REF)
600 continue;
602 st->vref[i] = devm_regulator_get_optional(&spi->dev,
603 ad7124_ref_names[i]);
604 if (PTR_ERR(st->vref[i]) == -ENODEV)
605 continue;
606 else if (IS_ERR(st->vref[i]))
607 return PTR_ERR(st->vref[i]);
609 ret = regulator_enable(st->vref[i]);
610 if (ret)
611 return ret;
614 st->mclk = devm_clk_get(&spi->dev, "mclk");
615 if (IS_ERR(st->mclk)) {
616 ret = PTR_ERR(st->mclk);
617 goto error_regulator_disable;
620 ret = clk_prepare_enable(st->mclk);
621 if (ret < 0)
622 goto error_regulator_disable;
624 ret = ad7124_soft_reset(st);
625 if (ret < 0)
626 goto error_clk_disable_unprepare;
628 ret = ad7124_setup(st);
629 if (ret < 0)
630 goto error_clk_disable_unprepare;
632 ret = ad_sd_setup_buffer_and_trigger(indio_dev);
633 if (ret < 0)
634 goto error_clk_disable_unprepare;
636 ret = iio_device_register(indio_dev);
637 if (ret < 0) {
638 dev_err(&spi->dev, "Failed to register iio device\n");
639 goto error_remove_trigger;
642 return 0;
644 error_remove_trigger:
645 ad_sd_cleanup_buffer_and_trigger(indio_dev);
646 error_clk_disable_unprepare:
647 clk_disable_unprepare(st->mclk);
648 error_regulator_disable:
649 for (i = ARRAY_SIZE(st->vref) - 1; i >= 0; i--) {
650 if (!IS_ERR_OR_NULL(st->vref[i]))
651 regulator_disable(st->vref[i]);
654 return ret;
657 static int ad7124_remove(struct spi_device *spi)
659 struct iio_dev *indio_dev = spi_get_drvdata(spi);
660 struct ad7124_state *st = iio_priv(indio_dev);
661 int i;
663 iio_device_unregister(indio_dev);
664 ad_sd_cleanup_buffer_and_trigger(indio_dev);
665 clk_disable_unprepare(st->mclk);
667 for (i = ARRAY_SIZE(st->vref) - 1; i >= 0; i--) {
668 if (!IS_ERR_OR_NULL(st->vref[i]))
669 regulator_disable(st->vref[i]);
672 return 0;
675 static const struct spi_device_id ad7124_id_table[] = {
676 { "ad7124-4", ID_AD7124_4 },
677 { "ad7124-8", ID_AD7124_8 },
680 MODULE_DEVICE_TABLE(spi, ad7124_id_table);
682 static const struct of_device_id ad7124_of_match[] = {
683 { .compatible = "adi,ad7124-4" },
684 { .compatible = "adi,ad7124-8" },
685 { },
687 MODULE_DEVICE_TABLE(of, ad7124_of_match);
689 static struct spi_driver ad71124_driver = {
690 .driver = {
691 .name = "ad7124",
692 .of_match_table = ad7124_of_match,
694 .probe = ad7124_probe,
695 .remove = ad7124_remove,
696 .id_table = ad7124_id_table,
698 module_spi_driver(ad71124_driver);
700 MODULE_AUTHOR("Stefan Popa <stefan.popa@analog.com>");
701 MODULE_DESCRIPTION("Analog Devices AD7124 SPI driver");
702 MODULE_LICENSE("GPL");