Lines Matching +full:sink +full:- +full:only
1 // SPDX-License-Identifier: GPL-2.0
14 * tb_lc_read_uuid() - Read switch UUID from link controller common register
20 if (!sw->cap_lc) in tb_lc_read_uuid()
21 return -EINVAL; in tb_lc_read_uuid()
22 return tb_sw_read(sw, uuid, TB_CFG_SWITCH, sw->cap_lc + TB_LC_FUSE, 4); in tb_lc_read_uuid()
27 if (!sw->cap_lc) in read_lc_desc()
28 return -EINVAL; in read_lc_desc()
29 return tb_sw_read(sw, desc, TB_CFG_SWITCH, sw->cap_lc + TB_LC_DESC, 1); in read_lc_desc()
34 struct tb_switch *sw = port->sw; in find_port_lc_cap()
45 phys = tb_phy_port_from_link(port->port); in find_port_lc_cap()
47 return sw->cap_lc + start + phys * size; in find_port_lc_cap()
51 * tb_lc_reset_port() - Trigger downstream port reset through LC
55 * Returns %0 in case of success negative errno otherwise. Only supports
56 * non-USB4 routers with link controller (that's Thunderbolt 2 and
61 struct tb_switch *sw = port->sw; in tb_lc_reset_port()
65 if (sw->generation < 2) in tb_lc_reset_port()
66 return -EINVAL; in tb_lc_reset_port()
96 struct tb_switch *sw = port->sw; in tb_lc_set_port_configured()
100 if (sw->generation < 2) in tb_lc_set_port_configured()
112 if (port->port % 2) in tb_lc_set_port_configured()
131 * tb_lc_configure_port() - Let LC know about configured port
142 * tb_lc_unconfigure_port() - Let LC know about unconfigured port
154 struct tb_switch *sw = port->sw; in tb_lc_set_xdomain_configured()
158 if (sw->generation < 2) in tb_lc_set_xdomain_configured()
170 if (port->port % 2) in tb_lc_set_xdomain_configured()
184 * tb_lc_configure_xdomain() - Inform LC that the link is XDomain
196 * tb_lc_unconfigure_xdomain() - Unconfigure XDomain from port
207 * tb_lc_start_lane_initialization() - Start lane initialization
218 struct tb_switch *sw = port->sw; in tb_lc_start_lane_initialization()
225 if (sw->generation < 2) in tb_lc_start_lane_initialization()
242 * tb_lc_is_clx_supported() - Check whether CLx is supported by the lane adapter
250 struct tb_switch *sw = port->sw; in tb_lc_is_clx_supported()
266 * tb_lc_is_usb_plugged() - Is there USB device connected to port
269 * Returns true if the @port has USB type-C device connected.
273 struct tb_switch *sw = port->sw; in tb_lc_is_usb_plugged()
277 if (sw->generation != 3) in tb_lc_is_usb_plugged()
292 * tb_lc_is_xhci_connected() - Is the internal xHCI connected
299 struct tb_switch *sw = port->sw; in tb_lc_is_xhci_connected()
303 if (sw->generation != 3) in tb_lc_is_xhci_connected()
319 struct tb_switch *sw = port->sw; in __tb_lc_xhci_connect()
323 if (sw->generation != 3) in __tb_lc_xhci_connect()
324 return -EINVAL; in __tb_lc_xhci_connect()
343 * tb_lc_xhci_connect() - Connect internal xHCI
348 * routers only.
363 * tb_lc_xhci_disconnect() - Disconnect internal xHCI
367 * for Thunderbolt 3 routers only.
406 * tb_lc_set_wake() - Enable/disable wake
417 if (sw->generation < 2) in tb_lc_set_wake()
434 unsigned int offset = sw->cap_lc + start + i * size; in tb_lc_set_wake()
445 * tb_lc_set_sleep() - Inform LC that the switch is going to sleep
456 if (sw->generation < 2) in tb_lc_set_sleep()
470 unsigned int offset = sw->cap_lc + start + i * size; in tb_lc_set_sleep()
489 * tb_lc_lane_bonding_possible() - Is lane bonding possible towards switch
501 if (sw->generation < 2) in tb_lc_lane_bonding_possible()
521 /* The first DP IN port is sink 0 and second is sink 1 */ in tb_lc_dp_sink_from_port()
527 return -EINVAL; in tb_lc_dp_sink_from_port()
530 static int tb_lc_dp_sink_available(struct tb_switch *sw, int sink) in tb_lc_dp_sink_available() argument
536 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_available()
541 * Sink is available for CM/SW to use if the allocation valie is in tb_lc_dp_sink_available()
544 if (!sink) { in tb_lc_dp_sink_available()
555 return -EBUSY; in tb_lc_dp_sink_available()
559 * tb_lc_dp_sink_query() - Is DP sink available for DP IN port
560 * @sw: Switch whose DP sink is queried
563 * Queries through LC SNK_ALLOCATION registers whether DP sink is available
568 int sink; in tb_lc_dp_sink_query() local
571 * For older generations sink is always available as there is no in tb_lc_dp_sink_query()
574 if (sw->generation < 3) in tb_lc_dp_sink_query()
577 sink = tb_lc_dp_sink_from_port(sw, in); in tb_lc_dp_sink_query()
578 if (sink < 0) in tb_lc_dp_sink_query()
581 return !tb_lc_dp_sink_available(sw, sink); in tb_lc_dp_sink_query()
585 * tb_lc_dp_sink_alloc() - Allocate DP sink
586 * @sw: Switch whose DP sink is allocated
587 * @in: DP IN port the DP sink is allocated for
589 * Allocate DP sink for @in via LC SNK_ALLOCATION registers. If the
591 * other cases returs negative errno. In particular %-EBUSY is returned if
596 int ret, sink; in tb_lc_dp_sink_alloc() local
599 if (sw->generation < 3) in tb_lc_dp_sink_alloc()
602 sink = tb_lc_dp_sink_from_port(sw, in); in tb_lc_dp_sink_alloc()
603 if (sink < 0) in tb_lc_dp_sink_alloc()
604 return sink; in tb_lc_dp_sink_alloc()
606 ret = tb_lc_dp_sink_available(sw, sink); in tb_lc_dp_sink_alloc()
611 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_alloc()
615 if (!sink) { in tb_lc_dp_sink_alloc()
625 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_alloc()
630 tb_port_dbg(in, "sink %d allocated\n", sink); in tb_lc_dp_sink_alloc()
635 * tb_lc_dp_sink_dealloc() - De-allocate DP sink
636 * @sw: Switch whose DP sink is de-allocated
637 * @in: DP IN port whose DP sink is de-allocated
639 * De-allocate DP sink from @in using LC SNK_ALLOCATION registers.
643 int ret, sink; in tb_lc_dp_sink_dealloc() local
646 if (sw->generation < 3) in tb_lc_dp_sink_dealloc()
649 sink = tb_lc_dp_sink_from_port(sw, in); in tb_lc_dp_sink_dealloc()
650 if (sink < 0) in tb_lc_dp_sink_dealloc()
651 return sink; in tb_lc_dp_sink_dealloc()
654 ret = tb_lc_dp_sink_available(sw, sink); in tb_lc_dp_sink_dealloc()
659 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_dealloc()
663 if (!sink) in tb_lc_dp_sink_dealloc()
669 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_dealloc()
673 tb_port_dbg(in, "sink %d de-allocated\n", sink); in tb_lc_dp_sink_dealloc()
678 * tb_lc_force_power() - Forces LC to be powered on