* [PATCH] usb: typec: ucsi: ucsi_glink: Prevent suspend during UCSI notification handling
@ 2026-07-10 10:21 Jishnu Prakash
2026-07-10 17:14 ` kernel test robot
2026-07-10 19:17 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Jishnu Prakash @ 2026-07-10 10:21 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: Dmitry Baryshkov, Konrad Dybcio, Deepak Kumar Singh, Kamal Wadhwa,
linux-usb, linux-kernel, Jishnu Prakash
When the system is suspended and a UCSI event arrives (such as USB plug-in),
the GLINK interrupt (with IRQF_NO_SUSPEND flag) fires and it eventually calls
the pmic_glink_ucsi_callback(), which schedules notify_work to handle the
connector change. However, since no wakeup source is held, the system can
re-enter suspend soon after the interrupt handler returns, before notify_work
has completed running, and the USB plug-in event would not be handled.
There was an earlier attempt to address this at the GLINK driver level, by
making the GLINK interrupt wakeup-capable, ("rpmsg: glink: Make glink smem
interrupt wakeup capable") [1], but upstream reviewers suggested a
different approach, preferring wakeup logic to be handled in the client driver.
To avoid losing UCSI notifications in this way, register ucsi_glink
as a wakeup-capable device in the probe, and call pm_wakeup_ws_event()
with hard=true before scheduling notify_work. The hard wakeup aborts any
in-progress suspend, and the timed wakeup source keeps the system
awake long enough for the notify_work call to run.
[1] https://lore.kernel.org/all/20240603073648.3475123-1-quic_deesin@quicinc.com/
Signed-off-by: Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>
---
drivers/usb/typec/ucsi/ucsi_glink.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
index 12e07b9fe622..7fa039f0a2ba 100644
--- a/drivers/usb/typec/ucsi/ucsi_glink.c
+++ b/drivers/usb/typec/ucsi/ucsi_glink.c
@@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of_device.h>
+#include <linux/pm_wakeup.h>
#include <linux/property.h>
#include <linux/soc/qcom/pdr.h>
#include <linux/usb/typec_mux.h>
@@ -26,6 +27,12 @@
#define UC_UCSI_WRITE_BUF_REQ 0x12
#define UC_UCSI_USBC_NOTIFY_IND 0x13
+/*
+ * Wakeup timeout to allow USB event notification processing to
+ * complete before device suspends.
+ */
+#define UCSI_GLINK_WAKEUP_TIMEOUT_MS 50
+
struct ucsi_read_buf_req_msg {
struct pmic_glink_hdr hdr;
};
@@ -342,6 +349,8 @@ static void pmic_glink_ucsi_callback(const void *data, size_t len, void *priv)
pmic_glink_ucsi_write_ack(ucsi, data, len);
break;
case UC_UCSI_USBC_NOTIFY_IND:
+ pm_wakeup_ws_event(ucsi->dev->power.wakeup,
+ UCSI_GLINK_WAKEUP_TIMEOUT_MS, true);
schedule_work(&ucsi->notify_work);
break;
}
@@ -401,6 +410,8 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev,
ucsi->dev = dev;
dev_set_drvdata(dev, ucsi);
+ device_init_wakeup(dev, true);
+
INIT_WORK(&ucsi->notify_work, pmic_glink_ucsi_notify);
INIT_WORK(&ucsi->register_work, pmic_glink_ucsi_register);
init_completion(&ucsi->read_ack);
---
base-commit: 2cb6eac064c8334418a76999468f68696a8dfe71
change-id: 20260710-ucsi_glink_wakeup-07e6bd23256b
Best regards,
--
Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] usb: typec: ucsi: ucsi_glink: Prevent suspend during UCSI notification handling
2026-07-10 10:21 [PATCH] usb: typec: ucsi: ucsi_glink: Prevent suspend during UCSI notification handling Jishnu Prakash
@ 2026-07-10 17:14 ` kernel test robot
2026-07-10 19:17 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-07-10 17:14 UTC (permalink / raw)
To: Jishnu Prakash, Heikki Krogerus, Greg Kroah-Hartman
Cc: oe-kbuild-all, Dmitry Baryshkov, Konrad Dybcio,
Deepak Kumar Singh, Kamal Wadhwa, linux-usb, linux-kernel,
Jishnu Prakash
Hi Jishnu,
kernel test robot noticed the following build errors:
[auto build test ERROR on 2cb6eac064c8334418a76999468f68696a8dfe71]
url: https://github.com/intel-lab-lkp/linux/commits/Jishnu-Prakash/usb-typec-ucsi-ucsi_glink-Prevent-suspend-during-UCSI-notification-handling/20260710-182232
base: 2cb6eac064c8334418a76999468f68696a8dfe71
patch link: https://lore.kernel.org/r/20260710-ucsi_glink_wakeup-v1-1-7d97ea628d92%40oss.qualcomm.com
patch subject: [PATCH] usb: typec: ucsi: ucsi_glink: Prevent suspend during UCSI notification handling
config: nios2-allmodconfig (https://download.01.org/0day-ci/archive/20260711/202607110115.YSVz17MH-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260711/202607110115.YSVz17MH-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607110115.YSVz17MH-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/usb/typec/ucsi/ucsi_glink.c: In function 'pmic_glink_ucsi_callback':
>> drivers/usb/typec/ucsi/ucsi_glink.c:352:53: error: 'struct dev_pm_info' has no member named 'wakeup'; did you mean 'can_wakeup'?
352 | pm_wakeup_ws_event(ucsi->dev->power.wakeup,
| ^~~~~~
| can_wakeup
vim +352 drivers/usb/typec/ucsi/ucsi_glink.c
338
339 static void pmic_glink_ucsi_callback(const void *data, size_t len, void *priv)
340 {
341 struct pmic_glink_ucsi *ucsi = priv;
342 const struct pmic_glink_hdr *hdr = data;
343
344 switch (le32_to_cpu(hdr->opcode)) {
345 case UC_UCSI_READ_BUF_REQ:
346 pmic_glink_ucsi_read_ack(ucsi, data, len);
347 break;
348 case UC_UCSI_WRITE_BUF_REQ:
349 pmic_glink_ucsi_write_ack(ucsi, data, len);
350 break;
351 case UC_UCSI_USBC_NOTIFY_IND:
> 352 pm_wakeup_ws_event(ucsi->dev->power.wakeup,
353 UCSI_GLINK_WAKEUP_TIMEOUT_MS, true);
354 schedule_work(&ucsi->notify_work);
355 break;
356 }
357 }
358
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] usb: typec: ucsi: ucsi_glink: Prevent suspend during UCSI notification handling
2026-07-10 10:21 [PATCH] usb: typec: ucsi: ucsi_glink: Prevent suspend during UCSI notification handling Jishnu Prakash
2026-07-10 17:14 ` kernel test robot
@ 2026-07-10 19:17 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-07-10 19:17 UTC (permalink / raw)
To: Jishnu Prakash, Heikki Krogerus, Greg Kroah-Hartman
Cc: llvm, oe-kbuild-all, Dmitry Baryshkov, Konrad Dybcio,
Deepak Kumar Singh, Kamal Wadhwa, linux-usb, linux-kernel,
Jishnu Prakash
Hi Jishnu,
kernel test robot noticed the following build errors:
[auto build test ERROR on 2cb6eac064c8334418a76999468f68696a8dfe71]
url: https://github.com/intel-lab-lkp/linux/commits/Jishnu-Prakash/usb-typec-ucsi-ucsi_glink-Prevent-suspend-during-UCSI-notification-handling/20260710-182232
base: 2cb6eac064c8334418a76999468f68696a8dfe71
patch link: https://lore.kernel.org/r/20260710-ucsi_glink_wakeup-v1-1-7d97ea628d92%40oss.qualcomm.com
patch subject: [PATCH] usb: typec: ucsi: ucsi_glink: Prevent suspend during UCSI notification handling
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20260711/202607110241.diOWToQ0-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project b3e6e6dabdc02153552a64fc74ff5c7532447eed)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260711/202607110241.diOWToQ0-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607110241.diOWToQ0-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/usb/typec/ucsi/ucsi_glink.c:352:39: error: no member named 'wakeup' in 'struct dev_pm_info'
352 | pm_wakeup_ws_event(ucsi->dev->power.wakeup,
| ~~~~~~~~~~~~~~~~ ^
1 error generated.
vim +352 drivers/usb/typec/ucsi/ucsi_glink.c
338
339 static void pmic_glink_ucsi_callback(const void *data, size_t len, void *priv)
340 {
341 struct pmic_glink_ucsi *ucsi = priv;
342 const struct pmic_glink_hdr *hdr = data;
343
344 switch (le32_to_cpu(hdr->opcode)) {
345 case UC_UCSI_READ_BUF_REQ:
346 pmic_glink_ucsi_read_ack(ucsi, data, len);
347 break;
348 case UC_UCSI_WRITE_BUF_REQ:
349 pmic_glink_ucsi_write_ack(ucsi, data, len);
350 break;
351 case UC_UCSI_USBC_NOTIFY_IND:
> 352 pm_wakeup_ws_event(ucsi->dev->power.wakeup,
353 UCSI_GLINK_WAKEUP_TIMEOUT_MS, true);
354 schedule_work(&ucsi->notify_work);
355 break;
356 }
357 }
358
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-10 19:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 10:21 [PATCH] usb: typec: ucsi: ucsi_glink: Prevent suspend during UCSI notification handling Jishnu Prakash
2026-07-10 17:14 ` kernel test robot
2026-07-10 19:17 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox