18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
28c2ecf20Sopenharmony_ci/* $XFree86$ */
38c2ecf20Sopenharmony_ci/* $XdotOrg$ */
48c2ecf20Sopenharmony_ci/*
58c2ecf20Sopenharmony_ci * Data and prototypes for init.c
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * If distributed as part of the Linux kernel, the following license terms
108c2ecf20Sopenharmony_ci * apply:
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * * This program is free software; you can redistribute it and/or modify
138c2ecf20Sopenharmony_ci * * it under the terms of the GNU General Public License as published by
148c2ecf20Sopenharmony_ci * * the Free Software Foundation; either version 2 of the named License,
158c2ecf20Sopenharmony_ci * * or any later version.
168c2ecf20Sopenharmony_ci * *
178c2ecf20Sopenharmony_ci * * This program is distributed in the hope that it will be useful,
188c2ecf20Sopenharmony_ci * * but WITHOUT ANY WARRANTY; without even the implied warranty of
198c2ecf20Sopenharmony_ci * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
208c2ecf20Sopenharmony_ci * * GNU General Public License for more details.
218c2ecf20Sopenharmony_ci * *
228c2ecf20Sopenharmony_ci * * You should have received a copy of the GNU General Public License
238c2ecf20Sopenharmony_ci * * along with this program; if not, write to the Free Software
248c2ecf20Sopenharmony_ci * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
258c2ecf20Sopenharmony_ci *
268c2ecf20Sopenharmony_ci * Otherwise, the following license terms apply:
278c2ecf20Sopenharmony_ci *
288c2ecf20Sopenharmony_ci * * Redistribution and use in source and binary forms, with or without
298c2ecf20Sopenharmony_ci * * modification, are permitted provided that the following conditions
308c2ecf20Sopenharmony_ci * * are met:
318c2ecf20Sopenharmony_ci * * 1) Redistributions of source code must retain the above copyright
328c2ecf20Sopenharmony_ci * *    notice, this list of conditions and the following disclaimer.
338c2ecf20Sopenharmony_ci * * 2) Redistributions in binary form must reproduce the above copyright
348c2ecf20Sopenharmony_ci * *    notice, this list of conditions and the following disclaimer in the
358c2ecf20Sopenharmony_ci * *    documentation and/or other materials provided with the distribution.
368c2ecf20Sopenharmony_ci * * 3) The name of the author may not be used to endorse or promote products
378c2ecf20Sopenharmony_ci * *    derived from this software without specific prior written permission.
388c2ecf20Sopenharmony_ci * *
398c2ecf20Sopenharmony_ci * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
408c2ecf20Sopenharmony_ci * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
418c2ecf20Sopenharmony_ci * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
428c2ecf20Sopenharmony_ci * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
438c2ecf20Sopenharmony_ci * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
448c2ecf20Sopenharmony_ci * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
458c2ecf20Sopenharmony_ci * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
468c2ecf20Sopenharmony_ci * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
478c2ecf20Sopenharmony_ci * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
488c2ecf20Sopenharmony_ci * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
498c2ecf20Sopenharmony_ci *
508c2ecf20Sopenharmony_ci * Author:	Thomas Winischhofer <thomas@winischhofer.net>
518c2ecf20Sopenharmony_ci *
528c2ecf20Sopenharmony_ci */
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#ifndef _SISUSB_INIT_H_
558c2ecf20Sopenharmony_ci#define _SISUSB_INIT_H_
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci/* SiS_ModeType */
588c2ecf20Sopenharmony_ci#define ModeText		0x00
598c2ecf20Sopenharmony_ci#define ModeCGA			0x01
608c2ecf20Sopenharmony_ci#define ModeEGA			0x02
618c2ecf20Sopenharmony_ci#define ModeVGA			0x03
628c2ecf20Sopenharmony_ci#define Mode15Bpp		0x04
638c2ecf20Sopenharmony_ci#define Mode16Bpp		0x05
648c2ecf20Sopenharmony_ci#define Mode24Bpp		0x06
658c2ecf20Sopenharmony_ci#define Mode32Bpp		0x07
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define ModeTypeMask		0x07
688c2ecf20Sopenharmony_ci#define IsTextMode		0x07
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#define DACInfoFlag		0x0018
718c2ecf20Sopenharmony_ci#define MemoryInfoFlag		0x01E0
728c2ecf20Sopenharmony_ci#define MemorySizeShift		5
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/* modeflag */
758c2ecf20Sopenharmony_ci#define Charx8Dot		0x0200
768c2ecf20Sopenharmony_ci#define LineCompareOff		0x0400
778c2ecf20Sopenharmony_ci#define CRT2Mode		0x0800
788c2ecf20Sopenharmony_ci#define HalfDCLK		0x1000
798c2ecf20Sopenharmony_ci#define NoSupportSimuTV		0x2000
808c2ecf20Sopenharmony_ci#define NoSupportLCDScale	0x4000	/* SiS bridge: No scaling possible (no matter what panel) */
818c2ecf20Sopenharmony_ci#define DoubleScanMode		0x8000
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci/* Infoflag */
848c2ecf20Sopenharmony_ci#define SupportTV		0x0008
858c2ecf20Sopenharmony_ci#define SupportTV1024		0x0800
868c2ecf20Sopenharmony_ci#define SupportCHTV		0x0800
878c2ecf20Sopenharmony_ci#define Support64048060Hz	0x0800	/* Special for 640x480 LCD */
888c2ecf20Sopenharmony_ci#define SupportHiVision		0x0010
898c2ecf20Sopenharmony_ci#define SupportYPbPr750p	0x1000
908c2ecf20Sopenharmony_ci#define SupportLCD		0x0020
918c2ecf20Sopenharmony_ci#define SupportRAMDAC2		0x0040	/* All           (<= 100Mhz) */
928c2ecf20Sopenharmony_ci#define SupportRAMDAC2_135	0x0100	/* All except DH (<= 135Mhz) */
938c2ecf20Sopenharmony_ci#define SupportRAMDAC2_162	0x0200	/* B, C          (<= 162Mhz) */
948c2ecf20Sopenharmony_ci#define SupportRAMDAC2_202	0x0400	/* C             (<= 202Mhz) */
958c2ecf20Sopenharmony_ci#define InterlaceMode		0x0080
968c2ecf20Sopenharmony_ci#define SyncPP			0x0000
978c2ecf20Sopenharmony_ci#define SyncPN			0x4000
988c2ecf20Sopenharmony_ci#define SyncNP			0x8000
998c2ecf20Sopenharmony_ci#define SyncNN			0xc000
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci/* SetFlag */
1028c2ecf20Sopenharmony_ci#define ProgrammingCRT2		0x0001
1038c2ecf20Sopenharmony_ci#define LowModeTests		0x0002
1048c2ecf20Sopenharmony_ci#define LCDVESATiming		0x0008
1058c2ecf20Sopenharmony_ci#define EnableLVDSDDA		0x0010
1068c2ecf20Sopenharmony_ci#define SetDispDevSwitchFlag	0x0020
1078c2ecf20Sopenharmony_ci#define CheckWinDos		0x0040
1088c2ecf20Sopenharmony_ci#define SetDOSMode		0x0080
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci/* Index in ModeResInfo table */
1118c2ecf20Sopenharmony_ci#define SIS_RI_320x200		0
1128c2ecf20Sopenharmony_ci#define SIS_RI_320x240		1
1138c2ecf20Sopenharmony_ci#define SIS_RI_320x400		2
1148c2ecf20Sopenharmony_ci#define SIS_RI_400x300		3
1158c2ecf20Sopenharmony_ci#define SIS_RI_512x384		4
1168c2ecf20Sopenharmony_ci#define SIS_RI_640x400		5
1178c2ecf20Sopenharmony_ci#define SIS_RI_640x480		6
1188c2ecf20Sopenharmony_ci#define SIS_RI_800x600		7
1198c2ecf20Sopenharmony_ci#define SIS_RI_1024x768		8
1208c2ecf20Sopenharmony_ci#define SIS_RI_1280x1024	9
1218c2ecf20Sopenharmony_ci#define SIS_RI_1600x1200	10
1228c2ecf20Sopenharmony_ci#define SIS_RI_1920x1440	11
1238c2ecf20Sopenharmony_ci#define SIS_RI_2048x1536	12
1248c2ecf20Sopenharmony_ci#define SIS_RI_720x480		13
1258c2ecf20Sopenharmony_ci#define SIS_RI_720x576		14
1268c2ecf20Sopenharmony_ci#define SIS_RI_1280x960		15
1278c2ecf20Sopenharmony_ci#define SIS_RI_800x480		16
1288c2ecf20Sopenharmony_ci#define SIS_RI_1024x576		17
1298c2ecf20Sopenharmony_ci#define SIS_RI_1280x720		18
1308c2ecf20Sopenharmony_ci#define SIS_RI_856x480		19
1318c2ecf20Sopenharmony_ci#define SIS_RI_1280x768		20
1328c2ecf20Sopenharmony_ci#define SIS_RI_1400x1050	21
1338c2ecf20Sopenharmony_ci#define SIS_RI_1152x864		22	/* Up to here SiS conforming */
1348c2ecf20Sopenharmony_ci#define SIS_RI_848x480		23
1358c2ecf20Sopenharmony_ci#define SIS_RI_1360x768		24
1368c2ecf20Sopenharmony_ci#define SIS_RI_1024x600		25
1378c2ecf20Sopenharmony_ci#define SIS_RI_1152x768		26
1388c2ecf20Sopenharmony_ci#define SIS_RI_768x576		27
1398c2ecf20Sopenharmony_ci#define SIS_RI_1360x1024	28
1408c2ecf20Sopenharmony_ci#define SIS_RI_1680x1050	29
1418c2ecf20Sopenharmony_ci#define SIS_RI_1280x800		30
1428c2ecf20Sopenharmony_ci#define SIS_RI_1920x1080	31
1438c2ecf20Sopenharmony_ci#define SIS_RI_960x540		32
1448c2ecf20Sopenharmony_ci#define SIS_RI_960x600		33
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci#define SIS_VIDEO_CAPTURE	0x00 - 0x30
1478c2ecf20Sopenharmony_ci#define SIS_VIDEO_PLAYBACK	0x02 - 0x30
1488c2ecf20Sopenharmony_ci#define SIS_CRT2_PORT_04	0x04 - 0x30
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ciint SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
1518c2ecf20Sopenharmony_ciint SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo);
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ciextern int sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data);
1548c2ecf20Sopenharmony_ciextern int sisusb_getreg(struct sisusb_usb_data *sisusb, u32 port, u8 * data);
1558c2ecf20Sopenharmony_ciextern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, u32 port,
1568c2ecf20Sopenharmony_ci			    u8 index, u8 data);
1578c2ecf20Sopenharmony_ciextern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, u32 port,
1588c2ecf20Sopenharmony_ci			    u8 index, u8 * data);
1598c2ecf20Sopenharmony_ciextern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, u32 port,
1608c2ecf20Sopenharmony_ci				 u8 idx, u8 myand, u8 myor);
1618c2ecf20Sopenharmony_ciextern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, u32 port,
1628c2ecf20Sopenharmony_ci			      u8 index, u8 myor);
1638c2ecf20Sopenharmony_ciextern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, u32 port,
1648c2ecf20Sopenharmony_ci			       u8 idx, u8 myand);
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_civoid sisusb_delete(struct kref *kref);
1678c2ecf20Sopenharmony_ciint sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data);
1688c2ecf20Sopenharmony_ciint sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 * data);
1698c2ecf20Sopenharmony_ciint sisusb_copy_memory(struct sisusb_usb_data *sisusb, u8 *src,
1708c2ecf20Sopenharmony_ci		       u32 dest, int length);
1718c2ecf20Sopenharmony_ciint sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init);
1728c2ecf20Sopenharmony_ciint sisusbcon_do_font_op(struct sisusb_usb_data *sisusb, int set, int slot,
1738c2ecf20Sopenharmony_ci			 u8 * arg, int cmapsz, int ch512, int dorecalc,
1748c2ecf20Sopenharmony_ci			 struct vc_data *c, int fh, int uplock);
1758c2ecf20Sopenharmony_civoid sisusb_set_cursor(struct sisusb_usb_data *sisusb, unsigned int location);
1768c2ecf20Sopenharmony_ciint sisusb_console_init(struct sisusb_usb_data *sisusb, int first, int last);
1778c2ecf20Sopenharmony_civoid sisusb_console_exit(struct sisusb_usb_data *sisusb);
1788c2ecf20Sopenharmony_civoid sisusb_init_concode(void);
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci#endif
181