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

Commit 7ef57f9e authored by Rahul Sharma's avatar Rahul Sharma Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm/shd : add default edid



Add a default EDID buffer to the SD connector. Update the
corresponding panel name and checksum to uniquely identify
this buffer.

Change-Id: Ie9564bfe48dd3b325a258d292bd71e0a05c7a529
Signed-off-by: default avatarRahul Sharma <rahsha@codeaurora.org>
parent 2e2aace7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ Required properties:
			qcom,mode-y-offset: A u32 property of y offset.
			qcom,mode-width: A u32 property of width.
			qcom,mode-height: A u32 property of height, including line padding.
- qcom,shared-display-name:  A string used as a descriptive name of the shared display.


qcom,shared-display-base properties:
@@ -71,6 +72,7 @@ Example:
		compatible = "qcom,shared-display";
		qcom,shared-display-base = <&sde_sh_base0>;
		qcom,blend-stage-range = <0 5>;
		qcom,shared-display-name = "shared-disp-0";
		qcom,shared-display-src-mode {
			qcom,mode-h-active = <1920>;
			qcom,mode-v-active = <2160>;
@@ -87,6 +89,7 @@ Example:
		compatible = "qcom,shared-display";
		qcom,shared-display-base = <&sde_sh_base0>;
		qcom,blend-stage-range = <5 5>;
		qcom,shared-display-name = "shared-disp-1";
		qcom,shared-display-src-mode {
			qcom,mode-h-active = <1920>;
			qcom,mode-v-active = <2160>;
+61 −4
Original line number Diff line number Diff line
@@ -550,13 +550,58 @@ enum drm_connector_status shd_connector_detect(struct drm_connector *conn,
end:
	return status;
}
static int shd_drm_update_edid_name(struct edid *edid, const char *name)
{
	u8 *dtd = (u8 *)&edid->detailed_timings[3];
	u8 standard_header[] = {0x00, 0x00, 0x00, 0xFE, 0x00};
	u32 dtd_size = 18;
	u32 header_size = sizeof(standard_header);

	if (!name)
		return -EINVAL;

	/* Fill standard header */
	memcpy(dtd, standard_header, header_size);

	dtd_size -= header_size;
	dtd_size = min_t(u32, dtd_size, strlen(name));

	memcpy(dtd + header_size, name, dtd_size);

	return 0;
}

static void shd_drm_update_checksum(struct edid *edid)
{
	u8 *data = (u8 *)edid;
	u32 i, sum = 0;

	for (i = 0; i < EDID_LENGTH - 1; i++)
		sum += data[i];

	edid->checksum = 0x100 - (sum & 0xFF);
}

static int shd_connector_get_modes(struct drm_connector *connector,
		void *display)
		void *data)
{
	struct drm_display_mode drm_mode;
	struct shd_display *disp = display;
	struct shd_display *disp = data;
	struct drm_display_mode *m;
	u32 count = 0;
	int rc;
	u32 edid_size;
	struct edid edid;
	const u8 edid_buf[EDID_LENGTH] = {
		0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x44, 0x6D,
		0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1B, 0x10, 0x01, 0x03,
		0x80, 0x50, 0x2D, 0x78, 0x0A, 0x0D, 0xC9, 0xA0, 0x57, 0x47,
		0x98, 0x27, 0x12, 0x48, 0x4C, 0x00, 0x00, 0x00, 0x01, 0x01,
		0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
		0x01, 0x01, 0x01, 0x01,
	};
	edid_size = min_t(u32, sizeof(edid), EDID_LENGTH);
	memcpy(&edid, edid_buf, edid_size);

	memcpy(&drm_mode, &disp->base->mode, sizeof(drm_mode));

@@ -573,7 +618,15 @@ static int shd_connector_get_modes(struct drm_connector *connector,
	m = drm_mode_duplicate(disp->drm_dev, &drm_mode);
	drm_mode_set_name(m);
	drm_mode_probed_add(connector, m);

	rc = shd_drm_update_edid_name(&edid, disp->name);
	if (rc) {
		count = 0;
		return count;
	}
	shd_drm_update_checksum(&edid);
	rc = drm_mode_connector_update_edid_property(connector, &edid);
	if (rc)
		count = 0;
	return 1;
}

@@ -980,7 +1033,6 @@ static int shd_parse_display(struct shd_display *display)
	u32 range[2];
	int rc;

	display->name = of_node->full_name;

	display->base_of = of_parse_phandle(of_node,
		"qcom,shared-display-base", 0);
@@ -1051,6 +1103,11 @@ static int shd_parse_display(struct shd_display *display)
	if (rc)
		SDE_ERROR("Failed to parse blend stage range\n");

	display->name = of_get_property(of_node,
		"qcom,shared-display-name", NULL);
	if (!display->name)
		display->name = of_node->full_name;

	display->src.w = src_w;
	display->src.h = src_h;
	display->roi.x = dst_x;