i2c_driver结构体 /* @ 定义在include/linux/i2c.h文件中 @ i2c_driver结构体 */ struct i2c_driver { unsigned int class; /* Notifies the driver that a new bus has appeared. You should * avoid using this, it will be removed in a near future. */ int (*attach_adapter)(struct i2c_adapte...
int (*probe)(struct i2c_client * , const struct i2c_device_id *); int (*remove)(struct i2c_client *); struct device_driver driver; const struct i2c_device_id *id_table; }; //注册与注销: int i2c_add_driver(struct i2c_driver *driver); void i2c_del_driver(struct i2c_driver *driver...
i2c_driver类似platform_driver,是我们编写I2C设备驱动重点要处理的内容,i2c_driver在上面已经介绍了其结构体的具体内容。 对于我们 I2C 设备驱动编写人来说,重点工作就是构建i2c_driver,构建完成以后需要向Linux内核注册这个i2c_driver。 那么如何注册呢? 使用下面的这个函数: 代码语言:javascript 代码运行次数:0 运行 ...
7. 48 * 8. 49 * Systems using the Linux I2C driverstack can declare tables of board info 9. 50 * while they initialize. This should be done in board-specific initcode 10. 51 * near arch_initcall() time, orequivalent, before any I2C adapter driver is 11. 52 * registered. For examp...
i2c_driver 类似 platform_driver,是我们编写 I2C 设备驱动重点要处理的内容, i2c_driver 结构体定义在 include/linux/i2c.h 文件中,内容如下: structi2c_driver{ unsignedintclass; /*Notifiesthedriverthatanewbushasappeared.Youshouldavoid *usingthis,itwillberemovedinanearfuture. ...
分类: LINUX 作者:apple_guet 一、i2c-dev驱动分析 1.1、设备驱动注册 分析这个驱动,还是从module_init()和module_exit()开始,程序如下: 点击(此处)折叠或打开 static int __init i2c_dev_init(void) { int res; printk(KERN_INFO "i2c /dev entries driver\n"); ...
在xilinx-linux中,i2c从设备是通过dts文件传递给内核的,内核通过zynq_init_machine函数注册所有的i2c从设备,i2c_client.I2C的linux必须知道4个结构体:i2c_adapter,i2c_algorithm,i2c_client,i2c_driverstruct i2c_adapter {struct module owner;unsigned int class; / classes to allow probing for /const struct i2c...
还剩下设备和驱动,i2c_client就是描述设备信息的,i2c_driver描述驱动内容,类似于platform_driver。 1、i2c_client结构体 i2c_client结构体定义在include/linux/i2c.h文件中,内容如下: 示例代码61.1.2.1 i2c_client结构体 217struct i2c_client { 218unsignedshort flags; /* 标志 */ 219unsignedshort addr; /* ...
Linux内核驱动程序示例: drivers/eeprom/at24.c 1. I2C驱动程序的层次 I2C Core就是I2C核心层,它的作用: 提供统一的访问函数,比如i2c_transfer、i2c_smbus_xfer等 实现I2C总线-设备-驱动模型,管理:I2C设备(i2c_client)、I2C设备驱动(i2c_driver)、I2C控制器(i2c_adapter) ...
00000083 return i2c_match_id(driver->id_table, client) != NULL; 00000084 00000085 return 0; 00000086 } 在IIC子系统中,用struct i2c_client来描述一个具体的IIC设备(IIC从机)。73行,如果没有IIC设备的话就直接返回0,表示匹配不成功。 77行,用of的方式进行匹配,应该是设备树方面的,具体没了解过。