aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRahul Sharma <rahul.sharma@samsung.com>2012-10-15 20:20:13 -0400
committerInki Dae <daeinki@gmail.com>2012-12-13 09:05:43 -0500
commitae9dace2903db86b27f19d40c1d1b21a6f712895 (patch)
tree5e6530ef34e5b3e66bf17cd38e77a9104834bf96
parent422bd00ea640b9aacb6bdd3903b76f69e72fba8d (diff)
drm: exynos: moved exynos drm hdmi device registration to drm driver
This patch moved the exynos-drm-hdmi platform device registration to the drm driver. When DT is enabled, platform devices needs to be registered within the driver code. This patch fits the requirement of both DT and Non DT based drm drivers. Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.c9
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h11
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_hdmi.c22
3 files changed, 41 insertions, 1 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 068381337d4f..4a1168d3e907 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -345,6 +345,10 @@ static int __init exynos_drm_init(void)
345 ret = platform_driver_register(&exynos_drm_common_hdmi_driver); 345 ret = platform_driver_register(&exynos_drm_common_hdmi_driver);
346 if (ret < 0) 346 if (ret < 0)
347 goto out_common_hdmi; 347 goto out_common_hdmi;
348
349 ret = exynos_platform_device_hdmi_register();
350 if (ret < 0)
351 goto out_common_hdmi_dev;
348#endif 352#endif
349 353
350#ifdef CONFIG_DRM_EXYNOS_VIDI 354#ifdef CONFIG_DRM_EXYNOS_VIDI
@@ -382,11 +386,13 @@ out_g2d:
382#endif 386#endif
383 387
384#ifdef CONFIG_DRM_EXYNOS_VIDI 388#ifdef CONFIG_DRM_EXYNOS_VIDI
385out_vidi:
386 platform_driver_unregister(&vidi_driver); 389 platform_driver_unregister(&vidi_driver);
390out_vidi:
387#endif 391#endif
388 392
389#ifdef CONFIG_DRM_EXYNOS_HDMI 393#ifdef CONFIG_DRM_EXYNOS_HDMI
394 exynos_platform_device_hdmi_unregister();
395out_common_hdmi_dev:
390 platform_driver_unregister(&exynos_drm_common_hdmi_driver); 396 platform_driver_unregister(&exynos_drm_common_hdmi_driver);
391out_common_hdmi: 397out_common_hdmi:
392 platform_driver_unregister(&mixer_driver); 398 platform_driver_unregister(&mixer_driver);
@@ -415,6 +421,7 @@ static void __exit exynos_drm_exit(void)
415#endif 421#endif
416 422
417#ifdef CONFIG_DRM_EXYNOS_HDMI 423#ifdef CONFIG_DRM_EXYNOS_HDMI
424 exynos_platform_device_hdmi_unregister();
418 platform_driver_unregister(&exynos_drm_common_hdmi_driver); 425 platform_driver_unregister(&exynos_drm_common_hdmi_driver);
419 platform_driver_unregister(&mixer_driver); 426 platform_driver_unregister(&mixer_driver);
420 platform_driver_unregister(&hdmi_driver); 427 platform_driver_unregister(&hdmi_driver);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 9c9c2dc75828..a4702a83e03f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -328,6 +328,17 @@ int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *drm_subdrv);
328int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file); 328int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file);
329void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file); 329void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file);
330 330
331/*
332 * this function registers exynos drm hdmi platform device. It ensures only one
333 * instance of the device is created.
334 */
335extern int exynos_platform_device_hdmi_register(void);
336
337/*
338 * this function unregisters exynos drm hdmi platform device if it exists.
339 */
340void exynos_platform_device_hdmi_unregister(void);
341
331extern struct platform_driver fimd_driver; 342extern struct platform_driver fimd_driver;
332extern struct platform_driver hdmi_driver; 343extern struct platform_driver hdmi_driver;
333extern struct platform_driver mixer_driver; 344extern struct platform_driver mixer_driver;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
index 2d11e70b601a..8b771a3d2709 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
@@ -29,6 +29,9 @@
29#define get_ctx_from_subdrv(subdrv) container_of(subdrv,\ 29#define get_ctx_from_subdrv(subdrv) container_of(subdrv,\
30 struct drm_hdmi_context, subdrv); 30 struct drm_hdmi_context, subdrv);
31 31
32/* platform device pointer for common drm hdmi device. */
33static struct platform_device *exynos_drm_hdmi_pdev;
34
32/* Common hdmi subdrv needs to access the hdmi and mixer though context. 35/* Common hdmi subdrv needs to access the hdmi and mixer though context.
33* These should be initialied by the repective drivers */ 36* These should be initialied by the repective drivers */
34static struct exynos_drm_hdmi_context *hdmi_ctx; 37static struct exynos_drm_hdmi_context *hdmi_ctx;
@@ -46,6 +49,25 @@ struct drm_hdmi_context {
46 bool enabled[MIXER_WIN_NR]; 49 bool enabled[MIXER_WIN_NR];
47}; 50};
48 51
52int exynos_platform_device_hdmi_register(void)
53{
54 if (exynos_drm_hdmi_pdev)
55 return -EEXIST;
56
57 exynos_drm_hdmi_pdev = platform_device_register_simple(
58 "exynos-drm-hdmi", -1, NULL, 0);
59 if (IS_ERR_OR_NULL(exynos_drm_hdmi_pdev))
60 return PTR_ERR(exynos_drm_hdmi_pdev);
61
62 return 0;
63}
64
65void exynos_platform_device_hdmi_unregister(void)
66{
67 if (exynos_drm_hdmi_pdev)
68 platform_device_unregister(exynos_drm_hdmi_pdev);
69}
70
49void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx) 71void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx)
50{ 72{
51 if (ctx) 73 if (ctx)