mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 23:24:22 -04:00
sec_mmi: timeout to wait for wake lock at suspend
As sec_mmi_pre_suspend() is called in the path of display-off, too long blocking would possibly cause user space module "Display Controller" to be out of syncing display power state. Set a timeout for checking wake lock instead of waiting for forever. Change-Id: Ie72bda93eaaf66e89ed34d33911ec1fdfea5b0cb Signed-off-by: Shiyong Li <a22381@motorola.com> Reviewed-on: https://gerrit.mot.com/1506510 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Igor Kovalenko <igork@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
b4a82b4f75
commit
9db2172413
1 changed files with 8 additions and 0 deletions
|
|
@ -42,6 +42,8 @@
|
|||
} \
|
||||
}
|
||||
|
||||
#define WAKELOCK_CHECKING_TIMEOUT_MS 300
|
||||
|
||||
static ssize_t sec_mmi_suppression_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size);
|
||||
static ssize_t sec_mmi_suppression_show(struct device *dev,
|
||||
|
|
@ -766,6 +768,7 @@ static int sec_mmi_wait_for_ready(struct device *dev) {
|
|||
static int sec_mmi_pre_suspend(struct device *dev) {
|
||||
struct sec_ts_data *ts = dev_get_drvdata(dev);
|
||||
unsigned long start_wait_jiffies = jiffies;
|
||||
unsigned int timeout = 0;
|
||||
|
||||
if (!ts) {
|
||||
dev_err(dev, "Failed to get driver data");
|
||||
|
|
@ -775,6 +778,11 @@ static int sec_mmi_pre_suspend(struct device *dev) {
|
|||
do {
|
||||
if (!ts->wakelock.active)
|
||||
break;
|
||||
if (++timeout > WAKELOCK_CHECKING_TIMEOUT_MS) {
|
||||
dev_err(dev, "%s: %d ms timeout of checking wakelock\n",
|
||||
__func__, WAKELOCK_CHECKING_TIMEOUT_MS);
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
usleep_range(1000, 1000);
|
||||
} while (1);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue