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

Commit a74be3b1 authored by Tatenda Chipeperekwa's avatar Tatenda Chipeperekwa
Browse files

drm/msm/dp: fix check for sink support for HDCP 2.x



Current implementation only checks if the sink is HDCP capable.
In addition, it is required that the source also checks for the
HDCP version supported by the sink prior to initiating HDCP 2.x
authentication sequence.

CRs-Fixed: 2062951
Change-Id: Ieed610a799c17e863ca15332a0c36733643fd394
Signed-off-by: default avatarTatenda Chipeperekwa <tatendac@codeaurora.org>
parent 1d9aee75
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#define DP_INTR_STATUS3				(0x00000028)
#define dp_read(offset) readl_relaxed((offset))
#define dp_write(offset, data) writel_relaxed((data), (offset))
#define DP_HDCP_RXCAPS_LENGTH 3

enum dp_hdcp2p2_sink_status {
	SINK_DISCONNECTED,
@@ -893,21 +894,22 @@ void *sde_dp_hdcp2p2_init(struct sde_hdcp_init_data *init_data)
static bool dp_hdcp2p2_supported(struct dp_hdcp2p2_ctrl *ctrl)
{
	u32 const rxcaps_dpcd_offset = 0x6921d;
	ssize_t const bytes_to_read = 1;
	ssize_t bytes_read = 0;
	u8 buf = 0;
	u8 buf[DP_HDCP_RXCAPS_LENGTH];

	bytes_read = drm_dp_dpcd_read(ctrl->init_data.drm_aux,
			rxcaps_dpcd_offset, &buf, bytes_to_read);
	if (bytes_read != bytes_to_read) {
			rxcaps_dpcd_offset, &buf, DP_HDCP_RXCAPS_LENGTH);
	if (bytes_read != DP_HDCP_RXCAPS_LENGTH) {
		pr_err("RxCaps read failed\n");
		goto error;
	}

	pr_debug("rxcaps 0x%x\n", buf);
	pr_debug("HDCP_CAPABLE=%lu\n", (buf[2] & BIT(1)) >> 1);
	pr_debug("VERSION=%d\n", buf[0]);

	if (buf & BIT(1))
	if ((buf[2] & BIT(1)) && (buf[0] == 0x2))
		return true;

error:
	return false;
}