Kernel2.6.34: how to compile the I2C driver

Source: Internet
Author: User

========================================================== ====
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.