auofb.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. #ifndef __AUOFB_H
  2. #define __AUOFB_H
  3. /*
  4. * linux/drivers/video/auofb.h
  5. *
  6. * $Id: s3cfb.h,v 1.13 2008/05/26 07:58:22 jsgood Exp $
  7. *
  8. * Copyright (c)2005 rahul tanwar <rahul.tanwar@samsung.com>
  9. *
  10. * This file is subject to the terms and conditions of the GNU General Public
  11. * License. See the file COPYING in the main directory of this archive for
  12. * more details.
  13. *
  14. * S3C LCD Controller Frame Buffer Driver
  15. * based on skeletonfb.c, sa1100fb.h
  16. *
  17. */
  18. #define BIT0 0x00000001
  19. #define BIT1 0x00000002
  20. #define BIT2 0x00000004
  21. #define BIT3 0x00000008
  22. #define BIT4 0x00000010
  23. #define BIT5 0x00000020
  24. #define BIT6 0x00000040
  25. #define BIT7 0x00000080
  26. #define BIT8 0x00000100
  27. #define BIT9 0x00000200
  28. #define BIT10 0x00000400
  29. #define BIT11 0x00000800
  30. #define BIT12 0x00001000
  31. #define BIT13 0x00002000
  32. #define BIT14 0x00004000
  33. #define BIT15 0x00008000
  34. #define BIT16 0x00010000
  35. #define BIT17 0x00020000
  36. #define BIT18 0x00040000
  37. #define BIT19 0x00080000
  38. #define BIT20 0x00100000
  39. #define BIT21 0x00200000
  40. #define BIT22 0x00400000
  41. #define BIT23 0x00800000
  42. #define BIT24 0x01000000
  43. #define BIT25 0x02000000
  44. #define BIT26 0x04000000
  45. #define BIT27 0x08000000
  46. #define BIT28 0x10000000
  47. #define BIT29 0x20000000
  48. #define BIT30 0x40000000
  49. #define BIT31 0x80000000
  50. #define MIN_XRES 64
  51. #define MIN_YRES 64
  52. #define AUOFB_IOCTL_TCON_GET_BUSY_STATUS 0xFF00
  53. #define AUOFB_IOCTL_SW_REFRESH 0xFF01
  54. #define AUOFB_IOCTL_TCON_PARTIAL_UPDATE 0xFF02
  55. #define AUOFB_IOCTL_TCON_SHUTDOWN 0xFF03
  56. #define AUOFB_IOCTL_TCON_STANDBY 0xFF04
  57. #define AUOFB_IOCTL_TCON_WAKEUP 0xFF05
  58. #define AUOFB_IOCTL_TCON_SLEEP 0xFF06
  59. #define AUOFB_IOCTL_TCON_NO_SLEEP 0xFF07
  60. #define AUOFB_IOCTL_TCON_REFRESH 0xFF08
  61. #define AUOFB_IOCTL_SET_UPDATE_THRESHOLD 0xFF09
  62. #define AUOFB_IOCTL_TCON_RESET 0xFF0A
  63. #define AUOFB_IOCTL_TCON_INIT 0xFF0B
  64. #define AUOFB_IOCTL_TCON_UPDATE_LUT 0xFF0C
  65. #define AUOFB_IOCTL_TCON_READ_LUT 0xFF0D
  66. #define AUOFB_IOCTL_TCON_POWER_STATE 0xFF70
  67. #define AUOFB_IOCTL_TCON_GET_TEMPERATURE 0xFFA0
  68. #define AUOFB_IOCTL_TCON_GET_EPD_TYPE 0xFFA1
  69. #define AUOFB_IOCTL_TCON_GET_PANEL_TYPE 0xFFA2
  70. #define AUOFB_IOCTL_TCON_GET_LUT_INFO 0xFFA3
  71. #define AUOFB_IOCTL_SHOW_PROGRESS_BAR 0xFFE0
  72. #define AUOFB_IOCTL_CLEAN_EPD 0xFFE1
  73. /* Qisda, Howard Hsu, 2010/01/11, Add show image ioctrl { */
  74. #define AUOFB_IOCTL_SHOW_IMAGE 0xFFE2
  75. /* } Qisda, Howard Hsu, 2010/01/11, Add show image ioctrl */
  76. #define EPD_DEVICE_POWER_STATE AUOFB_IOCTL_TCON_POWER_STATE
  77. enum {
  78. EN_EPD_DEVICE_POWER_STATE_D0 = 0, //normal
  79. EN_EPD_DEVICE_POWER_STATE_D1, //stand by
  80. EN_EPD_DEVICE_POWER_STATE_D2, //sleep
  81. EN_EPD_DEVICE_POWER_STATE_D3, //shutdown
  82. };
  83. struct auo_fb_rgb {
  84. struct fb_bitfield red;
  85. struct fb_bitfield green;
  86. struct fb_bitfield blue;
  87. struct fb_bitfield transp;
  88. };
  89. //???
  90. const static struct auo_fb_rgb auo_fb_rgb_4 = {
  91. .red = {.offset = 8, .length = 4,},
  92. .green = {.offset = 4, .length = 4,},
  93. .blue = {.offset = 0, .length = 4,},
  94. .transp = {.offset = 0, .length = 0,},
  95. };
  96. const static struct auo_fb_rgb auo_fb_rgb_8 = {
  97. .red = {.offset = 0, .length = 8,},
  98. .green = {.offset = 0, .length = 8,},
  99. .blue = {.offset = 0, .length = 8,},
  100. .transp = {.offset = 0, .length = 0,},
  101. };
  102. const static struct auo_fb_rgb auo_fb_rgb_16 = {
  103. .red = {.offset = 11, .length = 5,},
  104. .green = {.offset = 5, .length = 6,},
  105. .blue = {.offset = 0, .length = 5,},
  106. .transp = {.offset = 0, .length = 0,},
  107. };
  108. const static struct auo_fb_rgb auo_fb_rgb_24 = {
  109. .red = {.offset = 16, .length = 8,},
  110. .green = {.offset = 8, .length = 8,},
  111. .blue = {.offset = 0, .length = 8,},
  112. .transp = {.offset = 0, .length = 0,},
  113. };
  114. const static struct auo_fb_rgb auo_fb_rgb_32 = {
  115. .red={.offset=16, .length=8,},
  116. .green={.offset=8, .length=8,},
  117. .blue={.offset=0, .length=8,},
  118. .transp={.offset= 24, .length=8,},
  119. };
  120. struct auo_fb_info {
  121. struct fb_info fb;
  122. struct device *dev;
  123. // YREOM 2007 add for supporting many OSD
  124. u_int win_id;
  125. u_int max_bpp;
  126. u_int max_xres;
  127. u_int max_yres;
  128. /* raw memory addresses */
  129. dma_addr_t map_dma_f1; /* physical */
  130. u_char * map_cpu_f1; /* virtual */
  131. u_int map_size_f1;
  132. /* addresses of pieces placed in raw buffer */
  133. u_char * screen_cpu_f1; /* virtual address of frame buffer */
  134. dma_addr_t screen_dma_f1; /* physical address of frame buffer */
  135. /* raw memory addresses */
  136. dma_addr_t map_dma_f2; /* physical */
  137. u_char * map_cpu_f2; /* virtual */
  138. u_int map_size_f2;
  139. /* addresses of pieces placed in raw buffer */
  140. u_char * screen_cpu_f2; /* virtual address of frame buffer */
  141. dma_addr_t screen_dma_f2; /* physical address of frame buffer */
  142. unsigned int palette_ready;
  143. unsigned int fb_change_ready;
  144. /* keep these registers in case we need to re-write palette */
  145. u32 palette_buffer[256];
  146. u32 pseudo_pal[16];
  147. };
  148. #define PALETTE_BUFF_CLEAR (0x80000000) /* entry is clear/invalid */
  149. int auofb_init(void);
  150. #if 0
  151. #define dprintk(msg...) printk("auo_fb: " msg)
  152. #else
  153. #define dprintk(msg...) while (0) { }
  154. #endif
  155. struct auo_fb_mach_info {
  156. /* Screen size */
  157. int width;
  158. int height;
  159. /* Screen info */
  160. int xres;
  161. int yres;
  162. /* Virtual Screen info */
  163. int xres_virtual;
  164. int yres_virtual;
  165. int xoffset;
  166. int yoffset;
  167. /* OSD Screen size */
  168. int osd_width;
  169. int osd_height;
  170. /* OSD Screen info */
  171. int osd_xres;
  172. int osd_yres;
  173. /* OSD Screen info */
  174. int osd_xres_virtual;
  175. int osd_yres_virtual;
  176. int bpp;
  177. int bytes_per_pixel;
  178. unsigned long pixclock;
  179. int hsync_len;
  180. int left_margin;
  181. int right_margin;
  182. int vsync_len;
  183. int upper_margin;
  184. int lower_margin;
  185. int sync;
  186. int cmap_grayscale:1, cmap_inverse:1, cmap_static:1, unused:29;
  187. /* lcd configuration registers */
  188. unsigned long lcdcon1;
  189. unsigned long lcdcon2;
  190. unsigned long lcdcon3;
  191. unsigned long lcdcon4;
  192. unsigned long lcdcon5;
  193. /* GPIOs */
  194. unsigned long gpcup;
  195. unsigned long gpcup_mask;
  196. unsigned long gpccon;
  197. unsigned long gpccon_mask;
  198. unsigned long gpdup;
  199. unsigned long gpdup_mask;
  200. unsigned long gpdcon;
  201. unsigned long gpdcon_mask;
  202. /* lpc3600 control register */
  203. unsigned long lpcsel;
  204. unsigned long lcdtcon1;
  205. unsigned long lcdtcon2;
  206. unsigned long lcdtcon3;
  207. unsigned long lcdosd1;
  208. unsigned long lcdosd2;
  209. unsigned long lcdosd3;
  210. unsigned long lcdsaddrb1;
  211. unsigned long lcdsaddrb2;
  212. unsigned long lcdsaddrf1;
  213. unsigned long lcdsaddrf2;
  214. unsigned long lcdeaddrb1;
  215. unsigned long lcdeaddrb2;
  216. unsigned long lcdeaddrf1;
  217. unsigned long lcdeaddrf2;
  218. unsigned long lcdvscrb1;
  219. unsigned long lcdvscrb2;
  220. unsigned long lcdvscrf1;
  221. unsigned long lcdvscrf2;
  222. unsigned long lcdintcon;
  223. unsigned long lcdkeycon;
  224. unsigned long lcdkeyval;
  225. unsigned long lcdbgcon;
  226. unsigned long lcdfgcon;
  227. unsigned long lcddithcon;
  228. /* For s3c2443, s3c6400 */
  229. unsigned long vidcon0;
  230. unsigned long vidcon1;
  231. unsigned long vidtcon0;
  232. unsigned long vidtcon1;
  233. unsigned long vidtcon2;
  234. unsigned long vidtcon3;
  235. unsigned long wincon0;
  236. unsigned long wincon2;
  237. unsigned long wincon1;
  238. unsigned long wincon3;
  239. unsigned long wincon4;
  240. unsigned long vidosd0a;
  241. unsigned long vidosd0b;
  242. unsigned long vidosd0c;
  243. unsigned long vidosd1a;
  244. unsigned long vidosd1b;
  245. unsigned long vidosd1c;
  246. unsigned long vidosd1d;
  247. unsigned long vidosd2a;
  248. unsigned long vidosd2b;
  249. unsigned long vidosd2c;
  250. unsigned long vidosd2d;
  251. unsigned long vidosd3a;
  252. unsigned long vidosd3b;
  253. unsigned long vidosd3c;
  254. unsigned long vidosd4a;
  255. unsigned long vidosd4b;
  256. unsigned long vidosd4c;
  257. unsigned long vidw00add0b0;
  258. unsigned long vidw00add0b1;
  259. unsigned long vidw01add0;
  260. unsigned long vidw01add0b0;
  261. unsigned long vidw01add0b1;
  262. unsigned long vidw00add1b0;
  263. unsigned long vidw00add1b1;
  264. unsigned long vidw01add1;
  265. unsigned long vidw01add1b0;
  266. unsigned long vidw01add1b1;
  267. unsigned long vidw00add2b0;
  268. unsigned long vidw00add2b1;
  269. unsigned long vidw02add0;
  270. unsigned long vidw03add0;
  271. unsigned long vidw04add0;
  272. unsigned long vidw02add1;
  273. unsigned long vidw03add1;
  274. unsigned long vidw04add1;
  275. unsigned long vidw00add2;
  276. unsigned long vidw01add2;
  277. unsigned long vidw02add2;
  278. unsigned long vidw03add2;
  279. unsigned long vidw04add2;
  280. unsigned long vidintcon;
  281. unsigned long vidintcon0;
  282. unsigned long vidintcon1;
  283. unsigned long w1keycon0;
  284. unsigned long w1keycon1;
  285. unsigned long w2keycon0;
  286. unsigned long w2keycon1;
  287. unsigned long w3keycon0;
  288. unsigned long w3keycon1;
  289. unsigned long w4keycon0;
  290. unsigned long w4keycon1;
  291. unsigned long win0map;
  292. unsigned long win1map;
  293. unsigned long win2map;
  294. unsigned long win3map;
  295. unsigned long win4map;
  296. unsigned long wpalcon;
  297. unsigned long dithmode;
  298. unsigned long intclr0;
  299. unsigned long intclr1;
  300. unsigned long intclr2;
  301. unsigned long win0pal;
  302. unsigned long win1pal;
  303. /* backlight info */
  304. int backlight_min;
  305. int backlight_max;
  306. int backlight_default;
  307. /* Utility fonctions */
  308. void (*backlight_power)(int);
  309. void (*lcd_power)(int);
  310. void (*set_brightness)(int);
  311. };
  312. typedef struct {
  313. int Bpp;
  314. int LeftTop_x;
  315. int LeftTop_y;
  316. int Width;
  317. int Height;
  318. } auo_win_info_t;
  319. typedef struct {
  320. int width;
  321. int height;
  322. int bpp;
  323. int offset;
  324. int v_width;
  325. int v_height;
  326. } vs_info_t;
  327. typedef struct {
  328. int direction;
  329. unsigned int compkey_red;
  330. unsigned int compkey_green;
  331. unsigned int compkey_blue;
  332. } auo_color_key_info_t;
  333. typedef struct {
  334. unsigned int colval_red;
  335. unsigned int colval_green;
  336. unsigned int colval_blue;
  337. } auo_color_val_info_t;
  338. #ifndef MHZ
  339. #define MHZ (1000*1000)
  340. #endif
  341. #define print_mhz(m) ((m) / MHZ), ((m / 1000) % 1000)
  342. extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
  343. extern struct auo_fb_mach_info auo_mach_info;
  344. extern void set_brightness(int);
  345. extern int auo_fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg);
  346. extern void auofb_activate_var(struct auo_fb_info *fbi, struct fb_var_screeninfo *var);
  347. #endif