iio: st_pressure: Fix data sign
authorMarcin Niestroj <m.niestroj@grinn-global.com>
Mon, 12 Dec 2016 16:58:42 +0000 (17:58 +0100)
committerJonathan Cameron <jic23@kernel.org>
Fri, 30 Dec 2016 11:31:16 +0000 (11:31 +0000)
Datasheet of each device (lps331ap, lps25h, lps001wp, lps22hb) says that
the pressure and temperature data is a 2's complement.

I'm sending this the slow way, as negative pressures on these are pretty
unusual and the nature of the fixing of multiple device introduction patches
will make it hard to apply to older kernels - Jonathan.

Fixes: 217494e5b780 ("iio:pressure: Add STMicroelectronics pressures driver")
Fixes: 2f5effcbd097 ("iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor")
Fixes: 7885a8ce6800 ("iio: pressure: st: Add support for new LPS001WP pressure sensor")
Fixes: e039e2f5b4da ("iio:st_pressure:initial lps22hb sensor support")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/pressure/st_pressure_core.c

index e19e0787864cf436f2db208e5462f13c31a4cd2f..2e3c406f308da2aeb0ce08d026f88a1e03094b91 100644 (file)
@@ -136,7 +136,7 @@ static const struct iio_chan_spec st_press_1_channels[] = {
                .address = ST_PRESS_1_OUT_XL_ADDR,
                .scan_index = 0,
                .scan_type = {
-                       .sign = 'u',
+                       .sign = 's',
                        .realbits = 24,
                        .storagebits = 32,
                        .endianness = IIO_LE,
@@ -149,7 +149,7 @@ static const struct iio_chan_spec st_press_1_channels[] = {
                .address = ST_TEMP_1_OUT_L_ADDR,
                .scan_index = 1,
                .scan_type = {
-                       .sign = 'u',
+                       .sign = 's',
                        .realbits = 16,
                        .storagebits = 16,
                        .endianness = IIO_LE,
@@ -168,7 +168,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = {
                .address = ST_PRESS_LPS001WP_OUT_L_ADDR,
                .scan_index = 0,
                .scan_type = {
-                       .sign = 'u',
+                       .sign = 's',
                        .realbits = 16,
                        .storagebits = 16,
                        .endianness = IIO_LE,
@@ -182,7 +182,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = {
                .address = ST_TEMP_LPS001WP_OUT_L_ADDR,
                .scan_index = 1,
                .scan_type = {
-                       .sign = 'u',
+                       .sign = 's',
                        .realbits = 16,
                        .storagebits = 16,
                        .endianness = IIO_LE,
@@ -200,7 +200,7 @@ static const struct iio_chan_spec st_press_lps22hb_channels[] = {
                .address = ST_PRESS_1_OUT_XL_ADDR,
                .scan_index = 0,
                .scan_type = {
-                       .sign = 'u',
+                       .sign = 's',
                        .realbits = 24,
                        .storagebits = 32,
                        .endianness = IIO_LE,