#include <linux/input/mt.h>\r
#include <plat/board.h>\r
#include <mach/iomux.h>\r
+#ifdef CONFIG_RK_CONFIG\r
+#include <mach/config.h>\r
+#endif\r
+#define TP_MODULE_NAME GOODIX_I2C_NAME\r
+#ifdef CONFIG_RK_CONFIG\r
+\r
+enum {\r
+#if defined(RK2928_SDK_DEFAULT_CONFIG)\r
+ DEF_EN = 1,\r
+#else\r
+ DEF_EN = 0,\r
+#endif\r
+ DEF_IRQ = 0x008003c7,\r
+ DEF_RST = 0X000003c3,\r
+ DEF_I2C = 2, \r
+ DEF_ADDR = 0x5d,\r
+ DEF_X_MAX = 800,\r
+ DEF_Y_MAX = 480,\r
+};\r
+static int en = DEF_EN;\r
+module_param(en, int, 0644);\r
+\r
+static int irq = DEF_IRQ;\r
+module_param(irq, int, 0644);\r
+static int rst =DEF_RST;\r
+module_param(rst, int, 0644);\r
+\r
+static int i2c = DEF_I2C; // i2c channel\r
+module_param(i2c, int, 0644);\r
+static int addr = DEF_ADDR; // i2c addr\r
+module_param(addr, int, 0644);\r
+static int x_max = DEF_X_MAX;\r
+module_param(x_max, int, 0644);\r
+static int y_max = DEF_Y_MAX;\r
+module_param(y_max, int, 0644);\r
+\r
+static int tp_hw_init(void)\r
+{\r
+ int ret = 0;\r
+\r
+ ret = gpio_request(get_port_config(irq).gpio, "tp_irq");\r
+ if(ret < 0){\r
+ printk("%s: gpio_request(irq gpio) failed\n", __func__);\r
+ return ret;\r
+ }\r
+\r
+ ret = port_output_init(rst, 1, "tp_rst");\r
+ if(ret < 0){\r
+ printk("%s: port(rst) output init faild\n", __func__);\r
+ return ret;\r
+ }\r
+ mdelay(10);\r
+ port_output_off(rst);\r
+ mdelay(10);\r
+ port_output_on(rst);\r
+ msleep(300);\r
+\r
+ return 0;\r
+}\r
+#include "rk_tp.c"\r
+#endif\r
+\r
+\r
\r
static struct workqueue_struct *goodix_wq;\r
static const char *s3c_ts_name = "gt811_ts";\r
static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)\r
{\r
int ret = 0;\r
+ int val_ret = 1;\r
int retry=0;\r
char test_data = 1;\r
char buf[2]={0}; //w++\r
ts->client = client;\r
i2c_set_clientdata(client, ts);\r
pdata = client->dev.platform_data;\r
-\r
+#ifdef CONFIG_RK_CONFIG\r
+ tp_hw_init();\r
+ reset_pin = get_port_config(rst).gpio;\r
+ client->irq = get_port_config(irq).gpio;\r
+#else\r
if (pdata != NULL)\r
{\r
reset_pin = pdata->rest_pin;\r
}\r
\r
}\r
-\r
+#endif\r
/* \r
gpio_free(SHUTDOWN_PORT);\r
ret = gpio_request(SHUTDOWN_PORT, "RESET_INT");\r
msleep(100);\r
gpio_set_value(reset_pin,1);\r
msleep(100);\r
- int val_ret = 1;\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
\r
input_mt_init_slots(ts->input_dev, ts->max_touch_num);\r
input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);\r
+#ifdef CONFIG_RK_CONFIG\r
+ input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0, x_max, 0, 0);\r
+ input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, 0, y_max, 0, 0); \r
+#else\r
input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0, ts->abs_x_max, 0, 0);\r
input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, 0, ts->abs_y_max, 0, 0); \r
+#endif\r
\r
\r
#endif \r
if (ts->power) \r
{ \r
}\r
+ return 0;\r
}\r
static int goodix_ts_resume(struct i2c_client *client)\r
{\r
u8 ret;\r
u8 error = 0;\r
//struct tpd_info_t tpd_info;\r
- GT811_SET_INT_PIN( 0 );\r
+ GT811_SET_INT_PIN( ts->client->irq, 0 );\r
msleep( 20 );\r
ret = gt811_reset(ts);\r
if ( ret < 0 )\r
}\r
\r
end:\r
- GT811_SET_INT_PIN( 1 );\r
+ GT811_SET_INT_PIN( ts->client->irq, 1 );\r
// gpio_free(INT_PORT);\r
- gpio_pull_updown(&ts->client->irq, NULL);\r
+ gpio_pull_updown(ts->client->irq, 0);\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(&ts->client->irq);\r
- gpio_pull_updown(&ts->client->irq, NULL);\r
+ gpio_free(ts->client->irq);\r
+ gpio_pull_updown(ts->client->irq, 0);\r
return err;\r
\r
}\r
{\r
int ret;\r
\r
+#ifdef CONFIG_RK_CONFIG\r
+ ret = tp_board_init();\r
+\r
+ if(ret < 0)\r
+ return ret;\r
+#endif\r
goodix_wq = create_workqueue("goodix_wq"); //create a work queue and worker thread\r
if (!goodix_wq) {\r
printk(KERN_ALERT "creat workqueue faiked\n");\r