Lines Matching defs:adapter

64 static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver);
427 struct i2c_adapter *adap = client->adapter;
457 /* Keep adapter active when Host Notify is required */
458 pm_runtime_get_sync(&client->adapter->dev);
547 pm_runtime_put_sync(&client->adapter->dev);
574 pm_runtime_put(&client->adapter->dev);
730 static int i2c_check_mux_parents(struct i2c_adapter *adapter, int addr)
732 struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter);
735 result = device_for_each_child(&adapter->dev, &addr,
758 static int i2c_check_addr_busy(struct i2c_adapter *adapter, int addr)
760 struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter);
767 result = device_for_each_child(&adapter->dev, &addr,
775 * @adapter: Target I2C bus segment
776 * @flags: I2C_LOCK_ROOT_ADAPTER locks the root i2c adapter, I2C_LOCK_SEGMENT
777 * locks only this branch in the adapter tree
779 static void i2c_adapter_lock_bus(struct i2c_adapter *adapter,
782 rt_mutex_lock_nested(&adapter->bus_lock, i2c_adapter_depth(adapter));
787 * @adapter: Target I2C bus segment
788 * @flags: I2C_LOCK_ROOT_ADAPTER trylocks the root i2c adapter, I2C_LOCK_SEGMENT
789 * trylocks only this branch in the adapter tree
791 static int i2c_adapter_trylock_bus(struct i2c_adapter *adapter,
794 return rt_mutex_trylock(&adapter->bus_lock);
799 * @adapter: Target I2C bus segment
800 * @flags: I2C_LOCK_ROOT_ADAPTER unlocks the root i2c adapter, I2C_LOCK_SEGMENT
801 * unlocks only this branch in the adapter tree
803 static void i2c_adapter_unlock_bus(struct i2c_adapter *adapter,
806 rt_mutex_unlock(&adapter->bus_lock);
857 * @adap: the adapter managing the device
881 client->adapter = adap;
906 client->dev.parent = &client->adapter->dev;
995 * @adapter: the adapter managing the device
1011 struct i2c_client *i2c_new_dummy_device(struct i2c_adapter *adapter, u16 address)
1017 return i2c_new_client_device(adapter, &info);
1035 * @adapter: the adapter managing the device
1043 struct i2c_adapter *adapter,
1053 client = i2c_new_dummy_device(adapter, address);
1101 dev_dbg(&client->adapter->dev, "Address for %s : 0x%x\n", name, addr);
1102 return i2c_new_dummy_device(client->adapter, addr);
1116 unsigned int i2c_adapter_depth(struct i2c_adapter *adapter)
1120 while ((adapter = i2c_parent_is_i2c_adapter(adapter)))
1124 "adapter depth exceeds lockdep subclass limit\n");
1290 static void i2c_scan_static_board_info(struct i2c_adapter *adapter)
1296 if (devinfo->busnum == adapter->nr &&
1297 IS_ERR(i2c_new_client_device(adapter, &devinfo->board_info)))
1298 dev_err(&adapter->dev,
1374 * @adap: the adapter
1409 if (WARN(!adap->name[0], "i2c adapter has no name"))
1413 pr_err("adapter '%s': no algo supplied!\n", adap->name);
1433 pr_err("adapter '%s': can't create Host Notify IRQs (%d)\n",
1443 pr_err("adapter '%s': can't register device (%d)\n", adap->name, res);
1459 dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name);
1497 * @adap: the adapter to register (with adap->nr initialized)
1516 * i2c_add_adapter - declare i2c adapter, use dynamic bus number
1517 * @adapter: the adapter to add
1520 * This routine is used to declare an I2C adapter when its bus number
1526 * in adap->nr, and the specified adapter became available for clients.
1529 int i2c_add_adapter(struct i2c_adapter *adapter)
1531 struct device *dev = &adapter->dev;
1537 adapter->nr = id;
1538 return __i2c_add_numbered_adapter(adapter);
1543 id = idr_alloc(&i2c_adapter_idr, adapter,
1549 adapter->nr = id;
1551 return i2c_register_adapter(adapter);
1556 * i2c_add_numbered_adapter - declare i2c adapter, use static bus number
1557 * @adap: the adapter to register (with adap->nr initialized)
1560 * This routine is used to declare an I2C adapter when its bus number
1569 * register the adapter before any dynamically allocated ones. Otherwise
1572 * When this returns zero, the specified adapter became available for
1588 struct i2c_adapter *adapter)
1595 if (client->adapter == adapter) {
1596 dev_dbg(&adapter->dev, "Removing %s at 0x%x\n",
1626 * i2c_del_adapter - unregister I2C adapter
1627 * @adap: the adapter being unregistered
1630 * This unregisters an I2C adapter which was previously registered
1638 /* First make sure that this adapter was ever added */
1643 pr_debug("attempting to delete unregistered adapter [%s]\n", adap->name);
1680 dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
1702 /* Clear the device structure in case this adapter is ever going to be
1889 i2c_adapter_compat_class = class_compat_register("i2c-adapter");
1946 dev_err_ratelimited(&adap->dev, "adapter quirk: %s (addr 0x%04x, size %u, %s)\n",
2142 ret = i2c_transfer(client->adapter, &msg, 1);
2162 struct i2c_adapter *adap = client->adapter;
2233 struct i2c_adapter *adapter = temp_client->adapter;
2240 dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n",
2246 if (i2c_check_addr_busy(adapter, addr))
2250 if (!i2c_default_probe(adapter, addr))
2265 dev_err(&adapter->dev,
2272 if (adapter->class & I2C_CLASS_DEPRECATED)
2273 dev_warn(&adapter->dev,
2274 "This adapter will soon drop class based instantiation of devices. "
2279 dev_dbg(&adapter->dev, "Creating %s at 0x%02x\n",
2281 client = i2c_new_client_device(adapter, &info);
2285 dev_err(&adapter->dev, "Failed creating %s at 0x%02x\n",
2291 static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver)
2301 /* Warn that the adapter lost class based instantiation */
2302 if (adapter->class == I2C_CLASS_DEPRECATED) {
2303 dev_dbg(&adapter->dev,
2304 "This adapter dropped support for I2C classes and won't auto-detect %s devices anymore. "
2311 if (!(adapter->class & driver->class))
2318 temp_client->adapter = adapter;
2321 dev_dbg(&adapter->dev,
2322 "found normal entry for adapter %d, addr 0x%02x\n",
2323 i2c_adapter_id(adapter), address_list[i]);
2385 struct i2c_adapter *adapter;
2388 adapter = idr_find(&i2c_adapter_idr, nr);
2389 if (!adapter)
2392 if (try_module_get(adapter->owner))
2393 get_device(&adapter->dev);
2395 adapter = NULL;
2399 return adapter;