modify touch screen according to i2c-rk29.c
authorluowei <lw@rock-chips.com>
Sat, 9 Apr 2011 12:59:13 +0000 (20:59 +0800)
committerluowei <lw@rock-chips.com>
Sat, 9 Apr 2011 12:59:13 +0000 (20:59 +0800)
arch/arm/mach-rk29/board-rk29-a22.c
drivers/input/touchscreen/ili2102_ts.c

index 99af0b2991a2d914fb6fa4a6796d72ccd1cee6d1..14f12379f0fb549b495f4b64801fd6d77ba09958 100755 (executable)
@@ -1587,7 +1587,8 @@ static struct i2c_board_info __initdata board_i2c2_devices[] = {
 {
        .type           = "ili2102_ts",
        .addr           = 0x41,
-       .flags          = 0,
+       .flags          = I2C_M_NEED_DELAY,
+       .udelay      = 600,
        .irq            = RK29_PIN4_PD5,
        .platform_data = &ili2102_info,
 },     
@@ -2203,6 +2204,7 @@ struct rk29_sdmmc_platform_data default_sdmmc0_data = {
 #else
        .use_dma = 0,
 #endif
+       .detect_irq = INVALID_GPIO,
 };
 #endif
 #ifdef CONFIG_SDMMC1_RK29
index 65780bfa65891c2c2a9e0644bd5fa63f01fd3f30..3a115e92bad32bc52e9bea9146dd487e564f4bfd 100755 (executable)
@@ -93,17 +93,19 @@ static void ili2102_ts_work_func(struct work_struct *work)
        start_reg = 0x10;
 
        msg[0].addr = ts->client->addr;
-       msg[0].flags = 0;
+       msg[0].flags = ts->client->flags;
        msg[0].len = 1;
        msg[0].buf = &start_reg;
        msg[0].scl_rate = 200*1000;
+       msg[0].udelay = 500;
 
        msg[1].addr = ts->client->addr;
-       msg[1].flags = I2C_M_RD;
+       msg[1].flags = ts->client->flags | I2C_M_RD;
        msg[1].len = 9; 
        msg[1].buf = buf;//msg[1].buf = (u8*)&buf[0];
        msg[1].scl_rate = 200*1000;
-
+       msg[1].udelay = 500;
+       
        ret = i2c_transfer(ts->client->adapter, msg, 2); 
        if (ret < 0) 
        {
@@ -126,7 +128,7 @@ static void ili2102_ts_work_func(struct work_struct *work)
                                input_mt_sync(ts->input_dev);
                                syn_flag = 1;
                                touch_state[i] = TOUCH_UP;
-                               printk("touch_up \n");
+                               DBG("touch_up \n");
                        }
 
                }
@@ -142,6 +144,7 @@ static void ili2102_ts_work_func(struct work_struct *work)
 
                                if (verify_coord(ts,&x,&y))//goto out;
                                {
+                                       printk("err:x=%d,y=%d\n",x,y);
                                        x = g_x[i];
                                        y = g_y[i];
                                }
@@ -157,7 +160,7 @@ static void ili2102_ts_work_func(struct work_struct *work)
                                syn_flag = 1;
                                touch_state[i] = TOUCH_DOWN;
                                 ts->pendown = 1;
-                               printk("touch_down X = %d, Y = %d\n", x, y);
+                               DBG("touch_down X = %d, Y = %d\n", x, y);
                        }
                        
                }
@@ -289,16 +292,18 @@ static int ili2102_chip_Init(struct i2c_client *client)
        /* get panel information:6bytes */
        start_reg = 0x20;
        msg[0].addr =client->addr;
-       msg[0].flags = 0;
+       msg[0].flags = client->flags;
        msg[0].len = 1;
        msg[0].buf = &start_reg;
        msg[0].scl_rate = 200*1000;
+       msg[0].udelay = 500;
 
        msg[1].addr = client->addr;
-       msg[1].flags = I2C_M_RD;
+       msg[1].flags = client->flags |I2C_M_RD;
        msg[1].len = 6;
        msg[1].buf = (u8*)&buf[0];
        msg[1].scl_rate = 200*1000;
+       msg[1].udelay = 500;
 
        ret = i2c_transfer(client->adapter, msg, 2);   
        if (ret < 0) {
@@ -311,16 +316,18 @@ static int ili2102_chip_Init(struct i2c_client *client)
        /*get firmware version:3bytes */        
        start_reg = 0x40;
        msg[0].addr =client->addr;
-       msg[0].flags = 0;
+       msg[0].flags = client->flags;
        msg[0].len = 1;
        msg[0].buf = &start_reg;
        msg[0].scl_rate = 200*1000;
+       msg[0].udelay = 500;
 
        msg[1].addr = client->addr;
-       msg[1].flags = I2C_M_RD;
+       msg[1].flags = client->flags | I2C_M_RD;
        msg[1].len = 3;
        msg[1].buf = (u8*)&buf[0];
        msg[1].scl_rate =200*1000;
+       msg[1].udelay = 500;
 
        ret = i2c_transfer(client->adapter, msg, 2);
        if (ret < 0) {