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()
39 /* no i2c auxiliary bus on the chip */ in inv_mpu_i2c_aux_bus()
44 if (st->magn_disabled) in inv_mpu_i2c_aux_bus()
56 struct device *dev = indio_dev->dev.parent; in inv_mpu_i2c_aux_setup()
61 * MPU9xxx magnetometer support requires to disable i2c auxiliary bus. in inv_mpu_i2c_aux_setup()
63 * i2c auxiliary bus if it used. in inv_mpu_i2c_aux_setup()
64 * Check for i2c-gate node in devicetree and set magnetometer disabled. in inv_mpu_i2c_aux_setup()
67 switch (st->chip_type) { in inv_mpu_i2c_aux_setup()
71 mux_node = device_get_named_child_node(dev, "i2c-gate"); in inv_mpu_i2c_aux_setup()
73 st->magn_disabled = true; in inv_mpu_i2c_aux_setup()
82 /* enable i2c bypass when using i2c auxiliary bus */ in inv_mpu_i2c_aux_setup()
84 ret = regmap_write(st->map, st->reg->int_pin_cfg, in inv_mpu_i2c_aux_setup()
85 st->irq_mask | INV_MPU6050_BIT_BYPASS_EN); in inv_mpu_i2c_aux_setup()
94 * inv_mpu_probe() - probe function.
95 * @client: i2c client.
109 if (!i2c_check_functionality(client->adapter, in inv_mpu_probe()
111 return -EOPNOTSUPP; in inv_mpu_probe()
113 match = device_get_match_data(&client->dev); in inv_mpu_probe()
116 name = client->name; in inv_mpu_probe()
119 id->driver_data; in inv_mpu_probe()
120 name = id->name; in inv_mpu_probe()
122 return -ENOSYS; in inv_mpu_probe()
127 dev_err(&client->dev, "Failed to register i2c regmap: %pe\n", in inv_mpu_probe()
132 result = inv_mpu_core_probe(regmap, client->irq, name, in inv_mpu_probe()
137 st = iio_priv(dev_get_drvdata(&client->dev)); in inv_mpu_probe()
138 if (inv_mpu_i2c_aux_bus(&client->dev)) { in inv_mpu_probe()
139 /* declare i2c auxiliary bus */ in inv_mpu_probe()
140 st->muxc = i2c_mux_alloc(client->adapter, &client->dev, in inv_mpu_probe()
143 if (!st->muxc) in inv_mpu_probe()
144 return -ENOMEM; in inv_mpu_probe()
145 st->muxc->priv = dev_get_drvdata(&client->dev); in inv_mpu_probe()
146 result = i2c_mux_add_adapter(st->muxc, 0, 0); in inv_mpu_probe()
157 i2c_mux_del_adapters(st->muxc); in inv_mpu_probe()
166 if (st->muxc) { in inv_mpu_remove()
168 i2c_mux_del_adapters(st->muxc); in inv_mpu_remove()
198 MODULE_DEVICE_TABLE(i2c, inv_mpu_id);
290 .name = "inv-mpu6050-i2c",