Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b37c41f authored by Jean-Baptiste Maneyrol's avatar Jean-Baptiste Maneyrol Committed by Jonathan Cameron
Browse files

iio: imu: inv_mpu6050: use i2c mux only for chip with i2c aux bus



icm20608 does not have i2c aux bus, so it does not make sense to
allocate an i2c mux for this chip.

Signed-off-by: default avatarJean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent b3e5c2bd
Loading
Loading
Loading
Loading
+25 −16
Original line number Diff line number Diff line
@@ -125,6 +125,12 @@ static int inv_mpu_probe(struct i2c_client *client,
		return result;

	st = iio_priv(dev_get_drvdata(&client->dev));
	switch (st->chip_type) {
	case INV_ICM20608:
		/* no i2c auxiliary bus on the chip */
		break;
	default:
		/* declare i2c auxiliary bus */
		st->muxc = i2c_mux_alloc(client->adapter, &client->dev,
					 1, 0, I2C_MUX_LOCKED | I2C_MUX_GATE,
					 inv_mpu6050_select_bypass,
@@ -135,10 +141,11 @@ static int inv_mpu_probe(struct i2c_client *client,
		result = i2c_mux_add_adapter(st->muxc, 0, 0, 0);
		if (result)
			return result;

		result = inv_mpu_acpi_create_mux_client(client);
		if (result)
			goto out_del_mux;
		break;
	}

	return 0;

@@ -152,8 +159,10 @@ static int inv_mpu_remove(struct i2c_client *client)
	struct iio_dev *indio_dev = i2c_get_clientdata(client);
	struct inv_mpu6050_state *st = iio_priv(indio_dev);

	if (st->muxc) {
		inv_mpu_acpi_delete_mux_client(client);
		i2c_mux_del_adapters(st->muxc);
	}

	return 0;
}