lkml.org 
[lkml]   [2019]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 21/28] thunderbolt: Add support for Display Port tunnels
On Wed, Feb 06, 2019 at 04:17:31PM +0300, Mika Westerberg wrote:
> Display Port tunnels are somewhat more complex than PCIe tunnels as it
> requires 3 tunnels (AUX Rx/Tx and Video). In addition we are not
> supposed to create the tunnels immediately when a DP OUT is enumerated.
> Instead we need to wait until we get hotplug event to that adapter port
> or check if the port has HPD set before tunnels can be established. This
> adds Display Port tunneling support to the software connection manager.

> +static int tb_tunnel_dp(struct tb *tb, struct tb_port *out)
> +{
> + struct tb_cm *tcm = tb_priv(tb);
> + struct tb_switch *sw = out->sw;
> + struct tb_tunnel *tunnel;
> + struct tb_port *in;
> +
> + if (tb_port_is_enabled(out))
> + return 0;
> +
> + do {
> + sw = tb_to_switch(sw->dev.parent);
> + if (!sw)
> + return 0;
> + in = tb_find_unused_port(sw, TB_TYPE_DP_HDMI_IN);
> + } while (!in);
> +
> + tunnel = tb_tunnel_alloc_dp(tb, in, out);
> + if (!tunnel) {
> + tb_port_dbg(out, "DP tunnel allocation failed\n");

> + return -EIO;

In the same way how you done for XDomains it makes sense to return here -ENOMEM.

> + }
> +
> + if (tb_tunnel_activate(tunnel)) {
> + tb_port_info(out, "DP tunnel activation failed, aborting\n");
> + tb_tunnel_free(tunnel);
> + return -EIO;
> + }
> +
> + list_add_tail(&tunnel->list, &tcm->tunnel_list);
> + return 0;
> +}

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2019-02-07 15:28    [W:0.439 / U:26.136 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site