fsl-diu-fb.h 4.9 KB

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