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

Commit 67ba0992 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mdss: hdmi: check if hdcp2p2 app is present during hpd"

parents cd71634b dafd22c3
Loading
Loading
Loading
Loading
+624 −593

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ struct hdmi_hdcp_ops {
	int (*hdmi_hdcp_isr)(void *ptr);
	int (*hdmi_hdcp_reauthenticate)(void *input);
	int (*hdmi_hdcp_authenticate)(void *hdcp_ctrl);
	bool (*feature_supported)(void *input);
	void (*hdmi_hdcp_off)(void *hdcp_ctrl);
};

+253 −209

File changed.

Preview size limit exceeded, changes collapsed.

+51 −23
Original line number Diff line number Diff line
@@ -1203,7 +1203,6 @@ end:

static void hdmi_tx_hdcp_cb(void *ptr, enum hdmi_hdcp_state status)
{
	int rc = 0;
	struct hdmi_tx_ctrl *hdmi_ctrl = (struct hdmi_tx_ctrl *)ptr;

	if (!hdmi_ctrl) {
@@ -1211,10 +1210,27 @@ static void hdmi_tx_hdcp_cb(void *ptr, enum hdmi_hdcp_state status)
		return;
	}

	hdmi_ctrl->hdcp_status = status;

	queue_delayed_work(hdmi_ctrl->workq, &hdmi_ctrl->hdcp_cb_work, HZ/4);
}

static void hdmi_tx_hdcp_cb_work(struct work_struct *work)
{
	struct hdmi_tx_ctrl *hdmi_ctrl = NULL;
	struct delayed_work *dw = to_delayed_work(work);
	int rc = 0;

	hdmi_ctrl = container_of(dw, struct hdmi_tx_ctrl, hdcp_cb_work);
	if (!hdmi_ctrl) {
		DEV_DBG("%s: invalid input\n", __func__);
		return;
	}

	DEV_DBG("%s: HDCP status=%s hpd_state=%d\n", __func__,
		hdcp_state_name(status), hdmi_ctrl->hpd_state);
		hdcp_state_name(hdmi_ctrl->hdcp_status), hdmi_ctrl->hpd_state);

	switch (status) {
	switch (hdmi_ctrl->hdcp_status) {
	case HDCP_STATE_AUTHENTICATED:
		if (hdmi_ctrl->hpd_state) {
			rc = hdmi_tx_config_avmute(hdmi_ctrl, false);
@@ -1585,6 +1601,36 @@ error:
	return status;
} /* hdmi_tx_read_sink_info */

static void hdmi_tx_update_hdcp_info(struct hdmi_tx_ctrl *hdmi_ctrl)
{
	void *fd = NULL;
	struct hdmi_hdcp_ops *ops = NULL;

	if (!hdmi_ctrl) {
		DEV_ERR("%s: invalid input\n", __func__);
		return;
	}

	/* check first if hdcp2p2 is supported */
	fd = hdmi_ctrl->feature_data[HDMI_TX_FEAT_HDCP2P2];
	if (fd)
		ops = hdmi_hdcp2p2_start(fd);

	if (ops && ops->feature_supported)
		hdmi_ctrl->hdcp22_present = ops->feature_supported(fd);
	else
		hdmi_ctrl->hdcp22_present = false;

	if (!hdmi_ctrl->hdcp22_present && hdmi_ctrl->hdcp14_present) {
		fd = hdmi_ctrl->feature_data[HDMI_TX_FEAT_HDCP];
		ops = hdmi_hdcp_start(fd);
	}

	/* update internal data about hdcp */
	hdmi_ctrl->hdcp_feature_data = fd;
	hdmi_ctrl->hdcp_ops = ops;
}

static void hdmi_tx_hpd_int_work(struct work_struct *work)
{
	struct hdmi_tx_ctrl *hdmi_ctrl = NULL;
@@ -1614,26 +1660,7 @@ static void hdmi_tx_hpd_int_work(struct work_struct *work)
		if (hdmi_tx_enable_power(hdmi_ctrl, HDMI_TX_DDC_PM, false))
			DEV_ERR("%s: Failed to disable ddc power\n", __func__);

		/* Figure out HDCP capabilities of sink */
		hdmi_ctrl->hdcp_ops = NULL;
		hdmi_ctrl->hdcp_feature_data =
			hdmi_ctrl->feature_data[HDMI_TX_FEAT_HDCP2P2];
		if (hdmi_ctrl->hdcp_feature_data)
			hdmi_ctrl->hdcp_ops =
				hdmi_hdcp2p2_start(
					hdmi_ctrl->hdcp_feature_data);

		if (hdmi_ctrl->hdcp_ops)
			hdmi_ctrl->hdcp22_present = true;
		else
			hdmi_ctrl->hdcp22_present = false;

		if (!hdmi_ctrl->hdcp22_present && hdmi_ctrl->hdcp14_present) {
			hdmi_ctrl->hdcp_feature_data =
				hdmi_ctrl->feature_data[HDMI_TX_FEAT_HDCP];
			hdmi_ctrl->hdcp_ops =
				hdmi_hdcp_start(hdmi_ctrl->hdcp_feature_data);
		}
		hdmi_tx_update_hdcp_info(hdmi_ctrl);

		hdmi_tx_send_cable_notification(hdmi_ctrl, true);
	} else {
@@ -3896,6 +3923,7 @@ static int hdmi_tx_dev_init(struct hdmi_tx_ctrl *hdmi_ctrl)

	INIT_WORK(&hdmi_ctrl->hpd_int_work, hdmi_tx_hpd_int_work);
	INIT_WORK(&hdmi_ctrl->cable_notify_work, hdmi_tx_cable_notify_work);
	INIT_DELAYED_WORK(&hdmi_ctrl->hdcp_cb_work, hdmi_tx_hdcp_cb_work);

	spin_lock_init(&hdmi_ctrl->hpd_state_lock);

+2 −0
Original line number Diff line number Diff line
@@ -160,11 +160,13 @@ struct hdmi_tx_ctrl {
	u32 vote_hdmi_core_on;
	u8  timing_gen_on;
	u8  mhl_hpd_on;
	u8  hdcp_status;

	struct hdmi_util_ds_data ds_data;
	struct completion hpd_int_done;
	struct completion hpd_off_done;
	struct work_struct hpd_int_work;
	struct delayed_work hdcp_cb_work;

	struct work_struct cable_notify_work;

Loading