当前位置: > 华清远见教育科技集团 > 嵌入式学习 > 讲师博文 > 打开arch/arm/mach-s5pc100/mach-smdkc100.c
打开arch/arm/mach-s5pc100/mach-smdkc100.c
时间:2016-12-13作者:华清远见

图1

打开arch/arm/mach-s5pc100/mach-smdkc100.c

图2

Static void __init smdkc100_machine_init(void);

图3

struct i2c_devinfo *devinfo

图4

I2c_devs0

图5

&__i2c_board_list

图6

I2c_register_board_info( 0,         图3 , ARRAY_SIZE(i2c_devs0));
                               图4         = kzalloc(sizeof(*devinfo), GFP_KERNEL);
        devinfo->busnum = busnum;
        devinfo->board_info = *info;
        list_add_tail( &devinfo->list ,          图5       );

图7

struct i2c_devinfo {
                struct list_head list;
                int busnum;
                struct i2c_board_info board_info;
        };

图8

Static struct i2c_driver lm75_driver ={
                .driver ={
                        .name = “lm75”,
                }
                .probe = lm75_probe,
                .remove =lm75_remove,
                .id_table = lm75_ids,
        }

图9

Struct bus_type i2c_bus_type = {
                .name = “i2c”,
                .match = i2c_device_match,
                .probe = i2c_device_probe,
                .remove = i2c_device_remove,
                .shutdown = i2c_device_shutdown,
                .pm = &i2c_device_pm_opw,
        };

图10

Static struct i2c_board_info i2c_devs0[] __initdata= {
                I2C_BOARD_INFO(“lm75”,0x48)
        };

图11

LIST_HEAD(__i2c_board_list);

图12

I2c_add_driver(&lm75_driver);

图13

&i2c_bus_type;

图14

I2c_register_driver(THIS_MODULE, driver)
        Driver->driver.owner = owner;
        Driver->driver.bus =图13

图15

Drive_register( &driver->driver);

图16

Bus_add_driver(drv);

图17

Driver_attach(drv);

图18

Bus_for_each_dev( drv->bus, NULL, drv, __driver_attach ;)

图19

__driver_attach(struct device *dev, void *data)

图20

Driver_match_device(struct device_driver *drv, struce device *dev)

图21

Driver_probe_device(drv, dev);

图22

Really_probe(dev, drv);

图23

Dev->bus->probe(dev)

图24

I2c_device_probe(struce device *dev);
        Struce i2c_driver *driver = to_i2c_driver(dev->driver);
        Client->driver = driver;
        Status = driver->probec(client , i2c_match_id(driver->id_table, client))

流程图

发表评论
评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)