//--------------------------------------------------------------------------------------------
// 作者:longtian635241([email protected])
// 论坛ID:idea6410
// 版权:idea6410
// 平台:友坚idea6410开发板
// 发布日期:2012-11-19
// 最后修改:2012-11-19
//http://www.urbetter.com/main.asp
//----------------------------------------------------------------------------------------------
将友坚android2.3内核linux-2.6.36中的dev-ts.c ts 板载初始化和platform 资源初始化文件。
1、arch/arm/mach-s3c64xx/mach-smdk6410.c
注销掉头文件 #include<plat/ts.h>
添加头文件 #include<mach/ts.h>
copy arch/arm/mach-s3c64xx/include/mach/ts.h 到目标内核目录并添加:
#include <linux/sizes.h>
#include <linux/gfp.h>
arch/arm/mach-s3c64xx/dev-ts.c:27: error: 'SZ_256' undeclared here (not in a function)
arch/arm/mach-s3c64xx/dev-ts.c: In function 's3c_ts_set_platdata':
arch/arm/mach-s3c64xx/dev-ts.c:58: error: 'GFP_KERNEL' undeclared (first use in this function)
arch/arm/mach-s3c64xx/dev-ts.c:58: error: (Each undeclared identifier is reported only once
arch/arm/mach-s3c64xx/dev-ts.c:58: error: for each function it appears in.)
arch/arm/mach-s3c64xx/dev-ts.c:58: warning: passing argument 3 of 'kmemdup' makes integer from pointer without a cast
arch/arm/mach-s3c64xx/dev-ts.c: At top level:
arch/arm/mach-s3c64xx/dev-ts.c:64: warning: data definition has no type or storage class
arch/arm/mach-s3c64xx/dev-ts.c:64: warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL'
arch/arm/mach-s3c64xx/dev-ts.c:64: warning: parameter names (without types) in function declaration
make[1]: *** [arch/arm/mach-s3c64xx/dev-ts.o] 错误 1
make: *** [arch/arm/mach-s3c64xx] 错误 2
在include/linux/interrupt中添加
#define IRQF_SAMPLE_RANDOM 0x00000040
drivers/input/touchscreen/s3c-ts.c: In function 's3c_ts_probe':
drivers/input/touchscreen/s3c-ts.c:494: error: 'IRQF_SAMPLE_RANDOM' undeclared (first use in this function)
drivers/input/touchscreen/s3c-ts.c:494: error: (Each undeclared identifier is reported only once
drivers/input/touchscreen/s3c-ts.c:494: error: for each function it appears in.)
copy arch/arm/mach-s3c64xx/dev-ts.c 到目标内核目录在 arch/arm/mach-s3c64xx/Makefile 中添加
obj-$(CONFIG_TOUCHSCREEN_S3C) += dev-ts.o
2、 添加 ts 设备初始化 ,在smdk6410_machine_init () 结构体中
//s3c24xx_ts_set_platdata(NULL);
s3c_ts_set_platdata(&s3c_ts_platform);
添加结构体s3c_ts_platform
static struct s3c_ts_mach_info s3c_ts_platform __initdata = {
.delay = 10000,
.presc = 49,
.oversampling_shift = 2,
.resol_bit = 12,
.s3c_adc_con = ADC_TYPE_2,
};
3、把友坚恒天官方的s3c-tc.c拷贝到drivers/input/touchscreen/ (拷贝android2.3内核的linux-2.6.36中的)
3、1 修改 drivers/input/touchscreen/Makefile
添加 obj-$(CONFIG_TOUCHSCREEN_S3C) += s3c-ts.o
3、2 修改 drivers/input/tourch/screen/Kconfig
添加 config TOUCHSCREEN_S3C
config TOUCHSCREEN_S3C
tristate "S3C touchscreen driver"
depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5P64XX || ARCH_S5PC1XX
default y
help
Say Y here to enable the driver for the touchscreen on the
S3C SMDK board.
/*--------------------------- Common definitions for S3C ---------------------------*/
/* The following definitions will be applied to S3C24XX, S3C64XX, S5PC1XX. */
/*-----------------------------------------------------------------------------------*/
#define S3C_ADCREG(x) (x)
#define S3C_ADCCON S3C_ADCREG(0x00)
#define S3C_ADCTSC S3C_ADCREG(0x04)
#define S3C_ADCDLY S3C_ADCREG(0x08)
#define S3C_ADCDAT0 S3C_ADCREG(0x0C)
#define S3C_ADCDAT1 S3C_ADCREG(0x10)
#define S3C_ADCUPDN S3C_ADCREG(0x14)
#define S3C_ADCCLRINT S3C_ADCREG(0x18)
#define S3C_ADCMUX S3C_ADCREG(0x1C)
#define S3C_ADCCLRWK S3C_ADCREG(0x20)
/* ADCCON Register Bits */
#define S3C_ADCCON_RESSEL_10BIT (0x0<<16)
#define S3C_ADCCON_RESSEL_12BIT (0x1<<16)
#define S3C_ADCCON_ECFLG (1<<15)
#define S3C_ADCCON_PRSCEN (1<<14)
#define S3C_ADCCON_PRSCVL(x) (((x)&0xFF)<<6)
#define S3C_ADCCON_PRSCVLMASK (0xFF<<6)
#define S3C_ADCCON_SELMUX(x) (((x)&0x7)<<3)
#define S3C_ADCCON_SELMUX_1(x) (((x)&0xF)<<0)
#define S3C_ADCCON_MUXMASK (0x7<<3)
#define S3C_ADCCON_RESSEL_10BIT_1 (0x0<<3)
#define S3C_ADCCON_RESSEL_12BIT_1 (0x1<<3)
#define S3C_ADCCON_STDBM (1<<2)
#define S3C_ADCCON_READ_START (1<<1)
#define S3C_ADCCON_ENABLE_START (1<<0)
#define S3C_ADCCON_STARTMASK (0x3<<0)
/* ADCTSC Register Bits */
#define S3C_ADCTSC_UD_SEN (1<<8)
#define S3C_ADCTSC_YM_SEN (1<<7)
#define S3C_ADCTSC_YP_SEN (1<<6)
#define S3C_ADCTSC_XM_SEN (1<<5)
#define S3C_ADCTSC_XP_SEN (1<<4)
#define S3C_ADCTSC_PULL_UP_DISABLE (1<<3)
#define S3C_ADCTSC_AUTO_PST (1<<2)
#define S3C_ADCTSC_XY_PST(x) (((x)&0x3)<<0)
/* ADCDAT0 Bits */
#define S3C_ADCDAT0_UPDOWN (1<<15)
#define S3C_ADCDAT0_AUTO_PST (1<<14)
#define S3C_ADCDAT0_XY_PST (0x3<<12)
#define S3C_ADCDAT0_XPDATA_MASK (0x03FF)
#define S3C_ADCDAT0_XPDATA_MASK_12BIT (0x0FFF)
/* ADCDAT1 Bits */
#define S3C_ADCDAT1_UPDOWN (1<<15)
#define S3C_ADCDAT1_AUTO_PST (1<<14)
#define S3C_ADCDAT1_XY_PST (0x3<<12)
#define S3C_ADCDAT1_YPDATA_MASK (0x03FF)
#define S3C_ADCDAT1_YPDATA_MASK_12BIT (0x0FFF)
5、在arch/arm/plat-samsung/devs.c中添加
//add by hcm
#undef CONFIG_SAMSUNG_DEV_TS
//add hcm end
#ifdef CONFIG_SAMSUNG_DEV_TS
static struct resource s3c_ts_resource[] = {
[0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256),
[1] = DEFINE_RES_IRQ(IRQ_TC),
};
static struct s3c2410_ts_mach_info default_ts_data __initdata = {
.delay = 10000,
.presc = 49,
.oversampling_shift = 2,
};
struct platform_device s3c_device_ts = {
.name = "s3c64xx-ts",
.id = -1,
.num_resources = ARRAY_SIZE(s3c_ts_resource),
.resource = s3c_ts_resource,
};
void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
{
if (!pd)
pd = &default_ts_data;
s3c_set_platdata(pd, sizeof(struct s3c2410_ts_mach_info),
&s3c_device_ts);
}
#endif /* CONFIG_SAMSUNG_DEV_TS */
arch/arm/plat-samsung/built-in.o:(.data+0x9a8): multiple definition of `s3c_device_ts'
arch/arm/mach-s3c64xx/built-in.o:(.data+0x3a30): first defined here
make: *** [vmlinux] 错
6、配置内核:
System Type --->
[ ] ADC common driver support (一定不能选,否则占用触摸adc)
Device Drivers --->
Input device support --->
<*> Event interface
[*] Touchscreens --->
<*> S3C touchscreen driver (只选这一个,其他的不要选)
7、 移植成功serial则显示:
S3C Touchscreen driver, (c) 2008 Samsung Electronics
s3c-ts.c SCREEN_X=800 SCREEN_Y=480
S3C TouchScreen got loaded successfully : 12 bits
input: S3C TouchScreen as /devices/virtual/input/input0
8、测试
进入界面测试ok,可tslib不能用(转载(*^__^*) 嘻嘻……)(tslib更新请关注后面更新)