Commit 9cc55989 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio:adc:max1363 fix timestamp handling.

Not only was this not compliant with the abi, it was also missconfiguring
the buffer.
Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6f7c8ee5
...@@ -72,6 +72,9 @@ static MAX1363_SCAN_EL_D(7, 6, 21); ...@@ -72,6 +72,9 @@ static MAX1363_SCAN_EL_D(7, 6, 21);
static MAX1363_SCAN_EL_D(9, 8, 22); static MAX1363_SCAN_EL_D(9, 8, 22);
static MAX1363_SCAN_EL_D(11, 10, 23); static MAX1363_SCAN_EL_D(11, 10, 23);
static IIO_SCAN_EL_TIMESTAMP(24);
static IIO_CONST_ATTR_SCAN_EL_TYPE(timestamp, s, 64, 64);
static const struct max1363_mode max1363_mode_table[] = { static const struct max1363_mode max1363_mode_table[] = {
/* All of the single channel options first */ /* All of the single channel options first */
MAX1363_MODE_SINGLE(0, 1 << 0), MAX1363_MODE_SINGLE(0, 1 << 0),
...@@ -402,6 +405,9 @@ static struct attribute *max1363_scan_el_attrs[] = { ...@@ -402,6 +405,9 @@ static struct attribute *max1363_scan_el_attrs[] = {
&iio_const_attr_in1min0_index.dev_attr.attr, &iio_const_attr_in1min0_index.dev_attr.attr,
&iio_scan_el_in3min2.dev_attr.attr, &dev_attr_in3min2_type.attr, &iio_scan_el_in3min2.dev_attr.attr, &dev_attr_in3min2_type.attr,
&iio_const_attr_in3min2_index.dev_attr.attr, &iio_const_attr_in3min2_index.dev_attr.attr,
&iio_const_attr_timestamp_index.dev_attr.attr,
&iio_scan_el_timestamp.dev_attr.attr,
&iio_const_attr_timestamp_type.dev_attr.attr,
NULL, NULL,
}; };
...@@ -515,6 +521,9 @@ static struct attribute *max1238_scan_el_attrs[] = { ...@@ -515,6 +521,9 @@ static struct attribute *max1238_scan_el_attrs[] = {
&iio_const_attr_in9min8_index.dev_attr.attr, &iio_const_attr_in9min8_index.dev_attr.attr,
&iio_scan_el_in11min10.dev_attr.attr, &dev_attr_in11min10_type.attr, &iio_scan_el_in11min10.dev_attr.attr, &dev_attr_in11min10_type.attr,
&iio_const_attr_in11min10_index.dev_attr.attr, &iio_const_attr_in11min10_index.dev_attr.attr,
&iio_const_attr_timestamp_index.dev_attr.attr,
&iio_scan_el_timestamp.dev_attr.attr,
&iio_const_attr_timestamp_type.dev_attr.attr,
NULL, NULL,
}; };
...@@ -601,6 +610,9 @@ static struct attribute *max11608_scan_el_attrs[] = { ...@@ -601,6 +610,9 @@ static struct attribute *max11608_scan_el_attrs[] = {
&iio_const_attr_in5min4_index.dev_attr.attr, &iio_const_attr_in5min4_index.dev_attr.attr,
&iio_scan_el_in7min6.dev_attr.attr, &dev_attr_in7min6_type.attr, &iio_scan_el_in7min6.dev_attr.attr, &dev_attr_in7min6_type.attr,
&iio_const_attr_in7min6_index.dev_attr.attr, &iio_const_attr_in7min6_index.dev_attr.attr,
&iio_const_attr_timestamp_index.dev_attr.attr,
&iio_scan_el_timestamp.dev_attr.attr,
&iio_const_attr_timestamp_type.dev_attr.attr,
NULL NULL
}; };
......
...@@ -76,7 +76,7 @@ static int max1363_ring_preenable(struct iio_dev *indio_dev) ...@@ -76,7 +76,7 @@ static int max1363_ring_preenable(struct iio_dev *indio_dev)
{ {
struct max1363_state *st = indio_dev->dev_data; struct max1363_state *st = indio_dev->dev_data;
struct iio_ring_buffer *ring = indio_dev->ring; struct iio_ring_buffer *ring = indio_dev->ring;
size_t d_size; size_t d_size = 0;
unsigned long numvals; unsigned long numvals;
/* /*
...@@ -92,11 +92,13 @@ static int max1363_ring_preenable(struct iio_dev *indio_dev) ...@@ -92,11 +92,13 @@ static int max1363_ring_preenable(struct iio_dev *indio_dev)
numvals = hweight_long(st->current_mode->modemask); numvals = hweight_long(st->current_mode->modemask);
if (ring->access.set_bytes_per_datum) { if (ring->access.set_bytes_per_datum) {
if (ring->scan_timestamp)
d_size += sizeof(s64);
if (st->chip_info->bits != 8) if (st->chip_info->bits != 8)
d_size = numvals*2 + sizeof(s64); d_size += numvals*2;
else else
d_size = numvals + sizeof(s64); d_size += numvals;
if (d_size % 8) if (ring->scan_timestamp && (d_size % 8))
d_size += 8 - (d_size % 8); d_size += 8 - (d_size % 8);
ring->access.set_bytes_per_datum(ring, d_size); ring->access.set_bytes_per_datum(ring, d_size);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment