summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhaoyuan <yzhao@codeaurora.org>2015-11-10 13:17:46 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-05 22:01:46 -0700
commit5c6da5653ecc1fcd09ec0ae7c0f925929d5a6303 (patch)
tree0b301fd457753eefd7dee1c2ce8cd51dbe56c0ab
parent11d6060fffff4b7e87d1cadb5f65dfc7f74332cc (diff)
input: ft5x06: defer touch resume to workqueue
During device resume, the touch resume function is called after display's resume. In this case, the ft5x06's resume function needs to wait for 200ms because of reset requirement. Defer the touch resume to a workqueue to reduce the total device resume time. For this an optional DT property is added to enable this on targets that need this feature. Change-Id: Ib0677ca792aea83ece1caf8a0afff341302747fb Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org> Signed-off-by: zhaoyuan <yzhao@codeaurora.org>
-rw-r--r--Documentation/devicetree/bindings/input/touchscreen/ft5x06-ts.txt1
-rw-r--r--drivers/input/touchscreen/ft5x06_ts.c38
-rw-r--r--include/linux/input/ft5x06_ts.h1
3 files changed, 34 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/input/touchscreen/ft5x06-ts.txt b/Documentation/devicetree/bindings/input/touchscreen/ft5x06-ts.txt
index 8e2f0908562a..ec8b08ad60e4 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/ft5x06-ts.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/ft5x06-ts.txt
@@ -71,6 +71,7 @@ Optional properties:
- focaltech,fw-name : specify the firmware file name
- focaltech,psensor-support : specify whether support the proximity sensor
- focaltech,gesture-support : specify whether support gesture feature
+ - focaltech,resume-in-workqueue : specifiy whether to defer the resume to workqueue
Example:
i2c@f9923000{
diff --git a/drivers/input/touchscreen/ft5x06_ts.c b/drivers/input/touchscreen/ft5x06_ts.c
index b02e8ecf8608..17bce3d18d2f 100644
--- a/drivers/input/touchscreen/ft5x06_ts.c
+++ b/drivers/input/touchscreen/ft5x06_ts.c
@@ -253,6 +253,7 @@ struct ft5x06_ts_data {
u8 fw_vendor_id;
struct kobject ts_info_kobj;
#if defined(CONFIG_FB)
+ struct work_struct fb_notify_work;
struct notifier_block fb_notif;
#elif defined(CONFIG_HAS_EARLYSUSPEND)
struct early_suspend early_suspend;
@@ -1137,6 +1138,13 @@ static int ft5x06_ts_resume(struct device *dev)
#endif
#if defined(CONFIG_FB)
+static void fb_notify_resume_work(struct work_struct *work)
+{
+ struct ft5x06_ts_data *ft5x06_data =
+ container_of(work, struct ft5x06_ts_data, fb_notify_work);
+ ft5x06_ts_resume(&ft5x06_data->client->dev);
+}
+
static int fb_notifier_callback(struct notifier_block *self,
unsigned long event, void *data)
{
@@ -1145,13 +1153,27 @@ static int fb_notifier_callback(struct notifier_block *self,
struct ft5x06_ts_data *ft5x06_data =
container_of(self, struct ft5x06_ts_data, fb_notif);
- if (evdata && evdata->data && event == FB_EVENT_BLANK &&
- ft5x06_data && ft5x06_data->client) {
+ if (evdata && evdata->data && ft5x06_data && ft5x06_data->client) {
blank = evdata->data;
- if (*blank == FB_BLANK_UNBLANK)
- ft5x06_ts_resume(&ft5x06_data->client->dev);
- else if (*blank == FB_BLANK_POWERDOWN)
- ft5x06_ts_suspend(&ft5x06_data->client->dev);
+ if (ft5x06_data->pdata->resume_in_workqueue) {
+ if (event == FB_EARLY_EVENT_BLANK &&
+ *blank == FB_BLANK_UNBLANK)
+ schedule_work(&ft5x06_data->fb_notify_work);
+ else if (event == FB_EVENT_BLANK &&
+ *blank == FB_BLANK_POWERDOWN) {
+ flush_work(&ft5x06_data->fb_notify_work);
+ ft5x06_ts_suspend(&ft5x06_data->client->dev);
+ }
+ } else {
+ if (event == FB_EVENT_BLANK) {
+ if (*blank == FB_BLANK_UNBLANK)
+ ft5x06_ts_resume(
+ &ft5x06_data->client->dev);
+ else if (*blank == FB_BLANK_POWERDOWN)
+ ft5x06_ts_suspend(
+ &ft5x06_data->client->dev);
+ }
+ }
}
return 0;
@@ -1918,6 +1940,9 @@ static int ft5x06_parse_dt(struct device *dev,
pdata->gesture_support = of_property_read_bool(np,
"focaltech,gesture-support");
+ pdata->resume_in_workqueue = of_property_read_bool(np,
+ "focaltech,resume-in-workqueue");
+
rc = of_property_read_u32(np, "focaltech,family-id", &temp_val);
if (!rc)
pdata->family_id = temp_val;
@@ -2269,6 +2294,7 @@ static int ft5x06_ts_probe(struct i2c_client *client,
data->fw_ver[1], data->fw_ver[2]);
#if defined(CONFIG_FB)
+ INIT_WORK(&data->fb_notify_work, fb_notify_resume_work);
data->fb_notif.notifier_call = fb_notifier_callback;
err = fb_register_client(&data->fb_notif);
diff --git a/include/linux/input/ft5x06_ts.h b/include/linux/input/ft5x06_ts.h
index 3825f9d1e68c..ad95957d9189 100644
--- a/include/linux/input/ft5x06_ts.h
+++ b/include/linux/input/ft5x06_ts.h
@@ -69,6 +69,7 @@ struct ft5x06_ts_platform_data {
bool i2c_pull_up;
bool ignore_id_check;
bool gesture_support;
+ bool resume_in_workqueue;
int (*power_init)(bool);
int (*power_on)(bool);
};