core.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * linux/drivers/video/omap2/dss/core.c
  3. *
  4. * Copyright (C) 2009 Nokia Corporation
  5. * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
  6. *
  7. * Some code and ideas taken from drivers/video/omap/ driver
  8. * by Imre Deak.
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License version 2 as published by
  12. * the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but WITHOUT
  15. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  16. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  17. * more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along with
  20. * this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. #define DSS_SUBSYS_NAME "CORE"
  23. #include <linux/kernel.h>
  24. #include <linux/module.h>
  25. #include <linux/platform_device.h>
  26. #include "omapdss.h"
  27. #include "dss.h"
  28. /* INIT */
  29. static int (*dss_output_drv_reg_funcs[])(void) __initdata = {
  30. dss_init_platform_driver,
  31. dispc_init_platform_driver,
  32. #ifdef CONFIG_OMAP2_DSS_DSI
  33. dsi_init_platform_driver,
  34. #endif
  35. #ifdef CONFIG_OMAP2_DSS_VENC
  36. venc_init_platform_driver,
  37. #endif
  38. #ifdef CONFIG_OMAP4_DSS_HDMI
  39. hdmi4_init_platform_driver,
  40. #endif
  41. #ifdef CONFIG_OMAP5_DSS_HDMI
  42. hdmi5_init_platform_driver,
  43. #endif
  44. };
  45. static void (*dss_output_drv_unreg_funcs[])(void) = {
  46. #ifdef CONFIG_OMAP5_DSS_HDMI
  47. hdmi5_uninit_platform_driver,
  48. #endif
  49. #ifdef CONFIG_OMAP4_DSS_HDMI
  50. hdmi4_uninit_platform_driver,
  51. #endif
  52. #ifdef CONFIG_OMAP2_DSS_VENC
  53. venc_uninit_platform_driver,
  54. #endif
  55. #ifdef CONFIG_OMAP2_DSS_DSI
  56. dsi_uninit_platform_driver,
  57. #endif
  58. dispc_uninit_platform_driver,
  59. dss_uninit_platform_driver,
  60. };
  61. static struct platform_device *omap_drm_device;
  62. static int __init omap_dss_init(void)
  63. {
  64. int r;
  65. int i;
  66. for (i = 0; i < ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) {
  67. r = dss_output_drv_reg_funcs[i]();
  68. if (r)
  69. goto err_reg;
  70. }
  71. omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0);
  72. if (IS_ERR(omap_drm_device)) {
  73. r = PTR_ERR(omap_drm_device);
  74. goto err_reg;
  75. }
  76. return 0;
  77. err_reg:
  78. for (i = ARRAY_SIZE(dss_output_drv_reg_funcs) - i;
  79. i < ARRAY_SIZE(dss_output_drv_reg_funcs);
  80. ++i)
  81. dss_output_drv_unreg_funcs[i]();
  82. return r;
  83. }
  84. static void __exit omap_dss_exit(void)
  85. {
  86. int i;
  87. platform_device_unregister(omap_drm_device);
  88. for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i)
  89. dss_output_drv_unreg_funcs[i]();
  90. }
  91. module_init(omap_dss_init);
  92. module_exit(omap_dss_exit);
  93. MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@nokia.com>");
  94. MODULE_DESCRIPTION("OMAP2/3 Display Subsystem");
  95. MODULE_LICENSE("GPL v2");