Lines Matching +full:datasheet +full:- +full:recommended
1 // SPDX-License-Identifier: GPL-2.0
3 * 3-axis accelerometer driver supporting following Bosch-Sensortec chips:
4 * - BMI088
5 * - BMI085
6 * - BMI090L
8 * Copyright (c) 2018-2021, Topic Embedded Products
23 #include "bmi088-accel.h"
98 /* Available OSR (over sampling rate) sets the 3dB cut-off frequency */
134 /* Mark the RESET as volatile too, it is self-clearing */
157 ret = regmap_write(data->regmap, BMI088_ACCEL_REG_PWR_CTRL, 0x4);
161 /* Datasheet recommends to wait at least 5ms before communication */
165 ret = regmap_write(data->regmap, BMI088_ACCEL_REG_PWR_CONF, 0x0);
169 /* Recommended at least 1ms before further communication */
180 ret = regmap_write(data->regmap, BMI088_ACCEL_REG_PWR_CONF, 0x3);
184 /* Recommended at least 1ms before further communication */
188 ret = regmap_write(data->regmap, BMI088_ACCEL_REG_PWR_CTRL, 0x0);
192 /* Datasheet recommends to wait at least 5ms before communication */
204 ret = regmap_read(data->regmap, BMI088_ACCEL_REG_ACC_CONF,
210 value -= BMI088_ACCEL_MODE_ODR_12_5;
213 if (value >= ARRAY_SIZE(bmi088_sample_freqs) - 1)
214 return -EINVAL;
232 return -EINVAL;
236 return regmap_update_bits(data->regmap, BMI088_ACCEL_REG_ACC_CONF,
245 if (val == data->chip_info->scale_table[i][0] &&
246 val2 == data->chip_info->scale_table[i][1])
250 return -EINVAL;
252 return regmap_write(data->regmap, BMI088_ACCEL_REG_ACC_RANGE, i);
260 ret = regmap_bulk_read(data->regmap, BMI088_ACCEL_REG_TEMP,
261 &data->buffer, sizeof(__be16));
265 /* data->buffer is cacheline aligned */
266 temp = be16_to_cpu(*(__be16 *)data->buffer);
280 ret = regmap_bulk_read(data->regmap,
281 BMI088_ACCEL_AXIS_TO_REG(chan->scan_index),
282 data->buffer, sizeof(__le16));
286 raw_val = le16_to_cpu(*(__le16 *)data->buffer);
297 struct device *dev = regmap_get_device(data->regmap);
303 switch (chan->type) {
317 ret = -EBUSY;
328 return -EINVAL;
331 switch (chan->type) {
337 return -EINVAL;
340 switch (chan->type) {
350 ret = regmap_read(data->regmap,
356 *val = data->chip_info->scale_table[reg][0];
357 *val2 = data->chip_info->scale_table[reg][1];
362 return -EINVAL;
375 return -EINVAL;
393 *vals = (const int *)data->chip_info->scale_table;
403 return -EINVAL;
412 struct device *dev = regmap_get_device(data->regmap);
435 return -EINVAL;
457 .scan_index = -1,
467 .name = "bmi085-accel",
474 .name = "bmi088-accel",
481 .name = "bmi090l-accel",
502 struct device *dev = regmap_get_device(data->regmap);
507 return -ENODEV;
510 regmap_read(data->regmap, BMI088_ACCEL_REG_INT_STATUS, &val);
516 ret = regmap_write(data->regmap, BMI088_ACCEL_REG_RESET,
524 regmap_read(data->regmap, BMI088_ACCEL_REG_INT_STATUS, &val);
527 ret = regmap_read(data->regmap, BMI088_ACCEL_REG_CHIP_ID, &val);
539 data->chip_info = &bmi088_accel_chip_info_tbl[type];
541 data->chip_info = &bmi088_accel_chip_info_tbl[i];
558 return -ENOMEM;
563 data->regmap = regmap;
569 indio_dev->channels = data->chip_info->channels;
570 indio_dev->num_channels = data->chip_info->num_channels;
571 indio_dev->name = data->chip_info->name;
572 indio_dev->available_scan_masks = bmi088_accel_scan_masks;
573 indio_dev->modes = INDIO_DIRECT_MODE;
574 indio_dev->info = &bmi088_accel_info;