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 <pdhaval@codeaurora.org>
This commit is contained in:
Dhaval Patel 2020-04-22 20:29:00 -07:00
parent a590ad8a8a
commit d4566743e0
3 changed files with 29 additions and 16 deletions

View File

@ -1927,6 +1927,30 @@ static const struct component_master_ops msm_drm_ops = {
.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:
*/
@ -1936,6 +1960,10 @@ static int msm_pdev_probe(struct platform_device *pdev)
int ret;
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);
if (ret)
return ret;

View File

@ -928,11 +928,7 @@ int sde_rsc_client_state_update(struct sde_rsc_client *caller_client,
caller_client->crtc_id = crtc_id;
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);
goto end;
}
@ -1636,10 +1632,6 @@ static int sde_rsc_bind(struct device *dev,
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,
rsc->drv_io.len);
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");
return;
}
mutex_lock(&rsc->client_lock);
rsc->master_drm = NULL;
mutex_unlock(&rsc->client_lock);
}
static const struct component_ops sde_rsc_comp_ops = {

View File

@ -184,8 +184,6 @@ struct sde_rsc_bw_config {
* mode_threshold_time_ns: time to wake TCS in mode-0, must be greater than
* backoff time
* 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_waitq: Queue to wait for the vsync.
* bw_config: check sde_rsc_bw_config structure description.
@ -228,7 +226,6 @@ struct sde_rsc_priv {
u32 mode_threshold_time_ns;
u32 time_slot_0_ns;
struct drm_device *master_drm;
atomic_t rsc_vsync_wait;
wait_queue_head_t rsc_vsync_waitq;