summaryrefslogtreecommitdiff
path: root/drivers/iio/accel/bmi088-accel-core.c
AgeCommit message (Collapse)AuthorFilesLines
2023-12-17iio: accel: bmi088: update comments and KconfigJun Yan1-0/+2
update the comments and Kconfig file with more descriptive and accurate information about newly added device: BMI085, BMI090L. Signed-off-by: Jun Yan <jerrysteve1101@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-09-21iio: accel: bmi088: Use EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS() and pm_ptr()Jonathan Cameron1-9/+6
These macros allow the compiler to remove unused pm ops functions without needing to mark them maybe unused. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn> Cc: Mike Looijmans <mike.looijmans@topic.nl> Link: https://lore.kernel.org/r/20220807185618.1038812-6-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-06-14iio: accel: bmi088: Fix alignment for DMA safetyJonathan Cameron1-1/+1
____cacheline_aligned is insufficient guarantee for non-coherent DMA. Switch to the updated IIO_DMA_MINALIGN definition. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20220508175712.647246-7-jic23@kernel.org
2022-06-11iio: accel: bmi088: Add support for bmi090l accelLI Qingwu1-0/+7
Add supports for BMI090L, it's a high-performance 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. Same as BMI088, BMI090L have the range of +/-3, 6, 12, and 24g. 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-6-Qing-wu.Li@leica-geosystems.com.cn Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-06-11iio: accel: bmi088: Add support for bmi085 accelLI Qingwu1-0/+7
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>
2022-06-11iio: accel: bmi088: modified the device nameLI Qingwu1-15/+20
iio: accel: bmi088: modified the device name It is possible to have multiple sensors connected on the same platform. For support of different sensors, making it possible to obtain the device name by reading the chip id. If the device was found in the table but the device tree binding is different, the driver will carry on with a warning. If no matching device was found, the driver load the binding chip info. Tested case, test with bmi085 and bmi090 patches applied: connect 3 bmi090l to the system, and set device tree compatible: spi2.0: compatible = "bosch,bmi090l-accel"; spi2.2: compatible = "bosch,bmi088-accel"; spi2.4: compatible = "bosch,bmi085-accel"; Get a warning for the mismatched devices: bmi088_accel_spi spi2.2: unexpected chip id 0x1A bmi088_accel_spi spi2.4: unexpected chip id 0x1A Get the real present device name: /sys/bus/iio/devices/iio:device1/name:bmi090l-accel /sys/bus/iio/devices/iio:device3/name:bmi090l-accel /sys/bus/iio/devices/iio:device5/name:bmi090l-accel Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn> Link: https://lore.kernel.org/r/20220526133359.2261928-4-Qing-wu.Li@leica-geosystems.com.cn Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-06-11iio: accel: bmi088: Make it possible to config scalesLI Qingwu1-1/+32
The sensor can set the scales by writing the range register 0x41, The current driver has no interface to configure it. The commit adds the interface for config the scales. 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-3-Qing-wu.Li@leica-geosystems.com.cn Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-06-11iio: accel: bmi088: Modified the scale calculateLI Qingwu1-4/+11
The units after application of scale are 100*m/s^2, The scale calculation is only for the device with the range of 3, 6, 12, and 24g, but some other chips have a range of 2, 4, 6, and 8g. Modified the scales from formula to a list, the scales in the list are calculated as 9.8/32768*pow(2,reg41+1)*1.5, refer to datasheet 5.3.4. The new units after the application of scale are m/s^2. 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-2-Qing-wu.Li@leica-geosystems.com.cn Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-02-18iio:accel:bmi088: Move exports into IIO_BMI088 namespaceJonathan Cameron1-4/+4
To avoid unnecessary pollution of the global symbol namespace move the driver core exports into their own namespace and import that into the two bus modules. For more info see https://lwn.net/Articles/760045/ Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Mike Looijmans <mike.looijmans@topic.nl> Link: https://lore.kernel.org/r/20220116180535.2367780-11-jic23@kernel.org
2021-10-19iio: accel: bmi088: Make bmi088_accel_core_remove() return voidUwe Kleine-König1-3/+1
Up to now bmi088_accel_core_remove() returns zero unconditionally. Make it return void instead which makes it easier to see in the callers that there is no error to handle. Also the return value of spi remove callbacks is ignored anyway. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20211013203223.2694577-4-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-05-17iio: accel: bmi088: Balance runtime pm + use pm_runtime_resume_and_get()Jonathan Cameron1-6/+20
The call to pm_runtime_put_noidle() in remove() is not balanced by a get so drop it. Using pm_runtime_resume_and_get() allows for simple introduction of error handling to allow for runtime resume failing. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Mike Looijmans <mike.looijmans@topic.nl> Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/20210509113354.660190-13-jic23@kernel.org
2021-05-17iio: accel: bmi088: Drop manual assignment of iio_dev.dev.parentJonathan Cameron1-1/+0
The core already set this to the same value in devm_iio_device_alloc() Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Mike Looijmans <mike.looijmans@topic.nl> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20210426170251.351957-2-jic23@kernel.org
2021-03-11iio: accel: Add support for the Bosch-Sensortec BMI088Mike Looijmans1-0/+567
The BMI088 is a combined module with both accelerometer and gyroscope. This adds the accelerometer driver support for the SPI interface. The gyroscope part is already supported by the BMG160 driver. Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20210125150732.23873-2-mike.looijmans@topic.nl Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>