操作环境:
开发板:mini2440
CPU:(samsung)s3c2440
Linux版本:Linux-2.6.32.2
i2c_add_numbered_adapter ---> i2c_register_adapter --> i2c_scan_static_board_info-->__i2c_board_list--->i2c_new_device
i2c_register_board_info-->list_add_tai-->__i2c_board_list
/************* i2c-s3c2410.c ************/
platform_driver_register(&s3c24xx_i2c_driver);
.id_table = s3c24xx_driver_ids, ----> .name = "s3c2410-i2c", <-------
.probe = s3c24xx_i2c_probe, ----> i2c_add_numbered_adapter(&i2c->adap)
|
| i2c-core.c
V
i2c_register_adapter(adap) ---> i2c_scan_static_board_info(adap) --->
list_for_each_entry(devinfo, &__i2c_board_list, list)
i2c_new_device(adapter,&devinfo->board_info) ---> device_register(&client->dev)
/************* mach-mini2440.c ************/
s3c_i2c0_set_platdata(NULL);
s3c_device_i2c0.dev.platform_data = npd;
npd->cfg_gpio = s3c_i2c0_cfg_gpio; --->
s3c2410_gpio_cfgpin(S3C2410_GPE(15), S3C2410_GPE15_IICSDA);
s3c2410_gpio_cfgpin(S3C2410_GPE(14), S3C2410_GPE14_IICSCL);
i2c_register_board_info(0, i2c_devs, ARRAY_SIZE(i2c_devs)); ---> list_add_tail(&devinfo->list, &__i2c_board_list); ---->i2c-core.c
static struct i2c_board_info i2c_devs[ ] __initdata = { |
{ I2C_BOARD_INFO("24c08", 0x50), }, <------ V
}; device_register(&client->dev)
platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices))
platform_device_register(devs[i])
&s3c_device_i2c0,
| dev-i2c0.c
V
.name = "s3c2410-i2c", <-------
/************* at24.c ************/
i2c_add_driver(&at24_driver); ---> i2c_register_driver(THIS_MODULE, driver);
static struct i2c_driver at24_driver = {
.probe = at24_probe,
.id_table = at24_ids, ---> { "24c08", AT24_DEVICE_MAGIC(8192 / 8, 0) }, <------
};