Commit a8b53760 authored by Mustapha Ghaddar's avatar Mustapha Ghaddar Committed by Alex Deucher
Browse files

drm/amd/display: Add function pointer for validate bw usb4



[WHY]
In order to follow the new protocol of calling link functions

[HOW]
Add the function pointer to the link_srv

Reviewed-by: default avatarKshitij Bhardwaj <kshitij.bhardwaj1@amd.com>
Acked-by: default avatarQingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: default avatarMustapha Ghaddar <mghaddar@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b5006f87
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -473,3 +473,8 @@ void dc_link_enable_hpd_filter(struct dc_link *link, bool enable)
{
	link->dc->link_srv->enable_hpd_filter(link, enable);
}

bool dc_link_validate(struct dc *dc, const struct dc_stream_state *streams, const unsigned int count)
{
	return dc->link_srv->validate_dpia_bandwidth(streams, count);
}
+13 −0
Original line number Diff line number Diff line
@@ -2028,6 +2028,19 @@ void dc_link_handle_usb4_bw_alloc_response(struct dc_link *link,
int dc_link_dp_dpia_handle_usb4_bandwidth_allocation_for_link(
		struct dc_link *link, int peak_bw);

/*
 * Validate the BW of all the valid DPIA links to make sure it doesn't exceed
 * available BW for each host router
 *
 * @dc: pointer to dc struct
 * @stream: pointer to all possible streams
 * @num_streams: number of valid DPIA streams
 *
 * return: TRUE if bw used by DPIAs doesn't exceed available BW else return FALSE
 */
bool dc_link_validate(struct dc *dc, const struct dc_stream_state *streams,
		const unsigned int count);

/* Sink Interfaces - A sink corresponds to a display output device */

struct dc_container_id {
+3 −0
Original line number Diff line number Diff line
@@ -144,6 +144,9 @@ struct link_service {
	uint32_t (*dp_link_bandwidth_kbps)(
		const struct dc_link *link,
		const struct dc_link_settings *link_settings);
	bool (*validate_dpia_bandwidth)(
			const struct dc_stream_state *stream,
			const unsigned int num_streams);


	/*************************** DPMS *************************************/
+1 −0
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ static void construct_link_service_validation(struct link_service *link_srv)
{
	link_srv->validate_mode_timing = link_validate_mode_timing;
	link_srv->dp_link_bandwidth_kbps = dp_link_bandwidth_kbps;
	link_srv->validate_dpia_bandwidth = link_validate_dpia_bandwidth;
}

/* link dpms owns the programming sequence of stream's dpms state associated
+18 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
 */
#include "link_validation.h"
#include "protocols/link_dp_capability.h"
#include "protocols/link_dp_dpia_bw.h"
#include "resource.h"

#define DC_LOGGER_INIT(logger)
@@ -343,3 +344,20 @@ enum dc_status link_validate_mode_timing(

	return DC_OK;
}

bool link_validate_dpia_bandwidth(const struct dc_stream_state *stream, const unsigned int num_streams)
{
	bool ret = true;
	int bw_needed[MAX_DPIA_NUM];
	struct dc_link *link[MAX_DPIA_NUM];

	if (!num_streams || num_streams > MAX_DPIA_NUM)
		return ret;

	for (uint8_t i = 0; i < num_streams; ++i) {

		link[i] = stream[i].link;
		bw_needed[i] = dc_bandwidth_in_kbps_from_timing(&stream[i].timing);
	}
	return ret;
}
Loading