172b676d7Smrg/*
272b676d7Smrg * Data and prototypes for init301.c
372b676d7Smrg *
472b676d7Smrg * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
572b676d7Smrg *
672b676d7Smrg * If distributed as part of the Linux kernel, the following license terms
772b676d7Smrg * apply:
872b676d7Smrg *
972b676d7Smrg * * This program is free software; you can redistribute it and/or modify
1072b676d7Smrg * * it under the terms of the GNU General Public License as published by
1172b676d7Smrg * * the Free Software Foundation; either version 2 of the named License,
1272b676d7Smrg * * or any later version.
1372b676d7Smrg * *
1472b676d7Smrg * * This program is distributed in the hope that it will be useful,
1572b676d7Smrg * * but WITHOUT ANY WARRANTY; without even the implied warranty of
1672b676d7Smrg * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1772b676d7Smrg * * GNU General Public License for more details.
1872b676d7Smrg * *
1972b676d7Smrg * * You should have received a copy of the GNU General Public License
2072b676d7Smrg * * along with this program; if not, write to the Free Software
2172b676d7Smrg * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
2272b676d7Smrg *
2372b676d7Smrg * Otherwise, the following license terms apply:
2472b676d7Smrg *
2572b676d7Smrg * * Redistribution and use in source and binary forms, with or without
2672b676d7Smrg * * modification, are permitted provided that the following conditions
2772b676d7Smrg * * are met:
2872b676d7Smrg * * 1) Redistributions of source code must retain the above copyright
2972b676d7Smrg * *    notice, this list of conditions and the following disclaimer.
3072b676d7Smrg * * 2) Redistributions in binary form must reproduce the above copyright
3172b676d7Smrg * *    notice, this list of conditions and the following disclaimer in the
3272b676d7Smrg * *    documentation and/or other materials provided with the distribution.
3372b676d7Smrg * * 3) The name of the author may not be used to endorse or promote products
3472b676d7Smrg * *    derived from this software without specific prior written permission.
3572b676d7Smrg * *
3672b676d7Smrg * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
3772b676d7Smrg * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
3872b676d7Smrg * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
3972b676d7Smrg * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
4072b676d7Smrg * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
4172b676d7Smrg * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4272b676d7Smrg * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4372b676d7Smrg * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4472b676d7Smrg * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
4572b676d7Smrg * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4672b676d7Smrg *
4772b676d7Smrg * Author: 	Thomas Winischhofer <thomas@winischhofer.net>
4872b676d7Smrg *
4972b676d7Smrg */
5072b676d7Smrg
5172b676d7Smrg#ifndef  _INIT301_H_
5272b676d7Smrg#define  _INIT301_H_
5372b676d7Smrg
5472b676d7Smrg#include "osdef.h"
5572b676d7Smrg#include "initdef.h"
5672b676d7Smrg
5772b676d7Smrg#ifdef SIS_XORG_XF86
5872b676d7Smrg#include "sis.h"
5972b676d7Smrg#include "sis_regs.h"
6072b676d7Smrg#endif
6172b676d7Smrg
6272b676d7Smrg#ifdef SIS_LINUX_KERNEL
6372b676d7Smrg#include "vgatypes.h"
6472b676d7Smrg#include "vstruct.h"
6572b676d7Smrg#ifdef SIS_CP
6672b676d7Smrg#undef SIS_CP
6772b676d7Smrg#endif
6872b676d7Smrg#include <linux/config.h>
6972b676d7Smrg#include <linux/version.h>
7072b676d7Smrg#include <linux/types.h>
7172b676d7Smrg#include <asm/io.h>
7272b676d7Smrg#include <linux/fb.h>
7372b676d7Smrg#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
7472b676d7Smrg#include <video/fbcon.h>
7572b676d7Smrg#endif
7672b676d7Smrg#include "sis.h"
7772b676d7Smrg#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
7872b676d7Smrg#include <linux/sisfb.h>
7972b676d7Smrg#else
8072b676d7Smrg#include <video/sisfb.h>
8172b676d7Smrg#endif
8272b676d7Smrg#endif
8372b676d7Smrg
8472b676d7Smrgstatic const unsigned char SiS_YPbPrTable[5][64] = {
8572b676d7Smrg	{	/* 525i */
8672b676d7Smrg		0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c,
8772b676d7Smrg		0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a,
8872b676d7Smrg		0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b,
8972b676d7Smrg		0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17,
9072b676d7Smrg		0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02,
9172b676d7Smrg		0x03,0x0a,0x65,0x9d,0x08,0x92,0x8f,0x40,
9272b676d7Smrg		0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x53,
9372b676d7Smrg		0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00
9472b676d7Smrg	},
9572b676d7Smrg	{	/* 525p */
9672b676d7Smrg		0x33,0x06,0x06,0x09,0x0b,0x0c,0x0c,0x0c,
9772b676d7Smrg		0x98,0x0a,0x01,0x0d,0x06,0x0d,0x04,0x0a,
9872b676d7Smrg		0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
9972b676d7Smrg		0x0c,0x50,0xb2,0x9f,0x16,0x59,0x4f,0x13,
10072b676d7Smrg		0xad,0x11,0xad,0x1d,0x40,0x8a,0x3d,0xb8,
10172b676d7Smrg		0x51,0x5e,0x60,0x49,0x7d,0x92,0x0f,0x40,
10272b676d7Smrg		0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x4e,
10372b676d7Smrg		0x43,0x41,0x11,0x00,0xfc,0xff,0x32,0x00
10472b676d7Smrg	},
10572b676d7Smrg	{	/* 750p */
10672b676d7Smrg#if 0 /* OK, but sticks to left edge */
10772b676d7Smrg		0x13,0x1d,0xe8,0x09,0x09,0xed,0x0c,0x0c,
10872b676d7Smrg		0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a,
10972b676d7Smrg		0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
11072b676d7Smrg		0xed,0x50,0x70,0x9f,0x16,0x59,0x21 /*0x2b*/,0x13,
11172b676d7Smrg		0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0,
11272b676d7Smrg		0x4b,0x4b,0x65 /*0x6f*/,0x2f,0x63,0x92,0x0f,0x40,
11372b676d7Smrg		0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x27,
11472b676d7Smrg		0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00
11572b676d7Smrg#endif
11672b676d7Smrg		0x23,0x2d,0xe8,0x09,0x09,0xed,0x0c,0x0c,
11772b676d7Smrg		0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a,
11872b676d7Smrg		0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
11972b676d7Smrg		0xed,0x50,0x70,0x9f,0x16,0x59,0x60,0x13,
12072b676d7Smrg		0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0,
12172b676d7Smrg		0x4b,0x4b,0x6f,0x2f,0x63,0x92,0x0f,0x40,
12272b676d7Smrg		0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x73,
12372b676d7Smrg		0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00
12472b676d7Smrg	},
12572b676d7Smrg	{	/* 625i */
12672b676d7Smrg		0x19,0x52,0x35,0x6e,0x04,0x38,0x3d,0x70,
12772b676d7Smrg		0x94,0x49,0x01,0x12,0x06,0x3e,0x35,0x6d,
12872b676d7Smrg		0x06,0x14,0x3e,0x35,0x6d,0x00,0x45,0x2b,
12972b676d7Smrg		0x70,0x50,0x00,0x9b,0x00,0xd9,0x5d,0x17,
13072b676d7Smrg		0x7d,0x05,0x45,0x00,0x00,0xe8,0x00,0x02,
13172b676d7Smrg		0x0d,0x00,0x68,0xb0,0x0b,0x92,0x8f,0x40,
13272b676d7Smrg		0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x63,
13372b676d7Smrg		0x00,0x40,0x3e,0x00,0xe1,0x02,0x28,0x00
13472b676d7Smrg	},
13572b676d7Smrg	{	/* 625p */
13672b676d7Smrg		0x3a,0x06,0x6a,0x6e,0x0b,0x70,0x0c,0x0c,
13772b676d7Smrg		0x98,0x0a,0x01,0x0d,0x06,0x0d,0x04,0x0a,
13872b676d7Smrg		0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
13972b676d7Smrg		0x70,0x50,0xb2,0x9f,0x16,0x59,0x4f,0x13,
14072b676d7Smrg		0xad,0x11,0xad,0x1d,0x40,0x8a,0x3d,0xb8,
14172b676d7Smrg		0x51,0x5e,0x60,0x49,0x7d,0x92,0x0f,0x40,
14272b676d7Smrg		0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x4e,
14372b676d7Smrg		0x43,0x41,0x11,0x00,0xfc,0xff,0x32,0x00
14472b676d7Smrg	}
14572b676d7Smrg};
14672b676d7Smrg
14772b676d7Smrgstatic const unsigned char SiS_TVPhase[] =
14872b676d7Smrg{
14972b676d7Smrg	0x21,0xED,0xBA,0x08,	/* 0x00 SiS_NTSCPhase */
15072b676d7Smrg	0x2A,0x05,0xE3,0x00,	/* 0x01 SiS_PALPhase */
15172b676d7Smrg	0x21,0xE4,0x2E,0x9B,	/* 0x02 SiS_PALMPhase */
15272b676d7Smrg	0x21,0xF4,0x3E,0xBA,	/* 0x03 SiS_PALNPhase */
15372b676d7Smrg	0x1E,0x8B,0xA2,0xA7,
15472b676d7Smrg	0x1E,0x83,0x0A,0xE0,	/* 0x05 SiS_SpecialPhaseM */
15572b676d7Smrg	0x00,0x00,0x00,0x00,
15672b676d7Smrg	0x00,0x00,0x00,0x00,
15772b676d7Smrg	0x21,0xF0,0x7B,0xD6,	/* 0x08 SiS_NTSCPhase2 */
15872b676d7Smrg	0x2A,0x09,0x86,0xE9,	/* 0x09 SiS_PALPhase2 */
15972b676d7Smrg	0x21,0xE6,0xEF,0xA4,	/* 0x0a SiS_PALMPhase2 */
16072b676d7Smrg	0x21,0xF6,0x94,0x46,	/* 0x0b SiS_PALNPhase2 */
16172b676d7Smrg	0x1E,0x8B,0xA2,0xA7,
16272b676d7Smrg	0x1E,0x83,0x0A,0xE0,	/* 0x0d SiS_SpecialPhaseM */
16372b676d7Smrg	0x00,0x00,0x00,0x00,
16472b676d7Smrg	0x00,0x00,0x00,0x00,
16572b676d7Smrg	0x1e,0x8c,0x5c,0x7a,	/* 0x10 SiS_SpecialPhase */
16672b676d7Smrg	0x25,0xd4,0xfd,0x5e	/* 0x11 SiS_SpecialPhaseJ */
16772b676d7Smrg};
16872b676d7Smrg
16972b676d7Smrgstatic const unsigned char SiS_HiTVGroup3_1[] = {
17072b676d7Smrg	0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x13,
17172b676d7Smrg	0xb1, 0x41, 0x62, 0x62, 0xff, 0xf4, 0x45, 0xa6,
17272b676d7Smrg	0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20,
17372b676d7Smrg	0xac, 0xda, 0x60, 0xfe, 0x6a, 0x9a, 0x06, 0x10,
17472b676d7Smrg	0xd1, 0x04, 0x18, 0x0a, 0xff, 0x80, 0x00, 0x80,
17572b676d7Smrg	0x3b, 0x77, 0x00, 0xef, 0xe0, 0x10, 0xb0, 0xe0,
17672b676d7Smrg	0x10, 0x4f, 0x0f, 0x0f, 0x05, 0x0f, 0x08, 0x6e,
17772b676d7Smrg	0x1a, 0x1f, 0x25, 0x2a, 0x4c, 0xaa, 0x01
17872b676d7Smrg};
17972b676d7Smrg
18072b676d7Smrgstatic const unsigned char SiS_HiTVGroup3_2[] = {
18172b676d7Smrg	0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x7a,
18272b676d7Smrg	0x54, 0x41, 0xe7, 0xe7, 0xff, 0xf4, 0x45, 0xa6,
18372b676d7Smrg	0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20,
18472b676d7Smrg	0xac, 0x6a, 0x60, 0x2b, 0x52, 0xcd, 0x61, 0x10,
18572b676d7Smrg	0x51, 0x04, 0x18, 0x0a, 0x1f, 0x80, 0x00, 0x80,
18672b676d7Smrg	0xff, 0xa4, 0x04, 0x2b, 0x94, 0x21, 0x72, 0x94,
18772b676d7Smrg	0x26, 0x05, 0x01, 0x0f, 0xed, 0x0f, 0x0a, 0x64,
18872b676d7Smrg	0x18, 0x1d, 0x23, 0x28, 0x4c, 0xaa, 0x01
18972b676d7Smrg};
19072b676d7Smrg
19172b676d7Smrg#ifdef SIS315H
19272b676d7Smrg/* 661 et al LCD data structure (2.03.00) */
19372b676d7Smrgstatic const unsigned char SiS_LCDStruct661[] = {
19472b676d7Smrg    /* 1024x768 */
19572b676d7Smrg/*  type|CR37|   HDE   |   VDE   |    HT   |    VT   |   hss    | hse   */
19672b676d7Smrg    0x02,0xC0,0x00,0x04,0x00,0x03,0x40,0x05,0x26,0x03,0x10,0x00,0x88,
19772b676d7Smrg    0x00,0x02,0x00,0x06,0x00,0x41,0x5A,0x64,0x00,0x00,0x00,0x00,0x04,
19872b676d7Smrg    /*  | vss     |    vse  |clck|  clock  |CRT2DataP|CRT2DataP|idx     */
19972b676d7Smrg    /*					      VESA    non-VESA  noscale */
20072b676d7Smrg    /* 1280x1024 */
20172b676d7Smrg    0x03,0xC0,0x00,0x05,0x00,0x04,0x98,0x06,0x2A,0x04,0x30,0x00,0x70,
20272b676d7Smrg    0x00,0x01,0x00,0x03,0x00,0x6C,0xF8,0x2F,0x00,0x00,0x00,0x00,0x08,
20372b676d7Smrg    /* 1400x1050 */
20472b676d7Smrg    0x09,0x20,0x78,0x05,0x1A,0x04,0x98,0x06,0x2A,0x04,0x18,0x00,0x38,
20572b676d7Smrg    0x00,0x01,0x00,0x03,0x00,0x6C,0xF8,0x2F,0x00,0x00,0x00,0x00,0x09,
20672b676d7Smrg    /* 1600x1200 */
20772b676d7Smrg    0x0B,0xE0,0x40,0x06,0xB0,0x04,0x70,0x08,0xE2,0x04,0x40,0x00,0xC0,
20872b676d7Smrg    0x00,0x01,0x00,0x03,0x00,0xA2,0x70,0x24,0x00,0x00,0x00,0x00,0x0A,
20972b676d7Smrg    /* 1280x768 (_2) */
21072b676d7Smrg    0x0A,0xE0,0x00,0x05,0x00,0x03,0x7C,0x06,0x26,0x03,0x30,0x00,0x70,
21172b676d7Smrg    0x00,0x03,0x00,0x06,0x00,0x4D,0xC8,0x48,0x00,0x00,0x00,0x00,0x06,
21272b676d7Smrg    /* 1280x720 */
21372b676d7Smrg    0x0E,0xE0,0x00,0x05,0xD0,0x02,0x80,0x05,0x26,0x03,0x10,0x00,0x20,
21472b676d7Smrg    0x00,0x01,0x00,0x06,0x00,0x45,0x9C,0x62,0x00,0x00,0x00,0x00,0x05,
21572b676d7Smrg    /* 1280x800 (_2) */
21672b676d7Smrg    0x0C,0xE0,0x00,0x05,0x20,0x03,0x10,0x06,0x2C,0x03,0x30,0x00,0x70,
21772b676d7Smrg    0x00,0x04,0x00,0x03,0x00,0x49,0xCE,0x1E,0x00,0x00,0x00,0x00,0x09,
21872b676d7Smrg    /* 1680x1050 */
21972b676d7Smrg    0x0D,0xE0,0x90,0x06,0x1A,0x04,0x6C,0x07,0x2A,0x04,0x1A,0x00,0x4C,
22072b676d7Smrg    0x00,0x03,0x00,0x06,0x00,0x79,0xBE,0x44,0x00,0x00,0x00,0x00,0x06,
22172b676d7Smrg    /* 1280x800_3 */
22272b676d7Smrg    0x0C,0xE0,0x00,0x05,0x20,0x03,0xAA,0x05,0x2E,0x03,0x30,0x00,0x50,
22372b676d7Smrg    0x00,0x04,0x00,0x03,0x00,0x47,0xA9,0x10,0x00,0x00,0x00,0x00,0x07,
22472b676d7Smrg    /* 800x600 */
22572b676d7Smrg    0x01,0xC0,0x20,0x03,0x58,0x02,0x20,0x04,0x74,0x02,0x2A,0x00,0x80,
22672b676d7Smrg    0x00,0x06,0x00,0x04,0x00,0x28,0x63,0x4B,0x00,0x00,0x00,0x00,0x00,
22772b676d7Smrg    /* 1280x854 */
22872b676d7Smrg    0x08,0xE0,0x00,0x05,0x56,0x03,0x80,0x06,0x5d,0x03,0x10,0x00,0x70,
22972b676d7Smrg    0x00,0x01,0x00,0x03,0x00,0x54,0x75,0x13,0x00,0x00,0x00,0x00,0x08
23072b676d7Smrg};
23172b676d7Smrg#endif
23272b676d7Smrg
23372b676d7Smrg#ifdef SIS300
23472b676d7Smrgstatic unsigned char SiS300_TrumpionData[14][80] = {
23572b676d7Smrg  { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
23672b676d7Smrg    0x20,0x03,0x0B,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x10,0x00,0x00,0x04,0x23,
23772b676d7Smrg    0x00,0x00,0x03,0x28,0x03,0x10,0x05,0x08,0x40,0x10,0x00,0x10,0x04,0x23,0x00,0x23,
23872b676d7Smrg    0x03,0x11,0x60,0xBC,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x09,0x04,0x04,0x05,
23972b676d7Smrg    0x04,0x0C,0x09,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5A,0x01,0xBE,0x01,0x00 },
24072b676d7Smrg  { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x27,0x00,0x80,0x02,
24172b676d7Smrg    0x20,0x03,0x07,0x00,0x5E,0x01,0x0D,0x02,0x60,0x0C,0x30,0x11,0x00,0x00,0x04,0x23,
24272b676d7Smrg    0x00,0x00,0x03,0x80,0x03,0x28,0x06,0x08,0x40,0x11,0x00,0x11,0x04,0x23,0x00,0x23,
24372b676d7Smrg    0x03,0x11,0x60,0x90,0x01,0xFF,0x0F,0xF4,0x19,0x01,0x00,0x05,0x01,0x00,0x04,0x05,
24472b676d7Smrg    0x04,0x0C,0x02,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEC,0x57,0x01,0xBE,0x01,0x00 },
24572b676d7Smrg  { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x8A,0x00,0xD8,0x02,
24672b676d7Smrg    0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
24772b676d7Smrg    0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
24872b676d7Smrg    0x03,0x11,0x60,0xD9,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
24972b676d7Smrg    0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x59,0x01,0xBE,0x01,0x00 },
25072b676d7Smrg  { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x72,0x00,0xD8,0x02,
25172b676d7Smrg    0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
25272b676d7Smrg    0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
25372b676d7Smrg    0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
25472b676d7Smrg    0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
25572b676d7Smrg  { 0x02,0x0A,0x02,0x00,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
25672b676d7Smrg    0x20,0x03,0x16,0x00,0xE0,0x01,0x0D,0x02,0x60,0x0C,0x30,0x98,0x00,0x00,0x04,0x23,
25772b676d7Smrg    0x00,0x01,0x03,0x45,0x03,0x48,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x23,0x00,0x23,
25872b676d7Smrg    0x03,0x11,0x60,0xF4,0x01,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x05,0x01,0x00,0x05,0x05,
25972b676d7Smrg    0x04,0x0C,0x08,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
26072b676d7Smrg  { 0x02,0x0A,0x02,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0xBF,0x00,0x20,0x03,
26172b676d7Smrg    0x20,0x04,0x0D,0x00,0x58,0x02,0x71,0x02,0x80,0x0C,0x30,0x9A,0x00,0xFA,0x03,0x1D,
26272b676d7Smrg    0x00,0x01,0x03,0x22,0x03,0x28,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x1D,0x00,0x1D,
26372b676d7Smrg    0x03,0x11,0x60,0x39,0x03,0x40,0x05,0xF4,0x18,0x07,0x02,0x06,0x04,0x01,0x06,0x0B,
26472b676d7Smrg    0x02,0x0A,0x20,0x19,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
26572b676d7Smrg  { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0xEF,0x00,0x00,0x04,
26672b676d7Smrg    0x40,0x05,0x13,0x00,0x00,0x03,0x26,0x03,0x88,0x0C,0x30,0x90,0x00,0x00,0x04,0x23,
26772b676d7Smrg    0x00,0x01,0x03,0x24,0x03,0x28,0x06,0x08,0x40,0x90,0x00,0x90,0x04,0x23,0x00,0x23,
26872b676d7Smrg    0x03,0x11,0x60,0x40,0x05,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x08,0x01,0x00,0x08,0x01,
26972b676d7Smrg    0x00,0x08,0x01,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
27072b676d7Smrg  /* variant 2 */
27172b676d7Smrg  { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
27272b676d7Smrg    0x20,0x03,0x15,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x18,0x00,0x00,0x04,0x23,
27372b676d7Smrg    0x00,0x01,0x03,0x44,0x03,0x28,0x06,0x08,0x40,0x18,0x00,0x18,0x04,0x23,0x00,0x23,
27472b676d7Smrg    0x03,0x11,0x60,0xA6,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x13,0x04,0x04,0x05,
27572b676d7Smrg    0x04,0x0C,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
27672b676d7Smrg  { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
27772b676d7Smrg    0x20,0x03,0x15,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x18,0x00,0x00,0x04,0x23,
27872b676d7Smrg    0x00,0x01,0x03,0x44,0x03,0x28,0x06,0x08,0x40,0x18,0x00,0x18,0x04,0x23,0x00,0x23,
27972b676d7Smrg    0x03,0x11,0x60,0xA6,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x13,0x04,0x04,0x05,
28072b676d7Smrg    0x04,0x0C,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
28172b676d7Smrg  { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x8A,0x00,0xD8,0x02,
28272b676d7Smrg    0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
28372b676d7Smrg    0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
28472b676d7Smrg    0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
28572b676d7Smrg    0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
28672b676d7Smrg  { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x72,0x00,0xD8,0x02,
28772b676d7Smrg    0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
28872b676d7Smrg    0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
28972b676d7Smrg    0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
29072b676d7Smrg    0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
29172b676d7Smrg  { 0x02,0x0A,0x02,0x00,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
29272b676d7Smrg    0x20,0x03,0x16,0x00,0xE0,0x01,0x0D,0x02,0x60,0x0C,0x30,0x98,0x00,0x00,0x04,0x23,
29372b676d7Smrg    0x00,0x01,0x03,0x45,0x03,0x48,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x23,0x00,0x23,
29472b676d7Smrg    0x03,0x11,0x60,0xF4,0x01,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x05,0x01,0x00,0x05,0x05,
29572b676d7Smrg    0x04,0x0C,0x08,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 },
29672b676d7Smrg  { 0x02,0x0A,0x02,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0xBF,0x00,0x20,0x03,
29772b676d7Smrg    0x20,0x04,0x0D,0x00,0x58,0x02,0x71,0x02,0x80,0x0C,0x30,0x9A,0x00,0xFA,0x03,0x1D,
29872b676d7Smrg    0x00,0x01,0x03,0x22,0x03,0x28,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x1D,0x00,0x1D,
29972b676d7Smrg    0x03,0x11,0x60,0x39,0x03,0x40,0x05,0xF4,0x18,0x07,0x02,0x06,0x04,0x01,0x06,0x0B,
30072b676d7Smrg    0x02,0x0A,0x20,0x19,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 },
30172b676d7Smrg  { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0xEF,0x00,0x00,0x04,
30272b676d7Smrg    0x40,0x05,0x13,0x00,0x00,0x03,0x26,0x03,0x88,0x0C,0x30,0x90,0x00,0x00,0x04,0x23,
30372b676d7Smrg    0x00,0x01,0x03,0x24,0x03,0x28,0x06,0x08,0x40,0x90,0x00,0x90,0x04,0x23,0x00,0x23,
30472b676d7Smrg    0x03,0x11,0x60,0x40,0x05,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x08,0x01,0x00,0x08,0x01,
30572b676d7Smrg    0x00,0x08,0x01,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 }
30672b676d7Smrg};
30772b676d7Smrg#endif
30872b676d7Smrg
30972b676d7Smrgvoid		SiS_UnLockCRT2(struct SiS_Private *SiS_Pr);
31072b676d7Smrg#ifndef SIS_LINUX_KERNEL
31172b676d7Smrgvoid		SiS_LockCRT2(struct SiS_Private *SiS_Pr);
31272b676d7Smrg#endif
31372b676d7Smrgvoid		SiS_EnableCRT2(struct SiS_Private *SiS_Pr);
31472b676d7Smrgunsigned short	SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
31572b676d7Smrgvoid		SiS_WaitRetrace1(struct SiS_Private *SiS_Pr);
31672b676d7SmrgBOOLEAN		SiS_IsDualEdge(struct SiS_Private *SiS_Pr);
31772b676d7SmrgBOOLEAN		SiS_IsVAMode(struct SiS_Private *SiS_Pr);
31872b676d7Smrgvoid		SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
31972b676d7Smrg			unsigned short ModeIdIndex, int checkcrt2mode);
32072b676d7Smrgvoid		SiS_SetYPbPr(struct SiS_Private *SiS_Pr);
32172b676d7Smrgvoid    	SiS_SetTVMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
32272b676d7Smrg			unsigned short ModeIdIndex);
32372b676d7Smrgvoid		SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
32472b676d7Smrg		unsigned short ModeIdIndex);
32572b676d7Smrgunsigned short	SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex,
32672b676d7Smrg			unsigned short RefreshRateTableIndex);
32772b676d7Smrgunsigned short	SiS_GetResInfo(struct SiS_Private *SiS_Pr,unsigned short ModeNo,unsigned short ModeIdIndex);
32872b676d7Smrgvoid		SiS_DisableBridge(struct SiS_Private *SiS_Pr);
32972b676d7Smrg#ifndef SIS_LINUX_KERNEL
33072b676d7Smrgvoid		SiS_EnableBridge(struct SiS_Private *SiS_Pr);
33172b676d7Smrg#endif
33272b676d7SmrgBOOLEAN		SiS_SetCRT2Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
33372b676d7Smrgvoid		SiS_SiS30xBLOn(struct SiS_Private *SiS_Pr);
33472b676d7Smrgvoid		SiS_SiS30xBLOff(struct SiS_Private *SiS_Pr);
33572b676d7Smrg
33672b676d7Smrgvoid		SiS_SetCH700x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
33772b676d7Smrgunsigned short	SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short tempax);
33872b676d7Smrgvoid		SiS_SetCH701x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
33972b676d7Smrgunsigned short	SiS_GetCH701x(struct SiS_Private *SiS_Pr, unsigned short tempax);
34072b676d7Smrg#ifndef SIS_LINUX_KERNEL
34172b676d7Smrgvoid		SiS_SetCH70xx(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val);
34272b676d7Smrgunsigned short	SiS_GetCH70xx(struct SiS_Private *SiS_Pr, unsigned short tempax);
34372b676d7Smrg#endif
34472b676d7Smrgvoid		SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg,
34572b676d7Smrg			unsigned char orval,unsigned short andval);
34672b676d7Smrg#ifdef SIS315H
34772b676d7Smrgstatic void	SiS_Chrontel701xOn(struct SiS_Private *SiS_Pr);
34872b676d7Smrgstatic void	SiS_Chrontel701xOff(struct SiS_Private *SiS_Pr);
34972b676d7Smrgstatic void	SiS_ChrontelInitTVVSync(struct SiS_Private *SiS_Pr);
35072b676d7Smrgstatic void	SiS_ChrontelDoSomething1(struct SiS_Private *SiS_Pr);
35172b676d7Smrgvoid		SiS_Chrontel701xBLOn(struct SiS_Private *SiS_Pr);
35272b676d7Smrgvoid		SiS_Chrontel701xBLOff(struct SiS_Private *SiS_Pr);
35372b676d7Smrg#endif /* 315 */
35472b676d7Smrg
35572b676d7Smrg#ifdef SIS300
35672b676d7Smrgstatic  BOOLEAN	SiS_SetTrumpionBlock(struct SiS_Private *SiS_Pr, unsigned char *dataptr);
35772b676d7Smrgvoid		SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo);
35872b676d7Smrg#endif
35972b676d7Smrg
36072b676d7Smrgvoid		SiS_DDC2Delay(struct SiS_Private *SiS_Pr, unsigned int delaytime);
36172b676d7Smrgunsigned short	SiS_ReadDDC1Bit(struct SiS_Private *SiS_Pr);
36272b676d7Smrgunsigned short	SiS_HandleDDC(struct SiS_Private *SiS_Pr, unsigned int VBFlags, int VGAEngine,
36372b676d7Smrg			unsigned short adaptnum, unsigned short DDCdatatype,
36472b676d7Smrg			unsigned char *buffer, unsigned int VBFlags2);
36572b676d7Smrg
36672b676d7Smrg#ifdef SIS_XORG_XF86
36772b676d7Smrgunsigned short		SiS_InitDDCRegs(struct SiS_Private *SiS_Pr, unsigned int VBFlags,
36872b676d7Smrg				int VGAEngine, unsigned short adaptnum, unsigned short DDCdatatype,
36972b676d7Smrg				BOOLEAN checkcr32, unsigned int VBFlags2);
37072b676d7Smrgunsigned short		SiS_ProbeDDC(struct SiS_Private *SiS_Pr);
37172b676d7Smrgunsigned short		SiS_ReadDDC(struct SiS_Private *SiS_Pr, unsigned short DDCdatatype,
37272b676d7Smrg				unsigned char *buffer);
37372b676d7Smrg#else
37472b676d7Smrgstatic unsigned short	SiS_InitDDCRegs(struct SiS_Private *SiS_Pr, unsigned int VBFlags,
37572b676d7Smrg				int VGAEngine, unsigned short adaptnum, unsigned short DDCdatatype,
37672b676d7Smrg				BOOLEAN checkcr32, unsigned int VBFlags2);
37772b676d7Smrgstatic unsigned short	SiS_ProbeDDC(struct SiS_Private *SiS_Pr);
37872b676d7Smrgstatic unsigned short	SiS_ReadDDC(struct SiS_Private *SiS_Pr, unsigned short DDCdatatype,
37972b676d7Smrg				unsigned char *buffer);
38072b676d7Smrg#endif
38172b676d7Smrgstatic void		SiS_SetSwitchDDC2(struct SiS_Private *SiS_Pr);
38272b676d7Smrgstatic unsigned short	SiS_SetStart(struct SiS_Private *SiS_Pr);
38372b676d7Smrgstatic unsigned short	SiS_SetStop(struct SiS_Private *SiS_Pr);
38472b676d7Smrgstatic unsigned short	SiS_SetSCLKLow(struct SiS_Private *SiS_Pr);
38572b676d7Smrgstatic unsigned short	SiS_SetSCLKHigh(struct SiS_Private *SiS_Pr);
38672b676d7Smrgstatic unsigned short	SiS_ReadDDC2Data(struct SiS_Private *SiS_Pr);
38772b676d7Smrgstatic unsigned short	SiS_WriteDDC2Data(struct SiS_Private *SiS_Pr, unsigned short tempax);
38872b676d7Smrgstatic unsigned short	SiS_CheckACK(struct SiS_Private *SiS_Pr);
38972b676d7Smrgstatic unsigned short	SiS_WriteDABDDC(struct SiS_Private *SiS_Pr);
39072b676d7Smrgstatic unsigned short	SiS_PrepareReadDDC(struct SiS_Private *SiS_Pr);
39172b676d7Smrgstatic unsigned short	SiS_PrepareDDC(struct SiS_Private *SiS_Pr);
39272b676d7Smrgstatic void		SiS_SendACK(struct SiS_Private *SiS_Pr, unsigned short yesno);
39372b676d7Smrgstatic unsigned short	SiS_DoProbeDDC(struct SiS_Private *SiS_Pr);
39472b676d7Smrg
39572b676d7Smrg#ifdef SIS300
39672b676d7Smrgstatic void		SiS_OEM300Setting(struct SiS_Private *SiS_Pr,
39772b676d7Smrg				unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefTabindex);
39872b676d7Smrgstatic void		SetOEMLCDData2(struct SiS_Private *SiS_Pr,
39972b676d7Smrg				unsigned short ModeNo, unsigned short ModeIdIndex,unsigned short RefTableIndex);
40072b676d7Smrg#endif
40172b676d7Smrg#ifdef SIS315H
40272b676d7Smrgstatic void		SiS_OEM310Setting(struct SiS_Private *SiS_Pr,
40372b676d7Smrg				unsigned short ModeNo,unsigned short ModeIdIndex, unsigned short RRTI);
40472b676d7Smrgstatic void		SiS_OEM661Setting(struct SiS_Private *SiS_Pr,
40572b676d7Smrg				unsigned short ModeNo,unsigned short ModeIdIndex, unsigned short RRTI);
40672b676d7Smrgstatic void		SiS_FinalizeLCD(struct SiS_Private *, unsigned short, unsigned short);
40772b676d7Smrg#endif
40872b676d7Smrg
40972b676d7Smrgextern void		SiS_SetReg(SISIOADDRESS, unsigned short, unsigned short);
41072b676d7Smrgextern void		SiS_SetRegByte(SISIOADDRESS, unsigned short);
41172b676d7Smrgextern void		SiS_SetRegShort(SISIOADDRESS, unsigned short);
41272b676d7Smrgextern void		SiS_SetRegLong(SISIOADDRESS, unsigned int);
41372b676d7Smrgextern unsigned char	SiS_GetReg(SISIOADDRESS, unsigned short);
41472b676d7Smrgextern unsigned char	SiS_GetRegByte(SISIOADDRESS);
41572b676d7Smrgextern unsigned short	SiS_GetRegShort(SISIOADDRESS);
41672b676d7Smrgextern unsigned int	SiS_GetRegLong(SISIOADDRESS);
41772b676d7Smrgextern void		SiS_SetRegANDOR(SISIOADDRESS, unsigned short, unsigned short, unsigned short);
41872b676d7Smrgextern void		SiS_SetRegOR(SISIOADDRESS, unsigned short, unsigned short);
41972b676d7Smrgextern void		SiS_SetRegAND(SISIOADDRESS, unsigned short, unsigned short);
42072b676d7Smrgextern void		SiS_DisplayOff(struct SiS_Private *SiS_Pr);
42172b676d7Smrgextern void		SiS_DisplayOn(struct SiS_Private *SiS_Pr);
42272b676d7Smrgextern BOOLEAN		SiS_SearchModeID(struct SiS_Private *, unsigned short *, unsigned short *);
42372b676d7Smrgextern unsigned short	SiS_GetModeFlag(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
42472b676d7Smrg				unsigned short ModeIdIndex);
42572b676d7Smrgextern unsigned short	SiS_GetModePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
42672b676d7Smrgextern unsigned short	SiS_GetColorDepth(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
42772b676d7Smrgextern unsigned short	SiS_GetOffset(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex,
42872b676d7Smrg				unsigned short RefreshRateTableIndex);
42972b676d7Smrgextern void		SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
43072b676d7Smrg				unsigned short ModeIdIndex);
43172b676d7Smrgextern void		SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
43272b676d7Smrg				unsigned short ModeIdIndex);
43372b676d7Smrgextern void		SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth);
43472b676d7Smrgextern unsigned short	SiS_GetRefCRTVCLK(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide);
43572b676d7Smrgextern unsigned short	SiS_GetRefCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide);
43672b676d7Smrg#ifdef SIS300
43772b676d7Smrgextern void		SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *tempbx,
43872b676d7Smrg				unsigned short *tempcl);
43972b676d7Smrgextern unsigned short	SiS_GetFIFOThresholdB300(unsigned short tempbx, unsigned short tempcl);
44072b676d7Smrgextern unsigned short	SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index);
44172b676d7Smrg#ifdef SIS_LINUX_KERNEL
44272b676d7Smrgextern unsigned int	sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg);
44372b676d7Smrgextern unsigned int	sisfb_read_lpc_pci_dword(struct SiS_Private *SiS_Pr, int reg);
44472b676d7Smrg#endif
44572b676d7Smrg#endif
44672b676d7Smrg#ifdef SIS315H
44772b676d7Smrgextern void		SiS_SetGroup2_C_ELV(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
44872b676d7Smrg				unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex);
44972b676d7Smrg#endif
45072b676d7Smrg
45172b676d7Smrg#endif
452