summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/msm_drv.c
diff options
context:
space:
mode:
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>2022-04-19 18:53:46 +0300
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>2022-04-26 00:50:46 +0300
commit6874f48bb8b050b695698f1145e6846ba08baa75 (patch)
tree9df7bf6ea24b6573c3303e901dc52f15543ee161 /drivers/gpu/drm/msm/msm_drv.c
parentdc43e923cd1478fad5ec7a2bbb67dc3d00c24f84 (diff)
downloadlinux-6874f48bb8b050b695698f1145e6846ba08baa75.tar.bz2
drm/msm: make mdp5/dpu devices master components
The msm_mdss serves several roles at this moment. It provides IRQ domain used by MDP5 and DPU drivers but it also serves as a component master for both those usecases. MDP4 (which does not have separate MDSS device) is the component master on it's own. Remove this assymmetry and make both MDP5 and DPU component masters too. This removes a need to care about drm/components from msm_mdss driver, removes an mdss pointer from struct msm_drm_private and simplifies the interface between mdp5/dpu and msm_drv. Reviewed-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/482512/ Link: https://lore.kernel.org/r/20220419155346.1272627-7-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_drv.c')
-rw-r--r--drivers/gpu/drm/msm/msm_drv.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 148a4c13d25a..fc14432e492d 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -1007,10 +1007,10 @@ static const struct dev_pm_ops msm_pm_ops = {
* is no external component that we need to add since LVDS is within MDP4
* itself.
*/
-static int add_components_mdp(struct device *master_dev, struct device *mdp_dev,
+static int add_components_mdp(struct device *master_dev,
struct component_match **matchptr)
{
- struct device_node *np = mdp_dev->of_node;
+ struct device_node *np = master_dev->of_node;
struct device_node *ep_node;
for_each_endpoint_of_node(np, ep_node) {
@@ -1020,7 +1020,7 @@ static int add_components_mdp(struct device *master_dev, struct device *mdp_dev,
ret = of_graph_parse_endpoint(ep_node, &ep);
if (ret) {
- DRM_DEV_ERROR(mdp_dev, "unable to parse port endpoint\n");
+ DRM_DEV_ERROR(master_dev, "unable to parse port endpoint\n");
of_node_put(ep_node);
return ret;
}
@@ -1097,17 +1097,23 @@ const struct component_master_ops msm_drm_ops = {
.unbind = msm_drm_unbind,
};
-int msm_drv_probe(struct device *master_dev, struct device *mdp_dev)
+int msm_drv_probe(struct device *master_dev,
+ int (*kms_init)(struct drm_device *dev))
{
+ struct msm_drm_private *priv;
struct component_match *match = NULL;
int ret;
- if (mdp_dev) {
- /* add the MDP component itself */
- drm_of_component_match_add(master_dev, &match, component_compare_of,
- mdp_dev->of_node);
+ priv = devm_kzalloc(master_dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
- ret = add_components_mdp(master_dev, mdp_dev, &match);
+ priv->kms_init = kms_init;
+ dev_set_drvdata(master_dev, priv);
+
+ /* Add mdp components if we have KMS. */
+ if (kms_init) {
+ ret = add_components_mdp(master_dev, &match);
if (ret)
return ret;
}
@@ -1137,14 +1143,6 @@ int msm_drv_probe(struct device *master_dev, struct device *mdp_dev)
static int msm_pdev_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);
-
return msm_drv_probe(&pdev->dev, NULL);
}