xref: /openbmc/linux/drivers/video/fbdev/sis/init301.h (revision 3cf3cdea)
1 /* $XFree86$ */
2 /* $XdotOrg$ */
3 /*
4  * Data and prototypes for init301.c
5  *
6  * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
7  *
8  * If distributed as part of the Linux kernel, the following license terms
9  * apply:
10  *
11  * * This program is free software; you can redistribute it and/or modify
12  * * it under the terms of the GNU General Public License as published by
13  * * the Free Software Foundation; either version 2 of the named License,
14  * * or any later version.
15  * *
16  * * This program is distributed in the hope that it will be useful,
17  * * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * * GNU General Public License for more details.
20  * *
21  * * You should have received a copy of the GNU General Public License
22  * * along with this program; if not, write to the Free Software
23  * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
24  *
25  * Otherwise, the following license terms apply:
26  *
27  * * Redistribution and use in source and binary forms, with or without
28  * * modification, are permitted provided that the following conditions
29  * * are met:
30  * * 1) Redistributions of source code must retain the above copyright
31  * *    notice, this list of conditions and the following disclaimer.
32  * * 2) Redistributions in binary form must reproduce the above copyright
33  * *    notice, this list of conditions and the following disclaimer in the
34  * *    documentation and/or other materials provided with the distribution.
35  * * 3) The name of the author may not be used to endorse or promote products
36  * *    derived from this software without specific prior written permission.
37  * *
38  * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
39  * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
40  * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
41  * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
42  * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
43  * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
44  * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
45  * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
46  * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
47  * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48  *
49  * Author: 	Thomas Winischhofer <thomas@winischhofer.net>
50  *
51  */
52 
53 #ifndef  _INIT301_H_
54 #define  _INIT301_H_
55 
56 #include "initdef.h"
57 
58 #include "vgatypes.h"
59 #include "vstruct.h"
60 #ifdef SIS_CP
61 #undef SIS_CP
62 #endif
63 #include <linux/types.h>
64 #include <asm/io.h>
65 #include <linux/fb.h>
66 #include "sis.h"
67 #include <video/sisfb.h>
68 
69 void		SiS_UnLockCRT2(struct SiS_Private *SiS_Pr);
70 void		SiS_EnableCRT2(struct SiS_Private *SiS_Pr);
71 unsigned short	SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
72 void		SiS_WaitRetrace1(struct SiS_Private *SiS_Pr);
73 bool		SiS_IsDualEdge(struct SiS_Private *SiS_Pr);
74 bool		SiS_IsVAMode(struct SiS_Private *SiS_Pr);
75 void		SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
76 			unsigned short ModeIdIndex, int checkcrt2mode);
77 void		SiS_SetYPbPr(struct SiS_Private *SiS_Pr);
78 void    	SiS_SetTVMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
79 			unsigned short ModeIdIndex);
80 void		SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
81 		unsigned short ModeIdIndex);
82 unsigned short	SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex,
83 			unsigned short RefreshRateTableIndex);
84 unsigned short	SiS_GetResInfo(struct SiS_Private *SiS_Pr,unsigned short ModeNo,unsigned short ModeIdIndex);
85 void		SiS_DisableBridge(struct SiS_Private *SiS_Pr);
86 bool		SiS_SetCRT2Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
87 void		SiS_SiS30xBLOn(struct SiS_Private *SiS_Pr);
88 void		SiS_SiS30xBLOff(struct SiS_Private *SiS_Pr);
89 
90 void		SiS_SetCH700x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
91 unsigned short	SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short tempax);
92 void		SiS_SetCH701x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
93 unsigned short	SiS_GetCH701x(struct SiS_Private *SiS_Pr, unsigned short tempax);
94 void		SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg,
95 			unsigned char orval,unsigned short andval);
96 #ifdef CONFIG_FB_SIS_315
97 void		SiS_Chrontel701xBLOn(struct SiS_Private *SiS_Pr);
98 void		SiS_Chrontel701xBLOff(struct SiS_Private *SiS_Pr);
99 #endif /* 315 */
100 
101 #ifdef CONFIG_FB_SIS_300
102 void		SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo);
103 #endif
104 
105 void		SiS_DDC2Delay(struct SiS_Private *SiS_Pr, unsigned int delaytime);
106 unsigned short	SiS_ReadDDC1Bit(struct SiS_Private *SiS_Pr);
107 unsigned short	SiS_HandleDDC(struct SiS_Private *SiS_Pr, unsigned int VBFlags, int VGAEngine,
108 			unsigned short adaptnum, unsigned short DDCdatatype,
109 			unsigned char *buffer, unsigned int VBFlags2);
110 
111 extern void		SiS_DisplayOff(struct SiS_Private *SiS_Pr);
112 extern void		SiS_DisplayOn(struct SiS_Private *SiS_Pr);
113 extern bool		SiS_SearchModeID(struct SiS_Private *, unsigned short *, unsigned short *);
114 extern unsigned short	SiS_GetModeFlag(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
115 				unsigned short ModeIdIndex);
116 extern unsigned short	SiS_GetModePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
117 extern unsigned short	SiS_GetColorDepth(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
118 extern unsigned short	SiS_GetOffset(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex,
119 				unsigned short RefreshRateTableIndex);
120 extern void		SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
121 				unsigned short ModeIdIndex);
122 extern void		SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
123 				unsigned short ModeIdIndex);
124 extern void		SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth);
125 extern unsigned short	SiS_GetRefCRTVCLK(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide);
126 extern unsigned short	SiS_GetRefCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide);
127 #ifdef CONFIG_FB_SIS_300
128 extern void		SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *tempbx,
129 				unsigned short *tempcl);
130 extern unsigned short	SiS_GetFIFOThresholdB300(unsigned short tempbx, unsigned short tempcl);
131 extern unsigned short	SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index);
132 extern unsigned int	sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg);
133 extern unsigned int	sisfb_read_lpc_pci_dword(struct SiS_Private *SiS_Pr, int reg);
134 #endif
135 
136 #endif
137