162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * SiS 300/305/540/630(S)/730(S),
462306a36Sopenharmony_ci * SiS 315[E|PRO]/550/[M]65x/[M]66x[F|M|G]X/[M]74x[GX]/330/[M]76x[GX],
562306a36Sopenharmony_ci * XGI V3XT/V5/V8, Z7
662306a36Sopenharmony_ci * frame buffer driver for Linux kernels >=2.4.14 and >=2.6.3
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Copyright (C) 2001-2005 Thomas Winischhofer, Vienna, Austria.
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#ifndef _SISFB_MAIN
1262306a36Sopenharmony_ci#define _SISFB_MAIN
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include "vstruct.h"
1562306a36Sopenharmony_ci#include "sis.h"
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/* Fbcon stuff */
1862306a36Sopenharmony_cistatic struct fb_var_screeninfo my_default_var = {
1962306a36Sopenharmony_ci	.xres            = 0,
2062306a36Sopenharmony_ci	.yres            = 0,
2162306a36Sopenharmony_ci	.xres_virtual    = 0,
2262306a36Sopenharmony_ci	.yres_virtual    = 0,
2362306a36Sopenharmony_ci	.xoffset         = 0,
2462306a36Sopenharmony_ci	.yoffset         = 0,
2562306a36Sopenharmony_ci	.bits_per_pixel  = 0,
2662306a36Sopenharmony_ci	.grayscale       = 0,
2762306a36Sopenharmony_ci	.red             = {0, 8, 0},
2862306a36Sopenharmony_ci	.green           = {0, 8, 0},
2962306a36Sopenharmony_ci	.blue            = {0, 8, 0},
3062306a36Sopenharmony_ci	.transp          = {0, 0, 0},
3162306a36Sopenharmony_ci	.nonstd          = 0,
3262306a36Sopenharmony_ci	.activate        = FB_ACTIVATE_NOW,
3362306a36Sopenharmony_ci	.height          = -1,
3462306a36Sopenharmony_ci	.width           = -1,
3562306a36Sopenharmony_ci	.accel_flags     = 0,
3662306a36Sopenharmony_ci	.pixclock        = 0,
3762306a36Sopenharmony_ci	.left_margin     = 0,
3862306a36Sopenharmony_ci	.right_margin    = 0,
3962306a36Sopenharmony_ci	.upper_margin    = 0,
4062306a36Sopenharmony_ci	.lower_margin    = 0,
4162306a36Sopenharmony_ci	.hsync_len       = 0,
4262306a36Sopenharmony_ci	.vsync_len       = 0,
4362306a36Sopenharmony_ci	.sync            = 0,
4462306a36Sopenharmony_ci	.vmode           = FB_VMODE_NONINTERLACED,
4562306a36Sopenharmony_ci};
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define MODE_INDEX_NONE           0  /* index for mode=none */
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci/* Boot-time parameters */
5062306a36Sopenharmony_cistatic int sisfb_off = 0;
5162306a36Sopenharmony_cistatic int sisfb_parm_mem = 0;
5262306a36Sopenharmony_cistatic int sisfb_accel = -1;
5362306a36Sopenharmony_cistatic int sisfb_ypan = -1;
5462306a36Sopenharmony_cistatic int sisfb_max = -1;
5562306a36Sopenharmony_cistatic int sisfb_userom = 1;
5662306a36Sopenharmony_cistatic int sisfb_useoem = -1;
5762306a36Sopenharmony_cistatic int sisfb_mode_idx = -1;               /* Use a default mode if we are inside the kernel */
5862306a36Sopenharmony_cistatic int sisfb_parm_rate = -1;
5962306a36Sopenharmony_cistatic int sisfb_crt1off = 0;
6062306a36Sopenharmony_cistatic int sisfb_forcecrt1 = -1;
6162306a36Sopenharmony_cistatic int sisfb_crt2type  = -1;	/* CRT2 type (for overriding autodetection) */
6262306a36Sopenharmony_cistatic int sisfb_crt2flags = 0;
6362306a36Sopenharmony_cistatic int sisfb_pdc = 0xff;
6462306a36Sopenharmony_cistatic int sisfb_pdca = 0xff;
6562306a36Sopenharmony_cistatic int sisfb_scalelcd = -1;
6662306a36Sopenharmony_cistatic int sisfb_specialtiming = CUT_NONE;
6762306a36Sopenharmony_cistatic int sisfb_lvdshl = -1;
6862306a36Sopenharmony_cistatic int sisfb_dstn = 0;
6962306a36Sopenharmony_cistatic int sisfb_fstn = 0;
7062306a36Sopenharmony_cistatic int sisfb_tvplug = -1;		/* Tv plug type (for overriding autodetection) */
7162306a36Sopenharmony_cistatic int sisfb_tvstd  = -1;
7262306a36Sopenharmony_cistatic int sisfb_tvxposoffset = 0;
7362306a36Sopenharmony_cistatic int sisfb_tvyposoffset = 0;
7462306a36Sopenharmony_cistatic int sisfb_nocrt2rate = 0;
7562306a36Sopenharmony_ci#if !defined(__i386__) && !defined(__x86_64__)
7662306a36Sopenharmony_cistatic int sisfb_resetcard = 0;
7762306a36Sopenharmony_cistatic int sisfb_videoram = 0;
7862306a36Sopenharmony_ci#endif
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci/* List of supported chips */
8162306a36Sopenharmony_cistatic struct sisfb_chip_info {
8262306a36Sopenharmony_ci	int		chip;
8362306a36Sopenharmony_ci	int		vgaengine;
8462306a36Sopenharmony_ci	int		mni;
8562306a36Sopenharmony_ci	int		hwcursor_size;
8662306a36Sopenharmony_ci	int		CRT2_write_enable;
8762306a36Sopenharmony_ci	const char	*chip_name;
8862306a36Sopenharmony_ci} sisfb_chip_info[] = {
8962306a36Sopenharmony_ci	{ SIS_300,    SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 300/305" },
9062306a36Sopenharmony_ci	{ SIS_540,    SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 540" },
9162306a36Sopenharmony_ci	{ SIS_630,    SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 630" },
9262306a36Sopenharmony_ci	{ SIS_315H,   SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 315H" },
9362306a36Sopenharmony_ci	{ SIS_315,    SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 315" },
9462306a36Sopenharmony_ci	{ SIS_315PRO, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 315PRO" },
9562306a36Sopenharmony_ci	{ SIS_550,    SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 55x" },
9662306a36Sopenharmony_ci	{ SIS_650,    SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 650" },
9762306a36Sopenharmony_ci	{ SIS_330,    SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 330" },
9862306a36Sopenharmony_ci	{ SIS_660,    SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 660" },
9962306a36Sopenharmony_ci	{ XGI_20,     SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "XGI Z7" },
10062306a36Sopenharmony_ci	{ XGI_40,     SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "XGI V3XT/V5/V8" },
10162306a36Sopenharmony_ci};
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_cistatic struct pci_device_id sisfb_pci_table[] = {
10462306a36Sopenharmony_ci#ifdef CONFIG_FB_SIS_300
10562306a36Sopenharmony_ci	{ PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_300,     PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
10662306a36Sopenharmony_ci	{ PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_540_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
10762306a36Sopenharmony_ci	{ PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
10862306a36Sopenharmony_ci#endif
10962306a36Sopenharmony_ci#ifdef CONFIG_FB_SIS_315
11062306a36Sopenharmony_ci	{ PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_315H,    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
11162306a36Sopenharmony_ci	{ PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_315,     PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
11262306a36Sopenharmony_ci	{ PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_315PRO,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5},
11362306a36Sopenharmony_ci	{ PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_550_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6},
11462306a36Sopenharmony_ci	{ PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_650_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 7},
11562306a36Sopenharmony_ci	{ PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_330,     PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8},
11662306a36Sopenharmony_ci	{ PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_660_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 9},
11762306a36Sopenharmony_ci	{ PCI_VENDOR_ID_XGI,PCI_DEVICE_ID_XGI_20,     PCI_ANY_ID, PCI_ANY_ID, 0, 0,10},
11862306a36Sopenharmony_ci	{ PCI_VENDOR_ID_XGI,PCI_DEVICE_ID_XGI_40,     PCI_ANY_ID, PCI_ANY_ID, 0, 0,11},
11962306a36Sopenharmony_ci#endif
12062306a36Sopenharmony_ci	{ 0 }
12162306a36Sopenharmony_ci};
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ciMODULE_DEVICE_TABLE(pci, sisfb_pci_table);
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_cistatic struct sis_video_info *card_list = NULL;
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci/* The memory heap is now handled card-wise, by using
12862306a36Sopenharmony_ci   sis_malloc_new/sis_free_new. However, the DRM does
12962306a36Sopenharmony_ci   not do this yet. Until it does, we keep a "global"
13062306a36Sopenharmony_ci   heap which is actually the first card's one.
13162306a36Sopenharmony_ci */
13262306a36Sopenharmony_cistatic struct SIS_HEAP	*sisfb_heap;
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci#define MD_SIS300 1
13562306a36Sopenharmony_ci#define MD_SIS315 2
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci/* Mode table */
13862306a36Sopenharmony_cistatic const struct _sisbios_mode {
13962306a36Sopenharmony_ci	char name[15];
14062306a36Sopenharmony_ci	u8  mode_no[2];
14162306a36Sopenharmony_ci	u16 vesa_mode_no_1;  /* "SiS defined" VESA mode number */
14262306a36Sopenharmony_ci	u16 vesa_mode_no_2;  /* Real VESA mode numbers */
14362306a36Sopenharmony_ci	u16 xres;
14462306a36Sopenharmony_ci	u16 yres;
14562306a36Sopenharmony_ci	u16 bpp;
14662306a36Sopenharmony_ci	u16 rate_idx;
14762306a36Sopenharmony_ci	u16 cols;
14862306a36Sopenharmony_ci	u16 rows;
14962306a36Sopenharmony_ci	u8  chipset;
15062306a36Sopenharmony_ci} sisbios_mode[] = {
15162306a36Sopenharmony_ci/*0*/	{"none",         {0xff,0xff}, 0x0000, 0x0000,    0,    0,  0, 0,   0,  0, MD_SIS300|MD_SIS315},
15262306a36Sopenharmony_ci	{"320x200x8",    {0x59,0x59}, 0x0138, 0x0000,  320,  200,  8, 1,  40, 12, MD_SIS300|MD_SIS315},
15362306a36Sopenharmony_ci	{"320x200x16",   {0x41,0x41}, 0x010e, 0x0000,  320,  200, 16, 1,  40, 12, MD_SIS300|MD_SIS315},
15462306a36Sopenharmony_ci	{"320x200x24",   {0x4f,0x4f}, 0x0000, 0x0000,  320,  200, 32, 1,  40, 12, MD_SIS300|MD_SIS315},  /* That's for people who mix up color- and fb depth */
15562306a36Sopenharmony_ci	{"320x200x32",   {0x4f,0x4f}, 0x0000, 0x0000,  320,  200, 32, 1,  40, 12, MD_SIS300|MD_SIS315},
15662306a36Sopenharmony_ci	{"320x240x8",    {0x50,0x50}, 0x0132, 0x0000,  320,  240,  8, 1,  40, 15, MD_SIS300|MD_SIS315},
15762306a36Sopenharmony_ci	{"320x240x16",   {0x56,0x56}, 0x0135, 0x0000,  320,  240, 16, 1,  40, 15, MD_SIS300|MD_SIS315},
15862306a36Sopenharmony_ci	{"320x240x24",   {0x53,0x53}, 0x0000, 0x0000,  320,  240, 32, 1,  40, 15, MD_SIS300|MD_SIS315},
15962306a36Sopenharmony_ci	{"320x240x32",   {0x53,0x53}, 0x0000, 0x0000,  320,  240, 32, 1,  40, 15, MD_SIS300|MD_SIS315},
16062306a36Sopenharmony_ci#define MODE_FSTN_8	9
16162306a36Sopenharmony_ci#define MODE_FSTN_16	10
16262306a36Sopenharmony_ci	{"320x240x8",    {0x5a,0x5a}, 0x0132, 0x0000,  320,  240,  8, 1,  40, 15,           MD_SIS315},  /* FSTN */
16362306a36Sopenharmony_ci/*10*/	{"320x240x16",   {0x5b,0x5b}, 0x0135, 0x0000,  320,  240, 16, 1,  40, 15,           MD_SIS315},  /* FSTN */
16462306a36Sopenharmony_ci	{"400x300x8",    {0x51,0x51}, 0x0133, 0x0000,  400,  300,  8, 1,  50, 18, MD_SIS300|MD_SIS315},
16562306a36Sopenharmony_ci	{"400x300x16",   {0x57,0x57}, 0x0136, 0x0000,  400,  300, 16, 1,  50, 18, MD_SIS300|MD_SIS315},
16662306a36Sopenharmony_ci	{"400x300x24",   {0x54,0x54}, 0x0000, 0x0000,  400,  300, 32, 1,  50, 18, MD_SIS300|MD_SIS315},
16762306a36Sopenharmony_ci	{"400x300x32",   {0x54,0x54}, 0x0000, 0x0000,  400,  300, 32, 1,  50, 18, MD_SIS300|MD_SIS315},
16862306a36Sopenharmony_ci	{"512x384x8",    {0x52,0x52}, 0x0000, 0x0000,  512,  384,  8, 1,  64, 24, MD_SIS300|MD_SIS315},
16962306a36Sopenharmony_ci	{"512x384x16",   {0x58,0x58}, 0x0000, 0x0000,  512,  384, 16, 1,  64, 24, MD_SIS300|MD_SIS315},
17062306a36Sopenharmony_ci	{"512x384x24",   {0x5c,0x5c}, 0x0000, 0x0000,  512,  384, 32, 1,  64, 24, MD_SIS300|MD_SIS315},
17162306a36Sopenharmony_ci	{"512x384x32",   {0x5c,0x5c}, 0x0000, 0x0000,  512,  384, 32, 1,  64, 24, MD_SIS300|MD_SIS315},
17262306a36Sopenharmony_ci	{"640x400x8",    {0x2f,0x2f}, 0x0000, 0x0000,  640,  400,  8, 1,  80, 25, MD_SIS300|MD_SIS315},
17362306a36Sopenharmony_ci/*20*/	{"640x400x16",   {0x5d,0x5d}, 0x0000, 0x0000,  640,  400, 16, 1,  80, 25, MD_SIS300|MD_SIS315},
17462306a36Sopenharmony_ci	{"640x400x24",   {0x5e,0x5e}, 0x0000, 0x0000,  640,  400, 32, 1,  80, 25, MD_SIS300|MD_SIS315},
17562306a36Sopenharmony_ci	{"640x400x32",   {0x5e,0x5e}, 0x0000, 0x0000,  640,  400, 32, 1,  80, 25, MD_SIS300|MD_SIS315},
17662306a36Sopenharmony_ci	{"640x480x8",    {0x2e,0x2e}, 0x0101, 0x0101,  640,  480,  8, 1,  80, 30, MD_SIS300|MD_SIS315},
17762306a36Sopenharmony_ci	{"640x480x16",   {0x44,0x44}, 0x0111, 0x0111,  640,  480, 16, 1,  80, 30, MD_SIS300|MD_SIS315},
17862306a36Sopenharmony_ci	{"640x480x24",   {0x62,0x62}, 0x013a, 0x0112,  640,  480, 32, 1,  80, 30, MD_SIS300|MD_SIS315},
17962306a36Sopenharmony_ci	{"640x480x32",   {0x62,0x62}, 0x013a, 0x0112,  640,  480, 32, 1,  80, 30, MD_SIS300|MD_SIS315},
18062306a36Sopenharmony_ci	{"720x480x8",    {0x31,0x31}, 0x0000, 0x0000,  720,  480,  8, 1,  90, 30, MD_SIS300|MD_SIS315},
18162306a36Sopenharmony_ci	{"720x480x16",   {0x33,0x33}, 0x0000, 0x0000,  720,  480, 16, 1,  90, 30, MD_SIS300|MD_SIS315},
18262306a36Sopenharmony_ci	{"720x480x24",   {0x35,0x35}, 0x0000, 0x0000,  720,  480, 32, 1,  90, 30, MD_SIS300|MD_SIS315},
18362306a36Sopenharmony_ci/*30*/	{"720x480x32",   {0x35,0x35}, 0x0000, 0x0000,  720,  480, 32, 1,  90, 30, MD_SIS300|MD_SIS315},
18462306a36Sopenharmony_ci	{"720x576x8",    {0x32,0x32}, 0x0000, 0x0000,  720,  576,  8, 1,  90, 36, MD_SIS300|MD_SIS315},
18562306a36Sopenharmony_ci	{"720x576x16",   {0x34,0x34}, 0x0000, 0x0000,  720,  576, 16, 1,  90, 36, MD_SIS300|MD_SIS315},
18662306a36Sopenharmony_ci	{"720x576x24",   {0x36,0x36}, 0x0000, 0x0000,  720,  576, 32, 1,  90, 36, MD_SIS300|MD_SIS315},
18762306a36Sopenharmony_ci	{"720x576x32",   {0x36,0x36}, 0x0000, 0x0000,  720,  576, 32, 1,  90, 36, MD_SIS300|MD_SIS315},
18862306a36Sopenharmony_ci	{"768x576x8",    {0x5f,0x5f}, 0x0000, 0x0000,  768,  576,  8, 1,  96, 36, MD_SIS300|MD_SIS315},
18962306a36Sopenharmony_ci	{"768x576x16",   {0x60,0x60}, 0x0000, 0x0000,  768,  576, 16, 1,  96, 36, MD_SIS300|MD_SIS315},
19062306a36Sopenharmony_ci	{"768x576x24",   {0x61,0x61}, 0x0000, 0x0000,  768,  576, 32, 1,  96, 36, MD_SIS300|MD_SIS315},
19162306a36Sopenharmony_ci	{"768x576x32",   {0x61,0x61}, 0x0000, 0x0000,  768,  576, 32, 1,  96, 36, MD_SIS300|MD_SIS315},
19262306a36Sopenharmony_ci	{"800x480x8",    {0x70,0x70}, 0x0000, 0x0000,  800,  480,  8, 1, 100, 30, MD_SIS300|MD_SIS315},
19362306a36Sopenharmony_ci/*40*/	{"800x480x16",   {0x7a,0x7a}, 0x0000, 0x0000,  800,  480, 16, 1, 100, 30, MD_SIS300|MD_SIS315},
19462306a36Sopenharmony_ci	{"800x480x24",   {0x76,0x76}, 0x0000, 0x0000,  800,  480, 32, 1, 100, 30, MD_SIS300|MD_SIS315},
19562306a36Sopenharmony_ci	{"800x480x32",   {0x76,0x76}, 0x0000, 0x0000,  800,  480, 32, 1, 100, 30, MD_SIS300|MD_SIS315},
19662306a36Sopenharmony_ci#define DEFAULT_MODE		43 /* index for 800x600x8 */
19762306a36Sopenharmony_ci#define DEFAULT_LCDMODE		43 /* index for 800x600x8 */
19862306a36Sopenharmony_ci#define DEFAULT_TVMODE		43 /* index for 800x600x8 */
19962306a36Sopenharmony_ci	{"800x600x8",    {0x30,0x30}, 0x0103, 0x0103,  800,  600,  8, 2, 100, 37, MD_SIS300|MD_SIS315},
20062306a36Sopenharmony_ci	{"800x600x16",   {0x47,0x47}, 0x0114, 0x0114,  800,  600, 16, 2, 100, 37, MD_SIS300|MD_SIS315},
20162306a36Sopenharmony_ci	{"800x600x24",   {0x63,0x63}, 0x013b, 0x0115,  800,  600, 32, 2, 100, 37, MD_SIS300|MD_SIS315},
20262306a36Sopenharmony_ci	{"800x600x32",   {0x63,0x63}, 0x013b, 0x0115,  800,  600, 32, 2, 100, 37, MD_SIS300|MD_SIS315},
20362306a36Sopenharmony_ci	{"848x480x8",    {0x39,0x39}, 0x0000, 0x0000,  848,  480,  8, 2, 106, 30, MD_SIS300|MD_SIS315},
20462306a36Sopenharmony_ci#define DEFAULT_MODE_848	48
20562306a36Sopenharmony_ci	{"848x480x16",   {0x3b,0x3b}, 0x0000, 0x0000,  848,  480, 16, 2, 106, 30, MD_SIS300|MD_SIS315},
20662306a36Sopenharmony_ci	{"848x480x24",   {0x3e,0x3e}, 0x0000, 0x0000,  848,  480, 32, 2, 106, 30, MD_SIS300|MD_SIS315},
20762306a36Sopenharmony_ci/*50*/	{"848x480x32",   {0x3e,0x3e}, 0x0000, 0x0000,  848,  480, 32, 2, 106, 30, MD_SIS300|MD_SIS315},
20862306a36Sopenharmony_ci	{"856x480x8",    {0x3f,0x3f}, 0x0000, 0x0000,  856,  480,  8, 2, 107, 30, MD_SIS300|MD_SIS315},
20962306a36Sopenharmony_ci#define DEFAULT_MODE_856	52
21062306a36Sopenharmony_ci	{"856x480x16",   {0x42,0x42}, 0x0000, 0x0000,  856,  480, 16, 2, 107, 30, MD_SIS300|MD_SIS315},
21162306a36Sopenharmony_ci	{"856x480x24",   {0x45,0x45}, 0x0000, 0x0000,  856,  480, 32, 2, 107, 30, MD_SIS300|MD_SIS315},
21262306a36Sopenharmony_ci	{"856x480x32",   {0x45,0x45}, 0x0000, 0x0000,  856,  480, 32, 2, 107, 30, MD_SIS300|MD_SIS315},
21362306a36Sopenharmony_ci	{"960x540x8",    {0x1d,0x1d}, 0x0000, 0x0000,  960,  540,  8, 1, 120, 33,           MD_SIS315},
21462306a36Sopenharmony_ci	{"960x540x16",   {0x1e,0x1e}, 0x0000, 0x0000,  960,  540, 16, 1, 120, 33,           MD_SIS315},
21562306a36Sopenharmony_ci	{"960x540x24",   {0x1f,0x1f}, 0x0000, 0x0000,  960,  540, 32, 1, 120, 33,           MD_SIS315},
21662306a36Sopenharmony_ci	{"960x540x32",   {0x1f,0x1f}, 0x0000, 0x0000,  960,  540, 32, 1, 120, 33,           MD_SIS315},
21762306a36Sopenharmony_ci	{"960x600x8",    {0x20,0x20}, 0x0000, 0x0000,  960,  600,  8, 1, 120, 37,           MD_SIS315},
21862306a36Sopenharmony_ci/*60*/	{"960x600x16",   {0x21,0x21}, 0x0000, 0x0000,  960,  600, 16, 1, 120, 37,           MD_SIS315},
21962306a36Sopenharmony_ci	{"960x600x24",   {0x22,0x22}, 0x0000, 0x0000,  960,  600, 32, 1, 120, 37,           MD_SIS315},
22062306a36Sopenharmony_ci	{"960x600x32",   {0x22,0x22}, 0x0000, 0x0000,  960,  600, 32, 1, 120, 37,           MD_SIS315},
22162306a36Sopenharmony_ci	{"1024x576x8",   {0x71,0x71}, 0x0000, 0x0000, 1024,  576,  8, 1, 128, 36, MD_SIS300|MD_SIS315},
22262306a36Sopenharmony_ci	{"1024x576x16",  {0x74,0x74}, 0x0000, 0x0000, 1024,  576, 16, 1, 128, 36, MD_SIS300|MD_SIS315},
22362306a36Sopenharmony_ci	{"1024x576x24",  {0x77,0x77}, 0x0000, 0x0000, 1024,  576, 32, 1, 128, 36, MD_SIS300|MD_SIS315},
22462306a36Sopenharmony_ci	{"1024x576x32",  {0x77,0x77}, 0x0000, 0x0000, 1024,  576, 32, 1, 128, 36, MD_SIS300|MD_SIS315},
22562306a36Sopenharmony_ci	{"1024x600x8",   {0x20,0x20}, 0x0000, 0x0000, 1024,  600,  8, 1, 128, 37, MD_SIS300          },
22662306a36Sopenharmony_ci	{"1024x600x16",  {0x21,0x21}, 0x0000, 0x0000, 1024,  600, 16, 1, 128, 37, MD_SIS300          },
22762306a36Sopenharmony_ci	{"1024x600x24",  {0x22,0x22}, 0x0000, 0x0000, 1024,  600, 32, 1, 128, 37, MD_SIS300          },
22862306a36Sopenharmony_ci/*70*/	{"1024x600x32",  {0x22,0x22}, 0x0000, 0x0000, 1024,  600, 32, 1, 128, 37, MD_SIS300          },
22962306a36Sopenharmony_ci	{"1024x768x8",   {0x38,0x38}, 0x0105, 0x0105, 1024,  768,  8, 2, 128, 48, MD_SIS300|MD_SIS315},
23062306a36Sopenharmony_ci	{"1024x768x16",  {0x4a,0x4a}, 0x0117, 0x0117, 1024,  768, 16, 2, 128, 48, MD_SIS300|MD_SIS315},
23162306a36Sopenharmony_ci	{"1024x768x24",  {0x64,0x64}, 0x013c, 0x0118, 1024,  768, 32, 2, 128, 48, MD_SIS300|MD_SIS315},
23262306a36Sopenharmony_ci	{"1024x768x32",  {0x64,0x64}, 0x013c, 0x0118, 1024,  768, 32, 2, 128, 48, MD_SIS300|MD_SIS315},
23362306a36Sopenharmony_ci	{"1152x768x8",   {0x23,0x23}, 0x0000, 0x0000, 1152,  768,  8, 1, 144, 48, MD_SIS300          },
23462306a36Sopenharmony_ci	{"1152x768x16",  {0x24,0x24}, 0x0000, 0x0000, 1152,  768, 16, 1, 144, 48, MD_SIS300          },
23562306a36Sopenharmony_ci	{"1152x768x24",  {0x25,0x25}, 0x0000, 0x0000, 1152,  768, 32, 1, 144, 48, MD_SIS300          },
23662306a36Sopenharmony_ci	{"1152x768x32",  {0x25,0x25}, 0x0000, 0x0000, 1152,  768, 32, 1, 144, 48, MD_SIS300          },
23762306a36Sopenharmony_ci	{"1152x864x8",   {0x29,0x29}, 0x0000, 0x0000, 1152,  864,  8, 1, 144, 54, MD_SIS300|MD_SIS315},
23862306a36Sopenharmony_ci/*80*/	{"1152x864x16",  {0x2a,0x2a}, 0x0000, 0x0000, 1152,  864, 16, 1, 144, 54, MD_SIS300|MD_SIS315},
23962306a36Sopenharmony_ci	{"1152x864x24",  {0x2b,0x2b}, 0x0000, 0x0000, 1152,  864, 32, 1, 144, 54, MD_SIS300|MD_SIS315},
24062306a36Sopenharmony_ci	{"1152x864x32",  {0x2b,0x2b}, 0x0000, 0x0000, 1152,  864, 32, 1, 144, 54, MD_SIS300|MD_SIS315},
24162306a36Sopenharmony_ci	{"1280x720x8",   {0x79,0x79}, 0x0000, 0x0000, 1280,  720,  8, 1, 160, 45, MD_SIS300|MD_SIS315},
24262306a36Sopenharmony_ci	{"1280x720x16",  {0x75,0x75}, 0x0000, 0x0000, 1280,  720, 16, 1, 160, 45, MD_SIS300|MD_SIS315},
24362306a36Sopenharmony_ci	{"1280x720x24",  {0x78,0x78}, 0x0000, 0x0000, 1280,  720, 32, 1, 160, 45, MD_SIS300|MD_SIS315},
24462306a36Sopenharmony_ci	{"1280x720x32",  {0x78,0x78}, 0x0000, 0x0000, 1280,  720, 32, 1, 160, 45, MD_SIS300|MD_SIS315},
24562306a36Sopenharmony_ci	{"1280x768x8",   {0x55,0x23}, 0x0000, 0x0000, 1280,  768,  8, 1, 160, 48, MD_SIS300|MD_SIS315},
24662306a36Sopenharmony_ci	{"1280x768x16",  {0x5a,0x24}, 0x0000, 0x0000, 1280,  768, 16, 1, 160, 48, MD_SIS300|MD_SIS315},
24762306a36Sopenharmony_ci	{"1280x768x24",  {0x5b,0x25}, 0x0000, 0x0000, 1280,  768, 32, 1, 160, 48, MD_SIS300|MD_SIS315},
24862306a36Sopenharmony_ci/*90*/	{"1280x768x32",  {0x5b,0x25}, 0x0000, 0x0000, 1280,  768, 32, 1, 160, 48, MD_SIS300|MD_SIS315},
24962306a36Sopenharmony_ci	{"1280x800x8",   {0x14,0x14}, 0x0000, 0x0000, 1280,  800,  8, 1, 160, 50,           MD_SIS315},
25062306a36Sopenharmony_ci	{"1280x800x16",  {0x15,0x15}, 0x0000, 0x0000, 1280,  800, 16, 1, 160, 50,           MD_SIS315},
25162306a36Sopenharmony_ci	{"1280x800x24",  {0x16,0x16}, 0x0000, 0x0000, 1280,  800, 32, 1, 160, 50,           MD_SIS315},
25262306a36Sopenharmony_ci	{"1280x800x32",  {0x16,0x16}, 0x0000, 0x0000, 1280,  800, 32, 1, 160, 50,           MD_SIS315},
25362306a36Sopenharmony_ci	{"1280x854x8",   {0x14,0x14}, 0x0000, 0x0000, 1280,  854,  8, 1, 160, 53,           MD_SIS315},
25462306a36Sopenharmony_ci	{"1280x854x16",  {0x15,0x15}, 0x0000, 0x0000, 1280,  854, 16, 1, 160, 53,           MD_SIS315},
25562306a36Sopenharmony_ci	{"1280x854x24",  {0x16,0x16}, 0x0000, 0x0000, 1280,  854, 32, 1, 160, 53,           MD_SIS315},
25662306a36Sopenharmony_ci	{"1280x854x32",  {0x16,0x16}, 0x0000, 0x0000, 1280,  854, 32, 1, 160, 53,           MD_SIS315},
25762306a36Sopenharmony_ci	{"1280x960x8",   {0x7c,0x7c}, 0x0000, 0x0000, 1280,  960,  8, 1, 160, 60, MD_SIS300|MD_SIS315},
25862306a36Sopenharmony_ci/*100*/	{"1280x960x16",  {0x7d,0x7d}, 0x0000, 0x0000, 1280,  960, 16, 1, 160, 60, MD_SIS300|MD_SIS315},
25962306a36Sopenharmony_ci	{"1280x960x24",  {0x7e,0x7e}, 0x0000, 0x0000, 1280,  960, 32, 1, 160, 60, MD_SIS300|MD_SIS315},
26062306a36Sopenharmony_ci	{"1280x960x32",  {0x7e,0x7e}, 0x0000, 0x0000, 1280,  960, 32, 1, 160, 60, MD_SIS300|MD_SIS315},
26162306a36Sopenharmony_ci	{"1280x1024x8",  {0x3a,0x3a}, 0x0107, 0x0107, 1280, 1024,  8, 2, 160, 64, MD_SIS300|MD_SIS315},
26262306a36Sopenharmony_ci	{"1280x1024x16", {0x4d,0x4d}, 0x011a, 0x011a, 1280, 1024, 16, 2, 160, 64, MD_SIS300|MD_SIS315},
26362306a36Sopenharmony_ci	{"1280x1024x24", {0x65,0x65}, 0x013d, 0x011b, 1280, 1024, 32, 2, 160, 64, MD_SIS300|MD_SIS315},
26462306a36Sopenharmony_ci	{"1280x1024x32", {0x65,0x65}, 0x013d, 0x011b, 1280, 1024, 32, 2, 160, 64, MD_SIS300|MD_SIS315},
26562306a36Sopenharmony_ci	{"1360x768x8",   {0x48,0x48}, 0x0000, 0x0000, 1360,  768,  8, 1, 170, 48, MD_SIS300|MD_SIS315},
26662306a36Sopenharmony_ci	{"1360x768x16",  {0x4b,0x4b}, 0x0000, 0x0000, 1360,  768, 16, 1, 170, 48, MD_SIS300|MD_SIS315},
26762306a36Sopenharmony_ci	{"1360x768x24",  {0x4e,0x4e}, 0x0000, 0x0000, 1360,  768, 32, 1, 170, 48, MD_SIS300|MD_SIS315},
26862306a36Sopenharmony_ci/*110*/	{"1360x768x32",  {0x4e,0x4e}, 0x0000, 0x0000, 1360,  768, 32, 1, 170, 48, MD_SIS300|MD_SIS315},
26962306a36Sopenharmony_ci	{"1360x1024x8",  {0x67,0x67}, 0x0000, 0x0000, 1360, 1024,  8, 1, 170, 64, MD_SIS300          },
27062306a36Sopenharmony_ci#define DEFAULT_MODE_1360	112
27162306a36Sopenharmony_ci	{"1360x1024x16", {0x6f,0x6f}, 0x0000, 0x0000, 1360, 1024, 16, 1, 170, 64, MD_SIS300          },
27262306a36Sopenharmony_ci	{"1360x1024x24", {0x72,0x72}, 0x0000, 0x0000, 1360, 1024, 32, 1, 170, 64, MD_SIS300          },
27362306a36Sopenharmony_ci	{"1360x1024x32", {0x72,0x72}, 0x0000, 0x0000, 1360, 1024, 32, 1, 170, 64, MD_SIS300          },
27462306a36Sopenharmony_ci	{"1400x1050x8",  {0x26,0x26}, 0x0000, 0x0000, 1400, 1050,  8, 1, 175, 65,           MD_SIS315},
27562306a36Sopenharmony_ci	{"1400x1050x16", {0x27,0x27}, 0x0000, 0x0000, 1400, 1050, 16, 1, 175, 65,           MD_SIS315},
27662306a36Sopenharmony_ci	{"1400x1050x24", {0x28,0x28}, 0x0000, 0x0000, 1400, 1050, 32, 1, 175, 65,           MD_SIS315},
27762306a36Sopenharmony_ci	{"1400x1050x32", {0x28,0x28}, 0x0000, 0x0000, 1400, 1050, 32, 1, 175, 65,           MD_SIS315},
27862306a36Sopenharmony_ci	{"1600x1200x8",  {0x3c,0x3c}, 0x0130, 0x011c, 1600, 1200,  8, 1, 200, 75, MD_SIS300|MD_SIS315},
27962306a36Sopenharmony_ci/*120*/	{"1600x1200x16", {0x3d,0x3d}, 0x0131, 0x011e, 1600, 1200, 16, 1, 200, 75, MD_SIS300|MD_SIS315},
28062306a36Sopenharmony_ci	{"1600x1200x24", {0x66,0x66}, 0x013e, 0x011f, 1600, 1200, 32, 1, 200, 75, MD_SIS300|MD_SIS315},
28162306a36Sopenharmony_ci	{"1600x1200x32", {0x66,0x66}, 0x013e, 0x011f, 1600, 1200, 32, 1, 200, 75, MD_SIS300|MD_SIS315},
28262306a36Sopenharmony_ci	{"1680x1050x8",  {0x17,0x17}, 0x0000, 0x0000, 1680, 1050,  8, 1, 210, 65,           MD_SIS315},
28362306a36Sopenharmony_ci	{"1680x1050x16", {0x18,0x18}, 0x0000, 0x0000, 1680, 1050, 16, 1, 210, 65,           MD_SIS315},
28462306a36Sopenharmony_ci	{"1680x1050x24", {0x19,0x19}, 0x0000, 0x0000, 1680, 1050, 32, 1, 210, 65,           MD_SIS315},
28562306a36Sopenharmony_ci	{"1680x1050x32", {0x19,0x19}, 0x0000, 0x0000, 1680, 1050, 32, 1, 210, 65,           MD_SIS315},
28662306a36Sopenharmony_ci	{"1920x1080x8",  {0x2c,0x2c}, 0x0000, 0x0000, 1920, 1080,  8, 1, 240, 67,           MD_SIS315},
28762306a36Sopenharmony_ci	{"1920x1080x16", {0x2d,0x2d}, 0x0000, 0x0000, 1920, 1080, 16, 1, 240, 67,           MD_SIS315},
28862306a36Sopenharmony_ci	{"1920x1080x24", {0x73,0x73}, 0x0000, 0x0000, 1920, 1080, 32, 1, 240, 67,           MD_SIS315},
28962306a36Sopenharmony_ci/*130*/	{"1920x1080x32", {0x73,0x73}, 0x0000, 0x0000, 1920, 1080, 32, 1, 240, 67,           MD_SIS315},
29062306a36Sopenharmony_ci	{"1920x1440x8",  {0x68,0x68}, 0x013f, 0x0000, 1920, 1440,  8, 1, 240, 75, MD_SIS300|MD_SIS315},
29162306a36Sopenharmony_ci	{"1920x1440x16", {0x69,0x69}, 0x0140, 0x0000, 1920, 1440, 16, 1, 240, 75, MD_SIS300|MD_SIS315},
29262306a36Sopenharmony_ci	{"1920x1440x24", {0x6b,0x6b}, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, MD_SIS300|MD_SIS315},
29362306a36Sopenharmony_ci	{"1920x1440x32", {0x6b,0x6b}, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, MD_SIS300|MD_SIS315},
29462306a36Sopenharmony_ci	{"2048x1536x8",  {0x6c,0x6c}, 0x0000, 0x0000, 2048, 1536,  8, 1, 256, 96,           MD_SIS315},
29562306a36Sopenharmony_ci	{"2048x1536x16", {0x6d,0x6d}, 0x0000, 0x0000, 2048, 1536, 16, 1, 256, 96,           MD_SIS315},
29662306a36Sopenharmony_ci	{"2048x1536x24", {0x6e,0x6e}, 0x0000, 0x0000, 2048, 1536, 32, 1, 256, 96,           MD_SIS315},
29762306a36Sopenharmony_ci	{"2048x1536x32", {0x6e,0x6e}, 0x0000, 0x0000, 2048, 1536, 32, 1, 256, 96,           MD_SIS315},
29862306a36Sopenharmony_ci	{"\0", {0x00,0x00}, 0, 0, 0, 0, 0, 0, 0}
29962306a36Sopenharmony_ci};
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ci#define SIS_LCD_NUMBER 18
30262306a36Sopenharmony_cistatic struct _sis_lcd_data {
30362306a36Sopenharmony_ci	u32 lcdtype;
30462306a36Sopenharmony_ci	u16 xres;
30562306a36Sopenharmony_ci	u16 yres;
30662306a36Sopenharmony_ci	u8  default_mode_idx;
30762306a36Sopenharmony_ci} sis_lcd_data[] = {
30862306a36Sopenharmony_ci	{ LCD_640x480,    640,  480,  23 },
30962306a36Sopenharmony_ci	{ LCD_800x600,    800,  600,  43 },
31062306a36Sopenharmony_ci	{ LCD_1024x600,  1024,  600,  67 },
31162306a36Sopenharmony_ci	{ LCD_1024x768,  1024,  768,  71 },
31262306a36Sopenharmony_ci	{ LCD_1152x768,  1152,  768,  75 },
31362306a36Sopenharmony_ci	{ LCD_1152x864,  1152,  864,  79 },
31462306a36Sopenharmony_ci	{ LCD_1280x720,  1280,  720,  83 },
31562306a36Sopenharmony_ci	{ LCD_1280x768,  1280,  768,  87 },
31662306a36Sopenharmony_ci	{ LCD_1280x800,  1280,  800,  91 },
31762306a36Sopenharmony_ci	{ LCD_1280x854,  1280,  854,  95 },
31862306a36Sopenharmony_ci	{ LCD_1280x960,  1280,  960,  99 },
31962306a36Sopenharmony_ci	{ LCD_1280x1024, 1280, 1024, 103 },
32062306a36Sopenharmony_ci	{ LCD_1400x1050, 1400, 1050, 115 },
32162306a36Sopenharmony_ci	{ LCD_1680x1050, 1680, 1050, 123 },
32262306a36Sopenharmony_ci	{ LCD_1600x1200, 1600, 1200, 119 },
32362306a36Sopenharmony_ci	{ LCD_320x240_2,  320,  240,   9 },
32462306a36Sopenharmony_ci	{ LCD_320x240_3,  320,  240,   9 },
32562306a36Sopenharmony_ci	{ LCD_320x240,    320,  240,   9 },
32662306a36Sopenharmony_ci};
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci/* CR36 evaluation */
32962306a36Sopenharmony_cistatic unsigned short sis300paneltype[] = {
33062306a36Sopenharmony_ci	LCD_UNKNOWN,   LCD_800x600,   LCD_1024x768,  LCD_1280x1024,
33162306a36Sopenharmony_ci	LCD_1280x960,  LCD_640x480,   LCD_1024x600,  LCD_1152x768,
33262306a36Sopenharmony_ci	LCD_UNKNOWN,   LCD_UNKNOWN,   LCD_UNKNOWN,   LCD_UNKNOWN,
33362306a36Sopenharmony_ci	LCD_UNKNOWN,   LCD_UNKNOWN,   LCD_UNKNOWN,   LCD_UNKNOWN
33462306a36Sopenharmony_ci};
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_cistatic unsigned short sis310paneltype[] = {
33762306a36Sopenharmony_ci	LCD_UNKNOWN,   LCD_800x600,   LCD_1024x768,  LCD_1280x1024,
33862306a36Sopenharmony_ci	LCD_640x480,   LCD_1024x600,  LCD_1152x864,  LCD_1280x960,
33962306a36Sopenharmony_ci	LCD_1152x768,  LCD_1400x1050, LCD_1280x768,  LCD_1600x1200,
34062306a36Sopenharmony_ci	LCD_320x240_2, LCD_320x240_3, LCD_UNKNOWN,   LCD_UNKNOWN
34162306a36Sopenharmony_ci};
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_cistatic unsigned short sis661paneltype[] = {
34462306a36Sopenharmony_ci	LCD_UNKNOWN,   LCD_800x600,   LCD_1024x768,  LCD_1280x1024,
34562306a36Sopenharmony_ci	LCD_640x480,   LCD_1024x600,  LCD_1152x864,  LCD_1280x960,
34662306a36Sopenharmony_ci	LCD_1280x854,  LCD_1400x1050, LCD_1280x768,  LCD_1600x1200,
34762306a36Sopenharmony_ci	LCD_1280x800,  LCD_1680x1050, LCD_1280x720,  LCD_UNKNOWN
34862306a36Sopenharmony_ci};
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ci#define FL_550_DSTN 0x01
35162306a36Sopenharmony_ci#define FL_550_FSTN 0x02
35262306a36Sopenharmony_ci#define FL_300      0x04
35362306a36Sopenharmony_ci#define FL_315      0x08
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_cistatic struct _sis_crt2type {
35662306a36Sopenharmony_ci	char name[32];
35762306a36Sopenharmony_ci	u32 type_no;
35862306a36Sopenharmony_ci	u32 tvplug_no;
35962306a36Sopenharmony_ci	u16 flags;
36062306a36Sopenharmony_ci} sis_crt2type[] __initdata = {
36162306a36Sopenharmony_ci	{"NONE", 	     0, 	-1,                     FL_300|FL_315},
36262306a36Sopenharmony_ci	{"LCD",  	     CRT2_LCD, 	-1,                     FL_300|FL_315},
36362306a36Sopenharmony_ci	{"TV",   	     CRT2_TV, 	-1,                     FL_300|FL_315},
36462306a36Sopenharmony_ci	{"VGA",  	     CRT2_VGA, 	-1,                     FL_300|FL_315},
36562306a36Sopenharmony_ci	{"SVIDEO", 	     CRT2_TV, 	TV_SVIDEO,              FL_300|FL_315},
36662306a36Sopenharmony_ci	{"COMPOSITE", 	     CRT2_TV, 	TV_AVIDEO,              FL_300|FL_315},
36762306a36Sopenharmony_ci	{"CVBS", 	     CRT2_TV, 	TV_AVIDEO,              FL_300|FL_315},
36862306a36Sopenharmony_ci	{"SVIDEO+COMPOSITE", CRT2_TV,   TV_AVIDEO|TV_SVIDEO,    FL_300|FL_315},
36962306a36Sopenharmony_ci	{"COMPOSITE+SVIDEO", CRT2_TV,   TV_AVIDEO|TV_SVIDEO,    FL_300|FL_315},
37062306a36Sopenharmony_ci	{"SVIDEO+CVBS",      CRT2_TV,   TV_AVIDEO|TV_SVIDEO,    FL_300|FL_315},
37162306a36Sopenharmony_ci	{"CVBS+SVIDEO",      CRT2_TV,   TV_AVIDEO|TV_SVIDEO,    FL_300|FL_315},
37262306a36Sopenharmony_ci	{"SCART", 	     CRT2_TV, 	TV_SCART,               FL_300|FL_315},
37362306a36Sopenharmony_ci	{"HIVISION",	     CRT2_TV,   TV_HIVISION,            FL_315},
37462306a36Sopenharmony_ci	{"YPBPR480I",	     CRT2_TV,   TV_YPBPR|TV_YPBPR525I,  FL_315},
37562306a36Sopenharmony_ci	{"YPBPR480P",	     CRT2_TV,   TV_YPBPR|TV_YPBPR525P,  FL_315},
37662306a36Sopenharmony_ci	{"YPBPR720P",	     CRT2_TV,   TV_YPBPR|TV_YPBPR750P,  FL_315},
37762306a36Sopenharmony_ci	{"YPBPR1080I",	     CRT2_TV,   TV_YPBPR|TV_YPBPR1080I, FL_315},
37862306a36Sopenharmony_ci	{"DSTN",             CRT2_LCD,  -1,                     FL_315|FL_550_DSTN},
37962306a36Sopenharmony_ci	{"FSTN",             CRT2_LCD,  -1,                     FL_315|FL_550_FSTN},
38062306a36Sopenharmony_ci	{"\0",  	     -1, 	-1,                     0}
38162306a36Sopenharmony_ci};
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ci/* TV standard */
38462306a36Sopenharmony_cistatic struct _sis_tvtype {
38562306a36Sopenharmony_ci	char name[6];
38662306a36Sopenharmony_ci	u32 type_no;
38762306a36Sopenharmony_ci} sis_tvtype[] __initdata = {
38862306a36Sopenharmony_ci	{"PAL",  	TV_PAL},
38962306a36Sopenharmony_ci	{"NTSC", 	TV_NTSC},
39062306a36Sopenharmony_ci	{"PALM",  	TV_PAL|TV_PALM},
39162306a36Sopenharmony_ci	{"PALN",  	TV_PAL|TV_PALN},
39262306a36Sopenharmony_ci	{"NTSCJ",  	TV_NTSC|TV_NTSCJ},
39362306a36Sopenharmony_ci	{"\0",   	-1}
39462306a36Sopenharmony_ci};
39562306a36Sopenharmony_ci
39662306a36Sopenharmony_cistatic const struct _sis_vrate {
39762306a36Sopenharmony_ci	u16 idx;
39862306a36Sopenharmony_ci	u16 xres;
39962306a36Sopenharmony_ci	u16 yres;
40062306a36Sopenharmony_ci	u16 refresh;
40162306a36Sopenharmony_ci	bool SiS730valid32bpp;
40262306a36Sopenharmony_ci} sisfb_vrate[] = {
40362306a36Sopenharmony_ci	{1,  320,  200,  70,  true},
40462306a36Sopenharmony_ci	{1,  320,  240,  60,  true},
40562306a36Sopenharmony_ci	{1,  400,  300,  60,  true},
40662306a36Sopenharmony_ci	{1,  512,  384,  60,  true},
40762306a36Sopenharmony_ci	{1,  640,  400,  72,  true},
40862306a36Sopenharmony_ci	{1,  640,  480,  60,  true}, {2,  640,  480,  72,  true}, {3,  640,  480,  75,  true},
40962306a36Sopenharmony_ci	{4,  640,  480,  85,  true}, {5,  640,  480, 100,  true}, {6,  640,  480, 120,  true},
41062306a36Sopenharmony_ci	{7,  640,  480, 160,  true}, {8,  640,  480, 200,  true},
41162306a36Sopenharmony_ci	{1,  720,  480,  60,  true},
41262306a36Sopenharmony_ci	{1,  720,  576,  58,  true},
41362306a36Sopenharmony_ci	{1,  768,  576,  58,  true},
41462306a36Sopenharmony_ci	{1,  800,  480,  60,  true}, {2,  800,  480,  75,  true}, {3,  800,  480,  85,  true},
41562306a36Sopenharmony_ci	{1,  800,  600,  56,  true}, {2,  800,  600,  60,  true}, {3,  800,  600,  72,  true},
41662306a36Sopenharmony_ci	{4,  800,  600,  75,  true}, {5,  800,  600,  85,  true}, {6,  800,  600, 105,  true},
41762306a36Sopenharmony_ci	{7,  800,  600, 120,  true}, {8,  800,  600, 160,  true},
41862306a36Sopenharmony_ci	{1,  848,  480,  39,  true}, {2,  848,  480,  60,  true},
41962306a36Sopenharmony_ci	{1,  856,  480,  39,  true}, {2,  856,  480,  60,  true},
42062306a36Sopenharmony_ci	{1,  960,  540,  60,  true},
42162306a36Sopenharmony_ci	{1,  960,  600,  60,  true},
42262306a36Sopenharmony_ci	{1, 1024,  576,  60,  true}, {2, 1024,  576,  75,  true}, {3, 1024,  576,  85,  true},
42362306a36Sopenharmony_ci	{1, 1024,  600,  60,  true},
42462306a36Sopenharmony_ci	{1, 1024,  768,  43,  true}, {2, 1024,  768,  60,  true}, {3, 1024,  768,  70, false},
42562306a36Sopenharmony_ci	{4, 1024,  768,  75, false}, {5, 1024,  768,  85,  true}, {6, 1024,  768, 100,  true},
42662306a36Sopenharmony_ci	{7, 1024,  768, 120,  true},
42762306a36Sopenharmony_ci	{1, 1152,  768,  60,  true},
42862306a36Sopenharmony_ci	{1, 1152,  864,  60,  true}, {2, 1152,  864,  75,  true}, {3, 1152,  864,  84,  true},
42962306a36Sopenharmony_ci	{1, 1280,  720,  60,  true}, {2, 1280,  720,  75,  true}, {3, 1280,  720,  85,  true},
43062306a36Sopenharmony_ci	{1, 1280,  768,  60,  true},
43162306a36Sopenharmony_ci	{1, 1280,  800,  60,  true},
43262306a36Sopenharmony_ci	{1, 1280,  854,  60,  true},
43362306a36Sopenharmony_ci	{1, 1280,  960,  60,  true}, {2, 1280,  960,  85,  true},
43462306a36Sopenharmony_ci	{1, 1280, 1024,  43,  true}, {2, 1280, 1024,  60,  true}, {3, 1280, 1024,  75,  true},
43562306a36Sopenharmony_ci	{4, 1280, 1024,  85,  true},
43662306a36Sopenharmony_ci	{1, 1360,  768,  60,  true},
43762306a36Sopenharmony_ci	{1, 1360, 1024,  59,  true},
43862306a36Sopenharmony_ci	{1, 1400, 1050,  60,  true}, {2, 1400, 1050,  75,  true},
43962306a36Sopenharmony_ci	{1, 1600, 1200,  60,  true}, {2, 1600, 1200,  65,  true}, {3, 1600, 1200,  70,  true},
44062306a36Sopenharmony_ci	{4, 1600, 1200,  75,  true}, {5, 1600, 1200,  85,  true}, {6, 1600, 1200, 100,  true},
44162306a36Sopenharmony_ci	{7, 1600, 1200, 120,  true},
44262306a36Sopenharmony_ci	{1, 1680, 1050,  60,  true},
44362306a36Sopenharmony_ci	{1, 1920, 1080,  30,  true},
44462306a36Sopenharmony_ci	{1, 1920, 1440,  60,  true}, {2, 1920, 1440,  65,  true}, {3, 1920, 1440,  70,  true},
44562306a36Sopenharmony_ci	{4, 1920, 1440,  75,  true}, {5, 1920, 1440,  85,  true}, {6, 1920, 1440, 100,  true},
44662306a36Sopenharmony_ci	{1, 2048, 1536,  60,  true}, {2, 2048, 1536,  65,  true}, {3, 2048, 1536,  70,  true},
44762306a36Sopenharmony_ci	{4, 2048, 1536,  75,  true}, {5, 2048, 1536,  85,  true},
44862306a36Sopenharmony_ci	{0,    0,    0,   0, false}
44962306a36Sopenharmony_ci};
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_cistatic struct _sisfbddcsmodes {
45262306a36Sopenharmony_ci	u32 mask;
45362306a36Sopenharmony_ci	u16 h;
45462306a36Sopenharmony_ci	u16 v;
45562306a36Sopenharmony_ci	u32 d;
45662306a36Sopenharmony_ci} sisfb_ddcsmodes[] = {
45762306a36Sopenharmony_ci	{ 0x10000, 67, 75, 108000},
45862306a36Sopenharmony_ci	{ 0x08000, 48, 72,  50000},
45962306a36Sopenharmony_ci	{ 0x04000, 46, 75,  49500},
46062306a36Sopenharmony_ci	{ 0x01000, 35, 43,  44900},
46162306a36Sopenharmony_ci	{ 0x00800, 48, 60,  65000},
46262306a36Sopenharmony_ci	{ 0x00400, 56, 70,  75000},
46362306a36Sopenharmony_ci	{ 0x00200, 60, 75,  78800},
46462306a36Sopenharmony_ci	{ 0x00100, 80, 75, 135000},
46562306a36Sopenharmony_ci	{ 0x00020, 31, 60,  25200},
46662306a36Sopenharmony_ci	{ 0x00008, 38, 72,  31500},
46762306a36Sopenharmony_ci	{ 0x00004, 37, 75,  31500},
46862306a36Sopenharmony_ci	{ 0x00002, 35, 56,  36000},
46962306a36Sopenharmony_ci	{ 0x00001, 38, 60,  40000}
47062306a36Sopenharmony_ci};
47162306a36Sopenharmony_ci
47262306a36Sopenharmony_cistatic struct _sisfbddcfmodes {
47362306a36Sopenharmony_ci	u16 x;
47462306a36Sopenharmony_ci	u16 y;
47562306a36Sopenharmony_ci	u16 v;
47662306a36Sopenharmony_ci	u16 h;
47762306a36Sopenharmony_ci	u32 d;
47862306a36Sopenharmony_ci} sisfb_ddcfmodes[] = {
47962306a36Sopenharmony_ci	{ 1280, 1024, 85, 92, 157500},
48062306a36Sopenharmony_ci	{ 1600, 1200, 60, 75, 162000},
48162306a36Sopenharmony_ci	{ 1600, 1200, 65, 82, 175500},
48262306a36Sopenharmony_ci	{ 1600, 1200, 70, 88, 189000},
48362306a36Sopenharmony_ci	{ 1600, 1200, 75, 94, 202500},
48462306a36Sopenharmony_ci	{ 1600, 1200, 85, 107,229500},
48562306a36Sopenharmony_ci	{ 1920, 1440, 60, 90, 234000},
48662306a36Sopenharmony_ci	{ 1920, 1440, 75, 113,297000}
48762306a36Sopenharmony_ci};
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ci#ifdef CONFIG_FB_SIS_300
49062306a36Sopenharmony_cistatic struct _chswtable {
49162306a36Sopenharmony_ci	u16  subsysVendor;
49262306a36Sopenharmony_ci	u16  subsysCard;
49362306a36Sopenharmony_ci	char *vendorName;
49462306a36Sopenharmony_ci	char *cardName;
49562306a36Sopenharmony_ci} mychswtable[] = {
49662306a36Sopenharmony_ci	{ 0x1631, 0x1002, "Mitachi", "0x1002" },
49762306a36Sopenharmony_ci	{ 0x1071, 0x7521, "Mitac"  , "7521P"  },
49862306a36Sopenharmony_ci	{ 0,      0,      ""       , ""       }
49962306a36Sopenharmony_ci};
50062306a36Sopenharmony_ci#endif
50162306a36Sopenharmony_ci
50262306a36Sopenharmony_cistatic struct _customttable {
50362306a36Sopenharmony_ci	u16   chipID;
50462306a36Sopenharmony_ci	char  *biosversion;
50562306a36Sopenharmony_ci	char  *biosdate;
50662306a36Sopenharmony_ci	u32   bioschksum;
50762306a36Sopenharmony_ci	u16   biosFootprintAddr[5];
50862306a36Sopenharmony_ci	u8    biosFootprintData[5];
50962306a36Sopenharmony_ci	u16   pcisubsysvendor;
51062306a36Sopenharmony_ci	u16   pcisubsyscard;
51162306a36Sopenharmony_ci	char  *vendorName;
51262306a36Sopenharmony_ci	char  *cardName;
51362306a36Sopenharmony_ci	u32   SpecialID;
51462306a36Sopenharmony_ci	char  *optionName;
51562306a36Sopenharmony_ci} mycustomttable[] = {
51662306a36Sopenharmony_ci	{ SIS_630, "2.00.07", "09/27/2002-13:38:25",
51762306a36Sopenharmony_ci	  0x3240A8,
51862306a36Sopenharmony_ci	  { 0x220, 0x227, 0x228, 0x229, 0x0ee },
51962306a36Sopenharmony_ci	  {  0x01,  0xe3,  0x9a,  0x6a,  0xef },
52062306a36Sopenharmony_ci	  0x1039, 0x6300,
52162306a36Sopenharmony_ci	  "Barco", "iQ R200L/300/400", CUT_BARCO1366, "BARCO_1366"
52262306a36Sopenharmony_ci	},
52362306a36Sopenharmony_ci	{ SIS_630, "2.00.07", "09/27/2002-13:38:25",
52462306a36Sopenharmony_ci	  0x323FBD,
52562306a36Sopenharmony_ci	  { 0x220, 0x227, 0x228, 0x229, 0x0ee },
52662306a36Sopenharmony_ci	  {  0x00,  0x5a,  0x64,  0x41,  0xef },
52762306a36Sopenharmony_ci	  0x1039, 0x6300,
52862306a36Sopenharmony_ci	  "Barco", "iQ G200L/300/400/500", CUT_BARCO1024, "BARCO_1024"
52962306a36Sopenharmony_ci	},
53062306a36Sopenharmony_ci	{ SIS_650, "", "",
53162306a36Sopenharmony_ci	  0,
53262306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
53362306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
53462306a36Sopenharmony_ci	  0x0e11, 0x083c,
53562306a36Sopenharmony_ci	  "Inventec (Compaq)", "3017cl/3045US", CUT_COMPAQ12802, "COMPAQ_1280"
53662306a36Sopenharmony_ci	},
53762306a36Sopenharmony_ci	{ SIS_650, "", "",
53862306a36Sopenharmony_ci	  0,
53962306a36Sopenharmony_ci	  { 0x00c, 0, 0, 0, 0 },
54062306a36Sopenharmony_ci	  { 'e'  , 0, 0, 0, 0 },
54162306a36Sopenharmony_ci	  0x1558, 0x0287,
54262306a36Sopenharmony_ci	  "Clevo", "L285/L287 (Version 1)", CUT_CLEVO1024, "CLEVO_L28X_1"
54362306a36Sopenharmony_ci	},
54462306a36Sopenharmony_ci	{ SIS_650, "", "",
54562306a36Sopenharmony_ci	  0,
54662306a36Sopenharmony_ci	  { 0x00c, 0, 0, 0, 0 },
54762306a36Sopenharmony_ci	  { 'y'  , 0, 0, 0, 0 },
54862306a36Sopenharmony_ci	  0x1558, 0x0287,
54962306a36Sopenharmony_ci	  "Clevo", "L285/L287 (Version 2)", CUT_CLEVO10242, "CLEVO_L28X_2"
55062306a36Sopenharmony_ci	},
55162306a36Sopenharmony_ci	{ SIS_650, "", "",
55262306a36Sopenharmony_ci	  0,
55362306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
55462306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
55562306a36Sopenharmony_ci	  0x1558, 0x0400,  /* possibly 401 and 402 as well; not panelsize specific (?) */
55662306a36Sopenharmony_ci	  "Clevo", "D400S/D410S/D400H/D410H", CUT_CLEVO1400, "CLEVO_D4X0"
55762306a36Sopenharmony_ci	},
55862306a36Sopenharmony_ci	{ SIS_650, "", "",
55962306a36Sopenharmony_ci	  0,	/* Shift LCD in LCD-via-CRT1 mode */
56062306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
56162306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
56262306a36Sopenharmony_ci	  0x1558, 0x2263,
56362306a36Sopenharmony_ci	  "Clevo", "D22ES/D27ES", CUT_UNIWILL1024, "CLEVO_D2X0ES"
56462306a36Sopenharmony_ci	},
56562306a36Sopenharmony_ci	{ SIS_650, "", "",
56662306a36Sopenharmony_ci	  0,	/* Shift LCD in LCD-via-CRT1 mode */
56762306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
56862306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
56962306a36Sopenharmony_ci	  0x1734, 0x101f,
57062306a36Sopenharmony_ci	  "Uniwill", "N243S9", CUT_UNIWILL1024, "UNIWILL_N243S9"
57162306a36Sopenharmony_ci	},
57262306a36Sopenharmony_ci	{ SIS_650, "", "",
57362306a36Sopenharmony_ci	  0,	/* Shift LCD in LCD-via-CRT1 mode */
57462306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
57562306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
57662306a36Sopenharmony_ci	  0x1584, 0x5103,
57762306a36Sopenharmony_ci	  "Uniwill", "N35BS1", CUT_UNIWILL10242, "UNIWILL_N35BS1"
57862306a36Sopenharmony_ci	},
57962306a36Sopenharmony_ci	{ SIS_650, "1.09.2c", "",  /* Other versions, too? */
58062306a36Sopenharmony_ci	  0,	/* Shift LCD in LCD-via-CRT1 mode */
58162306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
58262306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
58362306a36Sopenharmony_ci	  0x1019, 0x0f05,
58462306a36Sopenharmony_ci	  "ECS", "A928", CUT_UNIWILL1024, "ECS_A928"
58562306a36Sopenharmony_ci	},
58662306a36Sopenharmony_ci	{ SIS_740, "1.11.27a", "",
58762306a36Sopenharmony_ci	  0,
58862306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
58962306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
59062306a36Sopenharmony_ci	  0x1043, 0x1612,
59162306a36Sopenharmony_ci	  "Asus", "L3000D/L3500D", CUT_ASUSL3000D, "ASUS_L3X00"
59262306a36Sopenharmony_ci	},
59362306a36Sopenharmony_ci	{ SIS_650, "1.10.9k", "",
59462306a36Sopenharmony_ci	  0,
59562306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
59662306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
59762306a36Sopenharmony_ci	  0x1025, 0x0028,
59862306a36Sopenharmony_ci	  "Acer", "Aspire 1700", CUT_ACER1280, "ACER_ASPIRE1700"
59962306a36Sopenharmony_ci	},
60062306a36Sopenharmony_ci	{ SIS_650, "1.10.7w", "",
60162306a36Sopenharmony_ci	  0,
60262306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
60362306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
60462306a36Sopenharmony_ci	  0x14c0, 0x0012,
60562306a36Sopenharmony_ci	  "Compal", "??? (V1)", CUT_COMPAL1400_1, "COMPAL_1400_1"
60662306a36Sopenharmony_ci	},
60762306a36Sopenharmony_ci	{ SIS_650, "1.10.7x", "",
60862306a36Sopenharmony_ci	  0,
60962306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
61062306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
61162306a36Sopenharmony_ci	  0x14c0, 0x0012,
61262306a36Sopenharmony_ci	  "Compal", "??? (V2)", CUT_COMPAL1400_2, "COMPAL_1400_2"
61362306a36Sopenharmony_ci	},
61462306a36Sopenharmony_ci	{ SIS_650, "1.10.8o", "",
61562306a36Sopenharmony_ci	  0,	/* For EMI (unknown) */
61662306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
61762306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
61862306a36Sopenharmony_ci	  0x1043, 0x1612,
61962306a36Sopenharmony_ci	  "Asus", "A2H (V1)", CUT_ASUSA2H_1, "ASUS_A2H_1"
62062306a36Sopenharmony_ci	},
62162306a36Sopenharmony_ci	{ SIS_650, "1.10.8q", "",
62262306a36Sopenharmony_ci	  0,	/* For EMI */
62362306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
62462306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
62562306a36Sopenharmony_ci	  0x1043, 0x1612,
62662306a36Sopenharmony_ci	  "Asus", "A2H (V2)", CUT_ASUSA2H_2, "ASUS_A2H_2"
62762306a36Sopenharmony_ci	},
62862306a36Sopenharmony_ci	{ 4321, "", "",			/* never autodetected */
62962306a36Sopenharmony_ci	  0,
63062306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
63162306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
63262306a36Sopenharmony_ci	  0, 0,
63362306a36Sopenharmony_ci	  "Generic", "LVDS/Parallel 848x480", CUT_PANEL848, "PANEL848x480"
63462306a36Sopenharmony_ci	},
63562306a36Sopenharmony_ci	{ 4322, "", "",			/* never autodetected */
63662306a36Sopenharmony_ci	  0,
63762306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
63862306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0 },
63962306a36Sopenharmony_ci	  0, 0,
64062306a36Sopenharmony_ci	  "Generic", "LVDS/Parallel 856x480", CUT_PANEL856, "PANEL856x480"
64162306a36Sopenharmony_ci	},
64262306a36Sopenharmony_ci	{ 0, "", "",
64362306a36Sopenharmony_ci	  0,
64462306a36Sopenharmony_ci	  { 0, 0, 0, 0 },
64562306a36Sopenharmony_ci	  { 0, 0, 0, 0 },
64662306a36Sopenharmony_ci	  0, 0,
64762306a36Sopenharmony_ci	  "", "", CUT_NONE, ""
64862306a36Sopenharmony_ci	}
64962306a36Sopenharmony_ci};
65062306a36Sopenharmony_ci
65162306a36Sopenharmony_ci#endif
652