aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2017-03-09 05:05:28 -0500
committerMaxime Ripard <maxime.ripard@free-electrons.com>2017-03-09 05:21:52 -0500
commit18c3b300837b864e875d23f22eef5b7acefeccf1 (patch)
tree4b95d4cb65f916a521fcad9cf26b2f12418dabad
parent279156a33c33b385a78c1266ddf6ebc2d473193d (diff)
drm/sun4i: Pass pointers for associated backend and tcon into crtc init
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>
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_crtc.c9
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_crtc.h4
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_tcon.c2
3 files changed, 9 insertions, 6 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c
index 5323e3485988..221e6d5ee970 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
@@ -134,9 +134,10 @@ static const struct drm_crtc_funcs sun4i_crtc_funcs = {
134 .disable_vblank = sun4i_crtc_disable_vblank, 134 .disable_vblank = sun4i_crtc_disable_vblank,
135}; 135};
136 136
137struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm) 137struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm,
138 struct sun4i_backend *backend,
139 struct sun4i_tcon *tcon)
138{ 140{
139 struct sun4i_drv *drv = drm->dev_private;
140 struct sun4i_crtc *scrtc; 141 struct sun4i_crtc *scrtc;
141 struct drm_plane *primary = NULL, *cursor = NULL; 142 struct drm_plane *primary = NULL, *cursor = NULL;
142 int ret, i; 143 int ret, i;
@@ -144,8 +145,8 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm)
144 scrtc = devm_kzalloc(drm->dev, sizeof(*scrtc), GFP_KERNEL); 145 scrtc = devm_kzalloc(drm->dev, sizeof(*scrtc), GFP_KERNEL);
145 if (!scrtc) 146 if (!scrtc)
146 return ERR_PTR(-ENOMEM); 147 return ERR_PTR(-ENOMEM);
147 scrtc->backend = drv->backend; 148 scrtc->backend = backend;
148 scrtc->tcon = drv->tcon; 149 scrtc->tcon = tcon;
149 150
150 /* Create our layers */ 151 /* Create our layers */
151 scrtc->layers = sun4i_layers_init(drm); 152 scrtc->layers = sun4i_layers_init(drm);
diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.h b/drivers/gpu/drm/sun4i/sun4i_crtc.h
index cd0e633cce3a..230cb8f0d601 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.h
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.h
@@ -27,6 +27,8 @@ static inline struct sun4i_crtc *drm_crtc_to_sun4i_crtc(struct drm_crtc *crtc)
27 return container_of(crtc, struct sun4i_crtc, crtc); 27 return container_of(crtc, struct sun4i_crtc, crtc);
28} 28}
29 29
30struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm); 30struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm,
31 struct sun4i_backend *backend,
32 struct sun4i_tcon *tcon);
31 33
32#endif /* _SUN4I_CRTC_H_ */ 34#endif /* _SUN4I_CRTC_H_ */
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index c52c482c8fd0..3ced0b1cef6e 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -528,7 +528,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
528 goto err_free_dotclock; 528 goto err_free_dotclock;
529 } 529 }
530 530
531 tcon->crtc = sun4i_crtc_init(drm); 531 tcon->crtc = sun4i_crtc_init(drm, drv->backend, tcon);
532 if (IS_ERR(tcon->crtc)) { 532 if (IS_ERR(tcon->crtc)) {
533 dev_err(dev, "Couldn't create our CRTC\n"); 533 dev_err(dev, "Couldn't create our CRTC\n");
534 ret = PTR_ERR(tcon->crtc); 534 ret = PTR_ERR(tcon->crtc);