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

From: Andy Shevchenko

Date: Mon Aug 10 2026 - 13:05:50 EST


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 <andriy.shevchenko@xxxxxxxxx>

--
With Best Regards,
Andy Shevchenko