input: touchscreen: Require low latency

Currently, CPU can enter deep sleep while waiting for data on the i2c
bug. That means an i2c read of 8 bytes can take as long as 10 ms, which
would overrun the desired interrupt handling time.
Use pm qos to require low latency and prevent CPU from entering deep
sleep while handling touch interrupts.

Bug: 110939384
Test: look at the i2c read traces:
1) ./external/chromium-trace/systrace.py --atrace-categories=view,wm,am,app,gfx,i2c,sched,irq,video,power,input,workq,freq
2) perform a fling
3) review the i2c read duration on the touchscreen bus

Change-Id: Icf8ab09324003a85af70517769ced3bae52f705c
Signed-Off-By: Siarhei Vishniakou <svv@google.com>
This commit is contained in:
Siarhei Vishniakou 2018-06-28 10:53:18 +01:00 committed by prashantpaddune
parent a3103639ca
commit 2a285456a4
2 changed files with 13 additions and 1 deletions

View File

@ -1398,12 +1398,17 @@ static irqreturn_t sec_ts_irq_thread(int irq, void *ptr)
}
#endif
/* prevent CPU from entering deep sleep */
pm_qos_update_request(&ts->pm_qos_req, 100);
mutex_lock(&ts->eventlock);
sec_ts_read_event(ts);
mutex_unlock(&ts->eventlock);
pm_qos_update_request(&ts->pm_qos_req, PM_QOS_DEFAULT_VALUE);
return IRQ_HANDLED;
}
@ -2230,6 +2235,9 @@ static int sec_ts_probe(struct i2c_client *client, const struct i2c_device_id *i
"%s: TOUCH DEVICE ID : %02X, %02X, %02X, %02X, %02X\n", __func__,
deviceID[0], deviceID[1], deviceID[2], deviceID[3], deviceID[4]);
pm_qos_add_request(&ts->pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
PM_QOS_DEFAULT_VALUE);
ret = sec_ts_i2c_read(ts, SEC_TS_READ_FIRMWARE_INTEGRITY, &result, 1);
if (ret < 0) {
input_err(true, &ts->client->dev, "%s: failed to integrity check (%d)\n", __func__, ret);
@ -2409,6 +2417,7 @@ static int sec_ts_probe(struct i2c_client *client, const struct i2c_device_id *i
err_fb_client:
#endif
err_irq:
pm_qos_remove_request(&ts->pm_qos_req);
if (ts->plat_data->support_dex) {
input_unregister_device(ts->input_dev_pad);
ts->input_dev_pad = NULL;
@ -2853,6 +2862,8 @@ static int sec_ts_remove(struct i2c_client *client)
free_irq(ts->client->irq, ts);
input_info(true, &ts->client->dev, "%s: irq disabled\n", __func__);
pm_qos_remove_request(&ts->pm_qos_req);
#ifdef USE_POWER_RESET_WORK
cancel_delayed_work_sync(&ts->reset_work);
flush_delayed_work(&ts->reset_work);

View File

@ -31,6 +31,7 @@
#include <linux/module.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/pm_qos.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/time.h>
@ -681,7 +682,7 @@ struct sec_ts_data {
struct mutex i2c_mutex;
struct mutex eventlock;
struct mutex modechange;
struct pm_qos_request pm_qos_req;
struct delayed_work work_read_info;
#ifdef USE_POWER_RESET_WORK
struct delayed_work reset_work;