From: Jonathan Cameron <jic23@kernel.org>
To: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 7/9] iio: imu: st_lsm6dsx: add st_lsm6dsx_push_tagged_data routine
Date: Sun, 11 Nov 2018 16:43:01 +0000 [thread overview]
Message-ID: <20181111164301.393fca34@archlinux> (raw)
In-Reply-To: <d65aca136a7d53305e2ca757f1df10c11082adc8.1541945612.git.lorenzo.bianconi@redhat.com>
On Sun, 11 Nov 2018 15:15:34 +0100
Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:
> Introduce st_lsm6dsx_push_tagged_data routine to push samples
> to iio buffers. st_lsm6dsx_push_tagged_data will be reused adding
> hw fifo support to st_lsm6dsx i2c embedded controller in order to
> improve code readability
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> .../iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 44 ++++++++++++-------
> 1 file changed, 29 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> index 6a379767b919..4e7ff370cbe0 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> @@ -453,6 +453,31 @@ int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw)
> return read_len;
> }
>
> +static int
> +st_lsm6dsx_push_tagged_data(struct st_lsm6dsx_hw *hw, u8 tag,
> + u8 *data, s64 ts)
> +{
> + struct st_lsm6dsx_sensor *sensor;
> + struct iio_dev *iio_dev;
> +
> + switch (tag) {
> + case ST_LSM6DSX_GYRO_TAG:
> + iio_dev = hw->iio_devs[ST_LSM6DSX_ID_GYRO];
> + break;
> + case ST_LSM6DSX_ACC_TAG:
> + iio_dev = hw->iio_devs[ST_LSM6DSX_ID_ACC];
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + sensor = iio_priv(iio_dev);
> + iio_push_to_buffers_with_timestamp(iio_dev, data,
> + ts + sensor->ts_ref);
> +
> + return 0;
> +}
> +
> /**
> * st_lsm6dsx_read_tagged_fifo() - LSM6DSO read FIFO routine
> * @hw: Pointer to instance of struct st_lsm6dsx_hw.
> @@ -508,8 +533,7 @@ int st_lsm6dsx_read_tagged_fifo(struct st_lsm6dsx_hw *hw)
> ST_LSM6DSX_SAMPLE_SIZE);
>
> tag = hw->buff[i] >> 3;
> - switch (tag) {
> - case ST_LSM6DSX_TS_TAG:
> + if (tag == ST_LSM6DSX_TS_TAG) {
> /*
> * hw timestamp is 4B long and it is stored
> * in FIFO according to this schema:
> @@ -526,19 +550,9 @@ int st_lsm6dsx_read_tagged_fifo(struct st_lsm6dsx_hw *hw)
> if (!reset_ts && ts >= 0xffff0000)
> reset_ts = true;
> ts *= ST_LSM6DSX_TS_SENSITIVITY;
> - break;
> - case ST_LSM6DSX_GYRO_TAG:
> - iio_push_to_buffers_with_timestamp(
> - hw->iio_devs[ST_LSM6DSX_ID_GYRO],
> - iio_buff, gyro_sensor->ts_ref + ts);
> - break;
> - case ST_LSM6DSX_ACC_TAG:
> - iio_push_to_buffers_with_timestamp(
> - hw->iio_devs[ST_LSM6DSX_ID_ACC],
> - iio_buff, acc_sensor->ts_ref + ts);
> - break;
> - default:
> - break;
> + } else {
> + st_lsm6dsx_push_tagged_data(hw, tag, iio_buff,
> + ts);
> }
> }
> }
next prev parent reply other threads:[~2018-11-12 2:32 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-11 14:15 [PATCH v2 0/9] add i2c controller support to st_lsm6dsx driver Lorenzo Bianconi
2018-11-11 14:15 ` [PATCH v2 1/9] iio: imu: st_lsm6dsx: introduce locked read/write utility routines Lorenzo Bianconi
2018-11-11 16:12 ` Jonathan Cameron
2018-11-11 14:15 ` [PATCH v2 2/9] iio: imu: st_lsm6dsx: reload trimming parameter at bootstrap Lorenzo Bianconi
2018-11-11 16:13 ` Jonathan Cameron
2018-11-11 14:15 ` [PATCH v2 3/9] iio: imu: st_lsm6dsx: remove static from st_lsm6dsx_set_watermark Lorenzo Bianconi
2018-11-11 16:14 ` Jonathan Cameron
2018-11-11 14:15 ` [PATCH v2 4/9] iio: imu: st_lsm6dsx: introduce ST_LSM6DSX_ID_EXT sensor ids Lorenzo Bianconi
2018-11-11 16:15 ` Jonathan Cameron
2018-11-11 14:15 ` [PATCH v2 5/9] iio: imu: st_lsm6dsx: introduce st_lsm6dsx_sensor_set_enable routine Lorenzo Bianconi
2018-11-11 16:31 ` Jonathan Cameron
2018-11-11 14:15 ` [PATCH v2 6/9] iio: imu: st_lsm6dsx: add i2c embedded controller support Lorenzo Bianconi
2018-11-11 16:40 ` Jonathan Cameron
2018-11-11 14:15 ` [PATCH v2 7/9] iio: imu: st_lsm6dsx: add st_lsm6dsx_push_tagged_data routine Lorenzo Bianconi
2018-11-11 16:43 ` Jonathan Cameron [this message]
2018-11-11 14:15 ` [PATCH v2 8/9] iio: imu: st_lsm6dsx: add hw FIFO support to i2c controller Lorenzo Bianconi
2018-11-11 16:43 ` Jonathan Cameron
2018-11-11 14:15 ` [PATCH v2 9/9] dt-bindings: iio: imu: st_lsm6dsx: add support to i2c pullup resistors Lorenzo Bianconi
2018-11-11 16:45 ` Jonathan Cameron
2018-11-17 15:37 ` Rob Herring
2018-11-17 16:26 ` Jonathan Cameron
2018-11-17 17:24 ` Lorenzo Bianconi
2018-11-21 18:57 ` Jonathan Cameron
2018-11-25 9:13 ` Lorenzo Bianconi
2018-11-11 16:46 ` [PATCH v2 0/9] add i2c controller support to st_lsm6dsx driver Jonathan Cameron
2018-11-11 17:35 ` Lorenzo Bianconi
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=20181111164301.393fca34@archlinux \
--to=jic23@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.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;
as well as URLs for NNTP newsgroup(s).