Get the App
SLTechnology News&Howtos  ›  Servers  › 

Programming of linux Touch screen driver

Shulou Source: shulou.com Published: 2022-06-02 04:37:44 10月03日 Update

As early as when Nokia phones were still popular, touch screens were not used much at that time. However, with the popularity of touch screen mobile phones, that is, smart phones, touch screen has basically become the standard of mobile phones. So today we can see how the touchscreen driver works on the linux.

1. Driver directory

Drivers/input

2. See how the Makefile of this directory is designed.

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. Except for the file input-core.o, you only need to look at the touchscreen directory

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. After you understand Kconfig, read Makefile. Note that S3C_ADC macros can refer to arch/arm/plat-samsung/adc.c.

Obj-$ (CONFIG_TOUCHSCREEN_S3C2410) + = s3c2410_ts.o

5. Continue to read the s3c2410_ts.c file

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. According to the probe function, see what you need to pay attention to

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. Next, check to see if any interrupt functions are registered

Ret = request_irq (ts.irq_tc, stylus_irq, 0, "s3c2410_ts_pen", ts.input)

8. Finally

Obviously, the touchscreen driver is essentially done by two macro, TOUCHSCREEN_S3C2410 and S3C_ADC.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Tags: Touchscreen mobile phone driver directory content function file time obvious two that is intelligence essence or N.Nokia reference learning help support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MySQL Xiaomi Shulou Tech Info MariaDB