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

Commit 37412f5a authored by Tatenda Chipeperekwa's avatar Tatenda Chipeperekwa
Browse files

disp: msm: dp: add support for PLL programming



Add support for PLL programming in the DisplayPort driver.

Change-Id: I4f08a621dcae5d1f54d67bb5c34409249012cc7b
Signed-off-by: default avatarTatenda Chipeperekwa <tatendac@codeaurora.org>
parent 9b75dd67
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ msm_drm-$(CONFIG_DRM_MSM_DP) += dp/dp_usbpd.o \
	dp/dp_hdcp2p2.o \
	sde_hdcp_1x.o \
	sde_hdcp_2x.o \
	dp/dp_pll.o \
	dp/dp_pll_5nm.o \

msm_drm-$(CONFIG_DRM_MSM_DP_MST) += dp/dp_mst_drm.o \

+2 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 */

#ifndef _DP_AUX_H_
@@ -22,6 +22,7 @@
#define DP_STATE_LINK_MAINTENANCE_COMPLETED BIT(10)
#define DP_STATE_LINK_MAINTENANCE_FAILED    BIT(11)
#define DP_STATE_AUX_TIMEOUT                BIT(12)
#define DP_STATE_PLL_LOCKED                 BIT(13)

enum dp_aux_error {
	DP_AUX_ERR_NONE	= 0,
+287 −162
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include "drm_connector.h"
#include "sde_connector.h"
#include "dp_display.h"
#include "dp_pll.h"

#define DEBUG_NAME "drm_dp"

@@ -40,6 +41,7 @@ struct dp_debug_private {
	struct dp_debug dp_debug;
	struct dp_parser *parser;
	struct dp_ctrl *ctrl;
	struct dp_pll *pll;
	struct mutex lock;
};

@@ -785,35 +787,6 @@ static ssize_t dp_debug_mst_sideband_mode_write(struct file *file,
	return count;
}

static ssize_t dp_debug_widebus_mode_write(struct file *file,
		const char __user *user_buff, size_t count, loff_t *ppos)
{
	struct dp_debug_private *debug = file->private_data;
	char buf[SZ_8];
	size_t len = 0;
	u32 widebus_mode = 0;

	if (!debug || !debug->parser)
		return -ENODEV;

	if (*ppos)
		return 0;

	len = min_t(size_t, count, SZ_8 - 1);
	if (copy_from_user(buf, user_buff, len))
		return -EFAULT;

	buf[len] = '\0';

	if (kstrtoint(buf, 10, &widebus_mode) != 0)
		return -EINVAL;

	debug->parser->has_widebus = widebus_mode ? true : false;
	DP_DEBUG("widebus_enable: %d\n", widebus_mode);

	return len;
}

static ssize_t dp_debug_tpg_write(struct file *file,
		const char __user *user_buff, size_t count, loff_t *ppos)
{
@@ -1900,126 +1873,171 @@ static const struct file_operations hdcp_fops = {
	.read = dp_debug_read_hdcp,
};

static const struct file_operations widebus_mode_fops = {
	.open = simple_open,
	.write = dp_debug_widebus_mode_write,
};

static int dp_debug_init(struct dp_debug *dp_debug)
static int dp_debug_init_mst(struct dp_debug_private *debug, struct dentry *dir)
{
	int rc = 0;
	struct dp_debug_private *debug = container_of(dp_debug,
		struct dp_debug_private, dp_debug);
	struct dentry *dir, *file;
	struct dentry *file;

	dir = debugfs_create_dir(DEBUG_NAME, NULL);
	if (IS_ERR_OR_NULL(dir)) {
		if (!dir)
			rc = -EINVAL;
		else
			rc = PTR_ERR(dir);
		DP_ERR("[%s] debugfs create dir failed, rc = %d\n",
	file = debugfs_create_file("mst_con_id", 0644, dir,
					debug, &mst_con_id_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs create mst_con_id failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error;
		return rc;
	}

	debug->root = dir;
	file = debugfs_create_file("mst_con_info", 0644, dir,
					debug, &mst_conn_info_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs create mst_conn_info failed, rc=%d\n",
		       DEBUG_NAME, rc);
		return rc;
	}

	file = debugfs_create_file("dp_debug", 0444, dir,
				debug, &dp_debug_fops);
	file = debugfs_create_file("mst_con_add", 0644, dir,
					debug, &mst_con_add_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs create file failed, rc=%d\n",
		DRM_ERROR("[%s] debugfs create mst_con_add failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("edid_modes", 0644, dir,
					debug, &edid_modes_fops);
	file = debugfs_create_file("mst_con_remove", 0644, dir,
					debug, &mst_con_remove_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs create edid_modes failed, rc=%d\n",
		DRM_ERROR("[%s] debugfs create mst_con_remove failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("edid_modes_mst", 0644, dir,
					debug, &edid_modes_mst_fops);
	file = debugfs_create_file("mst_mode", 0644, dir,
			debug, &mst_mode_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs create edid_modes_mst failed, rc=%d\n",
		DP_ERR("[%s] debugfs mst_mode failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("mst_con_id", 0644, dir,
					debug, &mst_con_id_fops);
	file = debugfs_create_file("mst_sideband_mode", 0644, dir,
			debug, &mst_sideband_mode_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs create mst_con_id failed, rc=%d\n",
		DP_ERR("[%s] debugfs mst_sideband_mode failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("mst_con_info", 0644, dir,
					debug, &mst_conn_info_fops);
	return rc;
}

static int dp_debug_init_link(struct dp_debug_private *debug,
		struct dentry *dir)
{
	int rc = 0;
	struct dentry *file;

	file = debugfs_create_file("max_bw_code", 0644, dir,
			debug, &bw_code_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs create mst_conn_info failed, rc=%d\n",
		DP_ERR("[%s] debugfs max_bw_code failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("mst_con_add", 0644, dir,
					debug, &mst_con_add_fops);
	file = debugfs_create_file("max_pclk_khz", 0644, dir,
			debug, &max_pclk_khz_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DRM_ERROR("[%s] debugfs create mst_con_add failed, rc=%d\n",
		DP_ERR("[%s] debugfs max_pclk_khz failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("mst_con_remove", 0644, dir,
					debug, &mst_con_remove_fops);
	file = debugfs_create_u32("max_lclk_khz", 0644, dir,
			&debug->parser->max_lclk_khz);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DRM_ERROR("[%s] debugfs create mst_con_remove failed, rc=%d\n",
		DP_ERR("[%s] debugfs max_lclk_khz failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("hpd", 0644, dir,
					debug, &hpd_fops);
	file = debugfs_create_u32("lane_count", 0644, dir,
			&debug->panel->lane_count);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs hpd failed, rc=%d\n",
		DP_ERR("[%s] debugfs lane_count failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("connected", 0444, dir,
					debug, &connected_fops);
	file = debugfs_create_u32("link_bw_code", 0644, dir,
			&debug->panel->link_bw_code);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs connected failed, rc=%d\n",
		DP_ERR("[%s] debugfs link_bw_code failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("max_bw_code", 0644, dir,
			debug, &bw_code_fops);
	return rc;
}

static int dp_debug_init_hdcp(struct dp_debug_private *debug,
		struct dentry *dir)
{
	int rc = 0;
	struct dentry *file;

	file = debugfs_create_bool("hdcp_wait_sink_sync", 0644, dir,
			&debug->dp_debug.hdcp_wait_sink_sync);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs max_bw_code failed, rc=%d\n",
		DP_ERR("[%s] debugfs hdcp_wait_sink_sync failed, rc=%d\n",
		       DEBUG_NAME, rc);
		return rc;
	}

	file = debugfs_create_file("exe_mode", 0644, dir,
			debug, &exe_mode_fops);
	file = debugfs_create_bool("force_encryption", 0644, dir,
			&debug->dp_debug.force_encryption);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs register failed, rc=%d\n",
		DP_ERR("[%s] debugfs force_encryption failed, rc=%d\n",
		       DEBUG_NAME, rc);
		return rc;
	}

	return rc;
}

static int dp_debug_init_sink_caps(struct dp_debug_private *debug,
		struct dentry *dir)
{
	int rc = 0;
	struct dentry *file;

	file = debugfs_create_file("edid_modes", 0644, dir,
					debug, &edid_modes_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs create edid_modes failed, rc=%d\n",
		       DEBUG_NAME, rc);
		return rc;
	}

	file = debugfs_create_file("edid_modes_mst", 0644, dir,
					debug, &edid_modes_mst_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs create edid_modes_mst failed, rc=%d\n",
		       DEBUG_NAME, rc);
		return rc;
	}

	file = debugfs_create_file("edid", 0644, dir,
@@ -2028,7 +2046,7 @@ static int dp_debug_init(struct dp_debug *dp_debug)
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs edid failed, rc=%d\n",
			DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("dpcd", 0644, dir,
@@ -2037,160 +2055,266 @@ static int dp_debug_init(struct dp_debug *dp_debug)
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs dpcd failed, rc=%d\n",
			DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("tpg_ctrl", 0644, dir,
			debug, &tpg_fops);
	return rc;
}

static int dp_debug_init_status(struct dp_debug_private *debug,
		struct dentry *dir)
{
	int rc = 0;
	struct dentry *file;

	file = debugfs_create_file("dp_debug", 0444, dir,
				debug, &dp_debug_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs tpg failed, rc=%d\n",
		DP_ERR("[%s] debugfs create file failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("hdr", 0400, dir,
		debug, &hdr_fops);
	file = debugfs_create_file("connected", 0444, dir,
					debug, &connected_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs connected failed, rc=%d\n",
			DEBUG_NAME, rc);
		return rc;
	}

	file = debugfs_create_file("hdr", 0400, dir, debug, &hdr_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs hdr failed, rc=%d\n",
			DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("hdr_mst", 0400, dir,
		debug, &hdr_mst_fops);

	file = debugfs_create_file("hdr_mst", 0400, dir, debug, &hdr_mst_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs hdr_mst failed, rc=%d\n",
			DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("sim", 0644, dir,
		debug, &sim_fops);

	file = debugfs_create_file("hdcp", 0644, dir, debug, &hdcp_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs sim failed, rc=%d\n",
		DP_ERR("[%s] debugfs hdcp failed, rc=%d\n",
			DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("attention", 0644, dir,
		debug, &attention_fops);
	return rc;
}

static int dp_debug_init_sim(struct dp_debug_private *debug, struct dentry *dir)
{
	int rc = 0;
	struct dentry *file;

	file = debugfs_create_file("hpd", 0644, dir, debug, &hpd_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs attention failed, rc=%d\n",
		DP_ERR("[%s] debugfs hpd failed, rc=%d\n",
			DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("dump", 0644, dir,
		debug, &dump_fops);

	file = debugfs_create_file("sim", 0644, dir, debug, &sim_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs dump failed, rc=%d\n",
		DP_ERR("[%s] debugfs sim failed, rc=%d\n",
			DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("mst_mode", 0644, dir,
			debug, &mst_mode_fops);
	file = debugfs_create_file("attention", 0644, dir,
			debug, &attention_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs max_bw_code failed, rc=%d\n",
		DP_ERR("[%s] debugfs attention failed, rc=%d\n",
			DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("mst_sideband_mode", 0644, dir,
			debug, &mst_sideband_mode_fops);
	file = debugfs_create_bool("skip_uevent", 0644, dir,
			&debug->dp_debug.skip_uevent);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs max_bw_code failed, rc=%d\n",
		DP_ERR("[%s] debugfs skip_uevent failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("max_pclk_khz", 0644, dir,
			debug, &max_pclk_khz_fops);
	return rc;
}

static int dp_debug_init_dsc_fec(struct dp_debug_private *debug,
		struct dentry *dir)
{
	int rc = 0;
	struct dentry *file;

	file = debugfs_create_bool("dsc_feature_enable", 0644, dir,
			&debug->parser->dsc_feature_enable);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs max_pclk_khz failed, rc=%d\n",
		DP_ERR("[%s] debugfs dsc_feature failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_bool("force_encryption", 0644, dir,
			&debug->dp_debug.force_encryption);
	file = debugfs_create_bool("fec_feature_enable", 0644, dir,
			&debug->parser->fec_feature_enable);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs force_encryption failed, rc=%d\n",
		DP_ERR("[%s] debugfs fec_feature_enable failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_file("hdcp", 0644, dir,
					debug, &hdcp_fops);
	return rc;
}

static int dp_debug_init_tpg(struct dp_debug_private *debug, struct dentry *dir)
{
	int rc = 0;
	struct dentry *file;

	file = debugfs_create_file("tpg_ctrl", 0644, dir,
			debug, &tpg_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs hdcp failed, rc=%d\n",
		DP_ERR("[%s] debugfs tpg failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_bool("hdcp_wait_sink_sync", 0644, dir,
			&debug->dp_debug.hdcp_wait_sink_sync);
	return rc;
}

static int dp_debug_init_reg_dump(struct dp_debug_private *debug,
		struct dentry *dir)
{
	int rc = 0;
	struct dentry *file;

	file = debugfs_create_file("exe_mode", 0644, dir,
			debug, &exe_mode_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs hdcp_wait_sink_sync failed, rc=%d\n",
		DP_ERR("[%s] debugfs register failed, rc=%d\n",
		       DEBUG_NAME, rc);
		goto error_remove_dir;
		return rc;
	}

	file = debugfs_create_bool("dsc_feature_enable", 0644, dir,
			&debug->parser->dsc_feature_enable);
	file = debugfs_create_file("dump", 0644, dir,
		debug, &dump_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs dsc_feature failed, rc=%d\n",
		DP_ERR("[%s] debugfs dump failed, rc=%d\n",
			DEBUG_NAME, rc);
		return rc;
	}

	file = debugfs_create_bool("fec_feature_enable", 0644, dir,
			&debug->parser->fec_feature_enable);
	return rc;
}

static int dp_debug_init_feature_toggle(struct dp_debug_private *debug,
		struct dentry *dir)
{
	int rc = 0;
	struct dentry *file;

	file = debugfs_create_bool("ssc_enable", 0644, dir,
			&debug->pll->ssc_en);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs fec_feature_enable failed, rc=%d\n",
		DP_ERR("[%s] debugfs ssc_enable failed, rc=%d\n",
		       DEBUG_NAME, rc);
		return rc;
	}

	file = debugfs_create_file("widebus_mode", 0644, dir,
			debug, &widebus_mode_fops);
	file = debugfs_create_bool("widebus_mode", 0644, dir,
			&debug->parser->has_widebus);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs widebus failed, rc=%d\n",
		DP_ERR("[%s] debugfs widebus_mode failed, rc=%d\n",
		       DEBUG_NAME, rc);
		return rc;
	}

	file = debugfs_create_u32("max_lclk_khz", 0644, dir,
			&debug->parser->max_lclk_khz);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		DP_ERR("[%s] debugfs max_lclk_khz failed, rc=%d\n",
	return rc;
}

static int dp_debug_init(struct dp_debug *dp_debug)
{
	int rc = 0;
	struct dp_debug_private *debug = container_of(dp_debug,
		struct dp_debug_private, dp_debug);
	struct dentry *dir;

	dir = debugfs_create_dir(DEBUG_NAME, NULL);
	if (IS_ERR_OR_NULL(dir)) {
		if (!dir)
			rc = -EINVAL;
		else
			rc = PTR_ERR(dir);
		DP_ERR("[%s] debugfs create dir failed, rc = %d\n",
		       DEBUG_NAME, rc);
		goto error;
	}

	debug->root = dir;

	rc = dp_debug_init_status(debug, dir);
	if (rc)
		goto error_remove_dir;

	rc = dp_debug_init_sink_caps(debug, dir);
	if (rc)
		goto error_remove_dir;

	rc = dp_debug_init_mst(debug, dir);
	if (rc)
		goto error_remove_dir;

	rc = dp_debug_init_link(debug, dir);
	if (rc)
		goto error_remove_dir;

	rc = dp_debug_init_hdcp(debug, dir);
	if (rc)
		goto error_remove_dir;

	rc = dp_debug_init_sim(debug, dir);
	if (rc)
		goto error_remove_dir;

	rc = dp_debug_init_dsc_fec(debug, dir);
	if (rc)
		goto error_remove_dir;

	rc = dp_debug_init_tpg(debug, dir);
	if (rc)
		goto error_remove_dir;

	rc = dp_debug_init_reg_dump(debug, dir);
	if (rc)
		goto error_remove_dir;

	rc = dp_debug_init_feature_toggle(debug, dir);
	if (rc)
		goto error_remove_dir;

	return 0;

error_remove_dir:
	if (!file)
		rc = -EINVAL;
	debugfs_remove_recursive(dir);
error:
	return rc;
@@ -2229,7 +2353,7 @@ struct dp_debug *dp_debug_get(struct dp_debug_in *in)
	struct dp_debug *dp_debug;

	if (!in->dev || !in->panel || !in->hpd || !in->link ||
	    !in->catalog || !in->ctrl) {
	    !in->catalog || !in->ctrl || !in->pll) {
		DP_ERR("invalid input\n");
		rc = -EINVAL;
		goto error;
@@ -2251,6 +2375,7 @@ struct dp_debug *dp_debug_get(struct dp_debug_in *in)
	debug->catalog = in->catalog;
	debug->parser = in->parser;
	debug->ctrl = in->ctrl;
	debug->pll = in->pll;

	dp_debug = &debug->dp_debug;
	dp_debug->vdisplay = 0;
+7 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 */

#ifndef _DP_DEBUG_H_
@@ -12,6 +12,7 @@
#include "dp_usbpd.h"
#include "dp_aux.h"
#include "dp_display.h"
#include "dp_pll.h"

#define DP_WARN(fmt, ...)	DRM_WARN("[msm-dp-warn] "fmt, ##__VA_ARGS__)
#define DP_ERR(fmt, ...)	DRM_DEV_ERROR(NULL, "[msm-dp-error]" fmt, \
@@ -35,6 +36,7 @@
 * @tpg_state: specifies whether tpg feature is enabled
 * @max_pclk_khz: max pclk supported
 * @force_encryption: enable/disable forced encryption for HDCP 2.2
 * @skip_uevent: skip hotplug uevent to the user space
 * @hdcp_status: string holding hdcp status information
 * @dp_mst_connector_list: list containing all dp mst connectors
 * @mst_hpd_sim: specifies whether simulated hpd enabled
@@ -56,6 +58,7 @@ struct dp_debug {
	bool tpg_state;
	u32 max_pclk_khz;
	bool force_encryption;
	bool skip_uevent;
	char hdcp_status[SZ_128];
	struct dp_mst_connector dp_mst_connector_list;
	bool mst_hpd_sim;
@@ -78,6 +81,8 @@ struct dp_debug {
 * @connector: double pointer to display connector
 * @catalog: instance of catalog module
 * @parser: instance of parser module
 * @ctrl: instance of controller module
 * @pll: instance of pll module
 */
struct dp_debug_in {
	struct device *dev;
@@ -89,6 +94,7 @@ struct dp_debug_in {
	struct dp_catalog *catalog;
	struct dp_parser *parser;
	struct dp_ctrl *ctrl;
	struct dp_pll *pll;
};

/**
+52 −31
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include "dp_display.h"
#include "sde_hdcp.h"
#include "dp_debug.h"
#include "dp_pll.h"

#define DP_MST_DEBUG(fmt, ...) DP_DEBUG(fmt, ##__VA_ARGS__)

@@ -152,6 +153,7 @@ struct dp_display_private {
	struct dp_panel   *panel;
	struct dp_ctrl    *ctrl;
	struct dp_debug   *debug;
	struct dp_pll     *pll;

	struct dp_panel *active_panels[DP_STREAM_MAX];
	struct dp_hdcp hdcp;
@@ -493,7 +495,8 @@ static void dp_display_deinitialize_hdcp(struct dp_display_private *dp)
		return;
	}

	sde_dp_hdcp2p2_deinit(dp->hdcp.data);
	sde_hdcp_1x_deinit(dp->hdcp.dev[HDCP_VERSION_1X].fd);
	sde_dp_hdcp2p2_deinit(dp->hdcp.dev[HDCP_VERSION_2P2].fd);
}

static int dp_display_initialize_hdcp(struct dp_display_private *dp)
@@ -527,19 +530,18 @@ static int dp_display_initialize_hdcp(struct dp_display_private *dp)

	fd = sde_hdcp_1x_init(&hdcp_init_data);
	if (IS_ERR_OR_NULL(fd)) {
		DP_ERR("Error initializing HDCP 1.x\n");
		rc = -EINVAL;
		goto error;
		DP_DEBUG("Error initializing HDCP 1.x\n");
		return -EINVAL;
	}

	dp->hdcp.dev[HDCP_VERSION_1X].fd = fd;
	dp->hdcp.dev[HDCP_VERSION_1X].ops = sde_hdcp_1x_get(fd);
	dp->hdcp.dev[HDCP_VERSION_1X].ver = HDCP_VERSION_1X;
	DP_DEBUG("HDCP 1.3 initialized\n");
	DP_INFO("HDCP 1.3 initialized\n");

	fd = sde_dp_hdcp2p2_init(&hdcp_init_data);
	if (IS_ERR_OR_NULL(fd)) {
		DP_ERR("Error initializing HDCP 2.x\n");
		DP_DEBUG("Error initializing HDCP 2.x\n");
		rc = -EINVAL;
		goto error;
	}
@@ -547,11 +549,11 @@ static int dp_display_initialize_hdcp(struct dp_display_private *dp)
	dp->hdcp.dev[HDCP_VERSION_2P2].fd = fd;
	dp->hdcp.dev[HDCP_VERSION_2P2].ops = sde_dp_hdcp2p2_get(fd);
	dp->hdcp.dev[HDCP_VERSION_2P2].ver = HDCP_VERSION_2P2;
	DP_DEBUG("HDCP 2.2 initialized\n");
	DP_INFO("HDCP 2.2 initialized\n");

	return 0;
error:
	dp_display_deinitialize_hdcp(dp);
	sde_hdcp_1x_deinit(dp->hdcp.dev[HDCP_VERSION_1X].fd);

	return rc;
}
@@ -661,6 +663,7 @@ static void dp_display_send_hpd_event(struct dp_display_private *dp)
	envp[2] = bpp;
	envp[3] = pattern;
	envp[4] = NULL;
	if (!dp->debug->skip_uevent)
		kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE,
				envp);

@@ -1346,17 +1349,18 @@ static int dp_display_get_usb_extcon(struct dp_display_private *dp)

static void dp_display_deinit_sub_modules(struct dp_display_private *dp)
{
	dp_debug_put(dp->debug);
	dp_hpd_put(dp->hpd);
	dp_audio_put(dp->panel->audio);
	dp_ctrl_put(dp->ctrl);
	dp_link_put(dp->link);
	dp_panel_put(dp->panel);
	dp_aux_put(dp->aux);
	dp_link_put(dp->link);
	dp_power_put(dp->power);
	dp_pll_put(dp->pll);
	dp_aux_put(dp->aux);
	dp_catalog_put(dp->catalog);
	dp_parser_put(dp->parser);
	dp_hpd_put(dp->hpd);
	mutex_destroy(&dp->session_lock);
	dp_debug_put(dp->debug);
}

static int dp_init_sub_modules(struct dp_display_private *dp)
@@ -1374,6 +1378,9 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
	struct dp_debug_in debug_in = {
		.dev = dev,
	};
	struct dp_pll_in pll_in = {
		.pdev = dp->pdev,
	};

	mutex_init(&dp->session_lock);

@@ -1401,21 +1408,6 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
		goto error_catalog;
	}

	dp->power = dp_power_get(dp->parser);
	if (IS_ERR(dp->power)) {
		rc = PTR_ERR(dp->power);
		DP_ERR("failed to initialize power, rc = %d\n", rc);
		dp->power = NULL;
		goto error_power;
	}

	rc = dp->power->power_client_init(dp->power, &dp->priv->phandle,
		dp->dp_display.drm_dev);
	if (rc) {
		DP_ERR("Power client create failed\n");
		goto error_aux;
	}

	dp->aux = dp_aux_get(dev, &dp->catalog->aux, dp->parser,
			dp->aux_switch_node);
	if (IS_ERR(dp->aux)) {
@@ -1428,6 +1420,32 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
	rc = dp->aux->drm_aux_register(dp->aux);
	if (rc) {
		DP_ERR("DRM DP AUX register failed\n");
		goto error_pll;
	}

	pll_in.aux = dp->aux;
	pll_in.parser = dp->parser;

	dp->pll = dp_pll_get(&pll_in);
	if (IS_ERR(dp->pll)) {
		rc = PTR_ERR(dp->pll);
		DP_ERR("failed to initialize pll, rc = %d\n", rc);
		dp->pll = NULL;
		goto error_pll;
	}

	dp->power = dp_power_get(dp->parser, dp->pll);
	if (IS_ERR(dp->power)) {
		rc = PTR_ERR(dp->power);
		DP_ERR("failed to initialize power, rc = %d\n", rc);
		dp->power = NULL;
		goto error_power;
	}

	rc = dp->power->power_client_init(dp->power, &dp->priv->phandle,
		dp->dp_display.drm_dev);
	if (rc) {
		DP_ERR("Power client create failed\n");
		goto error_link;
	}

@@ -1503,6 +1521,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
	debug_in.catalog = dp->catalog;
	debug_in.parser = dp->parser;
	debug_in.ctrl = dp->ctrl;
	debug_in.pll = dp->pll;

	dp->debug = dp_debug_get(&debug_in);
	if (IS_ERR(dp->debug)) {
@@ -1540,10 +1559,12 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
error_panel:
	dp_link_put(dp->link);
error_link:
	dp_aux_put(dp->aux);
error_aux:
	dp_power_put(dp->power);
error_power:
	dp_pll_put(dp->pll);
error_pll:
	dp_aux_put(dp->aux);
error_aux:
	dp_catalog_put(dp->catalog);
error_catalog:
	dp_parser_put(dp->parser);
Loading