Linux I²c standard Interface (ii)

Source: Internet
Author: User

Driver Operation Method: The drive of the I²C device can also be implemented by ordinary device driver, as usual drive, then the application layer can be like reading ordinary files, no need to consider reading and writing timing. In fact, the common device driver can also be implemented in two ways,

1) Build character device driver, directly operate the relevant registers of the I²C bus in Open,read,write and other functions to read and write the I²C device, but this method is different from the platform, the device must be re-written to drive

2) Call the I2c_transfer function provided by I2C-CORE.C in the device driver to achieve communication with the I²C device, so as long as the different devices write different drivers.

The first type of character device-driven approach, similar to the single-chip microcomputer does not have an I²C subsystem, directly operate the i²c IO port; In fact, this approach is similar to Gpio analog i²c, I have done gpio analog i²c driver. Here we mainly explain the second way.

1. I am currently using June Zheng's 3.08 kernel, need to modify the/kernel-3.08/arch/mips/xburst/soc-4775/board//trunk/core/core-misc.c file

Add qn8007 FM Info
static struct I2c_board_info duotin_i2c_dev[] = {
{
I2c_board_info ("dt-qn8007", 0x2b),
},
};

The static int __init core_board_init (void) function adds the add 0:I2C bus0; Add Duotin_i2c_dev to I2cbus0

I2c_register_board_info (0, Duotin_i2c_dev, array_size (Duotin_i2c_dev));

2. Add QN8007.C device driver files in the/kernel-3.08/drivers/i2c/chips/directory and modify kconfig and makefile files as appropriate

Linux I²c standard Interface (ii)

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.