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 6/9] iio: imu: st_lsm6dsx: add i2c embedded controller support
Date: Sun, 11 Nov 2018 16:40:12 +0000 [thread overview]
Message-ID: <20181111164012.47b963b4@archlinux> (raw)
In-Reply-To: <c9a134df6858ee2f290c844be18f8c2cef54c559.1541945612.git.lorenzo.bianconi@redhat.com>
On Sun, 11 Nov 2018 15:15:33 +0100
Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:
> i2c controller embedded in lsm6dx series can connect up to four
> slave devices using accelerometer sensor as trigger for i2c
> read/write operations.
> Introduce sensor hub support for lsm6dso sensor. Add register map
> for lis2mdl magnetometer sensor.
> In order to perform single read/write operations st_lsm6dsx driver
> relies on SLV0 channel (hw FIFO is not supported yet)
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Hi Lorenzo.
A build warning came up pointing out an issue with little endian
sizes.
I've 'guessed' that data is actually meant to be __le16 but
please confirm I got that right!
> +static int
> +st_lsm6dsx_shub_read_oneshot(struct st_lsm6dsx_sensor *sensor,
> + struct iio_chan_spec const *ch,
> + int *val)
> +{
> + int err, delay, len = ch->scan_type.realbits >> 3;
> + __le32 data;
> +
> + err = st_lsm6dsx_shub_set_enable(sensor, true);
> + if (err < 0)
> + return err;
> +
> + delay = 1000000 / sensor->odr;
> + usleep_range(delay, 2 * delay);
> +
> + err = st_lsm6dsx_shub_read(sensor, ch->address, (u8 *)&data, len);
> + if (err < 0)
> + return err;
> +
> + st_lsm6dsx_shub_set_enable(sensor, false);
> +
> + switch (len) {
> + case 2:
> + *val = (s16)le16_to_cpu(data);
This one is odd given data is an __le32?
What's going on here?
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + return IIO_VAL_INT;
> +}
> +
next prev parent reply other threads:[~2018-11-12 2:29 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 [this message]
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
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=20181111164012.47b963b4@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 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.