Commit Graph

11 Commits

Author SHA1 Message Date
Mika Westerberg
9e4f5b2af2 thunderbolt: Check for unplugged router in tb_switch_clx_disable()
There is no point disabling CL states if the router is unplugged so in
that case return early.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13 08:49:13 +03:00
Mika Westerberg
35c9ab4fd6 thunderbolt: Make tb_switch_clx_is_supported() static
This function is not used outside of clx.c so make it static. No
functional changes.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13 08:49:13 +03:00
Mika Westerberg
fd4d58d1fe thunderbolt: Enable CL2 low power state
For USB4 v2 routers we can also enable CL2 which allows better power
savings and thermal management than CL0s and CL1.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Mika Westerberg
53ba2e1695 thunderbolt: Disable CL states when a DMA tunnel is established
Tunnels between hosts should not have CL states enabled because
otherwise they might enter a low power state without the other end
noticing which causes packets to be lost. For this reason disable all
CL states upon first DMA tunnel creation. Once the last DMA tunnel is
torn down we try to re-enable them.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-09 12:07:24 +03:00
Mika Westerberg
4a420eb142 thunderbolt: Make tb_switch_clx_disable() return CL states that were enabled
This allows us to disable all CL states temporarily when running lane
margining and then return back the previously enabled states.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-09 12:07:24 +03:00
Mika Westerberg
768e6fe69f thunderbolt: Initialize CL states from the hardware
In case the boot firmware enabled any of them, read the currently
configured CL states and update the router structure accordingly.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-09 12:07:24 +03:00
Mika Westerberg
b5d15961d9 thunderbolt: Prefix CL state related log messages with "CLx: "
This makes it easier to spot from the logs and follows what we do with
the TMU code already. We also log enabling/disabling CL states using the
tb_sw_dbg() instead of tb_port_dbg().

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-09 12:07:24 +03:00
Mika Westerberg
9650de7379 thunderbolt: Check for first depth router in tb.c
Currently tb_switch_clx_enable() enables CL states only for the first
depth router. This is something we may want to change in the future and
in addition it is not visible from the calling path at all. For this
reason do the check in the tb.c so it is immediately visible that we
only do this for the first depth router. Fix the kernel-docs
accordingly.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-09 12:07:23 +03:00
Mika Westerberg
3562735306 thunderbolt: Switch CL states from enum to a bitmask
This is more natural and follows the hardware register layout better.
This makes it easier to see which CL states we enable (even though they
should be enabled together). Rename 'clx_mask' to 'clx' everywhere as
this is now always bitmask.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-09 12:07:23 +03:00
Mika Westerberg
4f9a4f25ad thunderbolt: Get rid of __tb_switch_[en|dis]able_clx()
No need to have separate functions for these so fold them into
tb_switch_clx_enable() and tb_switch_clx_disable() accordingly.

No functional changes.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-09 12:07:23 +03:00
Mika Westerberg
12a14f2fca thunderbolt: Move CLx support functions into clx.c
There really don't belong to switch.c so move them into their own file.
As we do this rename the functions to match the conventions used
elsewhere in the driver.

No functional changes.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-09 12:07:23 +03:00