From: "Jérôme Pouiller" <jerome.pouiller@silabs.com>
To: linux-wireless@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, "Kalle Valo" <kvalo@kernel.org>,
linux-devel@silabs.com,
"Jérôme Pouiller" <jerome.pouiller@silabs.com>
Subject: [PATCH 3/5] wifi: wfx: allow SPI device to wake up the host
Date: Fri, 28 Feb 2025 18:14:39 +0100 [thread overview]
Message-ID: <20250228171441.109321-4-jerome.pouiller@silabs.com> (raw)
In-Reply-To: <20250228171441.109321-1-jerome.pouiller@silabs.com>
When the host is asleep, the device has wake up the host using the
usual SPI IRQ.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
drivers/net/wireless/silabs/wfx/bus_spi.c | 31 ++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/silabs/wfx/bus_spi.c b/drivers/net/wireless/silabs/wfx/bus_spi.c
index 46278dce7ffc..1d6bf3525f4e 100644
--- a/drivers/net/wireless/silabs/wfx/bus_spi.c
+++ b/drivers/net/wireless/silabs/wfx/bus_spi.c
@@ -13,6 +13,7 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/of.h>
+#include <linux/pm.h>
#include "bus.h"
#include "wfx.h"
@@ -189,6 +190,26 @@ static const struct wfx_hwbus_ops wfx_spi_hwbus_ops = {
.align_size = wfx_spi_align_size,
};
+static int wfx_spi_suspend(struct device *dev)
+{
+ struct spi_device *func = to_spi_device(dev);
+ struct wfx_spi_priv *bus = spi_get_drvdata(func);
+
+ if (!device_may_wakeup(dev))
+ return 0;
+ flush_work(&bus->core->hif.bh);
+ return enable_irq_wake(func->irq);
+}
+
+static int wfx_spi_resume(struct device *dev)
+{
+ struct spi_device *func = to_spi_device(dev);
+
+ if (!device_may_wakeup(dev))
+ return 0;
+ return disable_irq_wake(func->irq);
+}
+
static int wfx_spi_probe(struct spi_device *func)
{
struct wfx_platform_data *pdata;
@@ -239,7 +260,12 @@ static int wfx_spi_probe(struct spi_device *func)
if (!bus->core)
return -EIO;
- return wfx_probe(bus->core);
+ ret = wfx_probe(bus->core);
+ if (ret)
+ return ret;
+
+ device_set_wakeup_capable(&func->dev, true);
+ return 0;
}
static void wfx_spi_remove(struct spi_device *func)
@@ -273,6 +299,8 @@ static const struct of_device_id wfx_spi_of_match[] = {
MODULE_DEVICE_TABLE(of, wfx_spi_of_match);
#endif
+DEFINE_SIMPLE_DEV_PM_OPS(wfx_spi_pm_ops, wfx_spi_suspend, wfx_spi_resume);
+
struct spi_driver wfx_spi_driver = {
.id_table = wfx_spi_id,
.probe = wfx_spi_probe,
@@ -280,5 +308,6 @@ struct spi_driver wfx_spi_driver = {
.driver = {
.name = "wfx-spi",
.of_match_table = of_match_ptr(wfx_spi_of_match),
+ .pm = &wfx_spi_pm_ops,
},
};
--
2.39.5
next prev parent reply other threads:[~2025-02-28 17:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 17:14 [PATCH 0/5] wfx: add support for WoWLAN on Silabs WF200 Jérôme Pouiller
2025-02-28 17:14 ` [PATCH 1/5] wifi: wfx: align declarations between bus_spi.c and bus_sdio.c Jérôme Pouiller
2025-02-28 17:14 ` [PATCH 2/5] wifi: wfx: declare support for WoWLAN Jérôme Pouiller
2025-03-02 2:19 ` kernel test robot
2025-02-28 17:14 ` Jérôme Pouiller [this message]
2025-02-28 17:14 ` [PATCH 4/5] wifi: wfx: allow SDIO device to wake up the host Jérôme Pouiller
2025-02-28 17:14 ` [PATCH 5/5] wifi: wfx: allow to enable WoWLAN using NL80211 Jérôme Pouiller
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=20250228171441.109321-4-jerome.pouiller@silabs.com \
--to=jerome.pouiller@silabs.com \
--cc=kvalo@kernel.org \
--cc=linux-devel@silabs.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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
all inboxes | Powered by JetHome®