summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuresh Mangipudi <smangipudi@nvidia.com>2010-10-05 15:24:38 +0530
committerVarun Colbert <vcolbert@nvidia.com>2010-10-21 15:35:52 -0700
commitcbfb3154f1621958f053ec23a4d2811fb938b618 (patch)
tree037325b824450db4fd74768f9bd3d818d691c75e
parentcb800e32170138f00aad5b724dc56c18ce1b07ad (diff)
[ARM]: touch: low power mode for touchscreen.
The late resume of touch was not invoked when display was not turned on. This has been handled now. Bug 740740 (cherry picked from commit ef6a066e3ad9254312660bbb725be9ed49448ffa) Change-Id: Id2f1cd255ed59019fb46778da1b93cbe7aa3b8bb Reviewed-on: http://git-master/r/7973 Reviewed-by: Suresh Mangipudi <smangipudi@nvidia.com> Tested-by: Suresh Mangipudi <smangipudi@nvidia.com> Reviewed-by: Narendra Damahe <ndamahe@nvidia.com> Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com> Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
-rwxr-xr-x[-rw-r--r--]drivers/input/touchscreen/tegra_odm.c53
1 files changed, 34 insertions, 19 deletions
diff --git a/drivers/input/touchscreen/tegra_odm.c b/drivers/input/touchscreen/tegra_odm.c
index b8b1852df14c..8515b6afc577 100644..100755
--- a/drivers/input/touchscreen/tegra_odm.c
+++ b/drivers/input/touchscreen/tegra_odm.c
@@ -66,6 +66,7 @@ struct tegra_touch_driver_data
NvU32 MinY;
int shutdown;
struct early_suspend early_suspend;
+ NvBool bIsSuspended;
};
#define NVODM_TOUCH_NAME "nvodm_touch"
@@ -75,11 +76,13 @@ struct tegra_touch_driver_data
#ifdef CONFIG_HAS_EARLYSUSPEND
static void tegra_touch_early_suspend(struct early_suspend *es)
{
- struct tegra_touch_driver_data *touch;
- touch = container_of(es, struct tegra_touch_driver_data, early_suspend);
-
+ struct tegra_touch_driver_data *touch;
+ touch = container_of(es, struct tegra_touch_driver_data, early_suspend);
if (touch && touch->hTouchDevice) {
- NvOdmTouchPowerOnOff(touch->hTouchDevice, NV_FALSE);
+ if (!touch->bIsSuspended) {
+ NvOdmTouchPowerOnOff(touch->hTouchDevice, NV_FALSE);
+ touch->bIsSuspended = NV_TRUE;
+ }
}
else {
pr_err("tegra_touch_early_suspend: NULL handles passed\n");
@@ -88,24 +91,34 @@ static void tegra_touch_early_suspend(struct early_suspend *es)
static void tegra_touch_late_resume(struct early_suspend *es)
{
- struct tegra_touch_driver_data *touch;
- touch = container_of(es, struct tegra_touch_driver_data, early_suspend);
-
+ struct tegra_touch_driver_data *touch;
+ touch = container_of(es, struct tegra_touch_driver_data, early_suspend);
if (touch && touch->hTouchDevice) {
- NvOdmTouchPowerOnOff(touch->hTouchDevice, NV_TRUE);
+ if (touch->bIsSuspended) {
+ NvOdmTouchPowerOnOff(touch->hTouchDevice, NV_TRUE);
+ touch->bIsSuspended = NV_FALSE;
+ }
}
else {
pr_err("tegra_touch_late_resume: NULL handles passed\n");
}
}
-#else
+
+#endif
+
static int tegra_touch_suspend(struct platform_device *pdev, pm_message_t state)
{
struct tegra_touch_driver_data *touch = platform_get_drvdata(pdev);
-
if (touch && touch->hTouchDevice) {
- NvOdmTouchPowerOnOff(touch->hTouchDevice, NV_FALSE);
- return 0;
+ if (!touch->bIsSuspended) {
+ NvOdmTouchPowerOnOff(touch->hTouchDevice, NV_FALSE);
+ touch->bIsSuspended = NV_TRUE;
+ return 0;
+ }
+ else {
+ // device is already suspended
+ return 0;
+ }
}
pr_err("tegra_touch_suspend: NULL handles passed\n");
return -1;
@@ -114,15 +127,19 @@ static int tegra_touch_suspend(struct platform_device *pdev, pm_message_t state)
static int tegra_touch_resume(struct platform_device *pdev)
{
struct tegra_touch_driver_data *touch = platform_get_drvdata(pdev);
-
if (touch && touch->hTouchDevice) {
- NvOdmTouchPowerOnOff(touch->hTouchDevice, NV_TRUE);
- return 0;
+ if (touch->bIsSuspended) {
+ NvOdmTouchPowerOnOff(touch->hTouchDevice, NV_TRUE);
+ touch->bIsSuspended = NV_FALSE;
+ return 0;
+ }
+ else {
+ return 0;
+ }
}
pr_err("tegra_touch_resume: NULL handles passed\n");
return -1;
}
-#endif
static int tegra_touch_thread(void *pdata)
{
@@ -331,7 +348,7 @@ static int __init tegra_touch_probe(struct platform_device *pdev)
for (i = 0; i < (caps->MaxNumberOfFingerCoordReported - 1); i++) {
set_bit(BTN_2 + i, touch->input_dev->keybit);
}
-
+ touch->bIsSuspended = NV_FALSE;
/* expose multi-touch capabilities */
set_bit(ABS_MT_TOUCH_MAJOR, touch->input_dev->keybit);
set_bit(ABS_MT_POSITION_X, touch->input_dev->keybit);
@@ -443,10 +460,8 @@ static int tegra_touch_remove(struct platform_device *pdev)
static struct platform_driver tegra_touch_driver = {
.probe = tegra_touch_probe,
.remove = tegra_touch_remove,
-#ifndef CONFIG_HAS_EARLYSUSPEND
.suspend = tegra_touch_suspend,
.resume = tegra_touch_resume,
-#endif
.driver = {
.name = "tegra_touch",
},