Netdev List
 help / color / mirror / Atom feed
From: Joakim Zhang <qiangqing.zhang@nxp.com>
To: "mkl@pengutronix.de" <mkl@pengutronix.de>,
	"sean@geanix.com" <sean@geanix.com>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Cc: dl-linux-imx <linux-imx@nxp.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Joakim Zhang <qiangqing.zhang@nxp.com>
Subject: [PATCH 2/2] can: flexcan: disable clocks during stop mode
Date: Tue, 10 Dec 2019 07:16:00 +0000	[thread overview]
Message-ID: <20191210071252.26165-2-qiangqing.zhang@nxp.com> (raw)
In-Reply-To: <20191210071252.26165-1-qiangqing.zhang@nxp.com>

Disable clocks during CAN in stop mode.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
 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


  reply	other threads:[~2019-12-10  7:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10  7:15 [PATCH 1/2] can: flexcan: disable runtime PM if register flexcandev failed Joakim Zhang
2019-12-10  7:16 ` Joakim Zhang [this message]
2019-12-10  7:39   ` [PATCH 2/2] can: flexcan: disable clocks during stop mode Sean Nyekjaer
2019-12-10  7:58     ` Joakim Zhang
2019-12-10  8:31   ` Marc Kleine-Budde
2019-12-10  8:41     ` Joakim Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191210071252.26165-2-qiangqing.zhang@nxp.com \
    --to=qiangqing.zhang@nxp.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=sean@geanix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox