... | ... | ||
---|---|---|---|
17 | iio: adc: ad4851: add ad485x driver | 17 | iio: adc: ad4851: add ad485x driver |
18 | 18 | ||
19 | .../bindings/iio/adc/adi,ad4851.yaml | 153 ++ | 19 | .../bindings/iio/adc/adi,ad4851.yaml | 153 ++ |
20 | drivers/iio/adc/Kconfig | 14 + | 20 | drivers/iio/adc/Kconfig | 14 + |
21 | drivers/iio/adc/Makefile | 1 + | 21 | drivers/iio/adc/Makefile | 1 + |
22 | drivers/iio/adc/ad4851.c | 1297 +++++++++++++++++ | 22 | drivers/iio/adc/ad4851.c | 1302 +++++++++++++++++ |
23 | drivers/iio/adc/adi-axi-adc.c | 88 ++ | 23 | drivers/iio/adc/adi-axi-adc.c | 93 ++ |
24 | drivers/iio/industrialio-backend.c | 60 + | 24 | drivers/iio/industrialio-backend.c | 60 + |
25 | include/linux/iio/backend.h | 19 + | 25 | include/linux/iio/backend.h | 19 + |
26 | 7 files changed, 1632 insertions(+) | 26 | 7 files changed, 1642 insertions(+) |
27 | create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad4851.yaml | 27 | create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad4851.yaml |
28 | create mode 100644 drivers/iio/adc/ad4851.c | 28 | create mode 100644 drivers/iio/adc/ad4851.c |
29 | 29 | ||
30 | -- | 30 | -- |
31 | 2.48.1 | 31 | 2.48.1 | diff view generated by jsdifflib |
1 | Add backend support for obtaining the interface type used. | 1 | Add backend support for obtaining the interface type used. |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Nuno Sa <nuno.sa@analog.com> | ||
3 | Reviewed-by: David Lechner <dlechner@baylibre.com> | 4 | Reviewed-by: David Lechner <dlechner@baylibre.com> |
4 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> | 5 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> |
5 | --- | 6 | --- |
6 | no changes in v10. | 7 | no changes in v11. |
7 | drivers/iio/industrialio-backend.c | 24 ++++++++++++++++++++++++ | 8 | drivers/iio/industrialio-backend.c | 24 ++++++++++++++++++++++++ |
8 | include/linux/iio/backend.h | 11 +++++++++++ | 9 | include/linux/iio/backend.h | 11 +++++++++++ |
9 | 2 files changed, 35 insertions(+) | 10 | 2 files changed, 35 insertions(+) |
10 | 11 | ||
11 | diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c | 12 | diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c |
... | ... | diff view generated by jsdifflib |
1 | Add backend support for setting the data size used. | 1 | Add backend support for setting the data size used. |
---|---|---|---|
2 | This setting can be adjusted within the IP cores interfacing devices. | 2 | This setting can be adjusted within the IP cores interfacing devices. |
3 | 3 | ||
4 | Reviewed-by: Nuno Sa <nuno.sa@analog.com> | ||
4 | Reviewed-by: David Lechner <dlechner@baylibre.com> | 5 | Reviewed-by: David Lechner <dlechner@baylibre.com> |
5 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> | 6 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> |
6 | --- | 7 | --- |
7 | no changes in v10. | 8 | no changes in v11. |
8 | drivers/iio/industrialio-backend.c | 21 +++++++++++++++++++++ | 9 | drivers/iio/industrialio-backend.c | 21 +++++++++++++++++++++ |
9 | include/linux/iio/backend.h | 3 +++ | 10 | include/linux/iio/backend.h | 3 +++ |
10 | 2 files changed, 24 insertions(+) | 11 | 2 files changed, 24 insertions(+) |
11 | 12 | ||
12 | diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c | 13 | diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c |
... | ... | diff view generated by jsdifflib |
1 | Add backend support for setting oversampling ratio. | 1 | Add backend support for setting oversampling ratio. |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: David Lechner <dlechner@baylibre.com> | 3 | Reviewed-by: David Lechner <dlechner@baylibre.com> |
4 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> | 4 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> |
5 | --- | 5 | --- |
6 | no changes in v10. | 6 | no changes in v11. |
7 | drivers/iio/industrialio-backend.c | 15 +++++++++++++++ | 7 | drivers/iio/industrialio-backend.c | 15 +++++++++++++++ |
8 | include/linux/iio/backend.h | 5 +++++ | 8 | include/linux/iio/backend.h | 5 +++++ |
9 | 2 files changed, 20 insertions(+) | 9 | 2 files changed, 20 insertions(+) |
10 | 10 | ||
11 | diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c | 11 | diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c |
... | ... | diff view generated by jsdifflib |
1 | Add support for getting the interface (CMOS or LVDS) used by the AXI ADC | 1 | Add support for getting the interface (CMOS or LVDS) used by the AXI ADC |
---|---|---|---|
2 | IP. | 2 | IP. |
3 | 3 | ||
4 | Reviewed-by: Nuno Sa <nuno.sa@analog.com> | ||
4 | Reviewed-by: David Lechner <dlechner@baylibre.com> | 5 | Reviewed-by: David Lechner <dlechner@baylibre.com> |
5 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> | 6 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> |
6 | --- | 7 | --- |
7 | no changes in v10. | 8 | no changes in v11. |
8 | drivers/iio/adc/adi-axi-adc.c | 23 +++++++++++++++++++++++ | 9 | drivers/iio/adc/adi-axi-adc.c | 23 +++++++++++++++++++++++ |
9 | 1 file changed, 23 insertions(+) | 10 | 1 file changed, 23 insertions(+) |
10 | 11 | ||
11 | diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c | 12 | diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c |
12 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
... | ... | diff view generated by jsdifflib |
1 | Add support for selecting the data format within the AXI ADC ip. | 1 | Add support for selecting the data format within the AXI ADC ip. |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Nuno Sa <nuno.sa@analog.com> | ||
3 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> | 4 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> |
4 | --- | 5 | --- |
5 | no changes in v10. | 6 | no changes in v11. |
6 | drivers/iio/adc/adi-axi-adc.c | 46 +++++++++++++++++++++++++++++++++++ | 7 | drivers/iio/adc/adi-axi-adc.c | 46 +++++++++++++++++++++++++++++++++++ |
7 | 1 file changed, 46 insertions(+) | 8 | 1 file changed, 46 insertions(+) |
8 | 9 | ||
9 | diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c | 10 | diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c |
10 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
... | ... | diff view generated by jsdifflib |
1 | Add support for enabling/disabling oversampling. | 1 | Add support for enabling/disabling oversampling. |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> | 3 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> |
4 | --- | 4 | --- |
5 | no changes in v10. | 5 | changes in v11: |
6 | drivers/iio/adc/adi-axi-adc.c | 19 +++++++++++++++++++ | 6 | - add comment. |
7 | 1 file changed, 19 insertions(+) | 7 | drivers/iio/adc/adi-axi-adc.c | 24 ++++++++++++++++++++++++ |
8 | 1 file changed, 24 insertions(+) | ||
8 | 9 | ||
9 | diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c | 10 | diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c |
10 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/drivers/iio/adc/adi-axi-adc.c | 12 | --- a/drivers/iio/adc/adi-axi-adc.c |
12 | +++ b/drivers/iio/adc/adi-axi-adc.c | 13 | +++ b/drivers/iio/adc/adi-axi-adc.c |
... | ... | ||
25 | +static int axi_adc_oversampling_ratio_set(struct iio_backend *back, | 26 | +static int axi_adc_oversampling_ratio_set(struct iio_backend *back, |
26 | + unsigned int ratio) | 27 | + unsigned int ratio) |
27 | +{ | 28 | +{ |
28 | + struct adi_axi_adc_state *st = iio_backend_get_priv(back); | 29 | + struct adi_axi_adc_state *st = iio_backend_get_priv(back); |
29 | + | 30 | + |
31 | + /* The current state of the function enables or disables the | ||
32 | + * oversampling in REG_CNTRL_3 register. A ratio equal to 1 implies no | ||
33 | + * oversampling, while a value greater than 1 implies oversampling being | ||
34 | + * enabled. | ||
35 | + */ | ||
30 | + switch (ratio) { | 36 | + switch (ratio) { |
31 | + case 0: | 37 | + case 0: |
32 | + return -EINVAL; | 38 | + return -EINVAL; |
33 | + case 1: | 39 | + case 1: |
34 | + return regmap_clear_bits(st->regmap, ADI_AXI_ADC_REG_CNTRL_3, | 40 | + return regmap_clear_bits(st->regmap, ADI_AXI_ADC_REG_CNTRL_3, |
... | ... | diff view generated by jsdifflib |
1 | Add devicetree bindings for ad485x family. | 1 | Add devicetree bindings for ad485x family. |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Conor Dooley <conor.dooley@microchip.com> | 3 | Reviewed-by: Conor Dooley <conor.dooley@microchip.com> |
4 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> | 4 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> |
5 | --- | 5 | --- |
6 | changes in v10: | 6 | no changes in v11. |
7 | - improve channel properties description. | ||
8 | .../bindings/iio/adc/adi,ad4851.yaml | 153 ++++++++++++++++++ | 7 | .../bindings/iio/adc/adi,ad4851.yaml | 153 ++++++++++++++++++ |
9 | 1 file changed, 153 insertions(+) | 8 | 1 file changed, 153 insertions(+) |
10 | create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad4851.yaml | 9 | create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad4851.yaml |
11 | 10 | ||
12 | diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad4851.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad4851.yaml | 11 | diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad4851.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad4851.yaml |
... | ... | diff view generated by jsdifflib |
1 | Add support for the AD485X a fully buffered, 8-channel simultaneous | 1 | Add support for the AD485X a fully buffered, 8-channel simultaneous |
---|---|---|---|
2 | sampling, 16/20-bit, 1 MSPS data acquisition system (DAS) with | 2 | sampling, 16/20-bit, 1 MSPS data acquisition system (DAS) with |
3 | differential, wide common-mode range inputs. | 3 | differential, wide common-mode range inputs. |
4 | 4 | ||
5 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> | 5 | Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> |
6 | --- | 6 | --- |
7 | changes in v10: | 7 | changes in v11: |
8 | - use u64 for scale_tbl cast. | 8 | - handle return for iio_get_current_scan_type |
9 | - use IIO_VAL_FRACTIONAL_LOG2 | 9 | - rework IIO_CHAN_INFO_SAMP_FREQ with val and val2 |
10 | - add comment for not using bulk_read | 10 | - check if val and val2 are negative. |
11 | - use _u and _b suffix for scan_type structures. | 11 | - drop scan_index and channel, channel2 from macro definition since they are |
12 | - add comment for not setting scan_type in macro definitions. | 12 | handled in parse_channels function. |
13 | - fix some wrapping. | 13 | - handle ret and reg separately. |
14 | - rework vrefbuf_en and vrefio_en handling. | 14 | - revert channel2 assignment as in previous versions. |
15 | - add depends on PWM in Kconfig | 15 | - optimize channel, channel2 assignments in parse_channels function. |
16 | - add unipolar/bipolar suffix where requested. | 16 | - drop ad4851_channels and use indio_dev->channels instead. |
17 | - rename REFSEL REFBUF macros. | 17 | - drop `ad4851_chan_diff` and dynamically set differential = 1. |
18 | - use indio_dev->channels[i].channel for iio_backend_chan_enable | 18 | - drop & for .get_current_scan_type = &ad4851_get_current_scan_type |
19 | - drop initialization for 'buf' | 19 | - drop lock in ad4851_reg_access |
20 | - use st->bipolar_ch[chan->channel], not chan->differential | 20 | - use `if (st->osr == osr) return 0;` |
21 | - use u32 for softspan_val | 21 | - rework find_opt using bitmap, and drop `status` iteration. |
22 | - move info_mask_separate above as suggested. | 22 | - use __assign_bit() as suggested. |
23 | - handle sign in parse channel function and use `u` as default in macro. | ||
24 | - check `reg` range. | ||
25 | - use fwnode_property_read_bool | ||
26 | - drop redundant `reg` parsing | ||
27 | - rework channel2 statement in channel macro and parse_channels. | ||
28 | - set ad4851_channels->has_ext_scan_type = 1 | ||
29 | drivers/iio/adc/Kconfig | 14 + | 23 | drivers/iio/adc/Kconfig | 14 + |
30 | drivers/iio/adc/Makefile | 1 + | 24 | drivers/iio/adc/Makefile | 1 + |
31 | drivers/iio/adc/ad4851.c | 1293 ++++++++++++++++++++++++++++++++++++++ | 25 | drivers/iio/adc/ad4851.c | 1302 ++++++++++++++++++++++++++++++++++++++ |
32 | 3 files changed, 1308 insertions(+) | 26 | 3 files changed, 1317 insertions(+) |
33 | create mode 100644 drivers/iio/adc/ad4851.c | 27 | create mode 100644 drivers/iio/adc/ad4851.c |
34 | 28 | ||
35 | diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig | 29 | diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig |
36 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
37 | --- a/drivers/iio/adc/Kconfig | 31 | --- a/drivers/iio/adc/Kconfig |
... | ... | ||
238 | + const char *name; | 232 | + const char *name; |
239 | + unsigned int product_id; | 233 | + unsigned int product_id; |
240 | + int num_scales; | 234 | + int num_scales; |
241 | + unsigned long max_sample_rate_hz; | 235 | + unsigned long max_sample_rate_hz; |
242 | + unsigned int resolution; | 236 | + unsigned int resolution; |
237 | + unsigned int max_channels; | ||
243 | + int (*parse_channels)(struct iio_dev *indio_dev); | 238 | + int (*parse_channels)(struct iio_dev *indio_dev); |
244 | +}; | 239 | +}; |
245 | + | 240 | + |
246 | +enum { | 241 | +enum { |
247 | + AD4851_SCAN_TYPE_NORMAL, | 242 | + AD4851_SCAN_TYPE_NORMAL, |
... | ... | ||
275 | + unsigned int writeval, | 270 | + unsigned int writeval, |
276 | + unsigned int *readval) | 271 | + unsigned int *readval) |
277 | +{ | 272 | +{ |
278 | + struct ad4851_state *st = iio_priv(indio_dev); | 273 | + struct ad4851_state *st = iio_priv(indio_dev); |
279 | + | 274 | + |
280 | + guard(mutex)(&st->lock); | ||
281 | + | ||
282 | + if (readval) | 275 | + if (readval) |
283 | + return regmap_read(st->regmap, reg, readval); | 276 | + return regmap_read(st->regmap, reg, readval); |
284 | + | 277 | + |
285 | + return regmap_write(st->regmap, reg, writeval); | 278 | + return regmap_write(st->regmap, reg, writeval); |
286 | +} | 279 | +} |
... | ... | ||
321 | + return i - 1; | 314 | + return i - 1; |
322 | + | 315 | + |
323 | + return -EINVAL; | 316 | + return -EINVAL; |
324 | +} | 317 | +} |
325 | + | 318 | + |
326 | +static void __ad4851_get_scale(struct iio_dev *indio_dev, int scale_tbl, | 319 | +static int __ad4851_get_scale(struct iio_dev *indio_dev, int scale_tbl, |
327 | + unsigned int *val, unsigned int *val2) | 320 | + unsigned int *val, unsigned int *val2) |
328 | +{ | 321 | +{ |
329 | + const struct iio_scan_type *scan_type; | 322 | + const struct iio_scan_type *scan_type; |
330 | + unsigned int tmp; | 323 | + unsigned int tmp; |
331 | + | 324 | + |
332 | + scan_type = iio_get_current_scan_type(indio_dev, &indio_dev->channels[0]); | 325 | + scan_type = iio_get_current_scan_type(indio_dev, &indio_dev->channels[0]); |
326 | + if (IS_ERR(scan_type)) | ||
327 | + return PTR_ERR(scan_type); | ||
333 | + | 328 | + |
334 | + tmp = ((u64)scale_tbl * MICRO) >> scan_type->realbits; | 329 | + tmp = ((u64)scale_tbl * MICRO) >> scan_type->realbits; |
335 | + *val = tmp / MICRO; | 330 | + *val = tmp / MICRO; |
336 | + *val2 = tmp % MICRO; | 331 | + *val2 = tmp % MICRO; |
332 | + | ||
333 | + return 0; | ||
337 | +} | 334 | +} |
338 | + | 335 | + |
339 | +static int ad4851_scale_fill(struct iio_dev *indio_dev) | 336 | +static int ad4851_scale_fill(struct iio_dev *indio_dev) |
340 | +{ | 337 | +{ |
341 | + struct ad4851_state *st = iio_priv(indio_dev); | 338 | + struct ad4851_state *st = iio_priv(indio_dev); |
342 | + unsigned int i, val1, val2; | 339 | + unsigned int i, val1, val2; |
340 | + int ret; | ||
343 | + | 341 | + |
344 | + for (i = 0; i < ARRAY_SIZE(ad4851_scale_avail_unipolar); i++) { | 342 | + for (i = 0; i < ARRAY_SIZE(ad4851_scale_avail_unipolar); i++) { |
345 | + __ad4851_get_scale(indio_dev, ad4851_scale_avail_unipolar[i], &val1, &val2); | 343 | + ret = __ad4851_get_scale(indio_dev, |
344 | + ad4851_scale_avail_unipolar[i], | ||
345 | + &val1, &val2); | ||
346 | + if (ret) | ||
347 | + return ret; | ||
348 | + | ||
346 | + st->scales_unipolar[i][0] = val1; | 349 | + st->scales_unipolar[i][0] = val1; |
347 | + st->scales_unipolar[i][1] = val2; | 350 | + st->scales_unipolar[i][1] = val2; |
348 | + } | 351 | + } |
349 | + | 352 | + |
350 | + for (i = 0; i < ARRAY_SIZE(ad4851_scale_avail_bipolar); i++) { | 353 | + for (i = 0; i < ARRAY_SIZE(ad4851_scale_avail_bipolar); i++) { |
351 | + __ad4851_get_scale(indio_dev, ad4851_scale_avail_bipolar[i], &val1, &val2); | 354 | + ret = __ad4851_get_scale(indio_dev, |
355 | + ad4851_scale_avail_bipolar[i], | ||
356 | + &val1, &val2); | ||
357 | + if (ret) | ||
358 | + return ret; | ||
359 | + | ||
352 | + st->scales_bipolar[i][0] = val1; | 360 | + st->scales_bipolar[i][0] = val1; |
353 | + st->scales_bipolar[i][1] = val2; | 361 | + st->scales_bipolar[i][1] = val2; |
354 | + } | 362 | + } |
355 | + | 363 | + |
356 | + return 0; | 364 | + return 0; |
... | ... | ||
526 | + return ret; | 534 | + return ret; |
527 | + | 535 | + |
528 | + return regmap_write(st->regmap, AD4851_REG_PACKET, 0); | 536 | + return regmap_write(st->regmap, AD4851_REG_PACKET, 0); |
529 | +} | 537 | +} |
530 | + | 538 | + |
531 | +static int ad4851_find_opt(bool *field, u32 size, u32 *ret_start) | 539 | +/* |
532 | +{ | 540 | + * Find the longest consecutive sequence of false values from field |
533 | + unsigned int i, cnt = 0, max_cnt = 0, max_start = 0; | 541 | + * and return starting index. |
534 | + int start; | 542 | + */ |
535 | + | 543 | +static int ad4851_find_opt(const unsigned long *field, unsigned int start, |
536 | + for (i = 0, start = -1; i < size; i++) { | 544 | + unsigned int nbits, unsigned int *val) |
537 | + if (field[i] == 0) { | 545 | +{ |
538 | + if (start == -1) | 546 | + unsigned int bit = start, end, start_cnt, cnt = 0; |
539 | + start = i; | 547 | + |
540 | + cnt++; | 548 | + for_each_clear_bitrange_from(bit, end, field, start + nbits) { |
541 | + } else { | 549 | + if (end - bit > cnt) { |
542 | + if (cnt > max_cnt) { | 550 | + cnt = end - bit; |
543 | + max_cnt = cnt; | 551 | + start_cnt = bit - start; |
544 | + max_start = start; | ||
545 | + } | ||
546 | + start = -1; | ||
547 | + cnt = 0; | ||
548 | + } | 552 | + } |
549 | + } | 553 | + } |
550 | + /* | 554 | + |
551 | + * Find the longest consecutive sequence of false values from field | 555 | + if (!cnt) |
552 | + * and return starting index. | ||
553 | + */ | ||
554 | + if (cnt > max_cnt) { | ||
555 | + max_cnt = cnt; | ||
556 | + max_start = start; | ||
557 | + } | ||
558 | + | ||
559 | + if (!max_cnt) | ||
560 | + return -ENOENT; | 556 | + return -ENOENT; |
561 | + | 557 | + |
562 | + *ret_start = max_start; | 558 | + *val = start_cnt; |
563 | + | 559 | + |
564 | + return max_cnt; | 560 | + return cnt; |
565 | +} | 561 | +} |
566 | + | 562 | + |
567 | +static int ad4851_calibrate(struct iio_dev *indio_dev) | 563 | +static int ad4851_calibrate(struct iio_dev *indio_dev) |
568 | +{ | 564 | +{ |
569 | + struct ad4851_state *st = iio_priv(indio_dev); | 565 | + struct ad4851_state *st = iio_priv(indio_dev); |
... | ... | ||
643 | + | 639 | + |
644 | + ret = iio_backend_chan_status(st->back, i, &status); | 640 | + ret = iio_backend_chan_status(st->back, i, &status); |
645 | + if (ret) | 641 | + if (ret) |
646 | + return ret; | 642 | + return ret; |
647 | + | 643 | + |
648 | + if (status) | 644 | + __assign_bit(i * AD4851_MAX_IODELAY + delay, pn_status, |
649 | + set_bit(i * AD4851_MAX_IODELAY + delay, pn_status); | 645 | + status); |
650 | + else | ||
651 | + clear_bit(i * AD4851_MAX_IODELAY + delay, pn_status); | ||
652 | + } | 646 | + } |
653 | + } | 647 | + } |
654 | + | 648 | + |
655 | + for (i = 0; i < num_lanes; i++) { | 649 | + for (i = 0; i < num_lanes; i++) { |
656 | + status = test_bit(i * AD4851_MAX_IODELAY, pn_status); | 650 | + c = ad4851_find_opt(pn_status, i * AD4851_MAX_IODELAY, |
657 | + c = ad4851_find_opt(&status, AD4851_MAX_IODELAY, &s); | 651 | + AD4851_MAX_IODELAY, &s); |
658 | + if (c < 0) | 652 | + if (c < 0) |
659 | + return c; | 653 | + return c; |
660 | + | 654 | + |
661 | + opt_delay = s + c / 2; | 655 | + opt_delay = s + c / 2; |
662 | + ret = iio_backend_iodelay_set(st->back, i, opt_delay); | 656 | + ret = iio_backend_iodelay_set(st->back, i, opt_delay); |
... | ... | ||
798 | + struct ad4851_state *st = iio_priv(indio_dev); | 792 | + struct ad4851_state *st = iio_priv(indio_dev); |
799 | + unsigned int scale_val[2]; | 793 | + unsigned int scale_val[2]; |
800 | + unsigned int i; | 794 | + unsigned int i; |
801 | + const struct ad4851_scale *scale_table; | 795 | + const struct ad4851_scale *scale_table; |
802 | + size_t table_size; | 796 | + size_t table_size; |
797 | + int ret; | ||
803 | + | 798 | + |
804 | + if (st->bipolar_ch[chan->channel]) { | 799 | + if (st->bipolar_ch[chan->channel]) { |
805 | + scale_table = ad4851_scale_table_bipolar; | 800 | + scale_table = ad4851_scale_table_bipolar; |
806 | + table_size = ARRAY_SIZE(ad4851_scale_table_bipolar); | 801 | + table_size = ARRAY_SIZE(ad4851_scale_table_bipolar); |
807 | + } else { | 802 | + } else { |
808 | + scale_table = ad4851_scale_table_unipolar; | 803 | + scale_table = ad4851_scale_table_unipolar; |
809 | + table_size = ARRAY_SIZE(ad4851_scale_table_unipolar); | 804 | + table_size = ARRAY_SIZE(ad4851_scale_table_unipolar); |
810 | + } | 805 | + } |
811 | + | 806 | + |
812 | + for (i = 0; i < table_size; i++) { | 807 | + for (i = 0; i < table_size; i++) { |
813 | + __ad4851_get_scale(indio_dev, scale_table[i].scale_val, | 808 | + ret = __ad4851_get_scale(indio_dev, scale_table[i].scale_val, |
814 | + &scale_val[0], &scale_val[1]); | 809 | + &scale_val[0], &scale_val[1]); |
810 | + if (ret) | ||
811 | + return ret; | ||
812 | + | ||
815 | + if (scale_val[0] != val || scale_val[1] != val2) | 813 | + if (scale_val[0] != val || scale_val[1] != val2) |
816 | + continue; | 814 | + continue; |
817 | + | 815 | + |
818 | + return regmap_write(st->regmap, | 816 | + return regmap_write(st->regmap, |
819 | + AD4851_REG_CHX_SOFTSPAN(chan->channel), | 817 | + AD4851_REG_CHX_SOFTSPAN(chan->channel), |
... | ... | ||
852 | + } | 850 | + } |
853 | + | 851 | + |
854 | + if (i == table_size) | 852 | + if (i == table_size) |
855 | + return -EIO; | 853 | + return -EIO; |
856 | + | 854 | + |
857 | + __ad4851_get_scale(indio_dev, scale_table[i].scale_val, val, val2); | 855 | + ret = __ad4851_get_scale(indio_dev, scale_table[i].scale_val, val, |
856 | + val2); | ||
857 | + if (ret) | ||
858 | + return ret; | ||
858 | + | 859 | + |
859 | + return IIO_VAL_INT_PLUS_MICRO; | 860 | + return IIO_VAL_INT_PLUS_MICRO; |
860 | +} | 861 | +} |
861 | + | 862 | + |
862 | +static int ad4851_read_raw(struct iio_dev *indio_dev, | 863 | +static int ad4851_read_raw(struct iio_dev *indio_dev, |
... | ... | ||
865 | +{ | 866 | +{ |
866 | + struct ad4851_state *st = iio_priv(indio_dev); | 867 | + struct ad4851_state *st = iio_priv(indio_dev); |
867 | + | 868 | + |
868 | + switch (info) { | 869 | + switch (info) { |
869 | + case IIO_CHAN_INFO_SAMP_FREQ: | 870 | + case IIO_CHAN_INFO_SAMP_FREQ: |
870 | + *val = st->cnv_trigger_rate_hz / st->osr; | 871 | + *val = st->cnv_trigger_rate_hz; |
872 | + *val2 = st->osr; | ||
871 | + return IIO_VAL_FRACTIONAL; | 873 | + return IIO_VAL_FRACTIONAL; |
872 | + case IIO_CHAN_INFO_CALIBSCALE: | 874 | + case IIO_CHAN_INFO_CALIBSCALE: |
873 | + return ad4851_get_calibscale(st, chan->channel, val, val2); | 875 | + return ad4851_get_calibscale(st, chan->channel, val, val2); |
874 | + case IIO_CHAN_INFO_SCALE: | 876 | + case IIO_CHAN_INFO_SCALE: |
875 | + return ad4851_get_scale(indio_dev, chan, val, val2); | 877 | + return ad4851_get_scale(indio_dev, chan, val, val2); |
... | ... | ||
888 | +{ | 890 | +{ |
889 | + struct ad4851_state *st = iio_priv(indio_dev); | 891 | + struct ad4851_state *st = iio_priv(indio_dev); |
890 | + | 892 | + |
891 | + switch (info) { | 893 | + switch (info) { |
892 | + case IIO_CHAN_INFO_SAMP_FREQ: | 894 | + case IIO_CHAN_INFO_SAMP_FREQ: |
893 | + return ad4851_set_sampling_freq(st, val * st->osr); | 895 | + if (val < 0 || val2 < 0) |
896 | + return -EINVAL; | ||
897 | + return ad4851_set_sampling_freq(st, val * st->osr + val2 * st->osr / MICRO); | ||
894 | + case IIO_CHAN_INFO_SCALE: | 898 | + case IIO_CHAN_INFO_SCALE: |
895 | + return ad4851_set_scale(indio_dev, chan, val, val2); | 899 | + return ad4851_set_scale(indio_dev, chan, val, val2); |
896 | + case IIO_CHAN_INFO_CALIBSCALE: | 900 | + case IIO_CHAN_INFO_CALIBSCALE: |
897 | + return ad4851_set_calibscale(st, chan->channel, val, val2); | 901 | + return ad4851_set_calibscale(st, chan->channel, val, val2); |
898 | + case IIO_CHAN_INFO_CALIBBIAS: | 902 | + case IIO_CHAN_INFO_CALIBBIAS: |
... | ... | ||
987 | + | 991 | + |
988 | + return st->resolution_boost_enabled ? AD4851_SCAN_TYPE_RESOLUTION_BOOST | 992 | + return st->resolution_boost_enabled ? AD4851_SCAN_TYPE_RESOLUTION_BOOST |
989 | + : AD4851_SCAN_TYPE_NORMAL; | 993 | + : AD4851_SCAN_TYPE_NORMAL; |
990 | +} | 994 | +} |
991 | + | 995 | + |
992 | +#define AD4851_IIO_CHANNEL(index, ch, diff) \ | 996 | +#define AD4851_IIO_CHANNEL \ |
993 | + .type = IIO_VOLTAGE, \ | 997 | + .type = IIO_VOLTAGE, \ |
994 | + .info_mask_separate = BIT(IIO_CHAN_INFO_CALIBSCALE) | \ | 998 | + .info_mask_separate = BIT(IIO_CHAN_INFO_CALIBSCALE) | \ |
995 | + BIT(IIO_CHAN_INFO_CALIBBIAS) | \ | 999 | + BIT(IIO_CHAN_INFO_CALIBBIAS) | \ |
996 | + BIT(IIO_CHAN_INFO_SCALE), \ | 1000 | + BIT(IIO_CHAN_INFO_SCALE), \ |
997 | + .info_mask_separate_available = BIT(IIO_CHAN_INFO_SCALE), \ | 1001 | + .info_mask_separate_available = BIT(IIO_CHAN_INFO_SCALE), \ |
998 | + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ) | \ | 1002 | + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ) | \ |
999 | + BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), \ | 1003 | + BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), \ |
1000 | + .info_mask_shared_by_all_available = \ | 1004 | + .info_mask_shared_by_all_available = \ |
1001 | + BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), \ | 1005 | + BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), \ |
1002 | + .indexed = 1, \ | 1006 | + .indexed = 1, |
1003 | + .differential = diff, \ | ||
1004 | + .channel = ch, \ | ||
1005 | + .channel2 = ch, \ | ||
1006 | + .scan_index = index, | ||
1007 | + | 1007 | + |
1008 | +/* | 1008 | +/* |
1009 | + * In case of AD4858_IIO_CHANNEL the scan_type is handled dynamically during the | 1009 | + * In case of AD4858_IIO_CHANNEL the scan_type is handled dynamically during the |
1010 | + * parse_channels function. | 1010 | + * parse_channels function. |
1011 | + */ | 1011 | + */ |
1012 | +#define AD4858_IIO_CHANNEL(index, ch, diff) \ | 1012 | +#define AD4858_IIO_CHANNEL \ |
1013 | +{ \ | 1013 | +{ \ |
1014 | + AD4851_IIO_CHANNEL(index, ch, diff) \ | 1014 | + AD4851_IIO_CHANNEL \ |
1015 | +} | 1015 | +} |
1016 | + | 1016 | + |
1017 | +#define AD4857_IIO_CHANNEL(index, ch, diff) \ | 1017 | +#define AD4857_IIO_CHANNEL \ |
1018 | +{ \ | 1018 | +{ \ |
1019 | + AD4851_IIO_CHANNEL(index, ch, diff) \ | 1019 | + AD4851_IIO_CHANNEL \ |
1020 | + .scan_type = { \ | 1020 | + .scan_type = { \ |
1021 | + .sign = 'u', \ | 1021 | + .sign = 'u', \ |
1022 | + .realbits = 16, \ | 1022 | + .realbits = 16, \ |
1023 | + .storagebits = 16, \ | 1023 | + .storagebits = 16, \ |
1024 | + }, \ | 1024 | + }, \ |
1025 | +} | 1025 | +} |
1026 | + | 1026 | + |
1027 | +static int ad4851_parse_channels(struct iio_dev *indio_dev, | 1027 | +static int ad4851_parse_channels(struct iio_dev *indio_dev, |
1028 | + struct iio_chan_spec **ad4851_channels, | 1028 | + const struct iio_chan_spec ad4851_chan) |
1029 | + const struct iio_chan_spec ad4851_chan, | ||
1030 | + const struct iio_chan_spec ad4851_chan_diff) | ||
1031 | +{ | 1029 | +{ |
1032 | + struct ad4851_state *st = iio_priv(indio_dev); | 1030 | + struct ad4851_state *st = iio_priv(indio_dev); |
1033 | + struct device *dev = &st->spi->dev; | 1031 | + struct device *dev = &st->spi->dev; |
1034 | + struct iio_chan_spec *channels; | 1032 | + struct iio_chan_spec *channels; |
1035 | + unsigned int num_channels, reg; | 1033 | + unsigned int num_channels, reg; |
... | ... | ||
1048 | + indio_dev->channels = channels; | 1046 | + indio_dev->channels = channels; |
1049 | + indio_dev->num_channels = num_channels; | 1047 | + indio_dev->num_channels = num_channels; |
1050 | + | 1048 | + |
1051 | + device_for_each_child_node_scoped(dev, child) { | 1049 | + device_for_each_child_node_scoped(dev, child) { |
1052 | + ret = fwnode_property_read_u32(child, "reg", ®); | 1050 | + ret = fwnode_property_read_u32(child, "reg", ®); |
1053 | + if (ret || reg >= AD4851_MAX_CH_NR) | 1051 | + if (reg >= AD4851_MAX_CH_NR) |
1054 | + return dev_err_probe(dev, ret, | 1052 | + return dev_err_probe(dev, ret, |
1055 | + "Missing/Invalid channel number\n"); | 1053 | + "Invalid channel number\n"); |
1054 | + if (ret) | ||
1055 | + return dev_err_probe(dev, ret, | ||
1056 | + "Missing channel number\n"); | ||
1057 | + *channels = ad4851_chan; | ||
1058 | + channels->scan_index = index++; | ||
1059 | + channels->channel = reg; | ||
1060 | + | ||
1056 | + if (fwnode_property_present(child, "diff-channels")) { | 1061 | + if (fwnode_property_present(child, "diff-channels")) { |
1057 | + *channels = ad4851_chan_diff; | 1062 | + channels->channel2 = reg + st->info->max_channels; |
1058 | + channels->scan_index = index++; | 1063 | + channels->differential = 1; |
1059 | + channels->channel = reg; | ||
1060 | + channels->channel2 = reg; | ||
1061 | + | ||
1062 | + } else { | ||
1063 | + *channels = ad4851_chan; | ||
1064 | + channels->scan_index = index++; | ||
1065 | + channels->channel = reg; | ||
1066 | + } | 1064 | + } |
1065 | + | ||
1067 | + channels++; | 1066 | + channels++; |
1068 | + | 1067 | + |
1069 | + st->bipolar_ch[reg] = fwnode_property_read_bool(child, "bipolar"); | 1068 | + st->bipolar_ch[reg] = fwnode_property_read_bool(child, "bipolar"); |
1070 | + | 1069 | + |
1071 | + if (st->bipolar_ch[reg]) { | 1070 | + if (st->bipolar_ch[reg]) { |
... | ... | ||
1076 | + if (ret) | 1075 | + if (ret) |
1077 | + return ret; | 1076 | + return ret; |
1078 | + } | 1077 | + } |
1079 | + } | 1078 | + } |
1080 | + | 1079 | + |
1081 | + *ad4851_channels = channels; | ||
1082 | + | ||
1083 | + return 0; | 1080 | + return 0; |
1084 | +} | 1081 | +} |
1085 | + | 1082 | + |
1086 | +static int ad4857_parse_channels(struct iio_dev *indio_dev) | 1083 | +static int ad4857_parse_channels(struct iio_dev *indio_dev) |
1087 | +{ | 1084 | +{ |
1088 | + struct iio_chan_spec *ad4851_channels; | 1085 | + const struct iio_chan_spec ad4851_chan = AD4857_IIO_CHANNEL; |
1089 | + const struct iio_chan_spec ad4851_chan = AD4857_IIO_CHANNEL(0, 0, 0); | 1086 | + |
1090 | + const struct iio_chan_spec ad4851_chan_diff = AD4857_IIO_CHANNEL(0, 0, 1); | 1087 | + return ad4851_parse_channels(indio_dev, ad4851_chan); |
1091 | + | ||
1092 | + return ad4851_parse_channels(indio_dev, &ad4851_channels, ad4851_chan, | ||
1093 | + ad4851_chan_diff); | ||
1094 | +} | 1088 | +} |
1095 | + | 1089 | + |
1096 | +static int ad4858_parse_channels(struct iio_dev *indio_dev) | 1090 | +static int ad4858_parse_channels(struct iio_dev *indio_dev) |
1097 | +{ | 1091 | +{ |
1098 | + struct ad4851_state *st = iio_priv(indio_dev); | 1092 | + struct ad4851_state *st = iio_priv(indio_dev); |
1099 | + struct device *dev = &st->spi->dev; | 1093 | + struct device *dev = &st->spi->dev; |
1100 | + struct iio_chan_spec *ad4851_channels; | 1094 | + struct iio_chan_spec *ad4851_channels; |
1101 | + const struct iio_chan_spec ad4851_chan = AD4858_IIO_CHANNEL(0, 0, 0); | 1095 | + const struct iio_chan_spec ad4851_chan = AD4858_IIO_CHANNEL; |
1102 | + const struct iio_chan_spec ad4851_chan_diff = AD4858_IIO_CHANNEL(0, 0, 1); | ||
1103 | + int ret; | 1096 | + int ret; |
1104 | + | 1097 | + |
1105 | + ret = ad4851_parse_channels(indio_dev, &ad4851_channels, ad4851_chan, | 1098 | + ad4851_channels = (struct iio_chan_spec *)indio_dev->channels; |
1106 | + ad4851_chan_diff); | 1099 | + |
1100 | + ret = ad4851_parse_channels(indio_dev, ad4851_chan); | ||
1107 | + if (ret) | 1101 | + if (ret) |
1108 | + return ret; | 1102 | + return ret; |
1109 | + | 1103 | + |
1110 | + device_for_each_child_node_scoped(dev, child) { | 1104 | + device_for_each_child_node_scoped(dev, child) { |
1111 | + ad4851_channels->has_ext_scan_type = 1; | 1105 | + ad4851_channels->has_ext_scan_type = 1; |
... | ... | ||
1130 | +static const struct ad4851_chip_info ad4851_info = { | 1124 | +static const struct ad4851_chip_info ad4851_info = { |
1131 | + .name = "ad4851", | 1125 | + .name = "ad4851", |
1132 | + .product_id = 0x67, | 1126 | + .product_id = 0x67, |
1133 | + .max_sample_rate_hz = 250 * KILO, | 1127 | + .max_sample_rate_hz = 250 * KILO, |
1134 | + .resolution = 16, | 1128 | + .resolution = 16, |
1129 | + .max_channels = AD4851_MAX_CH_NR, | ||
1135 | + .parse_channels = ad4857_parse_channels, | 1130 | + .parse_channels = ad4857_parse_channels, |
1136 | +}; | 1131 | +}; |
1137 | + | 1132 | + |
1138 | +static const struct ad4851_chip_info ad4852_info = { | 1133 | +static const struct ad4851_chip_info ad4852_info = { |
1139 | + .name = "ad4852", | 1134 | + .name = "ad4852", |
1140 | + .product_id = 0x66, | 1135 | + .product_id = 0x66, |
1141 | + .max_sample_rate_hz = 250 * KILO, | 1136 | + .max_sample_rate_hz = 250 * KILO, |
1142 | + .resolution = 20, | 1137 | + .resolution = 20, |
1138 | + .max_channels = AD4851_MAX_CH_NR, | ||
1143 | + .parse_channels = ad4858_parse_channels, | 1139 | + .parse_channels = ad4858_parse_channels, |
1144 | +}; | 1140 | +}; |
1145 | + | 1141 | + |
1146 | +static const struct ad4851_chip_info ad4853_info = { | 1142 | +static const struct ad4851_chip_info ad4853_info = { |
1147 | + .name = "ad4853", | 1143 | + .name = "ad4853", |
1148 | + .product_id = 0x65, | 1144 | + .product_id = 0x65, |
1149 | + .max_sample_rate_hz = 1 * MEGA, | 1145 | + .max_sample_rate_hz = 1 * MEGA, |
1150 | + .resolution = 16, | 1146 | + .resolution = 16, |
1147 | + .max_channels = AD4851_MAX_CH_NR, | ||
1151 | + .parse_channels = ad4857_parse_channels, | 1148 | + .parse_channels = ad4857_parse_channels, |
1152 | +}; | 1149 | +}; |
1153 | + | 1150 | + |
1154 | +static const struct ad4851_chip_info ad4854_info = { | 1151 | +static const struct ad4851_chip_info ad4854_info = { |
1155 | + .name = "ad4854", | 1152 | + .name = "ad4854", |
1156 | + .product_id = 0x64, | 1153 | + .product_id = 0x64, |
1157 | + .max_sample_rate_hz = 1 * MEGA, | 1154 | + .max_sample_rate_hz = 1 * MEGA, |
1158 | + .resolution = 20, | 1155 | + .resolution = 20, |
1156 | + .max_channels = AD4851_MAX_CH_NR, | ||
1159 | + .parse_channels = ad4858_parse_channels, | 1157 | + .parse_channels = ad4858_parse_channels, |
1160 | +}; | 1158 | +}; |
1161 | + | 1159 | + |
1162 | +static const struct ad4851_chip_info ad4855_info = { | 1160 | +static const struct ad4851_chip_info ad4855_info = { |
1163 | + .name = "ad4855", | 1161 | + .name = "ad4855", |
1164 | + .product_id = 0x63, | 1162 | + .product_id = 0x63, |
1165 | + .max_sample_rate_hz = 250 * KILO, | 1163 | + .max_sample_rate_hz = 250 * KILO, |
1166 | + .resolution = 16, | 1164 | + .resolution = 16, |
1165 | + .max_channels = AD4851_MAX_CH_NR, | ||
1167 | + .parse_channels = ad4857_parse_channels, | 1166 | + .parse_channels = ad4857_parse_channels, |
1168 | +}; | 1167 | +}; |
1169 | + | 1168 | + |
1170 | +static const struct ad4851_chip_info ad4856_info = { | 1169 | +static const struct ad4851_chip_info ad4856_info = { |
1171 | + .name = "ad4856", | 1170 | + .name = "ad4856", |
1172 | + .product_id = 0x62, | 1171 | + .product_id = 0x62, |
1173 | + .max_sample_rate_hz = 250 * KILO, | 1172 | + .max_sample_rate_hz = 250 * KILO, |
1174 | + .resolution = 20, | 1173 | + .resolution = 20, |
1174 | + .max_channels = AD4851_MAX_CH_NR, | ||
1175 | + .parse_channels = ad4858_parse_channels, | 1175 | + .parse_channels = ad4858_parse_channels, |
1176 | +}; | 1176 | +}; |
1177 | + | 1177 | + |
1178 | +static const struct ad4851_chip_info ad4857_info = { | 1178 | +static const struct ad4851_chip_info ad4857_info = { |
1179 | + .name = "ad4857", | 1179 | + .name = "ad4857", |
1180 | + .product_id = 0x61, | 1180 | + .product_id = 0x61, |
1181 | + .max_sample_rate_hz = 1 * MEGA, | 1181 | + .max_sample_rate_hz = 1 * MEGA, |
1182 | + .resolution = 16, | 1182 | + .resolution = 16, |
1183 | + .max_channels = AD4851_MAX_CH_NR, | ||
1183 | + .parse_channels = ad4857_parse_channels, | 1184 | + .parse_channels = ad4857_parse_channels, |
1184 | +}; | 1185 | +}; |
1185 | + | 1186 | + |
1186 | +static const struct ad4851_chip_info ad4858_info = { | 1187 | +static const struct ad4851_chip_info ad4858_info = { |
1187 | + .name = "ad4858", | 1188 | + .name = "ad4858", |
1188 | + .product_id = 0x60, | 1189 | + .product_id = 0x60, |
1189 | + .max_sample_rate_hz = 1 * MEGA, | 1190 | + .max_sample_rate_hz = 1 * MEGA, |
1190 | + .resolution = 20, | 1191 | + .resolution = 20, |
1192 | + .max_channels = AD4851_MAX_CH_NR, | ||
1191 | + .parse_channels = ad4858_parse_channels, | 1193 | + .parse_channels = ad4858_parse_channels, |
1192 | +}; | 1194 | +}; |
1193 | + | 1195 | + |
1194 | +static const struct ad4851_chip_info ad4858i_info = { | 1196 | +static const struct ad4851_chip_info ad4858i_info = { |
1195 | + .name = "ad4858i", | 1197 | + .name = "ad4858i", |
1196 | + .product_id = 0x6F, | 1198 | + .product_id = 0x6F, |
1197 | + .max_sample_rate_hz = 1 * MEGA, | 1199 | + .max_sample_rate_hz = 1 * MEGA, |
1198 | + .resolution = 20, | 1200 | + .resolution = 20, |
1201 | + .max_channels = AD4851_MAX_CH_NR, | ||
1199 | + .parse_channels = ad4858_parse_channels, | 1202 | + .parse_channels = ad4858_parse_channels, |
1200 | +}; | 1203 | +}; |
1201 | + | 1204 | + |
1202 | +static const struct iio_info ad4851_iio_info = { | 1205 | +static const struct iio_info ad4851_iio_info = { |
1203 | + .debugfs_reg_access = ad4851_reg_access, | 1206 | + .debugfs_reg_access = ad4851_reg_access, |
1204 | + .read_raw = ad4851_read_raw, | 1207 | + .read_raw = ad4851_read_raw, |
1205 | + .write_raw = ad4851_write_raw, | 1208 | + .write_raw = ad4851_write_raw, |
1206 | + .update_scan_mode = ad4851_update_scan_mode, | 1209 | + .update_scan_mode = ad4851_update_scan_mode, |
1207 | + .get_current_scan_type = &ad4851_get_current_scan_type, | 1210 | + .get_current_scan_type = ad4851_get_current_scan_type, |
1208 | + .read_avail = ad4851_read_avail, | 1211 | + .read_avail = ad4851_read_avail, |
1209 | +}; | 1212 | +}; |
1210 | + | 1213 | + |
1211 | +static const struct regmap_config regmap_config = { | 1214 | +static const struct regmap_config regmap_config = { |
1212 | + .reg_bits = 16, | 1215 | + .reg_bits = 16, |
... | ... | diff view generated by jsdifflib |