diff options
author | LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn> | 2022-05-26 13:33:57 +0000 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-06-11 14:35:28 +0100 |
commit | 7a61456c83b368436ebd9e4ffe8c98d4062d3e73 (patch) | |
tree | 3b4e2b0fd4888f452e72646a3d79d501ab63f2ad /drivers/iio/accel | |
parent | 67ac266db853d9f1c20b94a411c0a3abfd90a589 (diff) | |
download | linux-stable-7a61456c83b368436ebd9e4ffe8c98d4062d3e73.tar.gz linux-stable-7a61456c83b368436ebd9e4ffe8c98d4062d3e73.tar.bz2 linux-stable-7a61456c83b368436ebd9e4ffe8c98d4062d3e73.zip |
iio: accel: bmi088: Add support for bmi085 accel
Add supports for BMI085, an Inertial Measurement Unit,
with an accelerometer and gyroscope.
The commit adds the accelerometer driver for the SPI interface.
The gyroscope part is already supported by the BMG160 driver.
Unlike BMI088, the BMI085 accelerometer ranges are +/-2, 4, 6,
and 8g, the scales are calculated as 9.8/32768*pow(2,reg41+1).
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
Link: https://lore.kernel.org/r/20220526133359.2261928-5-Qing-wu.Li@leica-geosystems.com.cn
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/accel')
-rw-r--r-- | drivers/iio/accel/bmi088-accel-core.c | 7 | ||||
-rw-r--r-- | drivers/iio/accel/bmi088-accel-spi.c | 2 | ||||
-rw-r--r-- | drivers/iio/accel/bmi088-accel.h | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/drivers/iio/accel/bmi088-accel-core.c b/drivers/iio/accel/bmi088-accel-core.c index 2b3f34594099..977e1653472d 100644 --- a/drivers/iio/accel/bmi088-accel-core.c +++ b/drivers/iio/accel/bmi088-accel-core.c @@ -465,6 +465,13 @@ static const struct iio_chan_spec bmi088_accel_channels[] = { }; static const struct bmi088_accel_chip_info bmi088_accel_chip_info_tbl[] = { + [BOSCH_BMI085] = { + .name = "bmi085-accel", + .chip_id = 0x1F, + .channels = bmi088_accel_channels, + .num_channels = ARRAY_SIZE(bmi088_accel_channels), + .scale_table = {{0, 598}, {0, 1196}, {0, 2393}, {0, 4785}}, + }, [BOSCH_BMI088] = { .name = "bmi088-accel", .chip_id = 0x1E, diff --git a/drivers/iio/accel/bmi088-accel-spi.c b/drivers/iio/accel/bmi088-accel-spi.c index 3831e2df860f..6a5d17ebcf6e 100644 --- a/drivers/iio/accel/bmi088-accel-spi.c +++ b/drivers/iio/accel/bmi088-accel-spi.c @@ -62,12 +62,14 @@ static void bmi088_accel_remove(struct spi_device *spi) } static const struct of_device_id bmi088_of_match[] = { + { .compatible = "bosch,bmi085-accel" }, { .compatible = "bosch,bmi088-accel" }, {} }; MODULE_DEVICE_TABLE(of, bmi088_of_match); static const struct spi_device_id bmi088_accel_id[] = { + {"bmi085-accel", BOSCH_BMI085}, {"bmi088-accel", BOSCH_BMI088}, {} }; diff --git a/drivers/iio/accel/bmi088-accel.h b/drivers/iio/accel/bmi088-accel.h index 65338a1bf97d..044999eb4fd6 100644 --- a/drivers/iio/accel/bmi088-accel.h +++ b/drivers/iio/accel/bmi088-accel.h @@ -9,6 +9,7 @@ struct device; enum bmi_device_type { + BOSCH_BMI085, BOSCH_BMI088, BOSCH_UNKNOWN, }; |