ark_lcdc_common.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /*
  2. * Header file for ARKN141 LCD Controller
  3. *
  4. */
  5. #ifndef __ARKN_LCDC_COMMON_H__
  6. #define __ARKN_LCDC_COMMON_H__
  7. #include <linux/workqueue.h>
  8. #include <linux/pwm.h>
  9. /* Way LCD wires are connected to the chip:
  10. * A swapped wiring onboard can bring to RGB mode.
  11. */
  12. #define ATOMIC_SET_LAYER_POS (1 << 0)
  13. #define ATOMIC_SET_LAYER_SIZE (1 << 1)
  14. #define ATOMIC_SET_LAYER_FMT (1 << 2)
  15. #define ATOMIC_SET_LAYER_ADDR (1 << 3)
  16. #define ATOMIC_SET_LAYER_SCALER (1 << 4)
  17. /* Way LCD wires are connected to the chip:
  18. * A swapped wiring onboard can bring to RGB mode.
  19. */
  20. #define ARK_LCDC_WIRING_BGR 0
  21. #define ARK_LCDC_WIRING_GBR 1
  22. #define ARK_LCDC_WIRING_RBG 2
  23. #define ARK_LCDC_WIRING_BRG 3
  24. #define ARK_LCDC_WIRING_GRB 4
  25. #define ARK_LCDC_WIRING_RGB 5
  26. enum ark_lcdc_rgb_order {
  27. ARK_LCDC_ORDER_RGB,
  28. ARK_LCDC_ORDER_RBG,
  29. ARK_LCDC_ORDER_GRB,
  30. ARK_LCDC_ORDER_GBR,
  31. ARK_LCDC_ORDER_BRG,
  32. ARK_LCDC_ORDER_BGR,
  33. };
  34. enum ark_platform_type {
  35. ARK_PLATFORM_ARK1668,
  36. ARK_PLATFORM_ARKN141,
  37. ARK_PLATFORM_ARK1668E,
  38. ARK_PLATFORM_MAX
  39. };
  40. enum ark_disp_format {
  41. ARK_LCDC_FORMAT_YUV422,
  42. ARK_LCDC_FORMAT_YUV420,
  43. ARK_LCDC_FORMAT_VYUY,
  44. ARK_LCDC_FORMAT_YUV,
  45. ARK_LCDC_FORMAT_RGBI555,
  46. ARK_LCDC_FORMAT_R5G6B5,
  47. ARK_LCDC_FORMAT_RGBA888,
  48. ARK_LCDC_FORMAT_RGB888,
  49. ARK_LCDC_FORMAT_Y_UV422 = 0x10,
  50. ARK_LCDC_FORMAT_Y_UV420 = 0x11,
  51. };
  52. enum ark_lcdc_yuv_order {
  53. ARK_LCDC_ORDER_VYUY,
  54. ARK_LCDC_ORDER_UYVY,
  55. ARK_LCDC_ORDER_YVYU,
  56. ARK_LCDC_ORDER_YUYV,
  57. };
  58. struct ark_disp_scaler {
  59. int src_w;
  60. int src_h;
  61. int win_x;
  62. int win_y;
  63. int win_w;
  64. int win_h;
  65. int out_x;
  66. int out_y;
  67. int out_w;
  68. int out_h;
  69. int cut_top;
  70. int cut_bottom;
  71. int cut_left;
  72. int cut_right;
  73. };
  74. struct ark_disp_addr {
  75. unsigned int yaddr;
  76. unsigned int cbaddr;
  77. unsigned int craddr;
  78. unsigned int wait_vsync;
  79. };
  80. struct ark_disp_reg {
  81. unsigned int addr;
  82. unsigned int value;
  83. };
  84. struct ark_screen {
  85. unsigned int type;
  86. unsigned int width;
  87. unsigned int height;
  88. unsigned int disp_x;
  89. unsigned int disp_y;
  90. unsigned int disp_width;
  91. unsigned int disp_height;
  92. };
  93. struct ark_platform_info {
  94. int type;
  95. int reserve[32];
  96. };
  97. struct ark_disp_color {
  98. u8 contrast;
  99. u8 brightness;
  100. u8 saturation;
  101. u8 hue;
  102. };
  103. struct ark_disp_vp {
  104. struct ark_disp_color color;
  105. int reg[6];
  106. };
  107. struct ark_disp_atomic {
  108. int layer;
  109. int atomic_stat;
  110. int pos_x;
  111. int pos_y;
  112. int width;
  113. int height;
  114. int format;
  115. int yuyv_order;
  116. int rgb_order;
  117. struct ark_disp_addr addr;
  118. struct ark_disp_scaler scaler;
  119. };
  120. #define ARK_IOW(num, dtype) _IOW('O', num, dtype)
  121. #define ARK_IOR(num, dtype) _IOR('O', num, dtype)
  122. #define ARK_IOWR(num, dtype) _IOWR('O', num, dtype)
  123. #define ARK_IO(num) _IO('O', num)
  124. #define ARKFB_GET_VSYNC_STATUS ARK_IOW(37, unsigned int)
  125. #define ARKFB_WAITFORVSYNC ARK_IO(38)
  126. #define ARKFB_SHOW_WINDOW ARK_IO(39)
  127. #define ARKFB_HIDE_WINDOW ARK_IO(40)
  128. #define ARKFB_SET_WINDOW_POS ARK_IOW(41, unsigned int)
  129. #define ARKFB_SET_WINDOW_SIZE ARK_IOW(42, unsigned int)
  130. #define ARKFB_SET_WINDOW_FORMAT ARK_IOW(43, unsigned int)
  131. #define ARKFB_SET_WINDOW_ADDR ARK_IOW(44, struct ark_disp_addr)
  132. #define ARKFB_SET_WINDOW_SCALER ARK_IOW(45, struct ark_disp_scaler)
  133. #define ARKFB_SET_WINDOW_ATOMIC ARK_IOW(46, struct ark_disp_atomic)
  134. #define ARKFB_SET_REG_VALUE ARK_IOW(47, struct ark_disp_reg)
  135. #define ARKFB_GET_REG_VALUE ARK_IOR(48, struct ark_disp_reg)
  136. #define ARKFB_GET_WINDOW_ADDR ARK_IOR(49, struct ark_disp_addr)
  137. #define ARKFB_GET_SCREEN_INFO ARK_IOR(50, struct ark_screen)
  138. #define ARKFB_SET_SCREEN_INFO ARK_IOW(51, struct ark_screen)
  139. #define ARKFB_GET_PLATFORM_INFO ARK_IOR(52, struct ark_platform_info)
  140. #define ARKFB_GET_WINDOW_FORMAT ARK_IOR(53, unsigned int)
  141. #define ARKFB_SET_VP_INFO ARK_IOW(54, struct ark_disp_vp)
  142. #define ARKFB_GET_VP_INFO ARK_IOW(55, struct ark_disp_vp)
  143. #define ARKFB_SET_WINDOW_PRIORITY ARK_IOW(63, unsigned int)
  144. #define VIN_SHOW_WINDOW ARK_IO(55)
  145. #define VIN_HIDE_WINDOW ARK_IO(56)
  146. #define VIN_SET_WINDOW_POS ARK_IO(57)
  147. #define VIN_SET_SOURCE_SIZE ARK_IO(58)
  148. #define VIN_SET_WINDOW_FORMAT ARK_IO(59)
  149. #define VIN_SET_WINDOW_ADDR ARK_IO(60)
  150. #define VIN_SET_WINDOW_SCALER ARK_IO(61)
  151. #define VIN_SET_LAYER_SIZE ARK_IO(62)
  152. #endif /* __ARKN141_LCDC_H__ */