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.h131
1 files changed, 79 insertions, 52 deletions
diff --git a/include/asm-arm/arch-omap/omapfb.h b/include/asm-arm/arch-omap/omapfb.h
index ce80a71ce8f7..adf1d81f22d1 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)
@@ -36,14 +39,14 @@
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_UPDATE_WINDOW_OLD OMAP_IOW(41, struct omapfb_update_window_old)
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 OMAP_IOW(47, struct omapfb_update_window)
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)
47 50
48#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff 51#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff
49#define OMAPFB_CAPS_LCDC_MASK 0x00fff000 52#define OMAPFB_CAPS_LCDC_MASK 0x00fff000
@@ -56,6 +59,9 @@
56#define OMAPFB_FORMAT_MASK 0x00ff 59#define OMAPFB_FORMAT_MASK 0x00ff
57#define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100 60#define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100
58 61
62#define OMAPFB_EVENT_READY 1
63#define OMAPFB_EVENT_DISABLED 2
64
59enum omapfb_color_format { 65enum omapfb_color_format {
60 OMAPFB_COLOR_RGB565 = 0, 66 OMAPFB_COLOR_RGB565 = 0,
61 OMAPFB_COLOR_YUV422, 67 OMAPFB_COLOR_YUV422,
@@ -64,6 +70,8 @@ enum omapfb_color_format {
64 OMAPFB_COLOR_CLUT_4BPP, 70 OMAPFB_COLOR_CLUT_4BPP,
65 OMAPFB_COLOR_CLUT_2BPP, 71 OMAPFB_COLOR_CLUT_2BPP,
66 OMAPFB_COLOR_CLUT_1BPP, 72 OMAPFB_COLOR_CLUT_1BPP,
73 OMAPFB_COLOR_RGB444,
74 OMAPFB_COLOR_YUY422,
67}; 75};
68 76
69struct omapfb_update_window { 77struct omapfb_update_window {
@@ -88,18 +96,16 @@ enum omapfb_channel_out {
88 OMAPFB_CHANNEL_OUT_DIGIT, 96 OMAPFB_CHANNEL_OUT_DIGIT,
89}; 97};
90 98
91struct omapfb_setup_plane { 99struct omapfb_plane_info {
92 __u8 plane; 100 __u32 pos_x;
101 __u32 pos_y;
102 __u8 enabled;
93 __u8 channel_out; 103 __u8 channel_out;
94 __u32 offset; 104 __u8 mirror;
95 __u32 pos_x, pos_y; 105 __u8 reserved1;
96 __u32 width, height; 106 __u32 out_width;
97 __u32 color_mode; 107 __u32 out_height;
98}; 108 __u32 reserved2[12];
99
100struct omapfb_enable_plane {
101 __u8 plane;
102 __u8 enable;
103}; 109};
104 110
105enum omapfb_color_key_type { 111enum omapfb_color_key_type {
@@ -141,6 +147,9 @@ enum omapfb_update_mode {
141 147
142#define OMAP_LCDC_PANEL_TFT 0x0100 148#define OMAP_LCDC_PANEL_TFT 0x0100
143 149
150#define OMAPFB_PLANE_XRES_MIN 8
151#define OMAPFB_PLANE_YRES_MIN 8
152
144#ifdef CONFIG_ARCH_OMAP1 153#ifdef CONFIG_ARCH_OMAP1
145#define OMAPFB_PLANE_NUM 1 154#define OMAPFB_PLANE_NUM 1
146#else 155#else
@@ -169,15 +178,17 @@ struct lcd_panel {
169 int pcd; /* pixel clock divider. 178 int pcd; /* pixel clock divider.
170 Obsolete use pixel_clock instead */ 179 Obsolete use pixel_clock instead */
171 180
172 int (*init) (struct omapfb_device *fbdev); 181 int (*init) (struct lcd_panel *panel,
173 void (*cleanup) (void); 182 struct omapfb_device *fbdev);
174 int (*enable) (void); 183 void (*cleanup) (struct lcd_panel *panel);
175 void (*disable) (void); 184 int (*enable) (struct lcd_panel *panel);
176 unsigned long (*get_caps) (void); 185 void (*disable) (struct lcd_panel *panel);
177 int (*set_bklight_level)(unsigned int level); 186 unsigned long (*get_caps) (struct lcd_panel *panel);
178 unsigned int (*get_bklight_level)(void); 187 int (*set_bklight_level)(struct lcd_panel *panel,
179 unsigned int (*get_bklight_max) (void); 188 unsigned int level);
180 int (*run_test) (int test_num); 189 unsigned int (*get_bklight_level)(struct lcd_panel *panel);
190 unsigned int (*get_bklight_max) (struct lcd_panel *panel);
191 int (*run_test) (struct lcd_panel *panel, int test_num);
181}; 192};
182 193
183struct omapfb_device; 194struct omapfb_device;
@@ -202,7 +213,7 @@ struct extif_timings {
202}; 213};
203 214
204struct lcd_ctrl_extif { 215struct lcd_ctrl_extif {
205 int (*init) (void); 216 int (*init) (struct omapfb_device *fbdev);
206 void (*cleanup) (void); 217 void (*cleanup) (void);
207 void (*get_clk_info) (u32 *clk_period, u32 *max_clk_div); 218 void (*get_clk_info) (u32 *clk_period, u32 *max_clk_div);
208 int (*convert_timings) (struct extif_timings *timings); 219 int (*convert_timings) (struct extif_timings *timings);
@@ -213,30 +224,41 @@ struct lcd_ctrl_extif {
213 void (*write_data) (const void *buf, unsigned int len); 224 void (*write_data) (const void *buf, unsigned int len);
214 void (*transfer_area) (int width, int height, 225 void (*transfer_area) (int width, int height,
215 void (callback)(void * data), void *data); 226 void (callback)(void * data), void *data);
227
216 unsigned long max_transmit_size; 228 unsigned long max_transmit_size;
217}; 229};
218 230
219struct omapfb_notifier_block { 231struct omapfb_notifier_block {
220 struct notifier_block nb; 232 struct notifier_block nb;
221 void *data; 233 void *data;
234 int plane_idx;
222}; 235};
223 236
224typedef int (*omapfb_notifier_callback_t)(struct omapfb_notifier_block *, 237typedef int (*omapfb_notifier_callback_t)(struct notifier_block *,
225 unsigned long event, 238 unsigned long event,
226 struct omapfb_device *fbdev); 239 void *fbi);
240
241struct omapfb_mem_region {
242 dma_addr_t paddr;
243 void *vaddr;
244 unsigned long size;
245 int alloc:1;
246};
247
248struct omapfb_mem_desc {
249 int region_cnt;
250 struct omapfb_mem_region region[OMAPFB_PLANE_NUM];
251};
227 252
228struct lcd_ctrl { 253struct lcd_ctrl {
229 const char *name; 254 const char *name;
230 void *data; 255 void *data;
231 256
232 int (*init) (struct omapfb_device *fbdev, 257 int (*init) (struct omapfb_device *fbdev,
233 int ext_mode, int req_vram_size); 258 int ext_mode,
259 struct omapfb_mem_desc *req_md);
234 void (*cleanup) (void); 260 void (*cleanup) (void);
235 void (*bind_client) (struct omapfb_notifier_block *nb); 261 void (*bind_client) (struct omapfb_notifier_block *nb);
236 void (*get_vram_layout)(unsigned long *size,
237 void **virt_base,
238 dma_addr_t *phys_base);
239 int (*mmap) (struct vm_area_struct *vma);
240 unsigned long (*get_caps) (void); 262 unsigned long (*get_caps) (void);
241 int (*set_update_mode)(enum omapfb_update_mode mode); 263 int (*set_update_mode)(enum omapfb_update_mode mode);
242 enum omapfb_update_mode (*get_update_mode)(void); 264 enum omapfb_update_mode (*get_update_mode)(void);
@@ -245,8 +267,12 @@ struct lcd_ctrl {
245 int screen_width, 267 int screen_width,
246 int pos_x, int pos_y, int width, 268 int pos_x, int pos_y, int width,
247 int height, int color_mode); 269 int height, int color_mode);
270 int (*set_scale) (int plane,
271 int orig_width, int orig_height,
272 int out_width, int out_height);
248 int (*enable_plane) (int plane, int enable); 273 int (*enable_plane) (int plane, int enable);
249 int (*update_window) (struct omapfb_update_window *win, 274 int (*update_window) (struct fb_info *fbi,
275 struct omapfb_update_window *win,
250 void (*callback)(void *), 276 void (*callback)(void *),
251 void *callback_data); 277 void *callback_data);
252 void (*sync) (void); 278 void (*sync) (void);
@@ -257,6 +283,7 @@ struct lcd_ctrl {
257 u16 blue, u16 transp, 283 u16 blue, u16 transp,
258 int update_hw_mem); 284 int update_hw_mem);
259 int (*set_color_key) (struct omapfb_color_key *ck); 285 int (*set_color_key) (struct omapfb_color_key *ck);
286 int (*get_color_key) (struct omapfb_color_key *ck);
260 287
261}; 288};
262 289
@@ -266,19 +293,20 @@ enum omapfb_state {
266 OMAPFB_ACTIVE = 100 293 OMAPFB_ACTIVE = 100
267}; 294};
268 295
296struct omapfb_plane_struct {
297 int idx;
298 struct omapfb_plane_info info;
299 enum omapfb_color_format color_mode;
300 struct omapfb_device *fbdev;
301};
302
269struct omapfb_device { 303struct omapfb_device {
270 int state; 304 int state;
271 int ext_lcdc; /* Using external 305 int ext_lcdc; /* Using external
272 LCD controller */ 306 LCD controller */
273 struct mutex rqueue_mutex; 307 struct mutex rqueue_mutex;
274 308
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; 309 int palette_size;
281 int mirror;
282 u32 pseudo_palette[17]; 310 u32 pseudo_palette[17];
283 311
284 struct lcd_panel *panel; /* LCD panel */ 312 struct lcd_panel *panel; /* LCD panel */
@@ -286,20 +314,18 @@ struct omapfb_device {
286 struct lcd_ctrl *int_ctrl; /* internal LCD ctrl */ 314 struct lcd_ctrl *int_ctrl; /* internal LCD ctrl */
287 struct lcd_ctrl_extif *ext_if; /* LCD ctrl external 315 struct lcd_ctrl_extif *ext_if; /* LCD ctrl external
288 interface */ 316 interface */
289 struct fb_info *fb_info;
290
291 struct device *dev; 317 struct device *dev;
318
319 struct omapfb_mem_desc mem_desc;
320 struct fb_info *fb_info[OMAPFB_PLANE_NUM];
292}; 321};
293 322
294struct omapfb_platform_data { 323struct omapfb_platform_data {
295 struct omap_lcd_config lcd; 324 struct omap_lcd_config lcd;
296 struct omapfb_mem_desc mem_desc; 325 struct omapfb_mem_desc mem_desc;
297 void *ctrl_platform_data; 326 void *ctrl_platform_data;
298}; 327};
299 328
300#define OMAPFB_EVENT_READY 1
301#define OMAPFB_EVENT_DISABLED 2
302
303#ifdef CONFIG_ARCH_OMAP1 329#ifdef CONFIG_ARCH_OMAP1
304extern struct lcd_ctrl omap1_lcd_ctrl; 330extern struct lcd_ctrl omap1_lcd_ctrl;
305#else 331#else
@@ -311,12 +337,13 @@ extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval);
311extern void omapfb_notify_clients(struct omapfb_device *fbdev, 337extern void omapfb_notify_clients(struct omapfb_device *fbdev,
312 unsigned long event); 338 unsigned long event);
313extern int omapfb_register_client(struct omapfb_notifier_block *nb, 339extern int omapfb_register_client(struct omapfb_notifier_block *nb,
314 omapfb_notifier_callback_t callback, 340 omapfb_notifier_callback_t callback,
315 void *callback_data); 341 void *callback_data);
316extern int omapfb_unregister_client(struct omapfb_notifier_block *nb); 342extern int omapfb_unregister_client(struct omapfb_notifier_block *nb);
317extern int omapfb_update_window_async(struct omapfb_update_window *win, 343extern int omapfb_update_window_async(struct fb_info *fbi,
318 void (*callback)(void *), 344 struct omapfb_update_window *win,
319 void *callback_data); 345 void (*callback)(void *),
346 void *callback_data);
320 347
321/* in arch/arm/plat-omap/fb.c */ 348/* in arch/arm/plat-omap/fb.c */
322extern void omapfb_reserve_mem(void); 349extern void omapfb_reserve_mem(void);