Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: typec: ucsi: Handle incorrect num_connectors capability

The UCSI spec states that the num_connectors field is 7 bits, and the
8th bit is reserved and should be set to zero.
Some buggy FW has been known to set this bit, and it can lead to a
system not booting.
Flag that the FW is not behaving correctly, and auto-fix the value
so that the system boots correctly.

Found on Lenovo P1 G8 during Linux enablement program. The FW will
be fixed, but seemed worth addressing in case it hit platforms that
aren't officially Linux supported.

Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20250821185319.2585023-1-mpearson-lenovo@squebb.ca
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mark Pearson and committed by
Greg Kroah-Hartman
30cd2cb1 5570ad14

+6
+6
drivers/usb/typec/ucsi/ucsi.c
··· 1807 1807 ret = -ENODEV; 1808 1808 goto err_reset; 1809 1809 } 1810 + /* Check if reserved bit set. This is out of spec but happens in buggy FW */ 1811 + if (ucsi->cap.num_connectors & 0x80) { 1812 + dev_warn(ucsi->dev, "UCSI: Invalid num_connectors %d. Likely buggy FW\n", 1813 + ucsi->cap.num_connectors); 1814 + ucsi->cap.num_connectors &= 0x7f; // clear bit and carry on 1815 + } 1810 1816 1811 1817 /* Allocate the connectors. Released in ucsi_unregister() */ 1812 1818 connector = kcalloc(ucsi->cap.num_connectors + 1, sizeof(*connector), GFP_KERNEL);