Add touch suspend_noirq process

Because there is no disable-irq in LPM mode, I2C communication may
occur when system suspends, resulting in conflict, which may lead to
system crash.
  So we disable-irq when PM suspend, and then enable-irq again in the
suspend_noirq phase.

Change-Id: Ib9ca3f1f2a6d2da0142c6203acedb617535fc4a0
Reviewed-on: https://gerrit.mot.com/1494642
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jialei Hao <haojl2@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
litong 2020-02-07 16:38:11 +08:00 • committed by litong20
commit 905d07601f
2 changed files with 46 additions and 4 deletions

View file

@ -11,7 +11,8 @@ obj-m := sec_mmi.o
sec_mmi-objs = sec_ts.o sec_ts_fn.o sec_ts_fw.o sec_cmd.o sec_ts_only_vendor.o
ifneq ($(filter m y,$(CONFIG_INPUT_TOUCHSCREEN_MMI)),)
EXTRA_CFLAGS += -DCONFIG_PANEL_NOTIFICATIONS -DCONFIG_INPUT_TOUCHSCREEN_MMI
EXTRA_CFLAGS += -DCONFIG_PANEL_NOTIFICATIONS -DCONFIG_INPUT_TOUCHSCREEN_MMI \
-DCONFIG_PM
sec_mmi-objs += sec_ts_mmi_class.o
else
EXTRA_CFLAGS += -DUSE_STUBS

View file

@ -2486,14 +2486,34 @@ out:
return ret;
}
#if defined(CONFIG_PM) && !defined(CONFIG_DRM)
#if defined(CONFIG_PM)
static int sec_ts_pm_suspend(struct device *dev)
{
struct sec_ts_data *ts = dev_get_drvdata(dev);
input_dbg(true, &ts->client->dev, "%s:Into PM suspend\n", __func__);
#if !defined(CONFIG_DRM)
if (ts->lowpower_mode)
reinit_completion(&ts->resume_done);
#endif
if (ts->power_status == SEC_TS_STATE_LPM) {
input_dbg(true, &ts->client->dev, "%s: Disable-irq\n", __func__);
sec_ts_irq_enable(ts, false);
}
return 0;
}
static int sec_ts_pm_suspend_noirq(struct device *dev)
{
struct sec_ts_data *ts = dev_get_drvdata(dev);
input_dbg(true, &ts->client->dev, "%s: Into PM suspend_noirq\n", __func__);
if (ts->power_status == SEC_TS_STATE_LPM) {
input_dbg(true, &ts->client->dev, "%s: Enable-irq\n", __func__);
sec_ts_irq_enable(ts, true);
}
return 0;
}
@ -2501,9 +2521,28 @@ static int sec_ts_pm_resume(struct device *dev)
{
struct sec_ts_data *ts = dev_get_drvdata(dev);
input_dbg(true, &ts->client->dev, "%s: Into PM resume\n", __func__);
if (ts->power_status == SEC_TS_STATE_LPM) {
input_dbg(true, &ts->client->dev, "%s: Enable-irq\n", __func__);
sec_ts_irq_enable(ts, true);
}
#if !defined(CONFIG_DRM)
if (ts->lowpower_mode)
complete_all(&ts->resume_done);
#endif
return 0;
}
static int sec_ts_pm_resume_noirq(struct device *dev)
{
struct sec_ts_data *ts = dev_get_drvdata(dev);
input_dbg(true, &ts->client->dev, "%s: Into PM resume_noirq\n", __func__);
if (ts->power_status == SEC_TS_STATE_LPM) {
input_dbg(true, &ts->client->dev, "%s: Disable-irq\n", __func__);
sec_ts_irq_enable(ts, false);
}
return 0;
}
#endif
@ -2513,10 +2552,12 @@ static const struct i2c_device_id sec_ts_id[] = {
{ },
};
#if defined(CONFIG_PM) && !defined(CONFIG_DRM)
#if defined(CONFIG_PM)
static const struct dev_pm_ops sec_ts_dev_pm_ops = {
.suspend = sec_ts_pm_suspend,
.suspend_noirq = sec_ts_pm_suspend_noirq,
.resume = sec_ts_pm_resume,
.resume_noirq = sec_ts_pm_resume_noirq,
};
#endif
@ -2540,7 +2581,7 @@ static struct i2c_driver sec_ts_driver = {
#ifdef CONFIG_OF
.of_match_table = sec_ts_match_table,
#endif
#if defined(CONFIG_PM) && !defined(CONFIG_DRM)
#if defined(CONFIG_PM)
.pm = &sec_ts_dev_pm_ops,
#endif
},