diff options
author | Robert Collins <rcollins@nvidia.com> | 2011-06-06 15:06:45 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:52:19 -0800 |
commit | 49a964841735f74b022f9b99b0aacf5544327ab6 (patch) | |
tree | eedcebc637496d87c2a6c8490fa4dbc67deef4ea /drivers | |
parent | 2cb03680820716328b9dc6cbf7f2c2849a8f963c (diff) |
Input: atmel_mxt_ts: add early suspend/resume functionality
Add early suspend/resume functionality to Atmel touch driver.
0W suspend.
Early suspend/resume functions written and provided by
Atmel Corporation.
BUG 826854
Original-Change-Id: I58d5abacff20df9d3027c960021e94298e31b8a6
Reviewed-on: http://git-master/r/35286
Reviewed-by: Robert R Collins <rcollins@nvidia.com>
Tested-by: Robert R Collins <rcollins@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Reviewed-by: Narendra Damahe <ndamahe@nvidia.com>
Reviewed-by: Daniel Willemsen <dwillemsen@nvidia.com>
Rebase-Id: R1364d26f0c95bdb9e650e3231ac254242a9b3349
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 7cbaea67fc2a..115df441a29f 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -299,6 +299,9 @@ struct mxt_data { u8 actv2idle_timeout; u8 is_stopped; struct mutex access_mutex; +#if defined(CONFIG_HAS_EARLYSUSPEND) + struct early_suspend early_suspend; +#endif unsigned int driver_paused; struct bin_attribute mem_access_attr; int debug_enabled; @@ -311,6 +314,10 @@ struct mxt_data { u8 slowscan_shad_actv2idle_timeout; }; +#if defined(CONFIG_HAS_EARLYSUSPEND) +static void mxt_early_suspend(struct early_suspend *es); +static void mxt_early_resume(struct early_suspend *es); +#endif static bool mxt_object_readable(unsigned int type) { @@ -1636,6 +1643,13 @@ static int __devinit mxt_probe(struct i2c_client *client, goto err_free_object; } +#if defined(CONFIG_HAS_EARLYSUSPEND) + data->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1; + data->early_suspend.suspend = mxt_early_suspend; + data->early_suspend.resume = mxt_early_resume; + register_early_suspend(&data->early_suspend); +#endif + error = mxt_make_highchg(data); if (error) { dev_err(&client->dev, "Failed to make high CHG\n"); @@ -1733,6 +1747,34 @@ static int mxt_resume(struct device *dev) return 0; } +#if defined(CONFIG_HAS_EARLYSUSPEND) +static void mxt_early_suspend(struct early_suspend *es) +{ + struct mxt_data *mxt; + struct device *dev; + mxt = container_of(es, struct mxt_data, early_suspend); + dev = &mxt->client->dev; + dev_info(dev, "MXT Early Suspend entered\n"); + + if (mxt_suspend(&mxt->client->dev) != 0) + dev_err(&mxt->client->dev, "%s: failed\n", __func__); + dev_info(dev, "MXT Early Suspended\n"); +} + +static void mxt_early_resume(struct early_suspend *es) +{ + struct mxt_data *mxt; + struct device *dev; + mxt = container_of(es, struct mxt_data, early_suspend); + dev = &mxt->client->dev; + dev_info(dev, "MXT Early Resume entered\n"); + + if (mxt_resume(&mxt->client->dev) != 0) + dev_err(&mxt->client->dev, "%s: failed\n", __func__); + dev_info(dev, "MXT Early Resumed\n"); +} +#endif + static const struct dev_pm_ops mxt_pm_ops = { .suspend = mxt_suspend, .resume = mxt_resume, |