From 6b6a1d0b9c1827d8e8bda02ba7566a05d286f5ef Mon Sep 17 00:00:00 2001 From: xuwt2 Date: Mon, 6 Jan 2020 11:21:29 +0800 Subject: [PATCH] MMI: Add DC psy notifier The tree modules(p938x, smbcharger-mmi, qpnp-smb5) work togegher to handle the logic of wireless charging. In smbcharger-mmi, MMI_HB_VOLTER will hold dc suspend until heartbeat work detect DC present, In qpnp-smb5, dcin-plugin irq handle DC present status. they are all triggered asynchronously in parallel, and the DC present is always active after p938x VOUT_ON has been set for a while. And yet, at this point, smbcharger-mmi's heartbeat work has been triggered by wireless psy change when p938x is VOUT_ON. This leads to MMI_HB_VOLTER hold dc suspend in a minute to wait heartbeat schedule again by itself Change-Id: Idc8b62fa47975daeba3f0875d7715771fa8141a8 Signed-off-by: xuwt2 Reviewed-on: https://gerrit.mot.com/1479568 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Ryan Lattrel Reviewed-by: Ling Jin Submit-Approved: Jira Key --- drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c b/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c index 78897eca5bbf..0079006d2729 100644 --- a/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c +++ b/drivers/power/qpnp-smbcharger-mmi/qpnp-smbcharger-mmi.c @@ -3262,7 +3262,9 @@ static int mmi_psy_notifier_call(struct notifier_block *nb, unsigned long val, if (psy && ((strcmp(psy->desc->name, "usb") == 0) || - (strcmp(psy->desc->name, "wireless") == 0))) { + (strcmp(psy->desc->name, "wireless") == 0) || + (strcmp(psy->desc->name, "dc") == 0))) { + cancel_delayed_work(&chip->heartbeat_work); schedule_delayed_work(&chip->heartbeat_work, msecs_to_jiffies(0));