[1/8] iio: imu: inv_mpu6050: disable i2c mux for 925x under Kconfig
diff mbox series

Message ID 20190829151801.13014-2-jmaneyrol@invensense.com
State New
Headers show
Series
  • add magnetometer support for MPU925x
Related show

Commit Message

Jean-Baptiste Maneyrol Aug. 29, 2019, 3:18 p.m. UTC
Disable i2c mux for supported 9xxx chips when a Kconfig option
is enabled.
Add the new Kconfig option for enabling control of 9xxx
magnetometer using the i2c master of the chip. Since it has to be
explicitly enabled, we assure retro-compatibility with existing
configuration.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
 drivers/iio/imu/inv_mpu6050/Kconfig       | 9 +++++++++
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 5 +++++
 2 files changed, 14 insertions(+)

Patch
diff mbox series

diff --git a/drivers/iio/imu/inv_mpu6050/Kconfig b/drivers/iio/imu/inv_mpu6050/Kconfig
index e4c4c12236a7..a92b723c6b32 100644
--- a/drivers/iio/imu/inv_mpu6050/Kconfig
+++ b/drivers/iio/imu/inv_mpu6050/Kconfig
@@ -31,3 +31,12 @@  config INV_MPU6050_SPI
 	  over SPI.
 	  This driver can be built as a module. The module will be called
 	  inv-mpu6050-spi.
+
+config INV_MPU6050_MAGN
+	bool "Invensense 9-axis magnetometer support"
+	depends on INV_MPU6050_IIO
+	help
+	  For 9xxx chips add support of 9-axis in the driver using chip
+	  i2c master to drive the integrated magnetometer.
+	  Beware that this is disabling access to the i2c auxiliary bus!
+	  Support only MPU925x.
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
index 4b8b5a87398c..4c318304f9c6 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
@@ -121,6 +121,11 @@  static int inv_mpu_probe(struct i2c_client *client,
 	case INV_ICM20608:
 	case INV_ICM20602:
 		/* no i2c auxiliary bus on the chip */
+#ifdef CONFIG_INV_MPU6050_MAGN
+	case INV_MPU9250:
+	case INV_MPU9255:
+		/* i2c auxiliary bus used for driving magnetometer */
+#endif
 		break;
 	default:
 		/* declare i2c auxiliary bus */