linux驱动原载-- touch pannel驱动

本文介绍了Linux中触摸屏驱动的注册过程,涉及i2c_add_driver、i2c_register_driver等函数,以及平台数据的注册。驱动实现细节包括set_bit函数用于设置支持的事件类型,初始化中断、工作队列和定时器。同时讲解了touch驱动的初始化步骤,如input子系统的注册和early_suspend机制的应用。
摘要由CSDN通过智能技术生成

i2c设备:

一. Touch驱动的注册:

1. i2c_add_driver(struct i2c_driver  xx_i2c_driver): 

这个函数仅是调用 i2c_register_driver(struct module *owner, struct i2c_driver *driver);


2. i2c_register_driver(struct module *owner, s`truct i2c_driver *driver):

主要有两个功能:

a. 初始化 xx_i2c_driver 中的 'struct device_driver’ 结构体(xx_i2c_device),最主要的是初始化 ‘struct device_driver’ 结构体中的 ‘bus’参数,赋值为‘i2c_bus_type(一个在i2c中已初始化的结构体)’。i2c_bus_type 结构体中包含的函数值得研究。

b. 调用 driver_register(struct device_driver *drv) 函数;

c. 创建 struct i2c_client:

 bus_for_each_dev(&i2c_bus_type, NULL, driver, __process_new_driver) ---> __process_new_driver() ---> i2c_do_add_adapter() ---> i2c_detect() ---> i2c_detect_address() ---> i2c_new_device()


3. driver_register(struct device_driver *drv)函数:

先通过 xx_i2c_device的成员变量name在 i2c_device_list上检测是否该驱动已经被注册,如果没有注册则调用 bus_add_driver(struct device_driver *drv)函数 进行注册。


4. bus_add_driver(struct device_driver *drv)函数:

这个函数主要是将 xx_i2c_driver 和 xx_i2c_device 挂在到 i2c 总线队列上。

到了底层,基本上都是大量的链表,结构体和指针~


PS:整个注册过程中,xx_i2c_device的成员变量 name 起了非常大的作用。



二. Touch的平台数据(platform-data&

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值