Skip to content

Commit

Permalink
drm/msm: split the main platform driver
Browse files Browse the repository at this point in the history
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@quicinc.com>
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/482507/
Link: https://lore.kernel.org/r/20220419155346.1272627-4-dmitry.baryshkov@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
  • Loading branch information
Dmitry Baryshkov committed Apr 25, 2022
1 parent e107225 commit ecb23f2
Show file tree
Hide file tree
Showing 5 changed files with 288 additions and 205 deletions.
56 changes: 56 additions & 0 deletions drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* that adds other display interface components to itself.
*/
return msm_drv_probe(&pdev->dev, &pdev->dev);
}

static int mdp4_remove(struct platform_device *pdev)
{
component_master_del(&pdev->dev, &msm_drm_ops);

return 0;
}

static const struct of_device_id mdp4_dt_match[] = {
{ .compatible = "qcom,mdp4", .data = (void *)KMS_MDP4 },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mdp4_dt_match);

static struct platform_driver mdp4_platform_driver = {
.probe = mdp4_probe,
.remove = mdp4_remove,
.shutdown = msm_drv_shutdown,
.driver = {
.name = "mdp4",
.of_match_table = mdp4_dt_match,
.pm = &mdp4_pm_ops,
},
};

void __init msm_mdp4_register(void)
{
platform_driver_register(&mdp4_platform_driver);
}

void __exit msm_mdp4_unregister(void)
{
platform_driver_unregister(&mdp4_platform_driver);
}
Loading

0 comments on commit ecb23f2

Please sign in to comment.