aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun Zhang <chunz@codeaurora.org>2014-01-13 22:11:42 -0800
committerChun Zhang <chunz@codeaurora.org>2014-01-15 18:26:28 -0800
commitec69cce7ca307120838f4b1ca0cd28f60fc76f35 (patch)
tree3ffb1da3cf7bfedac81acd30835d5c297cbfe3f1
parent02983880ebd8c4c35de72f97d225e6d8232c76cd (diff)
input: synaptics_i2c_rmi4: amend error handling in wake and sleep
When device is put to suspend or resume, the correct behavior is to restore the previous state so that correct suspend and resume behavior is ensured in subsequent runs. CRs-Fixed: 591072 Change-Id: I2ff52a18df948b6d8eafaf049d50829ea7968323 Signed-off-by: Chun Zhang <chunz@codeaurora.org>
-rw-r--r--drivers/input/touchscreen/synaptics_i2c_rmi4.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/drivers/input/touchscreen/synaptics_i2c_rmi4.c b/drivers/input/touchscreen/synaptics_i2c_rmi4.c
index adfb72c2956..5241fc2c26d 100644
--- a/drivers/input/touchscreen/synaptics_i2c_rmi4.c
+++ b/drivers/input/touchscreen/synaptics_i2c_rmi4.c
@@ -5,7 +5,7 @@
*
* Copyright (C) 2012 Alexandra Chin <alexandra.chin@tw.synaptics.com>
* Copyright (C) 2012 Scott Lin <scott.lin@tw.synaptics.com>
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -3569,7 +3569,7 @@ static int synaptics_rmi4_suspend(struct device *dev)
retval = synaptics_rmi4_regulator_lpm(rmi4_data, true);
if (retval < 0) {
dev_err(dev, "failed to enter low power mode\n");
- return retval;
+ goto err_lpm_regulator;
}
} else {
dev_err(dev,
@@ -3581,12 +3581,24 @@ static int synaptics_rmi4_suspend(struct device *dev)
retval = synaptics_rmi4_gpio_configure(rmi4_data, false);
if (retval < 0) {
dev_err(dev, "failed to put gpios in suspend state\n");
- return retval;
+ goto err_gpio_configure;
}
}
rmi4_data->suspended = true;
return 0;
+
+err_gpio_configure:
+ synaptics_rmi4_regulator_lpm(rmi4_data, false);
+
+err_lpm_regulator:
+ if (rmi4_data->sensor_sleep) {
+ synaptics_rmi4_sensor_wake(rmi4_data);
+ synaptics_rmi4_irq_enable(rmi4_data, true);
+ rmi4_data->touch_stopped = false;
+ }
+
+ return retval;
}
/**
@@ -3622,7 +3634,7 @@ static int synaptics_rmi4_resume(struct device *dev)
retval = synaptics_rmi4_gpio_configure(rmi4_data, true);
if (retval < 0) {
dev_err(dev, "Failed to put gpios in active state\n");
- return retval;
+ goto err_gpio_configure;
}
}
@@ -3633,11 +3645,24 @@ static int synaptics_rmi4_resume(struct device *dev)
retval = synaptics_rmi4_check_configuration(rmi4_data);
if (retval < 0) {
dev_err(dev, "Failed to check configuration\n");
- return retval;
+ goto err_check_configuration;
}
rmi4_data->suspended = false;
return 0;
+
+err_check_configuration:
+ synaptics_rmi4_irq_enable(rmi4_data, false);
+ rmi4_data->touch_stopped = true;
+ synaptics_rmi4_sensor_sleep(rmi4_data);
+
+ if (rmi4_data->board->disable_gpios)
+ synaptics_rmi4_gpio_configure(rmi4_data, false);
+err_gpio_configure:
+ synaptics_rmi4_regulator_lpm(rmi4_data, true);
+ wake_up(&rmi4_data->wait);
+
+ return retval;
}
#if (!defined(CONFIG_FB) && !defined(CONFIG_HAS_EARLYSUSPEND))