Commit 3caf8887 authored by Mika Westerberg's avatar Mika Westerberg
Browse files

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: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 6026b703
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -399,12 +399,18 @@ int usb4_switch_set_wake(struct tb_switch *sw, unsigned int flags)

		val &= ~(PORT_CS_19_WOC | PORT_CS_19_WOD | PORT_CS_19_WOU4);

		if (flags & TB_WAKE_ON_CONNECT)
		if (tb_is_upstream_port(port)) {
			val |= PORT_CS_19_WOU4;
		} else {
			bool configured = val & PORT_CS_19_PC;

			if ((flags & TB_WAKE_ON_CONNECT) && !configured)
				val |= PORT_CS_19_WOC;
		if (flags & TB_WAKE_ON_DISCONNECT)
			if ((flags & TB_WAKE_ON_DISCONNECT) && configured)
				val |= PORT_CS_19_WOD;
		if (flags & TB_WAKE_ON_USB4)
			if ((flags & TB_WAKE_ON_USB4) && configured)
				val |= PORT_CS_19_WOU4;
		}

		ret = tb_port_write(port, &val, TB_CFG_PORT,
				    port->cap_usb4 + PORT_CS_19, 1);