iio: proximity: sx9500: Fix proximity value
authorDaniel Baluta <daniel.baluta@intel.com>
Thu, 11 Jun 2015 15:49:34 +0000 (18:49 +0300)
committerJonathan Cameron <jic23@kernel.org>
Sun, 19 Jul 2015 10:48:04 +0000 (11:48 +0100)
Because of the ABI confusion proximity value exposed by SX9500
was inverted.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/proximity/sx9500.c

index 2042e375f8351de6dc04b0b6ae7861702d17c6cf..01494cd6fa32fe791082699eef66a773ded1cc28 100644 (file)
@@ -281,7 +281,7 @@ static int sx9500_read_prox_data(struct sx9500_data *data,
        if (ret < 0)
                return ret;
 
-       *val = 32767 - (s16)be16_to_cpu(regval);
+       *val = be16_to_cpu(regval);
 
        return IIO_VAL_INT;
 }