MLK-14241-3 ARM: imx: pm-rpmsg: cancel heartbeat workqueue before suspend
authorRobin Gong <yibin.gong@nxp.com>
Wed, 22 Feb 2017 08:52:51 +0000 (16:52 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:10:46 +0000 (15:10 -0500)
cancel heartbeat workqueue to make sure no any heartbeat message will
be sent to M4 after M4 thought A7 core enter VLLS mode.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
arch/arm/mach-imx/pm-rpmsg.c

index 4cd9262..450687a 100644 (file)
@@ -248,12 +248,29 @@ static struct rpmsg_driver pm_rpmsg_driver = {
 #ifdef CONFIG_PM_SLEEP
 static int pm_heartbeat_suspend(struct device *dev)
 {
-       return pm_vlls_notify_m4(true);
+       int err;
+
+       err = pm_vlls_notify_m4(true);
+       if (err)
+               return err;
+
+       cancel_delayed_work_sync(&heart_beat_work);
+
+       return 0;
 }
 
 static int pm_heartbeat_resume(struct device *dev)
 {
-       return pm_vlls_notify_m4(false);
+       int err;
+
+       err = pm_vlls_notify_m4(true);
+       if (err)
+               return err;
+
+       schedule_delayed_work(&heart_beat_work,
+                       msecs_to_jiffies(10000));
+
+       return 0;
 }
 #endif