From: Jonathan Cameron <jic23@kernel.org>
To: Angel Iglesias <ang.iglesiasg@gmail.com>
Cc: Adam Rizkalla <ajarizzo@gmail.com>,
Vasileios Amoiridis <vassilisamir@gmail.com>,
lars@metafoo.de, linux-iio@vger.kernel.org
Subject: Re: Replying to: [PATCH] iio pressure: bmp280: Fix BMP580 temperature reading
Date: Sun, 5 May 2024 19:02:31 +0100 [thread overview]
Message-ID: <20240505190224.6b3c8d66@jic23-huawei> (raw)
In-Reply-To: <bcd4495c4dd988263acb257c0ccef27c7fe49020.camel@gmail.com>
On Fri, 03 May 2024 09:13:33 +0200
Angel Iglesias <ang.iglesiasg@gmail.com> wrote:
> On Thu, 2024-05-02 at 13:15 -0500, Adam Rizkalla wrote:
> > On Thu, May 02, 2024 at 07:16:16PM +0200, Vasileios Amoiridis wrote:
> > > Hi Angel!
> > >
> > > Indeed the datasheet says that the pressure is a signed value. But this
> > > comes
> > > in contrast with 2 things:
> > >
> > > 1) The BMP58x sensor does not have a compensation function so the value from
> > > the
> > > sensor is a pressure value just in different unit from the one reported by
> > > IIO.
> > > And the sensor is able to report in between 30-125kPa according to the
> > > datasheet which are both positive values so it makes more sense to be an
> > > unsigned value.
> > >
> > > 2) According to the BMP5 sensor API [1] provided by Bosch, the pressure is
> > > declared as an unsigned value.
> > >
> > > So, what should we trust?
> > >
> > > [1]:
> > > https://github.com/boschsensortec/BMP5_SensorAPI/blob/master/bmp5_defs.h#L895
> >
> > The pressure sensor reading cannot be negative, as the pressure range of the
> > sensor
> > is 300 - 1250 hPa,so this change does not need to be applied for
> > bmp580_read_press().
> > Also, the overflow issue does not happen with the pressure reading since the
> > value
> > read back from the device is scaled up only by 2^6 for pressure vs 2^16 for
> > temperature,
> > so multiplying by 1000 even for the maximum value would still fit in a 32-bit
> > signed
> > integer. Temperature ranges above ~32.767C, however, will overflow a 32-bit
> > signed
> > integer when multiplied by 2^16 * 1000 which is why this change is necessary
> > only for
> > temperature readings.
> >
> > Hope this helps clarify.
> >
> > Best,
> > Adam
>
> Crystal clear. Thanks to both of you for the clarifications :)
>
> Acked-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,
Jonathan
>
> Kind regards,
> Angel
prev parent reply other threads:[~2024-05-05 18:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 6:22 [PATCH] iio: pressure: bmp280: Fix BMP580 temperature reading Adam Rizkalla
2024-04-28 13:40 ` Jonathan Cameron
2024-05-02 13:05 ` Replying to: " Vasileios Amoiridis
2024-05-02 15:44 ` Angel Iglesias
2024-05-02 17:16 ` Replying to: [PATCH] iio " Vasileios Amoiridis
2024-05-02 18:15 ` Adam Rizkalla
2024-05-03 7:13 ` Angel Iglesias
2024-05-05 18:02 ` Jonathan Cameron [this message]
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=20240505190224.6b3c8d66@jic23-huawei \
--to=jic23@kernel.org \
--cc=ajarizzo@gmail.com \
--cc=ang.iglesiasg@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=vassilisamir@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).