Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 458033d0 authored by Tatenda Chipeperekwa's avatar Tatenda Chipeperekwa
Browse files

drm/msm/dp: fix command data for link polling requests



Fix the command data that is sent to the transport layer for link
polling requests by updating the buffer pointer to the request
buffer pointer from the HDCP library. This ensures that the
transport layer has a valid buffer pointer to use for messages
received from the sink. Furthermore, update the error messages in
the transport layer to correctly reflect the status of sent
messages.

Change-Id: Idc6124b635509547b7f4dca10ae0a895900e576d
Signed-off-by: default avatarTatenda Chipeperekwa <tatendac@codeaurora.org>
parent bbee3e41
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -359,6 +359,12 @@ static int dp_hdcp2p2_aux_read_message(struct dp_hdcp2p2_ctrl *ctrl)
		goto exit;
	}

	if (!buf) {
		pr_err("invalid request buffer\n");
		rc = -EINVAL;
		goto exit;
	}

	pr_debug("request: offset(0x%x), size(%d)\n", offset, size);

	do {
@@ -471,9 +477,9 @@ static void dp_hdcp2p2_send_msg_work(struct kthread_work *work)

exit:
	if (rc == -ETIMEDOUT)
		cdata.cmd = HDCP_2X_CMD_MSG_RECV_TIMEOUT;
		cdata.cmd = HDCP_2X_CMD_MSG_SEND_TIMEOUT;
	else if (rc)
		cdata.cmd = HDCP_2X_CMD_MSG_RECV_FAILED;
		cdata.cmd = HDCP_2X_CMD_MSG_SEND_FAILED;

	dp_hdcp2p2_wakeup_lib(ctrl, &cdata);
}
+18 −5
Original line number Diff line number Diff line
@@ -389,6 +389,15 @@ static void sde_hdcp_2x_query_stream_work(struct kthread_work *work)
	sde_hdcp_2x_stream(hdcp);
}

static void sde_hdcp_2x_initialize_command(struct sde_hdcp_2x_ctrl *hdcp,
		enum hdcp_transport_wakeup_cmd cmd,
		struct hdcp_transport_wakeup_data *cdata)
{
		cdata->cmd = cmd;
		cdata->timeout = hdcp->timeout_left;
		cdata->buf = hdcp->app_data.request.data + 1;
}

static void sde_hdcp_2x_msg_sent(struct sde_hdcp_2x_ctrl *hdcp)
{
	struct hdcp_transport_wakeup_data cdata = {
@@ -406,12 +415,14 @@ static void sde_hdcp_2x_msg_sent(struct sde_hdcp_2x_ctrl *hdcp)
		}

		/* poll for link check */
		cdata.cmd = HDCP_TRANSPORT_CMD_LINK_POLL;
		sde_hdcp_2x_initialize_command(hdcp,
				HDCP_TRANSPORT_CMD_LINK_POLL, &cdata);
		break;
	case SKE_SEND_EKS:
		if (hdcp->repeater_flag && !atomic_read(&hdcp->hdcp_off)) {
			/* poll for link check */
			cdata.cmd = HDCP_TRANSPORT_CMD_LINK_POLL;
			sde_hdcp_2x_initialize_command(hdcp,
					HDCP_TRANSPORT_CMD_LINK_POLL, &cdata);
		} else {
			hdcp->app_data.response.data[0] = SKE_SEND_TYPE_ID;
			hdcp->app_data.response.length = 2;
@@ -427,7 +438,8 @@ static void sde_hdcp_2x_msg_sent(struct sde_hdcp_2x_ctrl *hdcp)
			HDCP_2X_EXECUTE(stream);
			hdcp->update_stream = false;
		} else {
			cdata.cmd = HDCP_TRANSPORT_CMD_LINK_POLL;
			sde_hdcp_2x_initialize_command(hdcp,
					HDCP_TRANSPORT_CMD_LINK_POLL, &cdata);
		}
		break;
	default:
@@ -583,12 +595,13 @@ static void sde_hdcp_2x_msg_recvd(struct sde_hdcp_2x_ctrl *hdcp)
				cdata.cmd = HDCP_TRANSPORT_CMD_STATUS_SUCCESS;
				sde_hdcp_2x_wakeup_client(hdcp, &cdata);
			} else {
				pr_debug("failed to enable encryption (%d)\n",
				pr_err("failed to enable encryption (%d)\n",
						rc);
			}
		}

		cdata.cmd = HDCP_TRANSPORT_CMD_LINK_POLL;
		sde_hdcp_2x_initialize_command(hdcp,
				HDCP_TRANSPORT_CMD_LINK_POLL, &cdata);
		goto exit;
	}

+4 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
 * @HDCP_2X_CMD_STOP:              stop authentication
 * @HDCP_2X_CMD_MSG_SEND_SUCCESS:  sending message to sink succeeded
 * @HDCP_2X_CMD_MSG_SEND_FAILED:   sending message to sink failed
 * @HDCP_2X_CMD_MSG_SEND_TIMEOUT:  sending message to sink timed out
 * @HDCP_2X_CMD_MSG_RECV_SUCCESS:  receiving message from sink succeeded
 * @HDCP_2X_CMD_MSG_RECV_FAILED:   receiving message from sink failed
 * @HDCP_2X_CMD_MSG_RECV_TIMEOUT:  receiving message from sink timed out
@@ -38,6 +39,7 @@ enum sde_hdcp_2x_wakeup_cmd {
	HDCP_2X_CMD_STOP,
	HDCP_2X_CMD_MSG_SEND_SUCCESS,
	HDCP_2X_CMD_MSG_SEND_FAILED,
	HDCP_2X_CMD_MSG_SEND_TIMEOUT,
	HDCP_2X_CMD_MSG_RECV_SUCCESS,
	HDCP_2X_CMD_MSG_RECV_FAILED,
	HDCP_2X_CMD_MSG_RECV_TIMEOUT,
@@ -141,6 +143,8 @@ static inline const char *sde_hdcp_2x_cmd_to_str(
		return TO_STR(HDCP_2X_CMD_MSG_SEND_SUCCESS);
	case HDCP_2X_CMD_MSG_SEND_FAILED:
		return TO_STR(HDCP_2X_CMD_MSG_SEND_FAILED);
	case HDCP_2X_CMD_MSG_SEND_TIMEOUT:
		return TO_STR(HDCP_2X_CMD_MSG_SEND_TIMEOUT);
	case HDCP_2X_CMD_MSG_RECV_SUCCESS:
		return TO_STR(HDCP_2X_CMD_MSG_RECV_SUCCESS);
	case HDCP_2X_CMD_MSG_RECV_FAILED: