diff options
author | Marius Hoch <mail@mariushoch.de> | 2023-04-16 01:11:27 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2023-05-13 17:56:04 +0100 |
commit | c0f68439ae06c8612e4d64e24b70a5c82fcdede6 (patch) | |
tree | daa9e08c4dbbcce6aefe9b0e383020bc99800a15 | |
parent | a9e19f636036567284ef41008b930f5730acd974 (diff) |
iio: st_sensors: Add lsm303d support to the LSM9DS0 IMU driver
The lsm303d is basically the lsm9ds0 without the gyroscope
(which the LSM9DS0 IMU driver doesn't handle), as far as I
can tell.
Signed-off-by: Marius Hoch <mail@mariushoch.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Hans de Goede <hansg@kernel.org>
Link: https://lore.kernel.org/r/20230415231130.115094-4-mail@mariushoch.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r-- | drivers/iio/imu/st_lsm9ds0/Kconfig | 3 | ||||
-rw-r--r-- | drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c | 5 | ||||
-rw-r--r-- | drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c | 5 |
3 files changed, 12 insertions, 1 deletions
diff --git a/drivers/iio/imu/st_lsm9ds0/Kconfig b/drivers/iio/imu/st_lsm9ds0/Kconfig index d29558edee60..7aef714b6ecb 100644 --- a/drivers/iio/imu/st_lsm9ds0/Kconfig +++ b/drivers/iio/imu/st_lsm9ds0/Kconfig @@ -10,7 +10,8 @@ config IIO_ST_LSM9DS0 help Say yes here to build support for STMicroelectronics LSM9DS0 IMU - sensor. Supported devices: accelerometer/magnetometer of lsm9ds0. + sensor. Supported devices: accelerometer/magnetometer of lsm9ds0 + and lsm303d. To compile this driver as a module, choose M here: the module will be called st_lsm9ds0. diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c index a90138d8b06a..611515c6a73d 100644 --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c @@ -19,6 +19,10 @@ static const struct of_device_id st_lsm9ds0_of_match[] = { { + .compatible = "st,lsm303d-imu", + .data = LSM303D_IMU_DEV_NAME, + }, + { .compatible = "st,lsm9ds0-imu", .data = LSM9DS0_IMU_DEV_NAME, }, @@ -27,6 +31,7 @@ static const struct of_device_id st_lsm9ds0_of_match[] = { MODULE_DEVICE_TABLE(of, st_lsm9ds0_of_match); static const struct i2c_device_id st_lsm9ds0_id_table[] = { + { LSM303D_IMU_DEV_NAME }, { LSM9DS0_IMU_DEV_NAME }, {} }; diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c index b743bf3546a7..8cc041d56cf7 100644 --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c @@ -19,6 +19,10 @@ static const struct of_device_id st_lsm9ds0_of_match[] = { { + .compatible = "st,lsm303d-imu", + .data = LSM303D_IMU_DEV_NAME, + }, + { .compatible = "st,lsm9ds0-imu", .data = LSM9DS0_IMU_DEV_NAME, }, @@ -27,6 +31,7 @@ static const struct of_device_id st_lsm9ds0_of_match[] = { MODULE_DEVICE_TABLE(of, st_lsm9ds0_of_match); static const struct spi_device_id st_lsm9ds0_id_table[] = { + { LSM303D_IMU_DEV_NAME }, { LSM9DS0_IMU_DEV_NAME }, {} }; |