Linux USB
 help / color / mirror / Atom feed
From: Hex Lindqvist <hex@freenixos.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ajay Gupta <ajayg@nvidia.com>, Wayne Chang <waynec@nvidia.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] usb: typec: ucsi_ccg: Don't probe GPUs without a CCGx controller
Date: Fri, 13 Nov 2026 17:32:43 -0800	[thread overview]
Message-ID: <20261114013243.1240146-1-hex@freenixos.com> (raw)

The NVIDIA GPU I2C driver adds a ccgx-ucsi client on every GPU, but
GPUs without a USB Type-C port, such as the GTX 1660 Ti, have no CCGx
controller, and every probe fails with:

  ucsi_ccg 4-0008: i2c_transfer failed -110
  ucsi_ccg 4-0008: ucsi_ccg_init failed - -110
  ucsi_ccg 4-0008: probe with driver ucsi_ccg failed with error -110

Fix this by reading DEVICE_MODE first for clients created by the GPU
driver, and returning -ENODEV if the read times out. Controllers
described by firmware are not affected.

Tested on an ASUS TUF Gaming A17 (FA706IU, GTX 1660 Ti): the three
errors are gone, probe takes the same time (one timed-out transfer, as
before), and the platform's own UCSI port and suspend/resume are not
affected.

Assisted by LLM.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=206653
Link: https://lore.kernel.org/all/20200922054338.GA588161@kroah.com/
Signed-off-by: Hex Lindqvist <hex@freenixos.com>
---
The nvidia-gpu timeout line is fixed by a separate patch to linux-i2c.

Not tested on a GPU with a CCGx controller; there this adds one
DEVICE_MODE read before ucsi_ccg_init().

 drivers/usb/typec/ucsi/ucsi_ccg.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
index 3f12db95c7f4..0f082952272e 100644
--- a/drivers/usb/typec/ucsi/ucsi_ccg.c
+++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
@@ -357,6 +357,31 @@ static int ccg_op_region_update(struct ucsi_ccg *uc, u32 cci)
 	return 0;
 }
 
+/* GPUs without a USB Type-C port have no CCGx; transfers to it time out. */
+static bool ccg_is_present(struct ucsi_ccg *uc)
+{
+	struct i2c_client *client = uc->client;
+	unsigned char buf[2];
+	u8 data;
+	struct i2c_msg msgs[] = {
+		{
+			.addr	= client->addr,
+			.len	= sizeof(buf),
+			.buf	= buf,
+		},
+		{
+			.addr	= client->addr,
+			.flags	= I2C_M_RD,
+			.len	= sizeof(data),
+			.buf	= &data,
+		},
+	};
+
+	put_unaligned_le16(CCGX_RAB_DEVICE_MODE, buf);
+
+	return i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)) != -ETIMEDOUT;
+}
+
 static int ucsi_ccg_init(struct ucsi_ccg *uc)
 {
 	unsigned int count = 10;
@@ -1488,6 +1513,11 @@ static int ucsi_ccg_probe(struct i2c_client *client)
 			dev_err(uc->dev, "failed to get FW build information\n");
 	}
 
+	if (uc->fw_build == CCG_FW_BUILD_NVIDIA && !ccg_is_present(uc)) {
+		dev_dbg(dev, "no CCGx controller on this GPU\n");
+		return -ENODEV;
+	}
+
 	/* reset ccg device and initialize ucsi */
 	status = ucsi_ccg_init(uc);
 	if (status < 0) {

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.56.0


             reply	other threads:[~2026-11-14  1:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14  1:32 Hex Lindqvist [this message]
2026-11-14  1:51 ` [PATCH] usb: typec: ucsi_ccg: Don't probe GPUs without a CCGx controller sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261114013243.1240146-1-hex@freenixos.com \
    --to=hex@freenixos.com \
    --cc=ajayg@nvidia.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=waynec@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox