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

Andy Shevchenko <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,org.kernel.vger.linux-iio
Organization Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo
Message-ID <[email protected]>
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]>

-- 
With Best Regards,
Andy Shevchenko
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.