Lines Matching +full:i2c +full:- +full:gate
1 // SPDX-License-Identifier: GPL-2.0-only
8 #include <linux/i2c.h>
30 switch (st->chip_type) { in inv_mpu_i2c_aux_bus()
38 /* no i2c auxiliary bus on the chip */ in inv_mpu_i2c_aux_bus()
43 if (st->magn_disabled) in inv_mpu_i2c_aux_bus()
55 struct device *dev = indio_dev->dev.parent; in inv_mpu_i2c_aux_setup()
60 * MPU9xxx magnetometer support requires to disable i2c auxiliary bus. in inv_mpu_i2c_aux_setup()
62 * i2c auxiliary bus if it used. in inv_mpu_i2c_aux_setup()
63 * Check for i2c-gate node in devicetree and set magnetometer disabled. in inv_mpu_i2c_aux_setup()
66 switch (st->chip_type) { in inv_mpu_i2c_aux_setup()
70 mux_node = device_get_named_child_node(dev, "i2c-gate"); in inv_mpu_i2c_aux_setup()
72 st->magn_disabled = true; in inv_mpu_i2c_aux_setup()
81 /* enable i2c bypass when using i2c auxiliary bus */ in inv_mpu_i2c_aux_setup()
83 ret = regmap_write(st->map, st->reg->int_pin_cfg, in inv_mpu_i2c_aux_setup()
84 st->irq_mask | INV_MPU6050_BIT_BYPASS_EN); in inv_mpu_i2c_aux_setup()
93 * inv_mpu_probe() - probe function.
94 * @client: i2c client.
108 if (!i2c_check_functionality(client->adapter, in inv_mpu_probe()
110 return -EOPNOTSUPP; in inv_mpu_probe()
112 match = device_get_match_data(&client->dev); in inv_mpu_probe()
115 name = client->name; in inv_mpu_probe()
118 id->driver_data; in inv_mpu_probe()
119 name = id->name; in inv_mpu_probe()
121 return -ENOSYS; in inv_mpu_probe()
126 dev_err(&client->dev, "Failed to register i2c regmap: %pe\n", in inv_mpu_probe()
131 result = inv_mpu_core_probe(regmap, client->irq, name, in inv_mpu_probe()
136 st = iio_priv(dev_get_drvdata(&client->dev)); in inv_mpu_probe()
137 if (inv_mpu_i2c_aux_bus(&client->dev)) { in inv_mpu_probe()
138 /* declare i2c auxiliary bus */ in inv_mpu_probe()
139 st->muxc = i2c_mux_alloc(client->adapter, &client->dev, in inv_mpu_probe()
142 if (!st->muxc) in inv_mpu_probe()
143 return -ENOMEM; in inv_mpu_probe()
144 st->muxc->priv = dev_get_drvdata(&client->dev); in inv_mpu_probe()
145 result = i2c_mux_add_adapter(st->muxc, 0, 0, 0); in inv_mpu_probe()
156 i2c_mux_del_adapters(st->muxc); in inv_mpu_probe()
165 if (st->muxc) { in inv_mpu_remove()
167 i2c_mux_del_adapters(st->muxc); in inv_mpu_remove()
194 MODULE_DEVICE_TABLE(i2c, inv_mpu_id);
274 .name = "inv-mpu6050-i2c",