drm/exynos: added ipp device registration to drm driver
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 23 Apr 2013 05:02:53 +0000 (14:02 +0900)
committerInki Dae <inki.dae@samsung.com>
Mon, 29 Apr 2013 05:35:32 +0000 (14:35 +0900)
This patch added exynos-drm-ipp platform device registration to the exynos drm
driver. When DT is enabled, platform devices need to be registered within the
driver code. This patch fits the requirement of both DT and Non DT based drm
drivers.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
drivers/gpu/drm/exynos/exynos_drm_drv.c
drivers/gpu/drm/exynos/exynos_drm_drv.h
drivers/gpu/drm/exynos/exynos_drm_ipp.c

index 488278ccb2a8754352e308cc38b5aa5d5edff15b..ba6d995e437545e1874502d26a8d392dea980f3d 100644 (file)
@@ -380,6 +380,10 @@ static int __init exynos_drm_init(void)
        ret = platform_driver_register(&ipp_driver);
        if (ret < 0)
                goto out_ipp;
+
+       ret = exynos_platform_device_ipp_register();
+       if (ret < 0)
+               goto out_ipp_dev;
 #endif
 
        ret = platform_driver_register(&exynos_drm_platform_driver);
@@ -400,6 +404,8 @@ out:
 
 out_drm:
 #ifdef CONFIG_DRM_EXYNOS_IPP
+       exynos_platform_device_ipp_unregister();
+out_ipp_dev:
        platform_driver_unregister(&ipp_driver);
 out_ipp:
 #endif
@@ -456,6 +462,7 @@ static void __exit exynos_drm_exit(void)
        platform_driver_unregister(&exynos_drm_platform_driver);
 
 #ifdef CONFIG_DRM_EXYNOS_IPP
+       exynos_platform_device_ipp_unregister();
        platform_driver_unregister(&ipp_driver);
 #endif
 
index 635d4c51679834675ee736afbae43d89e760215d..680a7c1b9dea20f8848ba69bf19625910685be08 100644 (file)
@@ -329,6 +329,16 @@ int exynos_platform_device_hdmi_register(void);
  */
 void exynos_platform_device_hdmi_unregister(void);
 
+/*
+ * this function registers exynos drm ipp platform device.
+ */
+int exynos_platform_device_ipp_register(void);
+
+/*
+ * this function unregisters exynos drm ipp platform device if it exists.
+ */
+void exynos_platform_device_ipp_unregister(void);
+
 extern struct platform_driver fimd_driver;
 extern struct platform_driver hdmi_driver;
 extern struct platform_driver mixer_driver;
index 1adce07ecb5bd6bba59af8556ddcff99428c61b3..29d2ad314490126302ed65e5cb9f79b5afd896f1 100644 (file)
@@ -47,6 +47,9 @@
 #define get_ipp_context(dev)   platform_get_drvdata(to_platform_device(dev))
 #define ipp_is_m2m_cmd(c)      (c == IPP_CMD_M2M)
 
+/* platform device pointer for ipp device. */
+static struct platform_device *exynos_drm_ipp_pdev;
+
 /*
  * A structure of event.
  *
@@ -102,6 +105,30 @@ static LIST_HEAD(exynos_drm_ippdrv_list);
 static DEFINE_MUTEX(exynos_drm_ippdrv_lock);
 static BLOCKING_NOTIFIER_HEAD(exynos_drm_ippnb_list);
 
+int exynos_platform_device_ipp_register(void)
+{
+       struct platform_device *pdev;
+
+       if (exynos_drm_ipp_pdev)
+               return -EEXIST;
+
+       pdev = platform_device_register_simple("exynos-drm-ipp", -1, NULL, 0);
+       if (IS_ERR(pdev))
+               return PTR_ERR(pdev);
+
+       exynos_drm_ipp_pdev = pdev;
+
+       return 0;
+}
+
+void exynos_platform_device_ipp_unregister(void)
+{
+       if (exynos_drm_ipp_pdev) {
+               platform_device_unregister(exynos_drm_ipp_pdev);
+               exynos_drm_ipp_pdev = NULL;
+       }
+}
+
 int exynos_drm_ippdrv_register(struct exynos_drm_ippdrv *ippdrv)
 {
        DRM_DEBUG_KMS("%s\n", __func__);