FAILED: patch "[PATCH] usb: typec: ucsi: use UCSI_TIMEOUT_MS for sync command" failed to apply to 6.1-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x eb4573cf2fd860b20adfae050c3f6ec6ddc3abdb
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090308-nutmeg-underpaid-017e@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From eb4573cf2fd860b20adfae050c3f6ec6ddc3abdb Mon Sep 17 00:00:00 2001
From: Huang Wei <[email protected]>
Date: Wed, 5 Aug 2026 16:57:25 +0800
Subject: [PATCH] usb: typec: ucsi: use UCSI_TIMEOUT_MS for sync command
completion
The synchronous command completion path in ucsi_sync_control_common() hardcodes a 5 second (5 * HZ) timeout when waiting for the PPM to signal command completion via ACPI notification. This value matched UCSI_TIMEOUT_MS when it was still 5000 ms, but it was not updated when that macro was later raised to 10000 ms to fix PPM reset timeouts.
As a result, the two PPM communication paths are now inconsistent: the polling path in ucsi_reset_ppm() respects the 10 second timeout, while the event-driven completion path still uses 5 seconds. On machines where the firmware is slow to respond during boot (e.g. some Lenovo ThinkPad models such as the E14 Gen 7), commands sent after the PPM reset, such as SET_NOTIFICATION_ENABLE and GET_CAPABILITY, can exceed 5 seconds and cause UCSI initialization to fail with:
ucsi_acpi USBC000:00: error -ETIMEDOUT: PPM init failed
Once UCSI init aborts, USB-C PD negotiation never completes, which in turn blocks USB-C dock enumeration since the dock depends on a successful PD contract.
Replace the hardcoded 5 * HZ with msecs_to_jiffies(UCSI_TIMEOUT_MS) so that both communication paths share a single, consistent timeout value, and future adjustments to UCSI_TIMEOUT_MS are picked up automatically.
drivers/usb/typec/ucsi/ucsi.c +2 -1
@@ -91,7 +91,8 @@ int ucsi_sync_control_common(struct ucsi *ucsi, u64 command, u32 *cci,if (ret) goto out_clear_bit; -if (!wait_for_completion_timeout (&ucsi->complete,5 *HZ )) +if (!wait_for_completion_timeout (&ucsi->complete, +msecs_to_jiffies (UCSI_TIMEOUT_MS ))) ret = -ETIMEDOUT ; out_clear_bit:
Sasha Levin
maintainerPATCH 1/3 usb: typec: ucsi: move ucsi_acknowledge() from ucsi_read_error()
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit a7d2fa776976294d39d4cf36b25ca43be8325c3f ]
As a preparation for reworking UCSI command handling, move ucsi_acknowledge() for the failed command from ucsi_read_error() to ucsi_exec_command().
Stable-dep-of: eb4573cf2fd8 ("usb: typec: ucsi: use UCSI_TIMEOUT_MS for sync command completion")
--- drivers/usb/typec/ucsi/ucsi.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/usb/typec/ucsi/ucsi.c +6 -10
@@ -57,11 +57,6 @@ static int ucsi_read_error(struct ucsi *ucsi)u16 error;int ret; -/* Acknowledge the command that failed */ - ret =ucsi_acknowledge (ucsi, false); -if (ret) -return ret; - ret =ucsi_exec_command (ucsi,UCSI_GET_ERROR_STATUS );if (ret <0 )return ret;
@@ -140,13 +135,14 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd) }if (cci &UCSI_CCI_ERROR ) { -if (cmd ==UCSI_GET_ERROR_STATUS ) { - ret =ucsi_acknowledge (ucsi, false); -if (ret) -return ret; +/* Acknowledge the command that failed */ + ret =ucsi_acknowledge (ucsi, false); +if (ret) +return ret; +if (cmd ==UCSI_GET_ERROR_STATUS )return -EIO ; - } +return ucsi_read_error (ucsi); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/3 usb: typec: ucsi: split read operation
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 467399d989d799433ec7dd8da2ebbfbc70207d03 ]
The read operation is only used to read fixed data at fixed offsets (UCSI_VERSION, UCSI_CCI, UCSI_MESSAGE_IN). In some cases drivers apply offset-specific overrides. Split the read() operation into three operations, read_version(), read_cci(), read_message_in().
The read split depends on newer UCSI callbacks that are not present in this stable tree and is not needed by the dependent timeout fix. For the stable backport, instead move the existing ACPI synchronous command handling into the UCSI core while retaining the old callback interface. This places the hard-coded completion timeout where the dependent fix expects it without adding the unrelated read-operation wrappers.
[ sashal: Reduced backport -- upstream 467399d989d79 touches 7 file(s), this
backport carries 3. Not backported here:
drivers/usb/typec/ucsi/ucsi_ccg.c drivers/usb/typec/ucsi/ucsi_glink.c drivers/usb/typec/ucsi/ucsi_stm32g0.c drivers/usb/typec/ucsi/ucsi_yoga_c630.c
This note is generated from the file lists only; see the resolution record for the reasoning. ]
Stable-dep-of: eb4573cf2fd8 ("usb: typec: ucsi: use UCSI_TIMEOUT_MS for sync command completion")
--- drivers/usb/typec/ucsi/ucsi.c | 29 +++++++++++++++++ drivers/usb/typec/ucsi/ucsi.h | 3 ++ drivers/usb/typec/ucsi/ucsi_acpi.c | 51 ++++++------------------------ 3 files changed, 42 insertions(+), 41 deletions(-)
drivers/usb/typec/ucsi/ucsi.c +29 -0
@@ -36,6 +36,34 @@*/ #define UCSI_SWAP_TIMEOUT_MS 5000 +int ucsi_sync_control_common (struct ucsi *ucsi,unsigned int offset, +const void *val,size_t val_len) +{ +bool ack =UCSI_COMMAND (*(u64 *)val) ==UCSI_ACK_CC_CI ; +int ret; + +if (ack) +set_bit (ACK_PENDING , &ucsi->flags); +else +set_bit (COMMAND_PENDING , &ucsi->flags); + + ret = ucsi->ops->async_write (ucsi, offset, val, val_len); +if (ret) + goto out_clear_bit; + +if (!wait_for_completion_timeout (&ucsi->complete,5 *HZ )) + ret = -ETIMEDOUT ; + +out_clear_bit: +if (ack) +clear_bit (ACK_PENDING , &ucsi->flags); +else +clear_bit (COMMAND_PENDING , &ucsi->flags); + +return ret; +} +EXPORT_SYMBOL_GPL (ucsi_sync_control_common); +static int ucsi_acknowledge (struct ucsi *ucsi,bool conn_ack) {u64 ctrl;
@@ -1541,6 +1569,7 @@ struct ucsi *ucsi_create(struct device *dev, const struct ucsi_operations *ops)INIT_WORK (&ucsi->resume_work, ucsi_resume_work);INIT_DELAYED_WORK (&ucsi->work, ucsi_init_work);mutex_init (&ucsi->ppm_lock); +init_completion (&ucsi->complete); ucsi->dev = dev; ucsi->ops = ops;
drivers/usb/typec/ucsi/ucsi.h +3 -0
@@ -67,6 +67,8 @@ bool ucsi_con_mutex_lock(struct ucsi_connector *con);void ucsi_con_mutex_unlock (struct ucsi_connector *con);void ucsi_connector_change (struct ucsi *ucsi,u8 num); +int ucsi_sync_control_common (struct ucsi *ucsi,unsigned int offset, +const void *val,size_t val_len);/* -------------------------------------------------------------------------- */
@@ -308,6 +310,7 @@ struct ucsi {#define EVENT_PENDING 0#define COMMAND_PENDING 1#define ACK_PENDING 2 +struct completion complete; };#define UCSI_MAX_SVID 5
drivers/usb/typec/ucsi/ucsi_acpi.c +10 -41
98 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/3 usb: typec: ucsi: use UCSI_TIMEOUT_MS for sync command completion
In reply to Sasha LevinFrom: Huang Wei <[email protected]>
[ Upstream commit eb4573cf2fd860b20adfae050c3f6ec6ddc3abdb ]
The synchronous command completion path in ucsi_sync_control_common() hardcodes a 5 second (5 * HZ) timeout when waiting for the PPM to signal command completion via ACPI notification. This value matched UCSI_TIMEOUT_MS when it was still 5000 ms, but it was not updated when that macro was later raised to 10000 ms to fix PPM reset timeouts.
As a result, the two PPM communication paths are now inconsistent: the polling path in ucsi_reset_ppm() respects the 10 second timeout, while the event-driven completion path still uses 5 seconds. On machines where the firmware is slow to respond during boot (e.g. some Lenovo ThinkPad models such as the E14 Gen 7), commands sent after the PPM reset, such as SET_NOTIFICATION_ENABLE and GET_CAPABILITY, can exceed 5 seconds and cause UCSI initialization to fail with:
ucsi_acpi USBC000:00: error -ETIMEDOUT: PPM init failed
Once UCSI init aborts, USB-C PD negotiation never completes, which in turn blocks USB-C dock enumeration since the dock depends on a successful PD contract.
Replace the hardcoded 5 * HZ with msecs_to_jiffies(UCSI_TIMEOUT_MS) so that both communication paths share a single, consistent timeout value, and future adjustments to UCSI_TIMEOUT_MS are picked up automatically.
--- drivers/usb/typec/ucsi/ucsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi.c +2 -1
@@ -51,7 +51,8 @@ int ucsi_sync_control_common(struct ucsi *ucsi, unsigned int offset,if (ret) goto out_clear_bit; -if (!wait_for_completion_timeout (&ucsi->complete,5 *HZ )) +if (!wait_for_completion_timeout (&ucsi->complete, +msecs_to_jiffies (UCSI_TIMEOUT_MS ))) ret = -ETIMEDOUT ; out_clear_bit:
Signature · 1 line
2.53.0