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

Commit dc79968b authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

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

parents ae8071b9 ddacd9b8
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);
@@ -1200,6 +1192,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: