iio: imu: st_lsm6dsx: add support to ISM330DHCX
authorLorenzo Bianconi <lorenzo@kernel.org>
Mon, 5 Aug 2019 10:18:43 +0000 (12:18 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 5 Aug 2019 14:22:43 +0000 (15:22 +0100)
Add support to STM ISM330DHCX 6-axis (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/ism330dhcx.pdf

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_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 6cbf65a..939058b 100644 (file)
@@ -11,7 +11,8 @@ config IIO_ST_LSM6DSX
        help
          Say yes here to build support for STMicroelectronics LSM6DSx imu
          sensor. Supported devices: lsm6ds3, lsm6ds3h, lsm6dsl, lsm6dsm,
-         ism330dlc, lsm6dso, lsm6dsox, asm330lhh, lsm6dsr, lsm6ds3tr-c
+         ism330dlc, lsm6dso, lsm6dsox, asm330lhh, lsm6dsr, lsm6ds3tr-c,
+         ism330dhcx
 
          To compile this driver as a module, choose M here: the module
          will be called st_lsm6dsx.
index 5090f1b..4d47ba3 100644 (file)
@@ -23,6 +23,7 @@
 #define ST_LSM6DSOX_DEV_NAME   "lsm6dsox"
 #define ST_LSM6DSR_DEV_NAME    "lsm6dsr"
 #define ST_LSM6DS3TRC_DEV_NAME "lsm6ds3tr-c"
+#define ST_ISM330DHCX_DEV_NAME "ism330dhcx"
 
 enum st_lsm6dsx_hw_id {
        ST_LSM6DS3_ID,
@@ -35,6 +36,7 @@ enum st_lsm6dsx_hw_id {
        ST_LSM6DSOX_ID,
        ST_LSM6DSR_ID,
        ST_LSM6DS3TRC_ID,
+       ST_ISM330DHCX_ID,
        ST_LSM6DSX_MAX_ID,
 };
 
index 1be1cec..2c03a5b 100644 (file)
  * (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: 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).
+ * LSM6DSO/LSM6DSOX/ASM330LHH/LSM6DSR/ISM330DHCX: 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).
  *
  * FIFO supported modes:
  *  - BYPASS: FIFO disabled
index fc4d18b..85824d6 100644 (file)
@@ -24,7 +24,7 @@
  *   - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
  *   - FIFO size: 4KB
  *
- * - LSM6DSO/LSM6DSOX/ASM330LHH/LSM6DSR
+ * - LSM6DSO/LSM6DSOX/ASM330LHH/LSM6DSR/ISM330DHCX:
  *   - Accelerometer/Gyroscope supported ODR [Hz]: 13, 26, 52, 104, 208, 416
  *   - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
  *   - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
@@ -645,6 +645,9 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
                        {
                                .hw_id = ST_LSM6DSR_ID,
                                .name = ST_LSM6DSR_DEV_NAME,
+                       }, {
+                               .hw_id = ST_ISM330DHCX_ID,
+                               .name = ST_ISM330DHCX_DEV_NAME,
                        },
                },
                .channels = {
index 28581eb..15c6aa5 100644 (file)
@@ -79,6 +79,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = {
                .compatible = "st,lsm6ds3tr-c",
                .data = (void *)ST_LSM6DS3TRC_ID,
        },
+       {
+               .compatible = "st,ism330dhcx",
+               .data = (void *)ST_ISM330DHCX_ID,
+       },
        {},
 };
 MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match);
@@ -94,6 +98,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = {
        { ST_LSM6DSOX_DEV_NAME, ST_LSM6DSOX_ID },
        { ST_LSM6DSR_DEV_NAME, ST_LSM6DSR_ID },
        { ST_LSM6DS3TRC_DEV_NAME, ST_LSM6DS3TRC_ID },
+       { ST_ISM330DHCX_DEV_NAME, ST_ISM330DHCX_ID },
        {},
 };
 MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table);
index 0371e8b..a8430ee 100644 (file)
@@ -79,6 +79,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = {
                .compatible = "st,lsm6ds3tr-c",
                .data = (void *)ST_LSM6DS3TRC_ID,
        },
+       {
+               .compatible = "st,ism330dhcx",
+               .data = (void *)ST_ISM330DHCX_ID,
+       },
        {},
 };
 MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match);
@@ -94,6 +98,7 @@ static const struct spi_device_id st_lsm6dsx_spi_id_table[] = {
        { ST_LSM6DSOX_DEV_NAME, ST_LSM6DSOX_ID },
        { ST_LSM6DSR_DEV_NAME, ST_LSM6DSR_ID },
        { ST_LSM6DS3TRC_DEV_NAME, ST_LSM6DS3TRC_ID },
+       { ST_ISM330DHCX_DEV_NAME, ST_ISM330DHCX_ID },
        {},
 };
 MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table);