blob: 22b8f5eced80f3407b0fa9fc365c1d9e349d7e54 [file] [log] [blame]
Inki Dae1c248b72011-10-04 19:19:01 +09001/*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
3 * Authors:
4 * Inki Dae <inki.dae@samsung.com>
5 * Joonyoung Shim <jy0922.shim@samsung.com>
6 * Seung-Woo Kim <sw0312.kim@samsung.com>
7 *
Inki Daed81aecb2012-12-18 02:30:17 +09008 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
Inki Dae1c248b72011-10-04 19:19:01 +090012 */
13
David Howells760285e2012-10-02 18:01:07 +010014#include <drm/drmP.h>
15#include <drm/drm_crtc_helper.h>
Inki Dae1c248b72011-10-04 19:19:01 +090016
17#include <drm/exynos_drm.h>
18
19#include "exynos_drm_drv.h"
20#include "exynos_drm_crtc.h"
Inki Daed081f562012-02-15 11:25:19 +090021#include "exynos_drm_encoder.h"
Inki Dae1c248b72011-10-04 19:19:01 +090022#include "exynos_drm_fbdev.h"
23#include "exynos_drm_fb.h"
24#include "exynos_drm_gem.h"
Joonyoung Shim864ee9e2011-12-08 17:54:07 +090025#include "exynos_drm_plane.h"
Inki Daeb73d1232012-03-21 10:55:26 +090026#include "exynos_drm_vidi.h"
Inki Daeb2df26c2012-04-23 21:01:28 +090027#include "exynos_drm_dmabuf.h"
Joonyoung Shimd7f16422012-05-17 20:06:32 +090028#include "exynos_drm_g2d.h"
Eunchul Kimcb471f142012-12-14 18:10:31 +090029#include "exynos_drm_ipp.h"
Inki Dae0519f9a2012-10-20 07:53:42 -070030#include "exynos_drm_iommu.h"
Inki Dae1c248b72011-10-04 19:19:01 +090031
Inki Dae0edf9932011-12-15 17:31:24 +090032#define DRIVER_NAME "exynos"
Inki Dae1c248b72011-10-04 19:19:01 +090033#define DRIVER_DESC "Samsung SoC DRM"
34#define DRIVER_DATE "20110530"
35#define DRIVER_MAJOR 1
36#define DRIVER_MINOR 0
37
Inki Dae52c68812011-12-16 21:31:12 +090038#define VBLANK_OFF_DELAY 50000
39
Rahul Sharma422bd002012-10-16 05:50:12 +053040/* platform device pointer for eynos drm device. */
41static struct platform_device *exynos_drm_pdev;
42
Inki Dae1c248b72011-10-04 19:19:01 +090043static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
44{
45 struct exynos_drm_private *private;
46 int ret;
47 int nr;
48
Inki Dae1c248b72011-10-04 19:19:01 +090049 private = kzalloc(sizeof(struct exynos_drm_private), GFP_KERNEL);
Sachin Kamat38bb5252013-08-19 19:04:55 +090050 if (!private)
Inki Dae1c248b72011-10-04 19:19:01 +090051 return -ENOMEM;
Inki Dae1c248b72011-10-04 19:19:01 +090052
53 INIT_LIST_HEAD(&private->pageflip_event_list);
54 dev->dev_private = (void *)private;
55
Inki Dae0519f9a2012-10-20 07:53:42 -070056 /*
57 * create mapping to manage iommu table and set a pointer to iommu
58 * mapping structure to iommu_mapping of private data.
59 * also this iommu_mapping can be used to check if iommu is supported
60 * or not.
61 */
62 ret = drm_create_iommu_mapping(dev);
63 if (ret < 0) {
64 DRM_ERROR("failed to create iommu mapping.\n");
65 goto err_crtc;
66 }
67
Inki Dae1c248b72011-10-04 19:19:01 +090068 drm_mode_config_init(dev);
69
Seung-Woo Kim7db3eba2011-10-18 16:58:05 +090070 /* init kms poll for handling hpd */
71 drm_kms_helper_poll_init(dev);
72
Inki Dae1c248b72011-10-04 19:19:01 +090073 exynos_drm_mode_config_init(dev);
74
75 /*
76 * EXYNOS4 is enough to have two CRTCs and each crtc would be used
77 * without dependency of hardware.
78 */
79 for (nr = 0; nr < MAX_CRTC; nr++) {
80 ret = exynos_drm_crtc_create(dev, nr);
81 if (ret)
Inki Dae0519f9a2012-10-20 07:53:42 -070082 goto err_release_iommu_mapping;
Inki Dae1c248b72011-10-04 19:19:01 +090083 }
84
Joonyoung Shim864ee9e2011-12-08 17:54:07 +090085 for (nr = 0; nr < MAX_PLANE; nr++) {
Joonyoung Shimb5d2eb32012-06-27 14:27:04 +090086 struct drm_plane *plane;
87 unsigned int possible_crtcs = (1 << MAX_CRTC) - 1;
88
89 plane = exynos_plane_init(dev, possible_crtcs, false);
90 if (!plane)
Inki Dae0519f9a2012-10-20 07:53:42 -070091 goto err_release_iommu_mapping;
Joonyoung Shim864ee9e2011-12-08 17:54:07 +090092 }
93
Inki Dae1c248b72011-10-04 19:19:01 +090094 ret = drm_vblank_init(dev, MAX_CRTC);
95 if (ret)
Inki Dae0519f9a2012-10-20 07:53:42 -070096 goto err_release_iommu_mapping;
Inki Dae1c248b72011-10-04 19:19:01 +090097
98 /*
99 * probe sub drivers such as display controller and hdmi driver,
100 * that were registered at probe() of platform driver
101 * to the sub driver and create encoder and connector for them.
102 */
103 ret = exynos_drm_device_register(dev);
104 if (ret)
105 goto err_vblank;
106
Inki Daed081f562012-02-15 11:25:19 +0900107 /* setup possible_clones. */
108 exynos_drm_encoder_setup(dev);
109
Inki Dae1c248b72011-10-04 19:19:01 +0900110 /*
111 * create and configure fb helper and also exynos specific
112 * fbdev object.
113 */
114 ret = exynos_drm_fbdev_init(dev);
115 if (ret) {
116 DRM_ERROR("failed to initialize drm fbdev\n");
117 goto err_drm_device;
118 }
119
Inki Dae52c68812011-12-16 21:31:12 +0900120 drm_vblank_offdelay = VBLANK_OFF_DELAY;
121
Inki Dae1c248b72011-10-04 19:19:01 +0900122 return 0;
123
124err_drm_device:
125 exynos_drm_device_unregister(dev);
126err_vblank:
127 drm_vblank_cleanup(dev);
Inki Dae0519f9a2012-10-20 07:53:42 -0700128err_release_iommu_mapping:
129 drm_release_iommu_mapping(dev);
Inki Dae1c248b72011-10-04 19:19:01 +0900130err_crtc:
131 drm_mode_config_cleanup(dev);
132 kfree(private);
133
134 return ret;
135}
136
137static int exynos_drm_unload(struct drm_device *dev)
138{
Inki Dae1c248b72011-10-04 19:19:01 +0900139 exynos_drm_fbdev_fini(dev);
140 exynos_drm_device_unregister(dev);
141 drm_vblank_cleanup(dev);
Seung-Woo Kim7db3eba2011-10-18 16:58:05 +0900142 drm_kms_helper_poll_fini(dev);
Inki Dae1c248b72011-10-04 19:19:01 +0900143 drm_mode_config_cleanup(dev);
Inki Dae0519f9a2012-10-20 07:53:42 -0700144
145 drm_release_iommu_mapping(dev);
Inki Dae1c248b72011-10-04 19:19:01 +0900146 kfree(dev->dev_private);
147
148 dev->dev_private = NULL;
149
150 return 0;
151}
152
Joonyoung Shim9084f7b2012-03-16 18:47:09 +0900153static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
Inki Daeccf4d882011-10-14 13:29:51 +0900154{
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900155 struct drm_exynos_file_private *file_priv;
YoungJun Choba3706c2013-07-01 17:00:47 +0900156 int ret;
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900157
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900158 file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL);
159 if (!file_priv)
160 return -ENOMEM;
161
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900162 file->driver_priv = file_priv;
Inki Daeb2df26c2012-04-23 21:01:28 +0900163
YoungJun Choba3706c2013-07-01 17:00:47 +0900164 ret = exynos_drm_subdrv_open(dev, file);
165 if (ret) {
166 kfree(file_priv);
167 file->driver_priv = NULL;
168 }
169
170 return ret;
Joonyoung Shim9084f7b2012-03-16 18:47:09 +0900171}
172
Inki Daeccf4d882011-10-14 13:29:51 +0900173static void exynos_drm_preclose(struct drm_device *dev,
174 struct drm_file *file)
175{
Joonyoung Shim9084f7b2012-03-16 18:47:09 +0900176 exynos_drm_subdrv_close(dev, file);
Inki Daeccf4d882011-10-14 13:29:51 +0900177}
178
Inki Dae53ef2992012-02-15 11:25:22 +0900179static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
180{
Inki Dae0cbc3302013-10-01 14:51:37 +0900181 struct exynos_drm_private *private = dev->dev_private;
182 struct drm_pending_vblank_event *v, *vt;
183 struct drm_pending_event *e, *et;
184 unsigned long flags;
185
Inki Dae53ef2992012-02-15 11:25:22 +0900186 if (!file->driver_priv)
187 return;
188
Inki Dae0cbc3302013-10-01 14:51:37 +0900189 /* Release all events not unhandled by page flip handler. */
190 spin_lock_irqsave(&dev->event_lock, flags);
191 list_for_each_entry_safe(v, vt, &private->pageflip_event_list,
192 base.link) {
193 if (v->base.file_priv == file) {
194 list_del(&v->base.link);
195 drm_vblank_put(dev, v->pipe);
196 v->base.destroy(&v->base);
197 }
198 }
199
200 /* Release all events handled by page flip handler but not freed. */
201 list_for_each_entry_safe(e, et, &file->event_list, link) {
202 list_del(&e->link);
203 e->destroy(e);
204 }
205 spin_unlock_irqrestore(&dev->event_lock, flags);
206
207
Inki Dae53ef2992012-02-15 11:25:22 +0900208 kfree(file->driver_priv);
209 file->driver_priv = NULL;
210}
211
Inki Dae1c248b72011-10-04 19:19:01 +0900212static void exynos_drm_lastclose(struct drm_device *dev)
213{
Inki Dae1c248b72011-10-04 19:19:01 +0900214 exynos_drm_fbdev_restore_mode(dev);
215}
216
Laurent Pinchart78b68552012-05-17 13:27:22 +0200217static const struct vm_operations_struct exynos_drm_gem_vm_ops = {
Inki Dae1c248b72011-10-04 19:19:01 +0900218 .fault = exynos_drm_gem_fault,
219 .open = drm_gem_vm_open,
220 .close = drm_gem_vm_close,
221};
222
Rob Clarkbaa70942013-08-02 13:27:49 -0400223static const struct drm_ioctl_desc exynos_ioctls[] = {
Inki Dae1c248b72011-10-04 19:19:01 +0900224 DRM_IOCTL_DEF_DRV(EXYNOS_GEM_CREATE, exynos_drm_gem_create_ioctl,
225 DRM_UNLOCKED | DRM_AUTH),
226 DRM_IOCTL_DEF_DRV(EXYNOS_GEM_MAP_OFFSET,
227 exynos_drm_gem_map_offset_ioctl, DRM_UNLOCKED |
228 DRM_AUTH),
229 DRM_IOCTL_DEF_DRV(EXYNOS_GEM_MMAP,
230 exynos_drm_gem_mmap_ioctl, DRM_UNLOCKED | DRM_AUTH),
Inki Dae40cd7e02012-05-04 15:51:17 +0900231 DRM_IOCTL_DEF_DRV(EXYNOS_GEM_GET,
232 exynos_drm_gem_get_ioctl, DRM_UNLOCKED),
Inki Daeb73d1232012-03-21 10:55:26 +0900233 DRM_IOCTL_DEF_DRV(EXYNOS_VIDI_CONNECTION,
234 vidi_connection_ioctl, DRM_UNLOCKED | DRM_AUTH),
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900235 DRM_IOCTL_DEF_DRV(EXYNOS_G2D_GET_VER,
236 exynos_g2d_get_ver_ioctl, DRM_UNLOCKED | DRM_AUTH),
237 DRM_IOCTL_DEF_DRV(EXYNOS_G2D_SET_CMDLIST,
238 exynos_g2d_set_cmdlist_ioctl, DRM_UNLOCKED | DRM_AUTH),
239 DRM_IOCTL_DEF_DRV(EXYNOS_G2D_EXEC,
240 exynos_g2d_exec_ioctl, DRM_UNLOCKED | DRM_AUTH),
Eunchul Kimcb471f142012-12-14 18:10:31 +0900241 DRM_IOCTL_DEF_DRV(EXYNOS_IPP_GET_PROPERTY,
242 exynos_drm_ipp_get_property, DRM_UNLOCKED | DRM_AUTH),
243 DRM_IOCTL_DEF_DRV(EXYNOS_IPP_SET_PROPERTY,
244 exynos_drm_ipp_set_property, DRM_UNLOCKED | DRM_AUTH),
245 DRM_IOCTL_DEF_DRV(EXYNOS_IPP_QUEUE_BUF,
246 exynos_drm_ipp_queue_buf, DRM_UNLOCKED | DRM_AUTH),
247 DRM_IOCTL_DEF_DRV(EXYNOS_IPP_CMD_CTRL,
248 exynos_drm_ipp_cmd_ctrl, DRM_UNLOCKED | DRM_AUTH),
Inki Dae1c248b72011-10-04 19:19:01 +0900249};
250
Joonyoung Shimac2bdf72011-12-08 15:00:20 +0900251static const struct file_operations exynos_drm_driver_fops = {
252 .owner = THIS_MODULE,
253 .open = drm_open,
254 .mmap = exynos_drm_gem_mmap,
255 .poll = drm_poll,
256 .read = drm_read,
257 .unlocked_ioctl = drm_ioctl,
Keith Packard804d74a2012-07-09 15:40:07 -0700258#ifdef CONFIG_COMPAT
259 .compat_ioctl = drm_compat_ioctl,
260#endif
Joonyoung Shimac2bdf72011-12-08 15:00:20 +0900261 .release = drm_release,
262};
263
Inki Dae1c248b72011-10-04 19:19:01 +0900264static struct drm_driver exynos_drm_driver = {
Laurent Pinchart293a1c12012-05-16 17:08:53 +0200265 .driver_features = DRIVER_HAVE_IRQ | DRIVER_MODESET |
266 DRIVER_GEM | DRIVER_PRIME,
Inki Dae1c248b72011-10-04 19:19:01 +0900267 .load = exynos_drm_load,
268 .unload = exynos_drm_unload,
Joonyoung Shim9084f7b2012-03-16 18:47:09 +0900269 .open = exynos_drm_open,
Inki Daeccf4d882011-10-14 13:29:51 +0900270 .preclose = exynos_drm_preclose,
Inki Dae1c248b72011-10-04 19:19:01 +0900271 .lastclose = exynos_drm_lastclose,
Inki Dae53ef2992012-02-15 11:25:22 +0900272 .postclose = exynos_drm_postclose,
Inki Dae1c248b72011-10-04 19:19:01 +0900273 .get_vblank_counter = drm_vblank_count,
274 .enable_vblank = exynos_drm_crtc_enable_vblank,
275 .disable_vblank = exynos_drm_crtc_disable_vblank,
Inki Dae1c248b72011-10-04 19:19:01 +0900276 .gem_free_object = exynos_drm_gem_free_object,
277 .gem_vm_ops = &exynos_drm_gem_vm_ops,
278 .dumb_create = exynos_drm_gem_dumb_create,
279 .dumb_map_offset = exynos_drm_gem_dumb_map_offset,
Daniel Vetter43387b32013-07-16 09:12:04 +0200280 .dumb_destroy = drm_gem_dumb_destroy,
Inki Daeb2df26c2012-04-23 21:01:28 +0900281 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
282 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
283 .gem_prime_export = exynos_dmabuf_prime_export,
284 .gem_prime_import = exynos_dmabuf_prime_import,
Inki Dae1c248b72011-10-04 19:19:01 +0900285 .ioctls = exynos_ioctls,
Rob Clarkbaa70942013-08-02 13:27:49 -0400286 .num_ioctls = ARRAY_SIZE(exynos_ioctls),
Joonyoung Shimac2bdf72011-12-08 15:00:20 +0900287 .fops = &exynos_drm_driver_fops,
Inki Dae1c248b72011-10-04 19:19:01 +0900288 .name = DRIVER_NAME,
289 .desc = DRIVER_DESC,
290 .date = DRIVER_DATE,
291 .major = DRIVER_MAJOR,
292 .minor = DRIVER_MINOR,
293};
294
295static int exynos_drm_platform_probe(struct platform_device *pdev)
296{
Russell Kingd6cfaab2013-06-10 18:41:59 +0100297 int ret;
298
299 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
300 if (ret)
301 return ret;
Inki Dae1c248b72011-10-04 19:19:01 +0900302
303 return drm_platform_init(&exynos_drm_driver, pdev);
304}
305
306static int exynos_drm_platform_remove(struct platform_device *pdev)
307{
Inki Dae1c248b72011-10-04 19:19:01 +0900308 drm_platform_exit(&exynos_drm_driver, pdev);
309
310 return 0;
311}
312
313static struct platform_driver exynos_drm_platform_driver = {
314 .probe = exynos_drm_platform_probe,
Greg Kroah-Hartman56550d92012-12-21 15:09:25 -0800315 .remove = exynos_drm_platform_remove,
Inki Dae1c248b72011-10-04 19:19:01 +0900316 .driver = {
317 .owner = THIS_MODULE,
Marek Szyprowski9866b6c2012-03-05 12:02:30 +0100318 .name = "exynos-drm",
Inki Dae1c248b72011-10-04 19:19:01 +0900319 },
320};
321
322static int __init exynos_drm_init(void)
323{
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900324 int ret;
325
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900326#ifdef CONFIG_DRM_EXYNOS_FIMD
327 ret = platform_driver_register(&fimd_driver);
328 if (ret < 0)
329 goto out_fimd;
330#endif
331
332#ifdef CONFIG_DRM_EXYNOS_HDMI
333 ret = platform_driver_register(&hdmi_driver);
334 if (ret < 0)
335 goto out_hdmi;
336 ret = platform_driver_register(&mixer_driver);
337 if (ret < 0)
338 goto out_mixer;
339 ret = platform_driver_register(&exynos_drm_common_hdmi_driver);
340 if (ret < 0)
341 goto out_common_hdmi;
Rahul Sharmaae9dace2012-10-16 05:50:13 +0530342
343 ret = exynos_platform_device_hdmi_register();
344 if (ret < 0)
345 goto out_common_hdmi_dev;
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900346#endif
347
Inki Daeb73d1232012-03-21 10:55:26 +0900348#ifdef CONFIG_DRM_EXYNOS_VIDI
349 ret = platform_driver_register(&vidi_driver);
350 if (ret < 0)
351 goto out_vidi;
352#endif
353
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900354#ifdef CONFIG_DRM_EXYNOS_G2D
355 ret = platform_driver_register(&g2d_driver);
356 if (ret < 0)
357 goto out_g2d;
358#endif
359
Eunchul Kim16102ed2012-12-14 17:58:55 +0900360#ifdef CONFIG_DRM_EXYNOS_FIMC
361 ret = platform_driver_register(&fimc_driver);
362 if (ret < 0)
363 goto out_fimc;
364#endif
365
Eunchul Kimbea8a422012-12-14 17:58:56 +0900366#ifdef CONFIG_DRM_EXYNOS_ROTATOR
367 ret = platform_driver_register(&rotator_driver);
368 if (ret < 0)
369 goto out_rotator;
370#endif
371
Eunchul Kimf2646382012-12-14 17:58:57 +0900372#ifdef CONFIG_DRM_EXYNOS_GSC
373 ret = platform_driver_register(&gsc_driver);
374 if (ret < 0)
375 goto out_gsc;
376#endif
377
Eunchul Kimcb471f142012-12-14 18:10:31 +0900378#ifdef CONFIG_DRM_EXYNOS_IPP
379 ret = platform_driver_register(&ipp_driver);
380 if (ret < 0)
381 goto out_ipp;
Seung-Woo Kim43f41902013-04-23 14:02:53 +0900382
383 ret = exynos_platform_device_ipp_register();
384 if (ret < 0)
385 goto out_ipp_dev;
Eunchul Kimcb471f142012-12-14 18:10:31 +0900386#endif
387
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900388 ret = platform_driver_register(&exynos_drm_platform_driver);
389 if (ret < 0)
Rahul Sharma422bd002012-10-16 05:50:12 +0530390 goto out_drm;
391
392 exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1,
393 NULL, 0);
Seung-Woo Kim1055f492013-04-22 17:13:13 +0900394 if (IS_ERR(exynos_drm_pdev)) {
Rahul Sharma422bd002012-10-16 05:50:12 +0530395 ret = PTR_ERR(exynos_drm_pdev);
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900396 goto out;
Rahul Sharma422bd002012-10-16 05:50:12 +0530397 }
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900398
399 return 0;
400
401out:
Rahul Sharma422bd002012-10-16 05:50:12 +0530402 platform_driver_unregister(&exynos_drm_platform_driver);
403
404out_drm:
Eunchul Kimcb471f142012-12-14 18:10:31 +0900405#ifdef CONFIG_DRM_EXYNOS_IPP
Seung-Woo Kim43f41902013-04-23 14:02:53 +0900406 exynos_platform_device_ipp_unregister();
407out_ipp_dev:
Eunchul Kimcb471f142012-12-14 18:10:31 +0900408 platform_driver_unregister(&ipp_driver);
409out_ipp:
410#endif
411
Eunchul Kimf2646382012-12-14 17:58:57 +0900412#ifdef CONFIG_DRM_EXYNOS_GSC
413 platform_driver_unregister(&gsc_driver);
414out_gsc:
415#endif
416
Eunchul Kimbea8a422012-12-14 17:58:56 +0900417#ifdef CONFIG_DRM_EXYNOS_ROTATOR
418 platform_driver_unregister(&rotator_driver);
419out_rotator:
420#endif
421
Eunchul Kim16102ed2012-12-14 17:58:55 +0900422#ifdef CONFIG_DRM_EXYNOS_FIMC
423 platform_driver_unregister(&fimc_driver);
424out_fimc:
425#endif
426
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900427#ifdef CONFIG_DRM_EXYNOS_G2D
428 platform_driver_unregister(&g2d_driver);
429out_g2d:
430#endif
431
Inki Daeb73d1232012-03-21 10:55:26 +0900432#ifdef CONFIG_DRM_EXYNOS_VIDI
Inki Daeb73d1232012-03-21 10:55:26 +0900433 platform_driver_unregister(&vidi_driver);
Rahul Sharmaae9dace2012-10-16 05:50:13 +0530434out_vidi:
Inki Daeb73d1232012-03-21 10:55:26 +0900435#endif
436
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900437#ifdef CONFIG_DRM_EXYNOS_HDMI
Rahul Sharmaae9dace2012-10-16 05:50:13 +0530438 exynos_platform_device_hdmi_unregister();
439out_common_hdmi_dev:
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900440 platform_driver_unregister(&exynos_drm_common_hdmi_driver);
441out_common_hdmi:
442 platform_driver_unregister(&mixer_driver);
443out_mixer:
444 platform_driver_unregister(&hdmi_driver);
445out_hdmi:
446#endif
447
448#ifdef CONFIG_DRM_EXYNOS_FIMD
449 platform_driver_unregister(&fimd_driver);
450out_fimd:
451#endif
452 return ret;
Inki Dae1c248b72011-10-04 19:19:01 +0900453}
454
455static void __exit exynos_drm_exit(void)
456{
Rahul Sharma422bd002012-10-16 05:50:12 +0530457 platform_device_unregister(exynos_drm_pdev);
458
Inki Dae1c248b72011-10-04 19:19:01 +0900459 platform_driver_unregister(&exynos_drm_platform_driver);
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900460
Eunchul Kimcb471f142012-12-14 18:10:31 +0900461#ifdef CONFIG_DRM_EXYNOS_IPP
Seung-Woo Kim43f41902013-04-23 14:02:53 +0900462 exynos_platform_device_ipp_unregister();
Eunchul Kimcb471f142012-12-14 18:10:31 +0900463 platform_driver_unregister(&ipp_driver);
464#endif
465
Eunchul Kimf2646382012-12-14 17:58:57 +0900466#ifdef CONFIG_DRM_EXYNOS_GSC
467 platform_driver_unregister(&gsc_driver);
468#endif
469
Eunchul Kimbea8a422012-12-14 17:58:56 +0900470#ifdef CONFIG_DRM_EXYNOS_ROTATOR
471 platform_driver_unregister(&rotator_driver);
472#endif
473
Eunchul Kim16102ed2012-12-14 17:58:55 +0900474#ifdef CONFIG_DRM_EXYNOS_FIMC
475 platform_driver_unregister(&fimc_driver);
476#endif
477
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900478#ifdef CONFIG_DRM_EXYNOS_G2D
479 platform_driver_unregister(&g2d_driver);
480#endif
481
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900482#ifdef CONFIG_DRM_EXYNOS_HDMI
Rahul Sharmaae9dace2012-10-16 05:50:13 +0530483 exynos_platform_device_hdmi_unregister();
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900484 platform_driver_unregister(&exynos_drm_common_hdmi_driver);
485 platform_driver_unregister(&mixer_driver);
486 platform_driver_unregister(&hdmi_driver);
487#endif
488
Inki Daeb73d1232012-03-21 10:55:26 +0900489#ifdef CONFIG_DRM_EXYNOS_VIDI
490 platform_driver_unregister(&vidi_driver);
491#endif
492
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900493#ifdef CONFIG_DRM_EXYNOS_FIMD
494 platform_driver_unregister(&fimd_driver);
495#endif
Inki Dae1c248b72011-10-04 19:19:01 +0900496}
497
498module_init(exynos_drm_init);
499module_exit(exynos_drm_exit);
500
501MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>");
502MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>");
503MODULE_AUTHOR("Seung-Woo Kim <sw0312.kim@samsung.com>");
504MODULE_DESCRIPTION("Samsung SoC DRM Driver");
505MODULE_LICENSE("GPL");