1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 2 /* $XFree86$ */ 3 /* $XdotOrg$ */ 4 /* 5 * Data and prototypes for init.c 6 * 7 * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria 8 * 9 * If distributed as part of the Linux kernel, the following license terms 10 * apply: 11 * 12 * * This program is free software; you can redistribute it and/or modify 13 * * it under the terms of the GNU General Public License as published by 14 * * the Free Software Foundation; either version 2 of the named License, 15 * * or any later version. 16 * * 17 * * This program is distributed in the hope that it will be useful, 18 * * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * * GNU General Public License for more details. 21 * * 22 * * You should have received a copy of the GNU General Public License 23 * * along with this program; if not, write to the Free Software 24 * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA 25 * 26 * Otherwise, the following license terms apply: 27 * 28 * * Redistribution and use in source and binary forms, with or without 29 * * modification, are permitted provided that the following conditions 30 * * are met: 31 * * 1) Redistributions of source code must retain the above copyright 32 * * notice, this list of conditions and the following disclaimer. 33 * * 2) Redistributions in binary form must reproduce the above copyright 34 * * notice, this list of conditions and the following disclaimer in the 35 * * documentation and/or other materials provided with the distribution. 36 * * 3) The name of the author may not be used to endorse or promote products 37 * * derived from this software without specific prior written permission. 38 * * 39 * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 40 * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 41 * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 42 * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 43 * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 44 * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 45 * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 46 * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 47 * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 48 * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 49 * 50 * Author: Thomas Winischhofer <thomas@winischhofer.net> 51 * 52 */ 53 54 #ifndef _SISUSB_INIT_H_ 55 #define _SISUSB_INIT_H_ 56 57 /* SiS_ModeType */ 58 #define ModeText 0x00 59 #define ModeCGA 0x01 60 #define ModeEGA 0x02 61 #define ModeVGA 0x03 62 #define Mode15Bpp 0x04 63 #define Mode16Bpp 0x05 64 #define Mode24Bpp 0x06 65 #define Mode32Bpp 0x07 66 67 #define ModeTypeMask 0x07 68 #define IsTextMode 0x07 69 70 #define DACInfoFlag 0x0018 71 #define MemoryInfoFlag 0x01E0 72 #define MemorySizeShift 5 73 74 /* modeflag */ 75 #define Charx8Dot 0x0200 76 #define LineCompareOff 0x0400 77 #define CRT2Mode 0x0800 78 #define HalfDCLK 0x1000 79 #define NoSupportSimuTV 0x2000 80 #define NoSupportLCDScale 0x4000 /* SiS bridge: No scaling possible (no matter what panel) */ 81 #define DoubleScanMode 0x8000 82 83 /* Infoflag */ 84 #define SupportTV 0x0008 85 #define SupportTV1024 0x0800 86 #define SupportCHTV 0x0800 87 #define Support64048060Hz 0x0800 /* Special for 640x480 LCD */ 88 #define SupportHiVision 0x0010 89 #define SupportYPbPr750p 0x1000 90 #define SupportLCD 0x0020 91 #define SupportRAMDAC2 0x0040 /* All (<= 100Mhz) */ 92 #define SupportRAMDAC2_135 0x0100 /* All except DH (<= 135Mhz) */ 93 #define SupportRAMDAC2_162 0x0200 /* B, C (<= 162Mhz) */ 94 #define SupportRAMDAC2_202 0x0400 /* C (<= 202Mhz) */ 95 #define InterlaceMode 0x0080 96 #define SyncPP 0x0000 97 #define SyncPN 0x4000 98 #define SyncNP 0x8000 99 #define SyncNN 0xc000 100 101 /* SetFlag */ 102 #define ProgrammingCRT2 0x0001 103 #define LowModeTests 0x0002 104 #define LCDVESATiming 0x0008 105 #define EnableLVDSDDA 0x0010 106 #define SetDispDevSwitchFlag 0x0020 107 #define CheckWinDos 0x0040 108 #define SetDOSMode 0x0080 109 110 /* Index in ModeResInfo table */ 111 #define SIS_RI_320x200 0 112 #define SIS_RI_320x240 1 113 #define SIS_RI_320x400 2 114 #define SIS_RI_400x300 3 115 #define SIS_RI_512x384 4 116 #define SIS_RI_640x400 5 117 #define SIS_RI_640x480 6 118 #define SIS_RI_800x600 7 119 #define SIS_RI_1024x768 8 120 #define SIS_RI_1280x1024 9 121 #define SIS_RI_1600x1200 10 122 #define SIS_RI_1920x1440 11 123 #define SIS_RI_2048x1536 12 124 #define SIS_RI_720x480 13 125 #define SIS_RI_720x576 14 126 #define SIS_RI_1280x960 15 127 #define SIS_RI_800x480 16 128 #define SIS_RI_1024x576 17 129 #define SIS_RI_1280x720 18 130 #define SIS_RI_856x480 19 131 #define SIS_RI_1280x768 20 132 #define SIS_RI_1400x1050 21 133 #define SIS_RI_1152x864 22 /* Up to here SiS conforming */ 134 #define SIS_RI_848x480 23 135 #define SIS_RI_1360x768 24 136 #define SIS_RI_1024x600 25 137 #define SIS_RI_1152x768 26 138 #define SIS_RI_768x576 27 139 #define SIS_RI_1360x1024 28 140 #define SIS_RI_1680x1050 29 141 #define SIS_RI_1280x800 30 142 #define SIS_RI_1920x1080 31 143 #define SIS_RI_960x540 32 144 #define SIS_RI_960x600 33 145 146 #define SIS_VIDEO_CAPTURE 0x00 - 0x30 147 #define SIS_VIDEO_PLAYBACK 0x02 - 0x30 148 #define SIS_CRT2_PORT_04 0x04 - 0x30 149 150 int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); 151 int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo); 152 153 extern int sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data); 154 extern int sisusb_getreg(struct sisusb_usb_data *sisusb, u32 port, u8 * data); 155 extern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, u32 port, 156 u8 index, u8 data); 157 extern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, u32 port, 158 u8 index, u8 * data); 159 extern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, u32 port, 160 u8 idx, u8 myand, u8 myor); 161 extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, u32 port, 162 u8 index, u8 myor); 163 extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, u32 port, 164 u8 idx, u8 myand); 165 166 void sisusb_delete(struct kref *kref); 167 int sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data); 168 int sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 * data); 169 int sisusb_copy_memory(struct sisusb_usb_data *sisusb, u8 *src, 170 u32 dest, int length); 171 int sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init); 172 int sisusbcon_do_font_op(struct sisusb_usb_data *sisusb, int set, int slot, 173 u8 * arg, int cmapsz, int ch512, int dorecalc, 174 struct vc_data *c, int fh, int uplock); 175 void sisusb_set_cursor(struct sisusb_usb_data *sisusb, unsigned int location); 176 int sisusb_console_init(struct sisusb_usb_data *sisusb, int first, int last); 177 void sisusb_console_exit(struct sisusb_usb_data *sisusb); 178 void sisusb_init_concode(void); 179 180 #endif 181