Commit 55af17ea authored by Gregor Boirie's avatar Gregor Boirie Committed by Luis Henriques

iio:st_pressure:lps22hb: temperature support

BugLink: https://launchpad.net/bugs/1642258

Implement lps22hb temperature sampling channel.
Signed-off-by: default avatarGregor Boirie <gregor.boirie@parrot.com>
Tested-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
(cherry-picked from commit 85d79136)
Signed-off-by: default avatarShrirang Bagul <shrirang.bagul@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Acked-by: default avatarTim Gardner <tim.gardner@canonical.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 54b2948d
...@@ -190,6 +190,10 @@ ...@@ -190,6 +190,10 @@
* See LPS22HB datasheet: * See LPS22HB datasheet:
* http://www2.st.com/resource/en/datasheet/lps22hb.pdf * http://www2.st.com/resource/en/datasheet/lps22hb.pdf
*/ */
/* LPS22HB temperature sensitivity */
#define ST_PRESS_LPS22HB_LSB_PER_CELSIUS 100UL
#define ST_PRESS_LPS22HB_WAI_EXP 0xb1 #define ST_PRESS_LPS22HB_WAI_EXP 0xb1
#define ST_PRESS_LPS22HB_ODR_ADDR 0x10 #define ST_PRESS_LPS22HB_ODR_ADDR 0x10
#define ST_PRESS_LPS22HB_ODR_MASK 0x70 #define ST_PRESS_LPS22HB_ODR_MASK 0x70
...@@ -299,7 +303,22 @@ static const struct iio_chan_spec st_press_lps22hb_channels[] = { ...@@ -299,7 +303,22 @@ static const struct iio_chan_spec st_press_lps22hb_channels[] = {
.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),
.modified = 0, .modified = 0,
}, },
IIO_CHAN_SOFT_TIMESTAMP(1) {
.type = IIO_TEMP,
.address = ST_TEMP_1_OUT_L_ADDR,
.scan_index = 1,
.scan_type = {
.sign = 's',
.realbits = 16,
.storagebits = 16,
.endianness = IIO_LE,
},
.info_mask_separate =
BIT(IIO_CHAN_INFO_RAW) |
BIT(IIO_CHAN_INFO_SCALE),
.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),
},
IIO_CHAN_SOFT_TIMESTAMP(2)
}; };
static const struct st_sensor_settings st_press_sensors_settings[] = { static const struct st_sensor_settings st_press_sensors_settings[] = {
...@@ -476,12 +495,13 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { ...@@ -476,12 +495,13 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
.fs = { .fs = {
.fs_avl = { .fs_avl = {
/* /*
* Sensitivity values as defined in table 3 of * Pressure and temperature sensitivity values
* LPS22HB datasheet. * as defined in table 3 of LPS22HB datasheet.
*/ */
[0] = { [0] = {
.num = ST_PRESS_FS_AVL_1260MB, .num = ST_PRESS_FS_AVL_1260MB,
.gain = ST_PRESS_KPASCAL_NANO_SCALE, .gain = ST_PRESS_KPASCAL_NANO_SCALE,
.gain2 = ST_PRESS_LPS22HB_LSB_PER_CELSIUS,
}, },
}, },
}, },
......
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