Skip to contentSkip to conversation

Add support for the ICM 20600 IMU

PATCH In review Hermes Zhang 3 participants 7 messages May 5, 2023 – May 13, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover Add support for the ICM 20600 IMU

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.

Notes:
v2: require specifying "invensense,icm20602" as a fallback compatible
in the binding, as suggested
v3: reorder "invensense,icm20602" entry before icm20608 and add
Reviewed-by tag from Krzysztof

Hermes Zhang (2):
dt-bindings: iio: imu: mpu6050: Add icm20600 bindings to mpu6050
iio: imu: mpu6050: Add support for the ICM 20600 IMU

 .../bindings/iio/imu/invensense,mpu6050.yaml           |  3 +++
 drivers/iio/imu/inv_mpu6050/Kconfig                    |  4 ++--
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c             | 10 ++++++++++
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c              |  6 ++++++
 drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h              |  2 ++
 drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c              |  5 +++++
 6 files changed, 28 insertions(+), 2 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v3 1/2 dt-bindings: iio: imu: mpu6050: Add icm20600 bindings to mpu6050

ICM-20600 is almost same as ICM-20602 which already support in mpu6050 driver. Specify "invensense,icm20602" as a fallback compatible

---

Notes:
v2: require specifying "invensense,icm20602" as a fallback compatible
in the binding, as suggested
v3: reorder "invensense,icm20602" entry before icm20608 and add
Reviewed-by tag from Krzysztof

 .../devicetree/bindings/iio/imu/invensense,mpu6050.yaml        | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml +3 -0
index ec64d7877fe5..1db6952ddca5 100644
@@ -30,6 +30,9 @@ properties:
           - invensense,mpu9150
           - invensense,mpu9250
           - invensense,mpu9255
+      - items:
+          - const: invensense,icm20600
+          - const: invensense,icm20602
       - items:
           - const: invensense,icm20608d
           - const: invensense,icm20608
Signature · 1 line
2.30.2
maintainer Acked-by Reviewed-by Krzysztof Kozlowski on v3 1/2
#2 lore raw

Re: [PATCH v3 1/2] dt-bindings: iio: imu: mpu6050: Add icm20600 bindings to mpu6050

Hello,

looks good for me, thanks for the patch.

From: Hermes Zhang <[email protected]>
Sent: Friday, May 5, 2023 07:48
To: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Jean-Baptiste Maneyrol <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Hermes Zhang <[email protected]>; Krzysztof Kozlowski <[email protected]>; Lars-Peter Clausen <[email protected]>; [email protected] <[email protected]>
Subject: [PATCH v3 1/2] dt-bindings: iio: imu: mpu6050: Add icm20600 bindings to mpu6050

[CAUTION] This is an EXTERNAL email. Do not click links or open attachments unless you recognize the sender and know the content is safe.

======================================================================
ICM-20600 is almost same as ICM-20602 which already support in mpu6050 driver. Specify "invensense,icm20602" as a fallback compatible

---

Notes:
    v2: require specifying "invensense,icm20602" as a fallback compatible in the binding, as suggested
    v3: reorder "invensense,icm20602" entry before icm20608 and add Reviewed-by tag from Krzysztof

 .../devicetree/bindings/iio/imu/invensense,mpu6050.yaml        | 3 +++

 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml +0 -0
index ec64d7877fe5..1db6952ddca5 100644
@@ -30,6 +30,9 @@ properties:

           - invensense,mpu9150
           - invensense,mpu9250
           - invensense,mpu9255
+      - items:
+          - const: invensense,icm20600
+          - const: invensense,icm20602
       - items:
           - const: invensense,icm20608d
           - const: invensense,icm20608

Signature · 1 line
2.30.2
#3 lore raw

PATCH v3 2/2 iio: imu: mpu6050: Add support for the ICM 20600 IMU

In reply to Hermes Zhang

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.

---
 drivers/iio/imu/inv_mpu6050/Kconfig        |  4 ++--
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 10 ++++++++++
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c  |  6 ++++++
 drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h  |  2 ++
 drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c  |  5 +++++
 5 files changed, 25 insertions(+), 2 deletions(-)
drivers/iio/imu/inv_mpu6050/Kconfig +2 -2
index 3636b1bc90f1..64dd73dcc4ba 100644
@@ -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.
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +10 -0
index 8a129120b73d..592a6e60b413 100644
@@ -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);
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c +6 -0
index 2f2da4cb7321..0e39877678df 100644
@@ -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
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h +2 -0
index 94b54c501ec0..b4ab2c397d0f 100644
@@ -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
drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c +5 -0
index 89f46c2f213d..05451ca1580b 100644
@@ -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
Signature · 1 line
2.30.2
maintainer Acked-by on v3 2/2
#4 lore raw

Re: [PATCH v3 2/2] iio: imu: mpu6050: Add support for the ICM 20600 IMU

Hello,

looks good for me, thanks for the patch.

From: Hermes Zhang <[email protected]>
Sent: Friday, May 5, 2023 07:48
To: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Cc: Jean-Baptiste Maneyrol <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Hermes Zhang <[email protected]>; Lars-Peter Clausen <[email protected]>
Subject: [PATCH v3 2/2] iio: imu: mpu6050: Add support for the ICM 20600 IMU

[CAUTION] This is an EXTERNAL email. Do not click links or open attachments unless you recognize the sender and know the content is safe.

======================================================================
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.

---
 drivers/iio/imu/inv_mpu6050/Kconfig        |  4 ++-- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 10 ++++++++++

 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c  |  6 ++++++
 drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h  |  2 ++
 drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c  |  5 +++++
 5 files changed, 25 insertions(+), 2 deletions(-)
drivers/iio/imu/inv_mpu6050/Kconfig +0 -0
index 3636b1bc90f1..64dd73dcc4ba 100644
@@ -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.

drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +0 -0
index 8a129120b73d..592a6e60b413 100644
@@ -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);

drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c +0 -0
index 2f2da4cb7321..0e39877678df 100644
@@ -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

drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h +0 -0
index 94b54c501ec0..b4ab2c397d0f 100644
@@ -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

drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c +0 -0
index 89f46c2f213d..05451ca1580b 100644
@@ -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

Signature · 1 line
2.30.2
maintainer
#5 lore raw
In reply to Hermes Zhang
Quoted 10 lines · On Fri, 5 May 2023 13:48:51 +0800 Hermes Zhang <[email protected]> wrote:

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.

Notes:
v2: require specifying "invensense,icm20602" as a fallback compatible
in the binding, as suggested
v3: reorder "invensense,icm20602" entry before icm20608 and add
Reviewed-by tag from Krzysztof

Looks good to me. I want to leave a little more time for Jean-Baptiste to take a look. If it looks like I've forgotten this in 2 weeks, feel free to give me a poke.

Thanks,

Jonathan

Quoted 13 lines

Hermes Zhang (2):
dt-bindings: iio: imu: mpu6050: Add icm20600 bindings to mpu6050
iio: imu: mpu6050: Add support for the ICM 20600 IMU

 .../bindings/iio/imu/invensense,mpu6050.yaml           |  3 +++
 drivers/iio/imu/inv_mpu6050/Kconfig                    |  4 ++--
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c             | 10 ++++++++++
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c              |  6 ++++++
 drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h              |  2 ++
 drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c              |  5 +++++
 6 files changed, 28 insertions(+), 2 deletions(-)
maintainer
#6 lore raw
Quoted 14 lines · On Sat, 6 May 2023 17:37:17 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 10 lines · On Fri, 5 May 2023 13:48:51 +0800 Hermes Zhang <[email protected]> wrote:

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.

Notes:
v2: require specifying "invensense,icm20602" as a fallback compatible
in the binding, as suggested
v3: reorder "invensense,icm20602" entry before icm20608 and add
Reviewed-by tag from Krzysztof

Quoted 3 lines

Looks good to me. I want to leave a little more time for Jean-Baptiste to take a look. If it looks like I've forgotten this in 2 weeks, feel free to give me a poke.

Series applied to the togreg branch of iio.git and initially pushed out as testing for 0-day to take a look and see if we missed anything.

Thanks,

Jonathan

Quoted 20 lines

Thanks,

Jonathan

Quoted 13 lines

Hermes Zhang (2):
dt-bindings: iio: imu: mpu6050: Add icm20600 bindings to mpu6050
iio: imu: mpu6050: Add support for the ICM 20600 IMU

 .../bindings/iio/imu/invensense,mpu6050.yaml           |  3 +++
 drivers/iio/imu/inv_mpu6050/Kconfig                    |  4 ++--
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c             | 10 ++++++++++
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c              |  6 ++++++
 drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h              |  2 ++
 drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c              |  5 +++++
 6 files changed, 28 insertions(+), 2 deletions(-)