aboutsummaryrefslogtreecommitdiff
path: root/drivers/iio/industrialio-core.c
diff options
context:
space:
mode:
authorGravatar Jonathan Cameron <Jonathan.Cameron@huawei.com> 2022-06-26 13:29:32 +0100
committerGravatar Jonathan Cameron <Jonathan.Cameron@huawei.com> 2022-08-15 22:30:01 +0100
commit5c64990b99aa91622cf044a9a2f7a78de8f770a2 (patch)
tree7dd6a06389ed9d6bfc41acb2b65d5abf46b919e9 /drivers/iio/industrialio-core.c
parentstaging: iio: cdc: ad7746: Use _raw and _scale for temperature channels. (diff)
downloadlinux-5c64990b99aa91622cf044a9a2f7a78de8f770a2.tar.gz
linux-5c64990b99aa91622cf044a9a2f7a78de8f770a2.tar.bz2
linux-5c64990b99aa91622cf044a9a2f7a78de8f770a2.zip
iio: core: Introduce _zeropoint for differential channels
Address an ABI gap for device where the offset of both lines in a differential pair may be controlled so as to allow a wider range of inputs, but without having any direct effect of the differential measurement. _offset cannot be used as to remain in line with existing usage, userspace would be expected to apply it as (_raw + _offset) * _scale whereas _zeropoint is not. i.e. If we were computing the differential in software it would be. ((postive_raw + _zeropoint) - (negative_raw + zeropoint) + _offset) * _scale = ((postive_raw - negative_raw) + _offset) * _scale = (differential_raw + _offset) * _scale Similarly calibbias is expected to tweak the measurement seen, not the adjust the two lines of the differential pair. Needed for in_capacitanceX-capacitanceY_zeropoint for the AD7746 CDC driver. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20220626122938.582107-12-jic23@kernel.org
Diffstat (limited to 'drivers/iio/industrialio-core.c')
-rw-r--r--drivers/iio/industrialio-core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 40ebc63b7919..67d3d01d2dac 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -168,6 +168,7 @@ static const char * const iio_chan_info_postfix[] = {
[IIO_CHAN_INFO_OVERSAMPLING_RATIO] = "oversampling_ratio",
[IIO_CHAN_INFO_THERMOCOUPLE_TYPE] = "thermocouple_type",
[IIO_CHAN_INFO_CALIBAMBIENT] = "calibambient",
+ [IIO_CHAN_INFO_ZEROPOINT] = "zeropoint",
};
/**
* iio_device_id() - query the unique ID for the device