usb: typec: ucsi_ccg: Don't probe GPUs without a CCGx controller
Subsystems (2)
PATCH 1/1 usb: typec: ucsi_ccg: Don't probe GPUs without a CCGx controller
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.
---
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(+)
drivers/usb/typec/ucsi/ucsi_ccg.c +30 -0
@@ -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
Signature · 1 line
2.56.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 17 lines
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_ccg4-0008:i2c_transferfailed -110
ucsi_ccg4-0008:ucsi_ccg_initfailed - -110
ucsi_ccg4-0008: probe with driverucsi_ccgfailed with error -110Fix this by reading
DEVICE_MODEfirst for clients created by the GPU driver, and returning-ENODEVif 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.
Quoted 5 lines
Assisted by LLM.
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1