fb.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * File: arch/arm/plat-omap/fb.c
  4. *
  5. * Framebuffer device registration for TI OMAP platforms
  6. *
  7. * Copyright (C) 2006 Nokia Corporation
  8. * Author: Imre Deak <[email protected]>
  9. */
  10. #include <linux/module.h>
  11. #include <linux/kernel.h>
  12. #include <linux/mm.h>
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/memblock.h>
  16. #include <linux/io.h>
  17. #include <linux/omapfb.h>
  18. #include <linux/dma-mapping.h>
  19. #include <linux/irq.h>
  20. #include <asm/mach/map.h>
  21. #include "irqs.h"
  22. #if IS_ENABLED(CONFIG_FB_OMAP)
  23. static bool omapfb_lcd_configured;
  24. static struct omapfb_platform_data omapfb_config;
  25. static u64 omap_fb_dma_mask = ~(u32)0;
  26. static struct resource omap_fb_resources[] = {
  27. {
  28. .name = "irq",
  29. .start = INT_LCD_CTRL,
  30. .flags = IORESOURCE_IRQ,
  31. },
  32. {
  33. .name = "irq",
  34. .start = INT_SOSSI_MATCH,
  35. .flags = IORESOURCE_IRQ,
  36. },
  37. };
  38. static struct platform_device omap_fb_device = {
  39. .name = "omapfb",
  40. .id = -1,
  41. .dev = {
  42. .dma_mask = &omap_fb_dma_mask,
  43. .coherent_dma_mask = DMA_BIT_MASK(32),
  44. .platform_data = &omapfb_config,
  45. },
  46. .num_resources = ARRAY_SIZE(omap_fb_resources),
  47. .resource = omap_fb_resources,
  48. };
  49. void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
  50. {
  51. omapfb_config.lcd = *config;
  52. omapfb_lcd_configured = true;
  53. }
  54. static int __init omap_init_fb(void)
  55. {
  56. /*
  57. * If the board file has not set the lcd config with
  58. * omapfb_set_lcd_config(), don't bother registering the omapfb device
  59. */
  60. if (!omapfb_lcd_configured)
  61. return 0;
  62. return platform_device_register(&omap_fb_device);
  63. }
  64. arch_initcall(omap_init_fb);
  65. #else
  66. void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
  67. {
  68. }
  69. #endif