========================================================== ====
Author: yuanlulu
Http://blog.csdn.net/yuanlulu
No copyright, but please keep this statement for reprinting
========================================================== ====
For more information about how to create i2c_client, see http://blog.csdn.net/yuanlulu/archive/2011/06/21/6557901.aspx.
2.6.34 I2C sub-systems no longer distinguish between legacy model and standard drivermodel drivers. Now there is only one type.
At present, I2C device drivers can be written in two categories (I did not divide them into authoritative ones), and I did not register i2c_driver. I2c_driver is not required for communication with I2C devices. This is only an auxiliary structure. Only i2c_client is required for communication with I2C devices. The i2c_client method is to use i2c_new_device () and i2c_new_probed_device (). That is, method 2 for enumerative generation of i2c_client.
The second method is to write and register the i2c_driver. The idea of this method is to register i2c_client and i2c_driver respectively, then let the kernel driver model match i2c_client and i2c_driver, and call the probe member function of i2c_driver. I2c_driver must be initialized by INT (* probe) (struct i2c_client *, const struct i2c_device_id *);
INT (* remove) (struct i2c_client *); const struct i2c_device_id * id_table; // list of supported i2c_client names. Other members are dependent on the specific situation. The i2c_client method can be set up in 5 S. Except method 2, other methods are used together with the class driver. See http://blog.csdn.net/yuanlulu/archive/2011/06/21/6557901.aspx.
After i2c_client that can match the name in i2c_device_id is registered, the probe function of i2c_driver will be called. You can apply for a private data structure for the device in this function.