rk29_phone:fix touch screen driver
authorhhb <hhb@rock-chips.com>
Wed, 30 Mar 2011 13:13:46 +0000 (21:13 +0800)
committerhhb <hhb@rock-chips.com>
Wed, 30 Mar 2011 13:13:46 +0000 (21:13 +0800)
arch/arm/mach-rk29/board-rk29-phonesdk.c
drivers/input/touchscreen/gt801_ts.c

index 4a4317eeb8eaf722f9a87a0f41b0efe4e39a2ec3..e1502c77c731bd342dbd75008e3a26322dc5562f 100644 (file)
@@ -391,7 +391,7 @@ static struct gt801_platform_data gt801_info = {
        .y_min                  = 0,
        .y_max                  = 800,
        .gpio_reset     = GT801_GPIO_RESET,
-       .gpio_reset_active_low = 1,
+       .gpio_reset_active_low = 0,
        .gpio_pendown           = GT801_GPIO_INT,
     .pendown_iomux_name = GPIO4D5_CPUTRACECTL_NAME,
     .resetpin_iomux_name = NULL,
@@ -1348,13 +1348,13 @@ struct wm8994_pdata wm8994_platdata = {
        .ldo = {
                {
                        .enable = 0,
-                       //TCA6424_P11
-                       .supply = "wm8994-ldo1",
+                       //RK29_PIN5_PA1
+                       .supply = NULL,
                        .init_data = &regulator_init_data_ldo1,
                },
                {
                        .enable = 0,
-                       .supply = "wm8994-ldo2",                
+                       .supply = NULL,         
                        .init_data = &regulator_init_data_ldo2,
                }
        },
@@ -1433,7 +1433,7 @@ struct rk29_i2c_platform_data default_i2c2_data = {
        .bus_num    = 2,
        .flags      = 0,
        .slave_addr = 0xff,
-       .scl_rate  = 400*1000,
+       .scl_rate  = 200*1000,
        .mode           = I2C_MODE_IRQ,
        .io_init = rk29_i2c2_io_init,
 };
@@ -1473,7 +1473,7 @@ static struct i2c_board_info __initdata board_i2c0_devices[] = {
 #if defined (CONFIG_SND_SOC_WM8994)
        {
                .type                   = "wm8994",
-               .addr           = 0x34,
+               .addr           = 0x1a,
                .flags                  = 0,
                .platform_data  = &wm8994_platdata,     
        },
@@ -1562,7 +1562,7 @@ static struct i2c_board_info __initdata board_i2c2_devices[] = {
 #if defined (CONFIG_TOUCHSCREEN_GT801_IIC)
 {
        .type           = "gt801_ts",
-       .addr           = 0xAA,
+       .addr           = 0x55,
        .flags          = 0,
        .irq            = RK29_PIN4_PD5,
        .platform_data = &gt801_info,
@@ -2836,7 +2836,7 @@ static struct spi_board_info board_spi_devices[] = {
        {
                .modalias       = "wm8310",
                .chip_select    = 1,
-               .max_speed_hz   = 2*1000*1000,
+               .max_speed_hz   = 1*1000*1000,
                .bus_num        = 1,
                .irq            = RK29_PIN4_PD0,
                .platform_data = &wm831x_platdata,
@@ -2875,6 +2875,11 @@ static void __init machine_rk29_board_init(void)
        gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
        pm_power_off = rk29_pm_power_off;
 
+// codec                
+       gpio_request(RK29_PIN5_PA1, NULL);                       
+       gpio_direction_output(RK29_PIN5_PA1,GPIO_HIGH);                 
+       gpio_free(RK29_PIN5_PA1);
+
 #ifdef CONFIG_WIFI_CONTROL_FUNC
                 rk29sdk_wifi_bt_gpio_control_init();
 #endif
index d7a46b25fc717773b7370c12b2a1ec46001e3f7b..c40fe26a50e23135e4c77cd0119dd0fb69eed3d6 100755 (executable)
@@ -43,7 +43,7 @@
     #define TOUCH_NUMBER 2
 #endif
 
-#define TOUCH_REG_NUM 5 //ÿ×é×ø±êÐèÒªµÄ¼Ä´æÆ÷ÊýĿ
+#define TOUCH_REG_NUM 5 //ÿ�������Ҫ�ļĴ�����Ŀ
 
 const unsigned char GT801_RegData[GT801_REGS_NUM]={    
        0x19,0x05,0x06,0x28,0x02,0x14,0x14,0x10,0x40,0xB0,0x01,0xE0,0x03,0x4C,0x78,0x9A,0xBC,0xDE,0x65,0x43,0x20,0x11,0x00,0x00,0x00,0x00,0x05,0xCF,0x20,0x0B,0x0D,0x8D,0x32,0x3C,0x1E,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01
@@ -109,6 +109,7 @@ static int gt801_read_regs(struct i2c_client *client, u8 reg, u8 buf[], unsigned
 static int gt801_write_regs(struct i2c_client *client, u8 reg, u8 const buf[], unsigned short len)
 {
        int ret;
+       int i = len;
        ret = i2c_master_reg8_send(client,reg, buf, len, 200*1000);
        if (ret < 0) {
          printk("gt801_ts_work_func:i2c_transfer fail =%d\n",ret);
@@ -205,13 +206,14 @@ static void gt801_ts_work_func(struct work_struct *work)
                }
                else{
                        x = ((( ((unsigned short)buf[i+ptxh] )<< 8) ) | buf[i+ptxl]);
-                       y= (((((unsigned short)buf[i+ptyh] )<< 8) )| buf[i+ptyl]);
-                       
+                       y = (((((unsigned short)buf[i+ptyh] )<< 8) )| buf[i+ptyl]);
+                       x = 480-x;
+                       y = 800-y;
                        if (ts->swap_xy)
                                swap(x, y);
                        
                        if (verify_coord(ts,&x,&y))
-                               ;//goto out;    
+                               ;//goto out;
                        
                        gt801printk("input_report_abs--%d-%d-(%d/%d)\n", i,touch_state_index, x, y);    
                        input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, 1); //Finger Size
@@ -284,8 +286,6 @@ static int __devinit setup_resetPin(struct i2c_client *client, struct gt801_ts_d
                return err;
        }
        
-       gpio_set_value(ts->gpio_reset, ts->gpio_reset_active_low? GPIO_LOW:GPIO_HIGH);
-
        err = gpio_direction_output(ts->gpio_reset, ts->gpio_reset_active_low? GPIO_LOW:GPIO_HIGH);
        if (err) {
                dev_err(&client->dev, "failed to pulldown resetPin GPIO%d,err%d\n",
@@ -293,13 +293,10 @@ static int __devinit setup_resetPin(struct i2c_client *client, struct gt801_ts_d
                gpio_free(ts->gpio_reset);
                return err;
        }
-       
-    mdelay(100);
-
+       mdelay(100);
        gpio_set_value(ts->gpio_reset, ts->gpio_reset_active_low? GPIO_HIGH:GPIO_LOW);
-
        mdelay(100);
-        
+
        return 0;
 }
 static int __devinit setup_pendown(struct i2c_client *client, struct gt801_ts_data *ts)