static irqreturn_t Ctp_it7250_touch_irq(int irq, void *dev_id)\r
{ \r
struct Ctp_it7250_data *Ctp_it7250 = dev_id;\r
-\r
+ //printk("%s++++ %d \r\n",__FUNCTION__,__LINE__);\r
//rk28printk("%s++++ %d \r\n",__FUNCTION__,__LINE__);\r
disable_irq_nosync(irq);\r
//rk28printk("%s++++ %d irq=%d\r\n",__FUNCTION__,__LINE__,irq);\r
return true; \r
}\r
\r
-\r
// ================================================================================\r
// Function Name --- GetFirmwareInformation\r
// Description --- Get firmware information\r
ucWriteLength = 1;\r
ucReadLength = 0x0A;\r
pucData[0] = 0x00;\r
-rk28printk("%s\r\n",__FUNCTION__);\r
+ rk28printk("%s\r\n",__FUNCTION__);\r
// Query\r
do\r
{//printk("first wait 111\r\n");\r
if (!IdentifyCapSensor(client))\r
{\r
rk28printk("%s IdentifyCapSensor error \r\n",__FUNCTION__);\r
+ printk("%s IdentifyCapSensor error \r\n",__FUNCTION__);\r
return false;\r
//goto resetagin;\r
}\r
if (!GetFirmwareInformation (client))\r
{\r
rk28printk("%s GetFirmwareInformation error \r\n",__FUNCTION__);\r
+ printk("%s GetFirmwareInformation error \r\n",__FUNCTION__);\r
// goto resetagin;\r
}\r
\r
if (!Get2DResolutions(client, &wXResolution, &wYResolution, &ucStep))\r
{\r
rk28printk("%s Get2DResolutions error \r\n",__FUNCTION__);\r
+ printk("%s Get2DResolutions error \r\n",__FUNCTION__);\r
// goto resetagin;\r
}\r
\r
static int Ctp_it7250_probe(struct i2c_client *client, const struct i2c_device_id *id)\r
{\r
struct Ctp_it7250_data *Ctp_it7250;\r
-// u16 TempReg=0x0;\r
-// u16 val=0x0;\r
- \r
+\r
Ctp_it7250_client = client;\r
rk28printk("+++++++ %s+++++++\n", __FUNCTION__);\r
Ctp_it7250 = kzalloc(sizeof(struct Ctp_it7250_data), GFP_KERNEL);\r
// INIT_WORK(&Ctp_it7250->irq_work, Ctp_it7250_irq_worker);\r
INIT_DELAYED_WORK(&Ctp_it7250->delaywork, Ctp_it7250_delaywork_func);\r
\r
-\r
Ctp_it7250->client = client;\r
i2c_set_clientdata(client, Ctp_it7250);\r
-\r
\r
-if (!CaptouchHWInitial(client))\r
- goto err_free_mem;\r
-Ctp_it7250_init_irq(client); \r
+ if (!CaptouchHWInitial(client))\r
+ goto err_free_mem;\r
+ Ctp_it7250_init_irq(client); \r
ts_input_init(client);\r
// CTS_configure_pin(client);\r
\r
-{\r
#if 0\r
-lp8725_lilo_en(2,0);\r
-mdelay(100);\r
+ lp8725_lilo_en(2,0);\r
+ mdelay(100);\r
\r
-lp8725_lilo_en(2,1);\r
-mdelay(100);\r
-lp8725_set_lilo_vol(2,300);\r
-mdelay(5);\r
+ lp8725_lilo_en(2,1);\r
+ mdelay(100);\r
+ lp8725_set_lilo_vol(2,300);\r
+ mdelay(5);\r
#endif\r
\r
-}\r
-\r
- \r
- \r
//²»ÊDzéѯģʽ£¬²»ÐèÒªÂÖѯ\r
//schedule_delayed_work(&Ctp_it7250->delaywork,msecs_to_jiffies(50));\r
\r
\r
rk28printk("+++++++ %s+++++++\n", __FUNCTION__);\r
return 0;\r
-err_free_mem:\r
- kfree(Ctp_it7250);\r
- return false;\r
+ err_free_mem:\r
+ kfree(Ctp_it7250);\r
+ return false;\r
\r
}\r
\r
#ifdef CONFIG_PM\r
static int Ctp_it7250_suspend(struct i2c_client *client, pm_message_t state)\r
{//pr_emerg("\n irq1=%d \n",irq1);\r
-struct Ctp_it7250_data *Ctp_it7250 = (struct Ctp_it7250_data *)i2c_get_clientdata(client);\r
-\r
-//send command to make ctp into sleep mode\r
-#if 1\r
- u8 ucWriteLength;\r
- u8 pucData[128];\r
- u8 ucQuery;\r
-\r
- ucWriteLength = 3;\r
- pucData[0] = 0x04;\r
- pucData[1] = 0x00;\r
- pucData[2] = 0x02;\r
-\r
- // Query\r
- do\r
- {\r
- if(!ReadQueryBuffer(client, &ucQuery))\r
- {\r
- ucQuery = QUERY_BUSY;\r
- }\r
- }while(ucQuery & QUERY_BUSY);\r
+ struct Ctp_it7250_data *Ctp_it7250 = (struct Ctp_it7250_data *)i2c_get_clientdata(client);\r
\r
- // Write Command\r
- rk28printk("%s WriteCommandBuffer\r\n",__FUNCTION__);\r
- if(!WriteCommandBuffer(client, pucData, ucWriteLength))\r
- {\r
- return false;\r
- }\r
- #endif\r
-//send sleep command end\r
+ rk28printk("%s\n",__func__);\r
\r
+ CaptouchMode(client, 2);\r
disable_irq(Ctp_it7250->irq);\r
\r
return 0;\r
\r
static int Ctp_it7250_resume(struct i2c_client *client)\r
{\r
-struct Ctp_it7250_data *Ctp_it7250 = (struct Ctp_it7250_data *)i2c_get_clientdata(client);\r
-//read command to wakeup ctp\r
-#if 1\r
-u8 ucQuery;\r
-ReadQueryBuffer(client, &ucQuery);\r
-#endif\r
-//wakeup end\r
+ struct Ctp_it7250_data *Ctp_it7250 = (struct Ctp_it7250_data *)i2c_get_clientdata(client);\r
+\r
+ u8 ucQuery;\r
+ rk28printk("%s\n",__func__);\r
+\r
+ if(gpio_direction_output(client->irq,GPIO_LOW))\r
+ printk("%s:set pin output error\n",__func__);\r
+ msleep(20);\r
+ ReadQueryBuffer(client, &ucQuery);\r
+ if (gpio_direction_input(client->irq)) \r
+ printk("%s:failed to set CTS_configure_pin gpio input\n",__func__);\r
+ gpio_pull_updown(client->irq,GPIOPullUp);\r
+ msleep(20);\r
enable_irq(Ctp_it7250->irq);\r
+ \r
return 0;\r
}\r
#else\r
},\r
.id_table = Ctp_it7250_id,\r
.probe = Ctp_it7250_probe,\r
- .remove = Ctp_it7250_remove,
- .suspend = Ctp_it7250_suspend,
- .resume = Ctp_it7250_resume,\r
+ .remove = Ctp_it7250_remove,\r
+ .suspend = Ctp_it7250_suspend,\r
+ .resume = Ctp_it7250_resume,\r
};\r
\r
static int __init Ctp_it7250_init(void)\r
\r
MODULE_AUTHOR("Robert_mu<robert.mu@rahotech.com>");\r
\r
+\r