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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值