linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joakim Zhang <qiangqing.zhang@nxp.com>
To: Aisheng DONG <aisheng.dong@nxp.com>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
	"mkl@pengutronix.de" <mkl@pengutronix.de>
Cc: "wg@grandegger.com" <wg@grandegger.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH V4 1/1] can: flexcan: add self wakeup support
Date: Thu, 22 Nov 2018 05:08:40 +0000	[thread overview]
Message-ID: <DB7PR04MB4618F4EB4EC48CE22F89BAD2E6DB0@DB7PR04MB4618.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <AM0PR04MB4211B8283948F8DB63115DD580DB0@AM0PR04MB4211.eurprd04.prod.outlook.com>

Hi Aisheng,


> -----Original Message-----
> From: Aisheng DONG
> Sent: 2018年11月22日 10:31
> To: Joakim Zhang <qiangqing.zhang@nxp.com>; linux-can@vger.kernel.org;
> mkl@pengutronix.de
> Cc: wg@grandegger.com; linux-kernel@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: RE: [PATCH V4 1/1] can: flexcan: add self wakeup support
> 
> [...]
> 
> > +
> > +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);
> > +
> > +	if (netif_running(dev) && device_may_wakeup(device))
> > +		flexcan_enable_wakeup_irq(priv, true);
> > +
> > +	return 0;
> > +}
> > +
> > +static int __maybe_unused flexcan_noirq_resume(struct device *device) {
> > +	struct net_device *dev = dev_get_drvdata(device);
> > +	struct flexcan_priv *priv = netdev_priv(dev);
> > +
> > +	if (netif_running(dev) && device_may_wakeup(device)) {
> > +		disable_irq_wake(dev->irq);
> 
> A bit more thinking:
> Can we put flexcan_enable_wakeup_irq(priv, false) here and move
> disable_irq_wake to resume function?
> Then it looks better on pairs for those functions.
> 
> I'm not sure if irq will be lost or we may even not need wakeup irq.
> Please help check it.

1. I have try that flexcan_enable_wakeup_irq(priv, false) can move into flexcan_noirq_resume() and disable_irq_wake() can move into flexcan_resume().
  If you think that is better, I will modify it.

2. If we don't disable wakeup irq after it exits stop mode, it will continue enter wakeup interrupt handle function when the wakeup event arriving during suspend after
  the system has done once more suspend/resume.

Best Regards,
Joakim Zhang

> Regards
> Dong Aisheng
> 
> > +		flexcan_exit_stop_mode(priv);
> >  	}
> > +
> >  	return 0;
> >  }
> >
> > -static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend,
> > flexcan_resume);
> > +static const struct dev_pm_ops flexcan_pm_ops = {
> > +	SET_SYSTEM_SLEEP_PM_OPS(flexcan_suspend, flexcan_resume)
> > +	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(flexcan_noirq_suspend,
> > +flexcan_noirq_resume) };
> >
> >  static struct platform_driver flexcan_driver = {
> >  	.driver = {
> > --
> > 2.17.1


      reply	other threads:[~2018-11-22  5:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 12:32 [PATCH V4 0/1] can: flexcan: add self wakeup support Joakim Zhang
2018-11-21 12:32 ` [PATCH V4 1/1] " Joakim Zhang
2018-11-21 13:00   ` Aisheng DONG
2018-11-21 13:01     ` Aisheng DONG
2018-11-22  1:28       ` Joakim Zhang
2018-11-22  1:20     ` Joakim Zhang
2018-11-22  2:30   ` Aisheng DONG
2018-11-22  5:08     ` Joakim Zhang [this message]

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=DB7PR04MB4618F4EB4EC48CE22F89BAD2E6DB0@DB7PR04MB4618.eurprd04.prod.outlook.com \
    --to=qiangqing.zhang@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=wg@grandegger.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;
as well as URLs for NNTP newsgroup(s).