@@ -62,6 +62,36 @@ enum dc_status dpcd_get_tunneling_device_data(struct dc_link *link)
6262 if (status != DC_OK )
6363 goto err ;
6464
65+ link -> dpcd_caps .usb4_dp_tun_info .dp_tun_cap .raw =
66+ dpcd_dp_tun_data [DP_TUNNELING_CAPABILITIES_SUPPORT - DP_TUNNELING_CAPABILITIES_SUPPORT ];
67+
68+ if (link -> dpcd_caps .usb4_dp_tun_info .dp_tun_cap .bits .dp_tunneling == false)
69+ goto err ;
70+
71+ link -> dpcd_caps .usb4_dp_tun_info .dpia_info .raw =
72+ dpcd_dp_tun_data [DP_IN_ADAPTER_INFO - DP_TUNNELING_CAPABILITIES_SUPPORT ];
73+ link -> dpcd_caps .usb4_dp_tun_info .usb4_driver_id =
74+ dpcd_dp_tun_data [DP_USB4_DRIVER_ID - DP_TUNNELING_CAPABILITIES_SUPPORT ];
75+
76+ if (link -> dpcd_caps .usb4_dp_tun_info .dp_tun_cap .bits .dpia_bw_alloc ) {
77+ status = core_link_read_dpcd (link , USB4_DRIVER_BW_CAPABILITY ,
78+ dpcd_dp_tun_data , 1 );
79+
80+ if (status != DC_OK )
81+ goto err ;
82+
83+ link -> dpcd_caps .usb4_dp_tun_info .driver_bw_cap .raw = dpcd_dp_tun_data [0 ];
84+ }
85+
86+ DC_LOG_DEBUG ("%s: Link[%d] DP tunneling support (RouterId=%d AdapterId=%d) "
87+ "DPIA_BW_Alloc_support=%d "
88+ "CM_BW_Alloc_support=%d " ,
89+ __func__ , link -> link_index ,
90+ link -> dpcd_caps .usb4_dp_tun_info .usb4_driver_id ,
91+ link -> dpcd_caps .usb4_dp_tun_info .dpia_info .bits .dpia_num ,
92+ link -> dpcd_caps .usb4_dp_tun_info .dp_tun_cap .bits .dpia_bw_alloc ,
93+ link -> dpcd_caps .usb4_dp_tun_info .driver_bw_cap .bits .driver_bw_alloc_support );
94+
6595 status = core_link_read_dpcd (
6696 link ,
6797 DP_USB4_ROUTER_TOPOLOGY_ID ,
@@ -71,13 +101,6 @@ enum dc_status dpcd_get_tunneling_device_data(struct dc_link *link)
71101 if (status != DC_OK )
72102 goto err ;
73103
74- link -> dpcd_caps .usb4_dp_tun_info .dp_tun_cap .raw =
75- dpcd_dp_tun_data [DP_TUNNELING_CAPABILITIES_SUPPORT - DP_TUNNELING_CAPABILITIES_SUPPORT ];
76- link -> dpcd_caps .usb4_dp_tun_info .dpia_info .raw =
77- dpcd_dp_tun_data [DP_IN_ADAPTER_INFO - DP_TUNNELING_CAPABILITIES_SUPPORT ];
78- link -> dpcd_caps .usb4_dp_tun_info .usb4_driver_id =
79- dpcd_dp_tun_data [DP_USB4_DRIVER_ID - DP_TUNNELING_CAPABILITIES_SUPPORT ];
80-
81104 for (i = 0 ; i < DPCD_USB4_TOPOLOGY_ID_LEN ; i ++ )
82105 link -> dpcd_caps .usb4_dp_tun_info .usb4_topology_id [i ] = dpcd_topology_data [i ];
83106
@@ -120,3 +143,20 @@ bool dpia_query_hpd_status(struct dc_link *link)
120143 return link -> hpd_status ;
121144}
122145
146+ void link_decide_dp_tunnel_settings (struct dc_stream_state * stream ,
147+ struct dc_tunnel_settings * dp_tunnel_setting )
148+ {
149+ struct dc_link * link = stream -> link ;
150+
151+ memset (dp_tunnel_setting , 0 , sizeof (* dp_tunnel_setting ));
152+
153+ if ((stream -> signal == SIGNAL_TYPE_DISPLAY_PORT ) || (stream -> signal == SIGNAL_TYPE_DISPLAY_PORT_MST )) {
154+ dp_tunnel_setting -> should_enable_dp_tunneling =
155+ link -> dpcd_caps .usb4_dp_tun_info .dp_tun_cap .bits .dp_tunneling ;
156+
157+ if (link -> dpcd_caps .usb4_dp_tun_info .dp_tun_cap .bits .dpia_bw_alloc
158+ && link -> dpcd_caps .usb4_dp_tun_info .driver_bw_cap .bits .driver_bw_alloc_support )
159+ dp_tunnel_setting -> should_use_dp_bw_allocation = true;
160+ }
161+ }
162+
0 commit comments