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, enum omapfb_update_mode)
38 #define OMAPFB_GET_CAPS OMAP_IOR(42, unsigned long)
39 #define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, enum omapfb_update_mode)
40 #define OMAPFB_LCD_TEST OMAP_IOW(45, int)
41 #define OMAPFB_CTRL_TEST OMAP_IOW(46, int)
42 #define OMAPFB_UPDATE_WINDOW OMAP_IOW(47, struct omapfb_update_window)
43 #define OMAPFB_SETUP_PLANE OMAP_IOW(48, struct omapfb_setup_plane)
44 #define OMAPFB_ENABLE_PLANE OMAP_IOW(49, struct omapfb_enable_plane)
45 #define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key)
47 #define OMAPFB_CAPS_GENERIC_MASK 0x00000fff
48 #define OMAPFB_CAPS_LCDC_MASK 0x00fff000
49 #define OMAPFB_CAPS_PANEL_MASK 0xff000000
51 #define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000
52 #define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000
54 /* Values from DSP must map to lower 16-bits */
55 #define OMAPFB_FORMAT_MASK 0x00ff
56 #define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100
58 enum omapfb_color_format
{
59 OMAPFB_COLOR_RGB565
= 0,
62 OMAPFB_COLOR_CLUT_8BPP
,
63 OMAPFB_COLOR_CLUT_4BPP
,
64 OMAPFB_COLOR_CLUT_2BPP
,
65 OMAPFB_COLOR_CLUT_1BPP
,
68 struct omapfb_update_window
{
80 enum omapfb_channel_out
{
81 OMAPFB_CHANNEL_OUT_LCD
= 0,
82 OMAPFB_CHANNEL_OUT_DIGIT
,
85 struct omapfb_setup_plane
{
94 struct omapfb_enable_plane
{
99 enum omapfb_color_key_type
{
100 OMAPFB_COLOR_KEY_DISABLED
= 0,
101 OMAPFB_COLOR_KEY_GFX_DST
,
102 OMAPFB_COLOR_KEY_VID_SRC
,
105 struct omapfb_color_key
{
112 enum omapfb_update_mode
{
113 OMAPFB_UPDATE_DISABLED
= 0,
120 #include <linux/completion.h>
121 #include <linux/interrupt.h>
122 #include <linux/fb.h>
124 #define OMAP_LCDC_INV_VSYNC 0x0001
125 #define OMAP_LCDC_INV_HSYNC 0x0002
126 #define OMAP_LCDC_INV_PIX_CLOCK 0x0004
127 #define OMAP_LCDC_INV_OUTPUT_EN 0x0008
128 #define OMAP_LCDC_HSVS_RISING_EDGE 0x0010
129 #define OMAP_LCDC_HSVS_OPPOSITE 0x0020
131 #define OMAP_LCDC_SIGNAL_MASK 0x003f
133 #define OMAP_LCDC_PANEL_TFT 0x0100
135 #ifdef CONFIG_ARCH_OMAP1
136 #define OMAPFB_PLANE_NUM 1
138 #define OMAPFB_PLANE_NUM 3
141 struct omapfb_device
;
145 int config
; /* TFT/STN, signal inversion */
146 int bpp
; /* Pixel format in fb mem */
147 int data_lines
; /* Lines on LCD HW interface */
150 int pixel_clock
; /* In kHz */
151 int hsw
; /* Horizontal synchronization
153 int hfp
; /* Horizontal front porch */
154 int hbp
; /* Horizontal back porch */
155 int vsw
; /* Vertical synchronization
157 int vfp
; /* Vertical front porch */
158 int vbp
; /* Vertical back porch */
159 int acb
; /* ac-bias pin frequency */
160 int pcd
; /* pixel clock divider.
161 Obsolete use pixel_clock instead */
163 int (*init
) (struct omapfb_device
*fbdev
);
164 void (*cleanup
) (void);
165 int (*enable
) (void);
166 void (*disable
) (void);
167 unsigned long (*get_caps
) (void);
168 int (*set_bklight_level
)(unsigned int level
);
169 unsigned int (*get_bklight_level
)(void);
170 unsigned int (*get_bklight_max
) (void);
171 int (*run_test
) (int test_num
);
174 struct omapfb_device
;
176 struct extif_timings
{
189 struct lcd_ctrl_extif
{
191 void (*cleanup
) (void);
192 void (*set_timings
) (const struct extif_timings
*timings
);
193 void (*write_command
) (u32 cmd
);
194 u32 (*read_data
) (void);
195 void (*write_data
) (u32 data
);
196 void (*transfer_area
) (int width
, int height
,
197 void (callback
)(void * data
), void *data
);
204 int (*init
) (struct omapfb_device
*fbdev
,
205 int ext_mode
, int req_vram_size
);
206 void (*cleanup
) (void);
207 void (*get_vram_layout
)(unsigned long *size
,
209 dma_addr_t
*phys_base
);
210 unsigned long (*get_caps
) (void);
211 int (*set_update_mode
)(enum omapfb_update_mode mode
);
212 enum omapfb_update_mode (*get_update_mode
)(void);
213 int (*setup_plane
) (int plane
, int channel_out
,
214 unsigned long offset
,
216 int pos_x
, int pos_y
, int width
,
217 int height
, int color_mode
);
218 int (*enable_plane
) (int plane
, int enable
);
219 int (*update_window
) (struct omapfb_update_window
*win
,
220 void (*callback
)(void *),
221 void *callback_data
);
223 void (*suspend
) (void);
224 void (*resume
) (void);
225 int (*run_test
) (int test_num
);
226 int (*setcolreg
) (u_int regno
, u16 red
, u16 green
,
227 u16 blue
, u16 transp
,
229 int (*set_color_key
) (struct omapfb_color_key
*ck
);
235 OMAPFB_SUSPENDED
= 99,
239 struct omapfb_device
{
241 int ext_lcdc
; /* Using external
243 struct semaphore rqueue_sema
;
245 void *vram_virt_base
;
246 dma_addr_t vram_phys_base
;
247 unsigned long vram_size
;
252 u32 pseudo_palette
[17];
254 struct lcd_panel
*panel
; /* LCD panel */
255 struct lcd_ctrl
*ctrl
; /* LCD controller */
256 struct lcd_ctrl
*int_ctrl
; /* internal LCD ctrl */
257 struct lcd_ctrl_extif
*ext_if
; /* LCD ctrl external
259 struct fb_info
*fb_info
;
264 extern struct lcd_panel h3_panel
;
265 extern struct lcd_panel h2_panel
;
266 extern struct lcd_panel p2_panel
;
267 extern struct lcd_panel osk_panel
;
268 extern struct lcd_panel innovator1610_panel
;
269 extern struct lcd_panel innovator1510_panel
;
271 #ifdef CONFIG_ARCH_OMAP1
272 extern struct lcd_ctrl omap1_lcd_ctrl
;
274 extern struct lcd_ctrl omap2_disp_ctrl
;
277 extern void omapfb_write_first_pixel(struct omapfb_device
*fbdev
, u16 pixval
);
279 #endif /* __KERNEL__ */
281 #endif /* __OMAPFB_H */