diff --git a/drivers/input/touchscreen/gt9xx/gt9xx.c b/drivers/input/touchscreen/gt9xx/gt9xx.c index 02798b9c9c95..67b1b3451dab 100644 --- a/drivers/input/touchscreen/gt9xx/gt9xx.c +++ b/drivers/input/touchscreen/gt9xx/gt9xx.c @@ -608,7 +608,7 @@ static void goodix_ts_work_func(struct work_struct *work) ts = container_of(work, struct goodix_ts_data, work); if (ts->enter_update) { - return; + goto release_wakeup_lock; } #if GTP_GESTURE_WAKEUP if (DOZE_ENABLED == doze_status) @@ -682,7 +682,7 @@ static void goodix_ts_work_func(struct work_struct *work) { gtp_irq_enable(ts); } - return; + goto release_wakeup_lock; } #endif @@ -694,7 +694,7 @@ static void goodix_ts_work_func(struct work_struct *work) { gtp_irq_enable(ts); } - return; + goto release_wakeup_lock; } finger = point_data[GTP_ADDR_LENGTH]; @@ -783,7 +783,7 @@ static void goodix_ts_work_func(struct work_struct *work) { gtp_irq_enable(ts); } - return; + goto release_wakeup_lock; } if((finger & 0x80) == 0) @@ -1028,6 +1028,10 @@ exit_work_func: { gtp_irq_enable(ts); } + +release_wakeup_lock: + if (device_can_wakeup(&ts->client->dev)) + pm_relax(&ts->client->dev); } /******************************************************* @@ -1068,6 +1072,9 @@ static irqreturn_t goodix_ts_irq_handler(int irq, void *dev_id) gtp_irq_disable(ts); + if (device_can_wakeup(&ts->client->dev)) + pm_stay_awake(&ts->client->dev); + queue_work(goodix_wq, &ts->work); return IRQ_HANDLED; @@ -2795,6 +2802,7 @@ static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id ts->int_trigger_type = GTP_INT_TRIGGER; } + ts->irq_flags = ts->int_trigger_type ? IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING; // Create proc file system gt91xx_config_proc = proc_create(GT91XX_CONFIG_PROC_FILE, 0664, NULL, &config_proc_ops); if (gt91xx_config_proc == NULL) @@ -2834,9 +2842,11 @@ static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id gtp_irq_enable(ts); } -#ifdef CONFIG_ROCKCHIP_EBC_DEV - enable_irq_wake(ts->irq); -#endif + if (of_property_read_bool(np, "wakeup-source")) + { + device_init_wakeup(&client->dev, 1); + enable_irq_wake(ts->irq); + } #if GTP_CREATE_WR_NODE init_wr_node(client);