[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DB7PR04MB4618F4EB4EC48CE22F89BAD2E6DB0@DB7PR04MB4618.eurprd04.prod.outlook.com>
Date: Thu, 22 Nov 2018 05:08:40 +0000
From: Joakim Zhang <qiangqing.zhang@....com>
To: Aisheng DONG <aisheng.dong@....com>,
"linux-can@...r.kernel.org" <linux-can@...r.kernel.org>,
"mkl@...gutronix.de" <mkl@...gutronix.de>
CC: "wg@...ndegger.com" <wg@...ndegger.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
dl-linux-imx <linux-imx@....com>
Subject: RE: [PATCH V4 1/1] can: flexcan: add self wakeup support
Hi Aisheng,
> -----Original Message-----
> From: Aisheng DONG
> Sent: 2018年11月22日 10:31
> To: Joakim Zhang <qiangqing.zhang@....com>; linux-can@...r.kernel.org;
> mkl@...gutronix.de
> Cc: wg@...ndegger.com; linux-kernel@...r.kernel.org; dl-linux-imx
> <linux-imx@....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
Powered by blists - more mailing lists