mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Angel Iglesias <ang.iglesiasg@gmail.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: Mon, 30 Jan 2023 14:29:28 +0200	[thread overview]
Message-ID: <Y9e4KFhB2E6E4EQb@smile.fi.intel.com> (raw)
In-Reply-To: <013686653a60092227c842ae2fd0197f2509ad7c.1674954271.git.ang.iglesiasg@gmail.com>

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, &reg);
> +		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



  reply	other threads:[~2023-01-30 12:29 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 [this message]
2023-01-31 22:36     ` Angel Iglesias
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=Y9e4KFhB2E6E4EQb@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=ak@it-klinger.de \
    --cc=ang.iglesiasg@gmail.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

Powered by JetHome