FL2440觸摸屏驅動添加

本文爲作者原創,轉載請附明原地址:https://mp.csdn.net/postedit/79996008
一、修改內核源碼。
[shun@localhost linux-3.0]$ vim arch/arm/mach-s3c2440/mach-smdk2440.c

/* ADD BY LIUSHUN 2018-04-15 20:13 */
static struct s3c2410_ts_mach_info smdk2440_ts_cfg __initdata = {
        .delay = 10000,
         .presc = 49,
         .oversampling_shift = 2,
         };

static struct platform_device *smdk2440_devices[] __initdata = {
        &s3c_device_ohci,
        &s3c_device_lcd,
        &s3c_device_wdt,
        &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_dm9000,
        &s3c_device_adc,   /*ADD BY LIUSHUN 2018-04-15 20:15 */
        &s3c_device_ts,    /*ADD BY LIUSHUN 2018-04-15 20:15 */
};

static void __init smdk2440_machine_init(void)
{
        s3c24xx_fb_set_platdata(&smdk2440_fb_info);
        s3c_i2c0_set_platdata(NULL);
        s3c24xx_ts_set_platdata(&smdk2440_ts_cfg); /*ADD BY LIUSHUN 2018-04-15 20:21*/

        platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
        smdk_machine_init();
}

[shun@localhost linux-3.0]$ vim drivers/input/touchscreen/s3c2410_ts.c
//input_report_key(ts.input, BTN_TOUCH, 1);
input_report_abs(ts.input, ABS_PRESSURE, 1); /*change by liushun 2018-04-15 20:29*/

//input_report_key(ts.input, BTN_TOUCH, 0);
input_report_abs(ts.input, ABS_PRESSURE, 0); /*change by liushun 2018-04-15 20:31*/

//ts.input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
ts.input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) | BIT(EV_SYN); /*change by liushun 2018-04-15 20:34 */
ts.input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
input_set_abs_params(ts.input, ABS_X, 0, 0x3FF, 0, 0);
input_set_abs_params(ts.input, ABS_Y, 0, 0x3FF, 0, 0);
input_set_abs_params(ts.input, ABS_PRESSURE, 0, 1, 0, 0);  /*ADD by liushun 2018-04-15 20:36*/



二、配置內核。
[shun@localhost linux-3.0]$ make menuconfig

Device Drivers  --->
        Input device support  --->
                [*]   Touchscreens  --->
                        < *>   Samsung S3C2410/generic touchscreen input driver
[shun@localhost linux-3.0]$ make

三、燒錄到開發版上。

到/dev/input/路徑下查看是否存在 event0設備節點,若存在則說明觸摸屏驅動移植完成。









發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章