From: Jonathan Cameron <jic23@kernel.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: linux-iio@vger.kernel.org, lorenzo.bianconi@redhat.com,
jimmyassarsson@gmail.com
Subject: Re: [PATCH] iio: imu: st_lsm6dsx: configure full scale on slave device if supported
Date: Sat, 4 Apr 2020 15:24:15 +0100 [thread overview]
Message-ID: <20200404152415.53cc596e@archlinux> (raw)
In-Reply-To: <cb3059b1ef8a5f0ebbd68a11db9931d6a2e4f44d.1584651650.git.lorenzo@kernel.org>
On Thu, 19 Mar 2020 22:02:45 +0100
Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> Introduce st_lsm6dsx_shub_set_full_scale routine in order to configure
> the i2c slave device sensitivity
>
> Tested-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
I've lost track of what is going on around this driver.
One thing is clear though, this doesn't currently apply to my togreg
tree. I'll assume that's because I'm missing something (maybe a fix,
or maybe another series).
Give me a poke if I seem to have lost this in a few weeks once all the
trees catch up properly after the merge window.
Thanks,
Jonathan
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 33 ++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
> index 64ef07a30726..fec1dbd5f00d 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
> @@ -518,6 +518,36 @@ st_lsm6dsx_shub_read_raw(struct iio_dev *iio_dev,
> return ret;
> }
>
> +static int
> +st_lsm6dsx_shub_set_full_scale(struct st_lsm6dsx_sensor *sensor,
> + u32 gain)
> +{
> + const struct st_lsm6dsx_fs_table_entry *fs_table;
> + int i, err;
> +
> + fs_table = &sensor->ext_info.settings->fs_table;
> + if (!fs_table->reg.addr)
> + return -ENOTSUPP;
> +
> + for (i = 0; i < fs_table->fs_len; i++) {
> + if (fs_table->fs_avl[i].gain == gain)
> + break;
> + }
> +
> + if (i == fs_table->fs_len)
> + return -EINVAL;
> +
> + err = st_lsm6dsx_shub_write_with_mask(sensor, fs_table->reg.addr,
> + fs_table->reg.mask,
> + fs_table->fs_avl[i].val);
> + if (err < 0)
> + return err;
> +
> + sensor->gain = gain;
> +
> + return 0;
> +}
> +
> static int
> st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev,
> struct iio_chan_spec const *chan,
> @@ -552,6 +582,9 @@ st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev,
> }
> break;
> }
> + case IIO_CHAN_INFO_SCALE:
> + err = st_lsm6dsx_shub_set_full_scale(sensor, val2);
> + break;
> default:
> err = -EINVAL;
> break;
next prev parent reply other threads:[~2020-04-04 14:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-19 21:02 [PATCH] iio: imu: st_lsm6dsx: configure full scale on slave device if supported Lorenzo Bianconi
2020-04-04 14:24 ` Jonathan Cameron [this message]
2020-04-04 14:31 ` Lorenzo Bianconi
2020-04-04 14:51 ` 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=20200404152415.53cc596e@archlinux \
--to=jic23@kernel.org \
--cc=jimmyassarsson@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=lorenzo@kernel.org \
/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