[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y9e4KFhB2E6E4EQb@smile.fi.intel.com>
Date: Mon, 30 Jan 2023 14:29:28 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Angel Iglesias <ang.iglesiasg@...il.com>
Cc: linux-iio@...r.kernel.org, Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Andreas Klinger <ak@...klinger.de>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 7/7] iio: pressure: bmp280: Add nvmem operations for
BMP580
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)?
...
> + /* 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()?
> + 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.
> }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists