static AD799X_SCAN_EL(6);
static AD799X_SCAN_EL(7);
-static ssize_t ad799x_show_precision(struct device *dev,
+static ssize_t ad799x_show_type(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad799x_state *st = iio_dev_get_devdata(dev_info);
- return sprintf(buf, "%d\n", st->chip_info->bits);
-}
+ struct iio_ring_buffer *ring = dev_get_drvdata(dev);
+ struct iio_dev *indio_dev = ring->indio_dev;
+ struct ad799x_state *st = indio_dev->dev_data;
-static IIO_DEVICE_ATTR(in_precision, S_IRUGO, ad799x_show_precision,
- NULL, 0);
+ return sprintf(buf, "%c%d/%d\n", st->chip_info->sign,
+ st->chip_info->bits, AD799X_STORAGEBITS);
+}
+static IIO_DEVICE_ATTR(in_type, S_IRUGO, ad799x_show_type, NULL, 0);
static int ad7991_5_9_set_scan_mode(struct ad799x_state *st, unsigned mask)
{
if (ret < 0)
goto error_ret;
- data = rxbuf[0] & 0xFFF;
+ data = rxbuf[0];
}
/* Pretty print the result */
- len = sprintf(buf, "%u\n", data);
+ len = sprintf(buf, "%u\n", data & ((1 << (st->chip_info->bits)) - 1));
error_ret:
mutex_unlock(&dev_info->mlock);
&iio_const_attr_in2_index.dev_attr.attr,
&iio_scan_el_in3.dev_attr.attr,
&iio_const_attr_in3_index.dev_attr.attr,
- &iio_dev_attr_in_precision.dev_attr.attr,
+ &iio_dev_attr_in_type.dev_attr.attr,
NULL,
};
&iio_const_attr_in0_index.dev_attr.attr,
&iio_scan_el_in1.dev_attr.attr,
&iio_const_attr_in1_index.dev_attr.attr,
- &iio_dev_attr_in_precision.dev_attr.attr,
+ &iio_dev_attr_in_type.dev_attr.attr,
NULL,
};
&iio_const_attr_in6_index.dev_attr.attr,
&iio_scan_el_in7.dev_attr.attr,
&iio_const_attr_in7_index.dev_attr.attr,
- &iio_dev_attr_in_precision.dev_attr.attr,
+ &iio_dev_attr_in_type.dev_attr.attr,
NULL,
};
[ad7991] = {
.num_inputs = 4,
.bits = 12,
+ .sign = IIO_SCAN_EL_TYPE_UNSIGNED,
.int_vref_mv = 4096,
.dev_attrs = &ad7991_5_9_3_4_dev_attr_group,
.scan_attrs = &ad7991_5_9_3_4_scan_el_group,
[ad7995] = {
.num_inputs = 4,
.bits = 10,
+ .sign = IIO_SCAN_EL_TYPE_UNSIGNED,
.int_vref_mv = 1024,
.dev_attrs = &ad7991_5_9_3_4_dev_attr_group,
.scan_attrs = &ad7991_5_9_3_4_scan_el_group,
[ad7999] = {
.num_inputs = 4,
.bits = 10,
+ .sign = IIO_SCAN_EL_TYPE_UNSIGNED,
.int_vref_mv = 1024,
.dev_attrs = &ad7991_5_9_3_4_dev_attr_group,
.scan_attrs = &ad7991_5_9_3_4_scan_el_group,
[ad7992] = {
.num_inputs = 2,
.bits = 12,
+ .sign = IIO_SCAN_EL_TYPE_UNSIGNED,
.int_vref_mv = 4096,
.monitor_mode = true,
.default_config = AD7998_ALERT_EN,
[ad7993] = {
.num_inputs = 4,
.bits = 10,
+ .sign = IIO_SCAN_EL_TYPE_UNSIGNED,
.int_vref_mv = 1024,
.monitor_mode = true,
.default_config = AD7998_ALERT_EN,
[ad7994] = {
.num_inputs = 4,
.bits = 12,
+ .sign = IIO_SCAN_EL_TYPE_UNSIGNED,
.int_vref_mv = 4096,
.monitor_mode = true,
.default_config = AD7998_ALERT_EN,
[ad7997] = {
.num_inputs = 8,
.bits = 10,
+ .sign = IIO_SCAN_EL_TYPE_UNSIGNED,
.int_vref_mv = 1024,
.monitor_mode = true,
.default_config = AD7998_ALERT_EN,
[ad7998] = {
.num_inputs = 8,
.bits = 12,
+ .sign = IIO_SCAN_EL_TYPE_UNSIGNED,
.int_vref_mv = 4096,
.monitor_mode = true,
.default_config = AD7998_ALERT_EN,