• Jonathan Cameron's avatar
    iio: core: Introduce _zeropoint for differential channels · 5c64990b
    Jonathan Cameron authored
    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: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
    Link: https://lore.kernel.org/r/20220626122938.582107-12-jic23@kernel.org
    5c64990b
sysfs-bus-iio 92.1 KB