From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795959895; b=RF1oKMTQd8iIjXiKr+xxIEFsikcmPSJDRSSQOwVsVGK1GbiHIIkppcVhA03jya7m6I7U mBDGYVgSkHDcz1s1dLocQ/ws1T6SDAuP7a+XPOM89pmJzDtXLM7x1/+9krq+mrpdqtC45 JxQOufUEWHpwNFnwQrHv6+g0yvqw/x4o+k9mTl4qVHuoX76keT46aK7e1zomBwYLvxpo3 NDJRnr9nTe2W/MTAwCa1geuB90xqWE7jCTh/8O0XMXD4XdiiGc1FkzwlfmBZTEf7EyNM1 XWOYJk+ByecJLOewwRi/+2YwbitoNlImMmXrvTEqXbzPlmRzY7vBo0nhVHFWcrTpbug== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795959895; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=k/k+SiSJzo4/SsF4Z47KNLRA4d36TMrrnlpsk23diVQ=; b=xrmjC3UpOevrKGkyT9RVNztmj65LCFqF+jlRqR7ULkgtd2mpmo0CC3tBgBaDlkGiGqqS UjGQ91YiQBuFAPe/IKoK5RwFqOXnbt/ueLsFS80clAmp12/KhPXt3MaWT9bzjr64ksziN hQvSLiJZvJjvVAJX8uZCdrQRDYNfoVywy69D7Dn2HzxzEoDCS/o9hT2Zw5YcRx8hy/mEJ IrtjL7IeMkc+6PgZUi9FKy0vDYYPYrymi2EKCREfsv/bHrpY9+P5V6s6FPAvXWc1UtRz2 4xwl0Cdt9IB7MnNmK4uPpyW3XC7fB34SHnGEcDWfCMGkgCMgDJ4nqtOVpU2HOO+CO1A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="DVBC/7Qx"; arc=none smtp.remote-ip=209.85.128.50 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88A7D606A32F for ; Sun, 29 Nov 2026 13:44:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 88A7D606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=DVBC/7Qx Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4a207b02a2cso67887375e9.1 for ; Sun, 29 Nov 2026 05:44:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795959894; x=1796564694; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=k/k+SiSJzo4/SsF4Z47KNLRA4d36TMrrnlpsk23diVQ=; b=DVBC/7QxQkK/i4h6Q13ncA6VUfcQnjOOjEp7IfLc7MeAlNhB7kZ3nEDP+QZKRRBvv9 MllK2vIlU5wdynZFgQbVkZ6qWA2TIsDcCi17dYrSHDYxMguIdo5d1lWx+HcX5skZrg4l BxJ8O0x18kxpQ5uCTLg70A72LC1knMom9bvyW4YW8sl6PTo5JMaFfHOHA3X9a7klZUX9 xp/6ASLNpy0oYSKc8hRmTPvRJhmmbk2jJxykAVfPltwm9wY1quJVW5JK95ZDgsqejnqV OKXJ3GxJFQBxvC5pNE9iWGa9rlssJeFInblXgOA7FcrGiyMPFt0YDW6Y+bDzfD6hUuoB Rclg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795959894; x=1796564694; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=k/k+SiSJzo4/SsF4Z47KNLRA4d36TMrrnlpsk23diVQ=; b=dPNtKJ8vmZ4pV+GbORSDJpIpLvAbu//qiExyRuAAQ00yC6AH26R86bXKAjU1Fkc4tn bQC/eTCp7dYU2wu4niwJb0HfGXcP2jFRf38MDLm/JYEWNhY4iAvRx5NTrJm0QiqgSMjI vC2t+6BTpcrBwjmt+SV96wbFWXVIw/Z8Lb4M9eP3iwnDpX1Wv6HmJTnIqXh+tUWixH4t DGYuMgsNJj6KjuCYjBMjYNRfJNmcO9+VO9o64JEjKHjzaISYUNWO4a/26+/emZAE16Lt 9axxSDnr/Pp+f3M8WYKJja9siZ9TCLAPNEFKdLWq3wNHJmia0emIACWMDnt3yIZhoiNx 29Cw== X-Forwarded-Encrypted: i=1; AL+hErEt4Y5dk06AqdaAYCJZOuFehhfJZ1QwXwFWvdAgkrVQp6ykK+hT+dxCd+87za/G3CvBMh9X1L1FVA==@vger.kernel.org X-Gm-Message-State: APuU4Z8gPg9/6AvAuhfWETElzorNl81MOEeF+exAgosh44s2h9MKhNSX C2PcNUd1lzaNqWWTT9cYLtqqnD4hGIkng+bUUM31G7GpZF/aClKi7tAj X-Gm-Gg: AZFdTZeHP/Jid1ep226GnlTx0kBVU+JuG+lm4H3sxOOVr/vmsF0lgaiHMc9TQAqVNkn yJ2wynxBIFKVHNMtdrtg560TWnlStxf93Osr1RXV02mb1mZ5RdNXo6vm+ZzRposLUAdbB84kBLP cr1N/V248h7FAcCVMOyY+ImX1HJcvJLg7mn+nfC71aHgzrV6iOTYzJvxHKF9x3iyHm7zv+IA9Kd dQfmlD97KmT2KXOQbvFMUSnPamGujTOq+nXv7w91RQN5iIPwBhFdkoxAm/eBklpfUyKlpVUBV7s BuiMaMfd7WgV+jEqjxf2oScKkZ9wLWU4cmawYXUqU2kBUdh5TRzGAxs9+/B4/PpSQtVmJgZe9e7 SBnSaCLk+P337ZxaiTPs4UHPxy9miWQ9zvEhB/35Zp0tMz1dcuxaRXUCuAmffXYDwxQlLJk3haI VOX2Ak2VfHMxSkDLs0R/cfuzJ9DNE18acubHIYQBlqGtQywtWKOBVXT2hpK9ssV1psNC91tFUMl BRYj5Oj7/0Nkrzu1tGe6vL1x0pp++KhS1epNRLsdM3qyIsCu03wvCbg00jpaz7BqNgTu0sNiLPN to6qSYQQKjOZoapBd/Js+STi+gY+V9I7LeOWaiIbe0dE2L0Jp/EvmUiAndAw/JaxgMy1fZNjGA+ f X-Received: by 2002:a05:600c:4f0d:b0:4bb:5c97:f4b1 with SMTP id 5b1f17b1804b1-4bb8881941bmr665202505e9.24.1795959893666; Sun, 29 Nov 2026 05:44:53 -0800 (PST) Received: from localhost.localdomain ([188.190.249.216]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb853a1e8bsm700139325e9.9.2026.11.29.05.44.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 05:44:53 -0800 (PST) From: Vladyslav Tymoshchuk To: Bjorn Andersson , Konrad Dybcio , Sebastian Reichel , Heikki Krogerus , Greg Kroah-Hartman Cc: Neil Armstrong , Abel Vesa , Jishnu Prakash , Joonhoe Kim <26rote@gmail.com>, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/5] soc: qcom: pmic_glink: Deliver notifications from a freezable workqueue Date: Sun, 29 Nov 2026 15:44:36 +0200 Message-ID: <20261129134442.579-1-tvlad744@gmail.com> X-Mailer: git-send-email 2.45.1.windows.1 X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The GLINK interrupt is not suspended, so PMIC GLINK clients get notifications while devices are suspended, and the work they schedule can use those devices. This was hit on X Elite with a PS8830 retimer [1], on SM8850 with an FSA4480 switch [2] and on SM8750, where dwc3-qcom accesses registers with the clocks off and the SoC resets [3]. Commit c7c56b6ec077 ("soc: qcom: pmic_glink: Fix device access from worker during suspend") fixed the altmode client as a stop-gap, and left the queueing and filtering of the notifications in pmic_glink for later. - Patch 1 makes ucsi_glink notice a restart of the remote that happened before its work ran; with patch 2, DOWN and UP can arrive back to back. - Patch 2 passes the notifications and the changes of the service state on from system_freezable_wq, which is frozen while devices are suspended. RFC v1 queued them from ->prepare() to ->complete(). - Patch 3 reports wakeup events, for the clients whose device may wake up the system. - Patch 4 enables wakeup for ucsi_glink, as proposed in [4]. - Patch 5 makes qcom_battmgr wakeup capable for charger changes, with wakeup disabled by default. Patches 4 and 5 depend on patch 3, so the series would best go through the Qualcomm SoC tree. It is based on next-20261127. Not covered: pmic_glink does not wait for the work that a client queues for a notification, so work queued right before a suspend can still overlap the suspend of devices. Two observations of Joonhoe Kim on RFC v1 are not addressed, as they are the same without the series: a DisplayPort plug wakes up the system only after 26 s, and the DP controller resumes before the held back altmode notification reaches it. The PMIC GIO [5] and RTC [6] series also touch pmic_glink.c. With this series, notifications for their clients are held back as well. Tested on the OnePlus Pad 3 (SM8750), with the patches ported to a 7.3-rc5 based tree, debug prints added and the dwc3 fix [3] left out, pulling or plugging the cable while in s2idle: - with the series: unplug 6 times, plug 4 times, no reset. No notification was passed on before the tasks were restarted. One of the unplugs was done with the UCSI wakeup disabled, and did not wake up the system. - without it: unplug 3 times, plug 2 times, reset every time. No reset in 3 sleeps with the cable left alone. A restart of the remote was only simulated, by queueing DOWN and UP back to back while awake: ucsi_glink registered anew 15 times out of 15, and missed 4 of 5 without patch 1. A real one could not be tested, stopping the ADSP resets the SoC in this setup, without the series as well. Joonhoe, I dropped your Tested-by, as the queueing is new. Could you check this version? Changes since RFC v1: - Drop RFC, shorten the descriptions (Sebastian) - Always deliver from system_freezable_wq, with the service state in the same queue, instead of switching the queueing on and off from the pm callbacks, which also covers the Sashiko findings on that patch - New patch 1, for ucsi_glink - Drop the Tested-by of Joonhoe Kim, as the queueing changed - Report wakeup events through a wakeup source of pmic_glink, kept active until the queue has been passed on (Sashiko) - qcom_battmgr: only for the SM8350 and SM8550 firmware (Sashiko) - Rebase on the qcom_battmgr use-after-free fix - Link to RFC v1: https://lore.kernel.org/all/20261022164151.592-1-tvlad744@gmail.com/ An AI assistant (Claude) helped with the analysis, the patches and the descriptions. [1] https://lore.kernel.org/all/20250205-ucsi-schedule-conn-worker-on-freezable-wq-v1-1-107d1356b77b@linaro.org/ [2] https://lore.kernel.org/all/20261020132432.998-1-26rote@gmail.com/ [3] https://lore.kernel.org/all/20261111090122.134-1-tvlad744@gmail.com/ [4] https://lore.kernel.org/all/20260722-ucsi_glink_wakeup-v2-1-b43dee56df24@oss.qualcomm.com/ [5] https://lore.kernel.org/all/20261118-gio-framework-rtc-driver-2026-10-12-v3-0-52d78a8f43ee@oss.qualcomm.com/ [6] https://lore.kernel.org/all/20261103-rtc-glink-cleanup-v2-0-895eb6e8d890@qti.qualcomm.com/ Vladyslav Tymoshchuk (5): usb: typec: ucsi: glink: Handle a restart of the remote before the work runs soc: qcom: pmic_glink: Deliver notifications from a freezable workqueue soc: qcom: pmic_glink: Report wakeup events on behalf of clients usb: typec: ucsi: glink: Wake up the system on connector changes power: supply: qcom_battmgr: Allow charger changes to wake up the system drivers/power/supply/qcom_battmgr.c | 22 +++ drivers/soc/qcom/pmic_glink.c | 272 +++++++++++++++++++++++++--- drivers/usb/typec/ucsi/ucsi_glink.c | 21 ++- include/linux/soc/qcom/pmic_glink.h | 2 + 4 files changed, 290 insertions(+), 27 deletions(-) base-commit: e5aad2bdbbee783611d32599f89cea3f12f9593d