diff options
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.h | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 22 |
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 |
385 | out_vidi: | ||
386 | platform_driver_unregister(&vidi_driver); | 389 | platform_driver_unregister(&vidi_driver); |
390 | out_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(); | ||
395 | out_common_hdmi_dev: | ||
390 | platform_driver_unregister(&exynos_drm_common_hdmi_driver); | 396 | platform_driver_unregister(&exynos_drm_common_hdmi_driver); |
391 | out_common_hdmi: | 397 | out_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); | |||
328 | int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file); | 328 | int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file); |
329 | void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file); | 329 | void 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 | */ | ||
335 | extern int exynos_platform_device_hdmi_register(void); | ||
336 | |||
337 | /* | ||
338 | * this function unregisters exynos drm hdmi platform device if it exists. | ||
339 | */ | ||
340 | void exynos_platform_device_hdmi_unregister(void); | ||
341 | |||
331 | extern struct platform_driver fimd_driver; | 342 | extern struct platform_driver fimd_driver; |
332 | extern struct platform_driver hdmi_driver; | 343 | extern struct platform_driver hdmi_driver; |
333 | extern struct platform_driver mixer_driver; | 344 | extern 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. */ | ||
33 | static 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 */ |
34 | static struct exynos_drm_hdmi_context *hdmi_ctx; | 37 | static 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 | ||
52 | int 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 | |||
65 | void exynos_platform_device_hdmi_unregister(void) | ||
66 | { | ||
67 | if (exynos_drm_hdmi_pdev) | ||
68 | platform_device_unregister(exynos_drm_hdmi_pdev); | ||
69 | } | ||
70 | |||
49 | void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx) | 71 | void exynos_hdmi_drv_attach(struct exynos_drm_hdmi_context *ctx) |
50 | { | 72 | { |
51 | if (ctx) | 73 | if (ctx) |