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 V2 2/2] can: flexcan: disable clocks during stop mode
Date: Tue, 10 Dec 2019 09:00:13 +0000 [thread overview]
Message-ID: <20191210085721.9853-2-qiangqing.zhang@nxp.com> (raw)
In-Reply-To: <20191210085721.9853-1-qiangqing.zhang@nxp.com>
Disable clocks during CAN in stop mode.
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
------
ChangeLog:
V1->V2: * moving the pm_runtime_force_suspend() call for both
cases "device_may_wakeup()" and "!device_may_wakeup()" into the
flexcan_noirq_suspend() handler
---
drivers/net/can/flexcan.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 6c1ccf9f6c08..63b2f47635cf 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1718,10 +1718,6 @@ static int __maybe_unused flexcan_suspend(struct device *device)
if (err)
return err;
- err = pm_runtime_force_suspend(device);
- if (err)
- return err;
-
err = pinctrl_pm_select_sleep_state(device);
if (err)
return err;
@@ -1751,10 +1747,6 @@ static int __maybe_unused flexcan_resume(struct device *device)
if (err)
return err;
- err = pm_runtime_force_resume(device);
- if (err)
- return err;
-
err = flexcan_chip_start(dev);
if (err)
return err;
@@ -1786,9 +1778,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))
- flexcan_enable_wakeup_irq(priv, true);
+ if (netif_running(dev)) {
+ if (device_may_wakeup(device))
+ flexcan_enable_wakeup_irq(priv, true);
+
+ err = pm_runtime_force_suspend(device);
+ if (err)
+ return err;
+ }
return 0;
}
@@ -1799,11 +1798,18 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device)
struct flexcan_priv *priv = netdev_priv(dev);
int err;
- if (netif_running(dev) && device_may_wakeup(device)) {
- flexcan_enable_wakeup_irq(priv, false);
- err = flexcan_exit_stop_mode(priv);
+ if (netif_running(dev)) {
+ err = pm_runtime_force_resume(device);
if (err)
return err;
+
+ if (device_may_wakeup(device)) {
+ flexcan_enable_wakeup_irq(priv, false);
+
+ err = flexcan_exit_stop_mode(priv);
+ if (err)
+ return err;
+ }
}
return 0;
--
2.17.1
next prev parent reply other threads:[~2019-12-10 9:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 9:00 [PATCH V2 1/2] can: flexcan: disable runtime PM if register flexcandev failed Joakim Zhang
2019-12-10 9:00 ` Joakim Zhang [this message]
2019-12-18 14:00 ` [PATCH V2 2/2] can: flexcan: disable clocks during stop mode Sean Nyekjaer
2019-12-17 6:36 ` [PATCH V2 1/2] can: flexcan: disable runtime PM if register flexcandev failed Joakim Zhang
2019-12-18 14:03 ` Sean Nyekjaer
2019-12-19 4:59 ` Joakim Zhang
2020-01-03 7:37 ` Joakim Zhang
2019-12-18 14:00 ` Sean Nyekjaer
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=20191210085721.9853-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.