Kaynağa Gözat

disp: msm: dsi: register clk cb in display prepare

The clk_ctrl_cb and post_cmd_tx_workq callbacks are assigned
to individual ctrl during display bind. In case of dual display
with shared DSI, where primary display has ctrl0 & ctrl1 and
secondary display has ctrl1, the callbacks of ctrl1 of the
primary display gets overwritten with the callbacks of ctrl1
of the secondary display.

In the shared DSI design, only one display will be active at
a time. So, move the callback assignment of clk_ctrl_cb and
post_cmd_tx_workq to display prepare to fix this.

Change-Id: Ic02fa2f00c430fd5759400e06d82d004d4f7cba4
Signed-off-by: Anand Tarakh <[email protected]>
Anand Tarakh 2 yıl önce
ebeveyn
işleme
d83f4c93b2
1 değiştirilmiş dosya ile 34 ekleme ve 23 silme
  1. 34 23
      msm/dsi/dsi_display.c

+ 34 - 23
msm/dsi/dsi_display.c

@@ -5590,6 +5590,38 @@ static int dsi_display_pre_acquire(void *data)
 	return 0;
 }
 
+static int dsi_display_init_ctrl(struct dsi_display *display)
+{
+	struct dsi_display_ctrl *display_ctrl;
+	int i, rc = 0;
+	struct clk_ctrl_cb clk_cb;
+
+	clk_cb.priv = display;
+	clk_cb.dsi_clk_cb = dsi_display_clk_ctrl_cb;
+
+	display_for_each_ctrl(i, display) {
+		display_ctrl = &display->ctrl[i];
+
+		display_ctrl->ctrl->post_cmd_tx_workq = display->post_cmd_tx_workq;
+
+		rc = dsi_ctrl_clk_cb_register(display_ctrl->ctrl, &clk_cb);
+		if (rc) {
+			DSI_ERR("[%s] failed to register ctrl clk_cb[%d], rc=%d\n",
+				display->name, i, rc);
+				return rc;
+		}
+
+		rc = dsi_phy_clk_cb_register(display_ctrl->phy, &clk_cb);
+		if (rc) {
+			DSI_ERR("[%s] failed to register phy clk_cb[%d], rc=%d\n",
+					display->name, i, rc);
+			return rc;
+		}
+	}
+
+	return rc;
+}
+
 /**
  * dsi_display_bind - bind dsi device with controlling device
  * @dev:        Pointer to base of platform device
@@ -5605,7 +5637,6 @@ static int dsi_display_bind(struct device *dev,
 	struct drm_device *drm;
 	struct dsi_display *display;
 	struct dsi_clk_info info;
-	struct clk_ctrl_cb clk_cb;
 	void *handle = NULL;
 	struct platform_device *pdev = to_platform_device(dev);
 	char *client1 = "dsi_clk_client";
@@ -5686,7 +5717,6 @@ static int dsi_display_bind(struct device *dev,
 			goto error_ctrl_deinit;
 		}
 
-		display_ctrl->ctrl->post_cmd_tx_workq = display->post_cmd_tx_workq;
 		memcpy(&info.c_clks[i],
 				(&display_ctrl->ctrl->clk_info.core_clks),
 				sizeof(struct dsi_core_clk_info));
@@ -5742,27 +5772,6 @@ static int dsi_display_bind(struct device *dev,
 		display->mdp_clk_handle = handle;
 	}
 
-	clk_cb.priv = display;
-	clk_cb.dsi_clk_cb = dsi_display_clk_ctrl_cb;
-
-	display_for_each_ctrl(i, display) {
-		display_ctrl = &display->ctrl[i];
-
-		rc = dsi_ctrl_clk_cb_register(display_ctrl->ctrl, &clk_cb);
-		if (rc) {
-			DSI_ERR("[%s] failed to register ctrl clk_cb[%d], rc=%d\n",
-			       display->name, i, rc);
-			goto error_ctrl_deinit;
-		}
-
-		rc = dsi_phy_clk_cb_register(display_ctrl->phy, &clk_cb);
-		if (rc) {
-			DSI_ERR("[%s] failed to register phy clk_cb[%d], rc=%d\n",
-			       display->name, i, rc);
-			goto error_ctrl_deinit;
-		}
-	}
-
 	dsi_display_update_byte_intf_div(display);
 	rc = dsi_display_mipi_host_init(display);
 	if (rc) {
@@ -8202,6 +8211,8 @@ int dsi_display_prepare(struct dsi_display *display)
 	display->hw_ownership = true;
 	mode = display->panel->cur_mode;
 
+	dsi_display_init_ctrl(display);
+
 	dsi_display_set_ctrl_esd_check_flag(display, false);
 
 	/* Set up ctrl isr before enabling core clk */