Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adc: xilinx: Fix VREFN sign

The VREFN channel is bipolar, not unipolar. Small negative values do
occur (e.g., -1mV), and unsigned conversion maps them incorrectly to
large positive values (about +1V), so fix this.

Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>

authored by

Thomas Betker and committed by
Jonathan Cameron
97ffae1d 00db4e52

+1 -1
+1 -1
drivers/iio/adc/xilinx-xadc-core.c
··· 997 997 .num_event_specs = (_alarm) ? ARRAY_SIZE(xadc_voltage_events) : 0, \ 998 998 .scan_index = (_scan_index), \ 999 999 .scan_type = { \ 1000 - .sign = 'u', \ 1000 + .sign = ((_addr) == XADC_REG_VREFN) ? 's' : 'u', \ 1001 1001 .realbits = 12, \ 1002 1002 .storagebits = 16, \ 1003 1003 .shift = 4, \