Version:  2.0.40 2.2.26 2.4.37 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17

Linux/drivers/gpu/drm/exynos/exynos_drm_drv.c

  1 /*
  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  *
  8  * 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.
 12  */
 13 
 14 #include <linux/pm_runtime.h>
 15 #include <drm/drmP.h>
 16 #include <drm/drm_crtc_helper.h>
 17 
 18 #include <linux/anon_inodes.h>
 19 #include <linux/component.h>
 20 
 21 #include <drm/exynos_drm.h>
 22 
 23 #include "exynos_drm_drv.h"
 24 #include "exynos_drm_crtc.h"
 25 #include "exynos_drm_encoder.h"
 26 #include "exynos_drm_fbdev.h"
 27 #include "exynos_drm_fb.h"
 28 #include "exynos_drm_gem.h"
 29 #include "exynos_drm_plane.h"
 30 #include "exynos_drm_vidi.h"
 31 #include "exynos_drm_dmabuf.h"
 32 #include "exynos_drm_g2d.h"
 33 #include "exynos_drm_ipp.h"
 34 #include "exynos_drm_iommu.h"
 35 
 36 #define DRIVER_NAME     "exynos"
 37 #define DRIVER_DESC     "Samsung SoC DRM"
 38 #define DRIVER_DATE     "20110530"
 39 #define DRIVER_MAJOR    1
 40 #define DRIVER_MINOR    0
 41 
 42 static struct platform_device *exynos_drm_pdev;
 43 
 44 static DEFINE_MUTEX(drm_component_lock);
 45 static LIST_HEAD(drm_component_list);
 46 
 47 struct component_dev {
 48         struct list_head list;
 49         struct device *crtc_dev;
 50         struct device *conn_dev;
 51         enum exynos_drm_output_type out_type;
 52         unsigned int dev_type_flag;
 53 };
 54 
 55 static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 56 {
 57         struct exynos_drm_private *private;
 58         int ret;
 59         int nr;
 60 
 61         private = kzalloc(sizeof(struct exynos_drm_private), GFP_KERNEL);
 62         if (!private)
 63                 return -ENOMEM;
 64 
 65         INIT_LIST_HEAD(&private->pageflip_event_list);
 66         dev_set_drvdata(dev->dev, dev);
 67         dev->dev_private = (void *)private;
 68 
 69         /*
 70          * create mapping to manage iommu table and set a pointer to iommu
 71          * mapping structure to iommu_mapping of private data.
 72          * also this iommu_mapping can be used to check if iommu is supported
 73          * or not.
 74          */
 75         ret = drm_create_iommu_mapping(dev);
 76         if (ret < 0) {
 77                 DRM_ERROR("failed to create iommu mapping.\n");
 78                 goto err_free_private;
 79         }
 80 
 81         drm_mode_config_init(dev);
 82 
 83         exynos_drm_mode_config_init(dev);
 84 
 85         for (nr = 0; nr < MAX_PLANE; nr++) {
 86                 struct drm_plane *plane;
 87                 unsigned long possible_crtcs = (1 << MAX_CRTC) - 1;
 88 
 89                 plane = exynos_plane_init(dev, possible_crtcs, false);
 90                 if (!plane)
 91                         goto err_mode_config_cleanup;
 92         }
 93 
 94         /* init kms poll for handling hpd */
 95         drm_kms_helper_poll_init(dev);
 96 
 97         ret = drm_vblank_init(dev, MAX_CRTC);
 98         if (ret)
 99                 goto err_mode_config_cleanup;
100 
101         /* setup possible_clones. */
102         exynos_drm_encoder_setup(dev);
103 
104         platform_set_drvdata(dev->platformdev, dev);
105 
106         /* Try to bind all sub drivers. */
107         ret = component_bind_all(dev->dev, dev);
108         if (ret)
109                 goto err_cleanup_vblank;
110 
111         /* Probe non kms sub drivers and virtual display driver. */
112         ret = exynos_drm_device_subdrv_probe(dev);
113         if (ret)
114                 goto err_unbind_all;
115 
116         /* force connectors detection */
117         drm_helper_hpd_irq_event(dev);
118 
119         return 0;
120 
121 err_unbind_all:
122         component_unbind_all(dev->dev, dev);
123 err_cleanup_vblank:
124         drm_vblank_cleanup(dev);
125 err_mode_config_cleanup:
126         drm_mode_config_cleanup(dev);
127         drm_release_iommu_mapping(dev);
128 err_free_private:
129         kfree(private);
130 
131         return ret;
132 }
133 
134 static int exynos_drm_unload(struct drm_device *dev)
135 {
136         exynos_drm_device_subdrv_remove(dev);
137 
138         exynos_drm_fbdev_fini(dev);
139         drm_vblank_cleanup(dev);
140         drm_kms_helper_poll_fini(dev);
141         drm_mode_config_cleanup(dev);
142 
143         drm_release_iommu_mapping(dev);
144         kfree(dev->dev_private);
145 
146         component_unbind_all(dev->dev, dev);
147         dev->dev_private = NULL;
148 
149         return 0;
150 }
151 
152 static const struct file_operations exynos_drm_gem_fops = {
153         .mmap = exynos_drm_gem_mmap_buffer,
154 };
155 
156 static int exynos_drm_suspend(struct drm_device *dev, pm_message_t state)
157 {
158         struct drm_connector *connector;
159 
160         drm_modeset_lock_all(dev);
161         list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
162                 int old_dpms = connector->dpms;
163 
164                 if (connector->funcs->dpms)
165                         connector->funcs->dpms(connector, DRM_MODE_DPMS_OFF);
166 
167                 /* Set the old mode back to the connector for resume */
168                 connector->dpms = old_dpms;
169         }
170         drm_modeset_unlock_all(dev);
171 
172         return 0;
173 }
174 
175 static int exynos_drm_resume(struct drm_device *dev)
176 {
177         struct drm_connector *connector;
178 
179         drm_modeset_lock_all(dev);
180         list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
181                 if (connector->funcs->dpms)
182                         connector->funcs->dpms(connector, connector->dpms);
183         }
184         drm_modeset_unlock_all(dev);
185 
186         drm_helper_resume_force_mode(dev);
187 
188         return 0;
189 }
190 
191 static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
192 {
193         struct drm_exynos_file_private *file_priv;
194         struct file *anon_filp;
195         int ret;
196 
197         file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL);
198         if (!file_priv)
199                 return -ENOMEM;
200 
201         file->driver_priv = file_priv;
202 
203         ret = exynos_drm_subdrv_open(dev, file);
204         if (ret)
205                 goto err_file_priv_free;
206 
207         anon_filp = anon_inode_getfile("exynos_gem", &exynos_drm_gem_fops,
208                                         NULL, 0);
209         if (IS_ERR(anon_filp)) {
210                 ret = PTR_ERR(anon_filp);
211                 goto err_subdrv_close;
212         }
213 
214         anon_filp->f_mode = FMODE_READ | FMODE_WRITE;
215         file_priv->anon_filp = anon_filp;
216 
217         return ret;
218 
219 err_subdrv_close:
220         exynos_drm_subdrv_close(dev, file);
221 
222 err_file_priv_free:
223         kfree(file_priv);
224         file->driver_priv = NULL;
225         return ret;
226 }
227 
228 static void exynos_drm_preclose(struct drm_device *dev,
229                                         struct drm_file *file)
230 {
231         exynos_drm_subdrv_close(dev, file);
232 }
233 
234 static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
235 {
236         struct exynos_drm_private *private = dev->dev_private;
237         struct drm_exynos_file_private *file_priv;
238         struct drm_pending_vblank_event *v, *vt;
239         struct drm_pending_event *e, *et;
240         unsigned long flags;
241 
242         if (!file->driver_priv)
243                 return;
244 
245         /* Release all events not unhandled by page flip handler. */
246         spin_lock_irqsave(&dev->event_lock, flags);
247         list_for_each_entry_safe(v, vt, &private->pageflip_event_list,
248                         base.link) {
249                 if (v->base.file_priv == file) {
250                         list_del(&v->base.link);
251                         drm_vblank_put(dev, v->pipe);
252                         v->base.destroy(&v->base);
253                 }
254         }
255 
256         /* Release all events handled by page flip handler but not freed. */
257         list_for_each_entry_safe(e, et, &file->event_list, link) {
258                 list_del(&e->link);
259                 e->destroy(e);
260         }
261         spin_unlock_irqrestore(&dev->event_lock, flags);
262 
263         file_priv = file->driver_priv;
264         if (file_priv->anon_filp)
265                 fput(file_priv->anon_filp);
266 
267         kfree(file->driver_priv);
268         file->driver_priv = NULL;
269 }
270 
271 static void exynos_drm_lastclose(struct drm_device *dev)
272 {
273         exynos_drm_fbdev_restore_mode(dev);
274 }
275 
276 static const struct vm_operations_struct exynos_drm_gem_vm_ops = {
277         .fault = exynos_drm_gem_fault,
278         .open = drm_gem_vm_open,
279         .close = drm_gem_vm_close,
280 };
281 
282 static const struct drm_ioctl_desc exynos_ioctls[] = {
283         DRM_IOCTL_DEF_DRV(EXYNOS_GEM_CREATE, exynos_drm_gem_create_ioctl,
284                         DRM_UNLOCKED | DRM_AUTH),
285         DRM_IOCTL_DEF_DRV(EXYNOS_GEM_MAP_OFFSET,
286                         exynos_drm_gem_map_offset_ioctl, DRM_UNLOCKED |
287                         DRM_AUTH),
288         DRM_IOCTL_DEF_DRV(EXYNOS_GEM_MMAP,
289                         exynos_drm_gem_mmap_ioctl, DRM_UNLOCKED | DRM_AUTH),
290         DRM_IOCTL_DEF_DRV(EXYNOS_GEM_GET,
291                         exynos_drm_gem_get_ioctl, DRM_UNLOCKED),
292         DRM_IOCTL_DEF_DRV(EXYNOS_VIDI_CONNECTION,
293                         vidi_connection_ioctl, DRM_UNLOCKED | DRM_AUTH),
294         DRM_IOCTL_DEF_DRV(EXYNOS_G2D_GET_VER,
295                         exynos_g2d_get_ver_ioctl, DRM_UNLOCKED | DRM_AUTH),
296         DRM_IOCTL_DEF_DRV(EXYNOS_G2D_SET_CMDLIST,
297                         exynos_g2d_set_cmdlist_ioctl, DRM_UNLOCKED | DRM_AUTH),
298         DRM_IOCTL_DEF_DRV(EXYNOS_G2D_EXEC,
299                         exynos_g2d_exec_ioctl, DRM_UNLOCKED | DRM_AUTH),
300         DRM_IOCTL_DEF_DRV(EXYNOS_IPP_GET_PROPERTY,
301                         exynos_drm_ipp_get_property, DRM_UNLOCKED | DRM_AUTH),
302         DRM_IOCTL_DEF_DRV(EXYNOS_IPP_SET_PROPERTY,
303                         exynos_drm_ipp_set_property, DRM_UNLOCKED | DRM_AUTH),
304         DRM_IOCTL_DEF_DRV(EXYNOS_IPP_QUEUE_BUF,
305                         exynos_drm_ipp_queue_buf, DRM_UNLOCKED | DRM_AUTH),
306         DRM_IOCTL_DEF_DRV(EXYNOS_IPP_CMD_CTRL,
307                         exynos_drm_ipp_cmd_ctrl, DRM_UNLOCKED | DRM_AUTH),
308 };
309 
310 static const struct file_operations exynos_drm_driver_fops = {
311         .owner          = THIS_MODULE,
312         .open           = drm_open,
313         .mmap           = exynos_drm_gem_mmap,
314         .poll           = drm_poll,
315         .read           = drm_read,
316         .unlocked_ioctl = drm_ioctl,
317 #ifdef CONFIG_COMPAT
318         .compat_ioctl = drm_compat_ioctl,
319 #endif
320         .release        = drm_release,
321 };
322 
323 static struct drm_driver exynos_drm_driver = {
324         .driver_features        = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
325         .load                   = exynos_drm_load,
326         .unload                 = exynos_drm_unload,
327         .suspend                = exynos_drm_suspend,
328         .resume                 = exynos_drm_resume,
329         .open                   = exynos_drm_open,
330         .preclose               = exynos_drm_preclose,
331         .lastclose              = exynos_drm_lastclose,
332         .postclose              = exynos_drm_postclose,
333         .get_vblank_counter     = drm_vblank_count,
334         .enable_vblank          = exynos_drm_crtc_enable_vblank,
335         .disable_vblank         = exynos_drm_crtc_disable_vblank,
336         .gem_free_object        = exynos_drm_gem_free_object,
337         .gem_vm_ops             = &exynos_drm_gem_vm_ops,
338         .dumb_create            = exynos_drm_gem_dumb_create,
339         .dumb_map_offset        = exynos_drm_gem_dumb_map_offset,
340         .dumb_destroy           = drm_gem_dumb_destroy,
341         .prime_handle_to_fd     = drm_gem_prime_handle_to_fd,
342         .prime_fd_to_handle     = drm_gem_prime_fd_to_handle,
343         .gem_prime_export       = exynos_dmabuf_prime_export,
344         .gem_prime_import       = exynos_dmabuf_prime_import,
345         .ioctls                 = exynos_ioctls,
346         .num_ioctls             = ARRAY_SIZE(exynos_ioctls),
347         .fops                   = &exynos_drm_driver_fops,
348         .name   = DRIVER_NAME,
349         .desc   = DRIVER_DESC,
350         .date   = DRIVER_DATE,
351         .major  = DRIVER_MAJOR,
352         .minor  = DRIVER_MINOR,
353 };
354 
355 #ifdef CONFIG_PM_SLEEP
356 static int exynos_drm_sys_suspend(struct device *dev)
357 {
358         struct drm_device *drm_dev = dev_get_drvdata(dev);
359         pm_message_t message;
360 
361         if (pm_runtime_suspended(dev) || !drm_dev)
362                 return 0;
363 
364         message.event = PM_EVENT_SUSPEND;
365         return exynos_drm_suspend(drm_dev, message);
366 }
367 
368 static int exynos_drm_sys_resume(struct device *dev)
369 {
370         struct drm_device *drm_dev = dev_get_drvdata(dev);
371 
372         if (pm_runtime_suspended(dev) || !drm_dev)
373                 return 0;
374 
375         return exynos_drm_resume(drm_dev);
376 }
377 #endif
378 
379 static const struct dev_pm_ops exynos_drm_pm_ops = {
380         SET_SYSTEM_SLEEP_PM_OPS(exynos_drm_sys_suspend, exynos_drm_sys_resume)
381 };
382 
383 int exynos_drm_component_add(struct device *dev,
384                                 enum exynos_drm_device_type dev_type,
385                                 enum exynos_drm_output_type out_type)
386 {
387         struct component_dev *cdev;
388 
389         if (dev_type != EXYNOS_DEVICE_TYPE_CRTC &&
390                         dev_type != EXYNOS_DEVICE_TYPE_CONNECTOR) {
391                 DRM_ERROR("invalid device type.\n");
392                 return -EINVAL;
393         }
394 
395         mutex_lock(&drm_component_lock);
396 
397         /*
398          * Make sure to check if there is a component which has two device
399          * objects, for connector and for encoder/connector.
400          * It should make sure that crtc and encoder/connector drivers are
401          * ready before exynos drm core binds them.
402          */
403         list_for_each_entry(cdev, &drm_component_list, list) {
404                 if (cdev->out_type == out_type) {
405                         /*
406                          * If crtc and encoder/connector device objects are
407                          * added already just return.
408                          */
409                         if (cdev->dev_type_flag == (EXYNOS_DEVICE_TYPE_CRTC |
410                                                 EXYNOS_DEVICE_TYPE_CONNECTOR)) {
411                                 mutex_unlock(&drm_component_lock);
412                                 return 0;
413                         }
414 
415                         if (dev_type == EXYNOS_DEVICE_TYPE_CRTC) {
416                                 cdev->crtc_dev = dev;
417                                 cdev->dev_type_flag |= dev_type;
418                         }
419 
420                         if (dev_type == EXYNOS_DEVICE_TYPE_CONNECTOR) {
421                                 cdev->conn_dev = dev;
422                                 cdev->dev_type_flag |= dev_type;
423                         }
424 
425                         mutex_unlock(&drm_component_lock);
426                         return 0;
427                 }
428         }
429 
430         mutex_unlock(&drm_component_lock);
431 
432         cdev = kzalloc(sizeof(*cdev), GFP_KERNEL);
433         if (!cdev)
434                 return -ENOMEM;
435 
436         if (dev_type == EXYNOS_DEVICE_TYPE_CRTC)
437                 cdev->crtc_dev = dev;
438         if (dev_type == EXYNOS_DEVICE_TYPE_CONNECTOR)
439                 cdev->conn_dev = dev;
440 
441         cdev->out_type = out_type;
442         cdev->dev_type_flag = dev_type;
443 
444         mutex_lock(&drm_component_lock);
445         list_add_tail(&cdev->list, &drm_component_list);
446         mutex_unlock(&drm_component_lock);
447 
448         return 0;
449 }
450 
451 void exynos_drm_component_del(struct device *dev,
452                                 enum exynos_drm_device_type dev_type)
453 {
454         struct component_dev *cdev, *next;
455 
456         mutex_lock(&drm_component_lock);
457 
458         list_for_each_entry_safe(cdev, next, &drm_component_list, list) {
459                 if (dev_type == EXYNOS_DEVICE_TYPE_CRTC) {
460                         if (cdev->crtc_dev == dev) {
461                                 cdev->crtc_dev = NULL;
462                                 cdev->dev_type_flag &= ~dev_type;
463                         }
464                 }
465 
466                 if (dev_type == EXYNOS_DEVICE_TYPE_CONNECTOR) {
467                         if (cdev->conn_dev == dev) {
468                                 cdev->conn_dev = NULL;
469                                 cdev->dev_type_flag &= ~dev_type;
470                         }
471                 }
472 
473                 /*
474                  * Release cdev object only in case that both of crtc and
475                  * encoder/connector device objects are NULL.
476                  */
477                 if (!cdev->crtc_dev && !cdev->conn_dev) {
478                         list_del(&cdev->list);
479                         kfree(cdev);
480                 }
481 
482                 break;
483         }
484 
485         mutex_unlock(&drm_component_lock);
486 }
487 
488 static int compare_of(struct device *dev, void *data)
489 {
490         return dev == (struct device *)data;
491 }
492 
493 static int exynos_drm_add_components(struct device *dev, struct master *m)
494 {
495         struct component_dev *cdev;
496         unsigned int attach_cnt = 0;
497 
498         mutex_lock(&drm_component_lock);
499 
500         list_for_each_entry(cdev, &drm_component_list, list) {
501                 int ret;
502 
503                 /*
504                  * Add components to master only in case that crtc and
505                  * encoder/connector device objects exist.
506                  */
507                 if (!cdev->crtc_dev || !cdev->conn_dev)
508                         continue;
509 
510                 attach_cnt++;
511 
512                 mutex_unlock(&drm_component_lock);
513 
514                 /*
515                  * fimd and dpi modules have same device object so add
516                  * only crtc device object in this case.
517                  *
518                  * TODO. if dpi module follows driver-model driver then
519                  * below codes can be removed.
520                  */
521                 if (cdev->crtc_dev == cdev->conn_dev) {
522                         ret = component_master_add_child(m, compare_of,
523                                         cdev->crtc_dev);
524                         if (ret < 0)
525                                 return ret;
526 
527                         goto out_lock;
528                 }
529 
530                 /*
531                  * Do not chage below call order.
532                  * crtc device first should be added to master because
533                  * connector/encoder need pipe number of crtc when they
534                  * are created.
535                  */
536                 ret = component_master_add_child(m, compare_of, cdev->crtc_dev);
537                 ret |= component_master_add_child(m, compare_of,
538                                                         cdev->conn_dev);
539                 if (ret < 0)
540                         return ret;
541 
542 out_lock:
543                 mutex_lock(&drm_component_lock);
544         }
545 
546         mutex_unlock(&drm_component_lock);
547 
548         return attach_cnt ? 0 : -ENODEV;
549 }
550 
551 static int exynos_drm_bind(struct device *dev)
552 {
553         return drm_platform_init(&exynos_drm_driver, to_platform_device(dev));
554 }
555 
556 static void exynos_drm_unbind(struct device *dev)
557 {
558         drm_put_dev(dev_get_drvdata(dev));
559 }
560 
561 static const struct component_master_ops exynos_drm_ops = {
562         .add_components = exynos_drm_add_components,
563         .bind           = exynos_drm_bind,
564         .unbind         = exynos_drm_unbind,
565 };
566 
567 static int exynos_drm_platform_probe(struct platform_device *pdev)
568 {
569         int ret;
570 
571         pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
572         exynos_drm_driver.num_ioctls = ARRAY_SIZE(exynos_ioctls);
573 
574 #ifdef CONFIG_DRM_EXYNOS_FIMD
575         ret = platform_driver_register(&fimd_driver);
576         if (ret < 0)
577                 return ret;
578 #endif
579 
580 #ifdef CONFIG_DRM_EXYNOS_DP
581         ret = platform_driver_register(&dp_driver);
582         if (ret < 0)
583                 goto err_unregister_fimd_drv;
584 #endif
585 
586 #ifdef CONFIG_DRM_EXYNOS_DSI
587         ret = platform_driver_register(&dsi_driver);
588         if (ret < 0)
589                 goto err_unregister_dp_drv;
590 #endif
591 
592 #ifdef CONFIG_DRM_EXYNOS_HDMI
593         ret = platform_driver_register(&mixer_driver);
594         if (ret < 0)
595                 goto err_unregister_dsi_drv;
596         ret = platform_driver_register(&hdmi_driver);
597         if (ret < 0)
598                 goto err_unregister_mixer_drv;
599 #endif
600 
601 #ifdef CONFIG_DRM_EXYNOS_G2D
602         ret = platform_driver_register(&g2d_driver);
603         if (ret < 0)
604                 goto err_unregister_hdmi_drv;
605 #endif
606 
607 #ifdef CONFIG_DRM_EXYNOS_FIMC
608         ret = platform_driver_register(&fimc_driver);
609         if (ret < 0)
610                 goto err_unregister_g2d_drv;
611 #endif
612 
613 #ifdef CONFIG_DRM_EXYNOS_ROTATOR
614         ret = platform_driver_register(&rotator_driver);
615         if (ret < 0)
616                 goto err_unregister_fimc_drv;
617 #endif
618 
619 #ifdef CONFIG_DRM_EXYNOS_GSC
620         ret = platform_driver_register(&gsc_driver);
621         if (ret < 0)
622                 goto err_unregister_rotator_drv;
623 #endif
624 
625 #ifdef CONFIG_DRM_EXYNOS_IPP
626         ret = platform_driver_register(&ipp_driver);
627         if (ret < 0)
628                 goto err_unregister_gsc_drv;
629 
630         ret = exynos_platform_device_ipp_register();
631         if (ret < 0)
632                 goto err_unregister_ipp_drv;
633 #endif
634 
635         ret = component_master_add(&pdev->dev, &exynos_drm_ops);
636         if (ret < 0)
637                 DRM_DEBUG_KMS("re-tried by last sub driver probed later.\n");
638 
639         return 0;
640 
641 #ifdef CONFIG_DRM_EXYNOS_IPP
642 err_unregister_ipp_drv:
643         platform_driver_unregister(&ipp_driver);
644 err_unregister_gsc_drv:
645 #endif
646 
647 #ifdef CONFIG_DRM_EXYNOS_GSC
648         platform_driver_unregister(&gsc_driver);
649 err_unregister_rotator_drv:
650 #endif
651 
652 #ifdef CONFIG_DRM_EXYNOS_ROTATOR
653         platform_driver_unregister(&rotator_driver);
654 err_unregister_fimc_drv:
655 #endif
656 
657 #ifdef CONFIG_DRM_EXYNOS_FIMC
658         platform_driver_unregister(&fimc_driver);
659 err_unregister_g2d_drv:
660 #endif
661 
662 #ifdef CONFIG_DRM_EXYNOS_G2D
663         platform_driver_unregister(&g2d_driver);
664 err_unregister_hdmi_drv:
665 #endif
666 
667 #ifdef CONFIG_DRM_EXYNOS_HDMI
668         platform_driver_unregister(&hdmi_driver);
669 err_unregister_mixer_drv:
670         platform_driver_unregister(&mixer_driver);
671 err_unregister_dsi_drv:
672 #endif
673 
674 #ifdef CONFIG_DRM_EXYNOS_DSI
675         platform_driver_unregister(&dsi_driver);
676 err_unregister_dp_drv:
677 #endif
678 
679 #ifdef CONFIG_DRM_EXYNOS_DP
680         platform_driver_unregister(&dp_driver);
681 err_unregister_fimd_drv:
682 #endif
683 
684 #ifdef CONFIG_DRM_EXYNOS_FIMD
685         platform_driver_unregister(&fimd_driver);
686 #endif
687         return ret;
688 }
689 
690 static int exynos_drm_platform_remove(struct platform_device *pdev)
691 {
692 #ifdef CONFIG_DRM_EXYNOS_IPP
693         exynos_platform_device_ipp_unregister();
694         platform_driver_unregister(&ipp_driver);
695 #endif
696 
697 #ifdef CONFIG_DRM_EXYNOS_GSC
698         platform_driver_unregister(&gsc_driver);
699 #endif
700 
701 #ifdef CONFIG_DRM_EXYNOS_ROTATOR
702         platform_driver_unregister(&rotator_driver);
703 #endif
704 
705 #ifdef CONFIG_DRM_EXYNOS_FIMC
706         platform_driver_unregister(&fimc_driver);
707 #endif
708 
709 #ifdef CONFIG_DRM_EXYNOS_G2D
710         platform_driver_unregister(&g2d_driver);
711 #endif
712 
713 #ifdef CONFIG_DRM_EXYNOS_HDMI
714         platform_driver_unregister(&mixer_driver);
715         platform_driver_unregister(&hdmi_driver);
716 #endif
717 
718 #ifdef CONFIG_DRM_EXYNOS_FIMD
719         platform_driver_unregister(&fimd_driver);
720 #endif
721 
722 #ifdef CONFIG_DRM_EXYNOS_DSI
723         platform_driver_unregister(&dsi_driver);
724 #endif
725 
726 #ifdef CONFIG_DRM_EXYNOS_DP
727         platform_driver_unregister(&dp_driver);
728 #endif
729         component_master_del(&pdev->dev, &exynos_drm_ops);
730         return 0;
731 }
732 
733 static struct platform_driver exynos_drm_platform_driver = {
734         .probe  = exynos_drm_platform_probe,
735         .remove = exynos_drm_platform_remove,
736         .driver = {
737                 .owner  = THIS_MODULE,
738                 .name   = "exynos-drm",
739                 .pm     = &exynos_drm_pm_ops,
740         },
741 };
742 
743 static int exynos_drm_init(void)
744 {
745         int ret;
746 
747         exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1,
748                                                                 NULL, 0);
749         if (IS_ERR(exynos_drm_pdev))
750                 return PTR_ERR(exynos_drm_pdev);
751 
752 #ifdef CONFIG_DRM_EXYNOS_VIDI
753         ret = exynos_drm_probe_vidi();
754         if (ret < 0)
755                 goto err_unregister_pd;
756 #endif
757 
758         ret = platform_driver_register(&exynos_drm_platform_driver);
759         if (ret)
760                 goto err_remove_vidi;
761 
762         return 0;
763 
764 err_remove_vidi:
765 #ifdef CONFIG_DRM_EXYNOS_VIDI
766         exynos_drm_remove_vidi();
767 
768 err_unregister_pd:
769 #endif
770         platform_device_unregister(exynos_drm_pdev);
771 
772         return ret;
773 }
774 
775 static void exynos_drm_exit(void)
776 {
777         platform_driver_unregister(&exynos_drm_platform_driver);
778 #ifdef CONFIG_DRM_EXYNOS_VIDI
779         exynos_drm_remove_vidi();
780 #endif
781         platform_device_unregister(exynos_drm_pdev);
782 }
783 
784 module_init(exynos_drm_init);
785 module_exit(exynos_drm_exit);
786 
787 MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>");
788 MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>");
789 MODULE_AUTHOR("Seung-Woo Kim <sw0312.kim@samsung.com>");
790 MODULE_DESCRIPTION("Samsung SoC DRM Driver");
791 MODULE_LICENSE("GPL");
792 

This page was automatically generated by LXR 0.3.1 (source).  •  Linux is a registered trademark of Linus Torvalds  •  Contact us