drm/msm: move resource allocation to the _probe function
v4 cover drm/msm: move resource allocation to the _probe function
This patchset was left untouched for almost a year. Let's reiterate it in attempt to solve the long-standing issue.
As discussed several times on IRC, move display subdriver resource allocation from kms_init to probe time to let it bail early.
Changes since v3:
- Fixed MMIO unmaping in the DPU case.
Changes since v2:
- Move even more resource allocation in the DPU init path.
Changes since v1:
- Dropped the applied patch
- Picked in the patch to pass msm_kms pointer via msm_drv_probe()
Dmitry Baryshkov (4):
drm/msm: allow passing struct msm_kms to msm_drv_probe() drm/msm/dpu: move resource allocation to the _probe function drm/msm/mdp4: move resource allocation to the _probe function drm/msm/mdp5: move resource allocation to the _probe function
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 133 +++++++++++------------ drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 107 +++++++++--------- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 100 ++++++++--------- drivers/gpu/drm/msm/msm_drv.c | 6 +- drivers/gpu/drm/msm/msm_drv.h | 3 +- 5 files changed, 162 insertions(+), 187 deletions(-)
Signature · 1 line
2.39.2
PATCH v4 1/4 drm/msm: allow passing struct msm_kms to msm_drv_probe()
In preparation of moving resource allocation to the probe time, allow MSM KMS drivers to pass struct msm_kms pointer via msm_drv_probe().
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 2 +- drivers/gpu/drm/msm/msm_drv.c | 6 ++++-- drivers/gpu/drm/msm/msm_drv.h | 3 ++- 5 files changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -1
@@ -1244,7 +1244,7 @@ static int dpu_kms_init(struct drm_device *ddev)static int dpu_dev_probe (struct platform_device *pdev) { -return msm_drv_probe (&pdev->dev, dpu_kms_init); +return msm_drv_probe (&pdev->dev, dpu_kms_init,NULL ); }static int dpu_dev_remove (struct platform_device *pdev)
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +1 -1
@@ -558,7 +558,7 @@ static const struct dev_pm_ops mdp4_pm_ops = {static int mdp4_probe (struct platform_device *pdev) { -return msm_drv_probe (&pdev->dev, mdp4_kms_init); +return msm_drv_probe (&pdev->dev, mdp4_kms_init,NULL ); }static int mdp4_remove (struct platform_device *pdev)
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +1 -1
@@ -939,7 +939,7 @@ static int mdp5_dev_probe(struct platform_device *pdev)if (ret)return ret; -return msm_drv_probe (&pdev->dev, mdp5_kms_init); +return msm_drv_probe (&pdev->dev, mdp5_kms_init,NULL ); }static int mdp5_dev_remove (struct platform_device *pdev)
drivers/gpu/drm/msm/msm_drv.c +4 -2
@@ -1233,7 +1233,8 @@ const struct component_master_ops msm_drm_ops = { };int msm_drv_probe (struct device *master_dev, -int (*kms_init)(struct drm_device *dev)) +int (*kms_init)(struct drm_device *dev), +struct msm_kms *kms) {struct msm_drm_private *priv;struct component_match *match =NULL ;
@@ -1243,6 +1244,7 @@ int msm_drv_probe(struct device *master_dev,if (!priv)return -ENOMEM ; + priv->kms = kms; priv->kms_init = kms_init;dev_set_drvdata (master_dev, priv);
@@ -1278,7 +1280,7 @@ int msm_drv_probe(struct device *master_dev,static int msm_pdev_probe (struct platform_device *pdev) { -return msm_drv_probe (&pdev->dev,NULL ); +return msm_drv_probe (&pdev->dev,NULL ,NULL ); }static int msm_pdev_remove (struct platform_device *pdev)
drivers/gpu/drm/msm/msm_drv.h +2 -1
@@ -562,7 +562,8 @@ int msm_pm_prepare(struct device *dev);void msm_pm_complete (struct device *dev);int msm_drv_probe (struct device *dev, -int (*kms_init)(struct drm_device *dev)); +int (*kms_init)(struct drm_device *dev), +struct msm_kms *kms);void msm_drv_shutdown (struct platform_device *pdev);
Signature · 1 line
2.39.2
PATCH v4 2/4 drm/msm/dpu: move resource allocation to the _probe function
In reply to Dmitry BaryshkovTo let the probe function bail early if any of the resources is unavailable, move resource allocattion from kms_init directly to the probe callback. While we are at it, replace irq_of_parse_and_map() with platform_get_irq().
This also drops devm_iounmap() calls. It is too early to have them _dpu_kms_hw_destroy() (or it will break if for some reason DPU device is rebound into the composite device) and it doesn't make sense to have them in dpu_dev_remove (as everything will be torn down by the devres anyway after the device is unbound from the driver).
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 133 +++++++++++------------- 1 file changed, 61 insertions(+), 72 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +61 -72
@@ -388,8 +388,7 @@ static int dpu_kms_parse_data_bus_icc_path(struct dpu_kms *dpu_kms) {struct icc_path *path0;struct icc_path *path1; -struct drm_device *dev = dpu_kms->dev; -struct device *dpu_dev = dev->dev; +struct device *dpu_dev = &dpu_kms->pdev->dev; path0 =msm_icc_get (dpu_dev,"mdp0-mem" ); path1 =msm_icc_get (dpu_dev,"mdp1-mem" );
@@ -830,21 +829,9 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) dpu_kms->catalog =NULL ; -if (dpu_kms->vbif[VBIF_NRT ]) -devm_iounmap (&dpu_kms->pdev->dev, dpu_kms->vbif[VBIF_NRT ]); - dpu_kms->vbif[VBIF_NRT ] =NULL ; - -if (dpu_kms->vbif[VBIF_RT ]) -devm_iounmap (&dpu_kms->pdev->dev, dpu_kms->vbif[VBIF_RT ]); - dpu_kms->vbif[VBIF_RT ] =NULL ; -if (dpu_kms->hw_mdp)dpu_hw_mdp_destroy (dpu_kms->hw_mdp); dpu_kms->hw_mdp =NULL ; - -if (dpu_kms->mmio) -devm_iounmap (&dpu_kms->pdev->dev, dpu_kms->mmio); - dpu_kms->mmio =NULL ; }static void dpu_kms_destroy (struct msm_kms *kms)
@@ -1038,30 +1025,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)atomic_set (&dpu_kms->bandwidth_ref,0 ); - dpu_kms->mmio =msm_ioremap (dpu_kms->pdev,"mdp" ); -if (IS_ERR (dpu_kms->mmio)) { - rc =PTR_ERR (dpu_kms->mmio); -DPU_ERROR ("mdp register memory map failed: %d\n" , rc); - dpu_kms->mmio =NULL ; - goto error; - } -DRM_DEBUG ("mapped dpu address space @%pK\n" , dpu_kms->mmio); - - dpu_kms->vbif[VBIF_RT ] =msm_ioremap (dpu_kms->pdev,"vbif" ); -if (IS_ERR (dpu_kms->vbif[VBIF_RT ])) { - rc =PTR_ERR (dpu_kms->vbif[VBIF_RT ]); -DPU_ERROR ("vbif register memory map failed: %d\n" , rc); - dpu_kms->vbif[VBIF_RT ] =NULL ; - goto error; - } - dpu_kms->vbif[VBIF_NRT ] =msm_ioremap_quiet (dpu_kms->pdev,"vbif_nrt" ); -if (IS_ERR (dpu_kms->vbif[VBIF_NRT ])) { - dpu_kms->vbif[VBIF_NRT ] =NULL ; -DPU_DEBUG ("VBIF NRT is not defined" ); - } - -dpu_kms_parse_data_bus_icc_path (dpu_kms); - rc =pm_runtime_resume_and_get (&dpu_kms->pdev->dev);if (rc <0 ) goto error;
@@ -1186,33 +1149,11 @@ static int dpu_kms_init(struct drm_device *ddev)struct msm_drm_private *priv = ddev->dev_private;struct device *dev = ddev->dev;struct platform_device *pdev =to_platform_device (dev); -struct dpu_kms *dpu_kms; -int irq; +struct dpu_kms *dpu_kms =to_dpu_kms (priv->kms);struct dev_pm_opp *opp;int ret =0 ;unsigned long max_freq =ULONG_MAX ; - dpu_kms =devm_kzalloc (&pdev->dev,sizeof (*dpu_kms),GFP_KERNEL ); -if (!dpu_kms) -return -ENOMEM ; - - ret =devm_pm_opp_set_clkname (dev,"core" ); -if (ret) -return ret; -/* OPP table is optional */ - ret =devm_pm_opp_of_add_table (dev); -if (ret && ret != -ENODEV ) { -dev_err (dev,"invalid OPP table in device tree\n" ); -return ret; - } - - ret =devm_clk_bulk_get_all (&pdev->dev, &dpu_kms->clocks); -if (ret <0 ) { -DPU_ERROR ("failed to parse clocks, ret=%d\n" , ret); -return ret; - } - dpu_kms->num_clocks = ret; - opp =dev_pm_opp_find_freq_floor (dev, &max_freq);if (!IS_ERR (opp))dev_pm_opp_put (opp);
@@ -1225,26 +1166,74 @@ static int dpu_kms_init(struct drm_device *ddev)return ret; } dpu_kms->dev = ddev; - dpu_kms->pdev = pdev;pm_runtime_enable (&pdev->dev); dpu_kms->rpm_enabled = true; - priv->kms = &dpu_kms->base; - - irq =irq_of_parse_and_map (dpu_kms->pdev->dev.of_node,0 ); -if (!irq) { -DPU_ERROR ("failed to get irq\n" ); -return -EINVAL ; - } - dpu_kms->base.irq = irq; -return 0 ; }static int dpu_dev_probe (struct platform_device *pdev) { -return msm_drv_probe (&pdev->dev, dpu_kms_init,NULL ); +struct device *dev = &pdev->dev; +struct dpu_kms *dpu_kms; +int irq; +int ret =0 ; + + dpu_kms =devm_kzalloc (dev,sizeof (*dpu_kms),GFP_KERNEL ); +if (!dpu_kms) +return -ENOMEM ; + + dpu_kms->pdev = pdev; + + ret =devm_pm_opp_set_clkname (dev,"core" ); +if (ret) +return ret; +/* OPP table is optional */ + ret =devm_pm_opp_of_add_table (dev); +if (ret && ret != -ENODEV ) +return dev_err_probe (dev, ret,"invalid OPP table in device tree\n" ); + + ret =devm_clk_bulk_get_all (&pdev->dev, &dpu_kms->clocks); +if (ret <0 ) +return dev_err_probe (dev, ret,"failed to parse clocks\n" ); + + dpu_kms->num_clocks = ret; + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) +return dev_err_probe (dev, irq,"failed to get irq\n" ); + + dpu_kms->base.irq = irq; + + dpu_kms->mmio =msm_ioremap (pdev,"mdp" ); +if (IS_ERR (dpu_kms->mmio)) { + ret =PTR_ERR (dpu_kms->mmio); +DPU_ERROR ("mdp register memory map failed: %d\n" , ret); + dpu_kms->mmio =NULL ; +return ret; + } +DRM_DEBUG ("mapped dpu address space @%pK\n" , dpu_kms->mmio); + + dpu_kms->vbif[VBIF_RT ] =msm_ioremap (pdev,"vbif" ); +if (IS_ERR (dpu_kms->vbif[VBIF_RT ])) { + ret =PTR_ERR (dpu_kms->vbif[VBIF_RT ]); +DPU_ERROR ("vbif register memory map failed: %d\n" , ret); + dpu_kms->vbif[VBIF_RT ] =NULL ; +return ret; + } + + dpu_kms->vbif[VBIF_NRT ] =msm_ioremap_quiet (pdev,"vbif_nrt" ); +if (IS_ERR (dpu_kms->vbif[VBIF_NRT ])) { + dpu_kms->vbif[VBIF_NRT ] =NULL ; +DPU_DEBUG ("VBIF NRT is not defined" ); + } + + ret =dpu_kms_parse_data_bus_icc_path (dpu_kms); +if (ret) +return ret; + +return msm_drv_probe (&pdev->dev, dpu_kms_init, &dpu_kms->base); }static int dpu_dev_remove (struct platform_device *pdev)
Signature · 1 line
2.39.2
PATCH v4 3/4 drm/msm/mdp4: move resource allocation to the _probe function
In reply to Dmitry BaryshkovTo let the probe function bail early if any of the resources is unavailable, move resource allocattion from kms_init directly to the probe callback. While we are at it, replace irq_of_parse_and_map() with platform_get_irq().
--- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 107 +++++++++++------------ 1 file changed, 51 insertions(+), 56 deletions(-)
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +51 -56
@@ -135,8 +135,6 @@ static void mdp4_destroy(struct msm_kms *kms)pm_runtime_disable (dev);mdp_kms_destroy (&mdp4_kms->base); - -kfree (mdp4_kms); }static const struct mdp_kms_funcs kms_funcs = {
@@ -380,57 +378,27 @@ static int mdp4_kms_init(struct drm_device *dev) {struct platform_device *pdev =to_platform_device (dev->dev);struct msm_drm_private *priv = dev->dev_private; -struct mdp4_kms *mdp4_kms; +struct mdp4_kms *mdp4_kms =to_mdp4_kms (to_mdp_kms (priv->kms));struct msm_kms *kms =NULL ;struct msm_mmu *mmu;struct msm_gem_address_space *aspace; -int irq, ret; +int ret;u32 major, minor;unsigned long max_clk;/* TODO: Chips that aren't apq8064 have a 200 Mhz max_clk */ max_clk =266667000 ; - mdp4_kms =kzalloc (sizeof (*mdp4_kms),GFP_KERNEL ); -if (!mdp4_kms) { -DRM_DEV_ERROR (dev->dev,"failed to allocate kms\n" ); -return -ENOMEM ; - } - ret =mdp_kms_init (&mdp4_kms->base, &kms_funcs);if (ret) {DRM_DEV_ERROR (dev->dev,"failed to init kms\n" ); goto fail; } - priv->kms = &mdp4_kms->base.base; kms = priv->kms; mdp4_kms->dev = dev; - mdp4_kms->mmio =msm_ioremap (pdev,NULL ); -if (IS_ERR (mdp4_kms->mmio)) { - ret =PTR_ERR (mdp4_kms->mmio); - goto fail; - } - - irq =platform_get_irq (pdev,0 ); -if (irq <0 ) { - ret = irq; -DRM_DEV_ERROR (dev->dev,"failed to get irq: %d\n" , ret); - goto fail; - } - - kms->irq = irq; - -/* NOTE: driver for this regulator still missing upstream.. use -* _get_exclusive() and ignore the error if it does not exist -* (and hope that the bootloader left it on for us) -*/ - mdp4_kms->vdd =devm_regulator_get_exclusive (&pdev->dev,"vdd" ); -if (IS_ERR (mdp4_kms->vdd)) - mdp4_kms->vdd =NULL ; -if (mdp4_kms->vdd) { ret =regulator_enable (mdp4_kms->vdd);if (ret) {
@@ -439,24 +407,6 @@ static int mdp4_kms_init(struct drm_device *dev) } } - mdp4_kms->clk =devm_clk_get (&pdev->dev,"core_clk" ); -if (IS_ERR (mdp4_kms->clk)) { -DRM_DEV_ERROR (dev->dev,"failed to get core_clk\n" ); - ret =PTR_ERR (mdp4_kms->clk); - goto fail; - } - - mdp4_kms->pclk =devm_clk_get (&pdev->dev,"iface_clk" ); -if (IS_ERR (mdp4_kms->pclk)) - mdp4_kms->pclk =NULL ; - - mdp4_kms->axi_clk =devm_clk_get (&pdev->dev,"bus_clk" ); -if (IS_ERR (mdp4_kms->axi_clk)) { -DRM_DEV_ERROR (dev->dev,"failed to get axi_clk\n" ); - ret =PTR_ERR (mdp4_kms->axi_clk); - goto fail; - } -clk_set_rate (mdp4_kms->clk, max_clk);read_mdp_hw_revision (mdp4_kms, &major, &minor);
@@ -471,10 +421,9 @@ static int mdp4_kms_init(struct drm_device *dev) mdp4_kms->rev = minor;if (mdp4_kms->rev >=2 ) { - mdp4_kms->lut_clk =devm_clk_get (&pdev->dev,"lut_clk" ); -if (IS_ERR (mdp4_kms->lut_clk)) { +if (!mdp4_kms->lut_clk) {DRM_DEV_ERROR (dev->dev,"failed to get lut_clk\n" ); - ret =PTR_ERR (mdp4_kms->lut_clk); + ret = -ENODEV ; goto fail; }clk_set_rate (mdp4_kms->lut_clk, max_clk);
@@ -558,7 +507,53 @@ static const struct dev_pm_ops mdp4_pm_ops = {static int mdp4_probe (struct platform_device *pdev) { -return msm_drv_probe (&pdev->dev, mdp4_kms_init,NULL ); +struct device *dev = &pdev->dev; +struct mdp4_kms *mdp4_kms; +int irq; + + mdp4_kms =devm_kzalloc (dev,sizeof (*mdp4_kms),GFP_KERNEL ); +if (!mdp4_kms) +return dev_err_probe (dev, -ENOMEM ,"failed to allocate kms\n" ); + + mdp4_kms->mmio =msm_ioremap (pdev,NULL ); +if (IS_ERR (mdp4_kms->mmio)) +return PTR_ERR (mdp4_kms->mmio); + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) +return dev_err_probe (dev, irq,"failed to get irq\n" ); + + mdp4_kms->base.base.irq = irq; + +/* NOTE: driver for this regulator still missing upstream.. use +* _get_exclusive() and ignore the error if it does not exist +* (and hope that the bootloader left it on for us) +*/ + mdp4_kms->vdd =devm_regulator_get_exclusive (&pdev->dev,"vdd" ); +if (IS_ERR (mdp4_kms->vdd)) + mdp4_kms->vdd =NULL ; + + mdp4_kms->clk =devm_clk_get (&pdev->dev,"core_clk" ); +if (IS_ERR (mdp4_kms->clk)) +return dev_err_probe (dev,PTR_ERR (mdp4_kms->clk),"failed to get core_clk\n" ); + + mdp4_kms->pclk =devm_clk_get (&pdev->dev,"iface_clk" ); +if (IS_ERR (mdp4_kms->pclk)) + mdp4_kms->pclk =NULL ; + + mdp4_kms->axi_clk =devm_clk_get (&pdev->dev,"bus_clk" ); +if (IS_ERR (mdp4_kms->axi_clk)) +return dev_err_probe (dev,PTR_ERR (mdp4_kms->axi_clk),"failed to get axi_clk\n" ); + +/* +* This is required for revn >= 2. Handle errors here and let the kms +* init bail out if the clock is not provided. +*/ + mdp4_kms->lut_clk =devm_clk_get_optional (&pdev->dev,"lut_clk" ); +if (IS_ERR (mdp4_kms->lut_clk)) +return dev_err_probe (dev,PTR_ERR (mdp4_kms->lut_clk),"failed to get lut_clk\n" ); + +return msm_drv_probe (&pdev->dev, mdp4_kms_init, &mdp4_kms->base.base); }static int mdp4_remove (struct platform_device *pdev)
Signature · 1 line
2.39.2
PATCH v4 4/4 drm/msm/mdp5: move resource allocation to the _probe function
In reply to Dmitry BaryshkovTo let the probe function bail early if any of the resources is unavailable, move resource allocattion from kms_init directly to the probe callback.
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 100 ++++++++++------------- 1 file changed, 44 insertions(+), 56 deletions(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +44 -56
@@ -554,20 +554,16 @@ static int mdp5_kms_init(struct drm_device *dev)struct platform_device *pdev;struct mdp5_kms *mdp5_kms;struct mdp5_cfg *config; -struct msm_kms *kms; +struct msm_kms *kms = priv->kms;struct msm_gem_address_space *aspace; -int irq, i, ret; +int i, ret; ret =mdp5_init (to_platform_device (dev->dev), dev);if (ret)return ret; -/* priv->kms would have been populated by the MDP5 driver */ - kms = priv->kms; -if (!kms) -return -ENOMEM ; - mdp5_kms =to_mdp5_kms (to_mdp_kms (kms)); + pdev = mdp5_kms->pdev; ret =mdp_kms_init (&mdp5_kms->base, &kms_funcs);
@@ -576,15 +572,6 @@ static int mdp5_kms_init(struct drm_device *dev) goto fail; } - irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); -if (!irq) { - ret = -EINVAL ; -DRM_DEV_ERROR (&pdev->dev,"failed to get irq\n" ); - goto fail; - } - - kms->irq = irq; - config =mdp5_cfg_get_config (mdp5_kms->cfg);/* make sure things are off before attaching iommu (bootloader could
@@ -787,60 +774,23 @@ static int interface_init(struct mdp5_kms *mdp5_kms)static int mdp5_init (struct platform_device *pdev,struct drm_device *dev) {struct msm_drm_private *priv = dev->dev_private; -struct mdp5_kms *mdp5_kms; +struct mdp5_kms *mdp5_kms =to_mdp5_kms (to_mdp_kms (priv->kms));struct mdp5_cfg *config;u32 major, minor;int ret; - mdp5_kms =devm_kzalloc (&pdev->dev,sizeof (*mdp5_kms),GFP_KERNEL ); -if (!mdp5_kms) { - ret = -ENOMEM ; - goto fail; - } - -spin_lock_init (&mdp5_kms->resource_lock); - mdp5_kms->dev = dev; - mdp5_kms->pdev = pdev; ret =mdp5_global_obj_init (mdp5_kms);if (ret) goto fail; - mdp5_kms->mmio =msm_ioremap (pdev,"mdp_phys" ); -if (IS_ERR (mdp5_kms->mmio)) { - ret =PTR_ERR (mdp5_kms->mmio); - goto fail; - } - -/* mandatory clocks: */ - ret =get_clk (pdev, &mdp5_kms->axi_clk,"bus" , true); -if (ret) - goto fail; - ret =get_clk (pdev, &mdp5_kms->ahb_clk,"iface" , true); -if (ret) - goto fail; - ret =get_clk (pdev, &mdp5_kms->core_clk,"core" , true); -if (ret) - goto fail; - ret =get_clk (pdev, &mdp5_kms->vsync_clk,"vsync" , true); -if (ret) - goto fail; - -/* optional clocks: */ -get_clk (pdev, &mdp5_kms->lut_clk,"lut" , false); -get_clk (pdev, &mdp5_kms->tbu_clk,"tbu" , false); -get_clk (pdev, &mdp5_kms->tbu_rt_clk,"tbu_rt" , false); -/* we need to set a default rate before enabling. Set a safe * rate first, then figure out hw revision, and then set a * more optimal rate: */ clk_set_rate (mdp5_kms->core_clk,200000000 ); -/* set uninit-ed kms */ - priv->kms = &mdp5_kms->base.base; -pm_runtime_enable (&pdev->dev); mdp5_kms->rpm_enabled = true;
@@ -931,15 +881,53 @@ static int mdp5_setup_interconnect(struct platform_device *pdev)static int mdp5_dev_probe (struct platform_device *pdev) { -int ret; +struct mdp5_kms *mdp5_kms; +int ret, irq;DBG ("" ); + mdp5_kms =devm_kzalloc (&pdev->dev,sizeof (*mdp5_kms),GFP_KERNEL ); +if (!mdp5_kms) +return -ENOMEM ; + ret =mdp5_setup_interconnect (pdev);if (ret)return ret; -return msm_drv_probe (&pdev->dev, mdp5_kms_init,NULL ); + mdp5_kms->pdev = pdev; + +spin_lock_init (&mdp5_kms->resource_lock); + + mdp5_kms->mmio =msm_ioremap (pdev,"mdp_phys" ); +if (IS_ERR (mdp5_kms->mmio)) +return PTR_ERR (mdp5_kms->mmio); + +/* mandatory clocks: */ + ret =get_clk (pdev, &mdp5_kms->axi_clk,"bus" , true); +if (ret) +return ret; + ret =get_clk (pdev, &mdp5_kms->ahb_clk,"iface" , true); +if (ret) +return ret; + ret =get_clk (pdev, &mdp5_kms->core_clk,"core" , true); +if (ret) +return ret; + ret =get_clk (pdev, &mdp5_kms->vsync_clk,"vsync" , true); +if (ret) +return ret; + +/* optional clocks: */ +get_clk (pdev, &mdp5_kms->lut_clk,"lut" , false); +get_clk (pdev, &mdp5_kms->tbu_clk,"tbu" , false); +get_clk (pdev, &mdp5_kms->tbu_rt_clk,"tbu_rt" , false); + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) +return dev_err_probe (&pdev->dev, irq,"failed to get irq\n" ); + + mdp5_kms->base.base.irq = irq; + +return msm_drv_probe (&pdev->dev, mdp5_kms_init, &mdp5_kms->base.base); }static int mdp5_dev_remove (struct platform_device *pdev)
Signature · 1 line
2.39.2
Quoted 17 lines · Dmitry Baryshkov
This patchset was left untouched for almost a year. Let's reiterate it in attempt to solve the long-standing issue.
As discussed several times on IRC, move display subdriver resource allocation from
kms_initto probe time to let it bail early.Changes since v3:
- Fixed MMIO unmaping in the DPU case.Changes since v2:
- Move even more resource allocation in the DPU init path.Changes since v1:
- Dropped the applied patch
- Picked in the patch to passmsm_kmspointer viamsm_drv_probe()
Quoted 5 lines
Dmitry Baryshkov (4):
drm/msm: allow passing structmsm_kmstomsm_drv_probe()drm/msm/dpu: move resource allocation to the_probefunction drm/msm/mdp4: move resource allocation to the_probefunction drm/msm/mdp5: move resource allocation to the_probefunction
for the series,
Quoted 11 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 133 +++++++++++------------ drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 107 +++++++++--------- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 100 ++++++++--------- drivers/gpu/drm/msm/msm_drv.c | 6 +- drivers/gpu/drm/msm/msm_drv.h | 3 +- 5 files changed, 162 insertions(+), 187 deletions(-)--
2.39.2