2 * File: include/asm-arm/arch-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.
29 #define OMAP_IOW(num, dtype) _IOW('O', num, dtype)
30 #define OMAP_IOR(num, dtype) _IOR('O', num, dtype)
31 #define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype)
32 #define OMAP_IO(num) _IO('O', num)
34 #define OMAPFB_MIRROR OMAP_IOW(31, int)
35 #define OMAPFB_SYNC_GFX OMAP_IO(37)
36 #define OMAPFB_VSYNC OMAP_IO(38)
37 #define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int)
38 #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)
41 #define OMAPFB_LCD_TEST OMAP_IOW(45, int)
42 #define OMAPFB_CTRL_TEST OMAP_IOW(46, int)
43 #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)
48 #define OMAPFB_CAPS_GENERIC_MASK 0x00000fff
49 #define OMAPFB_CAPS_LCDC_MASK 0x00fff000
50 #define OMAPFB_CAPS_PANEL_MASK 0xff000000
52 #define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000
53 #define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000
55 /* Values from DSP must map to lower 16-bits */
56 #define OMAPFB_FORMAT_MASK 0x00ff
57 #define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100
59 enum omapfb_color_format {
60 OMAPFB_COLOR_RGB565 = 0,
63 OMAPFB_COLOR_CLUT_8BPP,
64 OMAPFB_COLOR_CLUT_4BPP,
65 OMAPFB_COLOR_CLUT_2BPP,
66 OMAPFB_COLOR_CLUT_1BPP,
69 struct omapfb_update_window {
75 struct omapfb_update_window_old {
86 enum omapfb_channel_out {
87 OMAPFB_CHANNEL_OUT_LCD = 0,
88 OMAPFB_CHANNEL_OUT_DIGIT,
91 struct omapfb_setup_plane {
100 struct omapfb_enable_plane {
105 enum omapfb_color_key_type {
106 OMAPFB_COLOR_KEY_DISABLED = 0,
107 OMAPFB_COLOR_KEY_GFX_DST,
108 OMAPFB_COLOR_KEY_VID_SRC,
111 struct omapfb_color_key {
118 enum omapfb_update_mode {
119 OMAPFB_UPDATE_DISABLED = 0,
126 #include <linux/completion.h>
127 #include <linux/interrupt.h>
128 #include <linux/fb.h>
129 #include <linux/mutex.h>
131 #include <asm/arch/board.h>
133 #define OMAP_LCDC_INV_VSYNC 0x0001
134 #define OMAP_LCDC_INV_HSYNC 0x0002
135 #define OMAP_LCDC_INV_PIX_CLOCK 0x0004
136 #define OMAP_LCDC_INV_OUTPUT_EN 0x0008
137 #define OMAP_LCDC_HSVS_RISING_EDGE 0x0010
138 #define OMAP_LCDC_HSVS_OPPOSITE 0x0020
140 #define OMAP_LCDC_SIGNAL_MASK 0x003f
142 #define OMAP_LCDC_PANEL_TFT 0x0100
144 #ifdef CONFIG_ARCH_OMAP1
145 #define OMAPFB_PLANE_NUM 1
147 #define OMAPFB_PLANE_NUM 3
150 struct omapfb_device;
154 int config; /* TFT/STN, signal inversion */
155 int bpp; /* Pixel format in fb mem */
156 int data_lines; /* Lines on LCD HW interface */
159 int pixel_clock; /* In kHz */
160 int hsw; /* Horizontal synchronization
162 int hfp; /* Horizontal front porch */
163 int hbp; /* Horizontal back porch */
164 int vsw; /* Vertical synchronization
166 int vfp; /* Vertical front porch */
167 int vbp; /* Vertical back porch */
168 int acb; /* ac-bias pin frequency */
169 int pcd; /* pixel clock divider.
170 Obsolete use pixel_clock instead */
172 int (*init) (struct omapfb_device *fbdev);
173 void (*cleanup) (void);
174 int (*enable) (void);
175 void (*disable) (void);
176 unsigned long (*get_caps) (void);
177 int (*set_bklight_level)(unsigned int level);
178 unsigned int (*get_bklight_level)(void);
179 unsigned int (*get_bklight_max) (void);
180 int (*run_test) (int test_num);
183 struct omapfb_device;
185 struct extif_timings {
199 u32 tim[5]; /* set by extif->convert_timings */
204 struct lcd_ctrl_extif {
206 void (*cleanup) (void);
207 void (*get_clk_info) (u32 *clk_period, u32 *max_clk_div);
208 int (*convert_timings) (struct extif_timings *timings);
209 void (*set_timings) (const struct extif_timings *timings);
210 void (*set_bits_per_cycle)(int bpc);
211 void (*write_command) (const void *buf, unsigned int len);
212 void (*read_data) (void *buf, unsigned int len);
213 void (*write_data) (const void *buf, unsigned int len);
214 void (*transfer_area) (int width, int height,
215 void (callback)(void * data), void *data);
216 unsigned long max_transmit_size;
219 struct omapfb_notifier_block {
220 struct notifier_block nb;
224 typedef int (*omapfb_notifier_callback_t)(struct omapfb_notifier_block *,
226 struct omapfb_device *fbdev);
232 int (*init) (struct omapfb_device *fbdev,
233 int ext_mode, int req_vram_size);
234 void (*cleanup) (void);
235 void (*bind_client) (struct omapfb_notifier_block *nb);
236 void (*get_vram_layout)(unsigned long *size,
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);
242 enum omapfb_update_mode (*get_update_mode)(void);
243 int (*setup_plane) (int plane, int channel_out,
244 unsigned long offset,
246 int pos_x, int pos_y, int width,
247 int height, int color_mode);
248 int (*enable_plane) (int plane, int enable);
249 int (*update_window) (struct omapfb_update_window *win,
250 void (*callback)(void *),
251 void *callback_data);
253 void (*suspend) (void);
254 void (*resume) (void);
255 int (*run_test) (int test_num);
256 int (*setcolreg) (u_int regno, u16 red, u16 green,
257 u16 blue, u16 transp,
259 int (*set_color_key) (struct omapfb_color_key *ck);
265 OMAPFB_SUSPENDED= 99,
269 struct omapfb_device {
271 int ext_lcdc; /* Using external
273 struct mutex rqueue_mutex;
275 void *vram_virt_base;
276 dma_addr_t vram_phys_base;
277 unsigned long vram_size;
282 u32 pseudo_palette[17];
284 struct lcd_panel *panel; /* LCD panel */
285 struct lcd_ctrl *ctrl; /* LCD controller */
286 struct lcd_ctrl *int_ctrl; /* internal LCD ctrl */
287 struct lcd_ctrl_extif *ext_if; /* LCD ctrl external
289 struct fb_info *fb_info;
294 struct omapfb_platform_data {
295 struct omap_lcd_config lcd;
296 struct omap_fbmem_config fbmem;
299 #define OMAPFB_EVENT_READY 1
300 #define OMAPFB_EVENT_DISABLED 2
302 #ifdef CONFIG_ARCH_OMAP1
303 extern struct lcd_ctrl omap1_lcd_ctrl;
305 extern struct lcd_ctrl omap2_disp_ctrl;
308 extern void omapfb_register_panel(struct lcd_panel *panel);
309 extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval);
310 extern void omapfb_notify_clients(struct omapfb_device *fbdev,
311 unsigned long event);
312 extern int omapfb_register_client(struct omapfb_notifier_block *nb,
313 omapfb_notifier_callback_t callback,
314 void *callback_data);
315 extern int omapfb_unregister_client(struct omapfb_notifier_block *nb);
316 extern int omapfb_update_window_async(struct omapfb_update_window *win,
317 void (*callback)(void *),
318 void *callback_data);
320 /* in arch/arm/plat-omap/devices.c */
321 extern void omapfb_reserve_mem(void);
323 #endif /* __KERNEL__ */
325 #endif /* __OMAPFB_H */