|
113 | 113 | #define ST_PRESS_LPS25H_OUT_XL_ADDR 0x28 |
114 | 114 | #define ST_TEMP_LPS25H_OUT_L_ADDR 0x2b |
115 | 115 |
|
| 116 | +/* CUSTOM VALUES FOR LPS22HB SENSOR */ |
| 117 | +#define ST_PRESS_LPS22HB_WAI_EXP 0xb1 |
| 118 | +#define ST_PRESS_LPS22HB_ODR_ADDR 0x10 |
| 119 | +#define ST_PRESS_LPS22HB_ODR_MASK 0x70 |
| 120 | +#define ST_PRESS_LPS22HB_ODR_AVL_1HZ_VAL 0x01 |
| 121 | +#define ST_PRESS_LPS22HB_ODR_AVL_10HZ_VAL 0x02 |
| 122 | +#define ST_PRESS_LPS22HB_ODR_AVL_25HZ_VAL 0x03 |
| 123 | +#define ST_PRESS_LPS22HB_ODR_AVL_50HZ_VAL 0x04 |
| 124 | +#define ST_PRESS_LPS22HB_ODR_AVL_75HZ_VAL 0x05 |
| 125 | +#define ST_PRESS_LPS22HB_PW_ADDR 0x10 |
| 126 | +#define ST_PRESS_LPS22HB_PW_MASK 0x70 |
| 127 | +#define ST_PRESS_LPS22HB_BDU_ADDR 0x10 |
| 128 | +#define ST_PRESS_LPS22HB_BDU_MASK 0x02 |
| 129 | +#define ST_PRESS_LPS22HB_DRDY_IRQ_ADDR 0x12 |
| 130 | +#define ST_PRESS_LPS22HB_DRDY_IRQ_INT1_MASK 0x04 |
| 131 | +#define ST_PRESS_LPS22HB_DRDY_IRQ_INT2_MASK 0x08 |
| 132 | +#define ST_PRESS_LPS22HB_IHL_IRQ_ADDR 0x12 |
| 133 | +#define ST_PRESS_LPS22HB_IHL_IRQ_MASK 0x80 |
| 134 | +#define ST_PRESS_LPS22HB_MULTIREAD_BIT true |
| 135 | + |
116 | 136 | static const struct iio_chan_spec st_press_1_channels[] = { |
117 | 137 | { |
118 | 138 | .type = IIO_PRESSURE, |
@@ -183,6 +203,27 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { |
183 | 203 | IIO_CHAN_SOFT_TIMESTAMP(1) |
184 | 204 | }; |
185 | 205 |
|
| 206 | +static const struct iio_chan_spec st_press_lps22hb_channels[] = { |
| 207 | + { |
| 208 | + .type = IIO_PRESSURE, |
| 209 | + .channel2 = IIO_NO_MOD, |
| 210 | + .address = ST_PRESS_1_OUT_XL_ADDR, |
| 211 | + .scan_index = 0, |
| 212 | + .scan_type = { |
| 213 | + .sign = 'u', |
| 214 | + .realbits = 24, |
| 215 | + .storagebits = 24, |
| 216 | + .endianness = IIO_LE, |
| 217 | + }, |
| 218 | + .info_mask_separate = |
| 219 | + BIT(IIO_CHAN_INFO_RAW) | |
| 220 | + BIT(IIO_CHAN_INFO_SCALE), |
| 221 | + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), |
| 222 | + .modified = 0, |
| 223 | + }, |
| 224 | + IIO_CHAN_SOFT_TIMESTAMP(1) |
| 225 | +}; |
| 226 | + |
186 | 227 | static const struct st_sensor_settings st_press_sensors_settings[] = { |
187 | 228 | { |
188 | 229 | .wai = ST_PRESS_LPS331AP_WAI_EXP, |
@@ -326,6 +367,51 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { |
326 | 367 | .multi_read_bit = ST_PRESS_LPS25H_MULTIREAD_BIT, |
327 | 368 | .bootime = 2, |
328 | 369 | }, |
| 370 | + { |
| 371 | + .wai = ST_PRESS_LPS22HB_WAI_EXP, |
| 372 | + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, |
| 373 | + .sensors_supported = { |
| 374 | + [0] = LPS22HB_PRESS_DEV_NAME, |
| 375 | + }, |
| 376 | + .ch = (struct iio_chan_spec *)st_press_lps22hb_channels, |
| 377 | + .num_ch = ARRAY_SIZE(st_press_lps22hb_channels), |
| 378 | + .odr = { |
| 379 | + .addr = ST_PRESS_LPS22HB_ODR_ADDR, |
| 380 | + .mask = ST_PRESS_LPS22HB_ODR_MASK, |
| 381 | + .odr_avl = { |
| 382 | + { 1, ST_PRESS_LPS22HB_ODR_AVL_1HZ_VAL, }, |
| 383 | + { 10, ST_PRESS_LPS22HB_ODR_AVL_10HZ_VAL, }, |
| 384 | + { 25, ST_PRESS_LPS22HB_ODR_AVL_25HZ_VAL, }, |
| 385 | + { 50, ST_PRESS_LPS22HB_ODR_AVL_50HZ_VAL, }, |
| 386 | + { 75, ST_PRESS_LPS22HB_ODR_AVL_75HZ_VAL, }, |
| 387 | + }, |
| 388 | + }, |
| 389 | + .pw = { |
| 390 | + .addr = ST_PRESS_LPS22HB_PW_ADDR, |
| 391 | + .mask = ST_PRESS_LPS22HB_PW_MASK, |
| 392 | + .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, |
| 393 | + }, |
| 394 | + .fs = { |
| 395 | + .fs_avl = { |
| 396 | + [0] = { |
| 397 | + .num = ST_PRESS_FS_AVL_1260MB, |
| 398 | + .gain = ST_PRESS_KPASCAL_NANO_SCALE, |
| 399 | + }, |
| 400 | + }, |
| 401 | + }, |
| 402 | + .bdu = { |
| 403 | + .addr = ST_PRESS_LPS22HB_BDU_ADDR, |
| 404 | + .mask = ST_PRESS_LPS22HB_BDU_MASK, |
| 405 | + }, |
| 406 | + .drdy_irq = { |
| 407 | + .addr = ST_PRESS_LPS22HB_DRDY_IRQ_ADDR, |
| 408 | + .mask_int1 = ST_PRESS_LPS22HB_DRDY_IRQ_INT1_MASK, |
| 409 | + .mask_int2 = ST_PRESS_LPS22HB_DRDY_IRQ_INT2_MASK, |
| 410 | + .addr_ihl = ST_PRESS_LPS22HB_IHL_IRQ_ADDR, |
| 411 | + .mask_ihl = ST_PRESS_LPS22HB_IHL_IRQ_MASK, |
| 412 | + }, |
| 413 | + .multi_read_bit = ST_PRESS_LPS22HB_MULTIREAD_BIT, |
| 414 | + }, |
329 | 415 | }; |
330 | 416 |
|
331 | 417 | static int st_press_write_raw(struct iio_dev *indio_dev, |
@@ -454,10 +540,9 @@ int st_press_common_probe(struct iio_dev *indio_dev) |
454 | 540 | indio_dev->channels = press_data->sensor_settings->ch; |
455 | 541 | indio_dev->num_channels = press_data->sensor_settings->num_ch; |
456 | 542 |
|
457 | | - if (press_data->sensor_settings->fs.addr != 0) |
458 | | - press_data->current_fullscale = |
459 | | - (struct st_sensor_fullscale_avl *) |
460 | | - &press_data->sensor_settings->fs.fs_avl[0]; |
| 543 | + press_data->current_fullscale = |
| 544 | + (struct st_sensor_fullscale_avl *) |
| 545 | + &press_data->sensor_settings->fs.fs_avl[0]; |
461 | 546 |
|
462 | 547 | press_data->odr = press_data->sensor_settings->odr.odr_avl[0].hz; |
463 | 548 |
|
|
0 commit comments