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)