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

Commit 362a4d38 authored by Chandan Uddaraju's avatar Chandan Uddaraju
Browse files

mdss: display-port: add support to use common EDID parser



For display-port, use the existing EDID parser
that is used by HDMI.

Change-Id: I64c7fe03126d33eb0436c67eba9147dec1169e4d
Signed-off-by: default avatarChandan Uddaraju <chandanu@codeaurora.org>
parent 3db8c288
Loading
Loading
Loading
Loading
+101 −0
Original line number Diff line number Diff line
@@ -41,6 +41,41 @@
#define VDDA_UA_ON_LOAD		100000	/* uA units */
#define VDDA_UA_OFF_LOAD	100		/* uA units */

static char edid_buf1[] = {
	0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
	0x22, 0xf0, 0x52, 0x29, 0x01, 0x01, 0x01, 0x01,
	0x16, 0x16, 0x01, 0x03, 0x80, 0x30, 0x1b, 0x78,
	0x2e, 0xee, 0x95, 0xa3, 0x54, 0x4c, 0x99, 0x26,
	0x0f, 0x50, 0x54, 0xa1, 0x08, 0x00, 0xd1, 0xc0,
	0x81, 0xc0, 0xa9, 0xc0, 0xb3, 0x00, 0x95, 0x00,
	0x81, 0x40, 0x81, 0x80, 0x01, 0x01, 0x02, 0x3a,
	0x80, 0x18, 0x71, 0x38, 0x2d, 0x40, 0x58, 0x2c,
	0x45, 0x00, 0xdb, 0x0b, 0x11, 0x00, 0x00, 0x1e,
	0x00, 0x00, 0x00, 0xfd, 0x00, 0x32, 0x4c, 0x18,
	0x5e, 0x11, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20,
	0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x48,
	0x50, 0x20, 0x5a, 0x52, 0x32, 0x32, 0x34, 0x30,
	0x77, 0x0a, 0x20, 0x20, 0x00, 0x00, 0x00, 0xff,
	0x00, 0x43, 0x4e, 0x34, 0x32, 0x32, 0x32, 0x30,
	0x30, 0x33, 0x46, 0x0a, 0x20, 0x20, 0x01, 0xb1,

	0x02, 0x03, 0x17, 0xb1, 0x4c, 0x90, 0x1f, 0x05,
	0x14, 0x04, 0x13, 0x03, 0x02, 0x07, 0x06, 0x12,
	0x01, 0x65, 0x03, 0x0c, 0x00, 0x10, 0x00, 0x02,
	0x3a, 0x80, 0x18, 0x71, 0x38, 0x2d, 0x40, 0x58,
	0x2c, 0x45, 0x00, 0xdb, 0x0b, 0x11, 0x00, 0x00,
	0x1e, 0x02, 0x3a, 0x80, 0xd0, 0x72, 0x38, 0x2d,
	0x40, 0x10, 0x2c, 0x45, 0x80, 0xdb, 0x0b, 0x11,
	0x00, 0x00, 0x1e, 0x01, 0x1d, 0x00, 0x72, 0x51,
	0xd0, 0x1e, 0x20, 0x6e, 0x28, 0x55, 0x00, 0xdb,
	0x0b, 0x11, 0x00, 0x00, 0x1e, 0x01, 0x1d, 0x00,
	0xbc, 0x52, 0xd0, 0x1e, 0x20, 0xb8, 0x28, 0x55,
	0x40, 0xdb, 0x0b, 0x11, 0x00, 0x00, 0x1e, 0x8c,
	0x0a, 0xd0, 0x8a, 0x20, 0xe0, 0x2d, 0x10, 0x10,
	0x3e, 0x96, 0x00, 0xdb, 0x0b, 0x11, 0x00, 0x00,
	0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b
};


static void mdss_dp_put_dt_clk_data(struct device *dev,
@@ -1037,6 +1072,41 @@ int mdss_dp_off(struct mdss_panel_data *pdata)
	return 0;
}

static int mdss_dp_edid_init(struct mdss_panel_data *pdata)
{
	struct mdss_dp_drv_pdata *dp_drv = NULL;
	struct hdmi_edid_init_data edid_init_data = {0};
	void *edid_data;

	if (!pdata) {
		pr_err("Invalid input data\n");
		return -EINVAL;
	}

	dp_drv = container_of(pdata, struct mdss_dp_drv_pdata,
			panel_data);

	dp_drv->max_pclk_khz = DP_MAX_PIXEL_CLK_KHZ;
	edid_init_data.kobj = dp_drv->kobj;
	edid_init_data.ds_data = dp_drv->ds_data;
	edid_init_data.max_pclk_khz = dp_drv->max_pclk_khz;

	edid_data = hdmi_edid_init(&edid_init_data);
	if (!edid_data) {
		DEV_ERR("%s: edid init failed\n", __func__);
		return -ENODEV;
	}

	edid_init_data.buf = edid_init_data.buf;
	edid_init_data.buf_size = edid_init_data.buf_size;

	/* Use the existing EDID buffer for 1080p */
	memcpy(edid_init_data.buf, edid_buf1, sizeof(edid_buf1));
	dp_drv->panel_data.panel_info.edid_data = edid_data;

	return 0;
}

static int mdss_dp_host_init(struct mdss_panel_data *pdata)
{
	struct mdss_dp_drv_pdata *dp_drv = NULL;
@@ -1076,8 +1146,16 @@ static int mdss_dp_host_init(struct mdss_panel_data *pdata)
	       mdss_dp_get_ctrl_hw_version(&dp_drv->ctrl_io),
	       mdss_dp_get_phy_hw_version(&dp_drv->phy_io));

	ret = hdmi_edid_parser(dp_drv->panel_data.panel_info.edid_data);
	if (ret) {
		DEV_ERR("%s: edid parse failed\n", __func__);
		goto edid_parser_error;
	}

	return ret;

edid_parser_error:
	mdss_dp_clk_ctrl(dp_drv, DP_CORE_PM, false);
clk_error:
	mdss_dp_regulator_ctrl(dp_drv, false);
vreg_error:
@@ -1088,8 +1166,19 @@ static int mdss_dp_event_handler(struct mdss_panel_data *pdata,
				  int event, void *arg)
{
	int rc = 0;
	struct fb_info *fbi;
	struct mdss_dp_drv_pdata *dp = NULL;

	if (!pdata) {
		pr_err("%s: Invalid input data\n", __func__);
		return -EINVAL;
	}

	pr_debug("event=%d\n", event);

	dp = container_of(pdata, struct mdss_dp_drv_pdata,
				panel_data);

	switch (event) {
	case MDSS_EVENT_UNBLANK:
		rc = mdss_dp_on(pdata);
@@ -1097,6 +1186,18 @@ static int mdss_dp_event_handler(struct mdss_panel_data *pdata,
	case MDSS_EVENT_PANEL_OFF:
		rc = mdss_dp_off(pdata);
		break;
	case MDSS_EVENT_FB_REGISTERED:
		fbi = (struct fb_info *)arg;
		if (!fbi || !fbi->dev)
			break;

		dp->kobj = &fbi->dev->kobj;
		dp->fb_node = fbi->node;
		mdss_dp_edid_init(pdata);
		break;
	default:
		pr_debug("%s: unhandled event=%d\n", __func__, event);
		break;
	}
	return rc;
}
+5 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <linux/usb/usbpd.h>

#include "mdss_hdmi_util.h"
#include "mdss_hdmi_edid.h"
#include "video/msm_hdmi_modes.h"
#include "mdss.h"
#include "mdss_panel.h"
@@ -235,7 +236,7 @@ struct dp_alt_mode {
#define DP_LINK_RATE_MAX	DP_LINK_RATE_540

#define DP_LINK_RATE_MULTIPLIER	27000000

#define DP_MAX_PIXEL_CLK_KHZ	675000
struct dpcd_cap {
	char major;
	char minor;
@@ -429,6 +430,9 @@ struct mdss_dp_drv_pdata {
	spinlock_t event_lock;
	spinlock_t lock;
	struct hdmi_util_ds_data ds_data;
	struct kobject *kobj;
	u32 max_pclk_khz;
	int fb_node;
};

static inline const char *__mdss_dp_pm_name(enum dp_pm_type module)