input: synaptics: defer touch resume to workqueue for v2.6 driver

During device resume, the touch resume function is called after
display resume. Touch resume function will take about >200ms.
Defer the touch resume function to a workqueue to reduce the total
device resume time. An optional DT property is added to enable this
on targets that need this feature.

This change has been merged. Now, touch driver was updated to V2.6,
so, merge this change to V2.6 driver.

Change-Id: Ica477f35bd4fda59eb49c9b4f5e88b460366c761
Signed-off-by: zhaoyuan <yzhao@codeaurora.org>
This commit is contained in:
zhaoyuan 2016-03-24 10:36:00 +08:00 committed by Abinaya P
parent a0732e6085
commit b378a2f8ba
4 changed files with 51 additions and 12 deletions

View file

@ -122,6 +122,7 @@ static int synaptics_rmi4_reset_device(struct synaptics_rmi4_data *rmi4_data,
bool rebuild); bool rebuild);
#ifdef CONFIG_FB #ifdef CONFIG_FB
static void synaptics_rmi4_fb_notify_resume_work(struct work_struct *work);
static int synaptics_rmi4_fb_notifier_cb(struct notifier_block *self, static int synaptics_rmi4_fb_notifier_cb(struct notifier_block *self,
unsigned long event, void *data); unsigned long event, void *data);
#endif #endif
@ -4012,6 +4013,8 @@ static int synaptics_rmi4_probe(struct platform_device *pdev)
} }
#ifdef CONFIG_FB #ifdef CONFIG_FB
INIT_WORK(&rmi4_data->fb_notify_work,
synaptics_rmi4_fb_notify_resume_work);
rmi4_data->fb_notifier.notifier_call = synaptics_rmi4_fb_notifier_cb; rmi4_data->fb_notifier.notifier_call = synaptics_rmi4_fb_notifier_cb;
retval = fb_register_client(&rmi4_data->fb_notifier); retval = fb_register_client(&rmi4_data->fb_notifier);
if (retval < 0) { if (retval < 0) {
@ -4328,6 +4331,14 @@ static void synaptics_rmi4_wakeup_gesture(struct synaptics_rmi4_data *rmi4_data,
} }
#ifdef CONFIG_FB #ifdef CONFIG_FB
static void synaptics_rmi4_fb_notify_resume_work(struct work_struct *work)
{
struct synaptics_rmi4_data *rmi4_data =
container_of(work, struct synaptics_rmi4_data, fb_notify_work);
synaptics_rmi4_resume(&(rmi4_data->input_dev->dev));
rmi4_data->fb_ready = true;
}
static int synaptics_rmi4_fb_notifier_cb(struct notifier_block *self, static int synaptics_rmi4_fb_notifier_cb(struct notifier_block *self,
unsigned long event, void *data) unsigned long event, void *data)
{ {
@ -4338,16 +4349,36 @@ static int synaptics_rmi4_fb_notifier_cb(struct notifier_block *self,
fb_notifier); fb_notifier);
if (evdata && evdata->data && rmi4_data) { if (evdata && evdata->data && rmi4_data) {
if (event == FB_EARLY_EVENT_BLANK) { if (rmi4_data->hw_if->board_data->resume_in_workqueue) {
synaptics_secure_touch_stop(rmi4_data, false); if (event == FB_EARLY_EVENT_BLANK) {
} else if (event == FB_EVENT_BLANK) { synaptics_secure_touch_stop(rmi4_data, false);
transition = evdata->data; } else if (event == FB_EVENT_BLANK) {
if (*transition == FB_BLANK_POWERDOWN) { transition = evdata->data;
synaptics_rmi4_suspend(&rmi4_data->pdev->dev); if (*transition == FB_BLANK_POWERDOWN) {
rmi4_data->fb_ready = false; flush_work(
} else if (*transition == FB_BLANK_UNBLANK) { &(rmi4_data->fb_notify_work));
synaptics_rmi4_resume(&rmi4_data->pdev->dev); synaptics_rmi4_suspend(
rmi4_data->fb_ready = true; &rmi4_data->pdev->dev);
rmi4_data->fb_ready = false;
} else if (*transition == FB_BLANK_UNBLANK) {
schedule_work(
&(rmi4_data->fb_notify_work));
}
}
} else {
if (event == FB_EARLY_EVENT_BLANK) {
synaptics_secure_touch_stop(rmi4_data, false);
} else if (event == FB_EVENT_BLANK) {
transition = evdata->data;
if (*transition == FB_BLANK_POWERDOWN) {
synaptics_rmi4_suspend(
&rmi4_data->pdev->dev);
rmi4_data->fb_ready = false;
} else if (*transition == FB_BLANK_UNBLANK) {
synaptics_rmi4_resume(
&rmi4_data->pdev->dev);
rmi4_data->fb_ready = true;
}
} }
} }
} }

View file

@ -5,7 +5,7 @@
* *
* Copyright (C) 2012 Alexandra Chin <alexandra.chin@tw.synaptics.com> * Copyright (C) 2012 Alexandra Chin <alexandra.chin@tw.synaptics.com>
* Copyright (C) 2012 Scott Lin <scott.lin@tw.synaptics.com> * Copyright (C) 2012 Scott Lin <scott.lin@tw.synaptics.com>
* * Copyright (C) 2016 The Linux Foundation. All rights reserved.
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
@ -331,6 +331,7 @@ struct synaptics_rmi4_data {
struct delayed_work rb_work; struct delayed_work rb_work;
struct workqueue_struct *rb_workqueue; struct workqueue_struct *rb_workqueue;
#ifdef CONFIG_FB #ifdef CONFIG_FB
struct work_struct fb_notify_work;
struct notifier_block fb_notifier; struct notifier_block fb_notifier;
struct work_struct reset_work; struct work_struct reset_work;
struct workqueue_struct *reset_workqueue; struct workqueue_struct *reset_workqueue;

View file

@ -5,7 +5,7 @@
* *
* Copyright (C) 2012 Alexandra Chin <alexandra.chin@tw.synaptics.com> * Copyright (C) 2012 Alexandra Chin <alexandra.chin@tw.synaptics.com>
* Copyright (C) 2012 Scott Lin <scott.lin@tw.synaptics.com> * Copyright (C) 2012 Scott Lin <scott.lin@tw.synaptics.com>
* * Copyright (C) 2016, The Linux Foundation. All rights reserved.
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
@ -78,6 +78,9 @@ static int parse_dt(struct device *dev, struct synaptics_dsx_board_data *bdata)
else else
bdata->irq_on_state = value; bdata->irq_on_state = value;
bdata->resume_in_workqueue = of_property_read_bool(np,
"synaptics,resume-in-workqueue");
retval = of_property_read_string(np, "synaptics,pwr-reg-name", &name); retval = of_property_read_string(np, "synaptics,pwr-reg-name", &name);
if (retval < 0) if (retval < 0)
bdata->pwr_reg_name = NULL; bdata->pwr_reg_name = NULL;

View file

@ -5,6 +5,7 @@
* *
* Copyright (C) 2012 Alexandra Chin <alexandra.chin@tw.synaptics.com> * Copyright (C) 2012 Alexandra Chin <alexandra.chin@tw.synaptics.com>
* Copyright (C) 2012 Scott Lin <scott.lin@tw.synaptics.com> * Copyright (C) 2012 Scott Lin <scott.lin@tw.synaptics.com>
* Copyright (C) 2016, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -57,6 +58,7 @@ struct synaptics_dsx_button_map {
* @x_flip: x flip flag * @x_flip: x flip flag
* @y_flip: y flip flag * @y_flip: y flip flag
* @swap_axes: swap axes flag * @swap_axes: swap axes flag
* @resume_in_workqueue: defer resume function to workqueue
* @irq_gpio: attention interrupt GPIO * @irq_gpio: attention interrupt GPIO
* @irq_on_state: attention interrupt active state * @irq_on_state: attention interrupt active state
* @power_gpio: power switch GPIO * @power_gpio: power switch GPIO
@ -79,11 +81,13 @@ struct synaptics_dsx_button_map {
* @bus_reg_name: pointer to name of regulator for bus pullup control * @bus_reg_name: pointer to name of regulator for bus pullup control
* @cap_button_map: pointer to 0D button map * @cap_button_map: pointer to 0D button map
* @vir_button_map: pointer to virtual button map * @vir_button_map: pointer to virtual button map
* @resume_in_workqueue: defer resume function to workqueue
*/ */
struct synaptics_dsx_board_data { struct synaptics_dsx_board_data {
bool x_flip; bool x_flip;
bool y_flip; bool y_flip;
bool swap_axes; bool swap_axes;
bool resume_in_workqueue;
int irq_gpio; int irq_gpio;
int irq_on_state; int irq_on_state;
int power_gpio; int power_gpio;