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