diff options
author | Super Liu <supercjliu@google.com> | 2020-06-03 23:49:51 +0800 |
---|---|---|
committer | Super Liu <supercjliu@google.com> | 2020-06-04 09:52:36 +0800 |
commit | 2b85d800ef60c9211f36ea04dd528cf2ea1a8f20 (patch) | |
tree | 1c6ee64cc77ccd0a6c307210230c61998fa70ac0 | |
parent | 23bc5e62b0224c00887bbeeac57e85234c45731d (diff) | |
download | sec_touch-2b85d800ef60c9211f36ea04dd528cf2ea1a8f20.tar.gz |
sec_touch: only update charger mode status after suspend
In normal case, touch driver will follow current power supply
notification to change corresponding charger mode. But, if this
notification is triggered after touch suspend, driver should only
update charger mode stauts to avoid any i/o transmission. And,
the latest charger mode will apply after touch driver resume.
Bug: 158067778
Change-Id: I3627a83dcfa4df74bce77ce4825425f0140a99a2
Signed-off-by: Super Liu <supercjliu@google.com>
-rw-r--r-- | sec_ts.c | 33 |
1 files changed, 21 insertions, 12 deletions
@@ -4555,19 +4555,25 @@ static void sec_ts_charger_work(struct work_struct *work) ts->charger_mode, charger_mode); if (ts->charger_mode != charger_mode) { - ret = ts->sec_ts_write(ts, SET_TS_CMD_SET_CHARGER_MODE, + if (ts->power_status == SEC_TS_STATE_POWER_ON) { + ret = ts->sec_ts_write(ts, SET_TS_CMD_SET_CHARGER_MODE, &charger_mode, 1); - if (ret < 0) { - input_err(true, &ts->client->dev, - "%s: write reg %#x %#x failed, returned %i\n", - __func__, SET_TS_CMD_SET_CHARGER_MODE, charger_mode, - ret); - return; - } + if (ret < 0) { + input_err(true, &ts->client->dev, + "%s: write reg %#x %#x failed, returned %i\n", + __func__, SET_TS_CMD_SET_CHARGER_MODE, + charger_mode, ret); + return; + } - input_info(true, &ts->client->dev, - "%s: charger_mode change from %#x to %#x\n", - __func__, ts->charger_mode, charger_mode); + input_info(true, &ts->client->dev, + "%s: charger_mode change from %#x to %#x\n", + __func__, ts->charger_mode, charger_mode); + } else { + input_info(true, &ts->client->dev, + "%s: ONLY update charger_mode status from %#x to %#x, then will apply during resume\n", + __func__, ts->charger_mode, charger_mode); + } ts->charger_mode = charger_mode; } @@ -4729,7 +4735,10 @@ static int sec_ts_psy_cb(struct notifier_block *nb, ktime_add_ms(ts->usb_changed_timestamp, debounce))) ts->keep_wlc_mode = true; } - queue_work(ts->event_wq, &ts->charger_work); + + if (ts->power_status == SEC_TS_STATE_POWER_ON) + queue_work(ts->event_wq, &ts->charger_work); + return NOTIFY_OK; } |