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

Commit 8345c679 authored by Ajay Singh Parmar's avatar Ajay Singh Parmar
Browse files

drm/msm/dsi-staging: add default edid



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

CRs-Fixed: 2399075
Change-Id: Ic86873d7725ebb93f69ecc7f9e78cba23ffcddbe
Signed-off-by: default avatarAjay Singh Parmar <aparmar@codeaurora.org>
parent 71f4785d
Loading
Loading
Loading
Loading
+63 −4
Original line number Diff line number Diff line
@@ -623,13 +623,61 @@ void dsi_connector_put_modes(struct drm_connector *connector,
	dsi_display->modes = NULL;
}

int dsi_connector_get_modes(struct drm_connector *connector,
		void *display)

static int dsi_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 dsi_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);
}

int dsi_connector_get_modes(struct drm_connector *connector, void *data)
{
	u32 count = 0;
	int rc, i;
	u32 count = 0, edid_size;
	struct dsi_display_mode *modes = NULL;
	struct drm_display_mode drm_mode;
	int rc, i;
	struct dsi_display *display = data;
	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, 0x02, 0x3A, 0x80, 0x18, 0x71, 0x38,
		0x2D, 0x40, 0x58, 0x2C, 0x45, 0x00, 0x50, 0x1D, 0x74, 0x00,
		0x00, 0x1E,
	};

	edid_size = min_t(u32, sizeof(edid), EDID_LENGTH);

	memcpy(&edid, edid_buf, edid_size);

	if (sde_connector_get_panel(connector)) {
		/*
@@ -669,6 +717,17 @@ int dsi_connector_get_modes(struct drm_connector *connector,
		m->height_mm = connector->display_info.height_mm;
		drm_mode_probed_add(connector, m);
	}

	rc = dsi_drm_update_edid_name(&edid, display->panel->name);
	if (rc) {
		count = 0;
		goto end;
	}

	dsi_drm_update_checksum(&edid);
	rc =  drm_connector_update_edid_property(connector, &edid);
	if (rc)
		count = 0;
end:
	pr_debug("MODE COUNT =%d\n\n", count);
	return count;