summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt/tb.c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2022-11-06 14:07:43 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2023-06-16 09:53:28 +0300
commitfd4d58d1fef9ae9b0ee235eaad73d2e0a6a73025 (patch)
treeb7f44a45ef98c391c264e16352b634469e98eebb /drivers/thunderbolt/tb.c
parentd49b4f043d63bddf4c1836623b8ae800878ed2e3 (diff)
downloadlinux-fd4d58d1fef9ae9b0ee235eaad73d2e0a6a73025.tar.xz
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>
Diffstat (limited to 'drivers/thunderbolt/tb.c')
-rw-r--r--drivers/thunderbolt/tb.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index ff034975a87e..79efc85db38b 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -244,6 +244,7 @@ static void tb_discover_dp_resources(struct tb *tb)
static int tb_enable_clx(struct tb_switch *sw)
{
struct tb_cm *tcm = tb_priv(sw->tb);
+ unsigned int clx = TB_CL0S | TB_CL1;
const struct tb_tunnel *tunnel;
int ret;
@@ -275,10 +276,12 @@ static int tb_enable_clx(struct tb_switch *sw)
}
/*
- * CL0s and CL1 are enabled and supported together.
- * Silently ignore CLx enabling in case CLx is not supported.
+ * Initially try with CL2. If that's not supported by the
+ * topology try with CL0s and CL1 and then give up.
*/
- ret = tb_switch_clx_enable(sw, TB_CL0S | TB_CL1);
+ ret = tb_switch_clx_enable(sw, clx | TB_CL2);
+ if (ret == -EOPNOTSUPP)
+ ret = tb_switch_clx_enable(sw, clx);
return ret == -EOPNOTSUPP ? 0 : ret;
}