DRV_06_I2C接口触摸屏驱动分析

资料下载

由于无法通过浏览器直接访问coding,您需要使用git工具进行下载:

git clone https://e.coding.net/weidongshan/linux/doc_and_source_for_drivers.git

视频观看

您可以观看百问网的驱动大全视频。

I2C接口触摸屏驱动分析参考资料

Linux 5.x内核

Documentationdevicetreebindingsinputtouchscreengoodix.txtdrivers/input/touchscreen/goodix.c

Linux 4.x内核

Documentationdevicetreebindingsinputtouchscreengoodix.txtdrivers/input/touchscreen/gt9xx/gt9xx.c

设备树

SpeakingPass-打造你的专属雅思口语语料 SpeakingPass-打造你的专属雅思口语语料

使用chatGPT帮你快速备考雅思口语,提升分数

SpeakingPass-打造你的专属雅思口语语料 25 查看详情 SpeakingPass-打造你的专属雅思口语语料 IMX6ULL:Linux-4.9.88/arch/arm/boot/dts/100ask_imx6ull-14x14.dtsSTM32MP157:Linux-5.4/arch/arm/boot/dts/stm32mp15xx-100ask.dtsi

驱动程序框架

DRV_06_I2C接口触摸屏驱动分析

设备树示例

设备树讲解示例

作为一个I2C设备,在某个I2C控制器节点下创建一个子节点。属性包括:

必备,根据这个属性找到驱动程序:compatible = "xxxx";必备,I2C设备地址:reg = ;可选:中断、复位引脚

i2c@00000000 {/* ... */gt928@5d {compatible = "goodix,gt928";reg = ;interrupt-parent = ;interrupts = ;irq-gpios = ;reset-gpios = ;};/* ... */};

100ASK_IMX6ULL

&i2c2 {gt9xx@5d {compatible = "goodix,gt9xx";reg = ;status = "okay";interrupt-parent = ;interrupts = ;pinctrl-names = "default";pinctrl-0 = ;/*pinctrl-1 = ;*//* pinctrl-names = "default", "int-output-low", "int-output-high", "int-input"; pinctrl-0 = ; pinctrl-1 = ; pinctrl-2 = ; pinctrl-3 = ;*/reset-gpios = ;irq-gpios = ;irq-flags = ;                /*1:rising 2: falling*/touchscreen-max-id = ;touchscreen-size-x = ;touchscreen-size-y = ;touchscreen-max-w = ;touchscreen-max-p = ;/*touchscreen-key-map = , ;*/ /*KEY_HOMEPAGE, KEY_BACK*/goodix,type-a-report = ;goodix,driver-send-cfg = ;goodix,create-wr-node = ;goodix,wakeup-with-reset = ;goodix,resume-in-workqueue = ;goodix,int-sync = ;goodix,swap-x2y = ;goodix,esd-protect = ;goodix,pen-suppress-finger = ;goodix,auto-update = ;goodix,auto-update-cfg = ;goodix,power-off-sleep = ;/* ...... */};};

100ASK_STM32MP157

&i2c4 {    gt911@5d {compatible = "goodix,gt928";reg = ;interrupt-parent = ;interrupts = ;reset-gpios = ;irq-gpios = ;irq-flags = ;                /*1:rising 2: falling*/touchscreen-max-id = ;touchscreen-size-x = ;touchscreen-size-y = ;};};

驱动程序分析

分配/设置/注册input_dev

IMX6ULL Linux 4.x

gtp_proberet = gtp_request_input_dev(ts);ts->input_dev = input_allocate_device();......ret = input_register_device(ts->input_dev);ret = gtp_request_irq(ts);

STM32MP157 Linux 5.x

goodix_ts_probeerror = request_firmware_nowait(THIS_MODULE, true, ts->cfg_name,&client->dev, GFP_KERNEL, ts,goodix_config_cb);goodix_config_cbgoodix_configure_dev(ts);ts->input_dev = devm_input_allocate_device(&ts->client->dev);......error = input_register_device(ts->input_dev);error = goodix_request_irq(ts);

注册中断处理函数

IMX6ULL Linux 4.x

ret = request_threaded_irq(ts->client->irq, NULL,gtp_irq_handler,ts->pdata->irq_flags | IRQF_ONESHOT,ts->client->name,ts);

STM32MP157 Linux 5.x

static int goodix_request_irq(struct goodix_ts_data *ts){return devm_request_threaded_irq(&ts->client->dev, ts->client->irq, NULL, goodix_ts_irq_handler, ts->irq_flags, ts->client->name, ts);}

中断处理函数分析

通过I2C函数读取数据、上报数据。

IMX6ULL Linux 4.x

gtp_irq_handlergtp_work_func(ts);point_state = gtp_get_points(ts, points, &key_value);gtp_i2c_readi2c_transfergtp_mt_slot_report(ts, point_state & 0x0f, points);input_mt_slotinput_mt_report_slot_stateinput_report_abs

STM32MP157 Linux 5.x

goodix_ts_irq_handlergoodix_process_events(ts);touch_num = goodix_ts_read_input_report(ts, point_data);goodix_i2c_readi2c_transfergoodix_ts_report_touch_9binput_mt_slotinput_mt_report_slot_statetouchscreen_report_posinput_report_abs

以上就是DRV_06_I2C接口触摸屏驱动分析的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/477199.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
Win7系统不能关机怎么办 Win7无法关机的解决方法
上一篇 2025年11月8日 09:58:18
南昌移动圆满完成2023世界VR大会保障服务任务
下一篇 2025年11月8日 09:58:33

相关推荐

发表回复

登录后才能评论
关注微信