Linux under a lot of devices are used to the I2C, so look at the driver of the I2C, although now understanding may still be human and material resources, but at least there are some basic concepts
Reference:
http://blog.csdn.net/ylyuanlu/article/details/6705942
http://blog.csdn.net/hongjiujing/article/details/4098547
Look at the I2C initialization process:
[CPP] View plain copy print? Static int __init i2c_init (void) { int retval; leaves_debug_flag_driver_i2c_busses_i2c_i2c_core_function_enter retval = bus_register (&i2c_bus_type); if (retval) return retval; #ifdef CONFIG_I2C_COMPAT i2c_adapter_compat_class = class_compat_register ("I2c-adapter"); if (!i2c_adapter_ Compat_class) { retval = -ENOMEM; goto bus_err; } #endif printk ("Leaves before i2c_add_driver\n "); retval = i2c_add_driver (&dummy_driver);     PRINTK ("leaves after i2c_add_driver\n"); if (retval) goto class_err; #ifdef CONFIG_I2C_DEV_RK29 init_ Completion (&i2c_dev_complete); #endif leaves_debug_flag_ driver_i2c_busses_i2c_i2c_core_function_exit return 0; class_err: #ifdef CONFIG_I2C_COMPAT class_ Compat_unregister (i2c_adapter_compat_class); bus_err: #endif bus_unregister (&i2c_bus_type);     LEAVES_DEBUG_FLAG_DRIVER_I2C _busses_i2c_i2c_core_function_exit return retval; }
This function is mainly registered for the I2C bus
2,
This is for the Rockchip chip 30,661 Board initialization, registered 5 I2C devices [CPP] view plain copy print? static void __init rk30_init_i2c (void) {PRINTK ("leaves Enter%s.\n", __function__); #ifdef config_i2c0_rk30 Platform_device_register (&device_i2c0); #endif #ifdef config_i2c1_rk30 platform_device_register (&DEVICE_I2C1); #endif &