Lines Matching full:sw
81 if (tb_switch_is_usb4(port->sw)) { in tb_port_clx_supported()
179 * @sw: Router
186 int tb_switch_clx_init(struct tb_switch *sw) in tb_switch_clx_init() argument
191 if (tb_switch_is_icm(sw)) in tb_switch_clx_init()
194 if (!tb_route(sw)) in tb_switch_clx_init()
197 if (!tb_switch_clx_is_supported(sw)) in tb_switch_clx_init()
200 up = tb_upstream_port(sw); in tb_switch_clx_init()
201 down = tb_switch_downstream_port(sw); in tb_switch_clx_init()
206 tb_sw_warn(sw, "CLx: inconsistent configuration %#x != %#x\n", in tb_switch_clx_init()
209 tb_sw_dbg(sw, "CLx: current mode: %s\n", clx_name(clx)); in tb_switch_clx_init()
211 sw->clx = clx; in tb_switch_clx_init()
215 static int tb_switch_pm_secondary_resolve(struct tb_switch *sw) in tb_switch_pm_secondary_resolve() argument
220 if (!tb_route(sw)) in tb_switch_pm_secondary_resolve()
223 up = tb_upstream_port(sw); in tb_switch_pm_secondary_resolve()
224 down = tb_switch_downstream_port(sw); in tb_switch_pm_secondary_resolve()
232 static int tb_switch_mask_clx_objections(struct tb_switch *sw) in tb_switch_mask_clx_objections() argument
234 int up_port = sw->config.upstream_port_number; in tb_switch_mask_clx_objections()
239 if (!tb_switch_is_titan_ridge(sw)) in tb_switch_mask_clx_objections()
242 if (!tb_route(sw)) in tb_switch_mask_clx_objections()
262 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, in tb_switch_mask_clx_objections()
263 sw->cap_lp + offset, ARRAY_SIZE(val)); in tb_switch_mask_clx_objections()
272 return tb_sw_write(sw, &val, TB_CFG_SWITCH, in tb_switch_mask_clx_objections()
273 sw->cap_lp + offset, ARRAY_SIZE(val)); in tb_switch_mask_clx_objections()
278 * @sw: The router to check CLx support for
280 bool tb_switch_clx_is_supported(const struct tb_switch *sw) in tb_switch_clx_is_supported() argument
285 if (sw->quirks & QUIRK_NO_CLX) in tb_switch_clx_is_supported()
292 if (tb_switch_is_tiger_lake(sw)) in tb_switch_clx_is_supported()
295 return tb_switch_is_usb4(sw) || tb_switch_is_titan_ridge(sw); in tb_switch_clx_is_supported()
308 * @sw: Router to enable CLx for
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()
388 * @sw: Router to disable CLx for
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 up = tb_upstream_port(sw); in tb_switch_clx_disable()
409 down = tb_switch_downstream_port(sw); in tb_switch_clx_disable()
419 sw->clx = 0; in tb_switch_clx_disable()
421 tb_sw_dbg(sw, "CLx: %s disabled\n", clx_name(clx)); in tb_switch_clx_disable()