Lines Matching +full:dp +full:- +full:port
1 // SPDX-License-Identifier: GPL-2.0
12 * tb_lc_read_uuid() - Read switch UUID from link controller common register
18 if (!sw->cap_lc) in tb_lc_read_uuid()
19 return -EINVAL; in tb_lc_read_uuid()
20 return tb_sw_read(sw, uuid, TB_CFG_SWITCH, sw->cap_lc + TB_LC_FUSE, 4); in tb_lc_read_uuid()
25 if (!sw->cap_lc) in read_lc_desc()
26 return -EINVAL; in read_lc_desc()
27 return tb_sw_read(sw, desc, TB_CFG_SWITCH, sw->cap_lc + TB_LC_DESC, 1); in read_lc_desc()
30 static int find_port_lc_cap(struct tb_port *port) in find_port_lc_cap() argument
32 struct tb_switch *sw = port->sw; in find_port_lc_cap()
40 /* Start of port LC registers */ in find_port_lc_cap()
43 phys = tb_phy_port_from_link(port->port); in find_port_lc_cap()
45 return sw->cap_lc + start + phys * size; in find_port_lc_cap()
48 static int tb_lc_set_port_configured(struct tb_port *port, bool configured) in tb_lc_set_port_configured() argument
50 bool upstream = tb_is_upstream_port(port); in tb_lc_set_port_configured()
51 struct tb_switch *sw = port->sw; in tb_lc_set_port_configured()
55 if (sw->generation < 2) in tb_lc_set_port_configured()
58 cap = find_port_lc_cap(port); in tb_lc_set_port_configured()
67 if (port->port % 2) in tb_lc_set_port_configured()
86 * tb_lc_configure_port() - Let LC know about configured port
87 * @port: Port that is set as configured
89 * Sets the port configured for power management purposes.
91 int tb_lc_configure_port(struct tb_port *port) in tb_lc_configure_port() argument
93 return tb_lc_set_port_configured(port, true); in tb_lc_configure_port()
97 * tb_lc_unconfigure_port() - Let LC know about unconfigured port
98 * @port: Port that is set as configured
100 * Sets the port unconfigured for power management purposes.
102 void tb_lc_unconfigure_port(struct tb_port *port) in tb_lc_unconfigure_port() argument
104 tb_lc_set_port_configured(port, false); in tb_lc_unconfigure_port()
107 static int tb_lc_set_xdomain_configured(struct tb_port *port, bool configure) in tb_lc_set_xdomain_configured() argument
109 struct tb_switch *sw = port->sw; in tb_lc_set_xdomain_configured()
113 if (sw->generation < 2) in tb_lc_set_xdomain_configured()
116 cap = find_port_lc_cap(port); in tb_lc_set_xdomain_configured()
125 if (port->port % 2) in tb_lc_set_xdomain_configured()
139 * tb_lc_configure_xdomain() - Inform LC that the link is XDomain
140 * @port: Switch downstream port connected to another host
145 int tb_lc_configure_xdomain(struct tb_port *port) in tb_lc_configure_xdomain() argument
147 return tb_lc_set_xdomain_configured(port, true); in tb_lc_configure_xdomain()
151 * tb_lc_unconfigure_xdomain() - Unconfigure XDomain from port
152 * @port: Switch downstream port that was connected to another host
156 void tb_lc_unconfigure_xdomain(struct tb_port *port) in tb_lc_unconfigure_xdomain() argument
158 tb_lc_set_xdomain_configured(port, false); in tb_lc_unconfigure_xdomain()
190 * tb_lc_set_wake() - Enable/disable wake
201 if (sw->generation < 2) in tb_lc_set_wake()
218 unsigned int offset = sw->cap_lc + start + i * size; in tb_lc_set_wake()
229 * tb_lc_set_sleep() - Inform LC that the switch is going to sleep
240 if (sw->generation < 2) in tb_lc_set_sleep()
254 unsigned int offset = sw->cap_lc + start + i * size; in tb_lc_set_sleep()
273 * tb_lc_lane_bonding_possible() - Is lane bonding possible towards switch
285 if (sw->generation < 2) in tb_lc_lane_bonding_possible()
303 struct tb_port *port; in tb_lc_dp_sink_from_port() local
305 /* The first DP IN port is sink 0 and second is sink 1 */ in tb_lc_dp_sink_from_port()
306 tb_switch_for_each_port(sw, port) { in tb_lc_dp_sink_from_port()
307 if (tb_port_is_dpin(port)) in tb_lc_dp_sink_from_port()
308 return in != port; in tb_lc_dp_sink_from_port()
311 return -EINVAL; in tb_lc_dp_sink_from_port()
320 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_available()
339 return -EBUSY; in tb_lc_dp_sink_available()
343 * tb_lc_dp_sink_query() - Is DP sink available for DP IN port
344 * @sw: Switch whose DP sink is queried
345 * @in: DP IN port to check
347 * Queries through LC SNK_ALLOCATION registers whether DP sink is available
348 * for the given DP IN port or not.
358 if (sw->generation < 3) in tb_lc_dp_sink_query()
369 * tb_lc_dp_sink_alloc() - Allocate DP sink
370 * @sw: Switch whose DP sink is allocated
371 * @in: DP IN port the DP sink is allocated for
373 * Allocate DP sink for @in via LC SNK_ALLOCATION registers. If the
375 * other cases returs negative errno. In particular %-EBUSY is returned if
383 if (sw->generation < 3) in tb_lc_dp_sink_alloc()
395 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_alloc()
409 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_alloc()
419 * tb_lc_dp_sink_dealloc() - De-allocate DP sink
420 * @sw: Switch whose DP sink is de-allocated
421 * @in: DP IN port whose DP sink is de-allocated
423 * De-allocate DP sink from @in using LC SNK_ALLOCATION registers.
430 if (sw->generation < 3) in tb_lc_dp_sink_dealloc()
443 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_dealloc()
453 sw->cap_lc + TB_LC_SNK_ALLOCATION, 1); in tb_lc_dp_sink_dealloc()
457 tb_port_dbg(in, "sink %d de-allocated\n", sink); in tb_lc_dp_sink_dealloc()
462 * tb_lc_force_power() - Forces LC to be powered on