From 544393fe584d333480659a4bed30f5295355df11 Mon Sep 17 00:00:00 2001 From: Thomas Winischhofer Date: Fri, 9 Sep 2005 13:04:45 -0700 Subject: [PATCH] sisfb update This lifts sisfb from version 1.7.17 to version 1.8.9. Changes include: - Added support for XGI V3XT, V5, V8, Z7 chipsets, including POSTing of all of these chipsets. - Added support for latest SiS chipsets (761). - Added support for SiS76x memory "hybrid" mode. - Added support for new LCD resolutions (eg 1280x854, 856x480). - Fixed support for 320x240 STN panels (for embedded devices). - Fixed many HDTV modes (525p, 750p, 1080i). - Fixed PCI config register reading/writing to use proper kernel functions for this purpose. - Fixed PCI ROM handling to use the kernel's proper functions. - Removed lots of "typedef"s. - Removed lots of code which was for X.org/XFree86 only. - Fixed coding style in many places. - Removed lots of 2.4 cruft. - Reduced stack size by unifying two previously separate structs into one. - Added new hooks for memory allocation (for DRM). Now the driver can truly handle multiple cards, including memory management. - Fixed numerous minor bugs. Signed-off-by: Thomas Winischhofer Cc: "Antonino A. Daplas" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/sis/sis_main.h | 602 ++++++++++++++++++------------------------- 1 file changed, 244 insertions(+), 358 deletions(-) (limited to 'drivers/video/sis/sis_main.h') diff --git a/drivers/video/sis/sis_main.h b/drivers/video/sis/sis_main.h index a6678a7aff35..445bcbba03ae 100644 --- a/drivers/video/sis/sis_main.h +++ b/drivers/video/sis/sis_main.h @@ -1,9 +1,10 @@ /* - * SiS 300/305/540/630(S)/730(S) - * SiS 315(H/PRO)/55x/(M)65x/(M)661(F/M)X/740/741(GX)/330/(M)760 + * SiS 300/305/540/630(S)/730(S), + * SiS 315[E|PRO]/550/[M]65x/[M]66x[F|M|G]X/[M]74x[GX]/330/[M]76x[GX], + * XGI V3XT/V5/V8, Z7 * frame buffer driver for Linux kernels >=2.4.14 and >=2.6.3 * - * Copyright (C) 2001-2004 Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2005 Thomas Winischhofer, Vienna, Austria. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,13 +24,9 @@ #ifndef _SISFB_MAIN #define _SISFB_MAIN -#include - #include "vstruct.h" #include "sis.h" -#define MODE_INDEX_NONE 0 /* index for mode=none */ - /* Fbcon stuff */ static struct fb_var_screeninfo my_default_var = { .xres = 0, @@ -60,6 +57,8 @@ static struct fb_var_screeninfo my_default_var = { .vmode = FB_VMODE_NONINTERLACED, }; +#define MODE_INDEX_NONE 0 /* index for mode=none */ + /* Boot-time parameters */ static int sisfb_off = 0; static int sisfb_parm_mem = 0; @@ -93,7 +92,6 @@ static int sisfb_tvplug = -1; /* Tv plug type (for overriding autodetection) */ static int sisfb_tvstd = -1; static int sisfb_tvxposoffset = 0; static int sisfb_tvyposoffset = 0; -static int sisfb_filter = -1; static int sisfb_nocrt2rate = 0; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) static int sisfb_inverse = 0; @@ -106,12 +104,12 @@ static int sisfb_videoram = 0; /* List of supported chips */ static struct sisfb_chip_info { - int chip; - int vgaengine; + int chip; + int vgaengine; int mni; - int hwcursor_size; + int hwcursor_size; int CRT2_write_enable; - const char *chip_name; + const char *chip_name; } sisfb_chip_info[] __devinitdata = { { SIS_300, SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 300/305" }, { SIS_540, SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 540" }, @@ -123,6 +121,8 @@ static struct sisfb_chip_info { { SIS_650, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 650" }, { SIS_330, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 330" }, { SIS_660, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "SiS 660" }, + { XGI_20, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "XGI Z7" }, + { XGI_40, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "XGI V3XT/V5/V8" }, }; static struct pci_device_id __devinitdata sisfb_pci_table[] = { @@ -139,6 +139,8 @@ static struct pci_device_id __devinitdata sisfb_pci_table[] = { { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_650_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 7}, { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_330, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8}, { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_660_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 9}, + { PCI_VENDOR_ID_XGI,PCI_DEVICE_ID_XGI_20, PCI_ANY_ID, PCI_ANY_ID, 0, 0,10}, + { PCI_VENDOR_ID_XGI,PCI_DEVICE_ID_XGI_40, PCI_ANY_ID, PCI_ANY_ID, 0, 0,11}, #endif { 0 } }; @@ -147,13 +149,12 @@ MODULE_DEVICE_TABLE(pci, sisfb_pci_table); static struct sis_video_info *card_list = NULL; -/* TODO: This is not handled card-wise because the DRM - does not refer to a unique fb when calling sis_alloc - or sis_free. Therefore, this is handled globally for - now (hoping that nobody is crazy enough to run two - SiS cards at the same time). +/* The memory heap is now handled card-wise, by using + sis_malloc_new/sis_free_new. However, the DRM does + not do this yet. Until it does, we keep a "global" + heap which is actually the first card's one. */ -static SIS_HEAP sisfb_heap; +static struct SIS_HEAP *sisfb_heap; #define MD_SIS300 1 #define MD_SIS315 2 @@ -181,8 +182,10 @@ static const struct _sisbios_mode { {"320x240x16", {0x56,0x56}, 0x0135, 0x0000, 320, 240, 16, 1, 40, 15, MD_SIS300|MD_SIS315}, {"320x240x24", {0x53,0x53}, 0x0000, 0x0000, 320, 240, 32, 1, 40, 15, MD_SIS300|MD_SIS315}, {"320x240x32", {0x53,0x53}, 0x0000, 0x0000, 320, 240, 32, 1, 40, 15, MD_SIS300|MD_SIS315}, - {"320x240x8", {0x5a,0x5a}, 0x0132, 0x0000, 320, 480, 8, 1, 40, 30, MD_SIS315}, /* FSTN */ -/*10*/ {"320x240x16", {0x5b,0x5b}, 0x0135, 0x0000, 320, 480, 16, 1, 40, 30, MD_SIS315}, /* FSTN */ +#define MODE_FSTN_8 9 +#define MODE_FSTN_16 10 + {"320x240x8", {0x5a,0x5a}, 0x0132, 0x0000, 320, 240, 8, 1, 40, 15, MD_SIS315}, /* FSTN */ +/*10*/ {"320x240x16", {0x5b,0x5b}, 0x0135, 0x0000, 320, 240, 16, 1, 40, 15, MD_SIS315}, /* FSTN */ {"400x300x8", {0x51,0x51}, 0x0133, 0x0000, 400, 300, 8, 1, 50, 18, MD_SIS300|MD_SIS315}, {"400x300x16", {0x57,0x57}, 0x0136, 0x0000, 400, 300, 16, 1, 50, 18, MD_SIS300|MD_SIS315}, {"400x300x24", {0x54,0x54}, 0x0000, 0x0000, 400, 300, 32, 1, 50, 18, MD_SIS300|MD_SIS315}, @@ -215,18 +218,20 @@ static const struct _sisbios_mode { /*40*/ {"800x480x16", {0x7a,0x7a}, 0x0000, 0x0000, 800, 480, 16, 1, 100, 30, MD_SIS300|MD_SIS315}, {"800x480x24", {0x76,0x76}, 0x0000, 0x0000, 800, 480, 32, 1, 100, 30, MD_SIS300|MD_SIS315}, {"800x480x32", {0x76,0x76}, 0x0000, 0x0000, 800, 480, 32, 1, 100, 30, MD_SIS300|MD_SIS315}, -#define DEFAULT_MODE 43 /* index for 800x600x8 */ -#define DEFAULT_LCDMODE 43 /* index for 800x600x8 */ -#define DEFAULT_TVMODE 43 /* index for 800x600x8 */ +#define DEFAULT_MODE 43 /* index for 800x600x8 */ +#define DEFAULT_LCDMODE 43 /* index for 800x600x8 */ +#define DEFAULT_TVMODE 43 /* index for 800x600x8 */ {"800x600x8", {0x30,0x30}, 0x0103, 0x0103, 800, 600, 8, 2, 100, 37, MD_SIS300|MD_SIS315}, {"800x600x16", {0x47,0x47}, 0x0114, 0x0114, 800, 600, 16, 2, 100, 37, MD_SIS300|MD_SIS315}, {"800x600x24", {0x63,0x63}, 0x013b, 0x0115, 800, 600, 32, 2, 100, 37, MD_SIS300|MD_SIS315}, {"800x600x32", {0x63,0x63}, 0x013b, 0x0115, 800, 600, 32, 2, 100, 37, MD_SIS300|MD_SIS315}, {"848x480x8", {0x39,0x39}, 0x0000, 0x0000, 848, 480, 8, 2, 106, 30, MD_SIS300|MD_SIS315}, +#define DEFAULT_MODE_848 48 {"848x480x16", {0x3b,0x3b}, 0x0000, 0x0000, 848, 480, 16, 2, 106, 30, MD_SIS300|MD_SIS315}, {"848x480x24", {0x3e,0x3e}, 0x0000, 0x0000, 848, 480, 32, 2, 106, 30, MD_SIS300|MD_SIS315}, /*50*/ {"848x480x32", {0x3e,0x3e}, 0x0000, 0x0000, 848, 480, 32, 2, 106, 30, MD_SIS300|MD_SIS315}, {"856x480x8", {0x3f,0x3f}, 0x0000, 0x0000, 856, 480, 8, 2, 107, 30, MD_SIS300|MD_SIS315}, +#define DEFAULT_MODE_856 52 {"856x480x16", {0x42,0x42}, 0x0000, 0x0000, 856, 480, 16, 2, 107, 30, MD_SIS300|MD_SIS315}, {"856x480x24", {0x45,0x45}, 0x0000, 0x0000, 856, 480, 32, 2, 107, 30, MD_SIS300|MD_SIS315}, {"856x480x32", {0x45,0x45}, 0x0000, 0x0000, 856, 480, 32, 2, 107, 30, MD_SIS300|MD_SIS315}, @@ -270,42 +275,47 @@ static const struct _sisbios_mode { {"1280x800x16", {0x15,0x15}, 0x0000, 0x0000, 1280, 800, 16, 1, 160, 50, MD_SIS315}, {"1280x800x24", {0x16,0x16}, 0x0000, 0x0000, 1280, 800, 32, 1, 160, 50, MD_SIS315}, {"1280x800x32", {0x16,0x16}, 0x0000, 0x0000, 1280, 800, 32, 1, 160, 50, MD_SIS315}, + {"1280x854x8", {0x14,0x14}, 0x0000, 0x0000, 1280, 854, 8, 1, 160, 53, MD_SIS315}, + {"1280x854x16", {0x15,0x15}, 0x0000, 0x0000, 1280, 854, 16, 1, 160, 53, MD_SIS315}, + {"1280x854x24", {0x16,0x16}, 0x0000, 0x0000, 1280, 854, 32, 1, 160, 53, MD_SIS315}, + {"1280x854x32", {0x16,0x16}, 0x0000, 0x0000, 1280, 854, 32, 1, 160, 53, MD_SIS315}, {"1280x960x8", {0x7c,0x7c}, 0x0000, 0x0000, 1280, 960, 8, 1, 160, 60, MD_SIS300|MD_SIS315}, - {"1280x960x16", {0x7d,0x7d}, 0x0000, 0x0000, 1280, 960, 16, 1, 160, 60, MD_SIS300|MD_SIS315}, +/*100*/ {"1280x960x16", {0x7d,0x7d}, 0x0000, 0x0000, 1280, 960, 16, 1, 160, 60, MD_SIS300|MD_SIS315}, {"1280x960x24", {0x7e,0x7e}, 0x0000, 0x0000, 1280, 960, 32, 1, 160, 60, MD_SIS300|MD_SIS315}, {"1280x960x32", {0x7e,0x7e}, 0x0000, 0x0000, 1280, 960, 32, 1, 160, 60, MD_SIS300|MD_SIS315}, {"1280x1024x8", {0x3a,0x3a}, 0x0107, 0x0107, 1280, 1024, 8, 2, 160, 64, MD_SIS300|MD_SIS315}, -/*100*/ {"1280x1024x16", {0x4d,0x4d}, 0x011a, 0x011a, 1280, 1024, 16, 2, 160, 64, MD_SIS300|MD_SIS315}, + {"1280x1024x16", {0x4d,0x4d}, 0x011a, 0x011a, 1280, 1024, 16, 2, 160, 64, MD_SIS300|MD_SIS315}, {"1280x1024x24", {0x65,0x65}, 0x013d, 0x011b, 1280, 1024, 32, 2, 160, 64, MD_SIS300|MD_SIS315}, {"1280x1024x32", {0x65,0x65}, 0x013d, 0x011b, 1280, 1024, 32, 2, 160, 64, MD_SIS300|MD_SIS315}, {"1360x768x8", {0x48,0x48}, 0x0000, 0x0000, 1360, 768, 8, 1, 170, 48, MD_SIS300|MD_SIS315}, {"1360x768x16", {0x4b,0x4b}, 0x0000, 0x0000, 1360, 768, 16, 1, 170, 48, MD_SIS300|MD_SIS315}, {"1360x768x24", {0x4e,0x4e}, 0x0000, 0x0000, 1360, 768, 32, 1, 170, 48, MD_SIS300|MD_SIS315}, - {"1360x768x32", {0x4e,0x4e}, 0x0000, 0x0000, 1360, 768, 32, 1, 170, 48, MD_SIS300|MD_SIS315}, +/*110*/ {"1360x768x32", {0x4e,0x4e}, 0x0000, 0x0000, 1360, 768, 32, 1, 170, 48, MD_SIS300|MD_SIS315}, {"1360x1024x8", {0x67,0x67}, 0x0000, 0x0000, 1360, 1024, 8, 1, 170, 64, MD_SIS300 }, +#define DEFAULT_MODE_1360 112 {"1360x1024x16", {0x6f,0x6f}, 0x0000, 0x0000, 1360, 1024, 16, 1, 170, 64, MD_SIS300 }, {"1360x1024x24", {0x72,0x72}, 0x0000, 0x0000, 1360, 1024, 32, 1, 170, 64, MD_SIS300 }, -/*110*/ {"1360x1024x32", {0x72,0x72}, 0x0000, 0x0000, 1360, 1024, 32, 1, 170, 64, MD_SIS300 }, + {"1360x1024x32", {0x72,0x72}, 0x0000, 0x0000, 1360, 1024, 32, 1, 170, 64, MD_SIS300 }, {"1400x1050x8", {0x26,0x26}, 0x0000, 0x0000, 1400, 1050, 8, 1, 175, 65, MD_SIS315}, {"1400x1050x16", {0x27,0x27}, 0x0000, 0x0000, 1400, 1050, 16, 1, 175, 65, MD_SIS315}, {"1400x1050x24", {0x28,0x28}, 0x0000, 0x0000, 1400, 1050, 32, 1, 175, 65, MD_SIS315}, {"1400x1050x32", {0x28,0x28}, 0x0000, 0x0000, 1400, 1050, 32, 1, 175, 65, MD_SIS315}, {"1600x1200x8", {0x3c,0x3c}, 0x0130, 0x011c, 1600, 1200, 8, 1, 200, 75, MD_SIS300|MD_SIS315}, - {"1600x1200x16", {0x3d,0x3d}, 0x0131, 0x011e, 1600, 1200, 16, 1, 200, 75, MD_SIS300|MD_SIS315}, +/*120*/ {"1600x1200x16", {0x3d,0x3d}, 0x0131, 0x011e, 1600, 1200, 16, 1, 200, 75, MD_SIS300|MD_SIS315}, {"1600x1200x24", {0x66,0x66}, 0x013e, 0x011f, 1600, 1200, 32, 1, 200, 75, MD_SIS300|MD_SIS315}, {"1600x1200x32", {0x66,0x66}, 0x013e, 0x011f, 1600, 1200, 32, 1, 200, 75, MD_SIS300|MD_SIS315}, {"1680x1050x8", {0x17,0x17}, 0x0000, 0x0000, 1680, 1050, 8, 1, 210, 65, MD_SIS315}, -/*120*/ {"1680x1050x16", {0x18,0x18}, 0x0000, 0x0000, 1680, 1050, 16, 1, 210, 65, MD_SIS315}, + {"1680x1050x16", {0x18,0x18}, 0x0000, 0x0000, 1680, 1050, 16, 1, 210, 65, MD_SIS315}, {"1680x1050x24", {0x19,0x19}, 0x0000, 0x0000, 1680, 1050, 32, 1, 210, 65, MD_SIS315}, {"1680x1050x32", {0x19,0x19}, 0x0000, 0x0000, 1680, 1050, 32, 1, 210, 65, MD_SIS315}, {"1920x1080x8", {0x2c,0x2c}, 0x0000, 0x0000, 1920, 1080, 8, 1, 240, 67, MD_SIS315}, {"1920x1080x16", {0x2d,0x2d}, 0x0000, 0x0000, 1920, 1080, 16, 1, 240, 67, MD_SIS315}, {"1920x1080x24", {0x73,0x73}, 0x0000, 0x0000, 1920, 1080, 32, 1, 240, 67, MD_SIS315}, - {"1920x1080x32", {0x73,0x73}, 0x0000, 0x0000, 1920, 1080, 32, 1, 240, 67, MD_SIS315}, +/*130*/ {"1920x1080x32", {0x73,0x73}, 0x0000, 0x0000, 1920, 1080, 32, 1, 240, 67, MD_SIS315}, {"1920x1440x8", {0x68,0x68}, 0x013f, 0x0000, 1920, 1440, 8, 1, 240, 75, MD_SIS300|MD_SIS315}, {"1920x1440x16", {0x69,0x69}, 0x0140, 0x0000, 1920, 1440, 16, 1, 240, 75, MD_SIS300|MD_SIS315}, {"1920x1440x24", {0x6b,0x6b}, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, MD_SIS300|MD_SIS315}, -/*130*/ {"1920x1440x32", {0x6b,0x6b}, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, MD_SIS300|MD_SIS315}, + {"1920x1440x32", {0x6b,0x6b}, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, MD_SIS300|MD_SIS315}, {"2048x1536x8", {0x6c,0x6c}, 0x0000, 0x0000, 2048, 1536, 8, 1, 256, 96, MD_SIS315}, {"2048x1536x16", {0x6d,0x6d}, 0x0000, 0x0000, 2048, 1536, 16, 1, 256, 96, MD_SIS315}, {"2048x1536x24", {0x6e,0x6e}, 0x0000, 0x0000, 2048, 1536, 32, 1, 256, 96, MD_SIS315}, @@ -313,13 +323,13 @@ static const struct _sisbios_mode { {"\0", {0x00,0x00}, 0, 0, 0, 0, 0, 0, 0} }; -#define SIS_LCD_NUMBER 17 -static const struct _sis_lcd_data { +#define SIS_LCD_NUMBER 18 +static struct _sis_lcd_data { u32 lcdtype; u16 xres; u16 yres; u8 default_mode_idx; -} sis_lcd_data[] = { +} sis_lcd_data[] __devinitdata = { { LCD_640x480, 640, 480, 23 }, { LCD_800x600, 800, 600, 43 }, { LCD_1024x600, 1024, 600, 67 }, @@ -329,34 +339,38 @@ static const struct _sis_lcd_data { { LCD_1280x720, 1280, 720, 83 }, { LCD_1280x768, 1280, 768, 87 }, { LCD_1280x800, 1280, 800, 91 }, - { LCD_1280x960, 1280, 960, 95 }, - { LCD_1280x1024, 1280, 1024, 99 }, - { LCD_1400x1050, 1400, 1050, 111 }, - { LCD_1680x1050, 1680, 1050, 119 }, - { LCD_1600x1200, 1600, 1200, 115 }, - { LCD_640x480_2, 640, 480, 23 }, - { LCD_640x480_3, 640, 480, 23 }, - { LCD_320x480, 320, 480, 9 }, + { LCD_1280x854, 1280, 854, 95 }, + { LCD_1280x960, 1280, 960, 99 }, + { LCD_1280x1024, 1280, 1024, 103 }, + { LCD_1400x1050, 1400, 1050, 115 }, + { LCD_1680x1050, 1680, 1050, 123 }, + { LCD_1600x1200, 1600, 1200, 119 }, + { LCD_320x240_2, 320, 240, 9 }, + { LCD_320x240_3, 320, 240, 9 }, + { LCD_320x240, 320, 240, 9 }, }; /* CR36 evaluation */ -static const USHORT sis300paneltype[] = - { LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, - LCD_1280x960, LCD_640x480, LCD_1024x600, LCD_1152x768, - LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, - LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN }; - -static const USHORT sis310paneltype[] = - { LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, - LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960, - LCD_1152x768, LCD_1400x1050, LCD_1280x768, LCD_1600x1200, - LCD_640x480_2, LCD_640x480_3, LCD_UNKNOWN, LCD_UNKNOWN }; - -static const USHORT sis661paneltype[] = - { LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, - LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960, - LCD_1152x768, LCD_1400x1050, LCD_1280x768, LCD_1600x1200, - LCD_1280x800, LCD_1680x1050, LCD_1280x720, LCD_UNKNOWN }; +static unsigned short sis300paneltype[] __devinitdata = { + LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, + LCD_1280x960, LCD_640x480, LCD_1024x600, LCD_1152x768, + LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, + LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN +}; + +static unsigned short sis310paneltype[] __devinitdata = { + LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, + LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960, + LCD_1152x768, LCD_1400x1050, LCD_1280x768, LCD_1600x1200, + LCD_320x240_2, LCD_320x240_3, LCD_UNKNOWN, LCD_UNKNOWN +}; + +static unsigned short sis661paneltype[] __devinitdata = { + LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, + LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960, + LCD_1280x854, LCD_1400x1050, LCD_1280x768, LCD_1600x1200, + LCD_1280x800, LCD_1680x1050, LCD_1280x720, LCD_UNKNOWN +}; #define FL_550_DSTN 0x01 #define FL_550_FSTN 0x02 @@ -413,7 +427,6 @@ static const struct _sis_vrate { } sisfb_vrate[] = { {1, 320, 200, 70, TRUE}, {1, 320, 240, 60, TRUE}, - {1, 320, 480, 60, TRUE}, {1, 400, 300, 60, TRUE}, {1, 512, 384, 60, TRUE}, {1, 640, 400, 72, TRUE}, @@ -437,10 +450,11 @@ static const struct _sis_vrate { {4, 1024, 768, 75, FALSE}, {5, 1024, 768, 85, TRUE}, {6, 1024, 768, 100, TRUE}, {7, 1024, 768, 120, TRUE}, {1, 1152, 768, 60, TRUE}, - {1, 1152, 864, 60, TRUE}, {1, 1152, 864, 75, TRUE}, {2, 1152, 864, 84, TRUE}, + {1, 1152, 864, 60, TRUE}, {2, 1152, 864, 75, TRUE}, {3, 1152, 864, 84, TRUE}, {1, 1280, 720, 60, TRUE}, {2, 1280, 720, 75, TRUE}, {3, 1280, 720, 85, TRUE}, {1, 1280, 768, 60, TRUE}, {1, 1280, 800, 60, TRUE}, + {1, 1280, 854, 60, TRUE}, {1, 1280, 960, 60, TRUE}, {2, 1280, 960, 85, TRUE}, {1, 1280, 1024, 43, TRUE}, {2, 1280, 1024, 60, TRUE}, {3, 1280, 1024, 75, TRUE}, {4, 1280, 1024, 85, TRUE}, @@ -459,12 +473,12 @@ static const struct _sis_vrate { {0, 0, 0, 0, FALSE} }; -static const struct _sisfbddcsmodes { +static struct _sisfbddcsmodes { u32 mask; u16 h; u16 v; u32 d; -} sisfb_ddcsmodes[] = { +} sisfb_ddcsmodes[] __devinitdata = { { 0x10000, 67, 75, 108000}, { 0x08000, 48, 72, 50000}, { 0x04000, 46, 75, 49500}, @@ -480,49 +494,49 @@ static const struct _sisfbddcsmodes { { 0x00001, 38, 60, 40000} }; -static const struct _sisfbddcfmodes { +static struct _sisfbddcfmodes { u16 x; u16 y; u16 v; u16 h; u32 d; -} sisfb_ddcfmodes[] = { - { 1280, 1024, 85, 92, 157500}, - { 1600, 1200, 60, 75, 162000}, - { 1600, 1200, 65, 82, 175500}, - { 1600, 1200, 70, 88, 189000}, - { 1600, 1200, 75, 94, 202500}, - { 1600, 1200, 85, 107,229500}, - { 1920, 1440, 60, 90, 234000}, - { 1920, 1440, 75, 113,297000} +} sisfb_ddcfmodes[] __devinitdata = { + { 1280, 1024, 85, 92, 157500}, + { 1600, 1200, 60, 75, 162000}, + { 1600, 1200, 65, 82, 175500}, + { 1600, 1200, 70, 88, 189000}, + { 1600, 1200, 75, 94, 202500}, + { 1600, 1200, 85, 107,229500}, + { 1920, 1440, 60, 90, 234000}, + { 1920, 1440, 75, 113,297000} }; #ifdef CONFIG_FB_SIS_300 static struct _chswtable { - u16 subsysVendor; - u16 subsysCard; - char *vendorName; - char *cardName; + u16 subsysVendor; + u16 subsysCard; + char *vendorName; + char *cardName; } mychswtable[] __devinitdata = { - { 0x1631, 0x1002, "Mitachi", "0x1002" }, + { 0x1631, 0x1002, "Mitachi", "0x1002" }, { 0x1071, 0x7521, "Mitac" , "7521P" }, { 0, 0, "" , "" } }; #endif static struct _customttable { - u16 chipID; - char *biosversion; - char *biosdate; - u32 bioschksum; - u16 biosFootprintAddr[5]; - u8 biosFootprintData[5]; - u16 pcisubsysvendor; - u16 pcisubsyscard; - char *vendorName; - char *cardName; - u32 SpecialID; - char *optionName; + u16 chipID; + char *biosversion; + char *biosdate; + u32 bioschksum; + u16 biosFootprintAddr[5]; + u8 biosFootprintData[5]; + u16 pcisubsysvendor; + u16 pcisubsyscard; + char *vendorName; + char *cardName; + u32 SpecialID; + char *optionName; } mycustomttable[] __devinitdata = { { SIS_630, "2.00.07", "09/27/2002-13:38:25", 0x3240A8, @@ -643,6 +657,13 @@ static struct _customttable { 0, 0, "Generic", "LVDS/Parallel 848x480", CUT_PANEL848, "PANEL848x480" }, + { 4322, "", "", /* never autodetected */ + 0, + { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, + 0, 0, + "Generic", "LVDS/Parallel 856x480", CUT_PANEL856, "PANEL856x480" + }, { 0, "", "", 0, { 0, 0, 0, 0 }, @@ -652,155 +673,6 @@ static struct _customttable { } }; -static const struct _sis_TV_filter { - u8 filter[9][4]; -} sis_TV_filter[] = { - { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_0 */ - {0x00,0xE0,0x10,0x60}, - {0x00,0xEE,0x10,0x44}, - {0x00,0xF4,0x10,0x38}, - {0xF8,0xF4,0x18,0x38}, - {0xFC,0xFB,0x14,0x2A}, - {0x00,0x00,0x10,0x20}, - {0x00,0x04,0x10,0x18}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_1 */ - {0x00,0xE0,0x10,0x60}, - {0x00,0xEE,0x10,0x44}, - {0x00,0xF4,0x10,0x38}, - {0xF8,0xF4,0x18,0x38}, - {0xFC,0xFB,0x14,0x2A}, - {0x00,0x00,0x10,0x20}, - {0x00,0x04,0x10,0x18}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_2 */ - {0xF5,0xEE,0x1B,0x44}, - {0xF8,0xF4,0x18,0x38}, - {0xEB,0x04,0x25,0x18}, - {0xF1,0x05,0x1F,0x16}, - {0xF6,0x06,0x1A,0x14}, - {0xFA,0x06,0x16,0x14}, - {0x00,0x04,0x10,0x18}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_3 */ - {0xF1,0x04,0x1F,0x18}, - {0xEE,0x0D,0x22,0x06}, - {0xF7,0x06,0x19,0x14}, - {0xF4,0x0B,0x1C,0x0A}, - {0xFA,0x07,0x16,0x12}, - {0xF9,0x0A,0x17,0x0C}, - {0x00,0x07,0x10,0x12}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_4 - 320 */ - {0x00,0xE0,0x10,0x60}, - {0x00,0xEE,0x10,0x44}, - {0x00,0xF4,0x10,0x38}, - {0xF8,0xF4,0x18,0x38}, - {0xFC,0xFB,0x14,0x2A}, - {0x00,0x00,0x10,0x20}, - {0x00,0x04,0x10,0x18}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_5 - 640 */ - {0xF5,0xEE,0x1B,0x44}, - {0xF8,0xF4,0x18,0x38}, - {0xEB,0x04,0x25,0x18}, - {0xF1,0x05,0x1F,0x16}, - {0xF6,0x06,0x1A,0x14}, - {0xFA,0x06,0x16,0x14}, - {0x00,0x04,0x10,0x18}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_6 - 720 */ - {0xEB,0x04,0x25,0x18}, - {0xE7,0x0E,0x29,0x04}, - {0xEE,0x0C,0x22,0x08}, - {0xF6,0x0B,0x1A,0x0A}, - {0xF9,0x0A,0x17,0x0C}, - {0xFC,0x0A,0x14,0x0C}, - {0x00,0x08,0x10,0x10}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_7 - 800 */ - {0xEC,0x02,0x24,0x1C}, - {0xF2,0x04,0x1E,0x18}, - {0xEB,0x15,0x25,0xF6}, - {0xF4,0x10,0x1C,0x00}, - {0xF8,0x0F,0x18,0x02}, - {0x00,0x04,0x10,0x18}, - {0x01,0x06,0x0F,0x14}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* PALFilter_0 */ - {0x00,0xE0,0x10,0x60}, - {0x00,0xEE,0x10,0x44}, - {0x00,0xF4,0x10,0x38}, - {0xF8,0xF4,0x18,0x38}, - {0xFC,0xFB,0x14,0x2A}, - {0x00,0x00,0x10,0x20}, - {0x00,0x04,0x10,0x18}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* PALFilter_1 */ - {0x00,0xE0,0x10,0x60}, - {0x00,0xEE,0x10,0x44}, - {0x00,0xF4,0x10,0x38}, - {0xF8,0xF4,0x18,0x38}, - {0xFC,0xFB,0x14,0x2A}, - {0x00,0x00,0x10,0x20}, - {0x00,0x04,0x10,0x18}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* PALFilter_2 */ - {0xF5,0xEE,0x1B,0x44}, - {0xF8,0xF4,0x18,0x38}, - {0xF1,0xF7,0x01,0x32}, - {0xF5,0xFB,0x1B,0x2A}, - {0xF9,0xFF,0x17,0x22}, - {0xFB,0x01,0x15,0x1E}, - {0x00,0x04,0x10,0x18}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* PALFilter_3 */ - {0xF5,0xFB,0x1B,0x2A}, - {0xEE,0xFE,0x22,0x24}, - {0xF3,0x00,0x1D,0x20}, - {0xF9,0x03,0x17,0x1A}, - {0xFB,0x02,0x14,0x1E}, - {0xFB,0x04,0x15,0x18}, - {0x00,0x06,0x10,0x14}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* PALFilter_4 - 320 */ - {0x00,0xE0,0x10,0x60}, - {0x00,0xEE,0x10,0x44}, - {0x00,0xF4,0x10,0x38}, - {0xF8,0xF4,0x18,0x38}, - {0xFC,0xFB,0x14,0x2A}, - {0x00,0x00,0x10,0x20}, - {0x00,0x04,0x10,0x18}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* PALFilter_5 - 640 */ - {0xF5,0xEE,0x1B,0x44}, - {0xF8,0xF4,0x18,0x38}, - {0xF1,0xF7,0x1F,0x32}, - {0xF5,0xFB,0x1B,0x2A}, - {0xF9,0xFF,0x17,0x22}, - {0xFB,0x01,0x15,0x1E}, - {0x00,0x04,0x10,0x18}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* PALFilter_6 - 720 */ - {0xF5,0xEE,0x1B,0x2A}, - {0xEE,0xFE,0x22,0x24}, - {0xF3,0x00,0x1D,0x20}, - {0xF9,0x03,0x17,0x1A}, - {0xFB,0x02,0x14,0x1E}, - {0xFB,0x04,0x15,0x18}, - {0x00,0x06,0x10,0x14}, - {0xFF,0xFF,0xFF,0xFF} }}, - { {{0x00,0x00,0x00,0x40}, /* PALFilter_7 - 800 */ - {0xF5,0xEE,0x1B,0x44}, - {0xF8,0xF4,0x18,0x38}, - {0xFC,0xFB,0x14,0x2A}, - {0xEB,0x05,0x25,0x16}, - {0xF1,0x05,0x1F,0x16}, - {0xFA,0x07,0x16,0x12}, - {0x00,0x07,0x10,0x12}, - {0xFF,0xFF,0xFF,0xFF} }} -}; - /* ---------------------- Prototypes ------------------------- */ /* Interface used by the world */ @@ -811,145 +683,159 @@ SISINITSTATIC int sisfb_setup(char *options); /* Interface to the low level console driver */ SISINITSTATIC int sisfb_init(void); - /* fbdev routines */ -static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con, - struct fb_info *info); +static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con, + struct fb_info *info); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -static int sisfb_get_fix(struct fb_fix_screeninfo *fix, - int con, - struct fb_info *info); -static int sisfb_get_var(struct fb_var_screeninfo *var, - int con, - struct fb_info *info); -static int sisfb_set_var(struct fb_var_screeninfo *var, - int con, - struct fb_info *info); -static void sisfb_crtc_to_var(struct sis_video_info *ivideo, - struct fb_var_screeninfo *var); -static int sisfb_get_cmap(struct fb_cmap *cmap, - int kspc, - int con, - struct fb_info *info); -static int sisfb_set_cmap(struct fb_cmap *cmap, - int kspc, - int con, - struct fb_info *info); -static int sisfb_update_var(int con, - struct fb_info *info); -static int sisfb_switch(int con, +static int sisfb_get_fix(struct fb_fix_screeninfo *fix, + int con, + struct fb_info *info); +static int sisfb_get_var(struct fb_var_screeninfo *var, + int con, + struct fb_info *info); +static int sisfb_set_var(struct fb_var_screeninfo *var, + int con, + struct fb_info *info); +static void sisfb_crtc_to_var(struct sis_video_info *ivideo, + struct fb_var_screeninfo *var); +static int sisfb_get_cmap(struct fb_cmap *cmap, + int kspc, + int con, + struct fb_info *info); +static int sisfb_set_cmap(struct fb_cmap *cmap, + int kspc, + int con, + struct fb_info *info); +static int sisfb_update_var(int con, + struct fb_info *info); +static int sisfb_switch(int con, struct fb_info *info); -static void sisfb_blank(int blank, - struct fb_info *info); -static void sisfb_set_disp(int con, - struct fb_var_screeninfo *var, - struct fb_info *info); -static int sis_getcolreg(unsigned regno, unsigned *red, unsigned *green, - unsigned *blue, unsigned *transp, - struct fb_info *fb_info); -static void sisfb_do_install_cmap(int con, - struct fb_info *info); -static int sisfb_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg, int con, - struct fb_info *info); -#endif +static void sisfb_blank(int blank, + struct fb_info *info); +static void sisfb_set_disp(int con, + struct fb_var_screeninfo *var, + struct fb_info *info); +static int sis_getcolreg(unsigned regno, unsigned *red, unsigned *green, + unsigned *blue, unsigned *transp, + struct fb_info *fb_info); +static void sisfb_do_install_cmap(int con, + struct fb_info *info); +static int sisfb_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg, int con, + struct fb_info *info); +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -static int sisfb_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg, - struct fb_info *info); -static int sisfb_set_par(struct fb_info *info); -static int sisfb_blank(int blank, - struct fb_info *info); -extern void fbcon_sis_fillrect(struct fb_info *info, - const struct fb_fillrect *rect); -extern void fbcon_sis_copyarea(struct fb_info *info, - const struct fb_copyarea *area); -extern int fbcon_sis_sync(struct fb_info *info); +static int sisfb_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg, + struct fb_info *info); +static int sisfb_set_par(struct fb_info *info); +static int sisfb_blank(int blank, + struct fb_info *info); +extern void fbcon_sis_fillrect(struct fb_info *info, + const struct fb_fillrect *rect); +extern void fbcon_sis_copyarea(struct fb_info *info, + const struct fb_copyarea *area); +extern int fbcon_sis_sync(struct fb_info *info); #endif - + /* Internal 2D accelerator functions */ -extern int sisfb_initaccel(struct sis_video_info *ivideo); -extern void sisfb_syncaccel(struct sis_video_info *ivideo); +extern int sisfb_initaccel(struct sis_video_info *ivideo); +extern void sisfb_syncaccel(struct sis_video_info *ivideo); /* Internal general routines */ -static void sisfb_search_mode(char *name, BOOLEAN quiet); -static int sisfb_validate_mode(struct sis_video_info *ivideo, int modeindex, u32 vbflags); -static u8 sisfb_search_refresh_rate(struct sis_video_info *ivideo, unsigned int rate, - int index); -static int sisfb_setcolreg(unsigned regno, unsigned red, unsigned green, - unsigned blue, unsigned transp, - struct fb_info *fb_info); -static int sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive, - struct fb_info *info); -static void sisfb_pre_setmode(struct sis_video_info *ivideo); -static void sisfb_post_setmode(struct sis_video_info *ivideo); -static BOOLEAN sisfb_CheckVBRetrace(struct sis_video_info *ivideo); -static BOOLEAN sisfbcheckvretracecrt2(struct sis_video_info *ivideo); -static BOOLEAN sisfbcheckvretracecrt1(struct sis_video_info *ivideo); -static BOOLEAN sisfb_bridgeisslave(struct sis_video_info *ivideo); -static void sisfb_detect_VB_connect(struct sis_video_info *ivideo); -static void sisfb_get_VB_type(struct sis_video_info *ivideo); -static void sisfb_set_TVxposoffset(struct sis_video_info *ivideo, int val); -static void sisfb_set_TVyposoffset(struct sis_video_info *ivideo, int val); +static void sisfb_search_mode(char *name, BOOLEAN quiet); +static int sisfb_validate_mode(struct sis_video_info *ivideo, int modeindex, u32 vbflags); +static u8 sisfb_search_refresh_rate(struct sis_video_info *ivideo, unsigned int rate, + int index); +static int sisfb_setcolreg(unsigned regno, unsigned red, unsigned green, + unsigned blue, unsigned transp, + struct fb_info *fb_info); +static int sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive, + struct fb_info *info); +static void sisfb_pre_setmode(struct sis_video_info *ivideo); +static void sisfb_post_setmode(struct sis_video_info *ivideo); +static BOOLEAN sisfb_CheckVBRetrace(struct sis_video_info *ivideo); +static BOOLEAN sisfbcheckvretracecrt2(struct sis_video_info *ivideo); +static BOOLEAN sisfbcheckvretracecrt1(struct sis_video_info *ivideo); +static BOOLEAN sisfb_bridgeisslave(struct sis_video_info *ivideo); +static void sisfb_detect_VB_connect(struct sis_video_info *ivideo); +static void sisfb_get_VB_type(struct sis_video_info *ivideo); +static void sisfb_set_TVxposoffset(struct sis_video_info *ivideo, int val); +static void sisfb_set_TVyposoffset(struct sis_video_info *ivideo, int val); +#ifdef CONFIG_FB_SIS_300 +unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg); +void sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg, unsigned int val); +unsigned int sisfb_read_lpc_pci_dword(struct SiS_Private *SiS_Pr, int reg); +#endif +#ifdef CONFIG_FB_SIS_315 +void sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg, unsigned char val); +unsigned int sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg); +#endif /* SiS-specific exported functions */ -void sis_malloc(struct sis_memreq *req); -void sis_free(u32 base); +void sis_malloc(struct sis_memreq *req); +void sis_malloc_new(struct pci_dev *pdev, struct sis_memreq *req); +void sis_free(u32 base); +void sis_free_new(struct pci_dev *pdev, u32 base); /* Internal heap routines */ -static int sisfb_heap_init(struct sis_video_info *ivideo); -static SIS_OH *sisfb_poh_new_node(void); -static SIS_OH *sisfb_poh_allocate(u32 size); -static void sisfb_delete_node(SIS_OH *poh); -static void sisfb_insert_node(SIS_OH *pohList, SIS_OH *poh); -static SIS_OH *sisfb_poh_free(u32 base); -static void sisfb_free_node(SIS_OH *poh); - -/* Sensing routines */ -static void SiS_Sense30x(struct sis_video_info *ivideo); -static void SiS_SenseCh(struct sis_video_info *ivideo); +static int sisfb_heap_init(struct sis_video_info *ivideo); +static struct SIS_OH * sisfb_poh_new_node(struct SIS_HEAP *memheap); +static struct SIS_OH * sisfb_poh_allocate(struct SIS_HEAP *memheap, u32 size); +static void sisfb_delete_node(struct SIS_OH *poh); +static void sisfb_insert_node(struct SIS_OH *pohList, struct SIS_OH *poh); +static struct SIS_OH * sisfb_poh_free(struct SIS_HEAP *memheap, u32 base); +static void sisfb_free_node(struct SIS_HEAP *memheap, struct SIS_OH *poh); /* Routines from init.c/init301.c */ -extern USHORT SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth, - BOOLEAN FSTN, USHORT CustomT, int LCDwith, int LCDheight); -extern USHORT SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth); -extern USHORT SiS_GetModeID_VGA2(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth); - -extern void SiSRegInit(SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr); -extern BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceInfo, USHORT ModeNo); -extern void SiS_SetEnableDstn(SiS_Private *SiS_Pr, int enable); -extern void SiS_SetEnableFstn(SiS_Private *SiS_Pr, int enable); - -extern BOOLEAN SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); - -extern BOOLEAN sisfb_gettotalfrommode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension, - unsigned char modeno, int *htotal, int *vtotal, unsigned char rateindex); +extern unsigned short SiS_GetModeID_LCD(int VGAEngine, unsigned int VBFlags, int HDisplay, + int VDisplay, int Depth, BOOLEAN FSTN, unsigned short CustomT, + int LCDwith, int LCDheight, unsigned int VBFlags2); +extern unsigned short SiS_GetModeID_TV(int VGAEngine, unsigned int VBFlags, int HDisplay, + int VDisplay, int Depth, unsigned int VBFlags2); +extern unsigned short SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay, + int VDisplay, int Depth, unsigned int VBFlags2); +extern void SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr); +extern BOOLEAN SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); +extern void SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable); +extern void SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable); + +extern BOOLEAN SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr); + +extern BOOLEAN sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno, + int *htotal, int *vtotal, unsigned char rateindex); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -extern int sisfb_mode_rate_to_dclock(SiS_Private *SiS_Pr, - PSIS_HW_INFO HwDeviceExtension, - unsigned char modeno, unsigned char rateindex); -extern int sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension, - unsigned char modeno, unsigned char rateindex, - struct fb_var_screeninfo *var); +extern int sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr, + unsigned char modeno, unsigned char rateindex); +extern int sisfb_mode_rate_to_ddata(struct SiS_Private *SiS_Pr, unsigned char modeno, + unsigned char rateindex, struct fb_var_screeninfo *var); +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +extern void SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, int xres, + int yres, struct fb_var_screeninfo *var, BOOLEAN writeres); #endif /* Chrontel TV, DDC and DPMS functions */ -extern USHORT SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempbx); -extern void SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempbx); -extern USHORT SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempbx); -extern void SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempbx); -extern void SiS_SetCH70xxANDOR(SiS_Private *SiS_Pr, USHORT tempax,USHORT tempbh); -extern void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime); -extern void SiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo); -extern USHORT SiS_HandleDDC(SiS_Private *SiS_Pr, ULONG VBFlags, int VGAEngine, - USHORT adaptnum, USHORT DDCdatatype, unsigned char *buffer); -extern USHORT SiS_ReadDDC1Bit(SiS_Private *SiS_Pr); -extern void SiS_Chrontel701xBLOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceInfo); -extern void SiS_Chrontel701xBLOff(SiS_Private *SiS_Pr); -extern void SiS_SiS30xBLOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceInfo); -extern void SiS_SiS30xBLOff(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceInfo); +extern unsigned short SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short reg); +extern void SiS_SetCH700x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val); +extern unsigned short SiS_GetCH701x(struct SiS_Private *SiS_Pr, unsigned short reg); +extern void SiS_SetCH701x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val); +extern void SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg, + unsigned char myor, unsigned char myand); +extern void SiS_DDC2Delay(struct SiS_Private *SiS_Pr, unsigned int delaytime); +extern void SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo); +extern unsigned short SiS_HandleDDC(struct SiS_Private *SiS_Pr, unsigned int VBFlags, int VGAEngine, + unsigned short adaptnum, unsigned short DDCdatatype, unsigned char *buffer, + unsigned int VBFlags2); +extern unsigned short SiS_ReadDDC1Bit(struct SiS_Private *SiS_Pr); +#ifdef CONFIG_FB_SIS_315 +extern void SiS_Chrontel701xBLOn(struct SiS_Private *SiS_Pr); +extern void SiS_Chrontel701xBLOff(struct SiS_Private *SiS_Pr); +#endif +extern void SiS_SiS30xBLOn(struct SiS_Private *SiS_Pr); +extern void SiS_SiS30xBLOff(struct SiS_Private *SiS_Pr); #endif -- cgit v1.2.3