[PATCH v3 2/3] power: sequencing: qcom-wcn: support SW_CTRL wake

From: Linghui Wu

Date: Mon Oct 19 2026 - 05:40:12 EST


Some WCN3990-family devices use SW_CTRL to signal that resources need
remain available while the application processor is suspended.

When the PMU is marked as a wakeup source, request the existing SW_CTRL
GPIO as an input, map it to an IRQ and register it as a dedicated wake
IRQ. The PM core then keeps the IRQ disabled during normal operation and
arms it for system suspend.

Signed-off-by: Linghui Wu <linghui.wu@xxxxxxxxxxxxxxxx>
---
drivers/power/sequencing/pwrseq-qcom-wcn.c | 36 ++++++++++++++++++++++
1 file changed, 36 insertions(+)

diff --git a/drivers/power/sequencing/pwrseq-qcom-wcn.c b/drivers/power/sequencing/pwrseq-qcom-wcn.c
index 636dd7e63891..69b7eb565996 100644
--- a/drivers/power/sequencing/pwrseq-qcom-wcn.c
+++ b/drivers/power/sequencing/pwrseq-qcom-wcn.c
@@ -11,6 +11,8 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/pm_wakeirq.h>
+#include <linux/pm_wakeup.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/pwrseq/provider.h>
@@ -484,11 +486,18 @@ static int pwrseq_qcom_wcn3990_match(struct pwrseq_device *pwrseq,
return pwrseq_qcom_wcn_match_regulator(pwrseq, dev, "vdd-1.8-xo-supply");
}

+static void pwrseq_qcom_wcn_clear_wake_irq(void *data)
+{
+ dev_pm_clear_wake_irq(data);
+}
+
static int pwrseq_qcom_wcn_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct pwrseq_qcom_wcn_ctx *ctx;
+ struct gpio_desc *swctrl_gpio;
struct pwrseq_config config;
+ int wake_irq;
int i, ret;

ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
@@ -526,6 +535,33 @@ static int pwrseq_qcom_wcn_probe(struct platform_device *pdev)
return dev_err_probe(dev, PTR_ERR(ctx->bt_gpio),
"Failed to get the Bluetooth enable GPIO\n");

+ if (device_property_read_bool(dev, "wakeup-source")) {
+ swctrl_gpio = devm_gpiod_get(dev, "swctrl", GPIOD_IN);
+ if (IS_ERR(swctrl_gpio))
+ return dev_err_probe(dev, PTR_ERR(swctrl_gpio),
+ "Failed to get the SW_CTRL GPIO\n");
+
+ wake_irq = gpiod_to_irq(swctrl_gpio);
+ if (wake_irq < 0)
+ return dev_err_probe(dev, wake_irq,
+ "Failed to get the SW_CTRL wake IRQ\n");
+
+ ret = devm_device_init_wakeup(dev);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to enable wakeup\n");
+
+ ret = dev_pm_set_dedicated_wake_irq(dev, wake_irq);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to set the SW_CTRL wake IRQ\n");
+
+ ret = devm_add_action_or_reset(dev,
+ pwrseq_qcom_wcn_clear_wake_irq, dev);
+ if (ret)
+ return ret;
+ }
+
ctx->wlan_gpio = devm_gpiod_get_optional(dev, "wlan-enable",
GPIOD_OUT_LOW);
if (IS_ERR(ctx->wlan_gpio))
--
2.43.0