diff options
author | Super Liu <supercjliu@google.com> | 2019-05-15 20:11:59 +0800 |
---|---|---|
committer | Super Liu <supercjliu@google.com> | 2019-05-17 12:40:30 +0800 |
commit | b5d1e5a589eacc667cc345567e8c5c40fae6e96e (patch) | |
tree | 39536ad3011b5120598559c02127b75c2700feb0 | |
parent | 54232827da2c119c47276b719f2bd07029befc4f (diff) | |
download | fts_touch_s5-b5d1e5a589eacc667cc345567e8c5c40fae6e96e.tar.gz |
input: touchscreen: stm: refuse to suspend if touch bus is in use
Normally, touch driver use display notifier(MSM_DRM_EVENT_BLANK
and MSM_DRM_EARLY_EVENT_BLANK) with bus reference mask(*) to trigger
suspend and resume.
Somehow system will enter deep sleep without MSM_DRM_BLANK_POWERDOWN
and MSM_DRM_BLANK_LP to suspend touch. Therefore, register pm
suspend/resume to correct report current touch driver state.
* Bits for the bus reference mask
enum {
FTS_BUS_REF_SCREEN_ON = 0x01,
FTS_BUS_REF_IRQ = 0x02,
FTS_BUS_REF_FW_UPDATE = 0x04,
FTS_BUS_REF_SYSFS = 0x08,
FTS_BUS_REF_FORCE_ACTIVE = 0x10
}
Bug: 131944527
Change-Id: I3b673536a787a71976d8f8a13e10720c18b1908f
Signed-off-by: Super Liu <supercjliu@google.com>
-rw-r--r-- | fts.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -5591,6 +5591,28 @@ static int fts_remove(struct spi_device *client) return OK; } +#ifdef CONFIG_PM +static int fts_pm_suspend(struct device *dev) +{ + struct fts_ts_info *info = dev_get_drvdata(dev); + + if (info->resume_bit) { + pr_warn("%s: can't suspend because touch bus is in use(bus_refmask=0x%X)!\n", + __func__, info->bus_refmask); + return -EBUSY; + } + + return 0; +} + +static int fts_pm_resume(struct device *dev) +{ + return 0; +} + +static SIMPLE_DEV_PM_OPS(fts_pm_ops, fts_pm_suspend, fts_pm_resume); +#endif + /** * Struct which contains the compatible names that need to match with * the definition of the device in the device tree node @@ -5612,6 +5634,9 @@ static struct i2c_driver fts_i2c_driver = { .driver = { .name = FTS_TS_DRV_NAME, .of_match_table = fts_of_match_table, +#ifdef CONFIG_PM + .pm = &fts_pm_ops, +#endif }, .probe = fts_probe, .remove = fts_remove, @@ -5623,6 +5648,9 @@ static struct spi_driver fts_spi_driver = { .name = FTS_TS_DRV_NAME, .of_match_table = fts_of_match_table, .owner = THIS_MODULE, +#ifdef CONFIG_PM + .pm = &fts_pm_ops, +#endif }, .probe = fts_probe, .remove = fts_remove, |