iio: imu: inv_mpu6050: Add support for MPU-6880
authorStephan Gerhold <stephan@gerhold.net>
Wed, 2 Dec 2020 10:46:56 +0000 (11:46 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 9 Jan 2021 14:25:30 +0000 (14:25 +0000)
MPU-6880 seems to be very similar to MPU-6500 and it works
fine with some minor additions for the mpu6050 driver.

Add the necessary defines for it and make it use the same registers
as MPU-6500 but with a FIFO size of 4096.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Link: https://lore.kernel.org/r/20201202104656.5119-2-stephan@gerhold.net
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 7137ea6..9c62551 100644 (file)
@@ -16,8 +16,8 @@ config INV_MPU6050_I2C
        select REGMAP_I2C
        help
          This driver supports the Invensense MPU6050/9150,
-         MPU6500/6515/9250/9255, ICM20608/20609/20689, ICM20602/ICM20690 and
-         IAM20680 motion tracking devices over I2C.
+         MPU6500/6515/6880/9250/9255, ICM20608/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/9250/9255, ICM20608/20609/20689, ICM20602/ICM20690 and
-         IAM20680 motion tracking devices over SPI.
+         MPU6500/6515/6880/9250/9255, ICM20608/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 18a1898..453c51c 100644 (file)
@@ -161,6 +161,14 @@ static const struct inv_mpu6050_hw hw_info[] = {
                .temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
        },
        {
+               .whoami = INV_MPU6880_WHOAMI_VALUE,
+               .name = "MPU6880",
+               .reg = &reg_set_6500,
+               .config = &chip_config_6500,
+               .fifo_size = 4096,
+               .temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
+       },
+       {
                .whoami = INV_MPU6000_WHOAMI_VALUE,
                .name = "MPU6000",
                .reg = &reg_set_6050,
@@ -1323,6 +1331,7 @@ static int inv_check_and_setup_chip(struct inv_mpu6050_state *st)
        case INV_MPU6000:
        case INV_MPU6500:
        case INV_MPU6515:
+       case INV_MPU6880:
        case INV_MPU9250:
        case INV_MPU9255:
                /* reset signal path (required for spi connection) */
index 28cfae1..95f1695 100644 (file)
@@ -177,6 +177,7 @@ static const struct i2c_device_id inv_mpu_id[] = {
        {"mpu6050", INV_MPU6050},
        {"mpu6500", INV_MPU6500},
        {"mpu6515", INV_MPU6515},
+       {"mpu6880", INV_MPU6880},
        {"mpu9150", INV_MPU9150},
        {"mpu9250", INV_MPU9250},
        {"mpu9255", INV_MPU9255},
@@ -205,6 +206,10 @@ static const struct of_device_id inv_of_match[] = {
                .data = (void *)INV_MPU6515
        },
        {
+               .compatible = "invensense,mpu6880",
+               .data = (void *)INV_MPU6880
+       },
+       {
                .compatible = "invensense,mpu9150",
                .data = (void *)INV_MPU9150
        },
index eb522b3..58188dc 100644 (file)
@@ -70,6 +70,7 @@ enum inv_devices {
        INV_MPU6050,
        INV_MPU6500,
        INV_MPU6515,
+       INV_MPU6880,
        INV_MPU6000,
        INV_MPU9150,
        INV_MPU9250,
@@ -373,6 +374,7 @@ struct inv_mpu6050_state {
 #define INV_MPU6000_WHOAMI_VALUE               0x68
 #define INV_MPU6050_WHOAMI_VALUE               0x68
 #define INV_MPU6500_WHOAMI_VALUE               0x70
+#define INV_MPU6880_WHOAMI_VALUE               0x78
 #define INV_MPU9150_WHOAMI_VALUE               0x68
 #define INV_MPU9250_WHOAMI_VALUE               0x71
 #define INV_MPU9255_WHOAMI_VALUE               0x73
index 6f968ce..b056f3f 100644 (file)
@@ -70,6 +70,7 @@ static const struct spi_device_id inv_mpu_id[] = {
        {"mpu6000", INV_MPU6000},
        {"mpu6500", INV_MPU6500},
        {"mpu6515", INV_MPU6515},
+       {"mpu6880", INV_MPU6880},
        {"mpu9250", INV_MPU9250},
        {"mpu9255", INV_MPU9255},
        {"icm20608", INV_ICM20608},
@@ -97,6 +98,10 @@ static const struct of_device_id inv_of_match[] = {
                .data = (void *)INV_MPU6515
        },
        {
+               .compatible = "invensense,mpu6880",
+               .data = (void *)INV_MPU6880
+       },
+       {
                .compatible = "invensense,mpu9250",
                .data = (void *)INV_MPU9250
        },