heycare 发表于 2012-11-20 10:37

基于2440开发板移植ft5x06系列的电容屏驱动

最近公司项目要求,需要在s3c2440平台上移植ft5x06系列的触摸屏。
想请问大家,有人做个该方面的工作吗?求指点一下方向、现在遇到挺多问题的:
1、ft5x06驱动移植,编译成功。但是/dev/event0设备没有产生,通过调试发现ft5x06_ts_prove函数没进去,导致设备注册不成功
2、ft5x06驱动依赖i2c,不知道是不是i2c驱动不行。内核已加入i2c驱动

imlvye 发表于 2012-11-20 17:21

回复 1# heycare
首先应该去看看你有没有使用i2c_register_board_info函数去注册一个ft5x06的device,及其注册的i2c设备的地址是否正确。


   

孤行者_cuit 发表于 2012-11-20 19:58

回复 1# heycare

移植ft5x06驱动,flow如下:
1. 向input sub system注册input device, 这步完成后会在会生成/dev/eventXX
    (1)input_allocate_device()
   (2)input_register_device()
2. 指定input device是CTP设备,主要是通过指定设备报事件能力
   set_bit()
   input_set_abs_params()
3.打通i2c。需要写好i2c主设备的驱动
4.从ft5x06读坐标,报事件

   

heycare 发表于 2012-11-20 21:56

感谢楼上2位的回答。 我在mach-xxx.c中加入了一些代码:


static struct i2c_board_info ft5x06_i2c_dev[] __initdata = {
        {
        .type = "ft5x0x_ts",
        .addr = 0x38,
        .irq = IRQ_EINT20,
        }
};

static struct s3c2410_platform_i2c i2c_ts_cfg __initdata = {
        .flags   = 0,
        .slave_addr = 0x38, // 7 bit address
        .frequency = 100*1000, // 100 kHz
        .sda_delay = 2,
};

static void __init tq2440_machine_init(void)
{
        s3c24xx_fb_set_platdata(&tq2440_fb_info);
        s3c_i2c0_set_platdata(NULL);

        platform_add_devices(tq2440_devices, ARRAY_SIZE(tq2440_devices));
        EmbedSky_machine_init();
        s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_EINT3);
        s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_EINT5);
        s3c_i2c0_set_platdata(&i2c_ts_cfg);
        i2c_register_board_info(0, ft5x06_i2c_dev,ARRAY_SIZE(ft5x06_i2c_dev));
        s3c2410_gpio_setpin(S3C2410_GPG12, 0);

        s3c2410_gpio_cfgpin(S3C2410_GPG12, S3C2410_GPIO_OUTPUT);
       
        s3c24xx_udc_set_platdata(&EmbedSky_udc_cfg);
}

编译后下载到板子上,启动Linux的时候出现了如下问题:

==ft5x0x_ts_init==
==ft5x0x_ts_probe=
==kzalloc=
input: ft5x0x_ts as /devices/virtual/input/input0
msg ft5x0x_read_reg i2c read error: -6
Firmware version = 0xa6
==probe over =
ret=0

希望能够得到解答,再次感谢

imlvye 发表于 2012-11-21 10:46

回复 4# heycare
i2c访问出错了。连寄存器都访问失败,检测硬件电路,i2c adapter驱动等


   

heycare 发表于 2012-11-21 14:32

我使用的源码是FT5X06提供的,他里面使用的中断号是IRQ_EINT6,我使用的平台是s3c2440。
SDA对应EINT5(GPF5)
SCL对应EINT3(GPF3)
是不是我要把中断号改成IRQ_EINT5

heycare 发表于 2012-11-21 15:03

i2c-adapter i2c-0: master_xfer W, addr=0x38, len=1
write mode
s3c2440-i2c s3c2440-i2c: START: 000000d0 to IICSTAT, 70 to DS
s3c2440-i2c s3c2440-i2c: iiccon, 000000e0
s3c2440-i2c s3c2440-i2c: ack was not received
s3c2440-i2c s3c2440-i2c: STOP
s3c2440-i2c s3c2440-i2c: master_complete -6
s3c2440-i2c s3c2440-i2c: incomplete xfer (-6)
i2c_write_interface error line = 99, ret = -6
firmware version = 0x81

baimingyong 发表于 2013-04-08 17:27

硬件问题。。。。。

noudle 发表于 2013-04-22 10:05

请问楼主问题解决了没?我现在遇到点问题,求大神指点。http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=4077664&page=1#pid23846633

uliux 发表于 2013-04-22 15:37

本帖最后由 uliux 于 2013-04-22 15:38 编辑

这个驱动是很简单的,你的cpu也很老了!
至于你的问题是probe函数没进去,那问题肯定在两个方面的?如果第一个就是设备的注册,第二个就是驱动的注册,并且probe没进去肯定是你的设备的结构体的name成员和driver结构体的名字必须匹配,因为你的模块加载的时候device链表和driver链表在bus总根上就是通过name的字符串来匹配的,我没看到你的driver中有name。
哦时间好早了 , 不好意思我没看清楚!
页: [1] 2
查看完整版本: 基于2440开发板移植ft5x06系列的电容屏驱动