Lines Matching +full:osr +full:- +full:press
5 * SPDX-License-Identifier: Apache-2.0
8 * https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp388-ds001.pdf
29 { 0, 3 }, /* 25/8192 - 327.68s */
30 { 0, 6 }, /* 25/4096 - 163.84s */
31 { 0, 12 }, /* 25/2048 - 81.92s */
32 { 0, 24 }, /* 25/1024 - 40.96s */
33 { 0, 49 }, /* 25/512 - 20.48s */
34 { 0, 98 }, /* 25/256 - 10.24s */
35 { 0, 195 }, /* 25/128 - 5.12s */
36 { 0, 391 }, /* 25/64 - 2.56s */
37 { 0, 781 }, /* 25/32 - 1.28s */
38 { 1, 563 }, /* 25/16 - 640ms */
39 { 3, 125 }, /* 25/8 - 320ms */
40 { 6, 250 }, /* 25/4 - 160ms */
41 { 12, 500 }, /* 25/2 - 80ms */
42 { 25, 0 }, /* 25 - 40ms */
43 { 50, 0 }, /* 50 - 20ms */
44 { 100, 0 }, /* 100 - 10ms */
45 { 200, 0 }, /* 200 - 5ms */
51 const struct bmp388_config *cfg = dev->config; in bmp388_bus_check()
53 return cfg->bus_io->check(&cfg->bus); in bmp388_bus_check()
59 const struct bmp388_config *cfg = dev->config; in bmp388_reg_read()
61 return cfg->bus_io->read(&cfg->bus, start, buf, size); in bmp388_reg_read()
67 const struct bmp388_config *cfg = dev->config; in bmp388_reg_write()
69 return cfg->bus_io->write(&cfg->bus, reg, val); in bmp388_reg_write()
79 const struct bmp388_config *cfg = dev->config; in bmp388_reg_field_update()
81 rc = cfg->bus_io->read(&cfg->bus, reg, &old_value, 1); in bmp388_reg_field_update()
91 return cfg->bus_io->write(&cfg->bus, reg, new_value); in bmp388_reg_field_update()
101 return -EINVAL; in bmp388_freq_to_odr_val()
108 return (ARRAY_SIZE(bmp388_odr_map) - 1) - i; in bmp388_freq_to_odr_val()
112 return -EINVAL; in bmp388_freq_to_odr_val()
120 struct bmp388_data *data = dev->data; in bmp388_attr_set_odr()
132 data->odr = odr; in bmp388_attr_set_odr()
148 struct bmp388_data *data = dev->data; in bmp388_attr_set_oversampling()
151 if ((val <= 0) || (val > 32) || ((val & (val - 1)) != 0)) { in bmp388_attr_set_oversampling()
152 return -EINVAL; in bmp388_attr_set_oversampling()
163 return -EINVAL; in bmp388_attr_set_oversampling()
182 data->osr_pressure = reg_val; in bmp388_attr_set_oversampling()
184 data->osr_temp = reg_val; in bmp388_attr_set_oversampling()
203 return -EBUSY; in bmp388_attr_set()
210 ret = bmp388_attr_set_odr(dev, val->val1, val->val2 / 1000); in bmp388_attr_set()
216 ret = bmp388_attr_set_oversampling(dev, chan, val->val1); in bmp388_attr_set()
221 ret = -EINVAL; in bmp388_attr_set()
230 struct bmp388_data *bmp3xx = dev->data; in bmp388_sample_fetch()
241 return -EBUSY; in bmp388_sample_fetch()
265 bmp3xx->sample.press = sys_get_le24(&raw[0]); in bmp388_sample_fetch()
266 bmp3xx->sample.raw_temp = sys_get_le24(&raw[3]); in bmp388_sample_fetch()
267 bmp3xx->sample.comp_temp = 0; in bmp388_sample_fetch()
277 * https://github.com/BoschSensortec/BMP3-Sensor-API/blob/master/bmp3.c in bmp388_compensate_temp()
286 struct bmp388_cal_data *cal = &data->cal; in bmp388_compensate_temp()
288 partial_data1 = ((int64_t)data->sample.raw_temp - (256 * cal->t1)); in bmp388_compensate_temp()
289 partial_data2 = cal->t2 * partial_data1; in bmp388_compensate_temp()
291 partial_data4 = (int64_t)partial_data3 * cal->t3; in bmp388_compensate_temp()
295 data->sample.comp_temp = partial_data5 / 4294967296; in bmp388_compensate_temp()
301 struct bmp388_data *data = dev->data; in bmp388_temp_channel_get()
303 if (data->sample.comp_temp == 0) { in bmp388_temp_channel_get()
307 int64_t tmp = (data->sample.comp_temp * 250000) / 16384; in bmp388_temp_channel_get()
309 val->val1 = tmp / 1000000; in bmp388_temp_channel_get()
310 val->val2 = tmp % 1000000; in bmp388_temp_channel_get()
318 * https://github.com/BoschSensortec/BMP3-Sensor-API/blob/master/bmp3.c in bmp388_compensate_press()
331 struct bmp388_cal_data *cal = &data->cal; in bmp388_compensate_press()
333 int64_t t_lin = data->sample.comp_temp; in bmp388_compensate_press()
334 uint32_t raw_pressure = data->sample.press; in bmp388_compensate_press()
339 partial_data4 = (cal->p8 * partial_data3) / 32; in bmp388_compensate_press()
340 partial_data5 = (cal->p7 * partial_data1) * 16; in bmp388_compensate_press()
341 partial_data6 = (cal->p6 * t_lin) * 4194304; in bmp388_compensate_press()
342 offset = (cal->p5 * 140737488355328) + partial_data4 + partial_data5 + in bmp388_compensate_press()
344 partial_data2 = (cal->p4 * partial_data3) / 32; in bmp388_compensate_press()
345 partial_data4 = (cal->p3 * partial_data1) * 4; in bmp388_compensate_press()
346 partial_data5 = (cal->p2 - 16384) * t_lin * 2097152; in bmp388_compensate_press()
347 sensitivity = ((cal->p1 - 16384) * 70368744177664) + partial_data2 + in bmp388_compensate_press()
350 partial_data2 = cal->p10 * t_lin; in bmp388_compensate_press()
351 partial_data3 = partial_data2 + (65536 * cal->p9); in bmp388_compensate_press()
359 partial_data2 = (cal->p11 * partial_data6) / 65536; in bmp388_compensate_press()
373 struct bmp388_data *data = dev->data; in bmp388_press_channel_get()
375 if (data->sample.comp_temp == 0) { in bmp388_press_channel_get()
384 val->val1 = tmp / 100000; in bmp388_press_channel_get()
385 val->val2 = (tmp % 100000) * 10; in bmp388_press_channel_get()
406 return -ENOTSUP; in bmp388_channel_get()
414 struct bmp388_data *data = dev->data; in bmp388_get_calibration_data()
415 struct bmp388_cal_data *cal = &data->cal; in bmp388_get_calibration_data()
418 return -EIO; in bmp388_get_calibration_data()
421 cal->t1 = sys_le16_to_cpu(cal->t1); in bmp388_get_calibration_data()
422 cal->t2 = sys_le16_to_cpu(cal->t2); in bmp388_get_calibration_data()
423 cal->p1 = (int16_t)sys_le16_to_cpu(cal->p1); in bmp388_get_calibration_data()
424 cal->p2 = (int16_t)sys_le16_to_cpu(cal->p2); in bmp388_get_calibration_data()
425 cal->p5 = sys_le16_to_cpu(cal->p5); in bmp388_get_calibration_data()
426 cal->p6 = sys_le16_to_cpu(cal->p6); in bmp388_get_calibration_data()
427 cal->p9 = (int16_t)sys_le16_to_cpu(cal->p9); in bmp388_get_calibration_data()
446 return -ENOTSUP; in bmp388_pm_action()
454 return -EIO; in bmp388_pm_action()
472 struct bmp388_data *bmp3xx = dev->data; in bmp388_init()
473 const struct bmp388_config *cfg = dev->config; in bmp388_init()
478 return -ENODEV; in bmp388_init()
484 return -EIO; in bmp388_init()
491 return -EIO; in bmp388_init()
494 if (val != bmp3xx->chip_id) { in bmp388_init()
496 return -ENODEV; in bmp388_init()
502 return -EIO; in bmp388_init()
506 if (bmp388_reg_field_update(dev, BMP388_REG_ODR, BMP388_ODR_MASK, bmp3xx->odr) < 0) { in bmp388_init()
508 return -EIO; in bmp388_init()
511 /* Set OSR */ in bmp388_init()
512 val = (bmp3xx->osr_pressure << BMP388_OSR_PRESSURE_POS); in bmp388_init()
513 val |= (bmp3xx->osr_temp << BMP388_OSR_TEMP_POS); in bmp388_init()
515 LOG_ERR("Failed to set OSR."); in bmp388_init()
516 return -EIO; in bmp388_init()
520 val = (cfg->iir_filter << BMP388_IIR_FILTER_POS) & BMP388_IIR_FILTER_MASK; in bmp388_init()
523 return -EIO; in bmp388_init()
531 return -EIO; in bmp388_init()
537 return -EIO; in bmp388_init()
540 /* OSR and ODR config not proper */ in bmp388_init()
542 LOG_ERR("OSR and ODR configuration is not proper"); in bmp388_init()
543 return -EINVAL; in bmp388_init()
547 if (cfg->gpio_int.port != NULL && bmp388_trigger_mode_init(dev) < 0) { in bmp388_init()
549 return -EINVAL; in bmp388_init()