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

Commit ddacd9b8 authored by Ajay Singh Parmar's avatar Ajay Singh Parmar
Browse files

drm/msm/dp: move hdcp capability check to hot plug



Currently the device's hdcp capabilities are checked during
framework boot. The dependent services may not be ready by
then. Move this check to hot plug handling to make sure
all the modules and services are up and running while checking
for hdcp capabilities.

CRs-Fixed: 2332364
Change-Id: I908737fb18b0f7a9fa9f121192c30d8b4b0b6234
Signed-off-by: default avatarAjay Singh Parmar <aparmar@codeaurora.org>
parent 38454009
Loading
Loading
Loading
Loading
+27 −34
Original line number Diff line number Diff line
@@ -220,6 +220,31 @@ static void dp_display_update_hdcp_info(struct dp_display_private *dp)
		sde_hdcp_version(dp->link->hdcp_status.hdcp_version));
}

static void dp_display_check_source_hdcp_caps(struct dp_display_private *dp)
{
	int i;
	struct dp_hdcp_dev *hdcp_dev = dp->hdcp.dev;

	if (dp->debug->hdcp_disabled) {
		pr_debug("hdcp disabled\n");
		return;
	}

	for (i = 0; i < HDCP_VERSION_MAX; i++) {
		struct dp_hdcp_dev *dev = &hdcp_dev[i];
		struct sde_hdcp_ops *ops = dev->ops;
		void *fd = dev->fd;

		if (!fd || !ops || (dp->hdcp.source_cap & dev->ver))
			continue;

		if (ops->feature_supported(fd))
			dp->hdcp.source_cap |= dev->ver;
	}

	dp_display_update_hdcp_status(dp, false);
}

static void dp_display_hdcp_cb_work(struct work_struct *work)
{
	struct dp_display_private *dp;
@@ -238,6 +263,7 @@ static void dp_display_hdcp_cb_work(struct work_struct *work)
	status = &dp->link->hdcp_status;

	if (status->hdcp_state == HDCP_STATE_INACTIVE) {
		dp_display_check_source_hdcp_caps(dp);
		dp_display_update_hdcp_info(dp);

		if (dp_display_is_hdcp_enabled(dp)) {
@@ -304,37 +330,6 @@ static void dp_display_notify_hdcp_status_cb(void *ptr,
	mutex_unlock(&dp->session_lock);
}

static void dp_display_check_source_hdcp_caps(struct dp_display_private *dp)
{
	int i;
	struct dp_hdcp_dev *hdcp_dev = dp->hdcp.dev;

	if (dp->debug->hdcp_disabled) {
		pr_debug("hdcp disabled\n");
		return;
	}

	for (i = 0; i < HDCP_VERSION_MAX; i++) {
		struct dp_hdcp_dev *dev = &hdcp_dev[i];
		struct sde_hdcp_ops *ops = dev->ops;
		void *fd = dev->fd;

		if (!fd || !ops)
			continue;

		if (ops->feature_supported(fd))
			dp->hdcp.source_cap |= dev->ver;
		else
			pr_warn("This device doesn't support %s\n",
				sde_hdcp_version(dev->ver));
	}

	if (!dp->hdcp.source_cap)
		dp->debug->hdcp_disabled = true;

	dp_display_update_hdcp_status(dp, false);
}

static void dp_display_deinitialize_hdcp(struct dp_display_private *dp)
{
	if (!dp) {
@@ -532,9 +527,6 @@ static void dp_display_post_open(struct dp_display *dp_display)
		return;
	}

	dp_display_update_hdcp_status(dp, true);
	dp_display_check_source_hdcp_caps(dp);

	/* if cable is already connected, send notification */
	if (dp->hpd->hpd_high)
		queue_delayed_work(dp->wq, &dp->connect_work, HZ * 10);
@@ -1198,6 +1190,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
	}

	dp->debug->hdcp_disabled = hdcp_disabled;
	dp_display_update_hdcp_status(dp, true);

	return rc;
error_debug: