Lines Matching refs:sw

81 	if (tb_switch_is_usb4(port->sw)) {
179 * @sw: Router
186 int tb_switch_clx_init(struct tb_switch *sw)
191 if (tb_switch_is_icm(sw))
194 if (!tb_route(sw))
197 if (!tb_switch_clx_is_supported(sw))
200 up = tb_upstream_port(sw);
201 down = tb_switch_downstream_port(sw);
206 tb_sw_warn(sw, "CLx: inconsistent configuration %#x != %#x\n",
209 tb_sw_dbg(sw, "CLx: current mode: %s\n", clx_name(clx));
211 sw->clx = clx;
215 static int tb_switch_pm_secondary_resolve(struct tb_switch *sw)
220 if (!tb_route(sw))
223 up = tb_upstream_port(sw);
224 down = tb_switch_downstream_port(sw);
232 static int tb_switch_mask_clx_objections(struct tb_switch *sw)
234 int up_port = sw->config.upstream_port_number;
239 if (!tb_switch_is_titan_ridge(sw))
242 if (!tb_route(sw))
262 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH,
263 sw->cap_lp + offset, ARRAY_SIZE(val));
272 return tb_sw_write(sw, &val, TB_CFG_SWITCH,
273 sw->cap_lp + offset, ARRAY_SIZE(val));
278 * @sw: The router to check CLx support for
280 bool tb_switch_clx_is_supported(const struct tb_switch *sw)
285 if (sw->quirks & QUIRK_NO_CLX)
292 if (tb_switch_is_tiger_lake(sw))
295 return tb_switch_is_usb4(sw) || tb_switch_is_titan_ridge(sw);
308 * @sw: Router to enable CLx for
318 int tb_switch_clx_enable(struct tb_switch *sw, unsigned int clx)
325 if (!clx || sw->clx == clx)
331 parent_sw = tb_switch_parent(sw);
336 !tb_switch_clx_is_supported(sw))
342 usb4_switch_version(sw) < 2))
345 ret = tb_switch_pm_secondary_resolve(sw);
349 up = tb_upstream_port(sw);
350 down = tb_switch_downstream_port(sw);
373 ret = tb_switch_mask_clx_objections(sw);
380 sw->clx |= clx;
382 tb_sw_dbg(sw, "CLx: %s enabled\n", clx_name(clx));
388 * @sw: Router to disable CLx for
396 int tb_switch_clx_disable(struct tb_switch *sw)
398 unsigned int clx = sw->clx;
402 if (!tb_switch_clx_is_supported(sw))
408 up = tb_upstream_port(sw);
409 down = tb_switch_downstream_port(sw);
419 sw->clx = 0;
421 tb_sw_dbg(sw, "CLx: %s disabled\n", clx_name(clx));