From patchwork Mon Apr 2 22:42:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Fischer X-Patchwork-Id: 10320443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B5B3C60532 for ; Mon, 2 Apr 2018 22:42:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 944C7281F9 for ; Mon, 2 Apr 2018 22:42:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87A4C288BB; Mon, 2 Apr 2018 22:42:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65F97289BD for ; Mon, 2 Apr 2018 22:42:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754540AbeDBWma (ORCPT ); Mon, 2 Apr 2018 18:42:30 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:36396 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754516AbeDBWma (ORCPT ); Mon, 2 Apr 2018 18:42:30 -0400 Received: by mail-qk0-f196.google.com with SMTP id o205so16723528qke.3 for ; Mon, 02 Apr 2018 15:42:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version :content-transfer-encoding; bh=cWv60nDtyYnojPeG88vMFOgIsbWgftsbjaYJSDmR3TY=; b=WvEhM1FJxEWbG8wL+fKYYftG1Y15Rhi2dPiirBmLZsm91wlIoYRmaIYd6MH/3mIcwP ZZUs0QKR7GfRVb9LoQ8dYOMOrx5YjFafQYCVkY8/b9B3EPIbN6jQ9tRo6fA8HvGnThBk MIEeElzlsllSBBW+amcIQnCUmNaQvkQ5+Ah6rUoNg5e+MtyQ1fYvxMgL6RpnvDfTip9C 8f9ya0FIj+Ht/5Kmn9uQ+aYfyplGdVstUMvHd0luc9QySm47A6fMTVzfKClX7rp3jv7o A8lFsZ+DiSzy35MJ9NjndLDTu1kjZ9zC4h+Vcs8F6dt55Jrt5+daqjuBCxm1i4Ux1UxD jZHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-transfer-encoding; bh=cWv60nDtyYnojPeG88vMFOgIsbWgftsbjaYJSDmR3TY=; b=HE6VsvmLWGVYtt4Dfv5vxaJfTODc07Ciwfr0Gv5zJ5JG++sojLHYaFppwMFBKp+4GC mD4GGj9VRwM2Nu59scQJSt2O16U/LUo0J1r+eMea3Ga2d9JI8H3HdIZesMuDlRAMEKts ZnAyXubJcgkHHPGl/0AFXi2NHHdXebxCAfOitOmYsAwTf89HmyDMfa+y8Ra1oJRbiCVK EDXviZj76u5UKrqybecLhbXjO78JK3jyZAENcVMbWBeCCUPftVz3xMMn+2UGBDBZxIUG d38V0FQDx7yVCFAqdEW6QfAmW5ydLUMSwYgz9d5RMJM7CSgE1Fxf2EPOaMDmJ5y2uFQn ohYw== X-Gm-Message-State: ALQs6tCnpGtMmt9XSkDgaaZrjISo15rLXfGThwanC52DqkUHytEXOM9s dEiEUxlWXXN5ITVNk3H/UkY= X-Google-Smtp-Source: AIpwx48RMlbl1+IE3MvfJEhH2vc22V/6oASfcQadnQ0qFSBKA1v54eZv08PFLNepi47K30YmSMTnkg== X-Received: by 10.55.185.69 with SMTP id j66mr15870586qkf.216.1522708949323; Mon, 02 Apr 2018 15:42:29 -0700 (PDT) Received: from Constantine (pool-96-230-56-196.bstnma.fios.verizon.net. [96.230.56.196]) by smtp.gmail.com with ESMTPSA id x31sm1180682qtc.55.2018.04.02.15.42.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Apr 2018 15:42:29 -0700 (PDT) Date: Mon, 2 Apr 2018 18:42:00 -0400 From: Douglas Fischer To: jic23@kernel.org, linux-iio@vger.kernel.org Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net Subject: [PATCH] iio: imu: Add mpu9255 support to mpu6050 driver Message-ID: <20180402184200.0aa65204@Constantine> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Added support for the mpu9255 IMU to the mpu6050 driver. The register map is the same as the other chips; the only driver difference is the compatible string and the WHOAMI register value. Signed-off-by: Douglas Fischer --- -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -uprN linux-4.16.orig/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt linux-4.16/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt --- linux-4.16.orig/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt 2018-04-01 17:20:27.000000000 -0400 +++ linux-4.16/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt 2018-04-02 18:31:38.342464417 -0400 @@ -8,6 +8,7 @@ Required properties: "invensense,mpu6500" "invensense,mpu9150" "invensense,mpu9250" + "invensense,mpu9255" "invensense,icm20608" - reg : the I2C address of the sensor - interrupt-parent : should be the phandle for the interrupt controller diff -uprN linux-4.16.orig/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c linux-4.16/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c --- linux-4.16.orig/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c 2018-04-01 17:20:27.000000000 -0400 +++ linux-4.16/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c 2018-04-02 18:31:38.345464417 -0400 @@ -121,6 +121,12 @@ static const struct inv_mpu6050_hw hw_in .config = &chip_config_6050, }, { + .whoami = INV_MPU9255_WHOAMI_VALUE, + .name = "MPU9255", + .reg = ®_set_6500, + .config = &chip_config_6050, + }, + { .whoami = INV_ICM20608_WHOAMI_VALUE, .name = "ICM20608", .reg = ®_set_6500, diff -uprN linux-4.16.orig/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c linux-4.16/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c --- linux-4.16.orig/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c 2018-04-01 17:20:27.000000000 -0400 +++ linux-4.16/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c 2018-04-02 18:31:38.348464417 -0400 @@ -179,6 +179,7 @@ static const struct i2c_device_id inv_mp {"mpu6500", INV_MPU6500}, {"mpu9150", INV_MPU9150}, {"mpu9250", INV_MPU9250}, + {"mpu9255", INV_MPU9255}, {"icm20608", INV_ICM20608}, {} }; @@ -203,6 +204,10 @@ static const struct of_device_id inv_of_ .data = (void *)INV_MPU9250 }, { + .compatible = "invensense,mpu9255", + .data = (void *)INV_MPU9255 + }, + { .compatible = "invensense,icm20608", .data = (void *)INV_ICM20608 }, diff -uprN linux-4.16.orig/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h linux-4.16/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h --- linux-4.16.orig/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h 2018-04-01 17:20:27.000000000 -0400 +++ linux-4.16/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h 2018-04-02 18:31:38.351464416 -0400 @@ -74,6 +74,7 @@ enum inv_devices { INV_MPU6000, INV_MPU9150, INV_MPU9250, + INV_MPU9255, INV_ICM20608, INV_NUM_PARTS }; @@ -232,6 +233,7 @@ struct inv_mpu6050_state { #define INV_MPU6500_WHOAMI_VALUE 0x70 #define INV_MPU9150_WHOAMI_VALUE 0x68 #define INV_MPU9250_WHOAMI_VALUE 0x71 +#define INV_MPU9255_WHOAMI_VALUE 0x73 #define INV_ICM20608_WHOAMI_VALUE 0xAF /* scan element definition */ diff -uprN linux-4.16.orig/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c linux-4.16/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c --- linux-4.16.orig/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c 2018-04-01 17:20:27.000000000 -0400 +++ linux-4.16/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c 2018-04-02 18:31:38.356464416 -0400 @@ -83,6 +83,7 @@ static const struct spi_device_id inv_mp {"mpu6500", INV_MPU6500}, {"mpu9150", INV_MPU9150}, {"mpu9250", INV_MPU9250}, + {"mpu9255", INV_MPU9255}, {"icm20608", INV_ICM20608}, {} };