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

thunderbolt: Align USB4 router wakes configuration with the CM guide

The USB4 Configuration Manager guide suggests that the USB4 port wakes
are configured in a certain way, like that when the port is configured
the wake-on-connect should not be set and so forth, so align the driver
with this.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

+11 -5
+11 -5
drivers/thunderbolt/usb4.c
··· 399 399 400 400 val &= ~(PORT_CS_19_WOC | PORT_CS_19_WOD | PORT_CS_19_WOU4); 401 401 402 - if (flags & TB_WAKE_ON_CONNECT) 403 - val |= PORT_CS_19_WOC; 404 - if (flags & TB_WAKE_ON_DISCONNECT) 405 - val |= PORT_CS_19_WOD; 406 - if (flags & TB_WAKE_ON_USB4) 402 + if (tb_is_upstream_port(port)) { 407 403 val |= PORT_CS_19_WOU4; 404 + } else { 405 + bool configured = val & PORT_CS_19_PC; 406 + 407 + if ((flags & TB_WAKE_ON_CONNECT) && !configured) 408 + val |= PORT_CS_19_WOC; 409 + if ((flags & TB_WAKE_ON_DISCONNECT) && configured) 410 + val |= PORT_CS_19_WOD; 411 + if ((flags & TB_WAKE_ON_USB4) && configured) 412 + val |= PORT_CS_19_WOU4; 413 + } 408 414 409 415 ret = tb_port_write(port, &val, TB_CFG_PORT, 410 416 port->cap_usb4 + PORT_CS_19, 1);