aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm/arch-omap/omapfb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-arm/arch-omap/omapfb.h')
-rw-r--r--include/asm-arm/arch-omap/omapfb.h188
1 files changed, 129 insertions, 59 deletions
diff --git a/include/asm-arm/arch-omap/omapfb.h b/include/asm-arm/arch-omap/omapfb.h
index fccdb3db025f..46d7a4f60854 100644
--- a/include/asm-arm/arch-omap/omapfb.h
+++ b/include/asm-arm/arch-omap/omapfb.h
@@ -24,6 +24,9 @@
24#ifndef __OMAPFB_H 24#ifndef __OMAPFB_H
25#define __OMAPFB_H 25#define __OMAPFB_H
26 26
27#include <asm/ioctl.h>
28#include <asm/types.h>
29
27/* IOCTL commands. */ 30/* IOCTL commands. */
28 31
29#define OMAP_IOW(num, dtype) _IOW('O', num, dtype) 32#define OMAP_IOW(num, dtype) _IOW('O', num, dtype)
@@ -35,26 +38,46 @@
35#define OMAPFB_SYNC_GFX OMAP_IO(37) 38#define OMAPFB_SYNC_GFX OMAP_IO(37)
36#define OMAPFB_VSYNC OMAP_IO(38) 39#define OMAPFB_VSYNC OMAP_IO(38)
37#define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int) 40#define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int)
38#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(41, struct omapfb_update_window_old) 41#define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps)
39#define OMAPFB_GET_CAPS OMAP_IOR(42, unsigned long)
40#define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int) 42#define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int)
41#define OMAPFB_LCD_TEST OMAP_IOW(45, int) 43#define OMAPFB_LCD_TEST OMAP_IOW(45, int)
42#define OMAPFB_CTRL_TEST OMAP_IOW(46, int) 44#define OMAPFB_CTRL_TEST OMAP_IOW(46, int)
43#define OMAPFB_UPDATE_WINDOW OMAP_IOW(47, struct omapfb_update_window) 45#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
44#define OMAPFB_SETUP_PLANE OMAP_IOW(48, struct omapfb_setup_plane)
45#define OMAPFB_ENABLE_PLANE OMAP_IOW(49, struct omapfb_enable_plane)
46#define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key) 46#define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key)
47#define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key)
48#define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info)
49#define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info)
50#define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window)
51#define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info)
52#define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info)
47 53
48#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff 54#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff
49#define OMAPFB_CAPS_LCDC_MASK 0x00fff000 55#define OMAPFB_CAPS_LCDC_MASK 0x00fff000
50#define OMAPFB_CAPS_PANEL_MASK 0xff000000 56#define OMAPFB_CAPS_PANEL_MASK 0xff000000
51 57
52#define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000 58#define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000
59#define OMAPFB_CAPS_TEARSYNC 0x00002000
60#define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000
61#define OMAPFB_CAPS_PLANE_SCALE 0x00008000
62#define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000
63#define OMAPFB_CAPS_WINDOW_SCALE 0x00020000
64#define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000
53#define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000 65#define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000
54 66
55/* Values from DSP must map to lower 16-bits */ 67/* Values from DSP must map to lower 16-bits */
56#define OMAPFB_FORMAT_MASK 0x00ff 68#define OMAPFB_FORMAT_MASK 0x00ff
57#define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100 69#define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100
70#define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200
71#define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400
72#define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800
73#define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000
74
75#define OMAPFB_EVENT_READY 1
76#define OMAPFB_EVENT_DISABLED 2
77
78#define OMAPFB_MEMTYPE_SDRAM 0
79#define OMAPFB_MEMTYPE_SRAM 1
80#define OMAPFB_MEMTYPE_MAX 1
58 81
59enum omapfb_color_format { 82enum omapfb_color_format {
60 OMAPFB_COLOR_RGB565 = 0, 83 OMAPFB_COLOR_RGB565 = 0,
@@ -64,17 +87,23 @@ enum omapfb_color_format {
64 OMAPFB_COLOR_CLUT_4BPP, 87 OMAPFB_COLOR_CLUT_4BPP,
65 OMAPFB_COLOR_CLUT_2BPP, 88 OMAPFB_COLOR_CLUT_2BPP,
66 OMAPFB_COLOR_CLUT_1BPP, 89 OMAPFB_COLOR_CLUT_1BPP,
90 OMAPFB_COLOR_RGB444,
91 OMAPFB_COLOR_YUY422,
67}; 92};
68 93
69struct omapfb_update_window { 94struct omapfb_update_window {
70 __u32 x, y; 95 __u32 x, y;
71 __u32 width, height; 96 __u32 width, height;
72 __u32 format; 97 __u32 format;
98 __u32 out_x, out_y;
99 __u32 out_width, out_height;
100 __u32 reserved[8];
73}; 101};
74 102
75struct omapfb_update_window_old { 103struct omapfb_update_window_old {
76 __u32 x, y; 104 __u32 x, y;
77 __u32 width, height; 105 __u32 width, height;
106 __u32 format;
78}; 107};
79 108
80enum omapfb_plane { 109enum omapfb_plane {
@@ -88,18 +117,28 @@ enum omapfb_channel_out {
88 OMAPFB_CHANNEL_OUT_DIGIT, 117 OMAPFB_CHANNEL_OUT_DIGIT,
89}; 118};
90 119
91struct omapfb_setup_plane { 120struct omapfb_plane_info {
92 __u8 plane; 121 __u32 pos_x;
122 __u32 pos_y;
123 __u8 enabled;
93 __u8 channel_out; 124 __u8 channel_out;
94 __u32 offset; 125 __u8 mirror;
95 __u32 pos_x, pos_y; 126 __u8 reserved1;
96 __u32 width, height; 127 __u32 out_width;
97 __u32 color_mode; 128 __u32 out_height;
129 __u32 reserved2[12];
98}; 130};
99 131
100struct omapfb_enable_plane { 132struct omapfb_mem_info {
101 __u8 plane; 133 __u32 size;
102 __u8 enable; 134 __u8 type;
135 __u8 reserved[3];
136};
137
138struct omapfb_caps {
139 __u32 ctrl;
140 __u32 plane_color;
141 __u32 wnd_color;
103}; 142};
104 143
105enum omapfb_color_key_type { 144enum omapfb_color_key_type {
@@ -141,6 +180,9 @@ enum omapfb_update_mode {
141 180
142#define OMAP_LCDC_PANEL_TFT 0x0100 181#define OMAP_LCDC_PANEL_TFT 0x0100
143 182
183#define OMAPFB_PLANE_XRES_MIN 8
184#define OMAPFB_PLANE_YRES_MIN 8
185
144#ifdef CONFIG_ARCH_OMAP1 186#ifdef CONFIG_ARCH_OMAP1
145#define OMAPFB_PLANE_NUM 1 187#define OMAPFB_PLANE_NUM 1
146#else 188#else
@@ -169,19 +211,19 @@ struct lcd_panel {
169 int pcd; /* pixel clock divider. 211 int pcd; /* pixel clock divider.
170 Obsolete use pixel_clock instead */ 212 Obsolete use pixel_clock instead */
171 213
172 int (*init) (struct omapfb_device *fbdev); 214 int (*init) (struct lcd_panel *panel,
173 void (*cleanup) (void); 215 struct omapfb_device *fbdev);
174 int (*enable) (void); 216 void (*cleanup) (struct lcd_panel *panel);
175 void (*disable) (void); 217 int (*enable) (struct lcd_panel *panel);
176 unsigned long (*get_caps) (void); 218 void (*disable) (struct lcd_panel *panel);
177 int (*set_bklight_level)(unsigned int level); 219 unsigned long (*get_caps) (struct lcd_panel *panel);
178 unsigned int (*get_bklight_level)(void); 220 int (*set_bklight_level)(struct lcd_panel *panel,
179 unsigned int (*get_bklight_max) (void); 221 unsigned int level);
180 int (*run_test) (int test_num); 222 unsigned int (*get_bklight_level)(struct lcd_panel *panel);
223 unsigned int (*get_bklight_max) (struct lcd_panel *panel);
224 int (*run_test) (struct lcd_panel *panel, int test_num);
181}; 225};
182 226
183struct omapfb_device;
184
185struct extif_timings { 227struct extif_timings {
186 int cs_on_time; 228 int cs_on_time;
187 int cs_off_time; 229 int cs_off_time;
@@ -202,9 +244,10 @@ struct extif_timings {
202}; 244};
203 245
204struct lcd_ctrl_extif { 246struct lcd_ctrl_extif {
205 int (*init) (void); 247 int (*init) (struct omapfb_device *fbdev);
206 void (*cleanup) (void); 248 void (*cleanup) (void);
207 void (*get_clk_info) (u32 *clk_period, u32 *max_clk_div); 249 void (*get_clk_info) (u32 *clk_period, u32 *max_clk_div);
250 unsigned long (*get_max_tx_rate)(void);
208 int (*convert_timings) (struct extif_timings *timings); 251 int (*convert_timings) (struct extif_timings *timings);
209 void (*set_timings) (const struct extif_timings *timings); 252 void (*set_timings) (const struct extif_timings *timings);
210 void (*set_bits_per_cycle)(int bpc); 253 void (*set_bits_per_cycle)(int bpc);
@@ -213,31 +256,48 @@ struct lcd_ctrl_extif {
213 void (*write_data) (const void *buf, unsigned int len); 256 void (*write_data) (const void *buf, unsigned int len);
214 void (*transfer_area) (int width, int height, 257 void (*transfer_area) (int width, int height,
215 void (callback)(void * data), void *data); 258 void (callback)(void * data), void *data);
259 int (*setup_tearsync) (unsigned pin_cnt,
260 unsigned hs_pulse_time, unsigned vs_pulse_time,
261 int hs_pol_inv, int vs_pol_inv, int div);
262 int (*enable_tearsync) (int enable, unsigned line);
263
216 unsigned long max_transmit_size; 264 unsigned long max_transmit_size;
217}; 265};
218 266
219struct omapfb_notifier_block { 267struct omapfb_notifier_block {
220 struct notifier_block nb; 268 struct notifier_block nb;
221 void *data; 269 void *data;
270 int plane_idx;
222}; 271};
223 272
224typedef int (*omapfb_notifier_callback_t)(struct omapfb_notifier_block *, 273typedef int (*omapfb_notifier_callback_t)(struct notifier_block *,
225 unsigned long event, 274 unsigned long event,
226 struct omapfb_device *fbdev); 275 void *fbi);
276
277struct omapfb_mem_region {
278 dma_addr_t paddr;
279 void *vaddr;
280 unsigned long size;
281 u8 type; /* OMAPFB_PLANE_MEM_* */
282 unsigned alloc:1; /* allocated by the driver */
283 unsigned map:1; /* kernel mapped by the driver */
284};
285
286struct omapfb_mem_desc {
287 int region_cnt;
288 struct omapfb_mem_region region[OMAPFB_PLANE_NUM];
289};
227 290
228struct lcd_ctrl { 291struct lcd_ctrl {
229 const char *name; 292 const char *name;
230 void *data; 293 void *data;
231 294
232 int (*init) (struct omapfb_device *fbdev, 295 int (*init) (struct omapfb_device *fbdev,
233 int ext_mode, int req_vram_size); 296 int ext_mode,
297 struct omapfb_mem_desc *req_md);
234 void (*cleanup) (void); 298 void (*cleanup) (void);
235 void (*bind_client) (struct omapfb_notifier_block *nb); 299 void (*bind_client) (struct omapfb_notifier_block *nb);
236 void (*get_vram_layout)(unsigned long *size, 300 void (*get_caps) (int plane, struct omapfb_caps *caps);
237 void **virt_base,
238 dma_addr_t *phys_base);
239 int (*mmap) (struct vm_area_struct *vma);
240 unsigned long (*get_caps) (void);
241 int (*set_update_mode)(enum omapfb_update_mode mode); 301 int (*set_update_mode)(enum omapfb_update_mode mode);
242 enum omapfb_update_mode (*get_update_mode)(void); 302 enum omapfb_update_mode (*get_update_mode)(void);
243 int (*setup_plane) (int plane, int channel_out, 303 int (*setup_plane) (int plane, int channel_out,
@@ -245,8 +305,16 @@ struct lcd_ctrl {
245 int screen_width, 305 int screen_width,
246 int pos_x, int pos_y, int width, 306 int pos_x, int pos_y, int width,
247 int height, int color_mode); 307 int height, int color_mode);
308 int (*setup_mem) (int plane, size_t size,
309 int mem_type, unsigned long *paddr);
310 int (*mmap) (struct fb_info *info,
311 struct vm_area_struct *vma);
312 int (*set_scale) (int plane,
313 int orig_width, int orig_height,
314 int out_width, int out_height);
248 int (*enable_plane) (int plane, int enable); 315 int (*enable_plane) (int plane, int enable);
249 int (*update_window) (struct omapfb_update_window *win, 316 int (*update_window) (struct fb_info *fbi,
317 struct omapfb_update_window *win,
250 void (*callback)(void *), 318 void (*callback)(void *),
251 void *callback_data); 319 void *callback_data);
252 void (*sync) (void); 320 void (*sync) (void);
@@ -257,7 +325,7 @@ struct lcd_ctrl {
257 u16 blue, u16 transp, 325 u16 blue, u16 transp,
258 int update_hw_mem); 326 int update_hw_mem);
259 int (*set_color_key) (struct omapfb_color_key *ck); 327 int (*set_color_key) (struct omapfb_color_key *ck);
260 328 int (*get_color_key) (struct omapfb_color_key *ck);
261}; 329};
262 330
263enum omapfb_state { 331enum omapfb_state {
@@ -266,19 +334,20 @@ enum omapfb_state {
266 OMAPFB_ACTIVE = 100 334 OMAPFB_ACTIVE = 100
267}; 335};
268 336
337struct omapfb_plane_struct {
338 int idx;
339 struct omapfb_plane_info info;
340 enum omapfb_color_format color_mode;
341 struct omapfb_device *fbdev;
342};
343
269struct omapfb_device { 344struct omapfb_device {
270 int state; 345 int state;
271 int ext_lcdc; /* Using external 346 int ext_lcdc; /* Using external
272 LCD controller */ 347 LCD controller */
273 struct mutex rqueue_mutex; 348 struct mutex rqueue_mutex;
274 349
275 void *vram_virt_base;
276 dma_addr_t vram_phys_base;
277 unsigned long vram_size;
278
279 int color_mode;
280 int palette_size; 350 int palette_size;
281 int mirror;
282 u32 pseudo_palette[17]; 351 u32 pseudo_palette[17];
283 352
284 struct lcd_panel *panel; /* LCD panel */ 353 struct lcd_panel *panel; /* LCD panel */
@@ -286,19 +355,19 @@ struct omapfb_device {
286 struct lcd_ctrl *int_ctrl; /* internal LCD ctrl */ 355 struct lcd_ctrl *int_ctrl; /* internal LCD ctrl */
287 struct lcd_ctrl_extif *ext_if; /* LCD ctrl external 356 struct lcd_ctrl_extif *ext_if; /* LCD ctrl external
288 interface */ 357 interface */
289 struct fb_info *fb_info;
290
291 struct device *dev; 358 struct device *dev;
359 struct fb_var_screeninfo new_var; /* for mode changes */
360
361 struct omapfb_mem_desc mem_desc;
362 struct fb_info *fb_info[OMAPFB_PLANE_NUM];
292}; 363};
293 364
294struct omapfb_platform_data { 365struct omapfb_platform_data {
295 struct omap_lcd_config lcd; 366 struct omap_lcd_config lcd;
296 struct omap_fbmem_config fbmem; 367 struct omapfb_mem_desc mem_desc;
368 void *ctrl_platform_data;
297}; 369};
298 370
299#define OMAPFB_EVENT_READY 1
300#define OMAPFB_EVENT_DISABLED 2
301
302#ifdef CONFIG_ARCH_OMAP1 371#ifdef CONFIG_ARCH_OMAP1
303extern struct lcd_ctrl omap1_lcd_ctrl; 372extern struct lcd_ctrl omap1_lcd_ctrl;
304#else 373#else
@@ -310,15 +379,16 @@ extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval);
310extern void omapfb_notify_clients(struct omapfb_device *fbdev, 379extern void omapfb_notify_clients(struct omapfb_device *fbdev,
311 unsigned long event); 380 unsigned long event);
312extern int omapfb_register_client(struct omapfb_notifier_block *nb, 381extern int omapfb_register_client(struct omapfb_notifier_block *nb,
313 omapfb_notifier_callback_t callback, 382 omapfb_notifier_callback_t callback,
314 void *callback_data); 383 void *callback_data);
315extern int omapfb_unregister_client(struct omapfb_notifier_block *nb); 384extern int omapfb_unregister_client(struct omapfb_notifier_block *nb);
316extern int omapfb_update_window_async(struct omapfb_update_window *win, 385extern int omapfb_update_window_async(struct fb_info *fbi,
317 void (*callback)(void *), 386 struct omapfb_update_window *win,
318 void *callback_data); 387 void (*callback)(void *),
388 void *callback_data);
319 389
320/* in arch/arm/plat-omap/devices.c */ 390/* in arch/arm/plat-omap/fb.c */
321extern void omapfb_reserve_mem(void); 391extern void omapfb_set_ctrl_platform_data(void *pdata);
322 392
323#endif /* __KERNEL__ */ 393#endif /* __KERNEL__ */
324 394