소스 검색

disp: msm: dsi: register io resource collection VM event hook

Add support to read register ranges and IRQ lines that needs
isolation during VM switch in dsi ctrl and dsi phy.
Register for VM resource collection event providing the
callback function.

Change-Id: I5eae4699b0a97ffed438627ccea855c401b3fbeb
Signed-off-by: Jeykumar Sankaran <[email protected]>
Jeykumar Sankaran 5 년 전
부모
커밋
962fd4faca
5개의 변경된 파일101개의 추가작업 그리고 0개의 파일을 삭제
  1. 21 0
      msm/dsi/dsi_ctrl.c
  2. 10 0
      msm/dsi/dsi_ctrl.h
  3. 40 0
      msm/dsi/dsi_display.c
  4. 21 0
      msm/dsi/dsi_phy.c
  5. 9 0
      msm/dsi/dsi_phy.h

+ 21 - 0
msm/dsi/dsi_ctrl.c

@@ -1998,6 +1998,27 @@ static struct platform_driver dsi_ctrl_driver = {
 	},
 };
 
+int dsi_ctrl_get_io_resources(struct msm_io_res *io_res)
+{
+	int rc = 0;
+	struct dsi_ctrl_list_item *dsi_ctrl;
+
+	mutex_lock(&dsi_ctrl_list_lock);
+
+	list_for_each_entry(dsi_ctrl, &dsi_ctrl_list, list) {
+		rc = msm_dss_get_io_mem(dsi_ctrl->ctrl->pdev, &io_res->mem);
+		if (rc) {
+			DSI_CTRL_ERR(dsi_ctrl->ctrl,
+					"failed to get io mem, rc = %d\n", rc);
+			return rc;
+		}
+	}
+
+	mutex_unlock(&dsi_ctrl_list_lock);
+
+	return rc;
+}
+
 /**
  * dsi_ctrl_get() - get a dsi_ctrl handle from an of_node
  * @of_node:    of_node of the DSI controller.

+ 10 - 0
msm/dsi/dsi_ctrl.h

@@ -847,4 +847,14 @@ void dsi_ctrl_set_continuous_clk(struct dsi_ctrl *dsi_ctrl, bool enable);
  * @dsi_ctrl:                      DSI controller handle.
  */
 int dsi_ctrl_wait4dynamic_refresh_done(struct dsi_ctrl *ctrl);
+
+/**
+ * dsi_ctrl_get_io_resources() - reads associated register range
+ *
+ * @io_res:	 pointer to msm_io_res struct to populate the ranges
+ *
+ * Return: error code.
+ */
+int dsi_ctrl_get_io_resources(struct msm_io_res *io_res);
+
 #endif /* _DSI_CTRL_H_ */

+ 40 - 0
msm/dsi/dsi_display.c

@@ -5037,6 +5037,39 @@ error:
 	return rc;
 }
 
+static int dsi_display_get_io_resources(struct msm_io_res *io_res, void *data)
+{
+	int rc = 0;
+
+	rc = dsi_ctrl_get_io_resources(io_res);
+	if (rc)
+		goto end;
+
+	rc = dsi_phy_get_io_resources(io_res);
+end:
+	return rc;
+}
+
+static int dsi_display_pre_release(void *data)
+{
+	if (!data)
+		return -EINVAL;
+
+	dsi_display_ctrl_irq_update((struct dsi_display *)data, false);
+
+	return 0;
+}
+
+static int dsi_display_pre_acquire(void *data)
+{
+	if (!data)
+		return -EINVAL;
+
+	dsi_display_ctrl_irq_update((struct dsi_display *)data, true);
+
+	return 0;
+}
+
 /**
  * dsi_display_bind - bind dsi device with controlling device
  * @dev:        Pointer to base of platform device
@@ -5057,6 +5090,11 @@ static int dsi_display_bind(struct device *dev,
 	struct platform_device *pdev = to_platform_device(dev);
 	char *client1 = "dsi_clk_client";
 	char *client2 = "mdp_event_client";
+	struct msm_vm_ops vm_event_ops = {
+		.vm_get_io_resources = dsi_display_get_io_resources,
+		.vm_pre_hw_release = dsi_display_pre_release,
+		.vm_post_hw_acquire = dsi_display_pre_acquire,
+	};
 	int i, rc = 0;
 
 	if (!dev || !pdev || !master) {
@@ -5250,6 +5288,8 @@ static int dsi_display_bind(struct device *dev,
 	/* register te irq handler */
 	dsi_display_register_te_irq(display);
 
+	msm_register_vm_event(master, dev, &vm_event_ops, (void *)display);
+
 	goto error;
 
 error_host_deinit:

+ 21 - 0
msm/dsi/dsi_phy.c

@@ -116,6 +116,27 @@ int dsi_phy_get_version(struct msm_dsi_phy *phy)
 	return phy->ver_info->version;
 }
 
+int dsi_phy_get_io_resources(struct msm_io_res *io_res)
+{
+	struct dsi_phy_list_item *dsi_phy;
+	int rc = 0;
+
+	mutex_lock(&dsi_phy_list_lock);
+
+	list_for_each_entry(dsi_phy, &dsi_phy_list, list) {
+		rc = msm_dss_get_io_mem(dsi_phy->phy->pdev, &io_res->mem);
+		if (rc) {
+			DSI_PHY_ERR(dsi_phy->phy,
+					"failed to get io mem, rc = %d\n", rc);
+			return rc;
+		}
+	}
+
+	mutex_unlock(&dsi_phy_list_lock);
+
+	return rc;
+}
+
 static int dsi_phy_regmap_init(struct platform_device *pdev,
 			       struct msm_dsi_phy *phy)
 {

+ 9 - 0
msm/dsi/dsi_phy.h

@@ -356,4 +356,13 @@ int dsi_phy_dyn_refresh_cache_phy_timings(struct msm_dsi_phy *phy,
  */
 void dsi_phy_set_continuous_clk(struct msm_dsi_phy *phy, bool enable);
 
+/**
+ * dsi_phy_get_io_resources() - reads associated register range
+ *
+ * @io_res:	 pointer to msm_io_res struct to populate the ranges
+ *
+ * Return: error code.
+ */
+int dsi_phy_get_io_resources(struct msm_io_res *io_res);
+
 #endif /* _DSI_PHY_H_ */