Lines Matching refs:sw
81 if (tb_switch_is_usb4(port->sw)) { in tb_port_clx_supported()
181 static bool tb_switch_clx_is_supported(const struct tb_switch *sw) in tb_switch_clx_is_supported() argument
186 if (sw->quirks & QUIRK_NO_CLX) in tb_switch_clx_is_supported()
193 if (tb_switch_is_tiger_lake(sw)) in tb_switch_clx_is_supported()
196 return tb_switch_is_usb4(sw) || tb_switch_is_titan_ridge(sw); in tb_switch_clx_is_supported()
208 int tb_switch_clx_init(struct tb_switch *sw) in tb_switch_clx_init() argument
213 if (tb_switch_is_icm(sw)) in tb_switch_clx_init()
216 if (!tb_route(sw)) in tb_switch_clx_init()
219 if (!tb_switch_clx_is_supported(sw)) in tb_switch_clx_init()
222 up = tb_upstream_port(sw); in tb_switch_clx_init()
223 down = tb_switch_downstream_port(sw); in tb_switch_clx_init()
228 tb_sw_warn(sw, "CLx: inconsistent configuration %#x != %#x\n", in tb_switch_clx_init()
231 tb_sw_dbg(sw, "CLx: current mode: %s\n", clx_name(clx)); in tb_switch_clx_init()
233 sw->clx = clx; in tb_switch_clx_init()
237 static int tb_switch_pm_secondary_resolve(struct tb_switch *sw) in tb_switch_pm_secondary_resolve() argument
242 if (!tb_route(sw)) in tb_switch_pm_secondary_resolve()
245 up = tb_upstream_port(sw); in tb_switch_pm_secondary_resolve()
246 down = tb_switch_downstream_port(sw); in tb_switch_pm_secondary_resolve()
254 static int tb_switch_mask_clx_objections(struct tb_switch *sw) in tb_switch_mask_clx_objections() argument
256 int up_port = sw->config.upstream_port_number; in tb_switch_mask_clx_objections()
261 if (!tb_switch_is_titan_ridge(sw)) in tb_switch_mask_clx_objections()
264 if (!tb_route(sw)) in tb_switch_mask_clx_objections()
284 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, in tb_switch_mask_clx_objections()
285 sw->cap_lp + offset, ARRAY_SIZE(val)); in tb_switch_mask_clx_objections()
294 return tb_sw_write(sw, &val, TB_CFG_SWITCH, in tb_switch_mask_clx_objections()
295 sw->cap_lp + offset, ARRAY_SIZE(val)); in tb_switch_mask_clx_objections()
318 int tb_switch_clx_enable(struct tb_switch *sw, unsigned int clx) in tb_switch_clx_enable() argument
325 if (!clx || sw->clx == clx) in tb_switch_clx_enable()
331 parent_sw = tb_switch_parent(sw); in tb_switch_clx_enable()
336 !tb_switch_clx_is_supported(sw)) in tb_switch_clx_enable()
342 usb4_switch_version(sw) < 2)) in tb_switch_clx_enable()
345 ret = tb_switch_pm_secondary_resolve(sw); in tb_switch_clx_enable()
349 up = tb_upstream_port(sw); in tb_switch_clx_enable()
350 down = tb_switch_downstream_port(sw); in tb_switch_clx_enable()
373 ret = tb_switch_mask_clx_objections(sw); in tb_switch_clx_enable()
380 sw->clx |= clx; in tb_switch_clx_enable()
382 tb_sw_dbg(sw, "CLx: %s enabled\n", clx_name(clx)); in tb_switch_clx_enable()
396 int tb_switch_clx_disable(struct tb_switch *sw) in tb_switch_clx_disable() argument
398 unsigned int clx = sw->clx; in tb_switch_clx_disable()
402 if (!tb_switch_clx_is_supported(sw)) in tb_switch_clx_disable()
408 if (sw->is_unplugged) in tb_switch_clx_disable()
411 up = tb_upstream_port(sw); in tb_switch_clx_disable()
412 down = tb_switch_downstream_port(sw); in tb_switch_clx_disable()
422 sw->clx = 0; in tb_switch_clx_disable()
424 tb_sw_dbg(sw, "CLx: %s disabled\n", clx_name(clx)); in tb_switch_clx_disable()