linux2.6.30.4 內核移植(2)觸摸屏驅動

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>

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