blob: 215131ab1dd2f2b65c707c6d367d50ec967c27d6 [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
Inki Dae96f54212013-12-20 19:16:24 +090017#include <linux/anon_inodes.h>
18
Inki Dae1c248b72011-10-04 19:19:01 +090019#include <drm/exynos_drm.h>
20
21#include "exynos_drm_drv.h"
22#include "exynos_drm_crtc.h"
Inki Daed081f562012-02-15 11:25:19 +090023#include "exynos_drm_encoder.h"
Inki Dae1c248b72011-10-04 19:19:01 +090024#include "exynos_drm_fbdev.h"
25#include "exynos_drm_fb.h"
26#include "exynos_drm_gem.h"
Joonyoung Shim864ee9e2011-12-08 17:54:07 +090027#include "exynos_drm_plane.h"
Inki Daeb73d1232012-03-21 10:55:26 +090028#include "exynos_drm_vidi.h"
Inki Daeb2df26c2012-04-23 21:01:28 +090029#include "exynos_drm_dmabuf.h"
Joonyoung Shimd7f16422012-05-17 20:06:32 +090030#include "exynos_drm_g2d.h"
Eunchul Kimcb471f142012-12-14 18:10:31 +090031#include "exynos_drm_ipp.h"
Inki Dae0519f9a2012-10-20 07:53:42 -070032#include "exynos_drm_iommu.h"
Inki Dae1c248b72011-10-04 19:19:01 +090033
Inki Dae0edf9932011-12-15 17:31:24 +090034#define DRIVER_NAME "exynos"
Inki Dae1c248b72011-10-04 19:19:01 +090035#define DRIVER_DESC "Samsung SoC DRM"
36#define DRIVER_DATE "20110530"
37#define DRIVER_MAJOR 1
38#define DRIVER_MINOR 0
39
Inki Dae52c68812011-12-16 21:31:12 +090040#define VBLANK_OFF_DELAY 50000
41
Rahul Sharma422bd002012-10-16 05:50:12 +053042/* platform device pointer for eynos drm device. */
43static struct platform_device *exynos_drm_pdev;
44
Inki Dae1c248b72011-10-04 19:19:01 +090045static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
46{
47 struct exynos_drm_private *private;
48 int ret;
49 int nr;
50
Inki Dae1c248b72011-10-04 19:19:01 +090051 private = kzalloc(sizeof(struct exynos_drm_private), GFP_KERNEL);
Sachin Kamat38bb5252013-08-19 19:04:55 +090052 if (!private)
Inki Dae1c248b72011-10-04 19:19:01 +090053 return -ENOMEM;
Inki Dae1c248b72011-10-04 19:19:01 +090054
55 INIT_LIST_HEAD(&private->pageflip_event_list);
56 dev->dev_private = (void *)private;
57
Inki Dae0519f9a2012-10-20 07:53:42 -070058 /*
59 * create mapping to manage iommu table and set a pointer to iommu
60 * mapping structure to iommu_mapping of private data.
61 * also this iommu_mapping can be used to check if iommu is supported
62 * or not.
63 */
64 ret = drm_create_iommu_mapping(dev);
65 if (ret < 0) {
66 DRM_ERROR("failed to create iommu mapping.\n");
67 goto err_crtc;
68 }
69
Inki Dae1c248b72011-10-04 19:19:01 +090070 drm_mode_config_init(dev);
71
Seung-Woo Kim7db3eba2011-10-18 16:58:05 +090072 /* init kms poll for handling hpd */
73 drm_kms_helper_poll_init(dev);
74
Inki Dae1c248b72011-10-04 19:19:01 +090075 exynos_drm_mode_config_init(dev);
76
77 /*
78 * EXYNOS4 is enough to have two CRTCs and each crtc would be used
79 * without dependency of hardware.
80 */
81 for (nr = 0; nr < MAX_CRTC; nr++) {
82 ret = exynos_drm_crtc_create(dev, nr);
83 if (ret)
Inki Dae0519f9a2012-10-20 07:53:42 -070084 goto err_release_iommu_mapping;
Inki Dae1c248b72011-10-04 19:19:01 +090085 }
86
Joonyoung Shim864ee9e2011-12-08 17:54:07 +090087 for (nr = 0; nr < MAX_PLANE; nr++) {
Joonyoung Shimb5d2eb32012-06-27 14:27:04 +090088 struct drm_plane *plane;
89 unsigned int possible_crtcs = (1 << MAX_CRTC) - 1;
90
91 plane = exynos_plane_init(dev, possible_crtcs, false);
92 if (!plane)
Inki Dae0519f9a2012-10-20 07:53:42 -070093 goto err_release_iommu_mapping;
Joonyoung Shim864ee9e2011-12-08 17:54:07 +090094 }
95
Inki Dae1c248b72011-10-04 19:19:01 +090096 ret = drm_vblank_init(dev, MAX_CRTC);
97 if (ret)
Inki Dae0519f9a2012-10-20 07:53:42 -070098 goto err_release_iommu_mapping;
Inki Dae1c248b72011-10-04 19:19:01 +090099
100 /*
101 * probe sub drivers such as display controller and hdmi driver,
102 * that were registered at probe() of platform driver
103 * to the sub driver and create encoder and connector for them.
104 */
105 ret = exynos_drm_device_register(dev);
106 if (ret)
107 goto err_vblank;
108
Inki Daed081f562012-02-15 11:25:19 +0900109 /* setup possible_clones. */
110 exynos_drm_encoder_setup(dev);
111
Inki Dae1c248b72011-10-04 19:19:01 +0900112 /*
113 * create and configure fb helper and also exynos specific
114 * fbdev object.
115 */
116 ret = exynos_drm_fbdev_init(dev);
117 if (ret) {
118 DRM_ERROR("failed to initialize drm fbdev\n");
119 goto err_drm_device;
120 }
121
Inki Dae52c68812011-12-16 21:31:12 +0900122 drm_vblank_offdelay = VBLANK_OFF_DELAY;
123
Daniel Vettera9a346d2013-12-11 11:34:23 +0100124 platform_set_drvdata(dev->platformdev, dev);
125
Inki Dae1c248b72011-10-04 19:19:01 +0900126 return 0;
127
128err_drm_device:
129 exynos_drm_device_unregister(dev);
130err_vblank:
131 drm_vblank_cleanup(dev);
Inki Dae0519f9a2012-10-20 07:53:42 -0700132err_release_iommu_mapping:
133 drm_release_iommu_mapping(dev);
Inki Dae1c248b72011-10-04 19:19:01 +0900134err_crtc:
135 drm_mode_config_cleanup(dev);
136 kfree(private);
137
138 return ret;
139}
140
141static int exynos_drm_unload(struct drm_device *dev)
142{
Inki Dae1c248b72011-10-04 19:19:01 +0900143 exynos_drm_fbdev_fini(dev);
144 exynos_drm_device_unregister(dev);
145 drm_vblank_cleanup(dev);
Seung-Woo Kim7db3eba2011-10-18 16:58:05 +0900146 drm_kms_helper_poll_fini(dev);
Inki Dae1c248b72011-10-04 19:19:01 +0900147 drm_mode_config_cleanup(dev);
Inki Dae0519f9a2012-10-20 07:53:42 -0700148
149 drm_release_iommu_mapping(dev);
Inki Dae1c248b72011-10-04 19:19:01 +0900150 kfree(dev->dev_private);
151
152 dev->dev_private = NULL;
153
154 return 0;
155}
156
Inki Dae96f54212013-12-20 19:16:24 +0900157static const struct file_operations exynos_drm_gem_fops = {
158 .mmap = exynos_drm_gem_mmap_buffer,
159};
160
Joonyoung Shim9084f7b2012-03-16 18:47:09 +0900161static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
Inki Daeccf4d882011-10-14 13:29:51 +0900162{
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900163 struct drm_exynos_file_private *file_priv;
Inki Dae96f54212013-12-20 19:16:24 +0900164 struct file *anon_filp;
YoungJun Choba3706c2013-07-01 17:00:47 +0900165 int ret;
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900166
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900167 file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL);
168 if (!file_priv)
169 return -ENOMEM;
170
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900171 file->driver_priv = file_priv;
Inki Daeb2df26c2012-04-23 21:01:28 +0900172
YoungJun Choba3706c2013-07-01 17:00:47 +0900173 ret = exynos_drm_subdrv_open(dev, file);
Sachin Kamat6ca605f2014-01-16 11:31:26 +0530174 if (ret)
175 goto out;
YoungJun Choba3706c2013-07-01 17:00:47 +0900176
Inki Dae96f54212013-12-20 19:16:24 +0900177 anon_filp = anon_inode_getfile("exynos_gem", &exynos_drm_gem_fops,
178 NULL, 0);
179 if (IS_ERR(anon_filp)) {
Sachin Kamat6ca605f2014-01-16 11:31:26 +0530180 ret = PTR_ERR(anon_filp);
181 goto out;
Inki Dae96f54212013-12-20 19:16:24 +0900182 }
183
184 anon_filp->f_mode = FMODE_READ | FMODE_WRITE;
185 file_priv->anon_filp = anon_filp;
186
YoungJun Choba3706c2013-07-01 17:00:47 +0900187 return ret;
Sachin Kamat6ca605f2014-01-16 11:31:26 +0530188out:
189 kfree(file_priv);
190 file->driver_priv = NULL;
191 return ret;
Joonyoung Shim9084f7b2012-03-16 18:47:09 +0900192}
193
Inki Daeccf4d882011-10-14 13:29:51 +0900194static void exynos_drm_preclose(struct drm_device *dev,
195 struct drm_file *file)
196{
Joonyoung Shim9084f7b2012-03-16 18:47:09 +0900197 exynos_drm_subdrv_close(dev, file);
Inki Daeccf4d882011-10-14 13:29:51 +0900198}
199
Inki Dae53ef2992012-02-15 11:25:22 +0900200static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
201{
Inki Dae0cbc3302013-10-01 14:51:37 +0900202 struct exynos_drm_private *private = dev->dev_private;
Inki Dae96f54212013-12-20 19:16:24 +0900203 struct drm_exynos_file_private *file_priv;
Inki Dae0cbc3302013-10-01 14:51:37 +0900204 struct drm_pending_vblank_event *v, *vt;
205 struct drm_pending_event *e, *et;
206 unsigned long flags;
207
Inki Dae53ef2992012-02-15 11:25:22 +0900208 if (!file->driver_priv)
209 return;
210
Inki Dae0cbc3302013-10-01 14:51:37 +0900211 /* Release all events not unhandled by page flip handler. */
212 spin_lock_irqsave(&dev->event_lock, flags);
213 list_for_each_entry_safe(v, vt, &private->pageflip_event_list,
214 base.link) {
215 if (v->base.file_priv == file) {
216 list_del(&v->base.link);
217 drm_vblank_put(dev, v->pipe);
218 v->base.destroy(&v->base);
219 }
220 }
221
222 /* Release all events handled by page flip handler but not freed. */
223 list_for_each_entry_safe(e, et, &file->event_list, link) {
224 list_del(&e->link);
225 e->destroy(e);
226 }
227 spin_unlock_irqrestore(&dev->event_lock, flags);
228
Inki Dae96f54212013-12-20 19:16:24 +0900229 file_priv = file->driver_priv;
230 if (file_priv->anon_filp)
231 fput(file_priv->anon_filp);
Inki Dae0cbc3302013-10-01 14:51:37 +0900232
Inki Dae53ef2992012-02-15 11:25:22 +0900233 kfree(file->driver_priv);
234 file->driver_priv = NULL;
235}
236
Inki Dae1c248b72011-10-04 19:19:01 +0900237static void exynos_drm_lastclose(struct drm_device *dev)
238{
Inki Dae1c248b72011-10-04 19:19:01 +0900239 exynos_drm_fbdev_restore_mode(dev);
240}
241
Laurent Pinchart78b68552012-05-17 13:27:22 +0200242static const struct vm_operations_struct exynos_drm_gem_vm_ops = {
Inki Dae1c248b72011-10-04 19:19:01 +0900243 .fault = exynos_drm_gem_fault,
244 .open = drm_gem_vm_open,
245 .close = drm_gem_vm_close,
246};
247
Rob Clarkbaa70942013-08-02 13:27:49 -0400248static const struct drm_ioctl_desc exynos_ioctls[] = {
Inki Dae1c248b72011-10-04 19:19:01 +0900249 DRM_IOCTL_DEF_DRV(EXYNOS_GEM_CREATE, exynos_drm_gem_create_ioctl,
250 DRM_UNLOCKED | DRM_AUTH),
251 DRM_IOCTL_DEF_DRV(EXYNOS_GEM_MAP_OFFSET,
252 exynos_drm_gem_map_offset_ioctl, DRM_UNLOCKED |
253 DRM_AUTH),
254 DRM_IOCTL_DEF_DRV(EXYNOS_GEM_MMAP,
255 exynos_drm_gem_mmap_ioctl, DRM_UNLOCKED | DRM_AUTH),
Inki Dae40cd7e02012-05-04 15:51:17 +0900256 DRM_IOCTL_DEF_DRV(EXYNOS_GEM_GET,
257 exynos_drm_gem_get_ioctl, DRM_UNLOCKED),
Inki Daeb73d1232012-03-21 10:55:26 +0900258 DRM_IOCTL_DEF_DRV(EXYNOS_VIDI_CONNECTION,
259 vidi_connection_ioctl, DRM_UNLOCKED | DRM_AUTH),
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900260 DRM_IOCTL_DEF_DRV(EXYNOS_G2D_GET_VER,
261 exynos_g2d_get_ver_ioctl, DRM_UNLOCKED | DRM_AUTH),
262 DRM_IOCTL_DEF_DRV(EXYNOS_G2D_SET_CMDLIST,
263 exynos_g2d_set_cmdlist_ioctl, DRM_UNLOCKED | DRM_AUTH),
264 DRM_IOCTL_DEF_DRV(EXYNOS_G2D_EXEC,
265 exynos_g2d_exec_ioctl, DRM_UNLOCKED | DRM_AUTH),
Eunchul Kimcb471f142012-12-14 18:10:31 +0900266 DRM_IOCTL_DEF_DRV(EXYNOS_IPP_GET_PROPERTY,
267 exynos_drm_ipp_get_property, DRM_UNLOCKED | DRM_AUTH),
268 DRM_IOCTL_DEF_DRV(EXYNOS_IPP_SET_PROPERTY,
269 exynos_drm_ipp_set_property, DRM_UNLOCKED | DRM_AUTH),
270 DRM_IOCTL_DEF_DRV(EXYNOS_IPP_QUEUE_BUF,
271 exynos_drm_ipp_queue_buf, DRM_UNLOCKED | DRM_AUTH),
272 DRM_IOCTL_DEF_DRV(EXYNOS_IPP_CMD_CTRL,
273 exynos_drm_ipp_cmd_ctrl, DRM_UNLOCKED | DRM_AUTH),
Inki Dae1c248b72011-10-04 19:19:01 +0900274};
275
Joonyoung Shimac2bdf72011-12-08 15:00:20 +0900276static const struct file_operations exynos_drm_driver_fops = {
277 .owner = THIS_MODULE,
278 .open = drm_open,
279 .mmap = exynos_drm_gem_mmap,
280 .poll = drm_poll,
281 .read = drm_read,
282 .unlocked_ioctl = drm_ioctl,
Keith Packard804d74a2012-07-09 15:40:07 -0700283#ifdef CONFIG_COMPAT
284 .compat_ioctl = drm_compat_ioctl,
285#endif
Joonyoung Shimac2bdf72011-12-08 15:00:20 +0900286 .release = drm_release,
287};
288
Inki Dae1c248b72011-10-04 19:19:01 +0900289static struct drm_driver exynos_drm_driver = {
Laurent Pinchart293a1c12012-05-16 17:08:53 +0200290 .driver_features = DRIVER_HAVE_IRQ | DRIVER_MODESET |
291 DRIVER_GEM | DRIVER_PRIME,
Inki Dae1c248b72011-10-04 19:19:01 +0900292 .load = exynos_drm_load,
293 .unload = exynos_drm_unload,
Joonyoung Shim9084f7b2012-03-16 18:47:09 +0900294 .open = exynos_drm_open,
Inki Daeccf4d882011-10-14 13:29:51 +0900295 .preclose = exynos_drm_preclose,
Inki Dae1c248b72011-10-04 19:19:01 +0900296 .lastclose = exynos_drm_lastclose,
Inki Dae53ef2992012-02-15 11:25:22 +0900297 .postclose = exynos_drm_postclose,
Inki Dae1c248b72011-10-04 19:19:01 +0900298 .get_vblank_counter = drm_vblank_count,
299 .enable_vblank = exynos_drm_crtc_enable_vblank,
300 .disable_vblank = exynos_drm_crtc_disable_vblank,
Inki Dae1c248b72011-10-04 19:19:01 +0900301 .gem_free_object = exynos_drm_gem_free_object,
302 .gem_vm_ops = &exynos_drm_gem_vm_ops,
303 .dumb_create = exynos_drm_gem_dumb_create,
304 .dumb_map_offset = exynos_drm_gem_dumb_map_offset,
Daniel Vetter43387b32013-07-16 09:12:04 +0200305 .dumb_destroy = drm_gem_dumb_destroy,
Inki Daeb2df26c2012-04-23 21:01:28 +0900306 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
307 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
308 .gem_prime_export = exynos_dmabuf_prime_export,
309 .gem_prime_import = exynos_dmabuf_prime_import,
Inki Dae1c248b72011-10-04 19:19:01 +0900310 .ioctls = exynos_ioctls,
Rob Clarkbaa70942013-08-02 13:27:49 -0400311 .num_ioctls = ARRAY_SIZE(exynos_ioctls),
Joonyoung Shimac2bdf72011-12-08 15:00:20 +0900312 .fops = &exynos_drm_driver_fops,
Inki Dae1c248b72011-10-04 19:19:01 +0900313 .name = DRIVER_NAME,
314 .desc = DRIVER_DESC,
315 .date = DRIVER_DATE,
316 .major = DRIVER_MAJOR,
317 .minor = DRIVER_MINOR,
318};
319
320static int exynos_drm_platform_probe(struct platform_device *pdev)
321{
Russell Kingd6cfaab2013-06-10 18:41:59 +0100322 int ret;
323
324 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
325 if (ret)
326 return ret;
Inki Dae1c248b72011-10-04 19:19:01 +0900327
328 return drm_platform_init(&exynos_drm_driver, pdev);
329}
330
331static int exynos_drm_platform_remove(struct platform_device *pdev)
332{
Daniel Vettera9a346d2013-12-11 11:34:23 +0100333 drm_put_dev(platform_get_drvdata(pdev));
Inki Dae1c248b72011-10-04 19:19:01 +0900334
335 return 0;
336}
337
338static struct platform_driver exynos_drm_platform_driver = {
339 .probe = exynos_drm_platform_probe,
Greg Kroah-Hartman56550d92012-12-21 15:09:25 -0800340 .remove = exynos_drm_platform_remove,
Inki Dae1c248b72011-10-04 19:19:01 +0900341 .driver = {
342 .owner = THIS_MODULE,
Marek Szyprowski9866b6c2012-03-05 12:02:30 +0100343 .name = "exynos-drm",
Inki Dae1c248b72011-10-04 19:19:01 +0900344 },
345};
346
347static int __init exynos_drm_init(void)
348{
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900349 int ret;
350
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900351#ifdef CONFIG_DRM_EXYNOS_FIMD
352 ret = platform_driver_register(&fimd_driver);
353 if (ret < 0)
354 goto out_fimd;
355#endif
356
357#ifdef CONFIG_DRM_EXYNOS_HDMI
358 ret = platform_driver_register(&hdmi_driver);
359 if (ret < 0)
360 goto out_hdmi;
361 ret = platform_driver_register(&mixer_driver);
362 if (ret < 0)
363 goto out_mixer;
364 ret = platform_driver_register(&exynos_drm_common_hdmi_driver);
365 if (ret < 0)
366 goto out_common_hdmi;
Rahul Sharmaae9dace2012-10-16 05:50:13 +0530367
368 ret = exynos_platform_device_hdmi_register();
369 if (ret < 0)
370 goto out_common_hdmi_dev;
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900371#endif
372
Inki Daeb73d1232012-03-21 10:55:26 +0900373#ifdef CONFIG_DRM_EXYNOS_VIDI
374 ret = platform_driver_register(&vidi_driver);
375 if (ret < 0)
376 goto out_vidi;
377#endif
378
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900379#ifdef CONFIG_DRM_EXYNOS_G2D
380 ret = platform_driver_register(&g2d_driver);
381 if (ret < 0)
382 goto out_g2d;
383#endif
384
Eunchul Kim16102ed2012-12-14 17:58:55 +0900385#ifdef CONFIG_DRM_EXYNOS_FIMC
386 ret = platform_driver_register(&fimc_driver);
387 if (ret < 0)
388 goto out_fimc;
389#endif
390
Eunchul Kimbea8a422012-12-14 17:58:56 +0900391#ifdef CONFIG_DRM_EXYNOS_ROTATOR
392 ret = platform_driver_register(&rotator_driver);
393 if (ret < 0)
394 goto out_rotator;
395#endif
396
Eunchul Kimf2646382012-12-14 17:58:57 +0900397#ifdef CONFIG_DRM_EXYNOS_GSC
398 ret = platform_driver_register(&gsc_driver);
399 if (ret < 0)
400 goto out_gsc;
401#endif
402
Eunchul Kimcb471f142012-12-14 18:10:31 +0900403#ifdef CONFIG_DRM_EXYNOS_IPP
404 ret = platform_driver_register(&ipp_driver);
405 if (ret < 0)
406 goto out_ipp;
Seung-Woo Kim43f41902013-04-23 14:02:53 +0900407
408 ret = exynos_platform_device_ipp_register();
409 if (ret < 0)
410 goto out_ipp_dev;
Eunchul Kimcb471f142012-12-14 18:10:31 +0900411#endif
412
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900413 ret = platform_driver_register(&exynos_drm_platform_driver);
414 if (ret < 0)
Rahul Sharma422bd002012-10-16 05:50:12 +0530415 goto out_drm;
416
417 exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1,
418 NULL, 0);
Seung-Woo Kim1055f492013-04-22 17:13:13 +0900419 if (IS_ERR(exynos_drm_pdev)) {
Rahul Sharma422bd002012-10-16 05:50:12 +0530420 ret = PTR_ERR(exynos_drm_pdev);
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900421 goto out;
Rahul Sharma422bd002012-10-16 05:50:12 +0530422 }
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900423
424 return 0;
425
426out:
Rahul Sharma422bd002012-10-16 05:50:12 +0530427 platform_driver_unregister(&exynos_drm_platform_driver);
428
429out_drm:
Eunchul Kimcb471f142012-12-14 18:10:31 +0900430#ifdef CONFIG_DRM_EXYNOS_IPP
Seung-Woo Kim43f41902013-04-23 14:02:53 +0900431 exynos_platform_device_ipp_unregister();
432out_ipp_dev:
Eunchul Kimcb471f142012-12-14 18:10:31 +0900433 platform_driver_unregister(&ipp_driver);
434out_ipp:
435#endif
436
Eunchul Kimf2646382012-12-14 17:58:57 +0900437#ifdef CONFIG_DRM_EXYNOS_GSC
438 platform_driver_unregister(&gsc_driver);
439out_gsc:
440#endif
441
Eunchul Kimbea8a422012-12-14 17:58:56 +0900442#ifdef CONFIG_DRM_EXYNOS_ROTATOR
443 platform_driver_unregister(&rotator_driver);
444out_rotator:
445#endif
446
Eunchul Kim16102ed2012-12-14 17:58:55 +0900447#ifdef CONFIG_DRM_EXYNOS_FIMC
448 platform_driver_unregister(&fimc_driver);
449out_fimc:
450#endif
451
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900452#ifdef CONFIG_DRM_EXYNOS_G2D
453 platform_driver_unregister(&g2d_driver);
454out_g2d:
455#endif
456
Inki Daeb73d1232012-03-21 10:55:26 +0900457#ifdef CONFIG_DRM_EXYNOS_VIDI
Inki Daeb73d1232012-03-21 10:55:26 +0900458 platform_driver_unregister(&vidi_driver);
Rahul Sharmaae9dace2012-10-16 05:50:13 +0530459out_vidi:
Inki Daeb73d1232012-03-21 10:55:26 +0900460#endif
461
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900462#ifdef CONFIG_DRM_EXYNOS_HDMI
Rahul Sharmaae9dace2012-10-16 05:50:13 +0530463 exynos_platform_device_hdmi_unregister();
464out_common_hdmi_dev:
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900465 platform_driver_unregister(&exynos_drm_common_hdmi_driver);
466out_common_hdmi:
467 platform_driver_unregister(&mixer_driver);
468out_mixer:
469 platform_driver_unregister(&hdmi_driver);
470out_hdmi:
471#endif
472
473#ifdef CONFIG_DRM_EXYNOS_FIMD
474 platform_driver_unregister(&fimd_driver);
475out_fimd:
476#endif
477 return ret;
Inki Dae1c248b72011-10-04 19:19:01 +0900478}
479
480static void __exit exynos_drm_exit(void)
481{
Rahul Sharma422bd002012-10-16 05:50:12 +0530482 platform_device_unregister(exynos_drm_pdev);
483
Inki Dae1c248b72011-10-04 19:19:01 +0900484 platform_driver_unregister(&exynos_drm_platform_driver);
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900485
Eunchul Kimcb471f142012-12-14 18:10:31 +0900486#ifdef CONFIG_DRM_EXYNOS_IPP
Seung-Woo Kim43f41902013-04-23 14:02:53 +0900487 exynos_platform_device_ipp_unregister();
Eunchul Kimcb471f142012-12-14 18:10:31 +0900488 platform_driver_unregister(&ipp_driver);
489#endif
490
Eunchul Kimf2646382012-12-14 17:58:57 +0900491#ifdef CONFIG_DRM_EXYNOS_GSC
492 platform_driver_unregister(&gsc_driver);
493#endif
494
Eunchul Kimbea8a422012-12-14 17:58:56 +0900495#ifdef CONFIG_DRM_EXYNOS_ROTATOR
496 platform_driver_unregister(&rotator_driver);
497#endif
498
Eunchul Kim16102ed2012-12-14 17:58:55 +0900499#ifdef CONFIG_DRM_EXYNOS_FIMC
500 platform_driver_unregister(&fimc_driver);
501#endif
502
Joonyoung Shimd7f16422012-05-17 20:06:32 +0900503#ifdef CONFIG_DRM_EXYNOS_G2D
504 platform_driver_unregister(&g2d_driver);
505#endif
506
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900507#ifdef CONFIG_DRM_EXYNOS_HDMI
Rahul Sharmaae9dace2012-10-16 05:50:13 +0530508 exynos_platform_device_hdmi_unregister();
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900509 platform_driver_unregister(&exynos_drm_common_hdmi_driver);
510 platform_driver_unregister(&mixer_driver);
511 platform_driver_unregister(&hdmi_driver);
512#endif
513
Inki Daeb73d1232012-03-21 10:55:26 +0900514#ifdef CONFIG_DRM_EXYNOS_VIDI
515 platform_driver_unregister(&vidi_driver);
516#endif
517
Joonyoung Shim132a5b92012-03-16 18:47:08 +0900518#ifdef CONFIG_DRM_EXYNOS_FIMD
519 platform_driver_unregister(&fimd_driver);
520#endif
Inki Dae1c248b72011-10-04 19:19:01 +0900521}
522
523module_init(exynos_drm_init);
524module_exit(exynos_drm_exit);
525
526MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>");
527MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>");
528MODULE_AUTHOR("Seung-Woo Kim <sw0312.kim@samsung.com>");
529MODULE_DESCRIPTION("Samsung SoC DRM Driver");
530MODULE_LICENSE("GPL");