iio: imu: st_lsm6dsx: add support to LSM6DS0
authorLorenzo Bianconi <lorenzo@kernel.org>
Mon, 7 Oct 2019 09:43:37 +0000 (11:43 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 15 Oct 2019 20:11:07 +0000 (21:11 +0100)
Add support to STM LSM6DS0 6-axis (acc + gyro) Mems sensor

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/st_lsm6dsx/Kconfig
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c

index 77aa0e7..b425a35 100644 (file)
@@ -12,7 +12,7 @@ config IIO_ST_LSM6DSX
          Say yes here to build support for STMicroelectronics LSM6DSx imu
          sensor. Supported devices: lsm6ds3, lsm6ds3h, lsm6dsl, lsm6dsm,
          ism330dlc, lsm6dso, lsm6dsox, asm330lhh, lsm6dsr, lsm6ds3tr-c,
-         ism330dhcx and the accelerometer/gyroscope of lsm9ds1.
+         ism330dhcx, lsm6ds0 and the accelerometer/gyroscope of lsm9ds1.
 
          To compile this driver as a module, choose M here: the module
          will be called st_lsm6dsx.
index 3dfd21f..f660359 100644 (file)
@@ -26,6 +26,7 @@
 #define ST_LSM6DS3TRC_DEV_NAME "lsm6ds3tr-c"
 #define ST_ISM330DHCX_DEV_NAME "ism330dhcx"
 #define ST_LSM9DS1_DEV_NAME    "lsm9ds1-imu"
+#define ST_LSM6DS0_DEV_NAME    "lsm6ds0"
 
 enum st_lsm6dsx_hw_id {
        ST_LSM6DS3_ID,
@@ -40,6 +41,7 @@ enum st_lsm6dsx_hw_id {
        ST_LSM6DS3TRC_ID,
        ST_ISM330DHCX_ID,
        ST_LSM9DS1_ID,
+       ST_LSM6DS0_ID,
        ST_LSM6DSX_MAX_ID,
 };
 
index 35b7431..f9c83aa 100644 (file)
@@ -32,7 +32,7 @@
  *   - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
  *   - FIFO size: 3KB
  *
- * - LSM9DS1:
+ * - LSM9DS1/LSM6DS0:
  *   - Accelerometer supported ODR [Hz]: 10, 50, 119, 238, 476, 952
  *   - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
  *   - Gyroscope supported ODR [Hz]: 15, 60, 119, 238, 476, 952
@@ -106,6 +106,9 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
                        {
                                .hw_id = ST_LSM9DS1_ID,
                                .name = ST_LSM9DS1_DEV_NAME,
+                       }, {
+                               .hw_id = ST_LSM6DS0_ID,
+                               .name = ST_LSM6DS0_DEV_NAME,
                        },
                },
                .channels = {
index f525110..e57744a 100644 (file)
@@ -87,6 +87,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = {
                .compatible = "st,lsm9ds1-imu",
                .data = (void *)ST_LSM9DS1_ID,
        },
+       {
+               .compatible = "st,lsm6ds0",
+               .data = (void *)ST_LSM6DS0_ID,
+       },
        {},
 };
 MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match);
@@ -104,6 +108,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = {
        { ST_LSM6DS3TRC_DEV_NAME, ST_LSM6DS3TRC_ID },
        { ST_ISM330DHCX_DEV_NAME, ST_ISM330DHCX_ID },
        { ST_LSM9DS1_DEV_NAME, ST_LSM9DS1_ID },
+       { ST_LSM6DS0_DEV_NAME, ST_LSM6DS0_ID },
        {},
 };
 MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table);
index 344b28d..933d4f9 100644 (file)
@@ -87,6 +87,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = {
                .compatible = "st,lsm9ds1-imu",
                .data = (void *)ST_LSM9DS1_ID,
        },
+       {
+               .compatible = "st,lsm6ds0",
+               .data = (void *)ST_LSM6DS0_ID,
+       },
        {},
 };
 MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match);
@@ -104,6 +108,7 @@ static const struct spi_device_id st_lsm6dsx_spi_id_table[] = {
        { ST_LSM6DS3TRC_DEV_NAME, ST_LSM6DS3TRC_ID },
        { ST_ISM330DHCX_DEV_NAME, ST_ISM330DHCX_ID },
        { ST_LSM9DS1_DEV_NAME, ST_LSM9DS1_ID },
+       { ST_LSM6DS0_DEV_NAME, ST_LSM6DS0_ID },
        {},
 };
 MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table);