blob: 7e4cd616bcb57c0e51358073873502c9c417c3ef [file] [log] [blame]
Tomi Valkeinen91773a02009-08-03 15:06:36 +03001/*
2 * File: include/linux/omapfb.h
3 *
4 * Framebuffer driver for TI OMAP boards
5 *
6 * Copyright (C) 2004 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
8 *
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.
13 *
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.
18 *
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.
22 */
23
24#ifndef __LINUX_OMAPFB_H__
25#define __LINUX_OMAPFB_H__
26
Tomi Valkeinenb39a982d2009-08-04 16:12:50 +030027#include <linux/fb.h>
Tomi Valkeinen91773a02009-08-03 15:06:36 +030028#include <linux/ioctl.h>
29#include <linux/types.h>
30
31/* IOCTL commands. */
32
33#define OMAP_IOW(num, dtype) _IOW('O', num, dtype)
34#define OMAP_IOR(num, dtype) _IOR('O', num, dtype)
35#define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype)
36#define OMAP_IO(num) _IO('O', num)
37
38#define OMAPFB_MIRROR OMAP_IOW(31, int)
39#define OMAPFB_SYNC_GFX OMAP_IO(37)
40#define OMAPFB_VSYNC OMAP_IO(38)
41#define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int)
42#define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps)
43#define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int)
44#define OMAPFB_LCD_TEST OMAP_IOW(45, int)
45#define OMAPFB_CTRL_TEST OMAP_IOW(46, int)
46#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
47#define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key)
48#define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key)
49#define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info)
50#define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info)
51#define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window)
52#define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info)
53#define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info)
Tomi Valkeinenb39a982d2009-08-04 16:12:50 +030054#define OMAPFB_WAITFORVSYNC OMAP_IO(57)
55#define OMAPFB_MEMORY_READ OMAP_IOR(58, struct omapfb_memory_read)
56#define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode)
57#define OMAPFB_WAITFORGO OMAP_IO(60)
58#define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info)
59#define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info)
Tomi Valkeinen6dd2e422010-01-14 17:32:13 +020060#define OMAPFB_GET_DISPLAY_INFO OMAP_IOR(63, struct omapfb_display_info)
Tomi Valkeinen91773a02009-08-03 15:06:36 +030061
62#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff
63#define OMAPFB_CAPS_LCDC_MASK 0x00fff000
64#define OMAPFB_CAPS_PANEL_MASK 0xff000000
65
66#define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000
67#define OMAPFB_CAPS_TEARSYNC 0x00002000
68#define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000
69#define OMAPFB_CAPS_PLANE_SCALE 0x00008000
70#define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000
71#define OMAPFB_CAPS_WINDOW_SCALE 0x00020000
72#define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000
73#define OMAPFB_CAPS_WINDOW_ROTATE 0x00080000
74#define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000
75
76/* Values from DSP must map to lower 16-bits */
77#define OMAPFB_FORMAT_MASK 0x00ff
78#define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100
79#define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200
80#define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400
81#define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800
82#define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000
83
84#define OMAPFB_MEMTYPE_SDRAM 0
85#define OMAPFB_MEMTYPE_SRAM 1
86#define OMAPFB_MEMTYPE_MAX 1
87
88enum omapfb_color_format {
89 OMAPFB_COLOR_RGB565 = 0,
90 OMAPFB_COLOR_YUV422,
91 OMAPFB_COLOR_YUV420,
92 OMAPFB_COLOR_CLUT_8BPP,
93 OMAPFB_COLOR_CLUT_4BPP,
94 OMAPFB_COLOR_CLUT_2BPP,
95 OMAPFB_COLOR_CLUT_1BPP,
96 OMAPFB_COLOR_RGB444,
97 OMAPFB_COLOR_YUY422,
Tomi Valkeinenb39a982d2009-08-04 16:12:50 +030098
99 OMAPFB_COLOR_ARGB16,
100 OMAPFB_COLOR_RGB24U, /* RGB24, 32-bit container */
101 OMAPFB_COLOR_RGB24P, /* RGB24, 24-bit container */
102 OMAPFB_COLOR_ARGB32,
103 OMAPFB_COLOR_RGBA32,
104 OMAPFB_COLOR_RGBX32,
Tomi Valkeinen91773a02009-08-03 15:06:36 +0300105};
106
107struct omapfb_update_window {
108 __u32 x, y;
109 __u32 width, height;
110 __u32 format;
111 __u32 out_x, out_y;
112 __u32 out_width, out_height;
113 __u32 reserved[8];
114};
115
116struct omapfb_update_window_old {
117 __u32 x, y;
118 __u32 width, height;
119 __u32 format;
120};
121
122enum omapfb_plane {
123 OMAPFB_PLANE_GFX = 0,
124 OMAPFB_PLANE_VID1,
125 OMAPFB_PLANE_VID2,
126};
127
128enum omapfb_channel_out {
129 OMAPFB_CHANNEL_OUT_LCD = 0,
130 OMAPFB_CHANNEL_OUT_DIGIT,
131};
132
133struct omapfb_plane_info {
134 __u32 pos_x;
135 __u32 pos_y;
136 __u8 enabled;
137 __u8 channel_out;
138 __u8 mirror;
139 __u8 reserved1;
140 __u32 out_width;
141 __u32 out_height;
142 __u32 reserved2[12];
143};
144
145struct omapfb_mem_info {
146 __u32 size;
147 __u8 type;
148 __u8 reserved[3];
149};
150
151struct omapfb_caps {
152 __u32 ctrl;
153 __u32 plane_color;
154 __u32 wnd_color;
155};
156
157enum omapfb_color_key_type {
158 OMAPFB_COLOR_KEY_DISABLED = 0,
159 OMAPFB_COLOR_KEY_GFX_DST,
160 OMAPFB_COLOR_KEY_VID_SRC,
161};
162
163struct omapfb_color_key {
164 __u8 channel_out;
165 __u32 background;
166 __u32 trans_key;
167 __u8 key_type;
168};
169
170enum omapfb_update_mode {
171 OMAPFB_UPDATE_DISABLED = 0,
172 OMAPFB_AUTO_UPDATE,
173 OMAPFB_MANUAL_UPDATE
174};
175
Tomi Valkeinenb39a982d2009-08-04 16:12:50 +0300176struct omapfb_memory_read {
177 __u16 x;
178 __u16 y;
179 __u16 w;
180 __u16 h;
181 size_t buffer_size;
182 void __user *buffer;
183};
184
185struct omapfb_ovl_colormode {
186 __u8 overlay_idx;
187 __u8 mode_idx;
188 __u32 bits_per_pixel;
189 __u32 nonstd;
190 struct fb_bitfield red;
191 struct fb_bitfield green;
192 struct fb_bitfield blue;
193 struct fb_bitfield transp;
194};
195
196struct omapfb_vram_info {
197 __u32 total;
198 __u32 free;
199 __u32 largest_free_block;
200 __u32 reserved[5];
201};
202
203struct omapfb_tearsync_info {
204 __u8 enabled;
205 __u8 reserved1[3];
206 __u16 line;
207 __u16 reserved2;
208};
209
Tomi Valkeinen6dd2e422010-01-14 17:32:13 +0200210struct omapfb_display_info {
211 __u16 xres;
212 __u16 yres;
213 __u32 width; /* phys width of the display in micrometers */
214 __u32 height; /* phys height of the display in micrometers */
215 __u32 reserved[5];
216};
217
Tomi Valkeinen91773a02009-08-03 15:06:36 +0300218#ifdef __KERNEL__
219
220#include <plat/board.h>
221
222#ifdef CONFIG_ARCH_OMAP1
223#define OMAPFB_PLANE_NUM 1
224#else
225#define OMAPFB_PLANE_NUM 3
226#endif
227
228struct omapfb_mem_region {
229 u32 paddr;
230 void __iomem *vaddr;
231 unsigned long size;
232 u8 type; /* OMAPFB_PLANE_MEM_* */
Tomi Valkeinenb39a982d2009-08-04 16:12:50 +0300233 enum omapfb_color_format format;/* OMAPFB_COLOR_* */
234 unsigned format_used:1; /* Must be set when format is set.
235 * Needed b/c of the badly chosen 0
236 * base for OMAPFB_COLOR_* values
237 */
Tomi Valkeinen91773a02009-08-03 15:06:36 +0300238 unsigned alloc:1; /* allocated by the driver */
239 unsigned map:1; /* kernel mapped by the driver */
240};
241
242struct omapfb_mem_desc {
243 int region_cnt;
244 struct omapfb_mem_region region[OMAPFB_PLANE_NUM];
245};
246
247struct omapfb_platform_data {
248 struct omap_lcd_config lcd;
249 struct omapfb_mem_desc mem_desc;
250 void *ctrl_platform_data;
251};
252
253/* in arch/arm/plat-omap/fb.c */
Tomi Valkeinenb39a982d2009-08-04 16:12:50 +0300254extern void omapfb_set_platform_data(struct omapfb_platform_data *data);
Tomi Valkeinen91773a02009-08-03 15:06:36 +0300255extern void omapfb_set_ctrl_platform_data(void *pdata);
Russell King98864ff2010-05-22 23:59:11 +0100256extern void omapfb_reserve_sdram_memblock(void);
Tomi Valkeinen91773a02009-08-03 15:06:36 +0300257
258#endif
259
260#endif /* __OMAPFB_H */