fsl-diu-fb.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. #include <linux/types.h>
  26. struct mfb_alpha {
  27. int enable;
  28. int alpha;
  29. };
  30. struct mfb_chroma_key {
  31. int enable;
  32. __u8 red_max;
  33. __u8 green_max;
  34. __u8 blue_max;
  35. __u8 red_min;
  36. __u8 green_min;
  37. __u8 blue_min;
  38. };
  39. struct aoi_display_offset {
  40. int x_aoi_d;
  41. int y_aoi_d;
  42. };
  43. #define MFB_SET_CHROMA_KEY _IOW('M', 1, struct mfb_chroma_key)
  44. #define MFB_SET_BRIGHTNESS _IOW('M', 3, __u8)
  45. #define MFB_SET_ALPHA 0x80014d00
  46. #define MFB_GET_ALPHA 0x40014d00
  47. #define MFB_SET_AOID 0x80084d04
  48. #define MFB_GET_AOID 0x40084d04
  49. #define MFB_SET_PIXFMT 0x80014d08
  50. #define MFB_GET_PIXFMT 0x40014d08
  51. #define FBIOGET_GWINFO 0x46E0
  52. #define FBIOPUT_GWINFO 0x46E1
  53. #ifdef __KERNEL__
  54. #include <linux/spinlock.h>
  55. /*
  56. * These are the fields of area descriptor(in DDR memory) for every plane
  57. */
  58. struct diu_ad {
  59. /* Word 0(32-bit) in DDR memory */
  60. /* __u16 comp; */
  61. /* __u16 pixel_s:2; */
  62. /* __u16 pallete:1; */
  63. /* __u16 red_c:2; */
  64. /* __u16 green_c:2; */
  65. /* __u16 blue_c:2; */
  66. /* __u16 alpha_c:3; */
  67. /* __u16 byte_f:1; */
  68. /* __u16 res0:3; */
  69. __be32 pix_fmt; /* hard coding pixel format */
  70. /* Word 1(32-bit) in DDR memory */
  71. __le32 addr;
  72. /* Word 2(32-bit) in DDR memory */
  73. /* __u32 delta_xs:11; */
  74. /* __u32 res1:1; */
  75. /* __u32 delta_ys:11; */
  76. /* __u32 res2:1; */
  77. /* __u32 g_alpha:8; */
  78. __le32 src_size_g_alpha;
  79. /* Word 3(32-bit) in DDR memory */
  80. /* __u32 delta_xi:11; */
  81. /* __u32 res3:5; */
  82. /* __u32 delta_yi:11; */
  83. /* __u32 res4:3; */
  84. /* __u32 flip:2; */
  85. __le32 aoi_size;
  86. /* Word 4(32-bit) in DDR memory */
  87. /*__u32 offset_xi:11;
  88. __u32 res5:5;
  89. __u32 offset_yi:11;
  90. __u32 res6:5;
  91. */
  92. __le32 offset_xyi;
  93. /* Word 5(32-bit) in DDR memory */
  94. /*__u32 offset_xd:11;
  95. __u32 res7:5;
  96. __u32 offset_yd:11;
  97. __u32 res8:5; */
  98. __le32 offset_xyd;
  99. /* Word 6(32-bit) in DDR memory */
  100. __u8 ckmax_r;
  101. __u8 ckmax_g;
  102. __u8 ckmax_b;
  103. __u8 res9;
  104. /* Word 7(32-bit) in DDR memory */
  105. __u8 ckmin_r;
  106. __u8 ckmin_g;
  107. __u8 ckmin_b;
  108. __u8 res10;
  109. /* __u32 res10:8; */
  110. /* Word 8(32-bit) in DDR memory */
  111. __le32 next_ad;
  112. /* Word 9(32-bit) in DDR memory, just for 64-bit aligned */
  113. __u32 paddr;
  114. } __attribute__ ((packed));
  115. /* DIU register map */
  116. struct diu {
  117. __be32 desc[3];
  118. __be32 gamma;
  119. __be32 pallete;
  120. __be32 cursor;
  121. __be32 curs_pos;
  122. __be32 diu_mode;
  123. __be32 bgnd;
  124. __be32 bgnd_wb;
  125. __be32 disp_size;
  126. __be32 wb_size;
  127. __be32 wb_mem_addr;
  128. __be32 hsyn_para;
  129. __be32 vsyn_para;
  130. __be32 syn_pol;
  131. __be32 thresholds;
  132. __be32 int_status;
  133. __be32 int_mask;
  134. __be32 colorbar[8];
  135. __be32 filling;
  136. __be32 plut;
  137. } __attribute__ ((packed));
  138. struct diu_hw {
  139. struct diu *diu_reg;
  140. spinlock_t reg_lock;
  141. __u32 mode; /* DIU operation mode */
  142. };
  143. struct diu_addr {
  144. __u8 __iomem *vaddr; /* Virtual address */
  145. dma_addr_t paddr; /* Physical address */
  146. __u32 offset;
  147. };
  148. struct diu_pool {
  149. struct diu_addr ad;
  150. struct diu_addr gamma;
  151. struct diu_addr pallete;
  152. struct diu_addr cursor;
  153. };
  154. #define FSL_DIU_BASE_OFFSET 0x2C000 /* Offset of DIU */
  155. #define INT_LCDC 64 /* DIU interrupt number */
  156. #define FSL_AOI_NUM 6 /* 5 AOIs and one dummy AOI */
  157. /* 1 for plane 0, 2 for plane 1&2 each */
  158. /* Minimum X and Y resolutions */
  159. #define MIN_XRES 64
  160. #define MIN_YRES 64
  161. /* HW cursor parameters */
  162. #define MAX_CURS 32
  163. /* Modes of operation of DIU */
  164. #define MFB_MODE0 0 /* DIU off */
  165. #define MFB_MODE1 1 /* All three planes output to display */
  166. #define MFB_MODE2 2 /* Plane 1 to display, planes 2+3 written back*/
  167. #define MFB_MODE3 3 /* All three planes written back to memory */
  168. #define MFB_MODE4 4 /* Color bar generation */
  169. /* INT_STATUS/INT_MASK field descriptions */
  170. #define INT_VSYNC 0x01 /* Vsync interrupt */
  171. #define INT_VSYNC_WB 0x02 /* Vsync interrupt for write back operation */
  172. #define INT_UNDRUN 0x04 /* Under run exception interrupt */
  173. #define INT_PARERR 0x08 /* Display parameters error interrupt */
  174. #define INT_LS_BF_VS 0x10 /* Lines before vsync. interrupt */
  175. /* Panels'operation modes */
  176. #define MFB_TYPE_OUTPUT 0 /* Panel output to display */
  177. #define MFB_TYPE_OFF 1 /* Panel off */
  178. #define MFB_TYPE_WB 2 /* Panel written back to memory */
  179. #define MFB_TYPE_TEST 3 /* Panel generate color bar */
  180. #endif /* __KERNEL__ */
  181. #endif /* __FSL_DIU_FB_H__ */