iio: imu: st_lsm6dsx: add support to LSM6DSOP
authorLorenzo Bianconi <lorenzo@kernel.org>
Sun, 29 Nov 2020 09:43:06 +0000 (10:43 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 3 Dec 2020 19:40:24 +0000 (19:40 +0000)
Add support to STM LSM6DSOP (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/lsm6dsop.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/d3c459ad945ccd1a256f4a217128be214b0c024e.1606642528.git.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_buffer.c
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 76c7abbd1ae8a15c8bcd4399a235cb31459908f3..85860217aaf3a5f0a94d08e0eb4b2e425a7e8845 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, lsm6dsrx, lsm6ds0, the accelerometer/gyroscope
+         ism330dhcx, lsm6dsrx, lsm6ds0, lsm6dsop, the accelerometer/gyroscope
          of lsm9ds1 and lsm6dst.
 
          To compile this driver as a module, choose M here: the module
index b81da6053b3c341b419da2b6e37c91cf70213d15..5ef55763a6cc24ef4b99e5b95b52e4d18a7d3218 100644 (file)
@@ -30,6 +30,7 @@
 #define ST_LSM6DS0_DEV_NAME    "lsm6ds0"
 #define ST_LSM6DSRX_DEV_NAME   "lsm6dsrx"
 #define ST_LSM6DST_DEV_NAME    "lsm6dst"
+#define ST_LSM6DSOP_DEV_NAME   "lsm6dsop"
 
 enum st_lsm6dsx_hw_id {
        ST_LSM6DS3_ID,
@@ -47,6 +48,7 @@ enum st_lsm6dsx_hw_id {
        ST_LSM6DS0_ID,
        ST_LSM6DSRX_ID,
        ST_LSM6DST_ID,
+       ST_LSM6DSOP_ID,
        ST_LSM6DSX_MAX_ID,
 };
 
index 49923503b75aef66d43370f1428ae8f5304bf50c..f1103ecedd6494b2d1165708d8e65e24a81fbda5 100644 (file)
@@ -14,7 +14,7 @@
  * (e.g. Gx, Gy, Gz, Ax, Ay, Az), then data are repeated depending on the
  * value of the decimation factor and ODR set for each FIFO data set.
  *
- * LSM6DSO/LSM6DSOX/ASM330LHH/LSM6DSR/LSM6DSRX/ISM330DHCX/LSM6DST:
+ * LSM6DSO/LSM6DSOX/ASM330LHH/LSM6DSR/LSM6DSRX/ISM330DHCX/LSM6DST/LSM6DSOP:
  * The FIFO buffer can be configured to store data from gyroscope and
  * accelerometer. Each sample is queued with a tag (1B) indicating data
  * source (gyroscope, accelerometer, hw timer).
index c05910fa0de6397f7e6add44c6264352cae7984a..467214e2e77cac8e45ca9cf2b156766767f3474b 100644 (file)
@@ -26,7 +26,7 @@
  *   - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
  *   - FIFO size: 4KB
  *
- * - LSM6DSO/LSM6DSOX/ASM330LHH/LSM6DSR/ISM330DHCX/LSM6DST:
+ * - LSM6DSO/LSM6DSOX/ASM330LHH/LSM6DSR/ISM330DHCX/LSM6DST/LSM6DSOP:
  *   - Accelerometer/Gyroscope supported ODR [Hz]: 13, 26, 52, 104, 208, 416,
  *     833
  *   - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
@@ -990,6 +990,10 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
                                .hw_id = ST_ASM330LHH_ID,
                                .name = ST_ASM330LHH_DEV_NAME,
                                .wai = 0x6b,
+                       }, {
+                               .hw_id = ST_LSM6DSOP_ID,
+                               .name = ST_LSM6DSOP_DEV_NAME,
+                               .wai = 0x6c,
                        },
                },
                .channels = {
index e0f945dde12da992770e4db15e0e7acc1de97e68..ec8d4351390aa034b01856cc741304b946ec7e8e 100644 (file)
@@ -98,6 +98,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = {
                .compatible = "st,lsm6dst",
                .data = (void *)ST_LSM6DST_ID,
        },
+       {
+               .compatible = "st,lsm6dsop",
+               .data = (void *)ST_LSM6DSOP_ID,
+       },
        {},
 };
 MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match);
@@ -118,6 +122,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = {
        { ST_LSM6DS0_DEV_NAME, ST_LSM6DS0_ID },
        { ST_LSM6DSRX_DEV_NAME, ST_LSM6DSRX_ID },
        { ST_LSM6DST_DEV_NAME, ST_LSM6DST_ID },
+       { ST_LSM6DSOP_DEV_NAME, ST_LSM6DSOP_ID },
        {},
 };
 MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table);
index c57895be8afe7333b9fe95f68d7c4c2913702b53..349ec9c1890dd86038b3b80cfbff817cf2ea12fd 100644 (file)
@@ -98,6 +98,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = {
                .compatible = "st,lsm6dst",
                .data = (void *)ST_LSM6DST_ID,
        },
+       {
+               .compatible = "st,lsm6dsop",
+               .data = (void *)ST_LSM6DSOP_ID,
+       },
        {},
 };
 MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match);
@@ -118,6 +122,7 @@ static const struct spi_device_id st_lsm6dsx_spi_id_table[] = {
        { ST_LSM6DS0_DEV_NAME, ST_LSM6DS0_ID },
        { ST_LSM6DSRX_DEV_NAME, ST_LSM6DSRX_ID },
        { ST_LSM6DST_DEV_NAME, ST_LSM6DST_ID },
+       { ST_LSM6DSOP_DEV_NAME, ST_LSM6DSOP_ID },
        {},
 };
 MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table);