diff options
author | Gregor Boirie <gregor.boirie@parrot.com> | 2016-06-27 06:38:57 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-07-04 13:13:02 -0400 |
commit | 85d79136d3080729b13d1dcd433727223038e830 (patch) | |
tree | 3fcfba062fbc83ea00061306a635c50f71088015 | |
parent | 05167cdce057910125c535a120d7ba0a4a3617b8 (diff) |
iio:st_pressure:lps22hb: temperature support
Implement lps22hb temperature sampling channel.
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | drivers/iio/pressure/st_pressure_core.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c index 70230a159b46..274cdecc535b 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c | |||
@@ -196,6 +196,10 @@ | |||
196 | * See LPS22HB datasheet: | 196 | * See LPS22HB datasheet: |
197 | * http://www2.st.com/resource/en/datasheet/lps22hb.pdf | 197 | * http://www2.st.com/resource/en/datasheet/lps22hb.pdf |
198 | */ | 198 | */ |
199 | |||
200 | /* LPS22HB temperature sensitivity */ | ||
201 | #define ST_PRESS_LPS22HB_LSB_PER_CELSIUS 100UL | ||
202 | |||
199 | #define ST_PRESS_LPS22HB_WAI_EXP 0xb1 | 203 | #define ST_PRESS_LPS22HB_WAI_EXP 0xb1 |
200 | #define ST_PRESS_LPS22HB_ODR_ADDR 0x10 | 204 | #define ST_PRESS_LPS22HB_ODR_ADDR 0x10 |
201 | #define ST_PRESS_LPS22HB_ODR_MASK 0x70 | 205 | #define ST_PRESS_LPS22HB_ODR_MASK 0x70 |
@@ -307,7 +311,22 @@ static const struct iio_chan_spec st_press_lps22hb_channels[] = { | |||
307 | .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), | 311 | .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), |
308 | .modified = 0, | 312 | .modified = 0, |
309 | }, | 313 | }, |
310 | IIO_CHAN_SOFT_TIMESTAMP(1) | 314 | { |
315 | .type = IIO_TEMP, | ||
316 | .address = ST_TEMP_1_OUT_L_ADDR, | ||
317 | .scan_index = 1, | ||
318 | .scan_type = { | ||
319 | .sign = 's', | ||
320 | .realbits = 16, | ||
321 | .storagebits = 16, | ||
322 | .endianness = IIO_LE, | ||
323 | }, | ||
324 | .info_mask_separate = | ||
325 | BIT(IIO_CHAN_INFO_RAW) | | ||
326 | BIT(IIO_CHAN_INFO_SCALE), | ||
327 | .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), | ||
328 | }, | ||
329 | IIO_CHAN_SOFT_TIMESTAMP(2) | ||
311 | }; | 330 | }; |
312 | 331 | ||
313 | static const struct st_sensor_settings st_press_sensors_settings[] = { | 332 | static const struct st_sensor_settings st_press_sensors_settings[] = { |
@@ -494,12 +513,13 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { | |||
494 | .fs = { | 513 | .fs = { |
495 | .fs_avl = { | 514 | .fs_avl = { |
496 | /* | 515 | /* |
497 | * Sensitivity values as defined in table 3 of | 516 | * Pressure and temperature sensitivity values |
498 | * LPS22HB datasheet. | 517 | * as defined in table 3 of LPS22HB datasheet. |
499 | */ | 518 | */ |
500 | [0] = { | 519 | [0] = { |
501 | .num = ST_PRESS_FS_AVL_1260MB, | 520 | .num = ST_PRESS_FS_AVL_1260MB, |
502 | .gain = ST_PRESS_KPASCAL_NANO_SCALE, | 521 | .gain = ST_PRESS_KPASCAL_NANO_SCALE, |
522 | .gain2 = ST_PRESS_LPS22HB_LSB_PER_CELSIUS, | ||
503 | }, | 523 | }, |
504 | }, | 524 | }, |
505 | }, | 525 | }, |