fsl-diu-fb.h 4.7 KB

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