Commit 52af17ea authored by Cruise Hung's avatar Cruise Hung Committed by Alex Deucher
Browse files

drm/amd/display: Change notification of link BW allocation



[WHY & HOW]
The response of DP BW allocation is handled in Outbox ISR.
When it failed to request the DP BW allocation, it sent another
DPCD request in Outbox ISR immediately. The DP AUX reply also
uses the Outbox ISR. So, no AUX reply happened in this case.
Change to use HPD IRQ for the notification.

Reviewed-by: default avatarMeenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>
Signed-off-by: default avatarCruise Hung <Cruise.Hung@amd.com>
Signed-off-by: default avatarAlex Hung <alex.hung@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 79538e63
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -370,15 +370,10 @@ bool dc_link_should_enable_fec(const struct dc_link *link)
	return link->dc->link_srv->dp_should_enable_fec(link);
}

int dc_link_dp_dpia_handle_usb4_bandwidth_allocation_for_link(
void dc_link_dp_dpia_handle_usb4_bandwidth_allocation_for_link(
		struct dc_link *link, int peak_bw)
{
	return link->dc->link_srv->dpia_handle_usb4_bandwidth_allocation_for_link(link, peak_bw);
}

void dc_link_handle_usb4_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t result)
{
	link->dc->link_srv->dpia_handle_bw_alloc_response(link, bw, result);
	link->dc->link_srv->dpia_handle_usb4_bandwidth_allocation_for_link(link, peak_bw);
}

bool dc_link_check_link_loss_status(
+1 −15
Original line number Diff line number Diff line
@@ -2353,19 +2353,6 @@ unsigned int dc_dp_trace_get_link_loss_count(struct dc_link *link);
 */
void dc_link_set_usb4_req_bw_req(struct dc_link *link, int req_bw);

/*
 * Handle function for when the status of the Request above is complete.
 * We will find out the result of allocating on CM and update structs.
 *
 * @link: pointer to the dc_link struct instance
 * @bw: Allocated or Estimated BW depending on the result
 * @result: Response type
 *
 * return: none
 */
void dc_link_handle_usb4_bw_alloc_response(struct dc_link *link,
		uint8_t bw, uint8_t result);

/*
 * Handle the USB4 BW Allocation related functionality here:
 * Plug => Try to allocate max bw from timing parameters supported by the sink
@@ -2374,9 +2361,8 @@ void dc_link_handle_usb4_bw_alloc_response(struct dc_link *link,
 * @link: pointer to the dc_link struct instance
 * @peak_bw: Peak bw used by the link/sink
 *
 * return: allocated bw else return 0
 */
int dc_link_dp_dpia_handle_usb4_bandwidth_allocation_for_link(
void dc_link_dp_dpia_handle_usb4_bandwidth_allocation_for_link(
		struct dc_link *link, int peak_bw);

/*
+0 −1
Original line number Diff line number Diff line
@@ -1224,7 +1224,6 @@ struct dc_dpia_bw_alloc {
	int bw_granularity;    // BW Granularity
	int dp_overhead;       // DP overhead in dp tunneling
	bool bw_alloc_enabled; // The BW Alloc Mode Support is turned ON for all 3:  DP-Tx & Dpia & CM
	bool response_ready;   // Response ready from the CM side
	uint8_t nrd_max_lane_count; // Non-reduced max lane count
	uint8_t nrd_max_link_rate; // Non-reduced max link rate
};
+1 −3
Original line number Diff line number Diff line
@@ -218,10 +218,8 @@ struct link_service {


	/*************************** DP DPIA/PHY ******************************/
	int (*dpia_handle_usb4_bandwidth_allocation_for_link)(
	void (*dpia_handle_usb4_bandwidth_allocation_for_link)(
			struct dc_link *link, int peak_bw);
	void (*dpia_handle_bw_alloc_response)(
			struct dc_link *link, uint8_t bw, uint8_t result);
	void (*dp_set_drive_settings)(
		struct dc_link *link,
		const struct link_resource *link_res,
+1 −16
Original line number Diff line number Diff line
@@ -2291,22 +2291,7 @@ static bool allocate_usb4_bandwidth_for_stream(struct dc_stream_state *stream, i
	link->dpia_bw_alloc_config.dp_overhead = link_dp_dpia_get_dp_overhead_in_dp_tunneling(link);
	req_bw += link->dpia_bw_alloc_config.dp_overhead;

	if (link_dp_dpia_allocate_usb4_bandwidth_for_stream(link, req_bw)) {
		if (req_bw <= link->dpia_bw_alloc_config.allocated_bw) {
			DC_LOG_DEBUG("%s, Success in allocate bw for link(%d), allocated_bw(%d), dp_overhead(%d)\n",
					__func__, link->link_index, link->dpia_bw_alloc_config.allocated_bw,
					link->dpia_bw_alloc_config.dp_overhead);
		} else {
			// Cannot get the required bandwidth.
			DC_LOG_ERROR("%s, Failed to allocate bw for link(%d), allocated_bw(%d), dp_overhead(%d)\n",
					__func__, link->link_index, link->dpia_bw_alloc_config.allocated_bw,
					link->dpia_bw_alloc_config.dp_overhead);
			return false;
		}
	} else {
		DC_LOG_DEBUG("%s, usb4 request bw timeout\n", __func__);
		return false;
	}
	link_dp_dpia_allocate_usb4_bandwidth_for_stream(link, req_bw);

	if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
		int i = 0;
Loading