drm.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * DRM/KMS device registration for TI OMAP platforms
  3. *
  4. * Copyright (C) 2012 Texas Instruments
  5. * Author: Rob Clark <rob.clark@linaro.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published by
  9. * the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  14. * more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with
  17. * this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include <linux/module.h>
  20. #include <linux/kernel.h>
  21. #include <linux/mm.h>
  22. #include <linux/init.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/dma-mapping.h>
  25. #include <plat/omap_device.h>
  26. #include <plat/omap_hwmod.h>
  27. #if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
  28. static struct platform_device omap_drm_device = {
  29. .dev = {
  30. .coherent_dma_mask = DMA_BIT_MASK(32),
  31. },
  32. .name = "omapdrm",
  33. .id = 0,
  34. };
  35. static int __init omap_init_drm(void)
  36. {
  37. struct omap_hwmod *oh = NULL;
  38. struct platform_device *pdev;
  39. /* lookup and populate the DMM information, if present - OMAP4+ */
  40. oh = omap_hwmod_lookup("dmm");
  41. if (oh) {
  42. pdev = omap_device_build(oh->name, -1, oh, NULL, 0, NULL, 0,
  43. false);
  44. WARN(IS_ERR(pdev), "Could not build omap_device for %s\n",
  45. oh->name);
  46. }
  47. return platform_device_register(&omap_drm_device);
  48. }
  49. arch_initcall(omap_init_drm);
  50. #endif