Commit 71af9d46 authored by Meenakshikumar Somasundaram's avatar Meenakshikumar Somasundaram Committed by Alex Deucher
Browse files

drm/amd/display: Support for SET_CONFIG processing with DMUB



[Why]
To process SET_CONFIG transactions with DMUB using inbox1 and
outbox1 mail boxes.

[How]
1) Added inbox1 DPIA command subtype DMUB_CMD__DPIA_SET_CONFIG_ACCESS to
   issue SET_CONFIG command to DMUB in dc_process_dmub_set_config_async().
   DMUB processes the command with DPIA sends reply back immediately or
   in an outbox1 message triggering an outbox1 interrupt to driver.
2) DMUB posts SET_CONFIG reply as an Outbox1 message of type
   DMUB_OUT_CMD__SET_CONFIG_REPLY.
3) The dmub async to sync mechanism for AUX is modified to accommodate
   SET_CONFIG commands for both command issue and reply code paths.

Reviewed-by: default avatarJun Lei <Jun.Lei@amd.com>
Acked-by: default avatarWayne Lin <Wayne.Lin@amd.com>
Acked-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarMeenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 80789bcf
Loading
Loading
Loading
Loading
+50 −0
Original line number Diff line number Diff line
@@ -3676,6 +3676,56 @@ uint8_t get_link_index_from_dpia_port_index(const struct dc *dc,
	return link_index;
}

/**
 *****************************************************************************
 *  Function: dc_process_dmub_set_config_async
 *
 *  @brief
 *		Submits set_config command to dmub via inbox message
 *
 *  @param
 *		[in] dc: dc structure
 *		[in] link_index: link index
 *		[in] payload: aux payload
 *		[out] notify: set_config immediate reply
 *
 *	@return
 *		True if successful, False if failure
 *****************************************************************************
 */
bool dc_process_dmub_set_config_async(struct dc *dc,
				uint32_t link_index,
				struct set_config_cmd_payload *payload,
				struct dmub_notification *notify)
{
	union dmub_rb_cmd cmd = {0};
	struct dc_dmub_srv *dmub_srv = dc->ctx->dmub_srv;
	bool is_cmd_complete = true;

	/* prepare SET_CONFIG command */
	cmd.set_config_access.header.type = DMUB_CMD__DPIA;
	cmd.set_config_access.header.sub_type = DMUB_CMD__DPIA_SET_CONFIG_ACCESS;

	cmd.set_config_access.set_config_control.instance = dc->links[link_index]->ddc_hw_inst;
	cmd.set_config_access.set_config_control.cmd_pkt.msg_type = payload->msg_type;
	cmd.set_config_access.set_config_control.cmd_pkt.msg_data = payload->msg_data;

	if (!dc_dmub_srv_cmd_with_reply_data(dmub_srv, &cmd)) {
		/* command is not processed by dmub */
		notify->sc_status = SET_CONFIG_UNKNOWN_ERROR;
		return is_cmd_complete;
	}

	/* command processed by dmub, if ret_status is 1, it is completed instantly */
	if (cmd.set_config_access.header.ret_status == 1)
		notify->sc_status = cmd.set_config_access.set_config_control.immed_status;
	else
		/* cmd pending, will receive notification via outbox */
		is_cmd_complete = false;

	return is_cmd_complete;
}

/**
 * dc_disable_accelerated_mode - disable accelerated mode
 * @dc: dc structure
+13 −3
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@
#include "dpcd_defs.h"
#include "link_hwss.h"
#include "inc/link_dpcd.h"
#include "dm_helpers.h"
#include "dmub/inc/dmub_cmd.h"

#define DC_LOGGER \
	link->ctx->logger
@@ -92,10 +94,18 @@ static enum link_training_result dpia_configure_link(struct dc_link *link,
}

static enum dc_status core_link_send_set_config(struct dc_link *link,
		uint8_t msg_type, uint8_t msg_data)
	uint8_t msg_type,
	uint8_t msg_data)
{
	/** @todo Implement */
	return DC_OK;
	struct set_config_cmd_payload payload;
	enum set_config_status set_config_result = SET_CONFIG_PENDING;

	/* prepare set_config payload */
	payload.msg_type = msg_type;
	payload.msg_data = msg_data;

	/* set_config should return ACK if successful */
	return (set_config_result == SET_CONFIG_ACK_RECEIVED) ? DC_OK : DC_ERROR_UNEXPECTED;
}

/* Build SET_CONFIG message data payload for specified message type. */
+2 −1
Original line number Diff line number Diff line
@@ -64,7 +64,8 @@ void dc_stat_get_dmub_notification(const struct dc *dc, struct dmub_notification

	/* For HPD/HPD RX, convert dpia port index into link index */
	if (notify->type == DMUB_NOTIFICATION_HPD ||
	    notify->type == DMUB_NOTIFICATION_HPD_IRQ) {
	    notify->type == DMUB_NOTIFICATION_HPD_IRQ ||
	    notify->type == DMUB_NOTIFICATION_SET_CONFIG_REPLY) {
		notify->link_index =
			get_link_index_from_dpia_port_index(dc, notify->link_index);
	}
+7 −0
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@

/* forward declaration */
struct aux_payload;
struct set_config_cmd_payload;
struct dmub_notification;

#define DC_VER "3.2.156"

@@ -1397,6 +1399,11 @@ bool dc_process_dmub_aux_transfer_async(struct dc *dc,
/* Get dc link index from dpia port index */
uint8_t get_link_index_from_dpia_port_index(const struct dc *dc,
				uint8_t dpia_port_index);

bool dc_process_dmub_set_config_async(struct dc *dc,
				uint32_t link_index,
				struct set_config_cmd_payload *payload,
				struct dmub_notification *notify);
/*******************************************************************************
 * DSC Interfaces
 ******************************************************************************/
+5 −0
Original line number Diff line number Diff line
@@ -179,4 +179,9 @@ int dm_helper_dmub_aux_transfer_sync(
		const struct dc_link *link,
		struct aux_payload *payload,
		enum aux_return_code_type *operation_result);
enum set_config_status;
int dm_helpers_dmub_set_config_sync(struct dc_context *ctx,
		const struct dc_link *link,
		struct set_config_cmd_payload *payload,
		enum set_config_status *operation_result);
#endif /* __DM_HELPERS__ */
Loading