18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * File: include/linux/omapfb.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Framebuffer driver for TI OMAP boards
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2004 Nokia Corporation
88c2ecf20Sopenharmony_ci * Author: Imre Deak <imre.deak@nokia.com>
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it
118c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License as published by the
128c2ecf20Sopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your
138c2ecf20Sopenharmony_ci * option) any later version.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but
168c2ecf20Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of
178c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
188c2ecf20Sopenharmony_ci * General Public License for more details.
198c2ecf20Sopenharmony_ci *
208c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License along
218c2ecf20Sopenharmony_ci * with this program; if not, write to the Free Software Foundation, Inc.,
228c2ecf20Sopenharmony_ci * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#ifndef _UAPI__LINUX_OMAPFB_H__
268c2ecf20Sopenharmony_ci#define _UAPI__LINUX_OMAPFB_H__
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#include <linux/fb.h>
298c2ecf20Sopenharmony_ci#include <linux/ioctl.h>
308c2ecf20Sopenharmony_ci#include <linux/types.h>
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/* IOCTL commands. */
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define OMAP_IOW(num, dtype)	_IOW('O', num, dtype)
358c2ecf20Sopenharmony_ci#define OMAP_IOR(num, dtype)	_IOR('O', num, dtype)
368c2ecf20Sopenharmony_ci#define OMAP_IOWR(num, dtype)	_IOWR('O', num, dtype)
378c2ecf20Sopenharmony_ci#define OMAP_IO(num)		_IO('O', num)
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#define OMAPFB_MIRROR		OMAP_IOW(31, int)
408c2ecf20Sopenharmony_ci#define OMAPFB_SYNC_GFX		OMAP_IO(37)
418c2ecf20Sopenharmony_ci#define OMAPFB_VSYNC		OMAP_IO(38)
428c2ecf20Sopenharmony_ci#define OMAPFB_SET_UPDATE_MODE	OMAP_IOW(40, int)
438c2ecf20Sopenharmony_ci#define OMAPFB_GET_CAPS		OMAP_IOR(42, struct omapfb_caps)
448c2ecf20Sopenharmony_ci#define OMAPFB_GET_UPDATE_MODE	OMAP_IOW(43, int)
458c2ecf20Sopenharmony_ci#define OMAPFB_LCD_TEST		OMAP_IOW(45, int)
468c2ecf20Sopenharmony_ci#define OMAPFB_CTRL_TEST	OMAP_IOW(46, int)
478c2ecf20Sopenharmony_ci#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
488c2ecf20Sopenharmony_ci#define OMAPFB_SET_COLOR_KEY	OMAP_IOW(50, struct omapfb_color_key)
498c2ecf20Sopenharmony_ci#define OMAPFB_GET_COLOR_KEY	OMAP_IOW(51, struct omapfb_color_key)
508c2ecf20Sopenharmony_ci#define OMAPFB_SETUP_PLANE	OMAP_IOW(52, struct omapfb_plane_info)
518c2ecf20Sopenharmony_ci#define OMAPFB_QUERY_PLANE	OMAP_IOW(53, struct omapfb_plane_info)
528c2ecf20Sopenharmony_ci#define OMAPFB_UPDATE_WINDOW	OMAP_IOW(54, struct omapfb_update_window)
538c2ecf20Sopenharmony_ci#define OMAPFB_SETUP_MEM	OMAP_IOW(55, struct omapfb_mem_info)
548c2ecf20Sopenharmony_ci#define OMAPFB_QUERY_MEM	OMAP_IOW(56, struct omapfb_mem_info)
558c2ecf20Sopenharmony_ci#define OMAPFB_WAITFORVSYNC	OMAP_IO(57)
568c2ecf20Sopenharmony_ci#define OMAPFB_MEMORY_READ	OMAP_IOR(58, struct omapfb_memory_read)
578c2ecf20Sopenharmony_ci#define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode)
588c2ecf20Sopenharmony_ci#define OMAPFB_WAITFORGO	OMAP_IO(60)
598c2ecf20Sopenharmony_ci#define OMAPFB_GET_VRAM_INFO	OMAP_IOR(61, struct omapfb_vram_info)
608c2ecf20Sopenharmony_ci#define OMAPFB_SET_TEARSYNC	OMAP_IOW(62, struct omapfb_tearsync_info)
618c2ecf20Sopenharmony_ci#define OMAPFB_GET_DISPLAY_INFO	OMAP_IOR(63, struct omapfb_display_info)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#define OMAPFB_CAPS_GENERIC_MASK	0x00000fff
648c2ecf20Sopenharmony_ci#define OMAPFB_CAPS_LCDC_MASK		0x00fff000
658c2ecf20Sopenharmony_ci#define OMAPFB_CAPS_PANEL_MASK		0xff000000
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define OMAPFB_CAPS_MANUAL_UPDATE	0x00001000
688c2ecf20Sopenharmony_ci#define OMAPFB_CAPS_TEARSYNC		0x00002000
698c2ecf20Sopenharmony_ci#define OMAPFB_CAPS_PLANE_RELOCATE_MEM	0x00004000
708c2ecf20Sopenharmony_ci#define OMAPFB_CAPS_PLANE_SCALE		0x00008000
718c2ecf20Sopenharmony_ci#define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE	0x00010000
728c2ecf20Sopenharmony_ci#define OMAPFB_CAPS_WINDOW_SCALE	0x00020000
738c2ecf20Sopenharmony_ci#define OMAPFB_CAPS_WINDOW_OVERLAY	0x00040000
748c2ecf20Sopenharmony_ci#define OMAPFB_CAPS_WINDOW_ROTATE	0x00080000
758c2ecf20Sopenharmony_ci#define OMAPFB_CAPS_SET_BACKLIGHT	0x01000000
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/* Values from DSP must map to lower 16-bits */
788c2ecf20Sopenharmony_ci#define OMAPFB_FORMAT_MASK		0x00ff
798c2ecf20Sopenharmony_ci#define OMAPFB_FORMAT_FLAG_DOUBLE	0x0100
808c2ecf20Sopenharmony_ci#define OMAPFB_FORMAT_FLAG_TEARSYNC	0x0200
818c2ecf20Sopenharmony_ci#define OMAPFB_FORMAT_FLAG_FORCE_VSYNC	0x0400
828c2ecf20Sopenharmony_ci#define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY	0x0800
838c2ecf20Sopenharmony_ci#define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY	0x1000
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci#define OMAPFB_MEMTYPE_SDRAM		0
868c2ecf20Sopenharmony_ci#define OMAPFB_MEMTYPE_SRAM		1
878c2ecf20Sopenharmony_ci#define OMAPFB_MEMTYPE_MAX		1
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#define OMAPFB_MEM_IDX_ENABLED	0x80
908c2ecf20Sopenharmony_ci#define OMAPFB_MEM_IDX_MASK	0x7f
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_cienum omapfb_color_format {
938c2ecf20Sopenharmony_ci	OMAPFB_COLOR_RGB565 = 0,
948c2ecf20Sopenharmony_ci	OMAPFB_COLOR_YUV422,
958c2ecf20Sopenharmony_ci	OMAPFB_COLOR_YUV420,
968c2ecf20Sopenharmony_ci	OMAPFB_COLOR_CLUT_8BPP,
978c2ecf20Sopenharmony_ci	OMAPFB_COLOR_CLUT_4BPP,
988c2ecf20Sopenharmony_ci	OMAPFB_COLOR_CLUT_2BPP,
998c2ecf20Sopenharmony_ci	OMAPFB_COLOR_CLUT_1BPP,
1008c2ecf20Sopenharmony_ci	OMAPFB_COLOR_RGB444,
1018c2ecf20Sopenharmony_ci	OMAPFB_COLOR_YUY422,
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci	OMAPFB_COLOR_ARGB16,
1048c2ecf20Sopenharmony_ci	OMAPFB_COLOR_RGB24U,	/* RGB24, 32-bit container */
1058c2ecf20Sopenharmony_ci	OMAPFB_COLOR_RGB24P,	/* RGB24, 24-bit container */
1068c2ecf20Sopenharmony_ci	OMAPFB_COLOR_ARGB32,
1078c2ecf20Sopenharmony_ci	OMAPFB_COLOR_RGBA32,
1088c2ecf20Sopenharmony_ci	OMAPFB_COLOR_RGBX32,
1098c2ecf20Sopenharmony_ci};
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_cistruct omapfb_update_window {
1128c2ecf20Sopenharmony_ci	__u32 x, y;
1138c2ecf20Sopenharmony_ci	__u32 width, height;
1148c2ecf20Sopenharmony_ci	__u32 format;
1158c2ecf20Sopenharmony_ci	__u32 out_x, out_y;
1168c2ecf20Sopenharmony_ci	__u32 out_width, out_height;
1178c2ecf20Sopenharmony_ci	__u32 reserved[8];
1188c2ecf20Sopenharmony_ci};
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_cistruct omapfb_update_window_old {
1218c2ecf20Sopenharmony_ci	__u32 x, y;
1228c2ecf20Sopenharmony_ci	__u32 width, height;
1238c2ecf20Sopenharmony_ci	__u32 format;
1248c2ecf20Sopenharmony_ci};
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_cienum omapfb_plane {
1278c2ecf20Sopenharmony_ci	OMAPFB_PLANE_GFX = 0,
1288c2ecf20Sopenharmony_ci	OMAPFB_PLANE_VID1,
1298c2ecf20Sopenharmony_ci	OMAPFB_PLANE_VID2,
1308c2ecf20Sopenharmony_ci};
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_cienum omapfb_channel_out {
1338c2ecf20Sopenharmony_ci	OMAPFB_CHANNEL_OUT_LCD = 0,
1348c2ecf20Sopenharmony_ci	OMAPFB_CHANNEL_OUT_DIGIT,
1358c2ecf20Sopenharmony_ci};
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_cistruct omapfb_plane_info {
1388c2ecf20Sopenharmony_ci	__u32 pos_x;
1398c2ecf20Sopenharmony_ci	__u32 pos_y;
1408c2ecf20Sopenharmony_ci	__u8  enabled;
1418c2ecf20Sopenharmony_ci	__u8  channel_out;
1428c2ecf20Sopenharmony_ci	__u8  mirror;
1438c2ecf20Sopenharmony_ci	__u8  mem_idx;
1448c2ecf20Sopenharmony_ci	__u32 out_width;
1458c2ecf20Sopenharmony_ci	__u32 out_height;
1468c2ecf20Sopenharmony_ci	__u32 reserved2[12];
1478c2ecf20Sopenharmony_ci};
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_cistruct omapfb_mem_info {
1508c2ecf20Sopenharmony_ci	__u32 size;
1518c2ecf20Sopenharmony_ci	__u8  type;
1528c2ecf20Sopenharmony_ci	__u8  reserved[3];
1538c2ecf20Sopenharmony_ci};
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_cistruct omapfb_caps {
1568c2ecf20Sopenharmony_ci	__u32 ctrl;
1578c2ecf20Sopenharmony_ci	__u32 plane_color;
1588c2ecf20Sopenharmony_ci	__u32 wnd_color;
1598c2ecf20Sopenharmony_ci};
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_cienum omapfb_color_key_type {
1628c2ecf20Sopenharmony_ci	OMAPFB_COLOR_KEY_DISABLED = 0,
1638c2ecf20Sopenharmony_ci	OMAPFB_COLOR_KEY_GFX_DST,
1648c2ecf20Sopenharmony_ci	OMAPFB_COLOR_KEY_VID_SRC,
1658c2ecf20Sopenharmony_ci};
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_cistruct omapfb_color_key {
1688c2ecf20Sopenharmony_ci	__u8  channel_out;
1698c2ecf20Sopenharmony_ci	__u32 background;
1708c2ecf20Sopenharmony_ci	__u32 trans_key;
1718c2ecf20Sopenharmony_ci	__u8  key_type;
1728c2ecf20Sopenharmony_ci};
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_cienum omapfb_update_mode {
1758c2ecf20Sopenharmony_ci	OMAPFB_UPDATE_DISABLED = 0,
1768c2ecf20Sopenharmony_ci	OMAPFB_AUTO_UPDATE,
1778c2ecf20Sopenharmony_ci	OMAPFB_MANUAL_UPDATE
1788c2ecf20Sopenharmony_ci};
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_cistruct omapfb_memory_read {
1818c2ecf20Sopenharmony_ci	__u16 x;
1828c2ecf20Sopenharmony_ci	__u16 y;
1838c2ecf20Sopenharmony_ci	__u16 w;
1848c2ecf20Sopenharmony_ci	__u16 h;
1858c2ecf20Sopenharmony_ci	size_t buffer_size;
1868c2ecf20Sopenharmony_ci	void __user *buffer;
1878c2ecf20Sopenharmony_ci};
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_cistruct omapfb_ovl_colormode {
1908c2ecf20Sopenharmony_ci	__u8 overlay_idx;
1918c2ecf20Sopenharmony_ci	__u8 mode_idx;
1928c2ecf20Sopenharmony_ci	__u32 bits_per_pixel;
1938c2ecf20Sopenharmony_ci	__u32 nonstd;
1948c2ecf20Sopenharmony_ci	struct fb_bitfield red;
1958c2ecf20Sopenharmony_ci	struct fb_bitfield green;
1968c2ecf20Sopenharmony_ci	struct fb_bitfield blue;
1978c2ecf20Sopenharmony_ci	struct fb_bitfield transp;
1988c2ecf20Sopenharmony_ci};
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_cistruct omapfb_vram_info {
2018c2ecf20Sopenharmony_ci	__u32 total;
2028c2ecf20Sopenharmony_ci	__u32 free;
2038c2ecf20Sopenharmony_ci	__u32 largest_free_block;
2048c2ecf20Sopenharmony_ci	__u32 reserved[5];
2058c2ecf20Sopenharmony_ci};
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_cistruct omapfb_tearsync_info {
2088c2ecf20Sopenharmony_ci	__u8 enabled;
2098c2ecf20Sopenharmony_ci	__u8 reserved1[3];
2108c2ecf20Sopenharmony_ci	__u16 line;
2118c2ecf20Sopenharmony_ci	__u16 reserved2;
2128c2ecf20Sopenharmony_ci};
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_cistruct omapfb_display_info {
2158c2ecf20Sopenharmony_ci	__u16 xres;
2168c2ecf20Sopenharmony_ci	__u16 yres;
2178c2ecf20Sopenharmony_ci	__u32 width;	/* phys width of the display in micrometers */
2188c2ecf20Sopenharmony_ci	__u32 height;	/* phys height of the display in micrometers */
2198c2ecf20Sopenharmony_ci	__u32 reserved[5];
2208c2ecf20Sopenharmony_ci};
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci#endif /* _UAPI__LINUX_OMAPFB_H__ */
224