omapfb.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /*
  2. * File: include/linux/omapfb.h
  3. *
  4. * Framebuffer driver for TI OMAP boards
  5. *
  6. * Copyright (C) 2004 Nokia Corporation
  7. * Author: Imre Deak <imre.deak@nokia.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write to the Free Software Foundation, Inc.,
  21. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. */
  23. #ifndef __LINUX_OMAPFB_H__
  24. #define __LINUX_OMAPFB_H__
  25. #include <linux/fb.h>
  26. #include <linux/ioctl.h>
  27. #include <linux/types.h>
  28. /* IOCTL commands. */
  29. #define OMAP_IOW(num, dtype) _IOW('O', num, dtype)
  30. #define OMAP_IOR(num, dtype) _IOR('O', num, dtype)
  31. #define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype)
  32. #define OMAP_IO(num) _IO('O', num)
  33. #define OMAPFB_MIRROR OMAP_IOW(31, int)
  34. #define OMAPFB_SYNC_GFX OMAP_IO(37)
  35. #define OMAPFB_VSYNC OMAP_IO(38)
  36. #define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int)
  37. #define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps)
  38. #define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int)
  39. #define OMAPFB_LCD_TEST OMAP_IOW(45, int)
  40. #define OMAPFB_CTRL_TEST OMAP_IOW(46, int)
  41. #define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
  42. #define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key)
  43. #define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key)
  44. #define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info)
  45. #define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info)
  46. #define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window)
  47. #define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info)
  48. #define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info)
  49. #define OMAPFB_WAITFORVSYNC OMAP_IO(57)
  50. #define OMAPFB_MEMORY_READ OMAP_IOR(58, struct omapfb_memory_read)
  51. #define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode)
  52. #define OMAPFB_WAITFORGO OMAP_IO(60)
  53. #define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info)
  54. #define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info)
  55. #define OMAPFB_GET_DISPLAY_INFO OMAP_IOR(63, struct omapfb_display_info)
  56. #define OMAPFB_CAPS_GENERIC_MASK 0x00000fff
  57. #define OMAPFB_CAPS_LCDC_MASK 0x00fff000
  58. #define OMAPFB_CAPS_PANEL_MASK 0xff000000
  59. #define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000
  60. #define OMAPFB_CAPS_TEARSYNC 0x00002000
  61. #define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000
  62. #define OMAPFB_CAPS_PLANE_SCALE 0x00008000
  63. #define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000
  64. #define OMAPFB_CAPS_WINDOW_SCALE 0x00020000
  65. #define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000
  66. #define OMAPFB_CAPS_WINDOW_ROTATE 0x00080000
  67. #define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000
  68. /* Values from DSP must map to lower 16-bits */
  69. #define OMAPFB_FORMAT_MASK 0x00ff
  70. #define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100
  71. #define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200
  72. #define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400
  73. #define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800
  74. #define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000
  75. #define OMAPFB_MEMTYPE_SDRAM 0
  76. #define OMAPFB_MEMTYPE_SRAM 1
  77. #define OMAPFB_MEMTYPE_MAX 1
  78. enum omapfb_color_format {
  79. OMAPFB_COLOR_RGB565 = 0,
  80. OMAPFB_COLOR_YUV422,
  81. OMAPFB_COLOR_YUV420,
  82. OMAPFB_COLOR_CLUT_8BPP,
  83. OMAPFB_COLOR_CLUT_4BPP,
  84. OMAPFB_COLOR_CLUT_2BPP,
  85. OMAPFB_COLOR_CLUT_1BPP,
  86. OMAPFB_COLOR_RGB444,
  87. OMAPFB_COLOR_YUY422,
  88. OMAPFB_COLOR_ARGB16,
  89. OMAPFB_COLOR_RGB24U, /* RGB24, 32-bit container */
  90. OMAPFB_COLOR_RGB24P, /* RGB24, 24-bit container */
  91. OMAPFB_COLOR_ARGB32,
  92. OMAPFB_COLOR_RGBA32,
  93. OMAPFB_COLOR_RGBX32,
  94. };
  95. struct omapfb_update_window {
  96. __u32 x, y;
  97. __u32 width, height;
  98. __u32 format;
  99. __u32 out_x, out_y;
  100. __u32 out_width, out_height;
  101. __u32 reserved[8];
  102. };
  103. struct omapfb_update_window_old {
  104. __u32 x, y;
  105. __u32 width, height;
  106. __u32 format;
  107. };
  108. enum omapfb_plane {
  109. OMAPFB_PLANE_GFX = 0,
  110. OMAPFB_PLANE_VID1,
  111. OMAPFB_PLANE_VID2,
  112. };
  113. enum omapfb_channel_out {
  114. OMAPFB_CHANNEL_OUT_LCD = 0,
  115. OMAPFB_CHANNEL_OUT_DIGIT,
  116. };
  117. struct omapfb_plane_info {
  118. __u32 pos_x;
  119. __u32 pos_y;
  120. __u8 enabled;
  121. __u8 channel_out;
  122. __u8 mirror;
  123. __u8 reserved1;
  124. __u32 out_width;
  125. __u32 out_height;
  126. __u32 reserved2[12];
  127. };
  128. struct omapfb_mem_info {
  129. __u32 size;
  130. __u8 type;
  131. __u8 reserved[3];
  132. };
  133. struct omapfb_caps {
  134. __u32 ctrl;
  135. __u32 plane_color;
  136. __u32 wnd_color;
  137. };
  138. enum omapfb_color_key_type {
  139. OMAPFB_COLOR_KEY_DISABLED = 0,
  140. OMAPFB_COLOR_KEY_GFX_DST,
  141. OMAPFB_COLOR_KEY_VID_SRC,
  142. };
  143. struct omapfb_color_key {
  144. __u8 channel_out;
  145. __u32 background;
  146. __u32 trans_key;
  147. __u8 key_type;
  148. };
  149. enum omapfb_update_mode {
  150. OMAPFB_UPDATE_DISABLED = 0,
  151. OMAPFB_AUTO_UPDATE,
  152. OMAPFB_MANUAL_UPDATE
  153. };
  154. struct omapfb_memory_read {
  155. __u16 x;
  156. __u16 y;
  157. __u16 w;
  158. __u16 h;
  159. size_t buffer_size;
  160. void __user *buffer;
  161. };
  162. struct omapfb_ovl_colormode {
  163. __u8 overlay_idx;
  164. __u8 mode_idx;
  165. __u32 bits_per_pixel;
  166. __u32 nonstd;
  167. struct fb_bitfield red;
  168. struct fb_bitfield green;
  169. struct fb_bitfield blue;
  170. struct fb_bitfield transp;
  171. };
  172. struct omapfb_vram_info {
  173. __u32 total;
  174. __u32 free;
  175. __u32 largest_free_block;
  176. __u32 reserved[5];
  177. };
  178. struct omapfb_tearsync_info {
  179. __u8 enabled;
  180. __u8 reserved1[3];
  181. __u16 line;
  182. __u16 reserved2;
  183. };
  184. struct omapfb_display_info {
  185. __u16 xres;
  186. __u16 yres;
  187. __u32 width; /* phys width of the display in micrometers */
  188. __u32 height; /* phys height of the display in micrometers */
  189. __u32 reserved[5];
  190. };
  191. #ifdef __KERNEL__
  192. #include <plat/board.h>
  193. #ifdef CONFIG_ARCH_OMAP1
  194. #define OMAPFB_PLANE_NUM 1
  195. #else
  196. #define OMAPFB_PLANE_NUM 3
  197. #endif
  198. struct omapfb_mem_region {
  199. u32 paddr;
  200. void __iomem *vaddr;
  201. unsigned long size;
  202. u8 type; /* OMAPFB_PLANE_MEM_* */
  203. enum omapfb_color_format format;/* OMAPFB_COLOR_* */
  204. unsigned format_used:1; /* Must be set when format is set.
  205. * Needed b/c of the badly chosen 0
  206. * base for OMAPFB_COLOR_* values
  207. */
  208. unsigned alloc:1; /* allocated by the driver */
  209. unsigned map:1; /* kernel mapped by the driver */
  210. };
  211. struct omapfb_mem_desc {
  212. int region_cnt;
  213. struct omapfb_mem_region region[OMAPFB_PLANE_NUM];
  214. };
  215. struct omapfb_platform_data {
  216. struct omap_lcd_config lcd;
  217. struct omapfb_mem_desc mem_desc;
  218. void *ctrl_platform_data;
  219. };
  220. /* in arch/arm/plat-omap/fb.c */
  221. extern void omapfb_set_platform_data(struct omapfb_platform_data *data);
  222. extern void omapfb_set_ctrl_platform_data(void *pdata);
  223. extern void omapfb_reserve_sdram(void);
  224. #endif
  225. #endif /* __OMAPFB_H */