4.触摸屏驱动移植
guolele:其中s3c2410_ts.c是用输入子系统写成的,这里我给出我写的一个。
修改arch/arm/mach-s3c2410/mach-smdk2410.c,添加
static struct s3c2410ts_mach_info s3c2410_tscfg __initdata = {
.delay = 10000,
.presc = 49,
.oversampling_shift = 2,
};
修改static struct platform_device *smdk2410_devices[] __initdata
加入
&s3c_device_ts,
在static void __init smdk2410_init(void)中加入:
s3c24xx_ts_set_platdata(&s3c2410_tscfg);
arch/arm/plat-s3c/include/plat/devs.h 中加入
extern struct platform_device s3c_device_ts;
在driver/input/touchscreen/下添加s3c2410-ts.c文件
在 include/asm-arm/ 下添加 ts.h 文件, 内容如下:
#ifndef __ASM_ARM_S3C2410_TS_H
#define __ASM_ARM_S3C2410_TS_H
struct s3c2410ts_mach_info {
int delay;
int presc;
int oversampling_shift;
};
extern void __init s3c24xx_ts_set_platdata(struct s3c2410ts_mach_info *);
#endif /* __ASM_ARM_S3C2410_TS_H */
修改arch/arm/plat-s3c24xx/devs.c,加入
/* Touch Screen Controller */
struct platform_device s3c_device_ts = {
.name = "s3c2410-ts",
.id = -1,
};
EXPORT_SYMBOL(s3c_device_ts);
void __init s3c24xx_ts_set_platdata(struct s3c2410ts_mach_info *pd)
{
struct s3c2410ts_mach_info *npd;
npd = kmalloc(sizeof(*npd), GFP_KERNEL);
if (npd) {
memcpy(npd, pd, sizeof(*npd));
s3c_device_ts.dev.platform_data = npd;
} else {
printk(KERN_ERR "no memory for TS platform data/n");
}
}
修改drivers/input/touchscreen/Kconfig,在if INPUT_TOUCHSCREEN下加入
config TOUCHSCREEN_S3C2410
tristate “s3c2410 touchscreen”
depends on ARCH_SMDK2410
default y
help
This is used for supporting s3c2410 touchscreen.
arch/arm/mach-s3c2410/mach-smdk2410.c:143: error: variable `s3c2410_tscfg' has initializer but incomplete type
./include/asm/ts.h:struct s3c2410ts_mach_info {
./include/asm/ts.h:extern void __init s3c24xx_ts_set_platdata(struct s3c2410ts_mach_info *);
./include/asm-arm/ts.h:struct s3c2410ts_mach_info {
./include/asm-arm/ts.h:extern void __init s3c24xx_ts_set_platdata(struct s3c2410ts_mach_info *);
arch/arm/mach-s3c2410/mach-smdk2410.c 中
添加 #include <asm/ts.h> 或 #include <asm-arm/ts.h>
arch/arm/plat-s3c24xx/devs.c: In function `s3c24xx_ts_set_platdata':
arch/arm/plat-s3c24xx/devs.c:520: error: dereferencing pointer to incomplete type
arch/arm/plat-s3c24xx/devs.c中添加
#include <asm/ts.h>
drivers/input/touchscreen/s3c2410-ts.c:21:35: asm/plat-s3c/regs-adc.h: 没有该文件或目录
drivers/input/touchscreen/s3c2410-ts.c:22:33: asm/arch/regs-gpio.h: 没有该文件或目录
drivers/input/touchscreen/s3c2410-ts.c:23:26: asm/arch/ts.h: 没有该文件或目录
./arch/arm/plat-s3c/include/plat/regs-adc.h
./arch/arm/mach-s3c2410/include/mach/regs-gpio.h
./arch/arm/plat-s3c64xx/include/plat/regs-gpio.h
./arch/arm/mach-ks8695/include/mach/regs-gpio.h
drivers/input/touchscreen/s3c2410-ts.c中添加
#include <plat/regs-adc.h>
#include <mach/regs-gpio.h>
#include <asm/ts.h>