linux 觸摸屏驅動編寫
早在諾基亞手機還比較流行的時候,那時候觸摸屏用的還不多。但是隨著觸摸屏手機、即智能手機的流行,觸摸屏基本成了手機的標配。所以,今天可以看看觸摸屏驅動在linux上是如何進行的。
1、驅動目錄
drivers/input
2、看看這個目錄的Makefile如何設計
obj-$(CONFIG_INPUT) += input-core.o input-core-y := input.o input-compat.o input-mt.o ff-core.o obj-$(CONFIG_INPUT_TOUCHSCREEN) += touchscreen/
3、除了input-core.o這個文件外,只需要看touchscreen目錄就可以了
config TOUCHSCREEN_S3C2410 tristate "Samsung S3C2410/generic touchscreen input driver" depends on ARCH_S3C24XX || SAMSUNG_DEV_TS depends on S3C_ADC help Say Y here if you have the s3c2410 touchscreen. If unsure, say N. To compile this driver as a module, choose M here: the module will be called s3c2410_ts.
4、看懂了Kconfig之后,再閱讀Makefile,注意S3C_ADC宏可以參考arch/arm/plat-samsung/adc.c
obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o
5、繼續(xù)閱讀s3c2410_ts.c文件
static const struct platform_device_id s3cts_driver_ids[] = {
{ "s3c2410-ts", 0 },
{ "s3c2440-ts", 0 },
{ "s3c64xx-ts", FEAT_PEN_IRQ },
{ }
};
MODULE_DEVICE_TABLE(platform, s3cts_driver_ids);
static struct platform_driver s3c_ts_driver = {
.driver = {
.name = "samsung-ts",
#ifdef CONFIG_PM
.pm = &s3c_ts_pmops,
#endif
},
.id_table = s3cts_driver_ids,
.probe = s3c2410ts_probe,
.remove = s3c2410ts_remove,
};
module_platform_driver(s3c_ts_driver);
6、根據(jù)probe函數(shù),看看有什么需要注意的內容
ts.client = s3c_adc_register(pdev, s3c24xx_ts_select,
s3c24xx_ts_conversion, 1);
if (IS_ERR(ts.client)) {
dev_err(dev, "failed to register adc client\n");
ret = PTR_ERR(ts.client);
goto err_iomap;
}
7、接著,查看是否有中斷函數(shù)被注冊
ret = request_irq(ts.irq_tc, stylus_irq, 0,
"s3c2410_ts_pen", ts.input);
8、最后
很明顯,觸摸屏驅動本質上還是由TOUCHSCREEN_S3C2410和S3C_ADC兩個macro一起完成的。
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
使用 Apache Superset 可視化 ClickHouse 數(shù)據(jù)的兩種方法
Apache Superset是一個強大的BI工具,它提供了查看和探索數(shù)據(jù)的方法。它在 ClickHouse 用戶中也越來越受歡迎。今天將介紹安裝 Superset 的 2 種方法,通過示例代碼給大家介紹的非常詳細,需要的朋友參考下吧2021-06-06
Ubuntu22.04系統(tǒng):fatal:?無法連接到?github.com
這篇文章主要介紹了Ubuntu22.04系統(tǒng):fatal:?無法連接到?github.com的相關資料,需要的朋友可以參考下2024-03-03
linux通過掛載系統(tǒng)光盤搭建本地yum倉庫的方法
linux通過掛載系統(tǒng)光盤搭建本地yum倉庫,使用yum命令加上 list 參數(shù)就可以查看倉庫了。本文介紹的非常詳細,具有參考借鑒價值,感興趣的朋友一起看看吧2016-10-10

