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