Lines Matching +full:gyro +full:- +full:pm

5  * SPDX-License-Identifier: Apache-2.0
9 #include <zephyr/pm/device.h>
27 const struct bmi08x_accel_config *bmi08x = dev->config; in bmi08x_accel_transceive_i2c()
30 return i2c_write_read_dt(&bmi08x->bus.i2c, &reg, 1, data, length); in bmi08x_accel_transceive_i2c()
33 return -EINVAL; in bmi08x_accel_transceive_i2c()
39 return i2c_write_dt(&bmi08x->bus.i2c, buf, 1 + length); in bmi08x_accel_transceive_i2c()
88 length -= len1; in bmi08x_write_config_file_i2c()
96 return i2c_is_ready_dt(&bus->i2c) ? 0 : -ENODEV; in bmi08x_bus_check_i2c()
114 const struct bmi08x_accel_config *bmi08x = dev->config; in bmi08x_accel_transceive_spi()
124 return spi_transceive_dt(&bmi08x->bus.spi, &tx, &rx); in bmi08x_accel_transceive_spi()
127 return spi_write_dt(&bmi08x->bus.spi, &tx); in bmi08x_accel_transceive_spi()
158 return spi_is_ready_dt(&bus->spi) ? 0 : -ENODEV; in bmi08x_bus_check_spi()
190 const struct bmi08x_accel_config *config = dev->config; in bmi08x_bus_check()
192 return config->api->check(&config->bus); in bmi08x_bus_check()
197 const struct bmi08x_accel_config *config = dev->config; in bmi08x_bus_init()
200 if (config->api->bus_init) { in bmi08x_bus_init()
201 return config->api->bus_init(dev); in bmi08x_bus_init()
209 const struct bmi08x_accel_config *config = dev->config; in bmi08x_accel_transceive()
211 return config->api->transceive(dev, reg, write, data, length); in bmi08x_accel_transceive()
299 struct bmi08x_accel_data *data = dev->data; in bmi08x_acc_range_set()
300 int32_t reg_val = -1; in bmi08x_acc_range_set()
303 if (data->accel_chip_id == BMI085_ACCEL_CHIP_ID) { in bmi08x_acc_range_set()
306 } else if (data->accel_chip_id == BMI088_ACCEL_CHIP_ID) { in bmi08x_acc_range_set()
310 return -ENODEV; in bmi08x_acc_range_set()
322 data->scale = BMI08X_ACC_SCALE(range); in bmi08x_acc_range_set()
334 return bmi08x_acc_odr_set(dev, val->val1, val->val2 / 1000); in bmi08x_acc_config()
337 return -ENOTSUP; in bmi08x_acc_config()
349 return -EBUSY; in bmi08x_attr_set()
361 return -ENOTSUP; in bmi08x_attr_set()
367 struct bmi08x_accel_data *data = dev->data; in bmi08x_sample_fetch()
373 return -ENOTSUP; in bmi08x_sample_fetch()
381 return -EBUSY; in bmi08x_sample_fetch()
387 ret = bmi08x_accel_read(dev, BMI08X_REG_ACCEL_X_LSB, (uint8_t *)data->acc_sample, in bmi08x_sample_fetch()
388 sizeof(data->acc_sample)); in bmi08x_sample_fetch()
395 for (i = 0; i < ARRAY_SIZE(data->acc_sample); i++) { in bmi08x_sample_fetch()
396 data->acc_sample[i] = sys_le16_to_cpu(data->acc_sample[i]); in bmi08x_sample_fetch()
409 * max(raw_val) = +/- 2^15 in bmi08x_to_fixed_point()
414 val->val1 = converted_val / 1000000; in bmi08x_to_fixed_point()
415 val->val2 = converted_val % 1000000; in bmi08x_to_fixed_point()
448 struct bmi08x_accel_data *data = dev->data; in bmi08x_acc_channel_get()
450 bmi08x_channel_convert(chan, data->scale, data->acc_sample, val); in bmi08x_acc_channel_get()
467 val->val1 = temp_micro / 1000000ULL; in bmi08x_temp_channel_get()
468 val->val2 = temp_micro % 1000000ULL; in bmi08x_temp_channel_get()
481 return -EBUSY; in bmi08x_channel_get()
496 return -ENOTSUP; in bmi08x_channel_get()
519 return -ENOTSUP; in bmi08x_accel_pm_action()
551 const struct bmi08x_accel_config *config = dev->config; in bmi08x_apply_sync_binary_config()
578 if (config->api->write_config_file(dev) != 0) { in bmi08x_apply_sync_binary_config()
580 return -EIO; in bmi08x_apply_sync_binary_config()
602 return -EIO; in bmi08x_apply_sync_binary_config()
613 fdata[4] = config->data_sync; in bmi08x_apply_sync_binary_config()
636 const struct bmi08x_accel_config *config = dev->config; in bmi08x_accel_init()
637 struct bmi08x_accel_data *data = dev->data; in bmi08x_accel_init()
643 LOG_ERR("Bus not ready for '%s'", dev->name); in bmi08x_accel_init()
658 LOG_ERR("Can't initialize bus for %s", dev->name); in bmi08x_accel_init()
670 return -ENODEV; in bmi08x_accel_init()
672 data->accel_chip_id = val; in bmi08x_accel_init()
689 if (config->data_sync != 0) { in bmi08x_accel_init()
701 ret = bmi08x_acc_range_set(dev, config->accel_fs); in bmi08x_accel_init()
710 config->accel_hz); in bmi08x_accel_init()
738 /* verify the bmi08x-accel is paired with a bmi08x-gyro */
741 "bmi08x-accel data sync not paired with a bmi08x-gyro")
743 * verify data sync odr, the only valid odr combinitions with the gyro are
744 * (gyro-hz == "400_47" and accel-hz == "400") or (gyro-hz == "1000_116" and accel-hz == "800")
745 * or ((gyro-hz == "2000_230" or gyro-hz == "2000_532") and accel-hz == "1600")
755 "Invalid gyro and accel odr for data-sync")
756 /* Assert if the gyro does not have data-sync enabled */
759 "paired bmi08x-gyro does not have data-sync enabled")
761 /* infer the data-sync value from the gyro and accel odr 2000=1, 1000=2, 400=3, otherwise it is 0 if