Quoting Dmitry Baryshkov (2022-03-23 02:25:35) > Currently the msm platform driver is a multiplex handling several cases: > - headless GPU-only driver, > - MDP4 with flat device nodes, > - MDP5/DPU MDSS with all the nodes being children of MDSS node. > > This results in not-so-perfect code, checking the hardware version > (MDP4/MDP5/DPU) in several places, checking for mdss even when it can > not exist, etc. Split the code into three handling subdrivers (mdp4, > mdss and headless msm). > > Reviewed-by: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> > --- With the match table fixed and the nit below Reviewed-by: Stephen Boyd <swboyd@xxxxxxxxxxxx> > diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c > index 3cf476c55158..c5c0650414c5 100644 > --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c > +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c > @@ -569,3 +569,59 @@ static struct mdp4_platform_config *mdp4_get_config(struct platform_device *dev) > > return &config; > } > + > +static const struct dev_pm_ops mdp4_pm_ops = { > + .prepare = msm_pm_prepare, > + .complete = msm_pm_complete, > +}; > + > +static int mdp4_probe(struct platform_device *pdev) > +{ > + struct msm_drm_private *priv; > + > + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); > + if (!priv) > + return -ENOMEM; > + > + platform_set_drvdata(pdev, priv); > + > + /* > + * on MDP4 based platforms, the MDP platform device is the component > + * master that adds other display interface components to itself. Just delete master. It provides no value in this sentence. > diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c > index 62007a4f29a2..512708101931 100644 > --- a/drivers/gpu/drm/msm/msm_mdss.c > +++ b/drivers/gpu/drm/msm/msm_mdss.c > @@ -255,3 +258,167 @@ struct msm_mdss *msm_mdss_init(struct platform_device *pdev, bool is_mdp5) [...] > + DRM_DEV_ERROR(dev, "failed to populate children devices\n"); > + goto fail; > + } > + > + mdp_dev = device_find_child(dev, NULL, find_mdp_node); > + if (!mdp_dev) { > + DRM_DEV_ERROR(dev, "failed to find MDSS MDP node\n"); > + of_platform_depopulate(dev); > + ret = -ENODEV; > + goto fail; > + } > + > + /* > + * on MDP5 based platforms, the MDSS platform device is the component > + * that adds MDP5 and other display interface components to Like here.