From: Sudeep Holla <sudeep.holla@arm.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Steve Glendinning <steve.glendinning@smsc.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Sudeep Holla <sudeep.holla@arm.com>,
Guenter Roeck <linux@roeck-us.net>,
Jeremy Linton <jeremy.linton@arm.com>,
Kamlakant Patel <kamlakant.patel@broadcom.com>,
Pavel Fedin <p.fedin@samsung.com>,
Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Tony Lindgren <tony@atomide.com>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
John Stultz <john.stultz@linaro.org>
Subject: Re: [PATCH 3/3] RFC: net: smsc911x: add wake-up event interrupt support
Date: Mon, 11 Jul 2016 11:23:25 +0100 [thread overview]
Message-ID: <5783739D.4090706@arm.com> (raw)
In-Reply-To: <1467968852-6175-3-git-send-email-linus.walleij@linaro.org>
On 08/07/16 10:07, Linus Walleij wrote:
> The SMSC911x have a line out of the chip called "PME",
> Power Management Event. When connected to an asynchronous
> interrupt controller this is able to wake the system up
> from sleep in response to certain network events.
>
> This is the first attempt to support this in the Linux
> driver: the Qualcomm APQ8060 Dragonboard has this line
> routed to a GPIO line on the primary SoC padring, and as
> such it can be armed as a wakeup interrupt.
>
> The patch is inspired by the wakeup code in the RTC
> subsystem.
>
> The code looks for an additional interrupt - apart from the
> ordinary device interrupt - and in case that is present,
> we register an interrupt handler to respons to this,
> and flag the device and this interrupt as a wakeup.
>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: John Stultz <john.stultz@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Added some wakeup people at CC who can (hopefully) tell me if
> I'm doing this right or not.
> ---
> drivers/net/ethernet/smsc/smsc911x.c | 48 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 48 insertions(+)
>
> diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
> index 125d58ac22bd..e43755ae130a 100644
> --- a/drivers/net/ethernet/smsc/smsc911x.c
> +++ b/drivers/net/ethernet/smsc/smsc911x.c
[...]
> @@ -2525,6 +2540,33 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
> goto out_disable_resources;
> }
>
> + irq = platform_get_irq(pdev, 1);
> + if (irq == -EPROBE_DEFER) {
> + retval = -EPROBE_DEFER;
> + goto out_disable_resources;
> + /* It's perfectly fine to not have a PME IRQ */
> + } else if (irq > 0) {
> + char *pme_name;
> +
> + /*
> + * The Power Management Event (PME) IRQ appears as
> + * a pulse waking up the system from sleep in response to a
> + * network event.
> + */
> + retval = request_threaded_irq(irq, NULL,
> + smsc911x_pme_irq_thread,
> + IRQF_ONESHOT, "smsc911x-pme",
> + dev);
> + if (retval) {
> + SMSC_WARN(pdata, probe,
> + "Unable to claim requested PME irq: %d", irq);
> + goto out_disable_resources;
> + }
> + pdata->pme_irq = irq;
> + device_init_wakeup(&pdev->dev, true);
> + dev_pm_set_wake_irq(&pdev->dev, irq);
> + }
> +
> netif_carrier_off(dev);
>
> retval = register_netdev(dev);
> @@ -2613,6 +2655,9 @@ static int smsc911x_suspend(struct device *dev)
> PMT_CTRL_PM_MODE_D1_ | PMT_CTRL_WOL_EN_ |
> PMT_CTRL_ED_EN_ | PMT_CTRL_PME_EN_);
>
> + if (pdata->pme_irq && device_may_wakeup(dev))
> + enable_irq_wake(pdata->pme_irq);
> +
Based on my understanding of dev_pm_{set,clear}_wake_irq, we don't need
this and the below hunk. It's taken care in device_wakeup_arm_wake_irqs
which is called from suspend_enter---->dpm_suspend_noirq path once you
have done the setup with dev_pm_set_wake_irq and is enabled both of
which is true in your case.
> return 0;
> }
>
> @@ -2622,6 +2667,9 @@ static int smsc911x_resume(struct device *dev)
> struct smsc911x_data *pdata = netdev_priv(ndev);
> unsigned int to = 100;
>
> + if (pdata->pme_irq && device_may_wakeup(dev))
> + disable_irq_wake(pdata->pme_irq);
> +
Same as above.
--
Regards,
Sudeep
next prev parent reply other threads:[~2016-07-11 10:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-08 9:07 [PATCH 1/3] net: smsc911x: augment device tree bindings Linus Walleij
2016-07-08 9:07 ` [PATCH 2/3] net: smsc911x: request and deassert optional RESET GPIO Linus Walleij
2016-07-08 13:52 ` Guenter Roeck
2016-07-08 9:07 ` [PATCH 3/3] RFC: net: smsc911x: add wake-up event interrupt support Linus Walleij
2016-07-11 8:14 ` Tony Lindgren
2016-07-11 10:23 ` Sudeep Holla [this message]
2016-07-15 19:13 ` Florian Fainelli
2016-07-15 19:03 ` [PATCH 1/3] net: smsc911x: augment device tree bindings Rob Herring
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=5783739D.4090706@arm.com \
--to=sudeep.holla@arm.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=davem@davemloft.net \
--cc=jeremy.linton@arm.com \
--cc=john.stultz@linaro.org \
--cc=kamlakant.patel@broadcom.com \
--cc=linus.walleij@linaro.org \
--cc=linux@roeck-us.net \
--cc=netdev@vger.kernel.org \
--cc=p.fedin@samsung.com \
--cc=rjw@rjwysocki.net \
--cc=steve.glendinning@smsc.com \
--cc=tony@atomide.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.