mutex_lock(&dev_info->mlock);
if (iio_buffer_enabled(dev_info))
ret = ad799x_single_channel_from_ring(st,
- chan->address);
+ chan->scan_index);
else
ret = ad799x_scan_direct(st, chan->address);
mutex_unlock(&dev_info->mlock);
static const struct ad799x_chip_info ad799x_chip_info_tbl[] = {
[ad7991] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 0, 0, IIO_ST('u', 12, 16, 0), 0),
- .channel[1] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 1, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 1, 1, IIO_ST('u', 12, 16, 0), 0),
- .channel[2] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 2, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 2, 2, IIO_ST('u', 12, 16, 0), 0),
- .channel[3] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 3, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 3, 3, IIO_ST('u', 12, 16, 0), 0),
- .channel[4] = IIO_CHAN_SOFT_TIMESTAMP(4),
+ .channel = {
+ [0] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 0,
+ .address = 0,
+ .scan_index = 0,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [1] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 1,
+ .address = 1,
+ .scan_index = 1,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [2] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 2,
+ .address = 2,
+ .scan_index = 2,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [3] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 3,
+ .address = 3,
+ .scan_index = 3,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [4] = IIO_CHAN_SOFT_TIMESTAMP(4),
+ },
.num_channels = 5,
.int_vref_mv = 4096,
.info = &ad7991_info,
},
[ad7995] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 0, 0, IIO_ST('u', 10, 16, 2), 0),
- .channel[1] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 1, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 1, 1, IIO_ST('u', 10, 16, 2), 0),
- .channel[2] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 2, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 2, 2, IIO_ST('u', 10, 16, 2), 0),
- .channel[3] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 3, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 3, 3, IIO_ST('u', 10, 16, 2), 0),
- .channel[4] = IIO_CHAN_SOFT_TIMESTAMP(4),
+ .channel = {
+ [0] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 0,
+ .address = 0,
+ .scan_index = 0,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [1] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 1,
+ .address = 1,
+ .scan_index = 1,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [2] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 2,
+ .address = 2,
+ .scan_index = 2,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [3] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 3,
+ .address = 3,
+ .scan_index = 3,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [4] = IIO_CHAN_SOFT_TIMESTAMP(4),
+ },
.num_channels = 5,
.int_vref_mv = 1024,
.info = &ad7991_info,
},
[ad7999] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 0, 0, IIO_ST('u', 8, 16, 4), 0),
- .channel[1] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 1, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 1, 1, IIO_ST('u', 8, 16, 4), 0),
- .channel[2] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 2, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 2, 2, IIO_ST('u', 8, 16, 4), 0),
- .channel[3] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 3, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 3, 3, IIO_ST('u', 8, 16, 4), 0),
- .channel[4] = IIO_CHAN_SOFT_TIMESTAMP(4),
+ .channel = {
+ [0] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 0,
+ .address = 0,
+ .scan_index = 0,
+ .scan_type = IIO_ST('u', 8, 16, 4),
+ },
+ [1] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 1,
+ .address = 1,
+ .scan_index = 1,
+ .scan_type = IIO_ST('u', 8, 16, 4),
+ },
+ [2] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 2,
+ .address = 2,
+ .scan_index = 2,
+ .scan_type = IIO_ST('u', 8, 16, 4),
+ },
+ [3] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 3,
+ .address = 3,
+ .scan_index = 3,
+ .scan_type = IIO_ST('u', 8, 16, 4),
+ },
+ [4] = IIO_CHAN_SOFT_TIMESTAMP(4),
+ },
.num_channels = 5,
.int_vref_mv = 1024,
.info = &ad7991_info,
},
[ad7992] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 0, 0, IIO_ST('u', 12, 16, 0), 0),
- .channel[1] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 1, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 1, 1, IIO_ST('u', 12, 16, 0), 0),
- .channel[2] = IIO_CHAN_SOFT_TIMESTAMP(2),
+ .channel = {
+ [0] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 0,
+ .address = 0,
+ .scan_index = 0,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [1] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 1,
+ .address = 1,
+ .scan_index = 1,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [2] = IIO_CHAN_SOFT_TIMESTAMP(2),
+ },
.num_channels = 3,
.int_vref_mv = 4096,
.default_config = AD7998_ALERT_EN,
.info = &ad7992_info,
},
[ad7993] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 0, 0, IIO_ST('u', 10, 16, 2), 0),
- .channel[1] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 1, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 1, 1, IIO_ST('u', 10, 16, 2), 0),
- .channel[2] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 2, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 2, 2, IIO_ST('u', 10, 16, 2), 0),
- .channel[3] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 3, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 3, 3, IIO_ST('u', 10, 16, 2), 0),
- .channel[4] = IIO_CHAN_SOFT_TIMESTAMP(4),
+ .channel = {
+ [0] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 0,
+ .address = 0,
+ .scan_index = 0,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [1] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 1,
+ .address = 1,
+ .scan_index = 1,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [2] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 2,
+ .address = 2,
+ .scan_index = 2,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [3] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 3,
+ .address = 3,
+ .scan_index = 3,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [4] = IIO_CHAN_SOFT_TIMESTAMP(4),
+ },
.num_channels = 5,
.int_vref_mv = 1024,
.default_config = AD7998_ALERT_EN,
.info = &ad7993_4_7_8_info,
},
[ad7994] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 0, 0, IIO_ST('u', 12, 16, 0), 0),
- .channel[1] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 1, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 1, 1, IIO_ST('u', 12, 16, 0), 0),
- .channel[2] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 2, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 2, 2, IIO_ST('u', 12, 16, 0), 0),
- .channel[3] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 3, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 3, 3, IIO_ST('u', 12, 16, 0), 0),
- .channel[4] = IIO_CHAN_SOFT_TIMESTAMP(4),
+ .channel = {
+ [0] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 0,
+ .address = 0,
+ .scan_index = 0,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [1] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 1,
+ .address = 1,
+ .scan_index = 1,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [2] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 2,
+ .address = 2,
+ .scan_index = 2,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [3] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 3,
+ .address = 3,
+ .scan_index = 3,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [4] = IIO_CHAN_SOFT_TIMESTAMP(4),
+ },
.num_channels = 5,
.int_vref_mv = 4096,
.default_config = AD7998_ALERT_EN,
.info = &ad7993_4_7_8_info,
},
[ad7997] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 0, 0, IIO_ST('u', 10, 16, 2), 0),
- .channel[1] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 1, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 1, 1, IIO_ST('u', 10, 16, 2), 0),
- .channel[2] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 2, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 2, 2, IIO_ST('u', 10, 16, 2), 0),
- .channel[3] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 3, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 3, 3, IIO_ST('u', 10, 16, 2), 0),
- .channel[4] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 4, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 4, 4, IIO_ST('u', 10, 16, 2), 0),
- .channel[5] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 5, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 5, 5, IIO_ST('u', 10, 16, 2), 0),
- .channel[6] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 6, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 6, 6, IIO_ST('u', 10, 16, 2), 0),
- .channel[7] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 7, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 7, 7, IIO_ST('u', 10, 16, 2), 0),
- .channel[8] = IIO_CHAN_SOFT_TIMESTAMP(8),
+ .channel = {
+ [0] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 0,
+ .address = 0,
+ .scan_index = 0,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [1] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 1,
+ .address = 1,
+ .scan_index = 1,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [2] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 2,
+ .address = 2,
+ .scan_index = 2,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [3] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 3,
+ .address = 3,
+ .scan_index = 3,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [4] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 4,
+ .address = 4,
+ .scan_index = 4,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [5] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 5,
+ .address = 5,
+ .scan_index = 5,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [6] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 6,
+ .address = 6,
+ .scan_index = 6,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [7] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 7,
+ .address = 7,
+ .scan_index = 7,
+ .scan_type = IIO_ST('u', 10, 16, 2),
+ },
+ [8] = IIO_CHAN_SOFT_TIMESTAMP(8),
+ },
.num_channels = 9,
.int_vref_mv = 1024,
.default_config = AD7998_ALERT_EN,
.info = &ad7993_4_7_8_info,
},
[ad7998] = {
- .channel[0] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 0, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 0, 0, IIO_ST('u', 12, 16, 0), 0),
- .channel[1] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 1, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 1, 1, IIO_ST('u', 12, 16, 0), 0),
- .channel[2] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 2, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 2, 2, IIO_ST('u', 12, 16, 0), 0),
- .channel[3] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 3, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 3, 3, IIO_ST('u', 12, 16, 0), 0),
- .channel[4] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 4, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 4, 4, IIO_ST('u', 12, 16, 0), 0),
- .channel[5] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 5, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 5, 5, IIO_ST('u', 12, 16, 0), 0),
- .channel[6] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 6, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 6, 6, IIO_ST('u', 12, 16, 0), 0),
- .channel[7] = IIO_CHAN(IIO_VOLTAGE, 0, 1, 0, NULL, 7, 0,
- (1 << IIO_CHAN_INFO_SCALE_SHARED),
- 7, 7, IIO_ST('u', 12, 16, 0), 0),
- .channel[8] = IIO_CHAN_SOFT_TIMESTAMP(8),
+ .channel = {
+ [0] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 0,
+ .address = 0,
+ .scan_index = 0,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [1] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 1,
+ .address = 1,
+ .scan_index = 1,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [2] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 2,
+ .address = 2,
+ .scan_index = 2,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [3] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 3,
+ .address = 3,
+ .scan_index = 3,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [4] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 4,
+ .address = 4,
+ .scan_index = 4,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [5] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 5,
+ .address = 5,
+ .scan_index = 5,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [6] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 6,
+ .address = 6,
+ .scan_index = 6,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [7] = {
+ .type = IIO_VOLTAGE,
+ .indexed = 1,
+ .channel = 7,
+ .address = 7,
+ .scan_index = 7,
+ .scan_type = IIO_ST('u', 12, 16, 0),
+ },
+ [8] = IIO_CHAN_SOFT_TIMESTAMP(8),
+ },
.num_channels = 9,
.int_vref_mv = 4096,
.default_config = AD7998_ALERT_EN,