pxafb.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. #ifndef __PXAFB_H__
  2. #define __PXAFB_H__
  3. /*
  4. * linux/drivers/video/pxafb.h
  5. * -- Intel PXA250/210 LCD Controller Frame Buffer Device
  6. *
  7. * Copyright (C) 1999 Eric A. Thomas.
  8. * Copyright (C) 2004 Jean-Frederic Clere.
  9. * Copyright (C) 2004 Ian Campbell.
  10. * Copyright (C) 2004 Jeff Lackey.
  11. * Based on sa1100fb.c Copyright (C) 1999 Eric A. Thomas
  12. * which in turn is
  13. * Based on acornfb.c Copyright (C) Russell King.
  14. *
  15. * 2001-08-03: Cliff Brake <cbrake@acclent.com>
  16. * - ported SA1100 code to PXA
  17. *
  18. * This file is subject to the terms and conditions of the GNU General Public
  19. * License. See the file COPYING in the main directory of this archive
  20. * for more details.
  21. */
  22. /* PXA LCD DMA descriptor */
  23. struct pxafb_dma_descriptor {
  24. unsigned int fdadr;
  25. unsigned int fsadr;
  26. unsigned int fidr;
  27. unsigned int ldcmd;
  28. };
  29. enum {
  30. PAL_NONE = -1,
  31. PAL_BASE = 0,
  32. PAL_OV1 = 1,
  33. PAL_OV2 = 2,
  34. PAL_MAX,
  35. };
  36. enum {
  37. DMA_BASE = 0,
  38. DMA_UPPER = 0,
  39. DMA_LOWER = 1,
  40. DMA_OV1 = 1,
  41. DMA_OV2_Y = 2,
  42. DMA_OV2_Cb = 3,
  43. DMA_OV2_Cr = 4,
  44. DMA_CURSOR = 5,
  45. DMA_CMD = 6,
  46. DMA_MAX,
  47. };
  48. /* maximum palette size - 256 entries, each 4 bytes long */
  49. #define PALETTE_SIZE (256 * 4)
  50. #define CMD_BUFF_SIZE (1024 * 50)
  51. /* NOTE: the palette and frame dma descriptors are doubled to allow
  52. * the 2nd set for branch settings (FBRx)
  53. */
  54. struct pxafb_dma_buff {
  55. unsigned char palette[PAL_MAX * PALETTE_SIZE];
  56. uint16_t cmd_buff[CMD_BUFF_SIZE];
  57. struct pxafb_dma_descriptor pal_desc[PAL_MAX * 2];
  58. struct pxafb_dma_descriptor dma_desc[DMA_MAX * 2];
  59. };
  60. enum {
  61. OVERLAY1,
  62. OVERLAY2,
  63. };
  64. enum {
  65. OVERLAY_FORMAT_RGB = 0,
  66. OVERLAY_FORMAT_YUV444_PACKED,
  67. OVERLAY_FORMAT_YUV444_PLANAR,
  68. OVERLAY_FORMAT_YUV422_PLANAR,
  69. OVERLAY_FORMAT_YUV420_PLANAR,
  70. };
  71. #define NONSTD_TO_XPOS(x) (((x) >> 0) & 0x3ff)
  72. #define NONSTD_TO_YPOS(x) (((x) >> 10) & 0x3ff)
  73. #define NONSTD_TO_PFOR(x) (((x) >> 20) & 0x7)
  74. struct pxafb_layer;
  75. struct pxafb_layer_ops {
  76. void (*enable)(struct pxafb_layer *);
  77. void (*disable)(struct pxafb_layer *);
  78. void (*setup)(struct pxafb_layer *);
  79. };
  80. struct pxafb_layer {
  81. struct fb_info fb;
  82. int id;
  83. int registered;
  84. uint32_t usage;
  85. uint32_t control[2];
  86. struct pxafb_layer_ops *ops;
  87. void __iomem *video_mem;
  88. unsigned long video_mem_phys;
  89. size_t video_mem_size;
  90. struct completion branch_done;
  91. struct pxafb_info *fbi;
  92. };
  93. struct pxafb_info {
  94. struct fb_info fb;
  95. struct device *dev;
  96. struct clk *clk;
  97. void __iomem *mmio_base;
  98. struct pxafb_dma_buff *dma_buff;
  99. size_t dma_buff_size;
  100. dma_addr_t dma_buff_phys;
  101. dma_addr_t fdadr[DMA_MAX * 2];
  102. void __iomem *video_mem; /* virtual address of frame buffer */
  103. unsigned long video_mem_phys; /* physical address of frame buffer */
  104. size_t video_mem_size; /* size of the frame buffer */
  105. u16 * palette_cpu; /* virtual address of palette memory */
  106. u_int palette_size;
  107. u_int lccr0;
  108. u_int lccr3;
  109. u_int lccr4;
  110. u_int cmap_inverse:1,
  111. cmap_static:1,
  112. unused:30;
  113. u_int reg_lccr0;
  114. u_int reg_lccr1;
  115. u_int reg_lccr2;
  116. u_int reg_lccr3;
  117. u_int reg_lccr4;
  118. u_int reg_cmdcr;
  119. unsigned long hsync_time;
  120. volatile u_char state;
  121. volatile u_char task_state;
  122. struct mutex ctrlr_lock;
  123. wait_queue_head_t ctrlr_wait;
  124. struct work_struct task;
  125. struct completion disable_done;
  126. #ifdef CONFIG_FB_PXA_SMARTPANEL
  127. uint16_t *smart_cmds;
  128. size_t n_smart_cmds;
  129. struct completion command_done;
  130. struct completion refresh_done;
  131. struct task_struct *smart_thread;
  132. #endif
  133. #ifdef CONFIG_FB_PXA_OVERLAY
  134. struct pxafb_layer overlay[2];
  135. #endif
  136. #ifdef CONFIG_CPU_FREQ
  137. struct notifier_block freq_transition;
  138. struct notifier_block freq_policy;
  139. #endif
  140. void (*lcd_power)(int, struct fb_var_screeninfo *);
  141. void (*backlight_power)(int);
  142. };
  143. #define TO_INF(ptr,member) container_of(ptr,struct pxafb_info,member)
  144. /*
  145. * These are the actions for set_ctrlr_state
  146. */
  147. #define C_DISABLE (0)
  148. #define C_ENABLE (1)
  149. #define C_DISABLE_CLKCHANGE (2)
  150. #define C_ENABLE_CLKCHANGE (3)
  151. #define C_REENABLE (4)
  152. #define C_DISABLE_PM (5)
  153. #define C_ENABLE_PM (6)
  154. #define C_STARTUP (7)
  155. #define PXA_NAME "PXA"
  156. /*
  157. * Minimum X and Y resolutions
  158. */
  159. #define MIN_XRES 64
  160. #define MIN_YRES 64
  161. /* maximum X and Y resolutions - note these are limits from the register
  162. * bits length instead of the real ones
  163. */
  164. #define MAX_XRES 1024
  165. #define MAX_YRES 1024
  166. #endif /* __PXAFB_H__ */