aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_crtc.c18
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_crtc.h3
2 files changed, 9 insertions, 12 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c
index 9d6fd2f40cf4..7bbcedff9f07 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
@@ -52,12 +52,11 @@ static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc,
52 struct drm_crtc_state *old_state) 52 struct drm_crtc_state *old_state)
53{ 53{
54 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); 54 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
55 struct sun4i_drv *drv = scrtc->drv;
56 struct drm_pending_vblank_event *event = crtc->state->event; 55 struct drm_pending_vblank_event *event = crtc->state->event;
57 56
58 DRM_DEBUG_DRIVER("Committing plane changes\n"); 57 DRM_DEBUG_DRIVER("Committing plane changes\n");
59 58
60 sun4i_backend_commit(drv->backend); 59 sun4i_backend_commit(scrtc->backend);
61 60
62 if (event) { 61 if (event) {
63 crtc->state->event = NULL; 62 crtc->state->event = NULL;
@@ -74,11 +73,10 @@ static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc,
74static void sun4i_crtc_disable(struct drm_crtc *crtc) 73static void sun4i_crtc_disable(struct drm_crtc *crtc)
75{ 74{
76 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); 75 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
77 struct sun4i_drv *drv = scrtc->drv;
78 76
79 DRM_DEBUG_DRIVER("Disabling the CRTC\n"); 77 DRM_DEBUG_DRIVER("Disabling the CRTC\n");
80 78
81 sun4i_tcon_disable(drv->tcon); 79 sun4i_tcon_disable(scrtc->tcon);
82 80
83 if (crtc->state->event && !crtc->state->active) { 81 if (crtc->state->event && !crtc->state->active) {
84 spin_lock_irq(&crtc->dev->event_lock); 82 spin_lock_irq(&crtc->dev->event_lock);
@@ -92,11 +90,10 @@ static void sun4i_crtc_disable(struct drm_crtc *crtc)
92static void sun4i_crtc_enable(struct drm_crtc *crtc) 90static void sun4i_crtc_enable(struct drm_crtc *crtc)
93{ 91{
94 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); 92 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
95 struct sun4i_drv *drv = scrtc->drv;
96 93
97 DRM_DEBUG_DRIVER("Enabling the CRTC\n"); 94 DRM_DEBUG_DRIVER("Enabling the CRTC\n");
98 95
99 sun4i_tcon_enable(drv->tcon); 96 sun4i_tcon_enable(scrtc->tcon);
100} 97}
101 98
102static const struct drm_crtc_helper_funcs sun4i_crtc_helper_funcs = { 99static const struct drm_crtc_helper_funcs sun4i_crtc_helper_funcs = {
@@ -109,11 +106,10 @@ static const struct drm_crtc_helper_funcs sun4i_crtc_helper_funcs = {
109static int sun4i_crtc_enable_vblank(struct drm_crtc *crtc) 106static int sun4i_crtc_enable_vblank(struct drm_crtc *crtc)
110{ 107{
111 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); 108 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
112 struct sun4i_drv *drv = scrtc->drv;
113 109
114 DRM_DEBUG_DRIVER("Enabling VBLANK on crtc %p\n", crtc); 110 DRM_DEBUG_DRIVER("Enabling VBLANK on crtc %p\n", crtc);
115 111
116 sun4i_tcon_enable_vblank(drv->tcon, true); 112 sun4i_tcon_enable_vblank(scrtc->tcon, true);
117 113
118 return 0; 114 return 0;
119} 115}
@@ -121,11 +117,10 @@ static int sun4i_crtc_enable_vblank(struct drm_crtc *crtc)
121static void sun4i_crtc_disable_vblank(struct drm_crtc *crtc) 117static void sun4i_crtc_disable_vblank(struct drm_crtc *crtc)
122{ 118{
123 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); 119 struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
124 struct sun4i_drv *drv = scrtc->drv;
125 120
126 DRM_DEBUG_DRIVER("Disabling VBLANK on crtc %p\n", crtc); 121 DRM_DEBUG_DRIVER("Disabling VBLANK on crtc %p\n", crtc);
127 122
128 sun4i_tcon_enable_vblank(drv->tcon, false); 123 sun4i_tcon_enable_vblank(scrtc->tcon, false);
129} 124}
130 125
131static const struct drm_crtc_funcs sun4i_crtc_funcs = { 126static const struct drm_crtc_funcs sun4i_crtc_funcs = {
@@ -149,7 +144,8 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm)
149 scrtc = devm_kzalloc(drm->dev, sizeof(*scrtc), GFP_KERNEL); 144 scrtc = devm_kzalloc(drm->dev, sizeof(*scrtc), GFP_KERNEL);
150 if (!scrtc) 145 if (!scrtc)
151 return ERR_PTR(-ENOMEM); 146 return ERR_PTR(-ENOMEM);
152 scrtc->drv = drv; 147 scrtc->backend = drv->backend;
148 scrtc->tcon = drv->tcon;
153 149
154 /* Create our layers */ 150 /* Create our layers */
155 scrtc->layers = sun4i_layers_init(drm); 151 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 0a888f73c983..cd0e633cce3a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.h
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.h
@@ -17,7 +17,8 @@ struct sun4i_crtc {
17 struct drm_crtc crtc; 17 struct drm_crtc crtc;
18 struct drm_pending_vblank_event *event; 18 struct drm_pending_vblank_event *event;
19 19
20 struct sun4i_drv *drv; 20 struct sun4i_backend *backend;
21 struct sun4i_tcon *tcon;
21 struct sun4i_layer **layers; 22 struct sun4i_layer **layers;
22}; 23};
23 24