From: Jonathan Cameron <jic23@kernel.org>
To: Viorel Suman <viorel.suman@gmail.com>, linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Ge Gao <ggao@invensense.com>
Subject: Re: [PATCH v2] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo
Date: Sat, 21 Feb 2015 19:00:39 +0000 [thread overview]
Message-ID: <54E8D5D7.7050205@kernel.org> (raw)
In-Reply-To: <1424282721-3033-1-git-send-email-viorel.suman@gmail.com>
On 18/02/15 18:05, Viorel Suman wrote:
> A hardware fifo reset always imply an invalidation of the
> existing timestamps, so we'll clear timestamps fifo on
> successfull hardware fifo reset.
>
> Signed-off-by: Viorel Suman <viorel.suman@gmail.com>
Looks sensible to me. Ge / Srinivas?
> ---
> v2: Addressed Jonathan's comment regarding the subject prefix.
>
> drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 25 ++++++++++++++-----------
> 1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> index 0cd306a..ba27e27 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> @@ -24,6 +24,16 @@
> #include <linux/poll.h>
> #include "inv_mpu_iio.h"
>
> +static void inv_clear_kfifo(struct inv_mpu6050_state *st)
> +{
> + unsigned long flags;
> +
> + /* take the spin lock sem to avoid interrupt kick in */
> + spin_lock_irqsave(&st->time_stamp_lock, flags);
> + kfifo_reset(&st->timestamps);
> + spin_unlock_irqrestore(&st->time_stamp_lock, flags);
> +}
> +
> int inv_reset_fifo(struct iio_dev *indio_dev)
> {
> int result;
> @@ -50,6 +60,10 @@ int inv_reset_fifo(struct iio_dev *indio_dev)
> INV_MPU6050_BIT_FIFO_RST);
> if (result)
> goto reset_fifo_fail;
> +
> + /* clear timestamps fifo */
> + inv_clear_kfifo(st);
> +
> /* enable interrupt */
> if (st->chip_config.accl_fifo_enable ||
> st->chip_config.gyro_fifo_enable) {
> @@ -83,16 +97,6 @@ reset_fifo_fail:
> return result;
> }
>
> -static void inv_clear_kfifo(struct inv_mpu6050_state *st)
> -{
> - unsigned long flags;
> -
> - /* take the spin lock sem to avoid interrupt kick in */
> - spin_lock_irqsave(&st->time_stamp_lock, flags);
> - kfifo_reset(&st->timestamps);
> - spin_unlock_irqrestore(&st->time_stamp_lock, flags);
> -}
> -
> /**
> * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt.
> */
> @@ -184,7 +188,6 @@ end_session:
> flush_fifo:
> /* Flush HW and SW FIFOs. */
> inv_reset_fifo(indio_dev);
> - inv_clear_kfifo(st);
> mutex_unlock(&indio_dev->mlock);
> iio_trigger_notify_done(indio_dev->trig);
>
>
next prev parent reply other threads:[~2015-02-21 19:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-18 18:05 [PATCH v2] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo Viorel Suman
2015-02-21 19:00 ` Jonathan Cameron [this message]
2015-02-26 18:35 ` Ge Gao
2015-03-08 11:31 ` Jonathan Cameron
2015-03-08 11:33 ` Jonathan Cameron
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=54E8D5D7.7050205@kernel.org \
--to=jic23@kernel.org \
--cc=ggao@invensense.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=viorel.suman@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox