diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2017-02-07 04:16:24 -0500 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2017-02-09 03:07:24 -0500 |
commit | 44b460cfe55483f4b14dd8beb4953f452be1a005 (patch) | |
tree | 9a6bfe76c103e9b7c05ce685279229e3fded2102 /drivers/gpu/drm/imx/imx-drm-core.c | |
parent | 14de02cdb0b8c8f34fe9c490cf6e426d529663ef (diff) |
drm: imx: remove struct imx_drm_crtc and imx_drm_crtc_helper_funcs
With the vblank hooks in struct drm_crtc_funcs, we do not need to
maintain the CRTC specific vblank callbacks with struct
imx_drm_crtc_helper_funcs any more. By moving the stuff that we
currently do in imx_drm_add_crtc(), like of_node setting and
drm_crtc_helper_add()/drm_crtc_init_with_planes() invoking, we can kill
things like struct imx_drm_crtc, imx_drm_crtc_helper_funcs and related
functions completely.
Functions ipu_enable_vblank() and ipu_disable_vblank() are moved around
without changes, only for saving the forward declarations.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: http://patchwork.freedesktop.org/patch/msgid/1486458995-31018-13-git-send-email-shawnguo@kernel.org
Diffstat (limited to 'drivers/gpu/drm/imx/imx-drm-core.c')
-rw-r--r-- | drivers/gpu/drm/imx/imx-drm-core.c | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 4badbb66d69e..65bd8b8a2494 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c | |||
@@ -40,17 +40,11 @@ struct imx_drm_component { | |||
40 | 40 | ||
41 | struct imx_drm_device { | 41 | struct imx_drm_device { |
42 | struct drm_device *drm; | 42 | struct drm_device *drm; |
43 | struct imx_drm_crtc *crtc[MAX_CRTC]; | ||
44 | unsigned int pipes; | 43 | unsigned int pipes; |
45 | struct drm_fbdev_cma *fbhelper; | 44 | struct drm_fbdev_cma *fbhelper; |
46 | struct drm_atomic_state *state; | 45 | struct drm_atomic_state *state; |
47 | }; | 46 | }; |
48 | 47 | ||
49 | struct imx_drm_crtc { | ||
50 | struct drm_crtc *crtc; | ||
51 | struct imx_drm_crtc_helper_funcs imx_drm_helper_funcs; | ||
52 | }; | ||
53 | |||
54 | #if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) | 48 | #if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) |
55 | static int legacyfb_depth = 16; | 49 | static int legacyfb_depth = 16; |
56 | module_param(legacyfb_depth, int, 0444); | 50 | module_param(legacyfb_depth, int, 0444); |
@@ -63,38 +57,6 @@ static void imx_drm_driver_lastclose(struct drm_device *drm) | |||
63 | drm_fbdev_cma_restore_mode(imxdrm->fbhelper); | 57 | drm_fbdev_cma_restore_mode(imxdrm->fbhelper); |
64 | } | 58 | } |
65 | 59 | ||
66 | static int imx_drm_enable_vblank(struct drm_device *drm, unsigned int pipe) | ||
67 | { | ||
68 | struct imx_drm_device *imxdrm = drm->dev_private; | ||
69 | struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[pipe]; | ||
70 | int ret; | ||
71 | |||
72 | if (!imx_drm_crtc) | ||
73 | return -EINVAL; | ||
74 | |||
75 | if (!imx_drm_crtc->imx_drm_helper_funcs.enable_vblank) | ||
76 | return -ENOSYS; | ||
77 | |||
78 | ret = imx_drm_crtc->imx_drm_helper_funcs.enable_vblank( | ||
79 | imx_drm_crtc->crtc); | ||
80 | |||
81 | return ret; | ||
82 | } | ||
83 | |||
84 | static void imx_drm_disable_vblank(struct drm_device *drm, unsigned int pipe) | ||
85 | { | ||
86 | struct imx_drm_device *imxdrm = drm->dev_private; | ||
87 | struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[pipe]; | ||
88 | |||
89 | if (!imx_drm_crtc) | ||
90 | return; | ||
91 | |||
92 | if (!imx_drm_crtc->imx_drm_helper_funcs.disable_vblank) | ||
93 | return; | ||
94 | |||
95 | imx_drm_crtc->imx_drm_helper_funcs.disable_vblank(imx_drm_crtc->crtc); | ||
96 | } | ||
97 | |||
98 | static const struct file_operations imx_drm_driver_fops = { | 60 | static const struct file_operations imx_drm_driver_fops = { |
99 | .owner = THIS_MODULE, | 61 | .owner = THIS_MODULE, |
100 | .open = drm_open, | 62 | .open = drm_open, |
@@ -180,67 +142,6 @@ static struct drm_mode_config_helper_funcs imx_drm_mode_config_helpers = { | |||
180 | .atomic_commit_tail = imx_drm_atomic_commit_tail, | 142 | .atomic_commit_tail = imx_drm_atomic_commit_tail, |
181 | }; | 143 | }; |
182 | 144 | ||
183 | /* | ||
184 | * imx_drm_add_crtc - add a new crtc | ||
185 | */ | ||
186 | int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, | ||
187 | struct imx_drm_crtc **new_crtc, struct drm_plane *primary_plane, | ||
188 | const struct imx_drm_crtc_helper_funcs *imx_drm_helper_funcs, | ||
189 | struct device_node *port) | ||
190 | { | ||
191 | struct imx_drm_device *imxdrm = drm->dev_private; | ||
192 | struct imx_drm_crtc *imx_drm_crtc; | ||
193 | |||
194 | /* | ||
195 | * The vblank arrays are dimensioned by MAX_CRTC - we can't | ||
196 | * pass IDs greater than this to those functions. | ||
197 | */ | ||
198 | if (imxdrm->pipes >= MAX_CRTC) | ||
199 | return -EINVAL; | ||
200 | |||
201 | if (imxdrm->drm->open_count) | ||
202 | return -EBUSY; | ||
203 | |||
204 | imx_drm_crtc = kzalloc(sizeof(*imx_drm_crtc), GFP_KERNEL); | ||
205 | if (!imx_drm_crtc) | ||
206 | return -ENOMEM; | ||
207 | |||
208 | imx_drm_crtc->imx_drm_helper_funcs = *imx_drm_helper_funcs; | ||
209 | imx_drm_crtc->crtc = crtc; | ||
210 | |||
211 | crtc->port = port; | ||
212 | |||
213 | imxdrm->crtc[imxdrm->pipes++] = imx_drm_crtc; | ||
214 | |||
215 | *new_crtc = imx_drm_crtc; | ||
216 | |||
217 | drm_crtc_helper_add(crtc, | ||
218 | imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs); | ||
219 | |||
220 | drm_crtc_init_with_planes(drm, crtc, primary_plane, NULL, | ||
221 | imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs, NULL); | ||
222 | |||
223 | return 0; | ||
224 | } | ||
225 | EXPORT_SYMBOL_GPL(imx_drm_add_crtc); | ||
226 | |||
227 | /* | ||
228 | * imx_drm_remove_crtc - remove a crtc | ||
229 | */ | ||
230 | int imx_drm_remove_crtc(struct imx_drm_crtc *imx_drm_crtc) | ||
231 | { | ||
232 | struct imx_drm_device *imxdrm = imx_drm_crtc->crtc->dev->dev_private; | ||
233 | unsigned int pipe = drm_crtc_index(imx_drm_crtc->crtc); | ||
234 | |||
235 | drm_crtc_cleanup(imx_drm_crtc->crtc); | ||
236 | |||
237 | imxdrm->crtc[pipe] = NULL; | ||
238 | |||
239 | kfree(imx_drm_crtc); | ||
240 | |||
241 | return 0; | ||
242 | } | ||
243 | EXPORT_SYMBOL_GPL(imx_drm_remove_crtc); | ||
244 | 145 | ||
245 | int imx_drm_encoder_parse_of(struct drm_device *drm, | 146 | int imx_drm_encoder_parse_of(struct drm_device *drm, |
246 | struct drm_encoder *encoder, struct device_node *np) | 147 | struct drm_encoder *encoder, struct device_node *np) |
@@ -288,8 +189,6 @@ static struct drm_driver imx_drm_driver = { | |||
288 | .gem_prime_vmap = drm_gem_cma_prime_vmap, | 189 | .gem_prime_vmap = drm_gem_cma_prime_vmap, |
289 | .gem_prime_vunmap = drm_gem_cma_prime_vunmap, | 190 | .gem_prime_vunmap = drm_gem_cma_prime_vunmap, |
290 | .gem_prime_mmap = drm_gem_cma_prime_mmap, | 191 | .gem_prime_mmap = drm_gem_cma_prime_mmap, |
291 | .enable_vblank = imx_drm_enable_vblank, | ||
292 | .disable_vblank = imx_drm_disable_vblank, | ||
293 | .ioctls = imx_drm_ioctls, | 192 | .ioctls = imx_drm_ioctls, |
294 | .num_ioctls = ARRAY_SIZE(imx_drm_ioctls), | 193 | .num_ioctls = ARRAY_SIZE(imx_drm_ioctls), |
295 | .fops = &imx_drm_driver_fops, | 194 | .fops = &imx_drm_driver_fops, |