/*linux2.6.22.6触摸屏移植到FL2440.txt*/
/*2011-3-21 -- 2011-3-22*/
Kernel version :2.6.22.6
Crosstool :arm-linux-gcc-3.4.1
Board :FL2440
System :Ubuntu 10.10
Source :regs-adc.h, ts.h, s3c2410_ts.c
1.cp regs-adc.h include/asm-arm/arch-s3c2410/regs-adc.h
2.cp ts.h include/asm-arm/arch-s3c2410/ts.h
3.cp s3c2410_ts.c drivers/input/touchscreen/s3c2440_ts.c
4.在drivers/input/touchscreen/Makefile中添加
obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2440_ts.o
5.在drivers/input/touchscreen/Kconfig中if INPUT_TOUCHSCREEN后加入:
config TOUCHSCREEN_S3C2410
tristate "Samsung S3C2410 touchscreen input driver"
depends on ARCH_S3C2410 && INPUT && INPUT_TOUCHSCREEN
select SERIO
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.
config TOUCHSCREEN_S3C2410_DEBUG
boolean "Samsung S3C2410 touchscreen debug messages"
depends on TOUCHSCREEN_S3C2410
help
Select this if you want debug messages
6.在arch/arm/mach-s3c2440/mach-smdk2440.c添加:
(1)#include <asm/arch/ts.h>
(2)struct s3c2410_ts_mach_info s3c2440_ts_cfg __initdata = {
.delay =20000,
.presc = 55,
.oversampling_shift = 2,
};
(3)smdk2440_devices中添加红字部分:
static struct platform_device *smdk2440_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
/* Mine dm9000 */
&s3c_device_dm9000,
/* Mine dm9000 end */
/* Mine ts */
&s3c_device_ts
/* Mine ts end */
};
(4)在smdk2440_map_io中添加s3c24xx_init_touchscreen(&s3c2440_ts_cfg):
static void __init smdk2440_map_io(void)
{
s3c24xx_init_touchscreen(&s3c2440_ts_cfg);
s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
s3c24xx_init_clocks(12000000);
s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
usb_sbc2410_init();
}
7.在arch/arm/plat-s3c24xx/devs.c 这里面我们加入(要在文件尾,至少要在s3c_adc_resource定义之后,因为我们要用到他。我的文件里,在这段之后仅有一行:#endif // CONFIG_CPU_S32440。也就是说我加在了最后一行的上面):
(1)
/* Touchscreen */
static struct s3c2410_ts_mach_info s3c2410_ts_info;
void __init s3c24xx_init_touchscreen(struct s3c2410_ts_mach_info *hard_s3c2410_ts_info)
{
memcpy(&s3c2410_ts_info,hard_s3c2410_ts_info,sizeof(struct s3c2410_ts_mach_info));
}
//EXPORT_SYMBOL(set_s3c2410ts_info);
struct platform_device s3c_device_ts = {
.name = "s3c2410-ts",
.id = -1,
.num_resources = ARRAY_SIZE(s3c_adc_resource),
.resource = s3c_adc_resource,
.dev = {
.platform_data = &s3c2410_ts_info,
}
};
EXPORT_SYMBOL(s3c_device_ts);
/* Mine ts end */
(2)加入头文件:
#include <asm/arch/ts.h>
8.vi include/asm/plat-s3c24xx/devs.h 加入:
extern struct platform_device s3c_device_ts;
void __init s3c24xx_init_touchscreen(struct s3c2410_ts_mach_info *hard_s3c2410_ts_info);
配置内核:
Device Drivers--->
HID Devices --->
USB HID Boot Protocol drivers --->
<*>USB HIDBP Keyboard(simple Boot) support
< >USB HIDBP Mouse(simple Boot) support
Input device support--->
(320) Horizontal screen resolution
(240) Vertical screen resolution
[*]Touchscreens--->
<*> Samsung S3C2410 touchscreen input driver
[*] Samsung S3C2410 touchscreen debug messages
<*> Touchscreen interface /* 选中这个会生成/dev/ts0 */
(240) Horizontal screen resolution
(320) vertical screen resolution
由于我的开发板是FL2440,直接用这样生成的内核启动QT2后造成了X,Y方向颠倒,因此做了如下修改:
在s3c2410_ts.c中找到如下两句:
input_report_abs(ts.dev, ABS_X, ts.xp);
input_report_abs(ts.dev, ABS_Y, ts.yp);
将此两句修改为如下:
input_report_abs(ts.dev, ABS_X, ts.yp);
input_report_abs(ts.dev, ABS_Y, ts.xp);
这样进去QT2重新校准后一切正常。
参考链接:
s3c2440触摸屏驱动分析:
http://blog.csdn.net/satanwxd/archive/2010/02/02/5279595.aspx
S3C2440上触摸屏驱动实例开发讲解:
http://blog.csdn.net/yangdelong/archive/2010/04/24/5520451.aspx
第五期 mini2440触摸屏驱动移植linux2.6.28内核(完成):
http://www.usr.cc/thread-1467-1-1.html
『分析』mini2440基于2.6.28内核的触屏驱动分析:
http://www.usr.cc/thread-1477-1-3.html