fsl-diu-fb.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /*
  2. * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
  3. *
  4. * Freescale DIU Frame Buffer device driver
  5. *
  6. * Authors: Hongjun Chen <hong-jun.chen@freescale.com>
  7. * Paul Widmer <paul.widmer@freescale.com>
  8. * Srikanth Srinivasan <srikanth.srinivasan@freescale.com>
  9. * York Sun <yorksun@freescale.com>
  10. *
  11. * Based on imxfb.c Copyright (C) 2004 S.Hauer, Pengutronix
  12. *
  13. * This program is free software; you can redistribute it and/or modify it
  14. * under the terms of the GNU General Public License as published by the
  15. * Free Software Foundation; either version 2 of the License, or (at your
  16. * option) any later version.
  17. *
  18. */
  19. #ifndef __FSL_DIU_FB_H__
  20. #define __FSL_DIU_FB_H__
  21. /* Arbitrary threshold to determine the allocation method
  22. * See mpc8610fb_set_par(), map_video_memory(), and unmap_video_memory()
  23. */
  24. #define MEM_ALLOC_THRESHOLD (1024*768*4+32)
  25. /* Minimum value that the pixel clock can be set to in pico seconds
  26. * This is determined by platform clock/3 where the minimum platform
  27. * clock is 533MHz. This gives 5629 pico seconds.
  28. */
  29. #define MIN_PIX_CLK 5629
  30. #define MAX_PIX_CLK 96096
  31. #include <linux/types.h>
  32. struct mfb_alpha {
  33. int enable;
  34. int alpha;
  35. };
  36. struct mfb_chroma_key {
  37. int enable;
  38. __u8 red_max;
  39. __u8 green_max;
  40. __u8 blue_max;
  41. __u8 red_min;
  42. __u8 green_min;
  43. __u8 blue_min;
  44. };
  45. struct aoi_display_offset {
  46. int x_aoi_d;
  47. int y_aoi_d;
  48. };
  49. #define MFB_SET_CHROMA_KEY _IOW('M', 1, struct mfb_chroma_key)
  50. #define MFB_WAIT_FOR_VSYNC _IOW('F', 0x20, u_int32_t)
  51. #define MFB_SET_BRIGHTNESS _IOW('M', 3, __u8)
  52. #define MFB_SET_ALPHA 0x80014d00
  53. #define MFB_GET_ALPHA 0x40014d00
  54. #define MFB_SET_AOID 0x80084d04
  55. #define MFB_GET_AOID 0x40084d04
  56. #define MFB_SET_PIXFMT 0x80014d08
  57. #define MFB_GET_PIXFMT 0x40014d08
  58. #define FBIOGET_GWINFO 0x46E0
  59. #define FBIOPUT_GWINFO 0x46E1
  60. #ifdef __KERNEL__
  61. #include <linux/spinlock.h>
  62. /*
  63. * These are the fields of area descriptor(in DDR memory) for every plane
  64. */
  65. struct diu_ad {
  66. /* Word 0(32-bit) in DDR memory */
  67. /* __u16 comp; */
  68. /* __u16 pixel_s:2; */
  69. /* __u16 pallete:1; */
  70. /* __u16 red_c:2; */
  71. /* __u16 green_c:2; */
  72. /* __u16 blue_c:2; */
  73. /* __u16 alpha_c:3; */
  74. /* __u16 byte_f:1; */
  75. /* __u16 res0:3; */
  76. __be32 pix_fmt; /* hard coding pixel format */
  77. /* Word 1(32-bit) in DDR memory */
  78. __le32 addr;
  79. /* Word 2(32-bit) in DDR memory */
  80. /* __u32 delta_xs:11; */
  81. /* __u32 res1:1; */
  82. /* __u32 delta_ys:11; */
  83. /* __u32 res2:1; */
  84. /* __u32 g_alpha:8; */
  85. __le32 src_size_g_alpha;
  86. /* Word 3(32-bit) in DDR memory */
  87. /* __u32 delta_xi:11; */
  88. /* __u32 res3:5; */
  89. /* __u32 delta_yi:11; */
  90. /* __u32 res4:3; */
  91. /* __u32 flip:2; */
  92. __le32 aoi_size;
  93. /* Word 4(32-bit) in DDR memory */
  94. /*__u32 offset_xi:11;
  95. __u32 res5:5;
  96. __u32 offset_yi:11;
  97. __u32 res6:5;
  98. */
  99. __le32 offset_xyi;
  100. /* Word 5(32-bit) in DDR memory */
  101. /*__u32 offset_xd:11;
  102. __u32 res7:5;
  103. __u32 offset_yd:11;
  104. __u32 res8:5; */
  105. __le32 offset_xyd;
  106. /* Word 6(32-bit) in DDR memory */
  107. __u8 ckmax_r;
  108. __u8 ckmax_g;
  109. __u8 ckmax_b;
  110. __u8 res9;
  111. /* Word 7(32-bit) in DDR memory */
  112. __u8 ckmin_r;
  113. __u8 ckmin_g;
  114. __u8 ckmin_b;
  115. __u8 res10;
  116. /* __u32 res10:8; */
  117. /* Word 8(32-bit) in DDR memory */
  118. __le32 next_ad;
  119. /* Word 9(32-bit) in DDR memory, just for 64-bit aligned */
  120. __u32 paddr;
  121. } __attribute__ ((packed));
  122. /* DIU register map */
  123. struct diu {
  124. __be32 desc[3];
  125. __be32 gamma;
  126. __be32 pallete;
  127. __be32 cursor;
  128. __be32 curs_pos;
  129. __be32 diu_mode;
  130. __be32 bgnd;
  131. __be32 bgnd_wb;
  132. __be32 disp_size;
  133. __be32 wb_size;
  134. __be32 wb_mem_addr;
  135. __be32 hsyn_para;
  136. __be32 vsyn_para;
  137. __be32 syn_pol;
  138. __be32 thresholds;
  139. __be32 int_status;
  140. __be32 int_mask;
  141. __be32 colorbar[8];
  142. __be32 filling;
  143. __be32 plut;
  144. } __attribute__ ((packed));
  145. struct diu_hw {
  146. struct diu *diu_reg;
  147. spinlock_t reg_lock;
  148. __u32 mode; /* DIU operation mode */
  149. };
  150. struct diu_addr {
  151. __u8 __iomem *vaddr; /* Virtual address */
  152. dma_addr_t paddr; /* Physical address */
  153. __u32 offset;
  154. };
  155. struct diu_pool {
  156. struct diu_addr ad;
  157. struct diu_addr gamma;
  158. struct diu_addr pallete;
  159. struct diu_addr cursor;
  160. };
  161. #define FSL_DIU_BASE_OFFSET 0x2C000 /* Offset of DIU */
  162. #define INT_LCDC 64 /* DIU interrupt number */
  163. #define FSL_AOI_NUM 6 /* 5 AOIs and one dummy AOI */
  164. /* 1 for plane 0, 2 for plane 1&2 each */
  165. /* Minimum X and Y resolutions */
  166. #define MIN_XRES 64
  167. #define MIN_YRES 64
  168. /* HW cursor parameters */
  169. #define MAX_CURS 32
  170. /* Modes of operation of DIU */
  171. #define MFB_MODE0 0 /* DIU off */
  172. #define MFB_MODE1 1 /* All three planes output to display */
  173. #define MFB_MODE2 2 /* Plane 1 to display, planes 2+3 written back*/
  174. #define MFB_MODE3 3 /* All three planes written back to memory */
  175. #define MFB_MODE4 4 /* Color bar generation */
  176. /* INT_STATUS/INT_MASK field descriptions */
  177. #define INT_VSYNC 0x01 /* Vsync interrupt */
  178. #define INT_VSYNC_WB 0x02 /* Vsync interrupt for write back operation */
  179. #define INT_UNDRUN 0x04 /* Under run exception interrupt */
  180. #define INT_PARERR 0x08 /* Display parameters error interrupt */
  181. #define INT_LS_BF_VS 0x10 /* Lines before vsync. interrupt */
  182. /* Panels'operation modes */
  183. #define MFB_TYPE_OUTPUT 0 /* Panel output to display */
  184. #define MFB_TYPE_OFF 1 /* Panel off */
  185. #define MFB_TYPE_WB 2 /* Panel written back to memory */
  186. #define MFB_TYPE_TEST 3 /* Panel generate color bar */
  187. #endif /* __KERNEL__ */
  188. #endif /* __FSL_DIU_FB_H__ */