Skip to content

Commit

Permalink
drm/msm: remove extra indirection for msm_mdss
Browse files Browse the repository at this point in the history
Since now there is just one mdss subdriver, drop all the indirection,
make msm_mdss struct completely opaque (and defined inside msm_mdss.c)
and call mdss functions directly.

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/482505/
Link: https://lore.kernel.org/r/20220419155346.1272627-3-dmitry.baryshkov@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
  • Loading branch information
Dmitry Baryshkov committed Apr 25, 2022
1 parent 87729e2 commit e107225
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 102 deletions.
29 changes: 16 additions & 13 deletions drivers/gpu/drm/msm/msm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,8 +1001,8 @@ static int __maybe_unused msm_runtime_suspend(struct device *dev)

DBG("");

if (mdss && mdss->funcs)
return mdss->funcs->disable(mdss);
if (mdss)
return msm_mdss_disable(mdss);

return 0;
}
Expand All @@ -1014,8 +1014,8 @@ static int __maybe_unused msm_runtime_resume(struct device *dev)

DBG("");

if (mdss && mdss->funcs)
return mdss->funcs->enable(mdss);
if (mdss)
return msm_mdss_enable(mdss);

return 0;
}
Expand Down Expand Up @@ -1241,6 +1241,7 @@ static const struct component_master_ops msm_drm_ops = {
static int msm_pdev_probe(struct platform_device *pdev)
{
struct component_match *match = NULL;
struct msm_mdss *mdss;
struct msm_drm_private *priv;
int ret;

Expand All @@ -1252,20 +1253,22 @@ static int msm_pdev_probe(struct platform_device *pdev)

switch (get_mdp_ver(pdev)) {
case KMS_MDP5:
ret = msm_mdss_init(pdev, true);
mdss = msm_mdss_init(pdev, true);
break;
case KMS_DPU:
ret = msm_mdss_init(pdev, false);
mdss = msm_mdss_init(pdev, false);
break;
default:
ret = 0;
mdss = NULL;
break;
}
if (ret) {
platform_set_drvdata(pdev, NULL);
if (IS_ERR(mdss)) {
ret = PTR_ERR(mdss);
return ret;
}

priv->mdss = mdss;

if (get_mdp_ver(pdev)) {
ret = add_display_components(pdev, &match);
if (ret)
Expand All @@ -1292,8 +1295,8 @@ static int msm_pdev_probe(struct platform_device *pdev)
fail:
of_platform_depopulate(&pdev->dev);

if (priv->mdss && priv->mdss->funcs)
priv->mdss->funcs->destroy(priv->mdss);
if (priv->mdss)
msm_mdss_destroy(priv->mdss);

return ret;
}
Expand All @@ -1306,8 +1309,8 @@ static int msm_pdev_remove(struct platform_device *pdev)
component_master_del(&pdev->dev, &msm_drm_ops);
of_platform_depopulate(&pdev->dev);

if (mdss && mdss->funcs)
mdss->funcs->destroy(mdss);
if (mdss)
msm_mdss_destroy(mdss);

return 0;
}
Expand Down
16 changes: 5 additions & 11 deletions drivers/gpu/drm/msm/msm_kms.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,12 @@ struct msm_kms *dpu_kms_init(struct drm_device *dev);
extern const struct of_device_id dpu_dt_match[];
extern const struct of_device_id mdp5_dt_match[];

struct msm_mdss_funcs {
int (*enable)(struct msm_mdss *mdss);
int (*disable)(struct msm_mdss *mdss);
void (*destroy)(struct msm_mdss *mdss);
};

struct msm_mdss {
struct device *dev;
const struct msm_mdss_funcs *funcs;
};
struct msm_mdss;

int msm_mdss_init(struct platform_device *pdev, bool is_mdp5);
struct msm_mdss *msm_mdss_init(struct platform_device *pdev, bool is_mdp5);
int msm_mdss_enable(struct msm_mdss *mdss);
int msm_mdss_disable(struct msm_mdss *mdss);
void msm_mdss_destroy(struct msm_mdss *mdss);

#define for_each_crtc_mask(dev, crtc, crtc_mask) \
drm_for_each_crtc(crtc, dev) \
Expand Down
Loading

0 comments on commit e107225

Please sign in to comment.