diff options
| author | Rahul Sharma <rahsha@codeaurora.org> | 2019-04-29 19:52:34 +0530 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-05-13 22:09:04 -0700 |
| commit | 592adc48492083ee94921e48da73473888949561 (patch) | |
| tree | b3b47f0e755d7354716687822224671281df1199 | |
| parent | 77c04577d922e31af38b247f5ce8fa162bbab792 (diff) | |
drm/msm: ensure display driver probe completion
This change is done so that in non display platform
indefinite wait is not introduced, however for platforms where
display driver is probed asynchronously we still
wait for completion.
Change-Id: I14932ee2c0e52330975529ca0be34b6e2521d05e
Signed-off-by: Rahul Sharma <rahsha@codeaurora.org>
| -rw-r--r-- | drivers/gpu/drm/msm/ekms/edrm_drv.c | 25 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/msm_drv.c | 25 |
2 files changed, 46 insertions, 4 deletions
diff --git a/drivers/gpu/drm/msm/ekms/edrm_drv.c b/drivers/gpu/drm/msm/ekms/edrm_drv.c index 3711b4680d0a..144dd231e428 100644 --- a/drivers/gpu/drm/msm/ekms/edrm_drv.c +++ b/drivers/gpu/drm/msm/ekms/edrm_drv.c @@ -24,6 +24,7 @@ #include "edrm_kms.h" static struct completion wait_display_completion; +static bool msm_edrm_probed; static int msm_edrm_unload(struct drm_device *dev) { @@ -330,6 +331,8 @@ static int msm_pdev_edrm_probe(struct platform_device *pdev) struct msm_drm_private *master_priv; struct msm_kms *master_kms; + msm_edrm_probed = true; + /* main DRM's minor ID is zero */ minor = drm_minor_acquire(0); if (IS_ERR(minor)) { @@ -411,6 +414,20 @@ static const struct of_device_id dt_match[] = { }; MODULE_DEVICE_TABLE(of, dt_match); +static int find_match(struct device *dev, void *data) +{ + struct device_driver *drv = data; + + return drv->bus->match(dev, drv); +} + +static bool find_device(struct platform_driver *pdrv) +{ + struct device_driver *drv = &pdrv->driver; + + return bus_for_each_dev(drv->bus, NULL, drv, find_match); +} + static struct platform_driver msm_platform_driver = { .probe = msm_pdev_edrm_probe, .remove = msm_pdev_edrm_remove, @@ -438,9 +455,13 @@ static void __exit msm_edrm_unregister(void) static int __init msm_edrm_late_register(void) { - pr_debug("wait for eDRM display probe completion\n"); - wait_for_completion(&wait_display_completion); + struct platform_driver *pdrv; + pdrv = &msm_platform_driver; + if (msm_edrm_probed || find_device(pdrv)) { + pr_debug("wait for eDRM display probe completion\n"); + wait_for_completion(&wait_display_completion); + } return 0; } diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index f36b992690c4..80dc06b4a884 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -48,6 +48,7 @@ #include "msm_mmu.h" static struct completion wait_display_completion; +static bool msm_drm_probed; static void msm_drm_helper_hotplug_event(struct drm_device *dev) { @@ -2369,6 +2370,8 @@ static int msm_pdev_probe(struct platform_device *pdev) int ret; struct component_match *match = NULL; + msm_drm_probed = true; + #ifdef CONFIG_OF add_components(&pdev->dev, &match, "connectors"); #ifndef CONFIG_QCOM_KGSL @@ -2454,6 +2457,20 @@ static const struct of_device_id dt_match[] = { }; MODULE_DEVICE_TABLE(of, dt_match); +static int find_match(struct device *dev, void *data) +{ + struct device_driver *drv = data; + + return drv->bus->match(dev, drv); +} + +static bool find_device(struct platform_driver *pdrv) +{ + struct device_driver *drv = &pdrv->driver; + + return bus_for_each_dev(drv->bus, NULL, drv, find_match); +} + static struct platform_driver msm_platform_driver = { .probe = msm_pdev_probe, .remove = msm_pdev_remove, @@ -2502,9 +2519,13 @@ static void __exit msm_drm_unregister(void) static int __init msm_drm_late_register(void) { - pr_debug("wait for display probe completion\n"); - wait_for_completion(&wait_display_completion); + struct platform_driver *pdrv; + pdrv = &msm_platform_driver; + if (msm_drm_probed || find_device(pdrv)) { + pr_debug("wait for display probe completion\n"); + wait_for_completion(&wait_display_completion); + } return 0; } |
