mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Neil Armstrong <neil.armstrong@linaro.org>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux@analog.com, "Conor Dooley" <conor.dooley@microchip.com>,
	"Marius Cristea" <marius.cristea@microchip.com>,
	"Andy Shevchenko" <andriy.shevchenko@intel.com>
Subject: Re: [PATCH v5 0/3] iio: adc: add support for the MAX34417 Four-Channel High Dynamic Range Power Accumulator
Date: Tue, 17 Nov 2026 03:22:40 +0000	[thread overview]
Message-ID: <20261117032240.487a2b1b@jic23-hlaptop> (raw)
In-Reply-To: <6cc41f58-970a-4a18-8a8d-dc6e7b42fe1e@linaro.org>

On Mon, 16 Nov 2026 10:34:30 +0100
Neil Armstrong <neil.armstrong@linaro.org> wrote:

> On 11/14/26 19:46, Jonathan Cameron wrote:
> > On Mon, 9 Nov 2026 10:52:22 +0100
> > Neil Armstrong <neil.armstrong@linaro.org> wrote:
> >   
> >> On 11/8/26 00:09, Jonathan Cameron wrote:  
> >>> On Wed, 4 Nov 2026 09:45:02 +0100
> >>> Neil Armstrong <neil.armstrong@linaro.org> wrote:  
> >>
> >> <snip>
> >>  
> >>>> But for the other reports:
> >>>> - [Medium] iio: adc: max34417: shared accumulators clobbered on CAM power/energy read
> >>>>
> >>>> This is a tough one, today if either we read power or energy, we erase the accumulated
> >>>> power+count in the context, the context accumulator is only here to make sure we don't
> >>>> loose data from other channels, like if we had a single HW channel.
> >>>> This simulates this, if we had a single HW channel, at each UPDATE we would get back
> >>>> to 0 in hardware anyway if we did read the power or energy.  
> >>>
> >>>
> >>> I'm only half understanding this.  Let me see...
> >>>
> >>> I'd expect userspace to see accumulated values since we enabled the channel
> >>> rather than since last read.  I think that's the final suggestion from
> >>> sashiko.  
> >>
> >> Oh this changes quite a lot of things.
> >> How do we handle overflow in this case ? we disable the channel and enable again to reset the state ?  
> > 
> > Is it possible to accumulate into a sufficiently large type that overflow won't happen in a feasible
> > timescale?  Anything else is going to be a but unpredictable for userspace if it
> > is expecting an accumulated number.   The other things that accumulate in IIO tend to be
> > moderately small so it's never been an issue (things like step counters).  
> 
> The hardware can store up to 4.55h of data with it's 56bit with the default rate,
> we store in 64bit in software, so we can store up to 256 times so up to 48.53 days.
> 
> It's possible to lower the SPS to 8, in this mode we can store up to 6211 days of data.
> I plan to add this mode afterwards.
> 
> I'll switch to this and clear the overflow only if we disable the POWER channel.

Hmm. Could use dual 64 bits values and a retry loop for theoretical tearing.
Would then need custom code to report though which isn't ideal and
it might rather surprise userspace.


> 
> Neil
> 
> > 
> > Jonathan  
> 


      reply	other threads:[~2026-11-17  3:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 14:49 Neil Armstrong
2026-11-02 14:49 ` [PATCH v5 1/3] dt-bindings: iio: add: document " Neil Armstrong
2026-11-02 14:49 ` [PATCH v5 2/3] unaligned: introduce be56 unaligned accessors Neil Armstrong
2026-11-02 14:49 ` [PATCH v5 3/3] iio: adc: add driver for the MAX34417 Four-Channel High Dynamic Range Power Accumulator Neil Armstrong
2026-11-04  2:30   ` Jonathan Cameron
2026-11-04  8:33     ` Neil Armstrong
2026-11-07 22:57       ` Jonathan Cameron
2026-11-04  2:17 ` [PATCH v5 0/3] iio: adc: add support " Jonathan Cameron
2026-11-04  8:45   ` Neil Armstrong
2026-11-07 23:09     ` Jonathan Cameron
2026-11-09  9:52       ` Neil Armstrong
2026-11-14 18:46         ` Jonathan Cameron
2026-11-16  9:34           ` Neil Armstrong
2026-11-17  3:22             ` 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=20261117032240.487a2b1b@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=conor.dooley@microchip.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@analog.com \
    --cc=marius.cristea@microchip.com \
    --cc=neil.armstrong@linaro.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@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

all inboxes | Powered by JetHome®