fsl-diu-fb.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
  4. *
  5. * Freescale DIU Frame Buffer device driver
  6. *
  7. * Authors: Hongjun Chen <hong-jun.chen@freescale.com>
  8. * Paul Widmer <paul.widmer@freescale.com>
  9. * Srikanth Srinivasan <srikanth.srinivasan@freescale.com>
  10. * York Sun <yorksun@freescale.com>
  11. *
  12. * Based on imxfb.c Copyright (C) 2004 S.Hauer, Pengutronix
  13. */
  14. #ifndef __FSL_DIU_FB_H__
  15. #define __FSL_DIU_FB_H__
  16. #include <linux/types.h>
  17. struct mfb_chroma_key {
  18. int enable;
  19. __u8 red_max;
  20. __u8 green_max;
  21. __u8 blue_max;
  22. __u8 red_min;
  23. __u8 green_min;
  24. __u8 blue_min;
  25. };
  26. struct aoi_display_offset {
  27. __s32 x_aoi_d;
  28. __s32 y_aoi_d;
  29. };
  30. #define MFB_SET_CHROMA_KEY _IOW('M', 1, struct mfb_chroma_key)
  31. #define MFB_SET_BRIGHTNESS _IOW('M', 3, __u8)
  32. #define MFB_SET_ALPHA _IOW('M', 0, __u8)
  33. #define MFB_GET_ALPHA _IOR('M', 0, __u8)
  34. #define MFB_SET_AOID _IOW('M', 4, struct aoi_display_offset)
  35. #define MFB_GET_AOID _IOR('M', 4, struct aoi_display_offset)
  36. #define MFB_SET_PIXFMT _IOW('M', 8, __u32)
  37. #define MFB_GET_PIXFMT _IOR('M', 8, __u32)
  38. /*
  39. * The MPC5121 BSP comes with a gamma_set utility that initializes the
  40. * gamma table. Unfortunately, it uses bad values for the IOCTL commands,
  41. * but there's nothing we can do about it now. These ioctls are only
  42. * supported on the MPC5121.
  43. */
  44. #define MFB_SET_GAMMA _IOW('M', 1, __u8)
  45. #define MFB_GET_GAMMA _IOR('M', 1, __u8)
  46. /*
  47. * The original definitions of MFB_SET_PIXFMT and MFB_GET_PIXFMT used the
  48. * wrong value for 'size' field of the ioctl. The current macros above use the
  49. * right size, but we still need to provide backwards compatibility, at least
  50. * for a while.
  51. */
  52. #define MFB_SET_PIXFMT_OLD 0x80014d08
  53. #define MFB_GET_PIXFMT_OLD 0x40014d08
  54. #ifdef __KERNEL__
  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 palette: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 palette;
  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. /*
  139. * Modes of operation of DIU. The DIU supports five different modes, but
  140. * the driver only supports modes 0 and 1.
  141. */
  142. #define MFB_MODE0 0 /* DIU off */
  143. #define MFB_MODE1 1 /* All three planes output to display */
  144. #endif /* __KERNEL__ */
  145. #endif /* __FSL_DIU_FB_H__ */