devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: "David Lechner" <dlechner@baylibre.com>,
	"Angelo Dureghello" <adureghello@baylibre.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	 devicetree@vger.kernel.org
Subject: Re: [PATCH 3/5] iio: adc: ad7606: add offset and phase calibration support
Date: Fri, 02 May 2025 08:43:55 +0100	[thread overview]
Message-ID: <29d79f863bd0352fa0e3fca36ba5cc007f467eff.camel@gmail.com> (raw)
In-Reply-To: <b4598086-e188-4dca-b060-0dd82fc79c02@baylibre.com>

On Wed, 2025-04-30 at 13:33 -0500, David Lechner wrote:
> On 4/30/25 11:14 AM, David Lechner wrote:
> > On 4/30/25 10:36 AM, Nuno Sá wrote:
> > > On Tue, 2025-04-29 at 15:06 +0200, Angelo Dureghello wrote:
> > > > From: Angelo Dureghello <adureghello@baylibre.com>
> > > > 
> > > > 
> 
> ...
> 
> > > > +
> > > > +	val += start_val;
> > > 
> > > Shouldn't this be val -= start_val?
> > > 
> > > I also don't think we have any strict rules in the ABI for units for these
> > > kind
> > > of interfaces so using "raw" values is easier. But FWIW, I think we could
> > > have
> > > this in mv (would naturally depend on scale) 
> > > 
> > > - Nuno Sá
> > > 
> > 
> > From testing, it seems to be working as expected for me, so I think this is
> > correct. The register value is not signed. 0x80 is no offset.
> > 
> 
> Heh, you are actually quite right. Even though it working correctly, it is
> because the value that gets written to the register is val & 0xFF, so adding
> or subtracting here basically has the same effect. But subtracting is the more
> logical way to do it. (I tested it that way too just to be 100% sure.)

Yeps, when testing it i realized that the current form just gives the correct
value in the 2 LSB so I assumed we were doing something to cast way the invalid
bits.

To be more pedantic, I think subtracting is the *correct* way :)

- Nuno Sá

  reply	other threads:[~2025-05-02  7:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 13:06 [PATCH 0/5] iio: adc: add ad7606 calibration support Angelo Dureghello
2025-04-29 13:06 ` [PATCH 1/5] Documentation: ABI: IIO: add calibphase_delay documentation Angelo Dureghello
2025-04-30  5:40   ` Nuno Sá
2025-04-30 14:21     ` David Lechner
2025-04-30 14:45       ` Andy Shevchenko
2025-04-30 14:56         ` David Lechner
2025-04-30 15:04           ` David Lechner
2025-05-01 12:33             ` Angelo Dureghello
2025-05-01 14:44               ` David Lechner
2025-05-04 15:04                 ` Jonathan Cameron
2025-04-29 13:06 ` [PATCH 2/5] iio: core: add ADC phase calibration definition Angelo Dureghello
2025-04-29 13:06 ` [PATCH 3/5] iio: adc: ad7606: add offset and phase calibration support Angelo Dureghello
2025-04-30 12:50   ` Andy Shevchenko
2025-05-01 12:37     ` Angelo Dureghello
2025-04-30 15:36   ` Nuno Sá
2025-04-30 16:14     ` David Lechner
2025-04-30 18:33       ` David Lechner
2025-05-02  7:43         ` Nuno Sá [this message]
2025-04-29 13:06 ` [PATCH 4/5] dt-bindings: iio: adc: adi,ad7606: add gain " Angelo Dureghello
2025-04-29 14:56   ` Conor Dooley
2025-04-29 15:26   ` David Lechner
2025-04-29 20:45     ` Angelo Dureghello
2025-04-29 13:06 ` [PATCH 5/5] iio: adc: ad7606: " Angelo Dureghello
2025-04-29 22:34   ` Andy Shevchenko
2025-05-01 13:49     ` Angelo Dureghello
2025-04-29 22:46   ` David Lechner
2025-05-01 13:35     ` Angelo Dureghello
2025-05-01 14:26       ` David Lechner

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=29d79f863bd0352fa0e3fca36ba5cc007f467eff.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=adureghello@baylibre.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).