Commit 67dbf54a authored by Jacek Anaszewski's avatar Jacek Anaszewski Committed by Jonathan Cameron

iio: lps331ap: Fix wrong in_pressure_scale output value

This patch fixes improper in_pressure_scale output that is
returned by the lps331ap barometer sensor driver. According
to the documentation the pressure after applying the scale has to
be expressed in kilopascal units. With erroneous implementation
the scale value larger by two orders of magnitude is returned -
2441410 instead of 24414.
Signed-off-by: default avatarJacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Acked-by: default avatarDenis Ciocca <denis.ciocca@st.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 8f6817a0
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
#include <linux/iio/common/st_sensors.h> #include <linux/iio/common/st_sensors.h>
#include "st_pressure.h" #include "st_pressure.h"
#define ST_PRESS_MBAR_TO_KPASCAL(x) (x * 10) #define ST_PRESS_LSB_PER_MBAR 4096UL
#define ST_PRESS_KPASCAL_NANO_SCALE (100000000UL / \
ST_PRESS_LSB_PER_MBAR)
#define ST_PRESS_NUMBER_DATA_CHANNELS 1 #define ST_PRESS_NUMBER_DATA_CHANNELS 1
/* DEFAULT VALUE FOR SENSORS */ /* DEFAULT VALUE FOR SENSORS */
...@@ -51,8 +53,8 @@ ...@@ -51,8 +53,8 @@
#define ST_PRESS_1_FS_ADDR 0x23 #define ST_PRESS_1_FS_ADDR 0x23
#define ST_PRESS_1_FS_MASK 0x30 #define ST_PRESS_1_FS_MASK 0x30
#define ST_PRESS_1_FS_AVL_1260_VAL 0x00 #define ST_PRESS_1_FS_AVL_1260_VAL 0x00
#define ST_PRESS_1_FS_AVL_1260_GAIN ST_PRESS_MBAR_TO_KPASCAL(244141)
#define ST_PRESS_1_FS_AVL_TEMP_GAIN 2083000 #define ST_PRESS_1_FS_AVL_TEMP_GAIN 2083000
#define ST_PRESS_1_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE
#define ST_PRESS_1_BDU_ADDR 0x20 #define ST_PRESS_1_BDU_ADDR 0x20
#define ST_PRESS_1_BDU_MASK 0x04 #define ST_PRESS_1_BDU_MASK 0x04
#define ST_PRESS_1_DRDY_IRQ_ADDR 0x22 #define ST_PRESS_1_DRDY_IRQ_ADDR 0x22
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment