iio: imu: mpu6050: Add support for the ICM 20600 IMU
authorHermes Zhang <chenhuiz@axis.com>
Fri, 5 May 2023 05:48:53 +0000 (13:48 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 13 May 2023 17:57:36 +0000 (18:57 +0100)
The Invensense ICM-20600 is a 6-axis MotionTracking device that combines a
3-axis gyroscope and an 3-axis accelerometer. It is very similar to the
ICM20602 imu which is already supported by the mpu6050 driver. The main
difference is that the ICM-20600 has a different WHOAMI value.

Signed-off-by: Hermes Zhang <chenhuiz@axis.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://lore.kernel.org/r/20230505054853.2155326-3-chenhuiz@axis.com
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 3636b1bc90f1c2dcf3c899ab2776cf834b00a284..64dd73dcc4bab48fe611e819d5b706c9f5078a10 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(D)/20609/20689, ICM20602/ICM20690
+         MPU6500/6515/6880/9250/9255, ICM20608(D)/20609/20689, ICM20600/20602/20690
          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(D)/20609/20689, ICM20602/ICM20690
+         MPU6500/6515/6880/9250/9255, ICM20608(D)/20609/20689, ICM20600/20602/20690
          and IAM20680 motion tracking devices over SPI.
          This driver can be built as a module. The module will be called
          inv-mpu6050-spi.
index 8a129120b73dd1f7fd1016ea7e5fc762d0a136ce..592a6e60b4131e0d79d091121fd5a1f0793d19ad 100644 (file)
@@ -244,6 +244,15 @@ static const struct inv_mpu6050_hw hw_info[] = {
                .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
                .startup_time = {INV_MPU6500_GYRO_STARTUP_TIME, INV_MPU6500_ACCEL_STARTUP_TIME},
        },
+       {
+               .whoami = INV_ICM20600_WHOAMI_VALUE,
+               .name = "ICM20600",
+               .reg = &reg_set_icm20602,
+               .config = &chip_config_6500,
+               .fifo_size = 1008,
+               .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+               .startup_time = {INV_ICM20602_GYRO_STARTUP_TIME, INV_ICM20602_ACCEL_STARTUP_TIME},
+       },
        {
                .whoami = INV_ICM20602_WHOAMI_VALUE,
                .name = "ICM20602",
@@ -1597,6 +1606,7 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
                indio_dev->num_channels = ARRAY_SIZE(inv_mpu9250_channels);
                indio_dev->available_scan_masks = inv_mpu9x50_scan_masks;
                break;
+       case INV_ICM20600:
        case INV_ICM20602:
                indio_dev->channels = inv_mpu_channels;
                indio_dev->num_channels = ARRAY_SIZE(inv_mpu_channels);
index 2f2da4cb732156fc4e7874027464ca17f2e4b9e7..0e39877678dfb4892621eb834c9a8cbff4486d37 100644 (file)
@@ -32,6 +32,7 @@ static bool inv_mpu_i2c_aux_bus(struct device *dev)
        case INV_ICM20608D:
        case INV_ICM20609:
        case INV_ICM20689:
+       case INV_ICM20600:
        case INV_ICM20602:
        case INV_IAM20680:
                /* no i2c auxiliary bus on the chip */
@@ -183,6 +184,7 @@ static const struct i2c_device_id inv_mpu_id[] = {
        {"icm20608d", INV_ICM20608D},
        {"icm20609", INV_ICM20609},
        {"icm20689", INV_ICM20689},
+       {"icm20600", INV_ICM20600},
        {"icm20602", INV_ICM20602},
        {"icm20690", INV_ICM20690},
        {"iam20680", INV_IAM20680},
@@ -236,6 +238,10 @@ static const struct of_device_id inv_of_match[] = {
                .compatible = "invensense,icm20689",
                .data = (void *)INV_ICM20689
        },
+       {
+               .compatible = "invensense,icm20600",
+               .data = (void *)INV_ICM20600
+       },
        {
                .compatible = "invensense,icm20602",
                .data = (void *)INV_ICM20602
index 94b54c501ec0a663c0a805a32201c379b018be0c..b4ab2c397d0fce92c9ed28f604d81b5fe8a9efb4 100644 (file)
@@ -79,6 +79,7 @@ enum inv_devices {
        INV_ICM20608D,
        INV_ICM20609,
        INV_ICM20689,
+       INV_ICM20600,
        INV_ICM20602,
        INV_ICM20690,
        INV_IAM20680,
@@ -398,6 +399,7 @@ struct inv_mpu6050_state {
 #define INV_ICM20608D_WHOAMI_VALUE             0xAE
 #define INV_ICM20609_WHOAMI_VALUE              0xA6
 #define INV_ICM20689_WHOAMI_VALUE              0x98
+#define INV_ICM20600_WHOAMI_VALUE              0x11
 #define INV_ICM20602_WHOAMI_VALUE              0x12
 #define INV_ICM20690_WHOAMI_VALUE              0x20
 #define INV_IAM20680_WHOAMI_VALUE              0xA9
index 89f46c2f213d8fb179075027cce6305ca6cc3dce..05451ca1580b637a66a30efe82fbd2a2b63e55d5 100644 (file)
@@ -76,6 +76,7 @@ static const struct spi_device_id inv_mpu_id[] = {
        {"icm20608d", INV_ICM20608D},
        {"icm20609", INV_ICM20609},
        {"icm20689", INV_ICM20689},
+       {"icm20600", INV_ICM20600},
        {"icm20602", INV_ICM20602},
        {"icm20690", INV_ICM20690},
        {"iam20680", INV_IAM20680},
@@ -125,6 +126,10 @@ static const struct of_device_id inv_of_match[] = {
                .compatible = "invensense,icm20689",
                .data = (void *)INV_ICM20689
        },
+       {
+               .compatible = "invensense,icm20600",
+               .data = (void *)INV_ICM20600
+       },
        {
                .compatible = "invensense,icm20602",
                .data = (void *)INV_ICM20602