Lines Matching refs:drv

29 static int validate_chip_id(struct bmp581_data *drv);
209 static int validate_chip_id(struct bmp581_data *drv) in validate_chip_id() argument
213 CHECKIF(drv == NULL) { in validate_chip_id()
217 if ((drv->chip_id == BMP5_CHIP_ID_PRIM) || (drv->chip_id == BMP5_CHIP_ID_SEC)) { in validate_chip_id()
220 drv->chip_id = 0; in validate_chip_id()
266 struct bmp581_data *drv = (struct bmp581_data *)dev->data; in set_osr_config() local
296 get_osr_odr_press_config(&drv->osr_odr_press_config, dev); in set_osr_config()
309 struct bmp581_data *drv = (struct bmp581_data *)dev->data; in set_odr_config() local
320 get_osr_odr_press_config(&drv->osr_odr_press_config, dev); in set_odr_config()
365 struct bmp581_data *drv = (struct bmp581_data *)dev->data; in bmp581_sample_fetch() local
375 drv->last_sample.temperature.val1 = data[2]; in bmp581_sample_fetch()
376 drv->last_sample.temperature.val2 = (data[1] << 8 | data[0]) * 10; in bmp581_sample_fetch()
378 if (drv->osr_odr_press_config.press_en == BMP5_ENABLE) { in bmp581_sample_fetch()
385 drv->last_sample.pressure.val1 = raw_pressure >> 6; in bmp581_sample_fetch()
386 drv->last_sample.pressure.val2 = (raw_pressure & BIT_MASK(6)) * 10000; in bmp581_sample_fetch()
388 drv->last_sample.pressure.val1 = 0; in bmp581_sample_fetch()
389 drv->last_sample.pressure.val2 = 0; in bmp581_sample_fetch()
403 struct bmp581_data *drv = (struct bmp581_data *)dev->data; in bmp581_channel_get() local
408 *val = drv->last_sample.pressure; in bmp581_channel_get()
412 *val = drv->last_sample.temperature; in bmp581_channel_get()
509 struct bmp581_data *drv = (struct bmp581_data *)dev->data; in bmp581_init() local
514 drv->chip_id = 0; in bmp581_init()
515 memset(&drv->osr_odr_press_config, 0, sizeof(drv->osr_odr_press_config)); in bmp581_init()
516 memset(&drv->last_sample, 0, sizeof(drv->last_sample)); in bmp581_init()
520 ret = i2c_reg_read_byte_dt(&conf->i2c, BMP5_REG_CHIP_ID, &drv->chip_id); in bmp581_init()
525 if (drv->chip_id != 0) { in bmp581_init()
528 ret = validate_chip_id(drv); in bmp581_init()
531 drv->chip_id, BMP5_CHIP_ID_PRIM, BMP5_CHIP_ID_SEC); in bmp581_init()
536 LOG_ERR("Unexpected chip id (%x). Expected (%x or %x)", drv->chip_id, in bmp581_init()