From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>,
Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 5/5] iio: adis16400: Fix burst transfer for adis16448
Date: Sat, 16 May 2015 11:01:49 +0100 [thread overview]
Message-ID: <5557158D.7060406@kernel.org> (raw)
In-Reply-To: <1431703118-32676-6-git-send-email-lars@metafoo.de>
On 15/05/15 16:18, Lars-Peter Clausen wrote:
> The adis16448, unlike the other chips in this family, in addition to the
> hardware channels also sends out the DIAG_STAT register in burst mode
> before them. Handle that case by skipping over the first 2 bytes before we
> pass the received data to the buffer.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> Fixes: 76ada52f7f5d ("iio:adis16400: Add support for the adis16448")
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,
Jonathan
> ---
> drivers/iio/imu/adis16400.h | 1 +
> drivers/iio/imu/adis16400_buffer.c | 10 +++++++++-
> drivers/iio/imu/adis16400_core.c | 3 ++-
> 3 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/imu/adis16400.h b/drivers/iio/imu/adis16400.h
> index 1e8fd2e..73b189c 100644
> --- a/drivers/iio/imu/adis16400.h
> +++ b/drivers/iio/imu/adis16400.h
> @@ -139,6 +139,7 @@
> #define ADIS16400_NO_BURST BIT(1)
> #define ADIS16400_HAS_SLOW_MODE BIT(2)
> #define ADIS16400_HAS_SERIAL_NUMBER BIT(3)
> +#define ADIS16400_BURST_DIAG_STAT BIT(4)
>
> struct adis16400_state;
>
> diff --git a/drivers/iio/imu/adis16400_buffer.c b/drivers/iio/imu/adis16400_buffer.c
> index 629ae84..90c24a2 100644
> --- a/drivers/iio/imu/adis16400_buffer.c
> +++ b/drivers/iio/imu/adis16400_buffer.c
> @@ -29,6 +29,8 @@ int adis16400_update_scan_mode(struct iio_dev *indio_dev,
>
> /* All but the timestamp channel */
> burst_length = (indio_dev->num_channels - 1) * sizeof(u16);
> + if (st->variant->flags & ADIS16400_BURST_DIAG_STAT)
> + burst_length += sizeof(u16);
>
> adis->xfer = kcalloc(2, sizeof(*adis->xfer), GFP_KERNEL);
> if (!adis->xfer)
> @@ -63,6 +65,7 @@ irqreturn_t adis16400_trigger_handler(int irq, void *p)
> struct adis16400_state *st = iio_priv(indio_dev);
> struct adis *adis = &st->adis;
> u32 old_speed_hz = st->adis.spi->max_speed_hz;
> + void *buffer;
> int ret;
>
> if (!adis->buffer)
> @@ -83,7 +86,12 @@ irqreturn_t adis16400_trigger_handler(int irq, void *p)
> spi_setup(st->adis.spi);
> }
>
> - iio_push_to_buffers_with_timestamp(indio_dev, adis->buffer,
> + if (st->variant->flags & ADIS16400_BURST_DIAG_STAT)
> + buffer = adis->buffer + sizeof(u16);
> + else
> + buffer = adis->buffer;
> +
> + iio_push_to_buffers_with_timestamp(indio_dev, buffer,
> pf->timestamp);
>
> iio_trigger_notify_done(indio_dev->trig);
> diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c
> index 7b06e058..2fd68f22 100644
> --- a/drivers/iio/imu/adis16400_core.c
> +++ b/drivers/iio/imu/adis16400_core.c
> @@ -778,7 +778,8 @@ static struct adis16400_chip_info adis16400_chips[] = {
> .channels = adis16448_channels,
> .num_channels = ARRAY_SIZE(adis16448_channels),
> .flags = ADIS16400_HAS_PROD_ID |
> - ADIS16400_HAS_SERIAL_NUMBER,
> + ADIS16400_HAS_SERIAL_NUMBER |
> + ADIS16400_BURST_DIAG_STAT,
> .gyro_scale_micro = IIO_DEGREE_TO_RAD(10000), /* 0.01 deg/s */
> .accel_scale_micro = IIO_G_TO_M_S_2(833), /* 1/1200 g */
> .temp_scale_nano = 73860000, /* 0.07386 C */
>
prev parent reply other threads:[~2015-05-16 10:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-15 15:18 [PATCH 0/5] iio: adis16400 fixes Lars-Peter Clausen
2015-05-15 15:18 ` [PATCH 1/5] iio: adis16400: Report pressure channel scale Lars-Peter Clausen
2015-05-16 9:56 ` Jonathan Cameron
2015-05-15 15:18 ` [PATCH 2/5] iio: adis16400: Use != channel indices for the two voltage channels Lars-Peter Clausen
2015-05-16 9:57 ` Jonathan Cameron
2015-05-15 15:18 ` [PATCH 3/5] iio: adis16400: Compute the scan mask from channel indices Lars-Peter Clausen
2015-05-16 9:59 ` Jonathan Cameron
2015-05-15 15:18 ` [PATCH 4/5] iio: adis16400: Fix burst mode Lars-Peter Clausen
2015-05-16 10:00 ` Jonathan Cameron
2015-05-15 15:18 ` [PATCH 5/5] iio: adis16400: Fix burst transfer for adis16448 Lars-Peter Clausen
2015-05-16 10:01 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5557158D.7060406@kernel.org \
--to=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.