iio: imu: inv_mpu6050: Add support for ICM-20608-D
authorMichael Srba <Michael.Srba@seznam.cz>
Wed, 23 Mar 2022 12:15:50 +0000 (13:15 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 4 Apr 2022 08:11:24 +0000 (09:11 +0100)
The difference between the ICM-20608-D and the other ICM-20608
variants is the addition of a DMP (Digital Motion Processor) core.
This difference is deemed substantial enough to change the WHOAMI
register value.
Since this driver doesn't currently acknowledge the exisence of
something like a DMP core, simply copy ICM-20608 except for the
aforementioned WHOAMI register.

Signed-off-by: Michael Srba <Michael.Srba@seznam.cz>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://lore.kernel.org/r/20220323121550.16096-3-michael.srba@seznam.cz
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/inv_mpu6050/Kconfig
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c

index 9c62551..3636b1b 100644 (file)
@@ -16,7 +16,7 @@ config INV_MPU6050_I2C
        select REGMAP_I2C
        help
          This driver supports the Invensense MPU6050/9150,
-         MPU6500/6515/6880/9250/9255, ICM20608/20609/20689, ICM20602/ICM20690
+         MPU6500/6515/6880/9250/9255, ICM20608(D)/20609/20689, ICM20602/ICM20690
          and IAM20680 motion tracking devices over I2C.
          This driver can be built as a module. The module will be called
          inv-mpu6050-i2c.
@@ -28,7 +28,7 @@ config INV_MPU6050_SPI
        select REGMAP_SPI
        help
          This driver supports the Invensense MPU6000,
-         MPU6500/6515/6880/9250/9255, ICM20608/20609/20689, ICM20602/ICM20690
+         MPU6500/6515/6880/9250/9255, ICM20608(D)/20609/20689, ICM20602/ICM20690
          and IAM20680 motion tracking devices over SPI.
          This driver can be built as a module. The module will be called
          inv-mpu6050-spi.
index 597768c..86fbbe9 100644 (file)
@@ -218,6 +218,15 @@ static const struct inv_mpu6050_hw hw_info[] = {
                .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
        },
        {
+               .whoami = INV_ICM20608D_WHOAMI_VALUE,
+               .name = "ICM20608D",
+               .reg = &reg_set_6500,
+               .config = &chip_config_6500,
+               .fifo_size = 512,
+               .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+               .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
+       },
+       {
                .whoami = INV_ICM20609_WHOAMI_VALUE,
                .name = "ICM20609",
                .reg = &reg_set_6500,
index 55cffb5..2aa6477 100644 (file)
@@ -29,6 +29,7 @@ static bool inv_mpu_i2c_aux_bus(struct device *dev)
 
        switch (st->chip_type) {
        case INV_ICM20608:
+       case INV_ICM20608D:
        case INV_ICM20609:
        case INV_ICM20689:
        case INV_ICM20602:
@@ -182,6 +183,7 @@ static const struct i2c_device_id inv_mpu_id[] = {
        {"mpu9250", INV_MPU9250},
        {"mpu9255", INV_MPU9255},
        {"icm20608", INV_ICM20608},
+       {"icm20608d", INV_ICM20608D},
        {"icm20609", INV_ICM20609},
        {"icm20689", INV_ICM20689},
        {"icm20602", INV_ICM20602},
@@ -226,6 +228,10 @@ static const struct of_device_id inv_of_match[] = {
                .data = (void *)INV_ICM20608
        },
        {
+               .compatible = "invensense,icm20608d",
+               .data = (void *)INV_ICM20608D
+       },
+       {
                .compatible = "invensense,icm20609",
                .data = (void *)INV_ICM20609
        },
index c6aa36e..8e14f20 100644 (file)
@@ -76,6 +76,7 @@ enum inv_devices {
        INV_MPU9250,
        INV_MPU9255,
        INV_ICM20608,
+       INV_ICM20608D,
        INV_ICM20609,
        INV_ICM20689,
        INV_ICM20602,
@@ -394,6 +395,7 @@ struct inv_mpu6050_state {
 #define INV_MPU9255_WHOAMI_VALUE               0x73
 #define INV_MPU6515_WHOAMI_VALUE               0x74
 #define INV_ICM20608_WHOAMI_VALUE              0xAF
+#define INV_ICM20608D_WHOAMI_VALUE             0xAE
 #define INV_ICM20609_WHOAMI_VALUE              0xA6
 #define INV_ICM20689_WHOAMI_VALUE              0x98
 #define INV_ICM20602_WHOAMI_VALUE              0x12
index 26a7c25..e6107b0 100644 (file)
@@ -73,6 +73,7 @@ static const struct spi_device_id inv_mpu_id[] = {
        {"mpu9250", INV_MPU9250},
        {"mpu9255", INV_MPU9255},
        {"icm20608", INV_ICM20608},
+       {"icm20608d", INV_ICM20608D},
        {"icm20609", INV_ICM20609},
        {"icm20689", INV_ICM20689},
        {"icm20602", INV_ICM20602},
@@ -113,6 +114,10 @@ static const struct of_device_id inv_of_match[] = {
                .data = (void *)INV_ICM20608
        },
        {
+               .compatible = "invensense,icm20608d",
+               .data = (void *)INV_ICM20608D
+       },
+       {
                .compatible = "invensense,icm20609",
                .data = (void *)INV_ICM20609
        },