Re: [PATCH v2] iio: adc: max1363: sign-extend bipolar differential channel reads

Jonathan Cameron <[email protected]>
Newsgroups gmane.linux.kernel.iio,gmane.linux.kernel
Message-ID <20260817020335.347796c4@jic23-huawei>
On Mon, 10 Aug 2026 20:04:23 +0300
Andy Shevchenko <[email protected]> wrote:

> On Mon, Aug 10, 2026 at 11:44:46PM +0700, Cong Nguyen wrote:
> > MAX1363 differential channels are bipolar (scan_type.sign = 's'), but  
> 
> The (...) can also be dropped, but I leave that to Jonathan, no need to resend.
> 
> > max1363_read_single_chan() masks the raw value to the ADC resolution
> > without sign-extending it. Negative differential readings are therefore
> > reported to userspace as large positive values (e.g. -1 as 4095 on a
> > 12-bit part).
> > 
> > Sign-extend the masked value from the resolution bit for differential
> > channels. Single-ended channels are unipolar and are left unchanged.  
> 
> Now looks good to me,
> Reviewed-by: Andy Shevchenko <[email protected]>

Applied.  Amazing that's sat there for so long given it is
a reasonably common part.  Oops - that younger me wrote just
as many bugs as the current version ;)

On the fixes-togreg branch but unlikely I'll do a pull request
until I've rebased that on 7.3-rc1 in a few weeks time.

Jonathan

>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.