drv_lcd.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-01-11 Lyons first version
  9. * 2021-06-24 RiceChen refactor
  10. */
  11. #ifndef __DRV_LCD_H__
  12. #define __DRV_LCD_H__
  13. #include <board.h>
  14. #include "drv_pin.h"
  15. #include "drv_common.h"
  16. #include "fsl_iomuxc.h"
  17. #include "fsl_clock.h"
  18. #include "fsl_elcdif.h"
  19. #define LCD_GPIO_MAX 29
  20. #define LCD_MUX_BASE 0x020E0104U
  21. #define LCD_CONFIG_BASE 0x020E0390U
  22. #define LCD_WIDTH BSP_LCD_WIDTH
  23. #define LCD_HEIGHT BSP_LCD_HEIGHT
  24. #define LCD_VSW BSP_LCD_VSW
  25. #define LCD_VBP BSP_LCD_VBP
  26. #define LCD_VFP BSP_LCD_VFP
  27. #define LCD_HSW BSP_LCD_HSW
  28. #define LCD_HBP BSP_LCD_HBP
  29. #define LCD_HFP BSP_LCD_HFP
  30. #define LCD_PLL_DIV BSP_LCD_PLL_DIV
  31. #define LCD_BITS_PER_PIXEL 32
  32. #define LCD_BUF_SIZE (LCD_WIDTH * LCD_HEIGHT * LCD_BITS_PER_PIXEL / 8)
  33. #define IMX6ULL_LCD_BL_PIN GET_PIN(1, 8)
  34. struct fb_fix_screen_info
  35. {
  36. rt_uint32_t shamem_start;
  37. rt_uint32_t shamem_len;
  38. };
  39. struct lcd_info
  40. {
  41. struct rt_device_graphic_info graphic;
  42. struct fb_fix_screen_info screen;
  43. };
  44. struct imx6ull_lcd_config
  45. {
  46. LCDIF_Type *ELCDIF;
  47. char *name;
  48. rt_uint32_t apd_clk_name;
  49. rt_uint32_t pix_clk_name;
  50. rt_uint32_t lcd_mux_base;
  51. rt_uint32_t lcd_cfg_base;
  52. };
  53. struct imx6ull_lcd_bus
  54. {
  55. struct rt_device parent;
  56. struct rt_device_graphic_info info;
  57. struct imx6ull_lcd_config *config;
  58. rt_uint8_t *fb_phy;
  59. rt_uint8_t *fb_virt;
  60. };
  61. #ifdef BSP_USING_LCD
  62. #define LCD_BUS_CONFIG \
  63. { \
  64. .ELCDIF = LCDIF, \
  65. .name = "lcd", \
  66. .apd_clk_name = kCLOCK_Lcd, \
  67. .pix_clk_name = kCLOCK_Lcdif1, \
  68. .lcd_mux_base = LCD_MUX_BASE, \
  69. .lcd_cfg_base = LCD_CONFIG_BASE, \
  70. }
  71. #endif /* BSP_USING_LCD */
  72. #endif