Devicetree
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Stefan Popa <stefan.popa@analog.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	linux-iio@vger.kernel.org,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sa" <nuno.sa@analog.com>, "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Siratul Islam" <siratul.islam@linux.dev>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Ciprian Hegbeli" <ciprian.hegbeli@analog.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/2] iio: adc: add MAX40080 current-sense amplifier driver
Date: Wed, 15 Jul 2026 09:51:06 +0300	[thread overview]
Message-ID: <alct2kGoQAC8pNMd@ashevche-desk.local> (raw)
In-Reply-To: <20260715063652.368501-1-stefan.popa@analog.com>

On Wed, Jul 15, 2026 at 09:36:15AM +0300, Stefan Popa wrote:
> This series adds support for the Maxim MAX40080, a bidirectional
> current-sense amplifier with an integrated 12-bit ADC and an I2C/SMBus
> interface. It measures the voltage across an external shunt resistor and
> the input bus voltage.
> 
> The driver operates in direct (INDIO_DIRECT_MODE) mode. Each raw read
> triggers a single on-demand conversion (SMBus Quick Command) and reads
> back the matched current/voltage pair, so results are always fresh. It
> exposes the current and voltage channels with raw and scale attributes,
> a configurable oversampling (digital averaging) ratio, and PEC-protected
> register access. The two selectable current-sense ranges are exposed
> through scale/scale_available; the current scale is derived from the
> shunt-resistor-micro-ohms device-tree property.
> 
> Tested on hardware with four MAX40080 devices on an I2C bus.
> 
> Regarding Andy's question about *iv being updated even on error in
> read_poll_timeout: yes, this is intentional. The poll loop must update
> *iv on each iteration to check the valid bit. On timeout (conversion
> never completes), *iv contains the last-read value with the valid bit
> still clear, but the caller always checks the return value first —
> "if (ret) return ret;" prevents any use of the stale data.

My point also is that we can do it only once. And since the above a comment is
a must. See more in the comment I'm going to give against individual piece of
code.

-- 
With Best Regards,
Andy Shevchenko



      parent reply	other threads:[~2026-07-15  6:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15  6:36 [PATCH v3 0/2] iio: adc: add MAX40080 current-sense amplifier driver Stefan Popa
2026-07-15  6:36 ` [PATCH v3 1/2] dt-bindings: iio: adc: add maxim,max40080 Stefan Popa
2026-07-15  6:45   ` sashiko-bot
2026-07-15  6:36 ` [PATCH v3 2/2] iio: adc: add MAX40080 current-sense amplifier driver Stefan Popa
2026-07-15  6:46   ` sashiko-bot
2026-07-15  8:34   ` Andy Shevchenko
2026-07-15  6:51 ` Andy Shevchenko [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=alct2kGoQAC8pNMd@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=ciprian.hegbeli@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=siratul.islam@linux.dev \
    --cc=stefan.popa@analog.com \
    --cc=u.kleine-koenig@baylibre.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