#include <linux/completion.h>\r
#include <asm/uaccess.h>\r
#include <linux/input/mt.h>\r
+#include <plat/board.h>\r
#include <mach/iomux.h>\r
\r
static struct workqueue_struct *goodix_wq;\r
static const char *s3c_ts_name = "gt811_ts";\r
//static struct point_queue finger_list;\r
struct i2c_client * i2c_connect_client = NULL;\r
+int reset_pin = 0;\r
//EXPORT_SYMBOL(i2c_connect_client);\r
static struct proc_dir_entry *goodix_proc_entry;\r
static short goodix_read_version(struct gt811_ts_data *ts); \r
{\r
if(point_data[3]==0xF0)\r
{\r
- gpio_direction_output(SHUTDOWN_PORT, 0);\r
+ gpio_direction_output(reset_pin, 0);\r
msleep(1);\r
- // gpio_direction_input(SHUTDOWN_PORT);\r
- gpio_set_value(SHUTDOWN_PORT,0);\r
+ // gpio_direction_input(reset_pin);\r
+ gpio_set_value(reset_pin,0);\r
msleep(100);\r
- gpio_set_value(SHUTDOWN_PORT,1);\r
+ gpio_set_value(reset_pin,1);\r
msleep(100);\r
\r
goodix_init_panel(ts);\r
return ret;\r
\r
case 1:\r
- gpio_direction_output(SHUTDOWN_PORT,0);\r
+ gpio_direction_output(reset_pin,0);\r
msleep(1);\r
- gpio_set_value(SHUTDOWN_PORT,0);\r
+ gpio_set_value(reset_pin,0);\r
msleep(100);\r
- gpio_set_value(SHUTDOWN_PORT,1);\r
+ gpio_set_value(reset_pin,1);\r
msleep(100);\r
ret = 0;\r
return ret;\r
const char irq_table[2] = {IRQF_TRIGGER_FALLING,IRQF_TRIGGER_RISING};\r
struct gt811_ts_data *ts;\r
// struct gt811_platform_data *811data = client->dev.platform_data;\r
- struct gt811_platform_data *pdata;\r
+ struct goodix_platform_data *pdata;\r
dev_info(&client->dev,"Install gt811 driver.\n");\r
dev_info(&client->dev,"Driver Release Date:2012-02-08\n"); \r
\r
}\r
\r
i2c_connect_client = client;\r
- \r
+ ts->client = client;\r
+ i2c_set_clientdata(client, ts);\r
+ pdata = client->dev.platform_data;\r
+\r
+ if (pdata != NULL)\r
+ {\r
+ reset_pin = pdata->rest_pin;\r
+ \r
+ if (pdata->init_platform_hw)\r
+ {\r
+ pdata->init_platform_hw();\r
+ }\r
+\r
+ }\r
+\r
+/* \r
gpio_free(SHUTDOWN_PORT);\r
ret = gpio_request(SHUTDOWN_PORT, "RESET_INT");\r
if (ret < 0)\r
\r
rk29_mux_api_set(GPIO0D3_PWM_1_NAME,GPIO0D_GPIO0D3);\r
gpio_pull_updown(SHUTDOWN_PORT, 1); //set GPIO pull-up\r
- \r
+*/ \r
for(retry=0;retry <= 10; retry++)\r
{\r
- gpio_direction_output(SHUTDOWN_PORT,0);\r
+ gpio_direction_output(reset_pin,0);\r
msleep(1);\r
- // gpio_direction_input(SHUTDOWN_PORT);//setinput means not ack so set the reset high\r
+ // gpio_direction_input(reset_pin);//setinput means not ack so set the reset high\r
// msleep(100);\r
- gpio_set_value(SHUTDOWN_PORT,1);\r
+ gpio_set_value(reset_pin,1);\r
msleep(100);\r
- gpio_set_value(SHUTDOWN_PORT,0);\r
+ gpio_set_value(reset_pin,0);\r
msleep(100);\r
- gpio_set_value(SHUTDOWN_PORT,1);\r
+ gpio_set_value(reset_pin,1);\r
msleep(100);\r
int val_ret = 1;\r
- val_ret = gpio_get_value(SHUTDOWN_PORT);\r
+ val_ret = gpio_get_value(reset_pin);\r
ret = i2c_write_bytes(client, &test_data, 1);\r
//ret =i2c_master_reg8_recv(client, 0x00, buf, 2, 200*1000);//i2c_write_bytes(client, &test_data, 1); //Test I2C connection.\r
if (ret == 1)\r
} \r
\r
INIT_WORK(&ts->work, goodix_ts_work_func); //init work_struct\r
- ts->client = client;\r
- i2c_set_clientdata(client, ts);\r
- pdata = client->dev.platform_data;\r
+\r
/////////////////////////////// UPDATE STEP 1 START/////////////////////////////////////////////////////////////////\r
#ifdef AUTO_UPDATE_GT811 //modify by andrew\r
msleep(20);\r
}\r
#endif\r
///////////////////////////////UPDATE STEP 1 END//////////////////////////////////////////////////////////////// \r
+/*\r
#ifdef INT_PORT \r
client->irq=TS_INT; //If not defined in client\r
if (client->irq)\r
#endif \r
}\r
#endif \r
-\r
+*/\r
err_gpio_request_failed:\r
for(retry=0; retry<3; retry++)\r
{\r
}\r
ts->bad_data = 0;\r
\r
-#ifdef INT_PORT \r
- ret = request_irq(TS_INT, goodix_ts_irq_handler ,irq_table[ts->int_trigger_type],\r
+#ifdef INT_PORT \r
+ ret = request_irq(gpio_to_irq(client->irq), goodix_ts_irq_handler ,irq_table[ts->int_trigger_type],\r
client->name, ts);\r
if (ret != 0)\r
{\r
dev_err(&client->dev,"Cannot allocate ts INT!ERRNO:%d\n", ret);\r
- gpio_direction_input(INT_PORT);\r
- gpio_free(INT_PORT);\r
+ gpio_direction_input(client->irq);\r
+ gpio_free(client->irq);\r
goto err_init_godix_ts;\r
}\r
else \r
// disable_irq(client->irq);\r
#endif\r
ts->use_irq = 1;\r
- dev_dbg(&client->dev,"Reques EIRQ %d succesd on GPIO:%d\n",TS_INT,INT_PORT);\r
+ dev_dbg(&client->dev,"Reques EIRQ %d succesd on GPIO:%d\n",client->irq,client->irq);\r
} \r
#endif \r
\r
if(ts->use_irq)\r
{\r
ts->use_irq = 0;\r
- free_irq(client->irq,ts);\r
+ free_irq(gpio_to_irq(client->irq),ts);\r
#ifdef INT_PORT \r
- gpio_direction_input(INT_PORT);\r
- gpio_free(INT_PORT);\r
+ gpio_direction_input(client->irq);\r
+ gpio_free(client->irq);\r
#endif \r
}\r
else \r
err_input_dev_alloc_failed:\r
i2c_set_clientdata(client, NULL);\r
err_gpio_request:\r
- gpio_free(SHUTDOWN_PORT);\r
+ gpio_free(reset_pin);\r
err_i2c_failed: \r
kfree(ts); \r
err_alloc_data_failed:\r
if (ts && ts->use_irq) \r
{\r
#ifdef INT_PORT\r
- gpio_direction_input(INT_PORT);\r
- gpio_free(INT_PORT);\r
+ gpio_direction_input(client->irq);\r
+ gpio_free(client->irq);\r
#endif \r
- free_irq(client->irq, ts);\r
+ free_irq(gpio_to_irq(client->irq), ts);\r
} \r
else if(ts)\r
hrtimer_cancel(&ts->timer);\r
{\r
int ret;\r
struct gt811_ts_data *ts = i2c_get_clientdata(client);\r
- disable_irq(client->irq);\r
+ disable_irq(gpio_to_irq(client->irq));\r
if (ts->power) \r
{ \r
}\r
if (ret < 0)\r
printk(KERN_ERR "goodix_ts_resume power on failed\n");\r
}\r
- enable_irq(client->irq);\r
+ enable_irq(gpio_to_irq(client->irq));\r
return 0;\r
}\r
\r
\r
// i2c_pre_cmd(ts);\r
\r
- gpio_direction_output(SHUTDOWN_PORT, 0);\r
+ gpio_direction_output(reset_pin, 0);\r
msleep(5);\r
- gpio_direction_input(SHUTDOWN_PORT);\r
+ gpio_direction_input(reset_pin);\r
msleep(20);\r
for(retry=0; retry<3; retry++)\r
{\r
unsigned char inbuf[3] = {0,0xff,0};\r
//outbuf[1] = 1;\r
\r
- gpio_direction_output(SHUTDOWN_PORT,0);\r
+ gpio_direction_output(reset_pin,0);\r
msleep(20);\r
- gpio_direction_input(SHUTDOWN_PORT);\r
+ gpio_direction_input(reset_pin);\r
msleep(100);\r
for(retry=0;retry < 80; retry++)\r
{\r
}\r
else\r
{\r
- gpio_direction_output(SHUTDOWN_PORT,0);\r
+ gpio_direction_output(reset_pin,0);\r
msleep(20);\r
- gpio_direction_input(SHUTDOWN_PORT);\r
+ gpio_direction_input(reset_pin);\r
msleep(20);\r
dev_info(&ts->client->dev, "i2c address failed\n");\r
} \r
unsigned char inbuf[3] = {0,0xff,0};\r
//outbuf[1] = 1;\r
\r
- gpio_direction_output(SHUTDOWN_PORT,0);\r
+ gpio_direction_output(reset_pin,0);\r
msleep(20);\r
- gpio_direction_input(SHUTDOWN_PORT);\r
+ gpio_direction_input(reset_pin);\r
msleep(100);\r
for(retry=0;retry < 80; retry++)\r
{\r
end:\r
GT811_SET_INT_PIN( 1 );\r
// gpio_free(INT_PORT);\r
- gpio_pull_updown(INT_PORT, NULL);\r
+ gpio_pull_updown(&ts->client->irq, NULL);\r
\r
msleep( 500 );\r
ret = gt811_reset2(ts);\r
// mt_set_gpio_out(GPIO_CTP_EN_PIN, GPIO_OUT_ONE);\r
// gpio_direction_output(INT_PORT,1);\r
// msleep(1);\r
- gpio_free(INT_PORT);\r
- gpio_pull_updown(INT_PORT, NULL);\r
+ gpio_free(&ts->client->irq);\r
+ gpio_pull_updown(&ts->client->irq, NULL);\r
return err;\r
\r
}\r