[PATCH 2/2] can: flexcan: disable clocks during stop mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Disable clocks during CAN in stop mode.

Signed-off-by: Joakim Zhang <qiangqing.zhang@xxxxxxx>
---
 drivers/net/can/flexcan.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 6c1ccf9f6c08..d767f85c80d3 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1786,10 +1786,16 @@ static int __maybe_unused flexcan_noirq_suspend(struct device *device)
 {
 	struct net_device *dev = dev_get_drvdata(device);
 	struct flexcan_priv *priv = netdev_priv(dev);
+	int err;
 
-	if (netif_running(dev) && device_may_wakeup(device))
+	if (netif_running(dev) && device_may_wakeup(device)) {
 		flexcan_enable_wakeup_irq(priv, true);
 
+		err = pm_runtime_force_suspend(device);
+		if (err)
+			return err;
+	}
+
 	return 0;
 }
 
@@ -1800,7 +1806,12 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device)
 	int err;
 
 	if (netif_running(dev) && device_may_wakeup(device)) {
+		err = pm_runtime_force_resume(device);
+		if (err)
+			return err;
+
 		flexcan_enable_wakeup_irq(priv, false);
+
 		err = flexcan_exit_stop_mode(priv);
 		if (err)
 			return err;
-- 
2.17.1





[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux