arkn141_lcdc.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * Header file for ARKN141 LCD Controller
  3. *
  4. */
  5. #ifndef __ARKN141_LCDC_H__
  6. #define __ARKN141_LCDC_H__
  7. #include <linux/workqueue.h>
  8. #include <linux/pwm.h>
  9. #include "ark_lcdc_common.h"
  10. enum arkn141_interface_type {
  11. ARKN141_LCDC_INTERFACE_TTL,
  12. ARKN141_LCDC_INTERFACE_RGB,
  13. ARKN141_LCDC_INTERFACE_SRGB,
  14. ARKN141_LCDC_INTERFACE_SRGBP //itu601out
  15. };
  16. enum arkn141_lcdc_format {
  17. ARKN141_LCDC_FORMAT_YUV420,
  18. ARKN141_LCDC_FORMAT_ARGB888,
  19. ARKN141_LCDC_FORMAT_RGB565,
  20. ARKN141_LCDC_FORMAT_RGB454,
  21. ARKN141_LCDC_FORMAT_AYUV444, //add
  22. ARKN141_LCDC_FORMAT_Y_UV420, //add
  23. ARKN141_LCDC_FORMAT_END
  24. };
  25. enum arkn141_lcdc_osdlayer {
  26. OSD_LAYER0 = 0,
  27. OSD_LAYER1,
  28. OSD_LAYER2,
  29. OSD_LAYER_MAX
  30. };
  31. /* LCD Controller info data structure, stored in device platform_data */
  32. struct arkn141_lcdfb_pdata {
  33. u8 default_bpp;
  34. u8 lcd_wiring_mode;
  35. u8 interface_type;
  36. u32 lvds_con;
  37. bool de_active_high;
  38. bool pixelclk_active_high;
  39. bool lcdcon_is_backlight;
  40. bool lcd_clk_freq_autoupdate;
  41. struct pwm_device *pwm;
  42. struct timer_list backlight_timer;
  43. int backlight_value;
  44. int backlight_delay;
  45. void (*arkn141_lcdfb_power_control)(struct arkn141_lcdfb_pdata *pdata, int on);
  46. struct list_head pwr_gpios;
  47. };
  48. /* LCD Controller info data structure, stored in device platform_data */
  49. struct arkn141_lcdfb_info {
  50. spinlock_t lock;
  51. struct fb_info *info;
  52. void __iomem *mmio;
  53. void __iomem *sysreg;
  54. int irq_base;
  55. struct work_struct task;
  56. wait_queue_head_t vsync_waitq;
  57. int vsync_flag;
  58. unsigned int smem_len;
  59. struct platform_device *pdev;
  60. struct clk *lcdc_clk;
  61. struct backlight_device *backlight;
  62. u8 bl_power;
  63. u8 saved_lcdcon;
  64. bool have_intensity_bit;
  65. u8 atomic_flag;
  66. struct ark_disp_atomic patomic[OSD_LAYER_MAX];
  67. struct arkn141_lcdfb_pdata pdata;
  68. struct mutex mutex_lock;
  69. volatile u32 frame_vsync;
  70. };
  71. #define ARKN141_LCDC_PARAM0 0x00
  72. #define ARKN141_LCDC_PARAM1 0x04
  73. #define ARKN141_LCDC_PARAM2 0x08
  74. #define ARKN141_LCDC_PARAM3 0x0c
  75. #define ARKN141_LCDC_PARAM4 0x10
  76. #define ARKN141_LCDC_PARAM5 0x14
  77. #define ARKN141_LCDC_PARAM6 0x18
  78. #define ARKN141_LCDC_PARAM7 0x1c
  79. #define ARKN141_LCDC_PARAM8 0x20
  80. #define ARKN141_LCDC_PARAM9 0x24
  81. #define ARKN141_LCDC_PARAM10 0x28
  82. #define ARKN141_LCDC_PARAM11 0x2c
  83. #define ARKN141_LCDC_PARAM12 0x30
  84. #define ARKN141_LCDC_PARAM13 0x34
  85. #define ARKN141_LCDC_PARAM14 0x38
  86. #define ARKN141_LCDC_PARAM15 0x3c
  87. #define ARKN141_LCDC_PARAM16 0x40
  88. #define ARKN141_LCDC_PARAM17 0x44
  89. #define ARKN141_LCDC_PARAM18 0x48
  90. #define ARKN141_LCDC_PARAM19 0x4c
  91. #define ARKN141_LCDC_PARAM20 0x50
  92. #define ARKN141_LCDC_PARAM21 0x54
  93. #define ARKN141_LCDC_PARAM22 0x58
  94. //OSD
  95. #define ARKN141_LCDC_OSD_BASE 0x5c
  96. #define ARKN141_LCDC_OSD0_PARAM0 0x5c
  97. #define ARKN141_LCDC_OSD0_PARAM1 0x60
  98. #define ARKN141_LCDC_OSD0_PARAM2 0x64
  99. #define ARKN141_LCDC_OSD0_PARAM3 0x68
  100. #define ARKN141_LCDC_OSD0_PARAM4 0x6c
  101. #define ARKN141_LCDC_OSD0_PARAM5 0x70
  102. #define ARKN141_LCDC_OSD1_PARAM0 0x74
  103. #define ARKN141_LCDC_OSD1_PARAM1 0x78
  104. #define ARKN141_LCDC_OSD1_PARAM2 0x7c
  105. #define ARKN141_LCDC_OSD1_PARAM3 0x80
  106. #define ARKN141_LCDC_OSD1_PARAM4 0x84
  107. #define ARKN141_LCDC_OSD1_PARAM5 0x88
  108. #define ARKN141_LCDC_OSD2_PARAM0 0x8c
  109. #define ARKN141_LCDC_OSD2_PARAM1 0x90
  110. #define ARKN141_LCDC_OSD2_PARAM2 0x94
  111. #define ARKN141_LCDC_OSD2_PARAM3 0x98
  112. #define ARKN141_LCDC_OSD2_PARAM4 0x9c
  113. #define ARKN141_LCDC_OSD2_PARAM5 0xa0
  114. #define ARKN141_LCDC_INTR_CLR 0xc8
  115. #define ARKN141_LCDC_STATUS 0xcc
  116. #define ARKN141_LCDC_VP_RGB2YCBCR_COEF0 0x200
  117. #define ARKN141_LCDC_VP_RGB2YCBCR_COEF1 0x204
  118. #define ARKN141_LCDC_VP_RGB2YCBCR_COEF2 0x208
  119. #define ARKN141_LCDC_VP_ADJUSTEMENT 0x20c
  120. #define ARKN141_LCDC_VP_CONTROL 0x210
  121. #define ARKN141_LCDC_DITHING 0x214
  122. #define ARKN141_LCDC_SRGB_CFG 0x218
  123. #define ARKN141_LCDC_OSD_012_PARAM 0x268
  124. #define ARKN141_LCDC_OSD_COEF_SYNC 0x26c
  125. #define ARKN141_LCDC_INT_LCD_FRAME (1 << 1)
  126. #define ARKN141_LAYER_IS_VALID(layer) ((layer >= OSD_LAYER0) && (layer < OSD_LAYER_MAX))
  127. int arkn141_lcdfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg);
  128. int arkn141_lcdc_funcs_init(struct arkn141_lcdfb_info *sinfo);
  129. int arkn141_lcdc_osd_addr_update(void);
  130. #endif /* __ARKN141_LCDC_H__ */