6. Conclusion
Based on the rich architecture diagram of the previous analysis
TIPS: I2C Adapter driver is not necessarily based on platform implementation, here is the s3c-i2c as an example.
I2c_driver, i2c_client, and i2c_adapter
I2c_driver and i2c_client are one-to-multiple relationships. One i2c_driver can support multiple i2c_clients of the same type. Call the i2c_add_driver function to register the i2c_driver to the I2C bus. Call the i2c_register_board_info function to register the i2c_client to the global linked list _ i2c_board_list. When you call i2c_add_adapter to register the adapter, traverse the _ i2c_board_list linked list, i2c_register_adapter ()-> i2c_scan_static_board_info ()-> i2c_new_device. When i2c_add_driver is called, The i2c_driver is first registered to the I2C bus, and then the I2C
The match function registered by bus is used for matching. If the matching is successful, the probe function registered in I2C bus is called first, and the probe function implemented in i2c_driver is called to complete the corresponding work.
* ******** If any error occurs, please kindly advise ********