All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Sean Nyekjaer <sean@geanix.com>
Cc: lorenzo.bianconi83@gmail.com, jic23@kernel.org,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: imu: st_lsm6dsx: do not roundup set samplerate
Date: Mon, 10 May 2021 16:47:40 +0200	[thread overview]
Message-ID: <YJlHjMtosViHbzAV@lore-desk> (raw)
In-Reply-To: <e0d50da5-7aac-1ba3-e60c-f6cd85037d30@geanix.com>

[-- Attachment #1: Type: text/plain, Size: 1790 bytes --]

> On 10/05/2021 14.07, Lorenzo Bianconi wrote:
> >> On 10/05/2021 08.28, Lorenzo Bianconi wrote:
> >>>> On 07/05/2021 13.02, Lorenzo Bianconi wrote:
> >>>>>> The correct way to set the sampling rate to 12.5 Hz before
> >>>>>> commit f8710f0357bc ("iio: imu: st_lsm6dsx: express odr in mHZ")
> >>>>>> was to write 13 Hz to sampling_frequency.
> >>>>>> Before this patch writing 13 to samplerate results in sample rate set
> >>>>>> to 26 Hz.
> >>>>>> Now we return EINVAL if the sampling rate is not in table.
> >>>>>>
> >>>>>> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> >>>>>
> >>>>> I think this patch is breaking i2c-master support available in st_lsm6dsx, have you tested it?
> >>>>>
> >>>> I have not tested with i2c-master.
> >>>> But it's not nice to round up sample rate from user space without any notice.
> >>>
> >>> the point is accel odr is used as trigger for i2c-slave sampling. Connected
> >>> i2c slave devices have different sample rates (e.g. LIS2MDL), so we need to
> >>> select the lower accel odr greather than slave device one.
> >>>
> >>> Regards,
> >>> Lorenzo
> >>>
> >>
> >> We could open up for custom sample rates if i2c-slaves are enabled?
> > 
> > can you please explain what you mean?
> > 
> If i2c-slaves are enabled, it's allowed to set off table sample rates.(We roundup samplerate like now)
> If i2c-slaves are disabled, we return -EINVAL if we can't find the chosen samplerate in the samplerate table?

IMO this is not a big deal because if you set the proper ODR (e.g. 26Hz) with the
i2c-master disabled, the sample rate will not be rounded-up. If you set 20Hz,
the accel ODR will be set to 26Hz. I think it does not worth to make the code
uglier and more complex to maintain.

Regards,
Lorenzo

> 
> /Sean

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2021-05-10 14:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07 10:32 [PATCH] iio: imu: st_lsm6dsx: do not roundup set samplerate Sean Nyekjaer
2021-05-07 11:02 ` Lorenzo Bianconi
2021-05-10  5:25   ` Sean Nyekjaer
2021-05-10  6:28     ` Lorenzo Bianconi
2021-05-10  6:41       ` Sean Nyekjaer
2021-05-10 12:07         ` Lorenzo Bianconi
2021-05-10 12:14           ` Sean Nyekjaer
2021-05-10 14:47             ` Lorenzo Bianconi [this message]
2021-05-10 16:52               ` Sean Nyekjaer

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=YJlHjMtosViHbzAV@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=lorenzo.bianconi83@gmail.com \
    --cc=sean@geanix.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.