struct i2c_bus_recovery_info *bus_recovery_info; const struct i2c_adapter_quirks *quirks; }; /* @ i2c_add_adapter 使用动态的总线号注册 @ 而 i2c_add_numbered_adapter 使用静态总线号注册 @ adapter或adap 要添加到 Linux 内核中的 i2c_adapter,也就是I2C 适配器 @ 返回值:0,成功;负值,失败 */...
728行的i2c_dw_init_recovery_info是在给dw_i2c_dev结构体(指代一个i2c controller ip)初始化lock-up recovery方法, recovery相关的方法保存在i2c_bus_recovery_info结构体中。 <include/linux/i2c.h> 611 struct i2c_bus_recovery_info { 612 int (*recover_bus)(struct i2c_adapter *adap); /* recovery...
structi2c_adapter{structmodule*owner;unsignedintclass;/* 该 I2C bus 支持哪些类型的从设备 */conststructi2c_algorithm*algo;/* the algorithm to access the bus */void*algo_data;/* data fields that are valid for all devices */conststructi2c_lock_operations*lock_ops;structrt_mutexbus_lock;struct...
i2c_init_recovery(adap); /* create pre-declared device nodes */ of_i2c_register_devices(adap); i2c_acpi_register_devices(adap); i2c_acpi_install_space_handler(adap); if (adap->nr < __i2c_first_dynamic_bus_num) i2c_scan_static_board_info(adap); /* Notify drivers */ mutex_lock(&co...
struct i2c_bus_recovery_info *bus_recovery_info; const struct i2c_adapter_quirks *quirks; }; 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. ...
struct i2c_bus_recovery_info *bus_recovery_info; const struct i2c_adapter_quirks *quirks; struct irq_domain *host_notify_domain; struct regulator *bus_regulator; }; 几个重要的成员: name:适配器的名称。 nr:适配器的编号。 bus_lock 和 bus_unlock:用于保护对适配器的并发访问的锁机制。
structi2c_bus_recovery_info*bus_recovery_info; conststructi2c_adapter_quirks*quirks; structirq_domain*host_notify_domain; structregulator*bus_regulator; }; 几个重要的成员: name:适配器的名称。 nr:适配器的编号。 bus_lock和bus_unlock:用于保护对适配器的并发访问的锁机制。
[I2C_NAME_SIZE]; struct i2c_adapter *adapter; /* the adapter we sit on */ struct device dev; /* the device structure */ int init_irq; /* irq set at initialization */ int irq; /* irq issued by device */ struct list_head detected; #if IS_ENABLED(CONFIG_I2C_SLAVE) i2c_slave_...
id_table = xxx_id, }; /* 驱动入口函数 */ static int __init xxx_init(void) { int ret = 0; ret = i2c_add_driver(&xxx_driver); return ret; } /* 驱动出口函数 */ static void __exit xxx_exit(void) { i2c_del_driver(&xxx_driver); } module_init(xxx_init); module_exit(xxx_...
id_table = xxx_id, }; /* 驱动入口函数 */ static int __init xxx_init(void) { int ret = 0; ret = i2c_add_driver(&xxx_driver); return ret; } /* 驱动出口函数 */ static void __exit xxx_exit(void) { i2c_del_driver(&xxx_driver); } module_init(xxx_init); module_exit(xxx_...