Linux USB
 help / color / mirror / Atom feed
* ucsi_acpi: intermittent "PPM init failed" at boot is never retried, Type-C event handling stays dead for the session
@ 2026-07-25 21:31 Jacob Riff
  2026-08-05 12:11 ` Heikki Krogerus
  0 siblings, 1 reply; 5+ messages in thread
From: Jacob Riff @ 2026-07-25 21:31 UTC (permalink / raw)
  To: linux-usb; +Cc: heikki.krogerus

Hi,

On a Lenovo ThinkPad X1 Carbon Gen 14 (21V7CTO1WW, Panther Lake), UCSI
initialization intermittently fails at boot, and because the failure is
never retried, no typec ports are registered for the rest of the
session. Most visible consequence: after unplugging and replugging the
USB-C charger (a PD monitor), the machine silently never resumes
charging. Notably, DisplayPort alt mode on the same port continues to
work across replugs in this state, and charging does work if the
charger was already attached at boot (EC autonomous) - it is
specifically resumption of charging after a replug that is lost, which
makes the failure easy to miss until the battery is unexpectedly
drained.

Failure rate: 5 of 8 boots on one day of testing. Reproduced on two
firmware versions including the latest (BIOS N4OET49W/1.12 and
N4OET51W/1.14, EC 1.09 and 1.10). No clear correlation with whether
anything is attached at boot: two boots one minute apart with the same
setup split ok/fail.

Kernel: 7.1.4 (Arch Linux, unpatched in this area)

Two failure flavors seen:

  ucsi_acpi USBC000:00: error -ENODEV: PPM init failed

and:

  ucsi_acpi USBC000:00: possible UCSI driver bug 2
  ucsi_acpi USBC000:00: error -EINVAL: PPM init failed

Both appear ~1s after the typec ports bind. On failed boots
/sys/class/typec/ stays empty.

The part that suggests a driver-side improvement: recovery is trivial.
Reloading the module seconds later has succeeded on every attempt so
far (double digits by now):

  modprobe -r ucsi_acpi && sleep 2 && modprobe ucsi_acpi

after which connectors register and charging renegotiates immediately,
no replug needed.

ucsi_init_work() currently only requeues the init work for
-EPROBE_DEFER (up to UCSI_ROLE_SWITCH_WAIT_COUNT). Given that an
immediate retry reliably succeeds here, would it be reasonable to also
retry a few times on other errors (-ENODEV/-EINVAL) before giving up?
The PPM on these machines appears to simply not be ready to answer
during a window around when init runs.

Possibly related prior reports of Lenovo PPMs being slow/unready at
init: the "usb: typec: ucsi: increase timeout for PPM reset operations"
RFC (Feb 2025) and Ubuntu bug #2054928 (ThinkPad E490, -ENODEV).

Happy to test patches on this hardware.

Thanks,
Jacob Riff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ucsi_acpi: intermittent "PPM init failed" at boot is never retried, Type-C event handling stays dead for the session
  2026-07-25 21:31 ucsi_acpi: intermittent "PPM init failed" at boot is never retried, Type-C event handling stays dead for the session Jacob Riff
@ 2026-08-05 12:11 ` Heikki Krogerus
  2026-08-05 12:46   ` Heikki Krogerus
  0 siblings, 1 reply; 5+ messages in thread
From: Heikki Krogerus @ 2026-08-05 12:11 UTC (permalink / raw)
  To: Jacob Riff; +Cc: linux-usb

On Sat, Jul 25, 2026 at 02:31:53PM -0700, Jacob Riff wrote:
> Hi,
> 
> On a Lenovo ThinkPad X1 Carbon Gen 14 (21V7CTO1WW, Panther Lake), UCSI
> initialization intermittently fails at boot, and because the failure is
> never retried, no typec ports are registered for the rest of the
> session. Most visible consequence: after unplugging and replugging the
> USB-C charger (a PD monitor), the machine silently never resumes
> charging. Notably, DisplayPort alt mode on the same port continues to
> work across replugs in this state, and charging does work if the
> charger was already attached at boot (EC autonomous) - it is
> specifically resumption of charging after a replug that is lost, which
> makes the failure easy to miss until the battery is unexpectedly
> drained.
> 
> Failure rate: 5 of 8 boots on one day of testing. Reproduced on two
> firmware versions including the latest (BIOS N4OET49W/1.12 and
> N4OET51W/1.14, EC 1.09 and 1.10). No clear correlation with whether
> anything is attached at boot: two boots one minute apart with the same
> setup split ok/fail.
> 
> Kernel: 7.1.4 (Arch Linux, unpatched in this area)
> 
> Two failure flavors seen:
> 
>   ucsi_acpi USBC000:00: error -ENODEV: PPM init failed
> 
> and:
> 
>   ucsi_acpi USBC000:00: possible UCSI driver bug 2
>   ucsi_acpi USBC000:00: error -EINVAL: PPM init failed
> 
> Both appear ~1s after the typec ports bind. On failed boots
> /sys/class/typec/ stays empty.
> 
> The part that suggests a driver-side improvement: recovery is trivial.
> Reloading the module seconds later has succeeded on every attempt so
> far (double digits by now):
> 
>   modprobe -r ucsi_acpi && sleep 2 && modprobe ucsi_acpi
> 
> after which connectors register and charging renegotiates immediately,
> no replug needed.
> 
> ucsi_init_work() currently only requeues the init work for
> -EPROBE_DEFER (up to UCSI_ROLE_SWITCH_WAIT_COUNT). Given that an
> immediate retry reliably succeeds here, would it be reasonable to also
> retry a few times on other errors (-ENODEV/-EINVAL) before giving up?
> The PPM on these machines appears to simply not be ready to answer
> during a window around when init runs.
> 
> Possibly related prior reports of Lenovo PPMs being slow/unready at
> init: the "usb: typec: ucsi: increase timeout for PPM reset operations"
> RFC (Feb 2025) and Ubuntu bug #2054928 (ThinkPad E490, -ENODEV).
> 
> Happy to test patches on this hardware.

I'm sorry to keep you waiting. I'm just letting you know that this
issue is in my queue, but right now I don't have time. I will try
to take a closer look at this later this month.

Thanks,

-- 
heikki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ucsi_acpi: intermittent "PPM init failed" at boot is never retried, Type-C event handling stays dead for the session
  2026-08-05 12:11 ` Heikki Krogerus
@ 2026-08-05 12:46   ` Heikki Krogerus
  2026-08-06  2:18     ` Jacob Riff
  0 siblings, 1 reply; 5+ messages in thread
From: Heikki Krogerus @ 2026-08-05 12:46 UTC (permalink / raw)
  To: Jacob Riff; +Cc: linux-usb

On Wed, Aug 05, 2026 at 02:11:43PM +0200, Heikki Krogerus wrote:
> On Sat, Jul 25, 2026 at 02:31:53PM -0700, Jacob Riff wrote:
> > Hi,
> > 
> > On a Lenovo ThinkPad X1 Carbon Gen 14 (21V7CTO1WW, Panther Lake), UCSI
> > initialization intermittently fails at boot, and because the failure is
> > never retried, no typec ports are registered for the rest of the
> > session. Most visible consequence: after unplugging and replugging the
> > USB-C charger (a PD monitor), the machine silently never resumes
> > charging. Notably, DisplayPort alt mode on the same port continues to
> > work across replugs in this state, and charging does work if the
> > charger was already attached at boot (EC autonomous) - it is
> > specifically resumption of charging after a replug that is lost, which
> > makes the failure easy to miss until the battery is unexpectedly
> > drained.
> > 
> > Failure rate: 5 of 8 boots on one day of testing. Reproduced on two
> > firmware versions including the latest (BIOS N4OET49W/1.12 and
> > N4OET51W/1.14, EC 1.09 and 1.10). No clear correlation with whether
> > anything is attached at boot: two boots one minute apart with the same
> > setup split ok/fail.
> > 
> > Kernel: 7.1.4 (Arch Linux, unpatched in this area)
> > 
> > Two failure flavors seen:
> > 
> >   ucsi_acpi USBC000:00: error -ENODEV: PPM init failed
> > 
> > and:
> > 
> >   ucsi_acpi USBC000:00: possible UCSI driver bug 2
> >   ucsi_acpi USBC000:00: error -EINVAL: PPM init failed
> > 
> > Both appear ~1s after the typec ports bind. On failed boots
> > /sys/class/typec/ stays empty.
> > 
> > The part that suggests a driver-side improvement: recovery is trivial.
> > Reloading the module seconds later has succeeded on every attempt so
> > far (double digits by now):
> > 
> >   modprobe -r ucsi_acpi && sleep 2 && modprobe ucsi_acpi
> > 
> > after which connectors register and charging renegotiates immediately,
> > no replug needed.
> > 
> > ucsi_init_work() currently only requeues the init work for
> > -EPROBE_DEFER (up to UCSI_ROLE_SWITCH_WAIT_COUNT). Given that an
> > immediate retry reliably succeeds here, would it be reasonable to also
> > retry a few times on other errors (-ENODEV/-EINVAL) before giving up?
> > The PPM on these machines appears to simply not be ready to answer
> > during a window around when init runs.
> > 
> > Possibly related prior reports of Lenovo PPMs being slow/unready at
> > init: the "usb: typec: ucsi: increase timeout for PPM reset operations"
> > RFC (Feb 2025) and Ubuntu bug #2054928 (ThinkPad E490, -ENODEV).
> > 
> > Happy to test patches on this hardware.
> 
> I'm sorry to keep you waiting. I'm just letting you know that this
> issue is in my queue, but right now I don't have time. I will try
> to take a closer look at this later this month.

Can you check does this improve the situation:
https://lore.kernel.org/linux-usb/20260805085725.389761-1-huangwei@kylinos.cn/

Thanks,

-- 
heikki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ucsi_acpi: intermittent "PPM init failed" at boot is never retried, Type-C event handling stays dead for the session
  2026-08-05 12:46   ` Heikki Krogerus
@ 2026-08-06  2:18     ` Jacob Riff
  2026-08-15  0:57       ` [RFC PATCH] usb: typec: ucsi: retry init when the PPM answers early commands incorrectly Jacob Riff
  0 siblings, 1 reply; 5+ messages in thread
From: Jacob Riff @ 2026-08-06  2:18 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: linux-usb

Hi Heikki,

I tested Huang Wei's patch on the affected machine (applied to 7.1.4's
ucsi.c, confirmed active via srcversion): no improvement.

8 boots with the patch: 4x "PPM init failed", 4 ok. That is the same
~50-60% failure rate as the unpatched baseline (5 of 8).

That matches what the error flavors suggest: this doesn't look like a
slow PPM. The -ENODEV case is GET_CAPABILITY completing but reporting
zero connectors, and the -EINVAL case comes with "possible UCSI driver
bug 2", i.e. the PPM rejecting a standard command. These are prompt
wrong answers rather than missing ones, so a longer completion wait
doesn't change the outcome.

One additional data point from this round: all 8 test boots had
nothing attached to any Type-C port, and the failure rate was
unchanged. So it doesn't appear related to PD contract negotiation
racing the handshake either. The PPM simply seems not ready to answer
correctly for a window during boot.

Which still leaves the observation from my original mail: reloading
ucsi_acpi a couple of seconds later has succeeded on every attempt
(well into double digits now), and the machine then behaves fully
normally. Would retrying ucsi_init() a few times on -ENODEV/-EINVAL,
similar to the existing -EPROBE_DEFER requeue, be an acceptable
direction? Happy to test such a patch on this hardware.

- Jacob Riff
Mobile: 760-840-6060

On Wed, Aug 5, 2026 at 5:46 AM Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
>
> On Wed, Aug 05, 2026 at 02:11:43PM +0200, Heikki Krogerus wrote:
> > On Sat, Jul 25, 2026 at 02:31:53PM -0700, Jacob Riff wrote:
> > > Hi,
> > >
> > > On a Lenovo ThinkPad X1 Carbon Gen 14 (21V7CTO1WW, Panther Lake), UCSI
> > > initialization intermittently fails at boot, and because the failure is
> > > never retried, no typec ports are registered for the rest of the
> > > session. Most visible consequence: after unplugging and replugging the
> > > USB-C charger (a PD monitor), the machine silently never resumes
> > > charging. Notably, DisplayPort alt mode on the same port continues to
> > > work across replugs in this state, and charging does work if the
> > > charger was already attached at boot (EC autonomous) - it is
> > > specifically resumption of charging after a replug that is lost, which
> > > makes the failure easy to miss until the battery is unexpectedly
> > > drained.
> > >
> > > Failure rate: 5 of 8 boots on one day of testing. Reproduced on two
> > > firmware versions including the latest (BIOS N4OET49W/1.12 and
> > > N4OET51W/1.14, EC 1.09 and 1.10). No clear correlation with whether
> > > anything is attached at boot: two boots one minute apart with the same
> > > setup split ok/fail.
> > >
> > > Kernel: 7.1.4 (Arch Linux, unpatched in this area)
> > >
> > > Two failure flavors seen:
> > >
> > >   ucsi_acpi USBC000:00: error -ENODEV: PPM init failed
> > >
> > > and:
> > >
> > >   ucsi_acpi USBC000:00: possible UCSI driver bug 2
> > >   ucsi_acpi USBC000:00: error -EINVAL: PPM init failed
> > >
> > > Both appear ~1s after the typec ports bind. On failed boots
> > > /sys/class/typec/ stays empty.
> > >
> > > The part that suggests a driver-side improvement: recovery is trivial.
> > > Reloading the module seconds later has succeeded on every attempt so
> > > far (double digits by now):
> > >
> > >   modprobe -r ucsi_acpi && sleep 2 && modprobe ucsi_acpi
> > >
> > > after which connectors register and charging renegotiates immediately,
> > > no replug needed.
> > >
> > > ucsi_init_work() currently only requeues the init work for
> > > -EPROBE_DEFER (up to UCSI_ROLE_SWITCH_WAIT_COUNT). Given that an
> > > immediate retry reliably succeeds here, would it be reasonable to also
> > > retry a few times on other errors (-ENODEV/-EINVAL) before giving up?
> > > The PPM on these machines appears to simply not be ready to answer
> > > during a window around when init runs.
> > >
> > > Possibly related prior reports of Lenovo PPMs being slow/unready at
> > > init: the "usb: typec: ucsi: increase timeout for PPM reset operations"
> > > RFC (Feb 2025) and Ubuntu bug #2054928 (ThinkPad E490, -ENODEV).
> > >
> > > Happy to test patches on this hardware.
> >
> > I'm sorry to keep you waiting. I'm just letting you know that this
> > issue is in my queue, but right now I don't have time. I will try
> > to take a closer look at this later this month.
>
> Can you check does this improve the situation:
> https://lore.kernel.org/linux-usb/20260805085725.389761-1-huangwei@kylinos.cn/
>
> Thanks,
>
> --
> heikki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [RFC PATCH] usb: typec: ucsi: retry init when the PPM answers early commands incorrectly
  2026-08-06  2:18     ` Jacob Riff
@ 2026-08-15  0:57       ` Jacob Riff
  0 siblings, 0 replies; 5+ messages in thread
From: Jacob Riff @ 2026-08-15  0:57 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: linux-usb, Greg Kroah-Hartman, Huang Wei, Jacob Riff

On some platforms the PPM is not ready to answer commands correctly
for a short window during boot. On the Lenovo ThinkPad X1 Carbon
Gen 14 (21V7, tested on BIOS 1.12 and 1.14) roughly half of all boots
fail ucsi_init() with either -ENODEV (GET_CAPABILITY completes but
reports zero connectors) or -EINVAL (a standard command is rejected,
logged as "possible UCSI driver bug"). The failure is not a timeout:
increasing the sync command completion wait does not change the rate.

Since ucsi_init_work() only requeues on -EPROBE_DEFER, a single bad
answer during that window leaves UCSI dead for the whole session, so
Type-C events are never handled again; most visibly, the machine
silently never resumes charging after the charger is replugged.
Manually reloading ucsi_acpi a few seconds later has succeeded on
every attempt observed, which suggests simply retrying is enough.

Retry -ENODEV and -EINVAL the same way as the role switch wait, log
the retries at debug level, keep the loud report for the case where
the retries are exhausted, and note when init only succeeded after
retrying.

Tested on the affected machine: across 8 consecutive boots with this
patch, 5 hit the failure (matching the historical ~50-60% rate) and
all 5 recovered on the first retry ("PPM init succeeded after 2
attempts"). 0 of 8 boots ended with UCSI unusable, where ~5 of 8
would have without the patch.

Signed-off-by: Jacob Riff <jacob@riff.dk>
---
This is the failure previously reported in the thread
"ucsi_acpi: intermittent PPM init failed at boot is never retried"
and reproduces on the latest firmware for the machine. Happy to test
alternative approaches on this hardware.

--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -2211,18 +2211,36 @@
 	int ret;
 
 	ret = ucsi_init(ucsi);
-	if (ret)
-		dev_err_probe(ucsi->dev, ret, "PPM init failed\n");
+	if (!ret) {
+		if (ucsi->work_count)
+			dev_info(ucsi->dev,
+				 "PPM init succeeded after %u attempts\n",
+				 ucsi->work_count + 1);
+		return;
+	}
 
-	if (ret == -EPROBE_DEFER) {
-		if (ucsi->work_count++ > UCSI_ROLE_SWITCH_WAIT_COUNT) {
-			dev_err(ucsi->dev, "PPM init failed, stop trying\n");
+	/*
+	 * On some platforms the PPM is not ready to answer commands
+	 * correctly for a short window during boot: standard commands are
+	 * rejected or GET_CAPABILITY reports zero connectors, seen as
+	 * -EINVAL or -ENODEV from ucsi_init(), and a retry moments later
+	 * succeeds (observed on Lenovo ThinkPad X1 Carbon Gen 14, where
+	 * this affects roughly half of all boots). Retry those like the
+	 * USB role switch wait instead of giving up on the first attempt.
+	 */
+	if (ret == -EPROBE_DEFER || ret == -ENODEV || ret == -EINVAL) {
+		if (ucsi->work_count++ < UCSI_ROLE_SWITCH_WAIT_COUNT) {
+			dev_dbg(ucsi->dev, "PPM init failed (%pe), retrying\n",
+				ERR_PTR(ret));
+			queue_delayed_work(system_dfl_long_wq, &ucsi->work,
+					   UCSI_ROLE_SWITCH_INTERVAL);
 			return;
 		}
-
-		queue_delayed_work(system_dfl_long_wq, &ucsi->work,
-				   UCSI_ROLE_SWITCH_INTERVAL);
+		dev_err(ucsi->dev, "PPM init failed, stop trying\n");
+		return;
 	}
+
+	dev_err_probe(ucsi->dev, ret, "PPM init failed\n");
 }
 
 /**

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-15  0:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-25 21:31 ucsi_acpi: intermittent "PPM init failed" at boot is never retried, Type-C event handling stays dead for the session Jacob Riff
2026-08-05 12:11 ` Heikki Krogerus
2026-08-05 12:46   ` Heikki Krogerus
2026-08-06  2:18     ` Jacob Riff
2026-08-15  0:57       ` [RFC PATCH] usb: typec: ucsi: retry init when the PPM answers early commands incorrectly Jacob Riff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox