From 817b266af327ba4014f6a632d629f1d743dacb00 Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Tue, 12 Apr 2011 09:38:06 +0800 Subject: [PATCH] cyttsp: implement early_suspend for cypress controller Put the controller into deep sleep mode when display is off. This gives a saving of ~5mW on the TMD panel during S0i3. Change-Id: I69d1e182311c164ad9372a44f736f8a71826fa17 Signed-off-by: Hong Liu --- drivers/input/touchscreen/cyttsp_core.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c index 157786e..e9fb703 100644 --- a/drivers/input/touchscreen/cyttsp_core.c +++ b/drivers/input/touchscreen/cyttsp_core.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "cyttsp_core.h" /* rely on kernel input.h to define Multi-Touch capability */ @@ -257,6 +258,8 @@ struct cyttsp { struct cyttsp_bus_ops *bus_ops; unsigned fw_loader_mode:1; unsigned suspended:1; + + struct early_suspend early_suspend; }; struct cyttsp_track_data { @@ -1400,6 +1403,22 @@ int cyttsp_suspend(void *handle) EXPORT_SYMBOL(cyttsp_suspend); #endif +#ifdef CONFIG_HAS_EARLYSUSPEND +static void cyttsp_early_suspend(struct early_suspend *h) +{ + struct cyttsp *ts = container_of(h, struct cyttsp, early_suspend); + + cyttsp_suspend(ts); +} + +static void cyttsp_late_resume(struct early_suspend *h) +{ + struct cyttsp *ts = container_of(h, struct cyttsp, early_suspend); + + cyttsp_resume(ts); +} +#endif + static ssize_t firmware_write(struct file *file, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t pos, size_t size) @@ -1533,6 +1552,13 @@ int cyttsp_core_init(void *bus_priv, struct cyttsp_bus_ops *bus_ops, ts->bus_ops = bus_ops; ts->bus_priv = bus_priv; +#ifdef CONFIG_HAS_EARLYSUSPEND + ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1; + ts->early_suspend.suspend = cyttsp_early_suspend; + ts->early_suspend.resume = cyttsp_late_resume; + register_early_suspend(&ts->early_suspend); +#endif + if (ts->platform_data->init) retval = ts->platform_data->init(1); if (retval) { -- 2.7.4