From patchwork Thu May 4 09:14:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hermes Zhang X-Patchwork-Id: 90010 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp169124vqo; Thu, 4 May 2023 02:21:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6PKhmAJmDF2Be/1hFwq76QNCvivn+c74qG1QEmwq0LK/sk/HXNeCmz+NMCo2uxqYkPLzgh X-Received: by 2002:a05:6a20:1584:b0:ef:7aa2:3cfd with SMTP id h4-20020a056a20158400b000ef7aa23cfdmr1813031pzj.50.1683192114896; Thu, 04 May 2023 02:21:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683192114; cv=none; d=google.com; s=arc-20160816; b=DRFHmgndb0+k9VjxIXPj1N8Ir/zbwh+oZYycf9fyx9JvpnN5vUxwZYdBRvAAKfgzzB qxvBfX9GtiJjI8xJw9ISM7tv9RqQkaQLauS2A4NaetzW3jwyS3qipefx+8f5nelE3fAk XzQIiwWTn3a6BpJoXAPV9Z8/2LFhpDxvbdfgEyL//6Gsjc/SGwbLfftYGduJvv/lu+YT 7IoRHxCgLUVEZEh3TNyFvdiwafqQUZj/d6wW62NlBsy9KRpdgqQamScsfFz95xc7aOp2 12inCXE1zjQUYEhhB0pU6dN5O8evv6P3N898+UQNetL96mFKLmkCIrRl7OZkNpn8Z2T2 OJmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cDIBRX8Ulk8P+kDO+DNb87Xtv4IZjVGMishO+Kq42zY=; b=HQ6Tj+jiGqiNXl4PW7gmF+EZzWPkykFBSLRB5KUZq1YDoLBKojJTNeM4T5SQqKzZkM WrKcCKVRjqm80n46TiP3XmaxQNt/1S6k1GejitttmTZBqHfzX4uorqngSmPIEFCdAkBX 8nyjcrzZk54+Bo1Z7RxFi5uzDtSd4kdx7pTsYeVyFNhHVr63zIAQw2aWGny8ESfhGM9i YsB1nYweSiroCbg6g2OxPGnUOe9LPsEkgofWPoYtTrcqKU5S/UCh6vYzmk4bSwNpxvI0 SXAvITqeA/XT3bSDCTzSLFHMCV1YwN2dvLM7NcxZ6JL4CaO8n+tM7hj+pgET6p3DBq14 xYUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=jIT2IhPJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a63d006000000b0052856cec94asi23758805pgf.884.2023.05.04.02.21.40; Thu, 04 May 2023 02:21:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=jIT2IhPJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230204AbjEDJP7 (ORCPT + 99 others); Thu, 4 May 2023 05:15:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230017AbjEDJPw (ORCPT ); Thu, 4 May 2023 05:15:52 -0400 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C44A4C34; Thu, 4 May 2023 02:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1683191713; x=1714727713; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cDIBRX8Ulk8P+kDO+DNb87Xtv4IZjVGMishO+Kq42zY=; b=jIT2IhPJlvu3M9EkOLJWR7aouCqQ37u1w9XQVXLLsxQimczWoBkWQYu3 dlR6iJe0IGnOCIYhtnhK3X75tpgLvvGkeMRvKWlP7M81j3jvvRPKh3ZmN XhhIRyFl6qHcdxG7qrwVwePV+tGvUo8/l2dzTHB5qUFc6ScVzD6uH/Ukn 7+zhoDbJwEfA5PZgqLkI9cQMcr3bKJCgiPCNHNdnefMJe1YxyY4V1aQyI HHeB5gVP72xvnZjdqdemRPBWV2rNKHNUxTKtBq+ra6pNDn1Reu2UNoYGz 2T3vpWKjHh37p+BsSRQ2amhA/P628fxUbrAq8hEtZSf2wuby/GIF4dKQr A==; From: Hermes Zhang To: , , CC: , , , , Hermes Zhang , Lars-Peter Clausen Subject: [PATCH v2 1/2] iio: imu: mpu6050: Add support for the ICM 20600 IMU Date: Thu, 4 May 2023 17:14:19 +0800 Message-ID: <20230504091421.2054451-2-chenhuiz@axis.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230504091421.2054451-1-chenhuiz@axis.com> References: <20230504091421.2054451-1-chenhuiz@axis.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764954855386379982?= X-GMAIL-MSGID: =?utf-8?q?1764954855386379982?= 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 --- 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(-) diff --git a/drivers/iio/imu/inv_mpu6050/Kconfig b/drivers/iio/imu/inv_mpu6050/Kconfig index 3636b1bc90f1..64dd73dcc4ba 100644 --- a/drivers/iio/imu/inv_mpu6050/Kconfig +++ b/drivers/iio/imu/inv_mpu6050/Kconfig @@ -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. diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index 8a129120b73d..592a6e60b413 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -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 = ®_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); diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c index 2f2da4cb7321..0e39877678df 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c @@ -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 diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h index 94b54c501ec0..b4ab2c397d0f 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h @@ -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 diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c index 89f46c2f213d..05451ca1580b 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c @@ -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 From patchwork Thu May 4 09:14:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hermes Zhang X-Patchwork-Id: 90013 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp169690vqo; Thu, 4 May 2023 02:23:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6D47ImyP1+Ypu25ER7sE1PVGINHmAdon9xpLFCCvPw1NTq59l0NKq+LVdlQxAMBUUKCIpr X-Received: by 2002:a17:902:f809:b0:1a9:3916:c2d1 with SMTP id ix9-20020a170902f80900b001a93916c2d1mr2811186plb.54.1683192197282; Thu, 04 May 2023 02:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683192197; cv=none; d=google.com; s=arc-20160816; b=wlIbR0KKRAvUYKk7eKaapnuBjSF7hyrR614OhAsrPKWZxV4vDdmiMxU76Hor/h5gMU 43TjCySk88I3UZp4bRD12VLM8O45aA2Z9yFW4DC0UWr9rz1RzIhvhBD47xkRDaa1E0pa XRu48/EiSUJVszrx58Y+siS6wSBo489e9essP5Vs+eqy7GfBWBwvMgrQk6oi40MQj4Bw 6/wnNuW5/FeqAJCIgWoIBr4aW5vo2TdIED3AnEFIWLfeoHxiWtd5vgGQgBDPKOejMizm 3TPi8yng9GXeJF3SOvNIcVJVOX3nh/4S4KahuA/CYMdaIPJ+kOwcLvuciyPR74jK0FLa /YJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XxpfMAAVzSMsSpNg03jMBd98fL8xCc8rZorQJMqF7+4=; b=cx4nZKz5BFa/TFgM32n+dyK7boRPGH/6L4FaCQCJ66jY5yDTzvxvYMdAx3gjE64Unh vJHEFtlxhkwZDwh9g2pDjD7jVec22sTSDoUjvCv+DSUoJNJC7fPTR/zJUx65HlQaBgCi cXH+hNLnocGgM9daTP8u+Cwq/p5+2wT6KGCYvHIKeX/bnyfoHyMdOaIDtP7f621hl/fS CXNEjyAVeQ9reAax4SbsCUXJnEKVsbJoxnvfYMmGbDMD07wzO0Y4v5XJEj34b/A1MTUR kj4dxoPFB4yRKNgWpKVEVkW/XmBBi33MUQhfPArbacDUzckXS0Hprpbd+QdYEELOTm0O n9Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b="YyjCAEJ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f23-20020a170902ab9700b001aaeb3adb5csi10133049plr.188.2023.05.04.02.23.02; Thu, 04 May 2023 02:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b="YyjCAEJ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229980AbjEDJQD (ORCPT + 99 others); Thu, 4 May 2023 05:16:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbjEDJP7 (ORCPT ); Thu, 4 May 2023 05:15:59 -0400 Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C426249E0; Thu, 4 May 2023 02:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1683191721; x=1714727721; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XxpfMAAVzSMsSpNg03jMBd98fL8xCc8rZorQJMqF7+4=; b=YyjCAEJ/9OzG4K+a/NGolnaM2Kgmc+0PNdfew71qJTmrnnAqa77MJFFW 7poNayxZtnVw/kdppIlCWSZUIzn8ShQraW4+oma9MwR1QqgDeBJ2Xr/UM rDRB5BYr2JrXc5hfWSfNx3w042k4n0VG+axPVaqICAgcMbZGZItXSsyed 8imnWyO755f2vcd47fNsf+Db7GTWZUEqZzcF+bk+8sRufcbb7SNtGSx+P lG8xQXri+gctXg9j2xJhzK2WFn9EkFsu4f3+JGSqSaZcS7HR6vO4vtdkx JvraPFswiWaIUs/xqSTPuCqUBcPjdn6nKN6dUS3oeIk061hdkc3sMzfqp A==; From: Hermes Zhang To: , , , Jean-Baptiste Maneyrol CC: , , , Hermes Zhang , Lars-Peter Clausen , Subject: [PATCH v2 2/2] dt-bindings: iio: imu: mpu6050: Add icm20600 bindings to mpu6050 Date: Thu, 4 May 2023 17:14:20 +0800 Message-ID: <20230504091421.2054451-3-chenhuiz@axis.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230504091421.2054451-1-chenhuiz@axis.com> References: <20230504091421.2054451-1-chenhuiz@axis.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764954941715154256?= X-GMAIL-MSGID: =?utf-8?q?1764954941715154256?= ICM-20600 is almost same as ICM-20602 which already support in mpu6050 driver. Specify "invensense,icm20602" as a fallback compatible Signed-off-by: Hermes Zhang Reviewed-by: Krzysztof Kozlowski --- Notes: v2: require specifying "invensense,icm20602" as a fallback compatible in the binding, as suggested .../devicetree/bindings/iio/imu/invensense,mpu6050.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml index ec64d7877fe5..711a1beeaecf 100644 --- a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml +++ b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml @@ -33,6 +33,9 @@ properties: - items: - const: invensense,icm20608d - const: invensense,icm20608 + - items: + - const: invensense,icm20600 + - const: invensense,icm20602 reg: maxItems: 1