linux i2c ctp核心流程学习
来源:互联网 发布:js post html代码 编辑:程序博客网 时间:2024/06/05 22:33
以i2c通信的ctp驱动,本质上是一个i2c驱动,i2c驱动是一个platform型的设备驱动。
platform型驱动主要包含platform device和platform driver,当两者都注册并匹配成功后会触发driver的probe函数。
一般来说i2c device在内核里已经注册,用户的主要工作,是编写i2c的driver,即i2c_driver,进行注册,即可完成工作。
i2c_driver例子:
static struct i2c_driver goodix_ts_driver = {
.class = I2C_CLASS_HWMON,
.probe = goodix_ts_probe, //最重要函数
.remove = goodix_ts_remove,
#ifndef CONFIG_HAS_EARLYSUSPEND
#ifdef CONFIG_PM
.suspend = goodix_ts_suspend,
.resume = goodix_ts_resume,
#endif
#endif
.id_table = goodix_ts_id,//匹配i2c_board_info里的名字
.driver = {
.name = CTP_NAME,
.owner = THIS_MODULE,
},
.address_list = normal_i2c,
};
定义:
struct i2c_driver {
unsigned int class;
/* Notifies the driver that a new bus has appeared or is about to be
* removed. You should avoid using this, it will be removed in a
* near future.
*/
int (*attach_adapter)(struct i2c_adapter *) __deprecated;
int (*detach_adapter)(struct i2c_adapter *) __deprecated;
/* Standard driver model interfaces */
int (*probe)(struct i2c_client *, const struct i2c_device_id *); //probe函数
int (*remove)(struct i2c_client *);
/* driver model interfaces that don't relate to enumeration */
void (*shutdown)(struct i2c_client *);
int (*suspend)(struct i2c_client *, pm_message_t mesg);
int (*resume)(struct i2c_client *);
/* Alert callback, for example for the SMBus alert protocol.
* The format and meaning of the data value depends on the protocol.
* For the SMBus alert protocol, there is a single bit of data passed
* as the alert response's low bit ("event flag").
*/
void (*alert)(struct i2c_client *, unsigned int data);
/* a ioctl like command that can be used to perform specific functions
* with the device.
*/
int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);
struct device_driver driver;
const struct i2c_device_id *id_table;//匹配i2c_board_info里的名字,新架构里没用到?
/* Device detection callback for automatic device creation */
int (*detect)(struct i2c_client *, struct i2c_board_info *);//检测函数
const unsigned short *address_list;//里面要放iic地址
struct list_head clients;//
};
i2c_board_info,某些平台是
/*ctp info*/
static struct sw_device_info ctps[] = {
{ "ft5x_ts", { 0x38}, 0xa3, {0x55,0x08,0x02,0x06,0xa3}, 0},
{ "gt82x", { 0x5d}, 0xf7d, {0x13,0x27,0x28 }, 0},
{ "gslX680", { 0x40}, 0x00, {0x00 }, 0},
{"gt9xx_ts", {0x14, 0x5d}, 0x8140, {0x39 }, 0},
{ "gt811", { 0x5d}, 0x715, {0x11 }, 0},
{ "zet622x", { 0x76}, 0x00, {0x00 }, 0},
};
static struct base_info ctps[] = {
{ "ft5x_ts", { 0x38}, 0xa3, {0x55,0x08,0x02,0x06,0xa3}},
{ "gt82x", { 0x5d}, 0xf7d, {0x13,0x27,0x28 }},
{ "gslX680", { 0x40}, 0x00, {0x00 }},
{"gt9xx_ts", {0x14, 0x5d}, 0x8140, {0x39 }},
{ "gt811", { 0x5d}, 0x715, {0x11 }},
};
,这里的name要和i2c_device_id匹配,新架构里没用到?
初始化工作:
1.构建i2c_driver,包括添加detect
2.添加i2c_driver
probe函数进行的重要工作:
1,INIT_WORK(&ts->work, goodix_ts_work_func);//添加工作进队列
2,ret = gtp_request_input_dev(ts);//申请input
3,ret = gtp_request_irq(ts); //申请中断,中断响应函数会调度工作队列goodix_ts_work_func
0 0
- linux i2c ctp核心流程学习
- Linux I2C 核心
- linux I2C设备驱动流程
- linux i2c驱动注册流程
- Linux I2C框架学习
- Linux I2C核心、总线与设备驱动
- Linux I2C核心、总线与设备驱动
- Linux I2C核心、总线与设备驱动
- Linux I2C核心、总线与设备驱动
- Linux I2C核心、总线与设备驱动
- Linux I2C核心、总线与设备驱动
- Linux I2C核心、总线与设备驱动
- Linux I2C核心、总线与设备驱动
- Linux I2C核心、总线与设备驱动
- Linux I2C核心、总线与设备驱动
- Linux I2C核心、总线与设备驱动
- Linux I2C核心、总线与设备驱动
- Linux I2C核心、总线与设备驱动
- .net在web.config中连接oracle数据库
- 树及二叉树
- 雷神走好
- C#运行网站报错:0x800700b7
- python对字典降序排序
- linux i2c ctp核心流程学习
- 关于i = i++的理解
- FDDB评估工具的安装
- C#入门5.4——迭代语句之while语句
- 内部类、内部接口与继承的加深理解
- Java基本数据类型的总结
- %pS
- 面向切面编程(AOP)的理解
- Loadrunner性能指标分析