ark_lcdc_common.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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_ARK1668ED,
  39. ARK_PLATFORM_MAX
  40. };
  41. enum ark_disp_format {
  42. ARK_LCDC_FORMAT_YUV422,
  43. ARK_LCDC_FORMAT_YUV420,
  44. ARK_LCDC_FORMAT_VYUY,
  45. ARK_LCDC_FORMAT_YUV,
  46. ARK_LCDC_FORMAT_RGBI555,
  47. ARK_LCDC_FORMAT_R5G6B5,
  48. ARK_LCDC_FORMAT_RGBA888,
  49. ARK_LCDC_FORMAT_RGB888,
  50. ARK_LCDC_FORMAT_Y_UV422 = 0x10,
  51. ARK_LCDC_FORMAT_Y_UV420 = 0x11,
  52. };
  53. enum ark_lcdc_yuv_order {
  54. ARK_LCDC_ORDER_VYUY,
  55. ARK_LCDC_ORDER_UYVY,
  56. ARK_LCDC_ORDER_YVYU,
  57. ARK_LCDC_ORDER_YUYV,
  58. };
  59. struct ark_disp_scaler {
  60. int src_w;
  61. int src_h;
  62. int win_x;
  63. int win_y;
  64. int win_w;
  65. int win_h;
  66. int out_x;
  67. int out_y;
  68. int out_w;
  69. int out_h;
  70. int cut_top;
  71. int cut_bottom;
  72. int cut_left;
  73. int cut_right;
  74. };
  75. struct ark_disp_addr {
  76. unsigned int yaddr;
  77. unsigned int cbaddr;
  78. unsigned int craddr;
  79. unsigned int wait_vsync;
  80. };
  81. struct ark_disp_reg {
  82. unsigned int addr;
  83. unsigned int value;
  84. };
  85. struct ark_screen {
  86. unsigned int type;
  87. unsigned int width;
  88. unsigned int height;
  89. unsigned int disp_x;
  90. unsigned int disp_y;
  91. unsigned int disp_width;
  92. unsigned int disp_height;
  93. };
  94. struct ark_platform_info {
  95. int type;
  96. int reserve[32];
  97. };
  98. struct ark_disp_color {
  99. u8 contrast;
  100. u8 brightness;
  101. u8 saturation;
  102. u8 hue;
  103. };
  104. struct ark_disp_vp {
  105. struct ark_disp_color color;
  106. int reg[6];
  107. };
  108. enum arke_disp_tvenc_out_mode {
  109. ARKE_TVENC_OUT_CVBS_PAL = 0,
  110. ARKE_TVENC_OUT_CVBS_NTSC = 1,
  111. ARKE_TVENC_AHDOUT_720P_25FPS = 2,
  112. };
  113. struct ark_disp_tvenc_cfg_arg {
  114. unsigned int src_width;
  115. unsigned int src_height;
  116. unsigned int enable;
  117. unsigned int out_mode; /* enum arke_disp_tvenc_out_mode */
  118. unsigned int backcolor_y;
  119. unsigned int backcolor_cb;
  120. unsigned int backcolor_cr;
  121. };
  122. struct ark_disp_update_window {
  123. __u32 win_x, win_y;
  124. __u32 win_width, win_height;
  125. __u32 width, height;
  126. __u32 format;
  127. __u32 rgb_order;
  128. __u32 yuyv_order;
  129. __u32 out_x, out_y;
  130. __u32 out_width, out_height;
  131. __u32 interlace_out;
  132. __u32 show_tv;
  133. };
  134. typedef struct
  135. {
  136. unsigned int SrcWidth; //source data width
  137. unsigned int SrcHeight; //source data height
  138. unsigned int WinWidth; //width of window which cut from source data
  139. unsigned int WinHeight; //height of window which cut from source data
  140. unsigned int DstWidth; //display width
  141. unsigned int DstHeight; //display height
  142. unsigned int XOffset; //the horizontal start position of window
  143. unsigned int YOffset; //the vertical start position of window
  144. unsigned int UpBlank; //the cut number of the top of the pic after scaler
  145. unsigned int DownBlank; //the cut number of the bpttom of the pic after scaler
  146. unsigned int LeftBlank; //the cut number of the left of the pic after scaler
  147. unsigned int RightBlank; //the cut number of the right of the pic after scaler
  148. unsigned int SrcBuf; //souce data address
  149. unsigned int Interlace4TV;
  150. unsigned int Format; //the format of source data
  151. unsigned int WriteBackEn; //whether write back data after scaler or not
  152. unsigned int *WriteBackBuf; //write back addr when write back enable,only video2 layer support
  153. }video_scaler_para;
  154. typedef struct
  155. {
  156. unsigned int tHFP;
  157. unsigned int tHBP;
  158. unsigned int tHSW;
  159. unsigned int tCPL;
  160. unsigned int tVSW;
  161. unsigned int tVFP;
  162. unsigned int tIOE;
  163. unsigned int tIHS;
  164. unsigned int tIVS;
  165. unsigned int tLPS;
  166. unsigned int tVBP;
  167. } tvenc_info_struct;
  168. typedef struct {
  169. unsigned int width;
  170. unsigned int height;
  171. unsigned int hsw;
  172. unsigned int vsw;
  173. unsigned int mode;
  174. } cvbs_format_struct;
  175. typedef struct
  176. {
  177. unsigned int width;
  178. unsigned int height;
  179. unsigned int hfp;
  180. unsigned int hsw;
  181. unsigned int hbp;
  182. unsigned int vfp;
  183. unsigned int vsw;
  184. unsigned int vbp;
  185. unsigned int mode;
  186. }ahd_format_struct;
  187. struct ark_disp_atomic {
  188. int layer;
  189. int atomic_stat;
  190. int pos_x;
  191. int pos_y;
  192. int width;
  193. int height;
  194. int format;
  195. int yuyv_order;
  196. int rgb_order;
  197. struct ark_disp_addr addr;
  198. struct ark_disp_scaler scaler;
  199. };
  200. #define ARK_IOW(num, dtype) _IOW('O', num, dtype)
  201. #define ARK_IOR(num, dtype) _IOR('O', num, dtype)
  202. #define ARK_IOWR(num, dtype) _IOWR('O', num, dtype)
  203. #define ARK_IO(num) _IO('O', num)
  204. #define ARKFB_GET_VSYNC_STATUS ARK_IOW(37, unsigned int)
  205. #define ARKFB_WAITFORVSYNC ARK_IO(38)
  206. #define ARKFB_SHOW_WINDOW ARK_IO(39)
  207. #define ARKFB_HIDE_WINDOW ARK_IO(40)
  208. #define ARKFB_SET_WINDOW_POS ARK_IOW(41, unsigned int)
  209. #define ARKFB_SET_WINDOW_SIZE ARK_IOW(42, unsigned int)
  210. #define ARKFB_SET_WINDOW_FORMAT ARK_IOW(43, unsigned int)
  211. #define ARKFB_SET_WINDOW_ADDR ARK_IOW(44, struct ark_disp_addr)
  212. #define ARKFB_SET_WINDOW_SCALER ARK_IOW(45, struct ark_disp_scaler)
  213. #define ARKFB_SET_WINDOW_ATOMIC ARK_IOW(46, struct ark_disp_atomic)
  214. #define ARKFB_SET_REG_VALUE ARK_IOW(47, struct ark_disp_reg)
  215. #define ARKFB_GET_REG_VALUE ARK_IOR(48, struct ark_disp_reg)
  216. #define ARKFB_GET_WINDOW_ADDR ARK_IOR(49, struct ark_disp_addr)
  217. #define ARKFB_GET_SCREEN_INFO ARK_IOR(50, struct ark_screen)
  218. #define ARKFB_SET_SCREEN_INFO ARK_IOW(51, struct ark_screen)
  219. #define ARKFB_GET_PLATFORM_INFO ARK_IOR(52, struct ark_platform_info)
  220. #define ARKFB_GET_WINDOW_FORMAT ARK_IOR(53, unsigned int)
  221. #define ARKFB_SET_VP_INFO ARK_IOW(54, struct ark_disp_vp)
  222. #define ARKFB_GET_VP_INFO ARK_IOW(55, struct ark_disp_vp)
  223. #define ARKFB_SET_WINDOW_PRIORITY ARK_IOW(63, unsigned int)
  224. #define ARKFB_SET_GUI_TVOUT ARK_IOW(64, struct ark_disp_tvenc_cfg_arg)
  225. #define ARKFB_SET_VIDEO_TVOUT ARK_IOW(65, struct ark_disp_tvenc_cfg_arg)
  226. #define VIN_SHOW_WINDOW ARK_IO(55)
  227. #define VIN_HIDE_WINDOW ARK_IO(56)
  228. #define VIN_SET_WINDOW_POS ARK_IO(57)
  229. #define VIN_SET_SOURCE_SIZE ARK_IO(58)
  230. #define VIN_SET_WINDOW_FORMAT ARK_IO(59)
  231. #define VIN_SET_WINDOW_ADDR ARK_IO(60)
  232. #define VIN_SET_WINDOW_SCALER ARK_IO(61)
  233. #define VIN_SET_LAYER_SIZE ARK_IO(62)
  234. #endif /* __ARKN141_LCDC_H__ */