Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: typec: ucsi_ccg: Don't probe GPUs without a CCGx controller
@ 2026-11-14  1:32 Hex Lindqvist
  2026-11-14  1:51 ` sashiko-bot
  2026-11-17 11:29 ` Heikki Krogerus
  0 siblings, 2 replies; 3+ messages in thread
From: Hex Lindqvist @ 2026-11-14  1:32 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman
  Cc: Ajay Gupta, Wayne Chang, linux-usb, linux-kernel

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


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

* Re: [PATCH] usb: typec: ucsi_ccg: Don't probe GPUs without a CCGx controller
  2026-11-14  1:32 [PATCH] usb: typec: ucsi_ccg: Don't probe GPUs without a CCGx controller Hex Lindqvist
@ 2026-11-14  1:51 ` sashiko-bot
  2026-11-17 11:29 ` Heikki Krogerus
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-14  1:51 UTC (permalink / raw)
  To: Hex Lindqvist; +Cc: linux-usb

> 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>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261114013243.1240146-1-hex@freenixos.com?part=1


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

* Re: [PATCH] usb: typec: ucsi_ccg: Don't probe GPUs without a CCGx controller
  2026-11-14  1:32 [PATCH] usb: typec: ucsi_ccg: Don't probe GPUs without a CCGx controller Hex Lindqvist
  2026-11-14  1:51 ` sashiko-bot
@ 2026-11-17 11:29 ` Heikki Krogerus
  1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2026-11-17 11:29 UTC (permalink / raw)
  To: Hex Lindqvist
  Cc: Greg Kroah-Hartman, Ajay Gupta, Wayne Chang, linux-usb,
	linux-kernel

On Fri, Nov 13, 2026 at 05:32:43PM -0800, Hex Lindqvist wrote:
> 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>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.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

-- 
heikki

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

end of thread, other threads:[~2026-11-17 11:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-14  1:32 [PATCH] usb: typec: ucsi_ccg: Don't probe GPUs without a CCGx controller Hex Lindqvist
2026-11-14  1:51 ` sashiko-bot
2026-11-17 11:29 ` Heikki Krogerus

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