thunderbolt: Honor TMU requirements in the domain when setting TMU mode
authorGil Fine <gil.fine@linux.intel.com>
Thu, 10 Oct 2024 14:29:42 +0000 (17:29 +0300)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 21 Oct 2024 06:42:42 +0000 (09:42 +0300)
commit3cea8af2d1a9ae5869b47c3dabe3b20f331f3bbd
tree3be15a54f74bd3d59143b8cd897dcde8bdc39be9
parente9e1b20fae7de06ba36dd3f8dba858157bad233d
thunderbolt: Honor TMU requirements in the domain when setting TMU mode

Currently, when configuring TMU (Time Management Unit) mode of a given
router, we take into account only its own TMU requirements ignoring
other routers in the domain. This is problematic if the router we are
configuring has lower TMU requirements than what is already configured
in the domain.

In the scenario below, we have a host router with two USB4 ports: A and
B. Port A connected to device router #1 (which supports CL states) and
existing DisplayPort tunnel, thus, the TMU mode is HiFi uni-directional.

1. Initial topology

          [Host]
         A/
         /
 [Device #1]
   /
Monitor

2. Plug in device #2 (that supports CL states) to downstream port B of
   the host router

         [Host]
        A/    B\
        /       \
 [Device #1]    [Device #2]
   /
Monitor

The TMU mode on port B and port A will be configured to LowRes which is
not what we want and will cause monitor to start flickering.

To address this we first scan the domain and search for any router
configured to HiFi uni-directional mode, and if found, configure TMU
mode of the given router to HiFi uni-directional as well.

Cc: stable@vger.kernel.org
Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/tb.c