omapfb.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /*
  2. * File: drivers/video/omap/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 __OMAPFB_H
  24. #define __OMAPFB_H
  25. #include <linux/fb.h>
  26. #include <linux/mutex.h>
  27. #include <linux/omapfb.h>
  28. #define OMAPFB_EVENT_READY 1
  29. #define OMAPFB_EVENT_DISABLED 2
  30. #define OMAP_LCDC_INV_VSYNC 0x0001
  31. #define OMAP_LCDC_INV_HSYNC 0x0002
  32. #define OMAP_LCDC_INV_PIX_CLOCK 0x0004
  33. #define OMAP_LCDC_INV_OUTPUT_EN 0x0008
  34. #define OMAP_LCDC_HSVS_RISING_EDGE 0x0010
  35. #define OMAP_LCDC_HSVS_OPPOSITE 0x0020
  36. #define OMAP_LCDC_SIGNAL_MASK 0x003f
  37. #define OMAP_LCDC_PANEL_TFT 0x0100
  38. #define OMAPFB_PLANE_XRES_MIN 8
  39. #define OMAPFB_PLANE_YRES_MIN 8
  40. struct omapfb_device;
  41. struct lcd_panel {
  42. const char *name;
  43. int config; /* TFT/STN, signal inversion */
  44. int bpp; /* Pixel format in fb mem */
  45. int data_lines; /* Lines on LCD HW interface */
  46. int x_res, y_res;
  47. int pixel_clock; /* In kHz */
  48. int hsw; /* Horizontal synchronization
  49. pulse width */
  50. int hfp; /* Horizontal front porch */
  51. int hbp; /* Horizontal back porch */
  52. int vsw; /* Vertical synchronization
  53. pulse width */
  54. int vfp; /* Vertical front porch */
  55. int vbp; /* Vertical back porch */
  56. int acb; /* ac-bias pin frequency */
  57. int pcd; /* pixel clock divider.
  58. Obsolete use pixel_clock instead */
  59. int (*init) (struct lcd_panel *panel,
  60. struct omapfb_device *fbdev);
  61. void (*cleanup) (struct lcd_panel *panel);
  62. int (*enable) (struct lcd_panel *panel);
  63. void (*disable) (struct lcd_panel *panel);
  64. unsigned long (*get_caps) (struct lcd_panel *panel);
  65. int (*set_bklight_level)(struct lcd_panel *panel,
  66. unsigned int level);
  67. unsigned int (*get_bklight_level)(struct lcd_panel *panel);
  68. unsigned int (*get_bklight_max) (struct lcd_panel *panel);
  69. int (*run_test) (struct lcd_panel *panel, int test_num);
  70. };
  71. struct extif_timings {
  72. int cs_on_time;
  73. int cs_off_time;
  74. int we_on_time;
  75. int we_off_time;
  76. int re_on_time;
  77. int re_off_time;
  78. int we_cycle_time;
  79. int re_cycle_time;
  80. int cs_pulse_width;
  81. int access_time;
  82. int clk_div;
  83. u32 tim[5]; /* set by extif->convert_timings */
  84. int converted;
  85. };
  86. struct lcd_ctrl_extif {
  87. int (*init) (struct omapfb_device *fbdev);
  88. void (*cleanup) (void);
  89. void (*get_clk_info) (u32 *clk_period, u32 *max_clk_div);
  90. unsigned long (*get_max_tx_rate)(void);
  91. int (*convert_timings) (struct extif_timings *timings);
  92. void (*set_timings) (const struct extif_timings *timings);
  93. void (*set_bits_per_cycle)(int bpc);
  94. void (*write_command) (const void *buf, unsigned int len);
  95. void (*read_data) (void *buf, unsigned int len);
  96. void (*write_data) (const void *buf, unsigned int len);
  97. void (*transfer_area) (int width, int height,
  98. void (callback)(void *data), void *data);
  99. int (*setup_tearsync) (unsigned pin_cnt,
  100. unsigned hs_pulse_time, unsigned vs_pulse_time,
  101. int hs_pol_inv, int vs_pol_inv, int div);
  102. int (*enable_tearsync) (int enable, unsigned line);
  103. unsigned long max_transmit_size;
  104. };
  105. struct omapfb_notifier_block {
  106. struct notifier_block nb;
  107. void *data;
  108. int plane_idx;
  109. };
  110. typedef int (*omapfb_notifier_callback_t)(struct notifier_block *,
  111. unsigned long event,
  112. void *fbi);
  113. struct lcd_ctrl {
  114. const char *name;
  115. void *data;
  116. int (*init) (struct omapfb_device *fbdev,
  117. int ext_mode,
  118. struct omapfb_mem_desc *req_md);
  119. void (*cleanup) (void);
  120. void (*bind_client) (struct omapfb_notifier_block *nb);
  121. void (*get_caps) (int plane, struct omapfb_caps *caps);
  122. int (*set_update_mode)(enum omapfb_update_mode mode);
  123. enum omapfb_update_mode (*get_update_mode)(void);
  124. int (*setup_plane) (int plane, int channel_out,
  125. unsigned long offset,
  126. int screen_width,
  127. int pos_x, int pos_y, int width,
  128. int height, int color_mode);
  129. int (*set_rotate) (int angle);
  130. int (*setup_mem) (int plane, size_t size,
  131. int mem_type, unsigned long *paddr);
  132. int (*mmap) (struct fb_info *info,
  133. struct vm_area_struct *vma);
  134. int (*set_scale) (int plane,
  135. int orig_width, int orig_height,
  136. int out_width, int out_height);
  137. int (*enable_plane) (int plane, int enable);
  138. int (*update_window) (struct fb_info *fbi,
  139. struct omapfb_update_window *win,
  140. void (*callback)(void *),
  141. void *callback_data);
  142. void (*sync) (void);
  143. void (*suspend) (void);
  144. void (*resume) (void);
  145. int (*run_test) (int test_num);
  146. int (*setcolreg) (u_int regno, u16 red, u16 green,
  147. u16 blue, u16 transp,
  148. int update_hw_mem);
  149. int (*set_color_key) (struct omapfb_color_key *ck);
  150. int (*get_color_key) (struct omapfb_color_key *ck);
  151. };
  152. enum omapfb_state {
  153. OMAPFB_DISABLED = 0,
  154. OMAPFB_SUSPENDED = 99,
  155. OMAPFB_ACTIVE = 100
  156. };
  157. struct omapfb_plane_struct {
  158. int idx;
  159. struct omapfb_plane_info info;
  160. enum omapfb_color_format color_mode;
  161. struct omapfb_device *fbdev;
  162. };
  163. struct omapfb_device {
  164. int state;
  165. int ext_lcdc; /* Using external
  166. LCD controller */
  167. struct mutex rqueue_mutex;
  168. int palette_size;
  169. u32 pseudo_palette[17];
  170. struct lcd_panel *panel; /* LCD panel */
  171. const struct lcd_ctrl *ctrl; /* LCD controller */
  172. const struct lcd_ctrl *int_ctrl; /* internal LCD ctrl */
  173. struct lcd_ctrl_extif *ext_if; /* LCD ctrl external
  174. interface */
  175. struct device *dev;
  176. struct fb_var_screeninfo new_var; /* for mode changes */
  177. struct omapfb_mem_desc mem_desc;
  178. struct fb_info *fb_info[OMAPFB_PLANE_NUM];
  179. struct platform_device *dssdev; /* dummy dev for clocks */
  180. };
  181. #ifdef CONFIG_ARCH_OMAP1
  182. extern struct lcd_ctrl omap1_lcd_ctrl;
  183. #else
  184. extern struct lcd_ctrl omap2_disp_ctrl;
  185. #endif
  186. extern void omapfb_register_panel(struct lcd_panel *panel);
  187. extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval);
  188. extern void omapfb_notify_clients(struct omapfb_device *fbdev,
  189. unsigned long event);
  190. extern int omapfb_register_client(struct omapfb_notifier_block *nb,
  191. omapfb_notifier_callback_t callback,
  192. void *callback_data);
  193. extern int omapfb_unregister_client(struct omapfb_notifier_block *nb);
  194. extern int omapfb_update_window_async(struct fb_info *fbi,
  195. struct omapfb_update_window *win,
  196. void (*callback)(void *),
  197. void *callback_data);
  198. #endif /* __OMAPFB_H */