public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Mario Tesi <mario.tesi@st.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] iio: lsm6dsx: Support temperature channel
Date: Sat, 12 Aug 2023 11:17:46 +0200	[thread overview]
Message-ID: <ZNdOOuXy7vON/Shb@lore-rh-laptop> (raw)
In-Reply-To: <CACRpkdYHMyfvAGxgvtB8jgTsOp36Lm4gXzVYcBfXdY7RQK36cQ@mail.gmail.com>

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

> Hi Lorenzo!
> 
> thanks for the review!
> 
> On Fri, Aug 11, 2023 at 12:07 PM Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> 
> > > +                     [ST_LSM6DSX_ID_TEMP] = {
> > > +                             .reg = {
> > > +                                     .addr = 0x0A,
> > > +                                     .mask = GENMASK(5, 4),
> > > +                             },
> >
> > looking at the ISM330DHCX datasheet, the temperature sensor ODR is just 52Hz,
> > while values in 0x0A register are used only for FIFO decimation, they are not
> > values you can configure the sensor e.g. for read_one_shot().
> >
> > > +                             .odr_avl[0] = {  26000, 0x02 },
> > > +                             .odr_avl[1] = {  52000, 0x03 },
> > > +                             .odr_len = 2,
> 
> I look at page 44, paragraph 9.6 about bits 4-5:
> 
> ODR_T_BATCH_[1:0]
> Selects batch data rate (write frequency in FIFO) for temperature data
> (00: Temperature not batched in FIFO (default);
> 01: 1.6 Hz;
> 10: 12.5 Hz;
> 11: 52 Hz)

AFAIR the batch register is used to sub-sample sensor data before queueing them
into the FIFO (please check st_lsm6dsx_set_fifo_odr()), but it does not refer
to the configured sensor ODR.
Looking at the device application-note [0], the temperature sensor ODR depends
on the accel/gyro one:

- temperature sensor ODR == accel sensor ODR if accel ODR is < 52Hz and the
  gyro is in power-down
- temperature sensor ODR = 52Hz if accel ODR > 52Hz or if the gyro is not in
  power-down

Regards,
Lorenzo

[0] https://www.st.com/resource/en/application_note/an5398-ism330dhcx-alwayson-3d-accelerometer-and-3d-gyroscope-with-digital-output-for-industrial-applications-stmicroelectronics.pdf

> 
> That reads to me that I should actually add the odr for 1.6 and 12.5 Hz
> and the above 26 Hz is wrong but the .odr_avl[1] = {  52000, 0x03 },
> 52000 milli-Hz is fine?
> 
> Yours,
> Linus Walleij

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

  reply	other threads:[~2023-08-12  9:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11  9:08 [PATCH 0/2] iio: imu: lsm6dsx: Support temperature and ism330dhc Linus Walleij
2023-08-11  9:08 ` [PATCH 1/2] iio: lsm6dsx: Support temperature channel Linus Walleij
2023-08-11 10:07   ` Lorenzo Bianconi
2023-08-11 18:16     ` Linus Walleij
2023-08-12  9:17       ` Lorenzo Bianconi [this message]
2023-08-12 20:40         ` Linus Walleij
2023-08-28 16:43           ` Jonathan Cameron
2023-08-29  7:30             ` Linus Walleij
2023-08-11  9:08 ` [PATCH 2/2] iio: imu: lsm6dsx: Add support for ism330dhc Linus Walleij
2023-08-11  9:40   ` Lorenzo Bianconi
2023-08-11 10:08 ` [PATCH 0/2] iio: imu: lsm6dsx: Support temperature and ism330dhc 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=ZNdOOuXy7vON/Shb@lore-rh-laptop \
    --to=lorenzo@kernel.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.tesi@st.com \
    --cc=miquel.raynal@bootlin.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