xref: /linux/include/uapi/video/sisfb.h (revision 24bce201d79807b668bf9d9e0aca801c5c0d5f78)
1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*
3  * sisfb.h - definitions for the SiS framebuffer driver
4  *
5  * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the named License,
10  * or any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
20  */
21 
22 #ifndef _UAPI_LINUX_SISFB_H_
23 #define _UAPI_LINUX_SISFB_H_
24 
25 #include <linux/types.h>
26 #include <asm/ioctl.h>
27 
28 /**********************************************/
29 /*                   PUBLIC                   */
30 /**********************************************/
31 
32 /* vbflags, public (others in sis.h) */
33 #define CRT2_DEFAULT		0x00000001
34 #define CRT2_LCD		0x00000002
35 #define CRT2_TV			0x00000004
36 #define CRT2_VGA		0x00000008
37 #define TV_NTSC			0x00000010
38 #define TV_PAL			0x00000020
39 #define TV_HIVISION		0x00000040
40 #define TV_YPBPR		0x00000080
41 #define TV_AVIDEO		0x00000100
42 #define TV_SVIDEO		0x00000200
43 #define TV_SCART		0x00000400
44 #define TV_PALM			0x00001000
45 #define TV_PALN			0x00002000
46 #define TV_NTSCJ		0x00001000
47 #define TV_CHSCART		0x00008000
48 #define TV_CHYPBPR525I		0x00010000
49 #define CRT1_VGA		0x00000000
50 #define CRT1_LCDA		0x00020000
51 #define VGA2_CONNECTED          0x00040000
52 #define VB_DISPTYPE_CRT1	0x00080000	/* CRT1 connected and used */
53 #define VB_SINGLE_MODE		0x20000000	/* CRT1 or CRT2; determined by DISPTYPE_CRTx */
54 #define VB_MIRROR_MODE		0x40000000	/* CRT1 + CRT2 identical (mirror mode) */
55 #define VB_DUALVIEW_MODE	0x80000000	/* CRT1 + CRT2 independent (dual head mode) */
56 
57 /* Aliases: */
58 #define CRT2_ENABLE		(CRT2_LCD | CRT2_TV | CRT2_VGA)
59 #define TV_STANDARD		(TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ)
60 #define TV_INTERFACE		(TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_CHSCART|TV_CHYPBPR525I)
61 
62 /* Only if TV_YPBPR is set: */
63 #define TV_YPBPR525I		TV_NTSC
64 #define TV_YPBPR525P		TV_PAL
65 #define TV_YPBPR750P		TV_PALM
66 #define TV_YPBPR1080I		TV_PALN
67 #define TV_YPBPRALL 		(TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I)
68 
69 #define VB_DISPTYPE_DISP2	CRT2_ENABLE
70 #define VB_DISPTYPE_CRT2	CRT2_ENABLE
71 #define VB_DISPTYPE_DISP1	VB_DISPTYPE_CRT1
72 #define VB_DISPMODE_SINGLE	VB_SINGLE_MODE
73 #define VB_DISPMODE_MIRROR	VB_MIRROR_MODE
74 #define VB_DISPMODE_DUAL	VB_DUALVIEW_MODE
75 #define VB_DISPLAY_MODE		(SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE)
76 
77 /* Structure argument for SISFB_GET_INFO ioctl  */
78 struct sisfb_info {
79 	__u32	sisfb_id;		/* for identifying sisfb */
80 #ifndef SISFB_ID
81 #define SISFB_ID	  0x53495346    /* Identify myself with 'SISF' */
82 #endif
83 	__u32   chip_id;		/* PCI-ID of detected chip */
84 	__u32   memory;			/* total video memory in KB */
85 	__u32   heapstart;		/* heap start offset in KB */
86 	__u8    fbvidmode;		/* current sisfb mode */
87 
88 	__u8	sisfb_version;
89 	__u8	sisfb_revision;
90 	__u8	sisfb_patchlevel;
91 
92 	__u8	sisfb_caps;		/* sisfb capabilities */
93 
94 	__u32	sisfb_tqlen;		/* turbo queue length (in KB) */
95 
96 	__u32	sisfb_pcibus;		/* The card's PCI ID */
97 	__u32	sisfb_pcislot;
98 	__u32	sisfb_pcifunc;
99 
100 	__u8	sisfb_lcdpdc;		/* PanelDelayCompensation */
101 
102 	__u8	sisfb_lcda;		/* Detected status of LCDA for low res/text modes */
103 
104 	__u32	sisfb_vbflags;
105 	__u32	sisfb_currentvbflags;
106 
107 	__u32	sisfb_scalelcd;
108 	__u32	sisfb_specialtiming;
109 
110 	__u8	sisfb_haveemi;
111 	__u8	sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33;
112 	__u8	sisfb_haveemilcd;
113 
114 	__u8	sisfb_lcdpdca;		/* PanelDelayCompensation for LCD-via-CRT1 */
115 
116 	__u16	sisfb_tvxpos, sisfb_tvypos;	/* Warning: Values + 32 ! */
117 
118 	__u32	sisfb_heapsize;		/* heap size (in KB) */
119 	__u32	sisfb_videooffset;	/* Offset of viewport in video memory (in bytes) */
120 
121 	__u32	sisfb_curfstn;		/* currently running FSTN/DSTN mode */
122 	__u32	sisfb_curdstn;
123 
124 	__u16	sisfb_pci_vendor;	/* PCI vendor (SiS or XGI) */
125 
126 	__u32	sisfb_vbflags2;		/* ivideo->vbflags2 */
127 
128 	__u8	sisfb_can_post;		/* sisfb can POST this card */
129 	__u8	sisfb_card_posted;	/* card is POSTED */
130 	__u8	sisfb_was_boot_device;	/* This card was the boot video device (ie is primary) */
131 
132 	__u8	reserved[183];		/* for future use */
133 };
134 
135 #define SISFB_CMD_GETVBFLAGS	0x55AA0001	/* no arg; result[1] = vbflags */
136 #define SISFB_CMD_SWITCHCRT1	0x55AA0010	/* arg[0]: 99 = query, 0 = off, 1 = on */
137 /* more to come */
138 
139 #define SISFB_CMD_ERR_OK	0x80000000	/* command succeeded */
140 #define SISFB_CMD_ERR_LOCKED	0x80000001	/* sisfb is locked */
141 #define SISFB_CMD_ERR_EARLY	0x80000002	/* request before sisfb took over gfx system */
142 #define SISFB_CMD_ERR_NOVB	0x80000003	/* No video bridge */
143 #define SISFB_CMD_ERR_NOCRT2	0x80000004	/* can't change CRT1 status, CRT2 disabled */
144 /* more to come */
145 #define SISFB_CMD_ERR_UNKNOWN   0x8000ffff	/* Unknown command */
146 #define SISFB_CMD_ERR_OTHER	0x80010000	/* Other error */
147 
148 /* Argument for SISFB_CMD ioctl */
149 struct sisfb_cmd {
150 	__u32  sisfb_cmd;
151 	__u32  sisfb_arg[16];
152 	__u32  sisfb_result[4];
153 };
154 
155 /* Additional IOCTLs for communication sisfb <> X driver                */
156 /* If changing this, vgatypes.h must also be changed (for X driver)    */
157 
158 /* ioctl for identifying and giving some info (esp. memory heap start) */
159 #define SISFB_GET_INFO_SIZE	_IOR(0xF3,0x00,__u32)
160 #define SISFB_GET_INFO		_IOR(0xF3,0x01,struct sisfb_info)
161 
162 /* ioctrl to get current vertical retrace status */
163 #define SISFB_GET_VBRSTATUS	_IOR(0xF3,0x02,__u32)
164 
165 /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */
166 #define SISFB_GET_AUTOMAXIMIZE	_IOR(0xF3,0x03,__u32)
167 #define SISFB_SET_AUTOMAXIMIZE	_IOW(0xF3,0x03,__u32)
168 
169 /* ioctls to relocate TV output (x=D[31:16], y=D[15:0], + 32)*/
170 #define SISFB_GET_TVPOSOFFSET	_IOR(0xF3,0x04,__u32)
171 #define SISFB_SET_TVPOSOFFSET	_IOW(0xF3,0x04,__u32)
172 
173 /* ioctl for internal sisfb commands (sisfbctrl) */
174 #define SISFB_COMMAND		_IOWR(0xF3,0x05,struct sisfb_cmd)
175 
176 /* ioctl for locking sisfb (no register access during lock) */
177 /* As of now, only used to avoid register access during
178  * the ioctls listed above.
179  */
180 #define SISFB_SET_LOCK		_IOW(0xF3,0x06,__u32)
181 
182 /* ioctls 0xF3 up to 0x3F reserved for sisfb */
183 
184 /****************************************************************/
185 /* The following are deprecated and should not be used anymore: */
186 /****************************************************************/
187 /* ioctl for identifying and giving some info (esp. memory heap start) */
188 #define SISFB_GET_INFO_OLD	   _IOR('n',0xF8,__u32)
189 /* ioctrl to get current vertical retrace status */
190 #define SISFB_GET_VBRSTATUS_OLD	   _IOR('n',0xF9,__u32)
191 /* ioctl to enable/disable panning auto-maximize (like nomax parameter) */
192 #define SISFB_GET_AUTOMAXIMIZE_OLD _IOR('n',0xFA,__u32)
193 #define SISFB_SET_AUTOMAXIMIZE_OLD _IOW('n',0xFA,__u32)
194 /****************************************************************/
195 /*               End of deprecated ioctl numbers                */
196 /****************************************************************/
197 
198 /* For fb memory manager (FBIO_ALLOC, FBIO_FREE) */
199 struct sis_memreq {
200 	__u32	offset;
201 	__u32	size;
202 };
203 
204 /**********************************************/
205 /*                  PRIVATE                   */
206 /*         (for IN-KERNEL usage only)         */
207 /**********************************************/
208 
209 
210 #endif /* _UAPI_LINUX_SISFB_H_ */
211