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

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

Merge "drivers/misc: create new module to handle sysfs and topology events" into msm-4.14

parents 2a227752 c33016db
Loading
Loading
Loading
Loading
+29 −38
Original line number Diff line number Diff line
@@ -48,11 +48,6 @@ struct dp_hdcp {
	void *hdcp1;
	void *hdcp2;

	int enc_lvl;

	bool auth_state;
	bool hdcp1_present;
	bool hdcp2_present;
	bool feature_enabled;
};

@@ -95,7 +90,6 @@ struct dp_display_private {
	struct work_struct attention_work;
	struct mutex hdcp_mutex;
	struct mutex session_lock;
	int hdcp_status;
	unsigned long audio_status;
};

@@ -111,9 +105,8 @@ static bool dp_display_framework_ready(struct dp_display_private *dp)

static inline bool dp_display_is_hdcp_enabled(struct dp_display_private *dp)
{
	return dp->hdcp.feature_enabled &&
		(dp->hdcp.hdcp1_present || dp->hdcp.hdcp2_present) &&
		dp->hdcp.ops;
	return dp->hdcp.feature_enabled && dp->link->hdcp_status.hdcp_version
		&& dp->hdcp.ops;
}

static irqreturn_t dp_display_irq(int irq, void *dev_id)
@@ -158,32 +151,25 @@ static void dp_display_hdcp_cb_work(struct work_struct *work)

	ops = dp->hdcp.ops;

	switch (dp->hdcp_status) {
	case HDCP_STATE_AUTHENTICATING:
		pr_debug("start authenticaton\n");
	pr_debug("%s: %s\n",
		sde_hdcp_version(dp->link->hdcp_status.hdcp_version),
		sde_hdcp_state_name(dp->link->hdcp_status.hdcp_state));

	switch (dp->link->hdcp_status.hdcp_state) {
	case HDCP_STATE_AUTHENTICATING:
		if (dp->hdcp.ops && dp->hdcp.ops->authenticate)
			rc = dp->hdcp.ops->authenticate(dp->hdcp.data);

		break;
	case HDCP_STATE_AUTHENTICATED:
		pr_debug("hdcp authenticated\n");
		dp->hdcp.auth_state = true;
		break;
	case HDCP_STATE_AUTH_FAIL:
		dp->hdcp.auth_state = false;

		if (dp->power_on) {
			pr_debug("Reauthenticating\n");
			if (ops && ops->reauthenticate) {
				rc = ops->reauthenticate(dp->hdcp.data);
				if (rc)
					pr_err("reauth failed rc=%d\n", rc);
					pr_err("failed rc=%d\n", rc);
			}
		} else {
			pr_debug("not reauthenticating, cable disconnected\n");
		}

		break;
	default:
		break;
@@ -191,7 +177,7 @@ static void dp_display_hdcp_cb_work(struct work_struct *work)
}

static void dp_display_notify_hdcp_status_cb(void *ptr,
		enum sde_hdcp_states status)
		enum sde_hdcp_state state)
{
	struct dp_display_private *dp = ptr;

@@ -200,7 +186,7 @@ static void dp_display_notify_hdcp_status_cb(void *ptr,
		return;
	}

	dp->hdcp_status = status;
	dp->link->hdcp_status.hdcp_state = state;

	if (dp->dp_display.is_connected)
		queue_delayed_work(dp->wq, &dp->hdcp_cb_work, HZ/4);
@@ -216,12 +202,16 @@ static void dp_display_update_hdcp_info(struct dp_display_private *dp)
{
	void *fd = NULL;
	struct sde_hdcp_ops *ops = NULL;
	bool hdcp2_present = false, hdcp1_present = false;

	if (!dp) {
		pr_err("invalid input\n");
		return;
	}

	dp->link->hdcp_status.hdcp_state = HDCP_STATE_INACTIVE;
	dp->link->hdcp_status.hdcp_version = HDCP_VERSION_NONE;

	if (!dp->hdcp.feature_enabled) {
		pr_debug("feature not enabled\n");
		return;
@@ -232,27 +222,28 @@ static void dp_display_update_hdcp_info(struct dp_display_private *dp)
		ops = sde_dp_hdcp2p2_start(fd);

	if (ops && ops->feature_supported)
		dp->hdcp.hdcp2_present = ops->feature_supported(fd);
		hdcp2_present = ops->feature_supported(fd);
	else
		dp->hdcp.hdcp2_present = false;
		hdcp2_present = false;

	pr_debug("hdcp2p2: %s\n",
			dp->hdcp.hdcp2_present ? "supported" : "not supported");
			hdcp2_present ? "supported" : "not supported");

	if (IS_ENABLED(CONFIG_HDCP_QSEECOM) && !dp->hdcp.hdcp2_present) {
		dp->hdcp.hdcp1_present =
			hdcp1_check_if_supported_load_app();

		if (dp->hdcp.hdcp1_present) {
	if (IS_ENABLED(CONFIG_HDCP_QSEECOM) && !hdcp2_present) {
		hdcp1_present = hdcp1_check_if_supported_load_app();
		if (hdcp1_present) {
			fd = dp->hdcp.hdcp1;
			ops = sde_hdcp_1x_start(fd);
			dp->link->hdcp_status.hdcp_version = HDCP_VERSION_1X;
		}
	} else {
		dp->link->hdcp_status.hdcp_version = HDCP_VERSION_2P2;
	}

	pr_debug("hdcp1x: %s\n",
			dp->hdcp.hdcp1_present ? "supported" : "not supported");
			hdcp1_present ? "supported" : "not supported");

	if (dp->hdcp.hdcp2_present || dp->hdcp.hdcp1_present) {
	if (hdcp2_present || hdcp1_present) {
		dp->hdcp.data = fd;
		dp->hdcp.ops = ops;
	} else {
@@ -292,7 +283,6 @@ static int dp_display_initialize_hdcp(struct dp_display_private *dp)
	hdcp_init_data.drm_aux       = dp->aux->drm_aux;
	hdcp_init_data.cb_data       = (void *)dp;
	hdcp_init_data.workq         = dp->wq;
	hdcp_init_data.mutex         = &dp->hdcp_mutex;
	hdcp_init_data.sec_access    = true;
	hdcp_init_data.notify_status = dp_display_notify_hdcp_status_cb;
	hdcp_init_data.dp_ahb        = &parser->get_io(parser, "dp_ahb")->io;
@@ -304,6 +294,7 @@ static int dp_display_initialize_hdcp(struct dp_display_private *dp)
	hdcp_init_data.hdcp_io       = &parser->get_io(parser,
						"hdcp_physical")->io;
	hdcp_init_data.revision      = &dp->panel->link_info.revision;
	hdcp_init_data.msm_hdcp_dev  = dp->parser->msm_hdcp_dev;

	dp->hdcp.hdcp1 = sde_hdcp_1x_init(&hdcp_init_data);
	if (IS_ERR_OR_NULL(dp->hdcp.hdcp1)) {
@@ -629,7 +620,7 @@ static int dp_display_usbpd_configure_cb(struct device *dev)
static void dp_display_clean(struct dp_display_private *dp)
{
	if (dp_display_is_hdcp_enabled(dp)) {
		dp->hdcp_status = HDCP_STATE_INACTIVE;
		dp->link->hdcp_status.hdcp_state = HDCP_STATE_INACTIVE;

		cancel_delayed_work_sync(&dp->hdcp_cb_work);
		if (dp->hdcp.ops->off)
@@ -1157,7 +1148,7 @@ static int dp_display_post_enable(struct dp_display *dp_display, void *panel)
	if (dp_display_is_hdcp_enabled(dp)) {
		cancel_delayed_work_sync(&dp->hdcp_cb_work);

		dp->hdcp_status = HDCP_STATE_AUTHENTICATING;
		dp->link->hdcp_status.hdcp_state = HDCP_STATE_AUTHENTICATING;
		queue_delayed_work(dp->wq, &dp->hdcp_cb_work, HZ / 2);
	}

@@ -1191,7 +1182,7 @@ static int dp_display_pre_disable(struct dp_display *dp_display, void *panel)
	}

	if (dp_display_is_hdcp_enabled(dp)) {
		dp->hdcp_status = HDCP_STATE_INACTIVE;
		dp->link->hdcp_status.hdcp_state = HDCP_STATE_INACTIVE;

		cancel_delayed_work_sync(&dp->hdcp_cb_work);
		if (dp->hdcp.ops->off)
+5 −20
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <linux/types.h>
#include <linux/kthread.h>
#include <linux/hdcp_qseecom.h>
#include <linux/msm_hdcp.h>
#include <drm/drm_dp_helper.h>

#include "sde_hdcp.h"
@@ -320,35 +321,16 @@ static void dp_hdcp2p2_min_level_change(void *client_ctx,
	struct dp_hdcp2p2_ctrl *ctrl = (struct dp_hdcp2p2_ctrl *)client_ctx;
	struct hdcp_lib_wakeup_data cdata = {
		HDCP_LIB_WKUP_CMD_QUERY_STREAM_TYPE};
	bool enc_notify = true;
	int enc_lvl;

	if (!ctrl) {
		pr_err("invalid input\n");
		return;
	}

	switch (min_enc_level) {
	case 0:
		enc_lvl = HDCP_STATE_AUTH_ENC_NONE;
		break;
	case 1:
		enc_lvl = HDCP_STATE_AUTH_ENC_1X;
		break;
	case 2:
		enc_lvl = HDCP_STATE_AUTH_ENC_2P2;
		break;
	default:
		enc_notify = false;
	}

	pr_debug("enc level changed %d\n", min_enc_level);

	cdata.context = ctrl->lib_ctx;
	dp_hdcp2p2_wakeup_lib(ctrl, &cdata);

	if (enc_notify && ctrl->init_data.notify_status)
		ctrl->init_data.notify_status(ctrl->init_data.cb_data, enc_lvl);
}

static void dp_hdcp2p2_auth_failed(struct dp_hdcp2p2_ctrl *ctrl)
@@ -812,7 +794,6 @@ void *sde_dp_hdcp2p2_init(struct sde_hdcp_init_data *init_data)

	static struct hdcp_client_ops client_ops = {
		.wakeup = dp_hdcp2p2_wakeup,
		.notify_lvl_change = dp_hdcp2p2_min_level_change,
	};
	static struct dp_hdcp2p2_int_set int_set1[] = {
		{BIT(17), "authentication successful", NULL},
@@ -872,6 +853,10 @@ void *sde_dp_hdcp2p2_init(struct sde_hdcp_init_data *init_data)
		goto error;
	}

	if (IS_ENABLED(CONFIG_HDCP_QSEECOM))
		msm_hdcp_register_cb(init_data->msm_hdcp_dev, ctrl,
				dp_hdcp2p2_min_level_change);

	kthread_init_worker(&ctrl->worker);

	kthread_init_work(&ctrl->auth,     dp_hdcp2p2_auth_work);
+6 −0
Original line number Diff line number Diff line
@@ -72,6 +72,11 @@ struct dp_link_test_audio {
	u32 test_audio_period_ch_8;
};

struct dp_link_hdcp_status {
	int hdcp_state;
	int hdcp_version;
};

struct dp_link_phy_params {
	u32 phy_test_pattern_sel;
	u8 v_level;
@@ -110,6 +115,7 @@ struct dp_link {
	struct dp_link_test_audio test_audio;
	struct dp_link_phy_params phy_params;
	struct dp_link_params link_params;
	struct dp_link_hdcp_status hdcp_status;

	u32 (*get_test_bits_depth)(struct dp_link *dp_link, u32 bpp);
	int (*process_request)(struct dp_link *dp_link);
+29 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#define pr_fmt(fmt)	"[drm-dp] %s: " fmt, __func__

#include <linux/of_gpio.h>
#include <linux/of_platform.h>

#include "dp_parser.h"

@@ -159,6 +160,30 @@ static int dp_parser_misc(struct dp_parser *parser)
	return 0;
}

static int dp_parser_msm_hdcp_dev(struct dp_parser *parser)
{
	struct device_node *node;
	struct platform_device *pdev;

	node = of_find_compatible_node(NULL, NULL, "qcom,msm-hdcp");
	if (!node) {
		// This is a non-fatal error, module initialization can proceed
		pr_warn("couldn't find msm-hdcp node\n");
		return 0;
	}

	pdev = of_find_device_by_node(node);
	if (!pdev) {
		// This is a non-fatal error, module initialization can proceed
		pr_warn("couldn't find msm-hdcp pdev\n");
		return 0;
	}

	parser->msm_hdcp_dev = &pdev->dev;

	return 0;
}

static int dp_parser_pinctrl(struct dp_parser *parser)
{
	int rc = 0;
@@ -678,6 +703,10 @@ static int dp_parser_parse(struct dp_parser *parser)
		goto err;

	rc = dp_parser_pinctrl(parser);
	if (rc)
		goto err;

	rc = dp_parser_msm_hdcp_dev(parser);
err:
	return rc;
}
+2 −0
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ static inline char *dp_phy_aux_config_type_to_string(u32 cfg_type)
 * struct dp_parser - DP parser's data exposed to clients
 *
 * @pdev: platform data of the client
 * @msm_hdcp_dev: device pointer for the HDCP driver
 * @mp: gpio, regulator and clock related data
 * @pinctrl: pin-control related data
 * @disp_data: controller's display related data
@@ -192,6 +193,7 @@ static inline char *dp_phy_aux_config_type_to_string(u32 cfg_type)
 */
struct dp_parser {
	struct platform_device *pdev;
	struct device *msm_hdcp_dev;
	struct dss_module_power mp[DP_MAX_PM];
	struct dp_pinctrl pinctrl;
	struct dp_io io;
Loading