iio:imu:mpu6050 add explicit mpu9250 support
authorJonathan Cameron <jic23@kernel.org>
Sun, 26 Mar 2017 11:11:00 +0000 (12:11 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sun, 2 Apr 2017 09:12:08 +0000 (10:12 +0100)
The mpu9250 is a SIP containing an mpu6500 and an ak8975.  If this was all
there was too it there would be no need for explicit handling in the driver.
Arguably the bindings would also only reflect the presence of an mpu6500 with
the ak8975 hanging off it, as the kernel doesn't care that they are in one
package.

However, the WHOAMI value changes as well so best to add explicit support.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
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 e28cb3abb343936cc0fb7424b5b2362ec95c55f2..2b4514592f833c9be71e0522ca8e839082470030 100644 (file)
@@ -7,6 +7,7 @@ Required properties:
                "invensense,mpu6050"
                "invensense,mpu6500"
                "invensense,mpu9150"
+               "invensense,mpu9250"
                "invensense,icm20608"
  - reg : the I2C address of the sensor
  - interrupt-parent : should be the phandle for the interrupt controller
index b9fcbf18aa99e53f4fb2b0ec62949ef983f9b0e0..96dabbd2f004b3d91c1cde6cca2f6dfdaf091d58 100644 (file)
@@ -113,6 +113,12 @@ static const struct inv_mpu6050_hw hw_info[] = {
                .reg = &reg_set_6050,
                .config = &chip_config_6050,
        },
+       {
+               .whoami = INV_MPU9250_WHOAMI_VALUE,
+               .name = "MPU9250",
+               .reg = &reg_set_6500,
+               .config = &chip_config_6050,
+       },
        {
                .whoami = INV_ICM20608_WHOAMI_VALUE,
                .name = "ICM20608",
index a8e6330cb90616776d7ee7c5491b89723f4446d8..64b5f5b9220074a8b6e3e73ea142764c784cc775 100644 (file)
@@ -178,6 +178,7 @@ static const struct i2c_device_id inv_mpu_id[] = {
        {"mpu6050", INV_MPU6050},
        {"mpu6500", INV_MPU6500},
        {"mpu9150", INV_MPU9150},
+       {"mpu9250", INV_MPU9250},
        {"icm20608", INV_ICM20608},
        {}
 };
@@ -197,6 +198,10 @@ static const struct of_device_id inv_of_match[] = {
                .compatible = "invensense,mpu9150",
                .data = (void *)INV_MPU9150
        },
+       {
+               .compatible = "invensense,mpu9250",
+               .data = (void *)INV_MPU9250
+       },
        {
                .compatible = "invensense,icm20608",
                .data = (void *)INV_ICM20608
index f0e8c5dd9fae25915e7cf0d4885d5d7b9b0e821d..ef13de7a2c20fd6ef3e450f8d3094483af71b9a9 100644 (file)
@@ -70,6 +70,7 @@ enum inv_devices {
        INV_MPU6500,
        INV_MPU6000,
        INV_MPU9150,
+       INV_MPU9250,
        INV_ICM20608,
        INV_NUM_PARTS
 };
@@ -226,6 +227,7 @@ struct inv_mpu6050_state {
 #define INV_MPU6050_WHOAMI_VALUE               0x68
 #define INV_MPU6500_WHOAMI_VALUE               0x70
 #define INV_MPU9150_WHOAMI_VALUE               0x68
+#define INV_MPU9250_WHOAMI_VALUE               0x71
 #define INV_ICM20608_WHOAMI_VALUE              0xAF
 
 /* scan element definition */
index 6e6476dfa188ed79bdace630f492ce866aacefe9..74506e5ac0db6d48749cc8dff55d5741daf6f9af 100644 (file)
@@ -82,6 +82,7 @@ static const struct spi_device_id inv_mpu_id[] = {
        {"mpu6000", INV_MPU6000},
        {"mpu6500", INV_MPU6500},
        {"mpu9150", INV_MPU9150},
+       {"mpu9250", INV_MPU9250},
        {"icm20608", INV_ICM20608},
        {}
 };