Browse Source

disp: msm: avoid msm_drv probe if sde_rsc is not probed yet

Msm_drv device node has dependency on sde_rsc device
node for power resource enable if sde_rsc device
device is enabled. This change moves the msm_drv device
to probe defer state during component addition if
sde_rsc device is not probed yet. It also removes
the master_drm device node access from sde_rsc device.

Change-Id: Ibb7457279b3376f45e82e5c9373aabd84a37ed36
Signed-off-by: Dhaval Patel <[email protected]>
Dhaval Patel 5 years ago
parent
commit
d4566743e0
3 changed files with 29 additions and 16 deletions
  1. 28 0
      msm/msm_drv.c
  2. 1 13
      msm/sde_rsc.c
  3. 0 3
      msm/sde_rsc_priv.h

+ 28 - 0
msm/msm_drv.c

@@ -1927,6 +1927,30 @@ static const struct component_master_ops msm_drm_ops = {
 	.unbind = msm_drm_unbind,
 	.unbind = msm_drm_unbind,
 };
 };
 
 
+static int msm_drm_component_dependency_check(struct device *dev)
+{
+	struct device_node *node;
+	struct device_node *np = dev->of_node;
+	unsigned int i;
+
+	if (!of_device_is_compatible(dev->of_node, "qcom,sde-kms"))
+		return 0;
+
+	for (i = 0; ; i++) {
+		node = of_parse_phandle(np, "connectors", i);
+		if (!node)
+			break;
+
+		if (of_node_name_eq(node,"qcom,sde_rscc") &&
+		    of_device_is_available(node) &&
+		    !of_node_check_flag(node, OF_POPULATED)) {
+			dev_err(dev, "qcom,sde_rscc device not probed yet\n");
+			return -EPROBE_DEFER;
+		}
+	}
+
+	return 0;
+}
 /*
 /*
  * Platform driver:
  * Platform driver:
  */
  */
@@ -1936,6 +1960,10 @@ static int msm_pdev_probe(struct platform_device *pdev)
 	int ret;
 	int ret;
 	struct component_match *match = NULL;
 	struct component_match *match = NULL;
 
 
+	ret = msm_drm_component_dependency_check(&pdev->dev);
+	if (ret)
+		return ret;
+
 	ret = msm_drm_device_init(pdev, &msm_driver);
 	ret = msm_drm_device_init(pdev, &msm_driver);
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;

+ 1 - 13
msm/sde_rsc.c

@@ -928,11 +928,7 @@ int sde_rsc_client_state_update(struct sde_rsc_client *caller_client,
 	caller_client->crtc_id = crtc_id;
 	caller_client->crtc_id = crtc_id;
 	caller_client->current_state = state;
 	caller_client->current_state = state;
 
 
-	if (rsc->master_drm == NULL) {
-		pr_err("invalid master component binding\n");
-		rc = -EINVAL;
-		goto end;
-	} else if ((rsc->current_state == state) && !config) {
+	if ((rsc->current_state == state) && !config) {
 		pr_debug("no state change: %d\n", state);
 		pr_debug("no state change: %d\n", state);
 		goto end;
 		goto end;
 	}
 	}
@@ -1636,10 +1632,6 @@ static int sde_rsc_bind(struct device *dev,
 		return -EINVAL;
 		return -EINVAL;
 	}
 	}
 
 
-	mutex_lock(&rsc->client_lock);
-	rsc->master_drm = drm;
-	mutex_unlock(&rsc->client_lock);
-
 	sde_dbg_reg_register_base(SDE_RSC_DRV_DBG_NAME, rsc->drv_io.base,
 	sde_dbg_reg_register_base(SDE_RSC_DRV_DBG_NAME, rsc->drv_io.base,
 							rsc->drv_io.len);
 							rsc->drv_io.len);
 	sde_dbg_reg_register_base(SDE_RSC_WRAPPER_DBG_NAME,
 	sde_dbg_reg_register_base(SDE_RSC_WRAPPER_DBG_NAME,
@@ -1669,10 +1661,6 @@ static void sde_rsc_unbind(struct device *dev,
 		pr_err("invalid display rsc\n");
 		pr_err("invalid display rsc\n");
 		return;
 		return;
 	}
 	}
-
-	mutex_lock(&rsc->client_lock);
-	rsc->master_drm = NULL;
-	mutex_unlock(&rsc->client_lock);
 }
 }
 
 
 static const struct component_ops sde_rsc_comp_ops = {
 static const struct component_ops sde_rsc_comp_ops = {

+ 0 - 3
msm/sde_rsc_priv.h

@@ -184,8 +184,6 @@ struct sde_rsc_bw_config {
  * mode_threshold_time_ns: time to wake TCS in mode-0, must be greater than
  * mode_threshold_time_ns: time to wake TCS in mode-0, must be greater than
  *			backoff time
  *			backoff time
  * time_slot_0_ns:	time for sleep & wake TCS in mode-1
  * time_slot_0_ns:	time for sleep & wake TCS in mode-1
- * master_drm:		Primary client waits for vsync on this drm object based
- *			on crtc id
  * rsc_vsync_wait:   Refcount to indicate if we have to wait for the vsync.
  * rsc_vsync_wait:   Refcount to indicate if we have to wait for the vsync.
  * rsc_vsync_waitq:   Queue to wait for the vsync.
  * rsc_vsync_waitq:   Queue to wait for the vsync.
  * bw_config:		check sde_rsc_bw_config structure description.
  * bw_config:		check sde_rsc_bw_config structure description.
@@ -228,7 +226,6 @@ struct sde_rsc_priv {
 	u32 mode_threshold_time_ns;
 	u32 mode_threshold_time_ns;
 	u32 time_slot_0_ns;
 	u32 time_slot_0_ns;
 
 
-	struct drm_device *master_drm;
 	atomic_t rsc_vsync_wait;
 	atomic_t rsc_vsync_wait;
 	wait_queue_head_t rsc_vsync_waitq;
 	wait_queue_head_t rsc_vsync_waitq;