From: Angel Iglesias <ang.iglesiasg@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-iio@vger.kernel.org, Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Andreas Klinger <ak@it-klinger.de>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 7/7] iio: pressure: bmp280: Add nvmem operations for BMP580
Date: Tue, 31 Jan 2023 23:36:14 +0100 [thread overview]
Message-ID: <2be3109edf0c29178aab58705ed2cf60b6b30a62.camel@gmail.com> (raw)
In-Reply-To: <Y9e4KFhB2E6E4EQb@smile.fi.intel.com>
On Mon, 2023-01-30 at 14:29 +0200, Andy Shevchenko wrote:
> On Sun, Jan 29, 2023 at 02:33:09AM +0100, Angel Iglesias wrote:
> > The pressure sensor BMP580 contains a non-volatile memory that stores
> > trimming and configuration params. That memory provides an programmable
> > user range of three 2-byte words.
>
> ...
>
> > +#define NVM_READ false
> > +#define NVM_WRITE true
>
> How is it helpful and why it's not namespaced properly (can collide with
> NVM framework)?
I thought it could provide clarity using those aliases calling
bmp580_nvm_operation() helper function on nvmen callbacks, instead of using
just true or false. Not my brightest idea for sure.
> ...
>
> > + /* Wait until NVM is ready again */
> > + do {
> > + ret = regmap_read(data->regmap, BMP580_REG_STATUS, ®);
> > + if (ret) {
> > + dev_err(data->dev, "failed to check nvm status\n");
> > + reg &= ~BMP580_STATUS_NVM_RDY_MASK;
> > + }
> > + } while (time_before(jiffies, deadline) && !(reg &
> > BMP580_STATUS_NVM_RDY_MASK));
>
> regmap_read_poll_timeout()?
Yes, thanks for pointing out, that's way better than the current loop.
>
> > + if (!(reg & BMP580_STATUS_NVM_RDY_MASK)) {
>
> if (ret) {
> ...
> return ret;
> }
>
> > + dev_err(data->dev,
> > + "reached timeout waiting for nvm operation
> > completion\n");
> > + return -ETIMEDOUT;
> > + }
>
> ...
>
> > + while (bytes >= sizeof(u16)) {
>
> sizeof(*dst) ?
>
> Or sizeof(data->le16)?
>
> > + addr = bmp580_nvmem_addrs[offset / sizeof(u16)];
>
> Ditto.
>
> ...
>
> > + bytes -= sizeof(u16);
> > + offset += sizeof(u16);
>
> Ditto.
>
> > + }
>
> ...
>
> > +static int bmp580_nvmem_write(void *priv, unsigned int offset, void *val,
> > + size_t bytes)
> > +{
>
> Same comments as per above function.
Got it!
> > }
>
>
Thanks for your time,
Angel
next prev parent reply other threads:[~2023-01-31 22:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-29 1:33 [PATCH v3 0/7] Add support for pressure sensor Bosch BMP580 Angel Iglesias
2023-01-29 1:33 ` [PATCH v3 1/7] iio: pressure: bmp280: Use chip_info pointers for each chip as driver data Angel Iglesias
2023-01-29 1:33 ` [PATCH v3 2/7] iio: pressure: bmp280: Add preinit callback Angel Iglesias
2023-01-29 1:33 ` [PATCH v3 3/7] iio: pressure: bmp280: Make read calibration callback optional Angel Iglesias
2023-01-29 1:33 ` [PATCH v3 4/7] iio: pressure: Kconfig: Delete misleading I2C reference on bmp280 title Angel Iglesias
2023-01-29 1:33 ` [PATCH v3 5/7] iio: pressure: bmp280: Add support for new sensor BMP580 Angel Iglesias
2023-02-05 14:53 ` Jonathan Cameron
2023-02-05 23:39 ` Angel Iglesias
2023-01-29 1:33 ` [PATCH v3 6/7] dt-bindings: iio: pressure: bmp085: Add BMP580 compatible string Angel Iglesias
2023-01-29 1:33 ` [PATCH v3 7/7] iio: pressure: bmp280: Add nvmem operations for BMP580 Angel Iglesias
2023-01-30 12:29 ` Andy Shevchenko
2023-01-31 22:36 ` Angel Iglesias [this message]
2023-01-30 12:30 ` [PATCH v3 0/7] Add support for pressure sensor Bosch BMP580 Andy Shevchenko
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=2be3109edf0c29178aab58705ed2cf60b6b30a62.camel@gmail.com \
--to=ang.iglesiasg@gmail.com \
--cc=ak@it-klinger.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).