Re: [PATCH] iio: adis16400: Set timestamp as the last element inchan_spec

From: Lars-Peter Clausen
Date: Fri Jan 24 2014 - 08:46:20 EST


On 01/24/2014 12:24 PM, Marcus Folkesson wrote:
> This is necessary since timestamp is calculated as the last element
> in iio_compute_scan_bytes().
>
> Signed-off-by: Marcus Folkesson <marcus.folkesson@xxxxxxxxx>

Looks good, thanks.

Acked-by: Lars-Peter Clausen

That said, I think we should try to modify the core code so that the scan
index for the timestamp is auto assigned to be always the last one.

> ---
> drivers/iio/imu/adis16400.h | 1 +
> drivers/iio/imu/adis16400_core.c | 10 +++++-----
> 2 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/imu/adis16400.h b/drivers/iio/imu/adis16400.h
> index 2f8f9d6..0916bf6 100644
> --- a/drivers/iio/imu/adis16400.h
> +++ b/drivers/iio/imu/adis16400.h
> @@ -189,6 +189,7 @@ enum {
> ADIS16300_SCAN_INCLI_X,
> ADIS16300_SCAN_INCLI_Y,
> ADIS16400_SCAN_ADC,
> + ADIS16400_SCAN_TIMESTAMP,
> };
>
> #ifdef CONFIG_IIO_BUFFER
> diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c
> index 3fb7757..7f98657 100644
> --- a/drivers/iio/imu/adis16400_core.c
> +++ b/drivers/iio/imu/adis16400_core.c
> @@ -632,7 +632,7 @@ static const struct iio_chan_spec adis16400_channels[] = {
> ADIS16400_MAGN_CHAN(Z, ADIS16400_ZMAGN_OUT, 14),
> ADIS16400_TEMP_CHAN(ADIS16400_TEMP_OUT, 12),
> ADIS16400_AUX_ADC_CHAN(ADIS16400_AUX_ADC, 12),
> - IIO_CHAN_SOFT_TIMESTAMP(12)
> + IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
> };
>
> static const struct iio_chan_spec adis16448_channels[] = {
> @@ -654,7 +654,7 @@ static const struct iio_chan_spec adis16448_channels[] = {
> .scan_type = IIO_ST('s', 16, 16, 0),
> },
> ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12),
> - IIO_CHAN_SOFT_TIMESTAMP(11)
> + IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
> };
>
> static const struct iio_chan_spec adis16350_channels[] = {
> @@ -672,7 +672,7 @@ static const struct iio_chan_spec adis16350_channels[] = {
> ADIS16400_MOD_TEMP_CHAN(X, ADIS16350_XTEMP_OUT, 12),
> ADIS16400_MOD_TEMP_CHAN(Y, ADIS16350_YTEMP_OUT, 12),
> ADIS16400_MOD_TEMP_CHAN(Z, ADIS16350_ZTEMP_OUT, 12),
> - IIO_CHAN_SOFT_TIMESTAMP(11)
> + IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
> };
>
> static const struct iio_chan_spec adis16300_channels[] = {
> @@ -685,7 +685,7 @@ static const struct iio_chan_spec adis16300_channels[] = {
> ADIS16400_AUX_ADC_CHAN(ADIS16300_AUX_ADC, 12),
> ADIS16400_INCLI_CHAN(X, ADIS16300_PITCH_OUT, 13),
> ADIS16400_INCLI_CHAN(Y, ADIS16300_ROLL_OUT, 13),
> - IIO_CHAN_SOFT_TIMESTAMP(14)
> + IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
> };
>
> static const struct iio_chan_spec adis16334_channels[] = {
> @@ -696,7 +696,7 @@ static const struct iio_chan_spec adis16334_channels[] = {
> ADIS16400_ACCEL_CHAN(Y, ADIS16400_YACCL_OUT, 14),
> ADIS16400_ACCEL_CHAN(Z, ADIS16400_ZACCL_OUT, 14),
> ADIS16400_TEMP_CHAN(ADIS16350_XTEMP_OUT, 12),
> - IIO_CHAN_SOFT_TIMESTAMP(8)
> + IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
> };
>
> static struct attribute *adis16400_attributes[] = {
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/