xref: /linux/include/uapi/linux/omapfb.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2607ca46eSDavid Howells /*
3607ca46eSDavid Howells  * File: include/linux/omapfb.h
4607ca46eSDavid Howells  *
5607ca46eSDavid Howells  * Framebuffer driver for TI OMAP boards
6607ca46eSDavid Howells  *
7607ca46eSDavid Howells  * Copyright (C) 2004 Nokia Corporation
8607ca46eSDavid Howells  * Author: Imre Deak <imre.deak@nokia.com>
9607ca46eSDavid Howells  *
10607ca46eSDavid Howells  * This program is free software; you can redistribute it and/or modify it
11607ca46eSDavid Howells  * under the terms of the GNU General Public License as published by the
12607ca46eSDavid Howells  * Free Software Foundation; either version 2 of the License, or (at your
13607ca46eSDavid Howells  * option) any later version.
14607ca46eSDavid Howells  *
15607ca46eSDavid Howells  * This program is distributed in the hope that it will be useful, but
16607ca46eSDavid Howells  * WITHOUT ANY WARRANTY; without even the implied warranty of
17607ca46eSDavid Howells  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18607ca46eSDavid Howells  * General Public License for more details.
19607ca46eSDavid Howells  *
20607ca46eSDavid Howells  * You should have received a copy of the GNU General Public License along
21607ca46eSDavid Howells  * with this program; if not, write to the Free Software Foundation, Inc.,
22607ca46eSDavid Howells  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23607ca46eSDavid Howells  */
24607ca46eSDavid Howells 
25607ca46eSDavid Howells #ifndef _UAPI__LINUX_OMAPFB_H__
26607ca46eSDavid Howells #define _UAPI__LINUX_OMAPFB_H__
27607ca46eSDavid Howells 
28607ca46eSDavid Howells #include <linux/fb.h>
29607ca46eSDavid Howells #include <linux/ioctl.h>
30607ca46eSDavid Howells #include <linux/types.h>
31607ca46eSDavid Howells 
32607ca46eSDavid Howells /* IOCTL commands. */
33607ca46eSDavid Howells 
34607ca46eSDavid Howells #define OMAP_IOW(num, dtype)	_IOW('O', num, dtype)
35607ca46eSDavid Howells #define OMAP_IOR(num, dtype)	_IOR('O', num, dtype)
36607ca46eSDavid Howells #define OMAP_IOWR(num, dtype)	_IOWR('O', num, dtype)
37607ca46eSDavid Howells #define OMAP_IO(num)		_IO('O', num)
38607ca46eSDavid Howells 
39607ca46eSDavid Howells #define OMAPFB_MIRROR		OMAP_IOW(31, int)
40607ca46eSDavid Howells #define OMAPFB_SYNC_GFX		OMAP_IO(37)
41607ca46eSDavid Howells #define OMAPFB_VSYNC		OMAP_IO(38)
42607ca46eSDavid Howells #define OMAPFB_SET_UPDATE_MODE	OMAP_IOW(40, int)
43607ca46eSDavid Howells #define OMAPFB_GET_CAPS		OMAP_IOR(42, struct omapfb_caps)
44607ca46eSDavid Howells #define OMAPFB_GET_UPDATE_MODE	OMAP_IOW(43, int)
45607ca46eSDavid Howells #define OMAPFB_LCD_TEST		OMAP_IOW(45, int)
46607ca46eSDavid Howells #define OMAPFB_CTRL_TEST	OMAP_IOW(46, int)
47607ca46eSDavid Howells #define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
48607ca46eSDavid Howells #define OMAPFB_SET_COLOR_KEY	OMAP_IOW(50, struct omapfb_color_key)
49607ca46eSDavid Howells #define OMAPFB_GET_COLOR_KEY	OMAP_IOW(51, struct omapfb_color_key)
50607ca46eSDavid Howells #define OMAPFB_SETUP_PLANE	OMAP_IOW(52, struct omapfb_plane_info)
51607ca46eSDavid Howells #define OMAPFB_QUERY_PLANE	OMAP_IOW(53, struct omapfb_plane_info)
52607ca46eSDavid Howells #define OMAPFB_UPDATE_WINDOW	OMAP_IOW(54, struct omapfb_update_window)
53607ca46eSDavid Howells #define OMAPFB_SETUP_MEM	OMAP_IOW(55, struct omapfb_mem_info)
54607ca46eSDavid Howells #define OMAPFB_QUERY_MEM	OMAP_IOW(56, struct omapfb_mem_info)
55607ca46eSDavid Howells #define OMAPFB_WAITFORVSYNC	OMAP_IO(57)
56607ca46eSDavid Howells #define OMAPFB_MEMORY_READ	OMAP_IOR(58, struct omapfb_memory_read)
57607ca46eSDavid Howells #define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode)
58607ca46eSDavid Howells #define OMAPFB_WAITFORGO	OMAP_IO(60)
59607ca46eSDavid Howells #define OMAPFB_GET_VRAM_INFO	OMAP_IOR(61, struct omapfb_vram_info)
60607ca46eSDavid Howells #define OMAPFB_SET_TEARSYNC	OMAP_IOW(62, struct omapfb_tearsync_info)
61607ca46eSDavid Howells #define OMAPFB_GET_DISPLAY_INFO	OMAP_IOR(63, struct omapfb_display_info)
62607ca46eSDavid Howells 
63607ca46eSDavid Howells #define OMAPFB_CAPS_GENERIC_MASK	0x00000fff
64607ca46eSDavid Howells #define OMAPFB_CAPS_LCDC_MASK		0x00fff000
65607ca46eSDavid Howells #define OMAPFB_CAPS_PANEL_MASK		0xff000000
66607ca46eSDavid Howells 
67607ca46eSDavid Howells #define OMAPFB_CAPS_MANUAL_UPDATE	0x00001000
68607ca46eSDavid Howells #define OMAPFB_CAPS_TEARSYNC		0x00002000
69607ca46eSDavid Howells #define OMAPFB_CAPS_PLANE_RELOCATE_MEM	0x00004000
70607ca46eSDavid Howells #define OMAPFB_CAPS_PLANE_SCALE		0x00008000
71607ca46eSDavid Howells #define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE	0x00010000
72607ca46eSDavid Howells #define OMAPFB_CAPS_WINDOW_SCALE	0x00020000
73607ca46eSDavid Howells #define OMAPFB_CAPS_WINDOW_OVERLAY	0x00040000
74607ca46eSDavid Howells #define OMAPFB_CAPS_WINDOW_ROTATE	0x00080000
75607ca46eSDavid Howells #define OMAPFB_CAPS_SET_BACKLIGHT	0x01000000
76607ca46eSDavid Howells 
77607ca46eSDavid Howells /* Values from DSP must map to lower 16-bits */
78607ca46eSDavid Howells #define OMAPFB_FORMAT_MASK		0x00ff
79607ca46eSDavid Howells #define OMAPFB_FORMAT_FLAG_DOUBLE	0x0100
80607ca46eSDavid Howells #define OMAPFB_FORMAT_FLAG_TEARSYNC	0x0200
81607ca46eSDavid Howells #define OMAPFB_FORMAT_FLAG_FORCE_VSYNC	0x0400
82607ca46eSDavid Howells #define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY	0x0800
83607ca46eSDavid Howells #define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY	0x1000
84607ca46eSDavid Howells 
85607ca46eSDavid Howells #define OMAPFB_MEMTYPE_SDRAM		0
86607ca46eSDavid Howells #define OMAPFB_MEMTYPE_SRAM		1
87607ca46eSDavid Howells #define OMAPFB_MEMTYPE_MAX		1
88607ca46eSDavid Howells 
89607ca46eSDavid Howells #define OMAPFB_MEM_IDX_ENABLED	0x80
90607ca46eSDavid Howells #define OMAPFB_MEM_IDX_MASK	0x7f
91607ca46eSDavid Howells 
92607ca46eSDavid Howells enum omapfb_color_format {
93607ca46eSDavid Howells 	OMAPFB_COLOR_RGB565 = 0,
94607ca46eSDavid Howells 	OMAPFB_COLOR_YUV422,
95607ca46eSDavid Howells 	OMAPFB_COLOR_YUV420,
96607ca46eSDavid Howells 	OMAPFB_COLOR_CLUT_8BPP,
97607ca46eSDavid Howells 	OMAPFB_COLOR_CLUT_4BPP,
98607ca46eSDavid Howells 	OMAPFB_COLOR_CLUT_2BPP,
99607ca46eSDavid Howells 	OMAPFB_COLOR_CLUT_1BPP,
100607ca46eSDavid Howells 	OMAPFB_COLOR_RGB444,
101607ca46eSDavid Howells 	OMAPFB_COLOR_YUY422,
102607ca46eSDavid Howells 
103607ca46eSDavid Howells 	OMAPFB_COLOR_ARGB16,
104607ca46eSDavid Howells 	OMAPFB_COLOR_RGB24U,	/* RGB24, 32-bit container */
105607ca46eSDavid Howells 	OMAPFB_COLOR_RGB24P,	/* RGB24, 24-bit container */
106607ca46eSDavid Howells 	OMAPFB_COLOR_ARGB32,
107607ca46eSDavid Howells 	OMAPFB_COLOR_RGBA32,
108607ca46eSDavid Howells 	OMAPFB_COLOR_RGBX32,
109607ca46eSDavid Howells };
110607ca46eSDavid Howells 
111607ca46eSDavid Howells struct omapfb_update_window {
112607ca46eSDavid Howells 	__u32 x, y;
113607ca46eSDavid Howells 	__u32 width, height;
114607ca46eSDavid Howells 	__u32 format;
115607ca46eSDavid Howells 	__u32 out_x, out_y;
116607ca46eSDavid Howells 	__u32 out_width, out_height;
117607ca46eSDavid Howells 	__u32 reserved[8];
118607ca46eSDavid Howells };
119607ca46eSDavid Howells 
120607ca46eSDavid Howells struct omapfb_update_window_old {
121607ca46eSDavid Howells 	__u32 x, y;
122607ca46eSDavid Howells 	__u32 width, height;
123607ca46eSDavid Howells 	__u32 format;
124607ca46eSDavid Howells };
125607ca46eSDavid Howells 
126607ca46eSDavid Howells enum omapfb_plane {
127607ca46eSDavid Howells 	OMAPFB_PLANE_GFX = 0,
128607ca46eSDavid Howells 	OMAPFB_PLANE_VID1,
129607ca46eSDavid Howells 	OMAPFB_PLANE_VID2,
130607ca46eSDavid Howells };
131607ca46eSDavid Howells 
132607ca46eSDavid Howells enum omapfb_channel_out {
133607ca46eSDavid Howells 	OMAPFB_CHANNEL_OUT_LCD = 0,
134607ca46eSDavid Howells 	OMAPFB_CHANNEL_OUT_DIGIT,
135607ca46eSDavid Howells };
136607ca46eSDavid Howells 
137607ca46eSDavid Howells struct omapfb_plane_info {
138607ca46eSDavid Howells 	__u32 pos_x;
139607ca46eSDavid Howells 	__u32 pos_y;
140607ca46eSDavid Howells 	__u8  enabled;
141607ca46eSDavid Howells 	__u8  channel_out;
142607ca46eSDavid Howells 	__u8  mirror;
143607ca46eSDavid Howells 	__u8  mem_idx;
144607ca46eSDavid Howells 	__u32 out_width;
145607ca46eSDavid Howells 	__u32 out_height;
146607ca46eSDavid Howells 	__u32 reserved2[12];
147607ca46eSDavid Howells };
148607ca46eSDavid Howells 
149607ca46eSDavid Howells struct omapfb_mem_info {
150607ca46eSDavid Howells 	__u32 size;
151607ca46eSDavid Howells 	__u8  type;
152607ca46eSDavid Howells 	__u8  reserved[3];
153607ca46eSDavid Howells };
154607ca46eSDavid Howells 
155607ca46eSDavid Howells struct omapfb_caps {
156607ca46eSDavid Howells 	__u32 ctrl;
157607ca46eSDavid Howells 	__u32 plane_color;
158607ca46eSDavid Howells 	__u32 wnd_color;
159607ca46eSDavid Howells };
160607ca46eSDavid Howells 
161607ca46eSDavid Howells enum omapfb_color_key_type {
162607ca46eSDavid Howells 	OMAPFB_COLOR_KEY_DISABLED = 0,
163607ca46eSDavid Howells 	OMAPFB_COLOR_KEY_GFX_DST,
164607ca46eSDavid Howells 	OMAPFB_COLOR_KEY_VID_SRC,
165607ca46eSDavid Howells };
166607ca46eSDavid Howells 
167607ca46eSDavid Howells struct omapfb_color_key {
168607ca46eSDavid Howells 	__u8  channel_out;
169607ca46eSDavid Howells 	__u32 background;
170607ca46eSDavid Howells 	__u32 trans_key;
171607ca46eSDavid Howells 	__u8  key_type;
172607ca46eSDavid Howells };
173607ca46eSDavid Howells 
174607ca46eSDavid Howells enum omapfb_update_mode {
175607ca46eSDavid Howells 	OMAPFB_UPDATE_DISABLED = 0,
176607ca46eSDavid Howells 	OMAPFB_AUTO_UPDATE,
177607ca46eSDavid Howells 	OMAPFB_MANUAL_UPDATE
178607ca46eSDavid Howells };
179607ca46eSDavid Howells 
180607ca46eSDavid Howells struct omapfb_memory_read {
181607ca46eSDavid Howells 	__u16 x;
182607ca46eSDavid Howells 	__u16 y;
183607ca46eSDavid Howells 	__u16 w;
184607ca46eSDavid Howells 	__u16 h;
185607ca46eSDavid Howells 	size_t buffer_size;
186607ca46eSDavid Howells 	void __user *buffer;
187607ca46eSDavid Howells };
188607ca46eSDavid Howells 
189607ca46eSDavid Howells struct omapfb_ovl_colormode {
190607ca46eSDavid Howells 	__u8 overlay_idx;
191607ca46eSDavid Howells 	__u8 mode_idx;
192607ca46eSDavid Howells 	__u32 bits_per_pixel;
193607ca46eSDavid Howells 	__u32 nonstd;
194607ca46eSDavid Howells 	struct fb_bitfield red;
195607ca46eSDavid Howells 	struct fb_bitfield green;
196607ca46eSDavid Howells 	struct fb_bitfield blue;
197607ca46eSDavid Howells 	struct fb_bitfield transp;
198607ca46eSDavid Howells };
199607ca46eSDavid Howells 
200607ca46eSDavid Howells struct omapfb_vram_info {
201607ca46eSDavid Howells 	__u32 total;
202607ca46eSDavid Howells 	__u32 free;
203607ca46eSDavid Howells 	__u32 largest_free_block;
204607ca46eSDavid Howells 	__u32 reserved[5];
205607ca46eSDavid Howells };
206607ca46eSDavid Howells 
207607ca46eSDavid Howells struct omapfb_tearsync_info {
208607ca46eSDavid Howells 	__u8 enabled;
209607ca46eSDavid Howells 	__u8 reserved1[3];
210607ca46eSDavid Howells 	__u16 line;
211607ca46eSDavid Howells 	__u16 reserved2;
212607ca46eSDavid Howells };
213607ca46eSDavid Howells 
214607ca46eSDavid Howells struct omapfb_display_info {
215607ca46eSDavid Howells 	__u16 xres;
216607ca46eSDavid Howells 	__u16 yres;
217607ca46eSDavid Howells 	__u32 width;	/* phys width of the display in micrometers */
218607ca46eSDavid Howells 	__u32 height;	/* phys height of the display in micrometers */
219607ca46eSDavid Howells 	__u32 reserved[5];
220607ca46eSDavid Howells };
221607ca46eSDavid Howells 
222607ca46eSDavid Howells 
223607ca46eSDavid Howells #endif /* _UAPI__LINUX_OMAPFB_H__ */
224