Skip to content

Commit

Permalink
drm/sun4i: Pass pointers for associated backend and tcon into crtc init
Browse files Browse the repository at this point in the history
sun4i_crtc controls the backend and tcon hardware blocks of the display
pipeline.

Pass pointers to the underlying devices into the crtc init function,
instead of trying to fetch them from the drm_device structure. This
avoids the headache of trying to figure out which devices the crtc
is actually associated with.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
  • Loading branch information
Chen-Yu Tsai authored and Maxime Ripard committed Mar 9, 2017
1 parent 279156a commit 18c3b30
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 5 additions & 4 deletions drivers/gpu/drm/sun4i/sun4i_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,19 @@ static const struct drm_crtc_funcs sun4i_crtc_funcs = {
.disable_vblank = sun4i_crtc_disable_vblank,
};

struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm)
struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm,
struct sun4i_backend *backend,
struct sun4i_tcon *tcon)
{
struct sun4i_drv *drv = drm->dev_private;
struct sun4i_crtc *scrtc;
struct drm_plane *primary = NULL, *cursor = NULL;
int ret, i;

scrtc = devm_kzalloc(drm->dev, sizeof(*scrtc), GFP_KERNEL);
if (!scrtc)
return ERR_PTR(-ENOMEM);
scrtc->backend = drv->backend;
scrtc->tcon = drv->tcon;
scrtc->backend = backend;
scrtc->tcon = tcon;

/* Create our layers */
scrtc->layers = sun4i_layers_init(drm);
Expand Down
4 changes: 3 additions & 1 deletion drivers/gpu/drm/sun4i/sun4i_crtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ static inline struct sun4i_crtc *drm_crtc_to_sun4i_crtc(struct drm_crtc *crtc)
return container_of(crtc, struct sun4i_crtc, crtc);
}

struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm);
struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm,
struct sun4i_backend *backend,
struct sun4i_tcon *tcon);

#endif /* _SUN4I_CRTC_H_ */
2 changes: 1 addition & 1 deletion drivers/gpu/drm/sun4i/sun4i_tcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
goto err_free_dotclock;
}

tcon->crtc = sun4i_crtc_init(drm);
tcon->crtc = sun4i_crtc_init(drm, drv->backend, tcon);
if (IS_ERR(tcon->crtc)) {
dev_err(dev, "Couldn't create our CRTC\n");
ret = PTR_ERR(tcon->crtc);
Expand Down

0 comments on commit 18c3b30

Please sign in to comment.