Kaynağa Gözat

disp: msm: dsi: move demura panel ID fetching to DTSI

Previous design had the demura panel ID passed in on the Linux kernel
command line. Update the DSI driver to read this information from the
DTSI instead.

Change-Id: I7697bb34a313f1837b80ba5ff78e720e8131a819
Signed-off-by: Christopher Braga <[email protected]>
Christopher Braga 5 yıl önce
ebeveyn
işleme
c8f9e73f0e
2 değiştirilmiş dosya ile 28 ekleme ve 21 silme
  1. 22 13
      msm/dsi/dsi_display.c
  2. 6 8
      msm/sde/sde_connector.c

+ 22 - 13
msm/dsi/dsi_display.c

@@ -618,6 +618,24 @@ static bool dsi_display_validate_reg_read(struct dsi_panel *panel)
 	return false;
 }
 
+static void dsi_display_parse_demura_data(struct dsi_display *display)
+{
+	int rc = 0;
+
+	display->panel_id = 0;
+	if (display->fw) {
+		DSI_INFO("FW definition unsupported for Demura panel data\n");
+		return;
+	}
+
+	rc = of_property_read_u64(display->pdev->dev.of_node,
+			"qcom,demura-panel-id", &display->panel_id);
+	if (rc)
+		DSI_INFO("No panel ID is present for this display\n");
+	else
+		DSI_INFO("panel id found: %lx\n", display->panel_id);
+}
+
 static void dsi_display_parse_te_data(struct dsi_display *display)
 {
 	struct platform_device *pdev;
@@ -2510,7 +2528,6 @@ static void dsi_display_parse_cmdline_topology(struct dsi_display *display,
 	char *sw_te = NULL;
 	unsigned long cmdline_topology = NO_OVERRIDE;
 	unsigned long cmdline_timing = NO_OVERRIDE;
-	unsigned long panel_id = NO_OVERRIDE;
 
 	if (display_type >= MAX_DSI_ACTIVE_DISPLAY) {
 		DSI_ERR("display_type=%d not supported\n", display_type);
@@ -2526,17 +2543,6 @@ static void dsi_display_parse_cmdline_topology(struct dsi_display *display,
 	if (sw_te)
 		display->sw_te_using_wd = true;
 
-	str = strnstr(boot_str, ":panelid", strlen(boot_str));
-	if (str) {
-		if (kstrtol(str + strlen(":panelid"), INT_BASE_10,
-				(unsigned long *)&panel_id)) {
-			DSI_INFO("panel id not found: %s\n", boot_str);
-		} else {
-			DSI_INFO("panel id found: %lx\n", panel_id);
-			display->panel_id = panel_id;
-		}
-	}
-
 	str = strnstr(boot_str, ":config", strlen(boot_str));
 	if (str) {
 		if (sscanf(str, ":config%lu", &cmdline_topology) != 1) {
@@ -4027,6 +4033,9 @@ static int dsi_display_parse_dt(struct dsi_display *display)
 			break;
 	}
 
+	/* Parse Demura data */
+	dsi_display_parse_demura_data(display);
+
 	DSI_DEBUG("success\n");
 error:
 	return rc;
@@ -8027,7 +8036,7 @@ static void dsi_display_panel_id_notification(struct dsi_display *display)
 		display->ctrl[0].ctrl->panel_id_cb.event_cb(
 			display->ctrl[0].ctrl->panel_id_cb.event_usr_ptr,
 			display->ctrl[0].ctrl->panel_id_cb.event_idx,
-			0, ((display->panel_id & 0xffffffff00000000) >> 31),
+			0, ((display->panel_id & 0xffffffff00000000) >> 32),
 			(display->panel_id & 0xffffffff), 0, 0);
 	}
 }

+ 6 - 8
msm/sde/sde_connector.c

@@ -484,23 +484,21 @@ static int sde_connector_handle_panel_id(uint32_t event_idx,
 	struct sde_connector *c_conn = usr;
 	int i;
 	u64 panel_id;
-	u8 arr[8], shift;
-	u64 mask = 0xff;
+	u8 msb_arr[8];
 
 	if (!c_conn)
 		return -EINVAL;
 
-	panel_id = (((u64)data0) << 31) | data1;
+	panel_id = (((u64)data0) << 32) | data1;
 	if (panel_id == ~0x0)
 		return 0;
 
-	for (i = 0; i < 8; i++) {
-		shift = 8 * i;
-		arr[7 - i] = (u8)((panel_id & (mask << shift)) >> shift);
-	}
+	for (i = 0; i < 8; i++)
+		msb_arr[i] = (panel_id >> (8 * (7 - i)));
+
 	/* update the panel id */
 	msm_property_set_blob(&c_conn->property_info,
-		  &c_conn->blob_panel_id, arr, sizeof(arr),
+		  &c_conn->blob_panel_id, &msb_arr,  sizeof(msb_arr),
 		  CONNECTOR_PROP_DEMURA_PANEL_ID);
 	sde_connector_register_event(&c_conn->base,
 			SDE_CONN_EVENT_PANEL_ID, NULL, c_conn);