diff options
Diffstat (limited to 'drivers/staging/xgifb')
-rw-r--r-- | drivers/staging/xgifb/Makefile | 2 | ||||
-rw-r--r-- | drivers/staging/xgifb/XGI_main.h | 13 | ||||
-rw-r--r-- | drivers/staging/xgifb/XGI_main_26.c | 158 | ||||
-rw-r--r-- | drivers/staging/xgifb/XGIfb.h | 3 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_ext.c | 444 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_ext.h | 9 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_init.c | 276 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_setmode.c | 1003 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_setmode.h | 52 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_struct.h | 4 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_table.h | 27 | ||||
-rw-r--r-- | drivers/staging/xgifb/vgatypes.h | 2 |
12 files changed, 478 insertions, 1515 deletions
diff --git a/drivers/staging/xgifb/Makefile b/drivers/staging/xgifb/Makefile index 3c8c7de..55e5199 100644 --- a/drivers/staging/xgifb/Makefile +++ b/drivers/staging/xgifb/Makefile @@ -1,4 +1,4 @@ obj-$(CONFIG_FB_XGI) += xgifb.o -xgifb-y := XGI_main_26.o vb_init.o vb_setmode.o vb_util.o vb_ext.o +xgifb-y := XGI_main_26.o vb_init.o vb_setmode.o vb_util.o diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h index 71aebe3..35f7b2a 100644 --- a/drivers/staging/xgifb/XGI_main.h +++ b/drivers/staging/xgifb/XGI_main.h @@ -32,14 +32,10 @@ #endif static DEFINE_PCI_DEVICE_TABLE(xgifb_pci_table) = { - {PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_20, PCI_ANY_ID, PCI_ANY_ID, - 0, 0, 0}, - {PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_27, PCI_ANY_ID, PCI_ANY_ID, - 0, 0, 1}, - {PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_40, PCI_ANY_ID, PCI_ANY_ID, - 0, 0, 2}, - {PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_42, PCI_ANY_ID, PCI_ANY_ID, - 0, 0, 3}, + {PCI_DEVICE(PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_20)}, + {PCI_DEVICE(PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_27)}, + {PCI_DEVICE(PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_40)}, + {PCI_DEVICE(PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_42)}, {0} }; @@ -128,7 +124,6 @@ MODULE_DEVICE_TABLE(pci, xgifb_pci_table); /* display status */ static int XGIfb_crt1off; static int XGIfb_forcecrt1 = -1; -static int XGIfb_userom ; /* global flags */ static int XGIfb_tvmode; diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 277e408..2502c49 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -21,7 +21,6 @@ #include <linux/ioport.h> #include <linux/init.h> #include <linux/pci.h> -#include <linux/vmalloc.h> #include <linux/vt_kern.h> #include <linux/capability.h> #include <linux/fs.h> @@ -46,8 +45,7 @@ #define GPIOG_EN (1<<6) #define GPIOG_READ (1<<1) -#define XGIFB_ROM_SIZE 65536 - +static char *forcecrt2type; static char *mode; static int vesa = -1; static unsigned int refresh_rate; @@ -159,7 +157,6 @@ static int XGIfb_mode_rate_to_dclock(struct vb_device_info *XGI_Pr, /* unsigned long temp = 0; */ int Clock; - XGI_Pr->ROMAddr = HwDeviceExtension->pjVirtualRomBase; InitTo330Pointer(HwDeviceExtension->jChipType, XGI_Pr); RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, @@ -199,7 +196,6 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr, unsigned char sr_data, cr_data, cr_data2; unsigned long cr_data3; int A, B, C, D, E, F, temp, j; - XGI_Pr->ROMAddr = HwDeviceExtension->pjVirtualRomBase; InitTo330Pointer(HwDeviceExtension->jChipType, XGI_Pr); RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, ModeIdIndex, XGI_Pr); @@ -387,7 +383,7 @@ static void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr) /* ------------------ Internal helper routines ----------------- */ -static int XGIfb_GetXG21DefaultLVDSModeIdx(void) +static int XGIfb_GetXG21DefaultLVDSModeIdx(struct xgifb_video_info *xgifb_info) { int found_mode = 0; @@ -396,11 +392,11 @@ static int XGIfb_GetXG21DefaultLVDSModeIdx(void) found_mode = 0; while ((XGIbios_mode[XGIfb_mode_idx].mode_no != 0) && (XGIbios_mode[XGIfb_mode_idx].xres - <= XGI21_LCDCapList[0].LVDSHDE)) { + <= xgifb_info->lvds_data.LVDSHDE)) { if ((XGIbios_mode[XGIfb_mode_idx].xres - == XGI21_LCDCapList[0].LVDSHDE) + == xgifb_info->lvds_data.LVDSHDE) && (XGIbios_mode[XGIfb_mode_idx].yres - == XGI21_LCDCapList[0].LVDSVDE) + == xgifb_info->lvds_data.LVDSVDE) && (XGIbios_mode[XGIfb_mode_idx].bpp == 8)) { found_mode = 1; break; @@ -456,51 +452,6 @@ invalid: printk(KERN_INFO "XGIfb: Invalid VESA mode 0x%x'\n", vesamode); } -static int XGIfb_GetXG21LVDSData(struct xgifb_video_info *xgifb_info) -{ - u8 tmp; - void __iomem *data = xgifb_info->mmio_vbase + 0x20000; - int i, j, k; - - tmp = xgifb_reg_get(XGISR, 0x1e); - xgifb_reg_set(XGISR, 0x1e, tmp | 4); - - if ((readb(data) == 0x55) && - (readb(data + 1) == 0xAA) && - (readb(data + 0x65) & 0x1)) { - i = readw(data + 0x316); - j = readb(data + i - 1); - if (j == 0xff) - j = 1; - - k = 0; - do { - XGI21_LCDCapList[k].LVDS_Capability = readw(data + i); - XGI21_LCDCapList[k].LVDSHT = readw(data + i + 2); - XGI21_LCDCapList[k].LVDSVT = readw(data + i + 4); - XGI21_LCDCapList[k].LVDSHDE = readw(data + i + 6); - XGI21_LCDCapList[k].LVDSVDE = readw(data + i + 8); - XGI21_LCDCapList[k].LVDSHFP = readw(data + i + 10); - XGI21_LCDCapList[k].LVDSVFP = readw(data + i + 12); - XGI21_LCDCapList[k].LVDSHSYNC = readw(data + i + 14); - XGI21_LCDCapList[k].LVDSVSYNC = readw(data + i + 16); - XGI21_LCDCapList[k].VCLKData1 = readb(data + i + 18); - XGI21_LCDCapList[k].VCLKData2 = readb(data + i + 19); - XGI21_LCDCapList[k].PSC_S1 = readb(data + i + 20); - XGI21_LCDCapList[k].PSC_S2 = readb(data + i + 21); - XGI21_LCDCapList[k].PSC_S3 = readb(data + i + 22); - XGI21_LCDCapList[k].PSC_S4 = readb(data + i + 23); - XGI21_LCDCapList[k].PSC_S5 = readb(data + i + 24); - i += 25; - j--; - k++; - } while ((j > 0) && (k < (sizeof(XGI21_LCDCapList) - / sizeof(struct XGI21_LVDSCapStruct)))); - return 1; - } - return 0; -} - static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) { u16 xres, yres; @@ -508,8 +459,8 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) if (xgifb_info->chip == XG21) { if (xgifb_info->display2 == XGIFB_DISP_LCD) { - xres = XGI21_LCDCapList[0].LVDSHDE; - yres = XGI21_LCDCapList[0].LVDSVDE; + xres = xgifb_info->lvds_data.LVDSHDE; + yres = xgifb_info->lvds_data.LVDSVDE; if (XGIbios_mode[myindex].xres > xres) return -1; if (XGIbios_mode[myindex].yres > yres) @@ -1223,7 +1174,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, if (isactive) { XGIfb_pre_setmode(xgifb_info); - if (XGISetModeNew(hw_info, + if (XGISetModeNew(xgifb_info, hw_info, XGIbios_mode[xgifb_info->mode_idx].mode_no) == 0) { printk(KERN_ERR "XGIfb: Setting mode[0x%x] failed\n", @@ -1794,17 +1745,16 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info) XGIfb_crt1off = 0; } - if (XGIfb_crt2type != -1) - /* TW: Override with option */ - xgifb_info->display2 = XGIfb_crt2type; - else if (cr32 & XGI_VB_TV) - xgifb_info->display2 = XGIFB_DISP_TV; - else if (cr32 & XGI_VB_LCD) - xgifb_info->display2 = XGIFB_DISP_LCD; - else if (cr32 & XGI_VB_CRT2) - xgifb_info->display2 = XGIFB_DISP_CRT; - else - xgifb_info->display2 = XGIFB_DISP_NONE; + if (!xgifb_info->display2_force) { + if (cr32 & XGI_VB_TV) + xgifb_info->display2 = XGIFB_DISP_TV; + else if (cr32 & XGI_VB_LCD) + xgifb_info->display2 = XGIFB_DISP_LCD; + else if (cr32 & XGI_VB_CRT2) + xgifb_info->display2 = XGIFB_DISP_CRT; + else + xgifb_info->display2 = XGIFB_DISP_NONE; + } if (XGIfb_tvplug != -1) /* PR/TW: Override with option */ @@ -1925,8 +1875,6 @@ static int __init XGIfb_setup(char *options) XGIfb_crt2type = XGIFB_DISP_LCD; } else if (!strncmp(this_opt, "noypan", 6)) { XGIfb_ypan = 0; - } else if (!strncmp(this_opt, "userom:", 7)) { - XGIfb_userom = xgifb_optval(this_opt, 7); } else { mode = this_opt; } @@ -1934,35 +1882,12 @@ static int __init XGIfb_setup(char *options) return 0; } -static unsigned char *xgifb_copy_rom(struct pci_dev *dev) -{ - void __iomem *rom_address; - unsigned char *rom_copy; - size_t rom_size; - - rom_address = pci_map_rom(dev, &rom_size); - if (rom_address == NULL) - return NULL; - - rom_copy = vzalloc(XGIFB_ROM_SIZE); - if (rom_copy == NULL) - goto done; - - rom_size = min_t(size_t, rom_size, XGIFB_ROM_SIZE); - memcpy_fromio(rom_copy, rom_address, rom_size); - -done: - pci_unmap_rom(dev, rom_address); - return rom_copy; -} - static int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { u8 reg, reg1; u8 CR48, CR38; int ret; - bool xgi21_drvlcdcaplist = false; struct fb_info *fb_info; struct xgifb_video_info *xgifb_info; struct xgi_hw_device_info *hw_info; @@ -2001,6 +1926,11 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, goto error; } + if (XGIfb_crt2type != -1) { + xgifb_info->display2 = XGIfb_crt2type; + xgifb_info->display2_force = true; + } + XGIRegInit(&xgifb_info->dev_info, (unsigned long)hw_info->pjIOAddress); xgifb_reg_set(XGISR, IND_XGI_PASSWORD, XGI_PASSWORD); @@ -2041,18 +1971,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, printk("XGIfb:chipid = %x\n", xgifb_info->chip); hw_info->jChipType = xgifb_info->chip; - if ((xgifb_info->chip == XG21) || (XGIfb_userom)) { - hw_info->pjVirtualRomBase = xgifb_copy_rom(pdev); - if (hw_info->pjVirtualRomBase) - printk(KERN_INFO "XGIfb: Video ROM found and mapped to %p\n", - hw_info->pjVirtualRomBase); - else - printk(KERN_INFO "XGIfb: Video ROM not found\n"); - } else { - hw_info->pjVirtualRomBase = NULL; - printk(KERN_INFO "XGIfb: Video ROM usage disabled\n"); - } - if (XGIfb_get_dram_size(xgifb_info)) { printk(KERN_INFO "XGIfb: Fatal error: Unable to determine RAM size.\n"); ret = -ENODEV; @@ -2117,8 +2035,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, CR38 = xgifb_reg_get(XGICR, 0x38); if ((CR38&0xE0) == 0xC0) { xgifb_info->display2 = XGIFB_DISP_LCD; - if (!XGIfb_GetXG21LVDSData(xgifb_info)) - xgi21_drvlcdcaplist = true; } else if ((CR38&0xE0) == 0x60) { xgifb_info->hasVB = HASVB_CHRONTEL; } else { @@ -2193,6 +2109,8 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, if (xgifb_info->hasVB != HASVB_NONE) XGIfb_detect_VB(xgifb_info); + else if (xgifb_info->chip != XG21) + xgifb_info->display2 = XGIFB_DISP_NONE; if (xgifb_info->display2 == XGIFB_DISP_LCD) { if (!enable_dstn) { @@ -2254,7 +2172,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, if (xgifb_info->display2 == XGIFB_DISP_LCD && xgifb_info->chip == XG21) xgifb_info->mode_idx = - XGIfb_GetXG21DefaultLVDSModeIdx(); + XGIfb_GetXG21DefaultLVDSModeIdx(xgifb_info); else xgifb_info->mode_idx = DEFAULT_MODE; } @@ -2264,21 +2182,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, goto error_1; } - if (xgi21_drvlcdcaplist) { - int m; - - for (m = 0; m < ARRAY_SIZE(XGI21_LCDCapList); m++) - if ((XGI21_LCDCapList[m].LVDSHDE == - XGIbios_mode[xgifb_info->mode_idx].xres) && - (XGI21_LCDCapList[m].LVDSVDE == - XGIbios_mode[xgifb_info->mode_idx].yres)) { - xgifb_reg_set(xgifb_info->dev_info.P3d4, - 0x36, - m); - break; - } - } - /* yilin set default refresh rate */ xgifb_info->refresh_rate = refresh_rate; if (xgifb_info->refresh_rate == 0) @@ -2418,7 +2321,6 @@ error_1: error_0: release_mem_region(xgifb_info->video_base, xgifb_info->video_size); error: - vfree(hw_info->pjVirtualRomBase); framebuffer_release(fb_info); return ret; } @@ -2442,7 +2344,6 @@ static void __devexit xgifb_remove(struct pci_dev *pdev) iounmap(xgifb_info->video_vbase); release_mem_region(xgifb_info->mmio_base, xgifb_info->mmio_size); release_mem_region(xgifb_info->video_base, xgifb_info->video_size); - vfree(xgifb_info->hw_info.pjVirtualRomBase); framebuffer_release(fb_info); pci_set_drvdata(pdev, NULL); } @@ -2458,6 +2359,8 @@ static int __init xgifb_init(void) { char *option = NULL; + if (forcecrt2type != NULL) + XGIfb_search_crt2type(forcecrt2type); if (fb_get_options("xgifb", &option)) return -ENODEV; XGIfb_setup(option); @@ -2480,6 +2383,11 @@ MODULE_AUTHOR("XGITECH , Others"); module_param(mode, charp, 0); module_param(vesa, int, 0); module_param(filter, int, 0); +module_param(forcecrt2type, charp, 0); + +MODULE_PARM_DESC(forcecrt2type, + "\nForce the second display output type. Possible values are NONE,\n" + "LCD, TV, VGA, SVIDEO or COMPOSITE.\n"); MODULE_PARM_DESC(mode, "\nSelects the desired default display mode in the format XxYxDepth,\n" diff --git a/drivers/staging/xgifb/XGIfb.h b/drivers/staging/xgifb/XGIfb.h index 7611846..2c866bb 100644 --- a/drivers/staging/xgifb/XGIfb.h +++ b/drivers/staging/xgifb/XGIfb.h @@ -86,10 +86,13 @@ struct xgifb_video_info { unsigned int refresh_rate; enum xgifb_display_type display2; /* the second display output type */ + bool display2_force; unsigned char hasVB; unsigned char TV_type; unsigned char TV_plug; + struct XGI21_LVDSCapStruct lvds_data; + enum XGI_CHIP_TYPE chip; unsigned char revision_id; diff --git a/drivers/staging/xgifb/vb_ext.c b/drivers/staging/xgifb/vb_ext.c deleted file mode 100644 index b1a2573..0000000 --- a/drivers/staging/xgifb/vb_ext.c +++ /dev/null @@ -1,444 +0,0 @@ -#include <linux/io.h> -#include <linux/types.h> -#include "XGIfb.h" - -#include "vb_def.h" -#include "vgatypes.h" -#include "vb_struct.h" -#include "vb_util.h" -#include "vb_setmode.h" -#include "vb_ext.h" - -/************************************************************** - *********************** Dynamic Sense ************************ - *************************************************************/ - -static unsigned char XGINew_Is301B(struct vb_device_info *pVBInfo) -{ - unsigned short flag; - - flag = xgifb_reg_get(pVBInfo->Part4Port, 0x01); - - if (flag > 0x0B0) - return 0; /* 301b */ - else - return 1; -} - -static unsigned char XGINew_Sense(unsigned short tempbx, - unsigned short tempcx, - struct vb_device_info *pVBInfo) -{ - unsigned short temp, i, tempch; - - temp = tempbx & 0xFF; - xgifb_reg_set(pVBInfo->Part4Port, 0x11, temp); - temp = (tempbx & 0xFF00) >> 8; - temp |= (tempcx & 0x00FF); - xgifb_reg_and_or(pVBInfo->Part4Port, 0x10, ~0x1F, temp); - - for (i = 0; i < 10; i++) - XGI_LongWait(pVBInfo); - - tempch = (tempcx & 0x7F00) >> 8; - temp = xgifb_reg_get(pVBInfo->Part4Port, 0x03); - temp = temp ^ (0x0E); - temp &= tempch; - - if (temp > 0) - return 1; - else - return 0; -} - -static unsigned char -XGINew_GetLCDDDCInfo(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) -{ - unsigned short temp; - - /* add lcd sense */ - if (HwDeviceExtension->ulCRT2LCDType == LCD_UNKNOWN) { - return 0; - } else { - temp = (unsigned short) HwDeviceExtension->ulCRT2LCDType; - switch (HwDeviceExtension->ulCRT2LCDType) { - case LCD_INVALID: - case LCD_800x600: - case LCD_1024x768: - case LCD_1280x1024: - break; - - case LCD_640x480: - case LCD_1024x600: - case LCD_1152x864: - case LCD_1280x960: - case LCD_1152x768: - temp = 0; - break; - - case LCD_1400x1050: - case LCD_1280x768: - case LCD_1600x1200: - break; - - case LCD_1920x1440: - case LCD_2048x1536: - temp = 0; - break; - - default: - break; - } - xgifb_reg_and_or(pVBInfo->P3d4, 0x36, 0xF0, temp); - return 1; - } -} - -static unsigned char XGINew_GetPanelID(struct vb_device_info *pVBInfo) -{ - unsigned short PanelTypeTable[16] = { SyncNN | PanelRGB18Bit - | Panel800x600 | _PanelType00, SyncNN | PanelRGB18Bit - | Panel1024x768 | _PanelType01, SyncNN | PanelRGB18Bit - | Panel800x600 | _PanelType02, SyncNN | PanelRGB18Bit - | Panel640x480 | _PanelType03, SyncNN | PanelRGB18Bit - | Panel1024x768 | _PanelType04, SyncNN | PanelRGB18Bit - | Panel1024x768 | _PanelType05, SyncNN | PanelRGB18Bit - | Panel1024x768 | _PanelType06, SyncNN | PanelRGB24Bit - | Panel1024x768 | _PanelType07, SyncNN | PanelRGB18Bit - | Panel800x600 | _PanelType08, SyncNN | PanelRGB18Bit - | Panel1024x768 | _PanelType09, SyncNN | PanelRGB18Bit - | Panel800x600 | _PanelType0A, SyncNN | PanelRGB18Bit - | Panel1024x768 | _PanelType0B, SyncNN | PanelRGB18Bit - | Panel1024x768 | _PanelType0C, SyncNN | PanelRGB24Bit - | Panel1024x768 | _PanelType0D, SyncNN | PanelRGB18Bit - | Panel1024x768 | _PanelType0E, SyncNN | PanelRGB18Bit - | Panel1024x768 | _PanelType0F }; - unsigned short tempax, tempbx, temp; - /* unsigned short return_flag; */ - - tempax = xgifb_reg_get(pVBInfo->P3c4, 0x1A); - tempbx = tempax & 0x1E; - - if (tempax == 0) - return 0; - else { - /* - if (!(tempax & 0x10)) { - if (pVBInfo->IF_DEF_LVDS == 1) { - tempbx = 0; - temp = xgifb_reg_get(pVBInfo->P3c4, 0x38); - if (temp & 0x40) - tempbx |= 0x08; - if (temp & 0x20) - tempbx |= 0x02; - if (temp & 0x01) - tempbx |= 0x01; - - temp = xgifb_reg_get(pVBInfo->P3c4, 0x39); - if (temp & 0x80) - tempbx |= 0x04; - } else { - return(0); - } - } - */ - - tempbx = tempbx >> 1; - temp = tempbx & 0x00F; - xgifb_reg_set(pVBInfo->P3d4, 0x36, temp); - tempbx--; - tempbx = PanelTypeTable[tempbx]; - - temp = (tempbx & 0xFF00) >> 8; - xgifb_reg_and_or(pVBInfo->P3d4, 0x37, ~(LCDSyncBit - | LCDRGB18Bit), temp); - return 1; - } -} - -static unsigned char -XGINew_BridgeIsEnable(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) -{ - unsigned short flag; - - if (XGI_BridgeIsOn(pVBInfo) == 0) { - flag = xgifb_reg_get(pVBInfo->Part1Port, 0x0); - - if (flag & 0x050) - return 1; - else - return 0; - - } - return 0; -} - -static unsigned char -XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) -{ - unsigned short tempbx, tempcx, temp, i, tempch; - - tempbx = *pVBInfo->pYCSenseData2; - - tempcx = 0x0604; - - temp = tempbx & 0xFF; - xgifb_reg_set(pVBInfo->Part4Port, 0x11, temp); - temp = (tempbx & 0xFF00) >> 8; - temp |= (tempcx & 0x00FF); - xgifb_reg_and_or(pVBInfo->Part4Port, 0x10, ~0x1F, temp); - - for (i = 0; i < 10; i++) - XGI_LongWait(pVBInfo); - - tempch = (tempcx & 0xFF00) >> 8; - temp = xgifb_reg_get(pVBInfo->Part4Port, 0x03); - temp = temp ^ (0x0E); - temp &= tempch; - - if (temp != tempch) - return 0; - - tempbx = *pVBInfo->pVideoSenseData2; - - tempcx = 0x0804; - temp = tempbx & 0xFF; - xgifb_reg_set(pVBInfo->Part4Port, 0x11, temp); - temp = (tempbx & 0xFF00) >> 8; - temp |= (tempcx & 0x00FF); - xgifb_reg_and_or(pVBInfo->Part4Port, 0x10, ~0x1F, temp); - - for (i = 0; i < 10; i++) - XGI_LongWait(pVBInfo); - - tempch = (tempcx & 0xFF00) >> 8; - temp = xgifb_reg_get(pVBInfo->Part4Port, 0x03); - temp = temp ^ (0x0E); - temp &= tempch; - - if (temp != tempch) { - return 0; - } else { - tempbx = 0x3FF; - tempcx = 0x0804; - temp = tempbx & 0xFF; - xgifb_reg_set(pVBInfo->Part4Port, 0x11, temp); - temp = (tempbx & 0xFF00) >> 8; - temp |= (tempcx & 0x00FF); - xgifb_reg_and_or(pVBInfo->Part4Port, 0x10, ~0x1F, temp); - - for (i = 0; i < 10; i++) - XGI_LongWait(pVBInfo); - - tempch = (tempcx & 0xFF00) >> 8; - temp = xgifb_reg_get(pVBInfo->Part4Port, 0x03); - temp = temp ^ (0x0E); - temp &= tempch; - - if (temp != tempch) - return 1; - else - return 0; - } -} - -void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) -{ - unsigned short tempax = 0, tempbx, tempcx, temp, - P2reg0 = 0, SenseModeNo = 0, - OutputSelect = *pVBInfo->pOutputSelect, - ModeIdIndex, i; - pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress; - - if (pVBInfo->IF_DEF_LVDS == 1) { - /* ynlai 02/27/2002 */ - tempax = xgifb_reg_get(pVBInfo->P3c4, 0x1A); - tempbx = xgifb_reg_get(pVBInfo->P3c4, 0x1B); - tempax = ((tempax & 0xFE) >> 1) | (tempbx << 8); - if (tempax == 0x00) { /* Get Panel id from DDC */ - temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo); - if (temp == 1) { /* LCD connect */ - /* set CR39 bit0="1" */ - xgifb_reg_and_or(pVBInfo->P3d4, - 0x39, 0xFF, 0x01); - /* clean CR37 bit4="0" */ - xgifb_reg_and_or(pVBInfo->P3d4, - 0x37, 0xEF, 0x00); - temp = LCDSense; - } else { /* LCD don't connect */ - temp = 0; - } - } else { - XGINew_GetPanelID(pVBInfo); - temp = LCDSense; - } - - tempbx = ~(LCDSense | AVIDEOSense | SVIDEOSense); - xgifb_reg_and_or(pVBInfo->P3d4, 0x32, tempbx, temp); - } else { /* for 301 */ - if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { /* for HiVision */ - tempax = xgifb_reg_get(pVBInfo->P3c4, 0x38); - temp = tempax & 0x01; - tempax = xgifb_reg_get(pVBInfo->P3c4, 0x3A); - temp = temp | (tempax & 0x02); - xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xA0, temp); - } else { - if (XGI_BridgeIsOn(pVBInfo)) { - P2reg0 = xgifb_reg_get(pVBInfo->Part2Port, - 0x00); - if (!XGINew_BridgeIsEnable(HwDeviceExtension, - pVBInfo)) { - SenseModeNo = 0x2e; - /* xgifb_reg_set(pVBInfo->P3d4, 0x30, 0x41); - * XGISetModeNew(HwDeviceExtension, 0x2e); - * // ynlai InitMode */ - - temp = XGI_SearchModeID(SenseModeNo, - &ModeIdIndex, - pVBInfo); - XGI_GetVGAType(HwDeviceExtension, - pVBInfo); - XGI_GetVBType(pVBInfo); - pVBInfo->SetFlag = 0x00; - pVBInfo->ModeType = ModeVGA; - pVBInfo->VBInfo = SetCRT2ToRAMDAC | - LoadDACFlag | - SetInSlaveMode; - XGI_GetLCDInfo(0x2e, - ModeIdIndex, - pVBInfo); - XGI_GetTVInfo(0x2e, - ModeIdIndex, - pVBInfo); - XGI_EnableBridge(HwDeviceExtension, - pVBInfo); - XGI_SetCRT2Group301(SenseModeNo, - HwDeviceExtension, - pVBInfo); - XGI_SetCRT2ModeRegs(0x2e, - HwDeviceExtension, - pVBInfo); - /* XGI_DisableBridge(HwDeviceExtension, - * pVBInfo ) ; */ - /* Display Off 0212 */ - xgifb_reg_and_or(pVBInfo->P3c4, - 0x01, - 0xDF, - 0x20); - for (i = 0; i < 20; i++) - XGI_LongWait(pVBInfo); - } - xgifb_reg_set(pVBInfo->Part2Port, 0x00, 0x1c); - tempax = 0; - tempbx = *pVBInfo->pRGBSenseData; - - if (!(XGINew_Is301B(pVBInfo))) - tempbx = *pVBInfo->pRGBSenseData2; - - tempcx = 0x0E08; - if (XGINew_Sense(tempbx, tempcx, pVBInfo)) { - if (XGINew_Sense(tempbx, - tempcx, - pVBInfo)) - tempax |= Monitor2Sense; - } - - if (pVBInfo->VBType & VB_XGI301C) - xgifb_reg_or(pVBInfo->Part4Port, - 0x0d, - 0x04); - - /* add by kuku for Multi-adapter sense HiTV */ - if (XGINew_SenseHiTV(HwDeviceExtension, - pVBInfo)) { - tempax |= HiTVSense; - if ((pVBInfo->VBType & VB_XGI301C)) - tempax ^= (HiTVSense | - YPbPrSense); - } - - /* start */ - if (!(tempax & (HiTVSense | YPbPrSense))) { - tempbx = *pVBInfo->pYCSenseData; - if (!(XGINew_Is301B(pVBInfo))) - tempbx = *pVBInfo->pYCSenseData2; - tempcx = 0x0604; - if (XGINew_Sense(tempbx, - tempcx, - pVBInfo)) { - if (XGINew_Sense(tempbx, - tempcx, - pVBInfo)) - tempax |= SVIDEOSense; - } - - if (OutputSelect & BoardTVType) { - tempbx = *pVBInfo->pVideoSenseData; - - if (!(XGINew_Is301B(pVBInfo))) - tempbx = *pVBInfo->pVideoSenseData2; - - tempcx = 0x0804; - if (XGINew_Sense(tempbx, - tempcx, - pVBInfo)) { - if (XGINew_Sense(tempbx, - tempcx, - pVBInfo)) - tempax |= AVIDEOSense; - } - } else { - if (!(tempax & SVIDEOSense)) { - tempbx = *pVBInfo->pVideoSenseData; - - if (!(XGINew_Is301B(pVBInfo))) - tempbx = *pVBInfo->pVideoSenseData2; - - tempcx = 0x0804; - if (XGINew_Sense(tempbx, - tempcx, - pVBInfo)) { - if (XGINew_Sense(tempbx, tempcx, pVBInfo)) - tempax |= AVIDEOSense; - } - } - } - } - } /* end */ - if (!(tempax & Monitor2Sense)) { - if (XGINew_SenseLCD(HwDeviceExtension, pVBInfo)) - tempax |= LCDSense; - } - tempbx = 0; - tempcx = 0; - XGINew_Sense(tempbx, tempcx, pVBInfo); - - xgifb_reg_and_or(pVBInfo->P3d4, 0x32, ~0xDF, tempax); - xgifb_reg_set(pVBInfo->Part2Port, 0x00, P2reg0); - - if (!(P2reg0 & 0x20)) { - pVBInfo->VBInfo = DisableCRT2Display; - /* XGI_SetCRT2Group301(SenseModeNo, - * HwDeviceExtension, - * pVBInfo); */ - } - } - } - XGI_DisableBridge(HwDeviceExtension, pVBInfo); /* shampoo 0226 */ - -} - -unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) -{ - /* unsigned short SoftSetting ; */ - unsigned short temp; - - temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo); - - return temp; -} diff --git a/drivers/staging/xgifb/vb_ext.h b/drivers/staging/xgifb/vb_ext.h deleted file mode 100644 index 0b1f55b..0000000 --- a/drivers/staging/xgifb/vb_ext.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _VBEXT_ -#define _VBEXT_ - -extern void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo); -extern unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *, - struct vb_device_info *pVBInfo); - -#endif diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 9e890a1..4ccd988 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -1,6 +1,7 @@ #include <linux/types.h> #include <linux/delay.h> /* udelay */ #include <linux/pci.h> +#include <linux/vmalloc.h> #include "vgatypes.h" #include "XGIfb.h" @@ -10,7 +11,6 @@ #include "vb_util.h" #include "vb_setmode.h" #include "vb_init.h" -#include "vb_ext.h" #include <linux/io.h> @@ -35,6 +35,8 @@ static const unsigned short XGINew_DDRDRAM_TYPE20[12][5] = { { 2, 12, 9, 8, 0x35}, { 2, 12, 8, 4, 0x31} }; +#define XGIFB_ROM_SIZE 65536 + static unsigned char XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) @@ -1068,20 +1070,20 @@ static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension, return 0; } -static void XGINew_SetDRAMSize_340(struct xgi_hw_device_info *HwDeviceExtension, +static void XGINew_SetDRAMSize_340(struct xgifb_video_info *xgifb_info, + struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) { unsigned short data; - pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase; pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; - XGISetModeNew(HwDeviceExtension, 0x2e); + XGISetModeNew(xgifb_info, HwDeviceExtension, 0x2e); data = xgifb_reg_get(pVBInfo->P3c4, 0x21); /* disable read cache */ xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short) (data & 0xDF)); - XGI_DisplayOff(HwDeviceExtension, pVBInfo); + XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo); /* data = xgifb_reg_get(pVBInfo->P3c4, 0x1); */ /* data |= 0x20 ; */ @@ -1092,118 +1094,100 @@ static void XGINew_SetDRAMSize_340(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short) (data | 0x20)); } -static void ReadVBIOSTablData(unsigned char ChipType, +static u8 *xgifb_copy_rom(struct pci_dev *dev, size_t *rom_size) +{ + void __iomem *rom_address; + u8 *rom_copy; + + rom_address = pci_map_rom(dev, rom_size); + if (rom_address == NULL) + return NULL; + + rom_copy = vzalloc(XGIFB_ROM_SIZE); + if (rom_copy == NULL) + goto done; + + *rom_size = min_t(size_t, *rom_size, XGIFB_ROM_SIZE); + memcpy_fromio(rom_copy, rom_address, *rom_size); + +done: + pci_unmap_rom(dev, rom_address); + return rom_copy; +} + +static void xgifb_read_vbios(struct pci_dev *pdev, struct vb_device_info *pVBInfo) { - volatile unsigned char *pVideoMemory = - (unsigned char *) pVBInfo->ROMAddr; + struct xgifb_video_info *xgifb_info = pci_get_drvdata(pdev); + u8 *vbios; unsigned long i; - unsigned char j, k; - /* Volari customize data area end */ - - if (ChipType == XG21) { - pVBInfo->IF_DEF_LVDS = 0; - if (pVideoMemory[0x65] & 0x1) { - pVBInfo->IF_DEF_LVDS = 1; - i = pVideoMemory[0x316] | (pVideoMemory[0x317] << 8); - j = pVideoMemory[i - 1]; - if (j != 0xff) { - k = 0; - do { - pVBInfo->XG21_LVDSCapList[k]. - LVDS_Capability - = pVideoMemory[i] | - (pVideoMemory[i + 1] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSHT - = pVideoMemory[i + 2] | - (pVideoMemory[i + 3] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSVT - = pVideoMemory[i + 4] | - (pVideoMemory[i + 5] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSHDE - = pVideoMemory[i + 6] | - (pVideoMemory[i + 7] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSVDE - = pVideoMemory[i + 8] | - (pVideoMemory[i + 9] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSHFP - = pVideoMemory[i + 10] | - (pVideoMemory[i + 11] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSVFP - = pVideoMemory[i + 12] | - (pVideoMemory[i + 13] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSHSYNC - = pVideoMemory[i + 14] | - (pVideoMemory[i + 15] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSVSYNC - = pVideoMemory[i + 16] | - (pVideoMemory[i + 17] << 8); - pVBInfo->XG21_LVDSCapList[k].VCLKData1 - = pVideoMemory[i + 18]; - pVBInfo->XG21_LVDSCapList[k].VCLKData2 - = pVideoMemory[i + 19]; - pVBInfo->XG21_LVDSCapList[k].PSC_S1 - = pVideoMemory[i + 20]; - pVBInfo->XG21_LVDSCapList[k].PSC_S2 - = pVideoMemory[i + 21]; - pVBInfo->XG21_LVDSCapList[k].PSC_S3 - = pVideoMemory[i + 22]; - pVBInfo->XG21_LVDSCapList[k].PSC_S4 - = pVideoMemory[i + 23]; - pVBInfo->XG21_LVDSCapList[k].PSC_S5 - = pVideoMemory[i + 24]; - i += 25; - j--; - k++; - } while ((j > 0) && - (k < (sizeof(XGI21_LCDCapList) / - sizeof(struct - XGI21_LVDSCapStruct)))); - } else { - pVBInfo->XG21_LVDSCapList[0].LVDS_Capability - = pVideoMemory[i] | - (pVideoMemory[i + 1] << 8); - pVBInfo->XG21_LVDSCapList[0].LVDSHT - = pVideoMemory[i + 2] | - (pVideoMemory[i + 3] << 8); - pVBInfo->XG21_LVDSCapList[0].LVDSVT - = pVideoMemory[i + 4] | - (pVideoMemory[i + 5] << 8); - pVBInfo->XG21_LVDSCapList[0].LVDSHDE - = pVideoMemory[i + 6] | - (pVideoMemory[i + 7] << 8); - pVBInfo->XG21_LVDSCapList[0].LVDSVDE - = pVideoMemory[i + 8] | - (pVideoMemory[i + 9] << 8); - pVBInfo->XG21_LVDSCapList[0].LVDSHFP - = pVideoMemory[i + 10] | - (pVideoMemory[i + 11] << 8); - pVBInfo->XG21_LVDSCapList[0].LVDSVFP - = pVideoMemory[i + 12] | - (pVideoMemory[i + 13] << 8); - pVBInfo->XG21_LVDSCapList[0].LVDSHSYNC - = pVideoMemory[i + 14] | - (pVideoMemory[i + 15] << 8); - pVBInfo->XG21_LVDSCapList[0].LVDSVSYNC - = pVideoMemory[i + 16] | - (pVideoMemory[i + 17] << 8); - pVBInfo->XG21_LVDSCapList[0].VCLKData1 - = pVideoMemory[i + 18]; - pVBInfo->XG21_LVDSCapList[0].VCLKData2 - = pVideoMemory[i + 19]; - pVBInfo->XG21_LVDSCapList[0].PSC_S1 - = pVideoMemory[i + 20]; - pVBInfo->XG21_LVDSCapList[0].PSC_S2 - = pVideoMemory[i + 21]; - pVBInfo->XG21_LVDSCapList[0].PSC_S3 - = pVideoMemory[i + 22]; - pVBInfo->XG21_LVDSCapList[0].PSC_S4 - = pVideoMemory[i + 23]; - pVBInfo->XG21_LVDSCapList[0].PSC_S5 - = pVideoMemory[i + 24]; - } - } + unsigned char j; + struct XGI21_LVDSCapStruct *lvds; + size_t vbios_size; + int entry; + + if (xgifb_info->chip != XG21) + return; + pVBInfo->IF_DEF_LVDS = 0; + vbios = xgifb_copy_rom(pdev, &vbios_size); + if (vbios == NULL) { + dev_err(&pdev->dev, "video BIOS not available\n"); + return; + } + if (vbios_size <= 0x65) + goto error; + /* + * The user can ignore the LVDS bit in the BIOS and force the display + * type. + */ + if (!(vbios[0x65] & 0x1) && + (!xgifb_info->display2_force || + xgifb_info->display2 != XGIFB_DISP_LCD)) { + vfree(vbios); + return; } + if (vbios_size <= 0x317) + goto error; + i = vbios[0x316] | (vbios[0x317] << 8); + if (vbios_size <= i - 1) + goto error; + j = vbios[i - 1]; + if (j == 0) + goto error; + if (j == 0xff) + j = 1; + /* + * Read the LVDS table index scratch register set by the BIOS. + */ + entry = xgifb_reg_get(xgifb_info->dev_info.P3d4, 0x36); + if (entry >= j) + entry = 0; + i += entry * 25; + lvds = &xgifb_info->lvds_data; + if (vbios_size <= i + 24) + goto error; + lvds->LVDS_Capability = vbios[i] | (vbios[i + 1] << 8); + lvds->LVDSHT = vbios[i + 2] | (vbios[i + 3] << 8); + lvds->LVDSVT = vbios[i + 4] | (vbios[i + 5] << 8); + lvds->LVDSHDE = vbios[i + 6] | (vbios[i + 7] << 8); + lvds->LVDSVDE = vbios[i + 8] | (vbios[i + 9] << 8); + lvds->LVDSHFP = vbios[i + 10] | (vbios[i + 11] << 8); + lvds->LVDSVFP = vbios[i + 12] | (vbios[i + 13] << 8); + lvds->LVDSHSYNC = vbios[i + 14] | (vbios[i + 15] << 8); + lvds->LVDSVSYNC = vbios[i + 16] | (vbios[i + 17] << 8); + lvds->VCLKData1 = vbios[i + 18]; + lvds->VCLKData2 = vbios[i + 19]; + lvds->PSC_S1 = vbios[i + 20]; + lvds->PSC_S2 = vbios[i + 21]; + lvds->PSC_S3 = vbios[i + 22]; + lvds->PSC_S4 = vbios[i + 23]; + lvds->PSC_S5 = vbios[i + 24]; + vfree(vbios); + pVBInfo->IF_DEF_LVDS = 1; + return; +error: + dev_err(&pdev->dev, "video BIOS corrupted\n"); + vfree(vbios); } static void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, @@ -1336,18 +1320,57 @@ static void XGINew_SetModeScratch(struct xgi_hw_device_info *HwDeviceExtension, } +static unsigned short XGINew_SenseLCD(struct xgi_hw_device_info + *HwDeviceExtension, + struct vb_device_info *pVBInfo) +{ + unsigned short temp; + + /* add lcd sense */ + if (HwDeviceExtension->ulCRT2LCDType == LCD_UNKNOWN) { + return 0; + } else { + temp = (unsigned short) HwDeviceExtension->ulCRT2LCDType; + switch (HwDeviceExtension->ulCRT2LCDType) { + case LCD_INVALID: + case LCD_800x600: + case LCD_1024x768: + case LCD_1280x1024: + break; + + case LCD_640x480: + case LCD_1024x600: + case LCD_1152x864: + case LCD_1280x960: + case LCD_1152x768: + temp = 0; + break; + + case LCD_1400x1050: + case LCD_1280x768: + case LCD_1600x1200: + break; + + case LCD_1920x1440: + case LCD_2048x1536: + temp = 0; + break; + + default: + break; + } + xgifb_reg_and_or(pVBInfo->P3d4, 0x36, 0xF0, temp); + return 1; + } +} + static void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) { unsigned char Temp; - volatile unsigned char *pVideoMemory = - (unsigned char *) pVBInfo->ROMAddr; - - pVBInfo->IF_DEF_LVDS = 0; #if 1 - if ((pVideoMemory[0x65] & 0x01)) { /* For XG21 LVDS */ - pVBInfo->IF_DEF_LVDS = 1; + if (pVBInfo->IF_DEF_LVDS) { /* For XG21 LVDS */ xgifb_reg_or(pVBInfo->P3d4, 0x32, LCDSense); /* LVDS on chip */ xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xC0); @@ -1393,7 +1416,6 @@ static void XGINew_GetXG27Sense(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(pVBInfo->P3d4, 0x4A, bCR4A); if (Temp <= 0x02) { - pVBInfo->IF_DEF_LVDS = 1; /* LVDS setting */ xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xC0); xgifb_reg_set(pVBInfo->P3d4, 0x30, 0x21); @@ -1451,24 +1473,15 @@ unsigned char XGIInitNew(struct pci_dev *pdev) struct vb_device_info *pVBInfo = &VBINF; unsigned char i, temp = 0, temp1; /* VBIOSVersion[5]; */ - volatile unsigned char *pVideoMemory; /* unsigned long j, k; */ - pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase; - pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress; - pVideoMemory = (unsigned char *) pVBInfo->ROMAddr; - /* Newdebugcode(0x99); */ - - /* if (pVBInfo->ROMAddr == 0) */ - /* return(0); */ - if (pVBInfo->FBAddr == NULL) { printk("\n pVBInfo->FBAddr == 0 "); return 0; @@ -1516,8 +1529,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev) InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo); - /* ReadVBIOSData */ - ReadVBIOSTablData(HwDeviceExtension->jChipType, pVBInfo); + xgifb_read_vbios(pdev, pVBInfo); /* 1.Openkey */ xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86); @@ -1774,7 +1786,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev) pVBInfo); printk("20"); - XGINew_SetDRAMSize_340(HwDeviceExtension, pVBInfo); + XGINew_SetDRAMSize_340(xgifb_info, HwDeviceExtension, pVBInfo); printk("21"); printk("22"); diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 81c0cc4..67a316c 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -67,11 +67,6 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) pVBInfo->XGINEWUB_CRT1Table = (struct XGI_CRT1TableStruct *) XGI_CRT1Table; - /* add for new UNIVGABIOS */ - /* XGINew_UBLCDDataTable = - * (struct XGI_LCDDataTablStruct *) XGI_LCDDataTable; */ - /* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable; */ - pVBInfo->MCLKData = (struct XGI_MCLKDataStruct *) XGI340New_MCLKData; pVBInfo->ECLKData = (struct XGI_ECLKDataStruct *) XGI340_ECLKData; pVBInfo->VCLKData = (struct XGI_VCLKDataStruct *) XGI_VCLKData; @@ -148,9 +143,6 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) else pVBInfo->LCDCapList = XGI_LCDCapList; - if ((ChipType == XG21) || (ChipType == XG27)) - pVBInfo->XG21_LVDSCapList = XGI21_LCDCapList; - pVBInfo->XGI_TVDelayList = XGI301TVDelayList; pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2; @@ -236,28 +228,6 @@ static void XGI_SetSeqRegs(unsigned short ModeNo, } } -static void XGI_SetMiscRegs(unsigned short StandTableIndex, - struct vb_device_info *pVBInfo) -{ - unsigned char Miscdata; - - /* Get Misc from file */ - Miscdata = pVBInfo->StandTable[StandTableIndex].MISC; - /* - if (pVBInfo->VBType & (VB_XGI301B | - VB_XGI302B | - VB_XGI301LV | - VB_XGI302LV | - VB_XGI301C)) { - if (pVBInfo->VBInfo & SetCRT2ToLCDA) { - Miscdata |= 0x0C; - } - } - */ - - outb(Miscdata, pVBInfo->P3c2); /* Set Misc(3c2) */ -} - static void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension, unsigned short StandTableIndex, struct vb_device_info *pVBInfo) @@ -274,16 +244,6 @@ static void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension, CRTCdata = pVBInfo->StandTable[StandTableIndex].CRTC[i]; xgifb_reg_set(pVBInfo->P3d4, i, CRTCdata); /* Set CRTC(3d4) */ } - /* - if ((HwDeviceExtension->jChipType == XGI_630) && - (HwDeviceExtension->jChipRevision == 0x30)) { - if (pVBInfo->VBInfo & SetInSlaveMode) { - if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { - xgifb_reg_set(pVBInfo->P3d4, 0x18, 0xFE); - } - } - } - */ } static void XGI_SetATTRegs(unsigned short ModeNo, @@ -530,10 +490,6 @@ static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo, unsigned char data, data1, pushax; unsigned short i, j; - /* xgifb_reg_set(pVBInfo->P3d4, 0x51, 0); */ - /* xgifb_reg_set(pVBInfo->P3d4, 0x56, 0); */ - /* xgifb_reg_and_or(pVBInfo->P3d4, 0x11, 0x7f, 0x00); */ - /* unlock cr0-7 */ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11); data &= 0x7F; @@ -595,10 +551,6 @@ static void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned char data; unsigned short i, j; - /* xgifb_reg_set(pVBInfo->P3d4, 0x51, 0); */ - /* xgifb_reg_set(pVBInfo->P3d4, 0x56, 0); */ - /* xgifb_reg_and_or(pVBInfo->P3d4, 0x11, 0x7f, 0x00); */ - for (i = 0x00; i <= 0x01; i++) { data = pVBInfo->TimingV[0].data[i]; xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 6), data); @@ -976,6 +928,20 @@ static void XGI_SetXG27CRTC(unsigned short ModeNo, } } +static void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo) +{ + unsigned char temp; + + /* D[1:0] 01: 18bit, 00: dual 12, 10: single 24 */ + temp = xgifb_reg_get(pVBInfo->P3d4, 0x37); + temp = (temp & 3) << 6; + /* SR06[7]0: dual 12/1: single 24 [6] 18bit Dither <= 0 h/w recommend */ + xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0xc0, temp & 0x80); + /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: 24bits */ + xgifb_reg_and_or(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); + +} + static void xgifb_set_lcd(int chip_id, struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex, @@ -1088,6 +1054,20 @@ static void XGI_UpdateXG21CRTC(unsigned short ModeNo, } } +static unsigned short XGI_GetResInfo(unsigned short ModeNo, + unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) +{ + unsigned short resindex; + + if (ModeNo <= 0x13) + /* si+St_ResInfo */ + resindex = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; + else + /* si+Ext_ResInfo */ + resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; + return resindex; +} + static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, @@ -1127,9 +1107,6 @@ static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, tempcx = 8; - /* if (!(modeflag & Charx8Dot)) */ - /* tempcx = 9; */ - tempax /= tempcx; tempax -= 1; tempbx -= 1; @@ -1163,20 +1140,6 @@ static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(pVBInfo->P3d4, 0x11, temp); } -unsigned short XGI_GetResInfo(unsigned short ModeNo, - unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) -{ - unsigned short resindex; - - if (ModeNo <= 0x13) - /* si+St_ResInfo */ - resindex = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; - else - /* si+Ext_ResInfo */ - resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; - return resindex; -} - static void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, @@ -1308,77 +1271,55 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, VCLKIndex = LCDXlat2VCLK[CRT2Index]; else VCLKIndex = LCDXlat1VCLK[CRT2Index]; - } else { /* for TV */ - if (pVBInfo->VBInfo & SetCRT2ToTV) { - if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { - if (pVBInfo->SetFlag & RPLLDIV2XO) { - VCLKIndex = HiTVVCLKDIV2; - VCLKIndex += 25; - } else { - VCLKIndex = HiTVVCLK; - VCLKIndex += 25; - } - - if (pVBInfo->SetFlag & TVSimuMode) { - if (modeflag & Charx8Dot) { - VCLKIndex = - HiTVSimuVCLK; - VCLKIndex += 25; - } else { - VCLKIndex = - HiTVTextVCLK; - VCLKIndex += 25; - } - } + } else if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { + if (pVBInfo->SetFlag & RPLLDIV2XO) { + VCLKIndex = HiTVVCLKDIV2; + VCLKIndex += 25; + } else { + VCLKIndex = HiTVVCLK; + VCLKIndex += 25; + } - /* 301lv */ - if (pVBInfo->VBType & VB_XGI301LV) { - if (!(pVBInfo->VBExtInfo == - VB_YPbPr1080i)) { - VCLKIndex = - YPbPr750pVCLK; - if (!(pVBInfo->VBExtInfo - == - VB_YPbPr750p)) { - VCLKIndex = - YPbPr525pVCLK; - if (!(pVBInfo->VBExtInfo - == VB_YPbPr525p)) { - VCLKIndex - = YPbPr525iVCLK_2; - if (!(pVBInfo->SetFlag - & RPLLDIV2XO)) - VCLKIndex - = YPbPr525iVCLK; - } - } - } - } + if (pVBInfo->SetFlag & TVSimuMode) { + if (modeflag & Charx8Dot) { + VCLKIndex = HiTVSimuVCLK; + VCLKIndex += 25; } else { - if (pVBInfo->VBInfo & SetCRT2ToTV) { - if (pVBInfo->SetFlag & - RPLLDIV2XO) { - VCLKIndex = TVVCLKDIV2; - VCLKIndex += 25; - } else { - VCLKIndex = TVVCLK; - VCLKIndex += 25; - } - } + VCLKIndex = HiTVTextVCLK; + VCLKIndex += 25; } - } else { /* for CRT2 */ - /* Port 3cch */ - VCLKIndex = (unsigned char) inb( - (pVBInfo->P3ca + 0x02)); - VCLKIndex = ((VCLKIndex >> 2) & 0x03); - if (ModeNo > 0x13) { - /* di+Ext_CRTVCLK */ - VCLKIndex = - pVBInfo->RefIndex[ + } + + /* 301lv */ + if ((pVBInfo->VBType & VB_XGI301LV) && + !(pVBInfo->VBExtInfo == VB_YPbPr1080i)) { + if (pVBInfo->VBExtInfo == VB_YPbPr750p) + VCLKIndex = YPbPr750pVCLK; + else if (pVBInfo->VBExtInfo == VB_YPbPr525p) + VCLKIndex = YPbPr525pVCLK; + else if (pVBInfo->SetFlag & RPLLDIV2XO) + VCLKIndex = YPbPr525iVCLK_2; + else + VCLKIndex = YPbPr525iVCLK; + } + } else if (pVBInfo->VBInfo & SetCRT2ToTV) { + if (pVBInfo->SetFlag & RPLLDIV2XO) { + VCLKIndex = TVVCLKDIV2; + VCLKIndex += 25; + } else { + VCLKIndex = TVVCLK; + VCLKIndex += 25; + } + } else { /* for CRT2 */ + /* Port 3cch */ + VCLKIndex = (unsigned char) inb((pVBInfo->P3ca + 0x02)); + VCLKIndex = ((VCLKIndex >> 2) & 0x03); + if (ModeNo > 0x13) { + /* di+Ext_CRTVCLK */ + VCLKIndex = pVBInfo->RefIndex[ RefreshRateTableIndex]. Ext_CRTVCLK; - VCLKIndex &= IndexMask; - } + VCLKIndex &= IndexMask; } } } else { /* LVDS */ @@ -1397,7 +1338,6 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, else VCLKIndex = LVDSXlat3VCLK[VCLKIndex]; } - /* VCLKIndex = VCLKIndex&IndexMask; */ return VCLKIndex; } @@ -1461,6 +1401,19 @@ static void XGI_SetCRT1VCLK(unsigned short ModeNo, } } +static void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo) +{ + unsigned char temp; + + temp = xgifb_reg_get(pVBInfo->P3d4, 0x37); /* D[0] 1: 18bit */ + temp = (temp & 1) << 6; + /* SR06[6] 18bit Dither */ + xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0x40, temp); + /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: dual 12bits */ + xgifb_reg_and_or(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); + +} + static void XGI_SetCRT1FIFO(unsigned short ModeNo, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) @@ -1532,16 +1485,6 @@ static void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(pVBInfo->P3c4, 0x1F, data); } - /* Jong for Adavantech LCD ripple issue - if ((VCLK >= 0) && (VCLK < 135)) - data2 = 0x03; - else if ((VCLK >= 135) && (VCLK < 160)) - data2 = 0x02; - else if ((VCLK >= 160) && (VCLK < 260)) - data2 = 0x01; - else if (VCLK > 260) - data2 = 0x00; - */ data2 = 0x00; xgifb_reg_and_or(pVBInfo->P3c4, 0x07, 0xFC, data2); @@ -1591,7 +1534,6 @@ static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, data2 |= 0x20; xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0x3F, data2); - /* xgifb_reg_set(pVBInfo->P3c4,0x06,data2); */ resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); if (ModeNo <= 0x13) xres = pVBInfo->StResInfo[resindex].HTotal; @@ -1636,11 +1578,6 @@ static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, XGI_SetVCLKState(HwDeviceExtension, ModeNo, RefreshRateTableIndex, pVBInfo); - /* if (modeflag&HalfDCLK) //030305 fix lowresolution bug */ - /* if (XGINew_IF_DEF_NEW_LOWRES) */ - /* XGI_VesaLowResolution(ModeNo, ModeIdIndex); - * //030305 fix lowresolution bug */ - data = xgifb_reg_get(pVBInfo->P3d4, 0x31); if (HwDeviceExtension->jChipType == XG27) { @@ -1803,11 +1740,6 @@ static void XGI_GetLVDSResInfo(unsigned short ModeNo, /* si+Ext_ResInfo */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; - /* if (ModeNo > 0x13) */ - /* modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; */ - /* else */ - /* modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; */ - if (ModeNo <= 0x13) /* si+St_ResInfo */ resindex = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; @@ -1815,8 +1747,6 @@ static void XGI_GetLVDSResInfo(unsigned short ModeNo, /* si+Ext_ResInfo */ resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; - /* resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); */ - if (ModeNo <= 0x13) { xres = pVBInfo->StResInfo[resindex].HTotal; yres = pVBInfo->StResInfo[resindex].VTotal; @@ -1831,13 +1761,10 @@ static void XGI_GetLVDSResInfo(unsigned short ModeNo, if (modeflag & DoubleScanMode) yres = yres << 1; } - /* if (modeflag & Charx8Dot) */ - /* { */ if (xres == 720) xres = 640; - /* } */ pVBInfo->VGAHDE = xres; pVBInfo->HDE = xres; pVBInfo->VGAVDE = yres; @@ -1890,7 +1817,7 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo, tempal = (tempal & 0x0f); } - tempcx = LCDLenList[tempbx]; /* mov cl,byte ptr cs:LCDLenList[bx] */ + tempcx = LCDLenList[tempbx]; if (pVBInfo->LCDInfo & EnableScalingLCD) { /* ScaleLCD */ if ((tempbx == 5) || (tempbx) == 7) @@ -1898,9 +1825,6 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo, else if ((tempbx == 3) || (tempbx == 8)) tempcx = LVDSDesDataLen2; } - /* mov di, word ptr cs:LCDDataList[bx] */ - /* tempdi = pVideoMemory[LCDDataList + tempbx * 2] | - (pVideoMemory[LCDDataList + tempbx * 2 + 1] << 8); */ switch (tempbx) { case 0: @@ -2321,10 +2245,10 @@ static void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo, switch (tempbx) { case 0: - tempdi = NULL; /*EPLCHTVCRT1Ptr_H;*/ + tempdi = NULL; break; case 1: - tempdi = NULL; /*EPLCHTVCRT1Ptr_V;*/ + tempdi = NULL; break; case 2: case 6: @@ -2363,9 +2287,7 @@ static void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo, } /* 07/05/22 */ - if (table == 0x00) { - } else if (table == 0x01) { - } else if (table == 0x04) { + if (table == 0x04) { switch (tempdi[i].DATAPTR) { case 0: return &XGI_ExtPALData[tempal]; @@ -2429,7 +2351,6 @@ static void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo, default: break; } - } else if (table == 0x06) { } return NULL; } @@ -2741,7 +2662,6 @@ static void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex, else tempbx = LCDPtr->LCDVRS; - /* tempbx = tempbx >> 4; */ tempcx = push1; if (pVBInfo->LCDInfo & EnableScalingLCD) @@ -2881,7 +2801,6 @@ static void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1, unsigned short index; if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { - /* index = XGI_GetLCDCapPtr(pVBInfo); */ index = XGI_GetLCDCapPtr1(pVBInfo); if (pVBInfo->VBInfo & SetCRT2ToLCD) { /* LCDB */ @@ -3105,19 +3024,6 @@ static void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension, } } -void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) -{ - /* - if ( HwDeviceExtension->jChipType >= XG20 ) { - pVBInfo->Set_VGAType = XG20; - } else { - pVBInfo->Set_VGAType = VGA_XGI340; - } - */ - pVBInfo->Set_VGAType = HwDeviceExtension->jChipType; -} - void XGI_GetVBType(struct vb_device_info *pVBInfo) { unsigned short flag, tempbx, tempah; @@ -3160,7 +3066,7 @@ void XGI_GetVBType(struct vb_device_info *pVBInfo) } } -void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, +static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) { @@ -3193,14 +3099,9 @@ void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, if (pVBInfo->IF_DEF_LCDA == 1) { - if ((pVBInfo->Set_VGAType >= XG20) - || (pVBInfo->Set_VGAType >= XG40)) { + if ((HwDeviceExtension->jChipType >= XG20) || + (HwDeviceExtension->jChipType >= XG40)) { if (pVBInfo->IF_DEF_LVDS == 0) { - /* if ((pVBInfo->VBType & VB_XGI302B) - || (pVBInfo->VBType & VB_XGI301LV) - || (pVBInfo->VBType & VB_XGI302LV) - || (pVBInfo->VBType & VB_XGI301C)) - */ if (pVBInfo->VBType & (VB_XGI302B | VB_XGI301LV | @@ -3225,7 +3126,7 @@ void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType & VB_XGI302LV) || (pVBInfo->VBType & VB_XGI301C)))) { - if (temp & SetYPbPr) { /* temp = CR38 */ + if (temp & SetYPbPr) { if (pVBInfo->IF_DEF_HiVision == 1) { /* shampoo add for new * scratch */ @@ -3242,8 +3143,6 @@ void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, SetCRT2ToYPbPr; } } - - /* tempbx |= SetCRT2ToYPbPr; */ } } } @@ -3368,7 +3267,7 @@ void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, pVBInfo->VBInfo = tempbx; } -void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, +static void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) { unsigned short temp, tempbx = 0, resinfo = 0, modeflag, index1; @@ -3404,17 +3303,6 @@ void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, tempbx &= (SetCHTVOverScan | SetNTSCJ | SetPALTV); - /* - if (pVBInfo->IF_DEF_LVDS == 0) { - //PAL-M/PAL-N Info - index1 = xgifb_reg_get(pVBInfo->P3d4, 0x38); - //00:PAL, 01:PAL-M, 10:PAL-N - temp2 = (index1 & 0xC0) >> 5; - tempbx |= temp2; - if (temp2 & 0x02) //PAL-M - tempbx &= (~SetPALTV); - } - */ } if (pVBInfo->IF_DEF_LVDS == 0) { @@ -3476,8 +3364,8 @@ void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, pVBInfo->TVInfo = tempbx; } -unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex, - struct vb_device_info *pVBInfo) +static unsigned char XGI_GetLCDInfo(unsigned short ModeNo, + unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) { unsigned short temp, tempax, tempbx, modeflag, resinfo = 0, LCDIdIndex; @@ -3553,15 +3441,8 @@ unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex, tempbx |= SetLCDtoNonExpanding; } - /* - if (tempax & LCDBToA) { - tempbx |= SetLCDBToA; - } - */ - if (pVBInfo->IF_DEF_ExpLink == 1) { if (modeflag & HalfDCLK) { - /* if (!(pVBInfo->LCDInfo&LCDNonExpanding)) */ if (!(tempbx & SetLCDtoNonExpanding)) { tempbx |= EnableLVDSDDA; } else { @@ -3604,25 +3485,6 @@ unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex, } } - /* - if (pVBInfo->IF_DEF_LVDS == 0) { - if (tempax & (LockLCDBToA | StLCDBToA)) { - if (pVBInfo->VBInfo & SetInSlaveMode) { - if (!((!(tempax & LockLCDBToA)) && - (ModeNo > 0x13))) { - pVBInfo->VBInfo &= - ~(SetSimuScanMode | - SetInSlaveMode | - SetCRT2ToLCD); - pVBInfo->VBInfo |= - SetCRT2ToLCDA | - SetCRT2ToDualEdge; - } - } - } - } - */ - return 1; } @@ -3632,10 +3494,6 @@ unsigned char XGI_SearchModeID(unsigned short ModeNo, if (ModeNo <= 5) ModeNo |= 1; if (ModeNo <= 0x13) { - /* for (*ModeIdIndex=0; - *ModeIdIndex < sizeof(pVBInfo->SModeIDTable) - / sizeof(struct XGI_StStruct); - (*ModeIdIndex)++) */ for (*ModeIdIndex = 0;; (*ModeIdIndex)++) { if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == ModeNo) @@ -3651,10 +3509,6 @@ unsigned char XGI_SearchModeID(unsigned short ModeNo, (*ModeIdIndex) += 2; /* 400 lines */ /* else 350 lines */ } else { - /* for (*ModeIdIndex=0; - *ModeIdIndex < sizeof(pVBInfo->EModeIDTable) - / sizeof(struct XGI_ExtStruct); - (*ModeIdIndex)++) */ for (*ModeIdIndex = 0;; (*ModeIdIndex)++) { if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == ModeNo) @@ -3675,7 +3529,6 @@ static unsigned char XG21GPIODataTransfer(unsigned char ujDate) for (i = 0; i < 8; i++) { ujRet = ujRet << 1; - /* ujRet |= GETBITS(ujDate >> i, 0:0); */ ujRet |= (ujDate >> i) & 1; } @@ -3726,7 +3579,101 @@ static unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo) return temp; } -void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE, +/*----------------------------------------------------------------------------*/ +/* input */ +/* bl[5] : 1;LVDS signal on */ +/* bl[1] : 1;LVDS backlight on */ +/* bl[0] : 1:LVDS VDD on */ +/* bh: 100000b : clear bit 5, to set bit5 */ +/* 000010b : clear bit 1, to set bit1 */ +/* 000001b : clear bit 0, to set bit0 */ +/*----------------------------------------------------------------------------*/ +static void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, + struct vb_device_info *pVBInfo) +{ + unsigned char CR4A, temp; + + CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A); + tempbh &= 0x23; + tempbl &= 0x23; + xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */ + + if (tempbh & 0x20) { + temp = (tempbl >> 4) & 0x02; + + /* CR B4[1] */ + xgifb_reg_and_or(pVBInfo->P3d4, 0xB4, ~0x02, temp); + + } + + temp = xgifb_reg_get(pVBInfo->P3d4, 0x48); + + temp = XG21GPIODataTransfer(temp); + temp &= ~tempbh; + temp |= tempbl; + xgifb_reg_set(pVBInfo->P3d4, 0x48, temp); +} + +static void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, + struct vb_device_info *pVBInfo) +{ + unsigned char CR4A, temp; + unsigned short tempbh0, tempbl0; + + tempbh0 = tempbh; + tempbl0 = tempbl; + tempbh0 &= 0x20; + tempbl0 &= 0x20; + tempbh0 >>= 3; + tempbl0 >>= 3; + + if (tempbh & 0x20) { + temp = (tempbl >> 4) & 0x02; + + /* CR B4[1] */ + xgifb_reg_and_or(pVBInfo->P3d4, 0xB4, ~0x02, temp); + + } + xgifb_reg_and_or(pVBInfo->P3d4, 0xB4, ~tempbh0, tempbl0); + + CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A); + tempbh &= 0x03; + tempbl &= 0x03; + tempbh <<= 2; + tempbl <<= 2; /* GPIOC,GPIOD */ + xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */ + xgifb_reg_and_or(pVBInfo->P3d4, 0x48, ~tempbh, tempbl); +} + +/* --------------------------------------------------------------------- */ +/* Function : XGI_XG21SetPanelDelay */ +/* Input : */ +/* Output : */ +/* Description : */ +/* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */ +/* : bl : 2 ; T2 : the duration signal on and Vdd on */ +/* : bl : 3 ; T3 : the duration between CPL off and signal off */ +/* : bl : 4 ; T4 : the duration signal off and Vdd off */ +/* --------------------------------------------------------------------- */ +static void XGI_XG21SetPanelDelay(struct xgifb_video_info *xgifb_info, + unsigned short tempbl, + struct vb_device_info *pVBInfo) +{ + if (tempbl == 1) + mdelay(xgifb_info->lvds_data.PSC_S1); + + if (tempbl == 2) + mdelay(xgifb_info->lvds_data.PSC_S2); + + if (tempbl == 3) + mdelay(xgifb_info->lvds_data.PSC_S3); + + if (tempbl == 4) + mdelay(xgifb_info->lvds_data.PSC_S4); +} + +static void XGI_DisplayOn(struct xgifb_video_info *xgifb_info, + struct xgi_hw_device_info *pXGIHWDE, struct vb_device_info *pVBInfo) { @@ -3736,12 +3683,12 @@ void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE, if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x1)) { /* LVDS VDD on */ XGI_XG21BLSignalVDD(0x01, 0x01, pVBInfo); - XGI_XG21SetPanelDelay(2, pVBInfo); + XGI_XG21SetPanelDelay(xgifb_info, 2, pVBInfo); } if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x20)) /* LVDS signal on */ XGI_XG21BLSignalVDD(0x20, 0x20, pVBInfo); - XGI_XG21SetPanelDelay(3, pVBInfo); + XGI_XG21SetPanelDelay(xgifb_info, 3, pVBInfo); /* LVDS backlight on */ XGI_XG21BLSignalVDD(0x02, 0x02, pVBInfo); } else { @@ -3756,12 +3703,12 @@ void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE, if (!(XGI_XG27GetPSCValue(pVBInfo) & 0x1)) { /* LVDS VDD on */ XGI_XG27BLSignalVDD(0x01, 0x01, pVBInfo); - XGI_XG21SetPanelDelay(2, pVBInfo); + XGI_XG21SetPanelDelay(xgifb_info, 2, pVBInfo); } if (!(XGI_XG27GetPSCValue(pVBInfo) & 0x20)) /* LVDS signal on */ XGI_XG27BLSignalVDD(0x20, 0x20, pVBInfo); - XGI_XG21SetPanelDelay(3, pVBInfo); + XGI_XG21SetPanelDelay(xgifb_info, 3, pVBInfo); /* LVDS backlight on */ XGI_XG27BLSignalVDD(0x02, 0x02, pVBInfo); } else { @@ -3772,7 +3719,8 @@ void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE, } } -void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE, +void XGI_DisplayOff(struct xgifb_video_info *xgifb_info, + struct xgi_hw_device_info *pXGIHWDE, struct vb_device_info *pVBInfo) { @@ -3780,7 +3728,7 @@ void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE, if (pVBInfo->IF_DEF_LVDS == 1) { /* LVDS backlight off */ XGI_XG21BLSignalVDD(0x02, 0x00, pVBInfo); - XGI_XG21SetPanelDelay(3, pVBInfo); + XGI_XG21SetPanelDelay(xgifb_info, 3, pVBInfo); } else { /* DVO/DVI signal off */ XGI_XG21BLSignalVDD(0x20, 0x00, pVBInfo); @@ -3791,7 +3739,7 @@ void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE, if ((XGI_XG27GetPSCValue(pVBInfo) & 0x2)) { /* LVDS backlight off */ XGI_XG27BLSignalVDD(0x02, 0x00, pVBInfo); - XGI_XG21SetPanelDelay(3, pVBInfo); + XGI_XG21SetPanelDelay(xgifb_info, 3, pVBInfo); } if (pVBInfo->IF_DEF_LVDS == 0) @@ -3838,26 +3786,17 @@ static void XGI_GetCRT2ResInfo(unsigned short ModeNo, if (ModeNo <= 0x13) { xres = pVBInfo->StResInfo[resindex].HTotal; yres = pVBInfo->StResInfo[resindex].VTotal; - /* si+St_ResInfo */ - /* modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;*/ } else { xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */ yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */ /* si+St_ModeFlag */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; - /* - if (pVBInfo->IF_DEF_FSTN) { - xres *= 2; - yres *= 2; - } else { - */ if (modeflag & HalfDCLK) xres *= 2; if (modeflag & DoubleScanMode) yres *= 2; - /* } */ } if (pVBInfo->VBInfo & SetCRT2ToLCD) { @@ -4028,8 +3967,6 @@ static void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex, tempbx = 775; else if (pVBInfo->VGAVDE == 600) tempbx = 775; - /* else if (pVBInfo->VGAVDE==350) tempbx=560; */ - /* else if (pVBInfo->VGAVDE==400) tempbx=640; */ else tempbx = 768; } else @@ -4294,7 +4231,6 @@ static void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, XGI_SetCRT2Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex, HwDeviceExtension, pVBInfo); XGI_SetCRT2FIFO(pVBInfo); - /* XGI_SetCRT2Sync(ModeNo,RefreshRateTableIndex); */ for (tempcx = 4; tempcx < 7; tempcx++) xgifb_reg_set(pVBInfo->Part1Port, tempcx, 0x0); @@ -4497,9 +4433,6 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, temp = 0xFF; /* set MAX HT */ xgifb_reg_set(pVBInfo->Part1Port, 0x03, temp); - /* if (modeflag & Charx8Dot) */ - /* tempcx = 0x08; */ - /* else */ tempcx = 0x08; if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) @@ -4565,7 +4498,6 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, } } } else { - /* tempcx = tempbx & 0x00FF ; */ tempbx = (tempbx & 0xFF00) >> 8; tempcx = (tempcx + tempbx) >> 1; temp = (tempcx & 0x00FF) + 2; @@ -4579,36 +4511,23 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, temp -= 6; } } - } else { - if (!(modeflag & HalfDCLK)) { - temp -= 4; - if (pVBInfo->LCDResInfo != Panel1280x960) { - if (pVBInfo->VGAHDE >= 800) { - temp -= 7; - if (pVBInfo->ModeType == - ModeEGA) { - if (pVBInfo->VGAVDE == - 1024) { - temp += 15; - if (pVBInfo->LCDResInfo != Panel1280x1024) { - temp += - 7; - } - } - } - - if (pVBInfo->VGAHDE >= 1280) { - if (pVBInfo->LCDResInfo - != Panel1280x960) { - if (pVBInfo->LCDInfo - & LCDNonExpanding) { - temp - += 28; - } - } - } - } + } else if (!(modeflag & HalfDCLK)) { + temp -= 4; + if (pVBInfo->LCDResInfo != Panel1280x960 && + pVBInfo->VGAHDE >= 800) { + temp -= 7; + if (pVBInfo->ModeType == ModeEGA && + pVBInfo->VGAVDE == 1024) { + temp += 15; + if (pVBInfo->LCDResInfo != + Panel1280x1024) + temp += 7; } + + if (pVBInfo->VGAHDE >= 1280 && + pVBInfo->LCDResInfo != Panel1280x960 && + (pVBInfo->LCDInfo & LCDNonExpanding)) + temp += 28; } } } @@ -5297,7 +5216,6 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, tempax--; xgifb_reg_and(pVBInfo->Part2Port, 0x01, tempax); - /* if ( !( pVBInfo->VBType & VB_XGI301C ) ) */ xgifb_reg_and(pVBInfo->Part2Port, 0x00, 0xEF); } @@ -5436,7 +5354,6 @@ static void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex, tempax = pVBInfo->VT; tempbx = pVBInfo->LCDVRS; - /* if (SetLCD_Info & EnableScalingLCD) */ tempcx += tempbx; if (tempcx >= tempax) tempcx -= tempax; @@ -5478,12 +5395,10 @@ static void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex, temp = (tempcx & 0xFF00) >> 8; xgifb_reg_set(pVBInfo->Part2Port, 0x25, temp); - /* getlcdsync() */ XGI_GetLCDSync(&tempax, &tempbx, pVBInfo); tempcx = tempax; tempax = pVBInfo->HT; tempbx = pVBInfo->LCDHRS; - /* if ( SetLCD_Info & EnableScalingLCD) */ if (XGI_IsLCDDualLink(pVBInfo)) { tempax = tempax >> 1; tempbx = tempbx >> 1; @@ -5801,9 +5716,6 @@ static void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex, if (XGI_IsLCDDualLink(pVBInfo)) tempax = tempax >> 1; - /* if((pVBInfo->VBInfo&(SetCRT2ToLCD)) || - ((pVBInfo->TVInfo&SetYPbPrMode525p) || - (pVBInfo->TVInfo&SetYPbPrMode750p))) { */ if (pVBInfo->VBInfo & SetCRT2ToLCD) { if (tempax > 800) tempax -= 800; @@ -5817,33 +5729,6 @@ static void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex, } tempax -= 1; - /* - if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToHiVisionTV)) { - if (pVBInfo->VBType & VB_XGI301LV) { - if (!(pVBInfo->TVInfo & - (SetYPbPrMode525p | - SetYPbPrMode750p | - SetYPbPrMode1080i))) { - if (pVBInfo->VGAHDE > 800) { - if (pVBInfo->VGAHDE == 1024) - tempax =(tempax * 25 / - 32) - 1; - else - tempax = (tempax * 20 / - 32) - 1; - } - } - } else { - if (pVBInfo->VGAHDE > 800) { - if (pVBInfo->VGAHDE == 1024) - tempax = (tempax * 25 / 32) - 1; - else - tempax = (tempax * 20 / 32) - 1; - } - } - } - */ - temp = (tempax & 0xFF00) >> 8; temp = ((temp & 0x0003) << 4); xgifb_reg_set(pVBInfo->Part4Port, 0x1E, temp); @@ -5902,7 +5787,6 @@ static void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex, if (!(pVBInfo->VBInfo & (SetInSlaveMode | LoadDACFlag | CRT2DisplayFlag))) { XGINew_EnableCRT2(pVBInfo); - /* LoadDAC2(pVBInfo->Part5Port, ModeNo, ModeIdIndex); */ } } return; @@ -5921,118 +5805,11 @@ static void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_and_or(pVBInfo->P3d4, 0x63, 0xBF, 0x00); } -/*----------------------------------------------------------------------------*/ -/* input */ -/* bl[5] : 1;LVDS signal on */ -/* bl[1] : 1;LVDS backlight on */ -/* bl[0] : 1:LVDS VDD on */ -/* bh: 100000b : clear bit 5, to set bit5 */ -/* 000010b : clear bit 1, to set bit1 */ -/* 000001b : clear bit 0, to set bit0 */ -/*----------------------------------------------------------------------------*/ -void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, - struct vb_device_info *pVBInfo) -{ - unsigned char CR4A, temp; - - CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A); - tempbh &= 0x23; - tempbl &= 0x23; - xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */ - - if (tempbh & 0x20) { - temp = (tempbl >> 4) & 0x02; - - /* CR B4[1] */ - xgifb_reg_and_or(pVBInfo->P3d4, 0xB4, ~0x02, temp); - - } - - temp = xgifb_reg_get(pVBInfo->P3d4, 0x48); - - temp = XG21GPIODataTransfer(temp); - temp &= ~tempbh; - temp |= tempbl; - xgifb_reg_set(pVBInfo->P3d4, 0x48, temp); -} - -void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, - struct vb_device_info *pVBInfo) -{ - unsigned char CR4A, temp; - unsigned short tempbh0, tempbl0; - - tempbh0 = tempbh; - tempbl0 = tempbl; - tempbh0 &= 0x20; - tempbl0 &= 0x20; - tempbh0 >>= 3; - tempbl0 >>= 3; - - if (tempbh & 0x20) { - temp = (tempbl >> 4) & 0x02; - - /* CR B4[1] */ - xgifb_reg_and_or(pVBInfo->P3d4, 0xB4, ~0x02, temp); - - } - xgifb_reg_and_or(pVBInfo->P3d4, 0xB4, ~tempbh0, tempbl0); - - CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A); - tempbh &= 0x03; - tempbl &= 0x03; - tempbh <<= 2; - tempbl <<= 2; /* GPIOC,GPIOD */ - xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */ - xgifb_reg_and_or(pVBInfo->P3d4, 0x48, ~tempbh, tempbl); -} - -/* --------------------------------------------------------------------- */ -unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo) -{ - unsigned short index; - - index = xgifb_reg_get(pVBInfo->P3d4, 0x36); - if (index < sizeof(XGI21_LCDCapList) - / sizeof(struct XGI21_LVDSCapStruct)) - return index; - return 0; -} - -/* --------------------------------------------------------------------- */ -/* Function : XGI_XG21SetPanelDelay */ -/* Input : */ -/* Output : */ -/* Description : */ -/* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */ -/* : bl : 2 ; T2 : the duration signal on and Vdd on */ -/* : bl : 3 ; T3 : the duration between CPL off and signal off */ -/* : bl : 4 ; T4 : the duration signal off and Vdd off */ -/* --------------------------------------------------------------------- */ -void XGI_XG21SetPanelDelay(unsigned short tempbl, +static unsigned char XGI_XG21CheckLVDSMode(struct xgifb_video_info *xgifb_info, + unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) { - unsigned short index; - - index = XGI_GetLVDSOEMTableIndex(pVBInfo); - if (tempbl == 1) - mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S1); - - if (tempbl == 2) - mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S2); - - if (tempbl == 3) - mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S3); - - if (tempbl == 4) - mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S4); -} - -unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, - unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) -{ - unsigned short xres, yres, colordepth, modeflag, resindex, - lvdstableindex; + unsigned short xres, yres, colordepth, modeflag, resindex; resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); if (ModeNo <= 0x13) { @@ -6061,18 +5838,15 @@ unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, } - lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo); - if (xres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE)) + if (xres > xgifb_info->lvds_data.LVDSHDE) return 0; - if (yres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE)) + if (yres > xgifb_info->lvds_data.LVDSVDE) return 0; if (ModeNo > 0x13) { - if ((xres != (pVBInfo->XG21_LVDSCapList[lvdstableindex]. - LVDSHDE)) || - (yres != (pVBInfo->XG21_LVDSCapList[lvdstableindex]. - LVDSVDE))) { + if (xres != xgifb_info->lvds_data.LVDSHDE || + yres != xgifb_info->lvds_data.LVDSVDE) { colordepth = XGI_GetColorDepth(ModeNo, ModeIdIndex, pVBInfo); @@ -6084,55 +5858,26 @@ unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, return 1; } -void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo) -{ - unsigned char temp; - - temp = xgifb_reg_get(pVBInfo->P3d4, 0x37); /* D[0] 1: 18bit */ - temp = (temp & 1) << 6; - /* SR06[6] 18bit Dither */ - xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0x40, temp); - /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: dual 12bits */ - xgifb_reg_and_or(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); - -} - -void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo) -{ - unsigned char temp; - - /* D[1:0] 01: 18bit, 00: dual 12, 10: single 24 */ - temp = xgifb_reg_get(pVBInfo->P3d4, 0x37); - temp = (temp & 3) << 6; - /* SR06[7]0: dual 12/1: single 24 [6] 18bit Dither <= 0 h/w recommend */ - xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0xc0, temp & 0x80); - /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: 24bits */ - xgifb_reg_and_or(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); - -} - -static void xgifb_set_lvds(int chip_id, +static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info, + int chip_id, unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) { unsigned char temp, Miscdata; - unsigned short xres, yres, modeflag, resindex, lvdstableindex; + unsigned short xres, yres, modeflag, resindex; unsigned short LVDSHT, LVDSHBS, LVDSHRS, LVDSHRE, LVDSHBE; unsigned short LVDSVT, LVDSVBS, LVDSVRS, LVDSVRE, LVDSVBE; unsigned short value; - lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo); - temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex]. - LVDS_Capability & + temp = (unsigned char) ((xgifb_info->lvds_data.LVDS_Capability & (LCDPolarity << 8)) >> 8); temp &= LCDPolarity; Miscdata = (unsigned char) inb(pVBInfo->P3cc); outb((Miscdata & 0x3F) | temp, pVBInfo->P3c2); - temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex]. - LVDS_Capability & LCDPolarity); + temp = xgifb_info->lvds_data.LVDS_Capability & LCDPolarity; /* SR35[7] FP VSync polarity */ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80); /* SR30[5] FP HSync polarity */ @@ -6159,48 +5904,43 @@ static void xgifb_set_lvds(int chip_id, if (!(modeflag & Charx8Dot)) xres = xres * 8 / 9; - LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT; + LVDSHT = xgifb_info->lvds_data.LVDSHT; - LVDSHBS = xres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE - - xres) / 2; + LVDSHBS = xres + (xgifb_info->lvds_data.LVDSHDE - xres) / 2; if ((ModeNo <= 0x13) && (modeflag & HalfDCLK)) LVDSHBS -= xres / 4; if (LVDSHBS > LVDSHT) LVDSHBS -= LVDSHT; - LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP; + LVDSHRS = LVDSHBS + xgifb_info->lvds_data.LVDSHFP; if (LVDSHRS > LVDSHT) LVDSHRS -= LVDSHT; - LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC; + LVDSHRE = LVDSHRS + xgifb_info->lvds_data.LVDSHSYNC; if (LVDSHRE > LVDSHT) LVDSHRE -= LVDSHT; - LVDSHBE = LVDSHBS + LVDSHT - - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE; + LVDSHBE = LVDSHBS + LVDSHT - xgifb_info->lvds_data.LVDSHDE; - LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT; + LVDSVT = xgifb_info->lvds_data.LVDSVT; - LVDSVBS = yres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE - - yres) / 2; + LVDSVBS = yres + (xgifb_info->lvds_data.LVDSVDE - yres) / 2; if ((ModeNo > 0x13) && (modeflag & DoubleScanMode)) LVDSVBS += yres / 2; if (LVDSVBS > LVDSVT) LVDSVBS -= LVDSVT; - LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP; + LVDSVRS = LVDSVBS + xgifb_info->lvds_data.LVDSVFP; if (LVDSVRS > LVDSVT) LVDSVRS -= LVDSVT; - LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex]. - LVDSVSYNC; + LVDSVRE = LVDSVRS + xgifb_info->lvds_data.LVDSVSYNC; if (LVDSVRE > LVDSVT) LVDSVRE -= LVDSVT; - LVDSVBE = LVDSVBS + LVDSVT - - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE; + LVDSVBE = LVDSVBS + LVDSVT - xgifb_info->lvds_data.LVDSVDE; temp = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11); xgifb_reg_set(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */ @@ -6300,13 +6040,9 @@ static void xgifb_set_lvds(int chip_id, xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, value); xgifb_reg_set(pVBInfo->P3c4, - 0x2B, - pVBInfo->XG21_LVDSCapList[lvdstableindex]. - VCLKData1); + 0x2B, xgifb_info->lvds_data.VCLKData1); xgifb_reg_set(pVBInfo->P3c4, - 0x2C, - pVBInfo->XG21_LVDSCapList[lvdstableindex]. - VCLKData2); + 0x2C, xgifb_info->lvds_data.VCLKData2); value += 0x10; } @@ -6398,7 +6134,8 @@ static unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo) return 0; } -void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, +static void XGI_DisableBridge(struct xgifb_video_info *xgifb_info, + struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) { unsigned short tempah = 0; @@ -6442,7 +6179,7 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, | SetSimuScanMode))) { if (pVBInfo->SetFlag & GatingCRT) XGI_EnableGatingCRT(HwDeviceExtension, pVBInfo); - XGI_DisplayOff(HwDeviceExtension, pVBInfo); + XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo); } if (pVBInfo->VBInfo & SetCRT2ToLCDA) { @@ -6464,7 +6201,6 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, ((!(pVBInfo->VBInfo & SetCRT2ToLCDA)) && (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV)))) - /* BScreenOff=1 */ xgifb_reg_or(pVBInfo->Part1Port, 0x00, 0x80); if ((pVBInfo->SetFlag & DisableChB) || @@ -6484,7 +6220,6 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, } } else { /* {301} */ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { - /* BScreenOff=1 */ xgifb_reg_or(pVBInfo->Part1Port, 0x00, 0x80); /* Disable CRT2 */ xgifb_reg_and(pVBInfo->Part1Port, 0x1E, 0xDF); @@ -6494,7 +6229,7 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, if (pVBInfo->VBInfo & (DisableCRT2Display | SetCRT2ToLCDA | SetSimuScanMode)) - XGI_DisplayOff(HwDeviceExtension, pVBInfo); + XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo); } } @@ -6610,17 +6345,6 @@ static void XGI_SetDelayComp(struct vb_device_info *pVBInfo) if (pVBInfo->VBInfo & SetCRT2ToDualEdge) tempbl = tempbl >> 4; - /* - if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) - tempbl = CRT2Delay1; // Get CRT2 Delay - if (pVBInfo->VBType & - (VB_XGI301B | - VB_XGI302B | - VB_XGI301LV | - VB_XGI302LV | - VB_XGI301C)) - tempbl = CRT2Delay2; - */ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /* Get LCD Delay */ index = XGI_GetLCDCapPtr(pVBInfo); @@ -6680,23 +6404,6 @@ static void XGI_SetLCDCap_A(unsigned short tempcx, (unsigned short) (0x30 | (tempcx & 0x00C0))); xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00); } - - /* - if (tempcx & EnableLCD24bpp) { // 24bits - xgifb_reg_and_or(pVBInfo->Part1Port, - 0x19, - 0x0F, - (unsigned short)(0x30 | (tempcx&0x00C0))); - xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00); - } else { - xgifb_reg_and_or(pVBInfo->Part1Port, - 0x19, - 0x0F, - // Enable Dither - (unsigned short)(0x20 | (tempcx&0x00C0))); - xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80); - } - */ } /* --------------------------------------------------------------------- */ @@ -6718,6 +6425,25 @@ static void XGI_SetLCDCap_B(unsigned short tempcx, | 0x18)); /* Enable Dither */ } +static void XGI_LongWait(struct vb_device_info *pVBInfo) +{ + unsigned short i; + + i = xgifb_reg_get(pVBInfo->P3c4, 0x1F); + + if (!(i & 0xC0)) { + for (i = 0; i < 0xFFFF; i++) { + if (!(inb(pVBInfo->P3da) & 0x08)) + break; + } + + for (i = 0; i < 0xFFFF; i++) { + if ((inb(pVBInfo->P3da) & 0x08)) + break; + } + } +} + static void SetSpectrum(struct vb_device_info *pVBInfo) { unsigned short index; @@ -6940,14 +6666,12 @@ static void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) { - /* GetPart1IO(); */ XGI_SetDelayComp(pVBInfo); if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) XGI_SetLCDCap(pVBInfo); if (pVBInfo->VBInfo & SetCRT2ToTV) { - /* GetPart2IO() */ XGI_SetPhaseIncr(pVBInfo); XGI_SetYFilter(ModeNo, ModeIdIndex, pVBInfo); XGI_SetAntiFlicker(ModeNo, ModeIdIndex, pVBInfo); @@ -6963,7 +6687,7 @@ static void XGI_OEM310Setting(unsigned short ModeNo, /* Output : */ /* Description : Origin code for crt2group */ /* --------------------------------------------------------------------- */ -void XGI_SetCRT2ModeRegs(unsigned short ModeNo, +static void XGI_SetCRT2ModeRegs(unsigned short ModeNo, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) { @@ -6972,8 +6696,6 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo, unsigned char tempah; - /* // fix write part1 index 0 BTDRAM bit Bug - * xgifb_reg_set(pVBInfo->Part1Port, 0x03, 0x00); */ tempah = 0; if (!(pVBInfo->VBInfo & DisableCRT2Display)) { tempah = xgifb_reg_get(pVBInfo->Part1Port, 0x00); @@ -6999,32 +6721,6 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo, } } - /* 0210 shampoo - if (pVBInfo->VBInfo & DisableCRT2Display) { - tempah = 0; - } - - xgifb_reg_set(pVBInfo->Part1Port, 0x00, tempah); - if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD)) { - tempcl = pVBInfo->ModeType; - if (ModeNo > 0x13) { - tempcl -= ModeVGA; - if ((tempcl > 0) || (tempcl == 0)) { - tempah=(0x008>>tempcl) ; - if (tempah == 0) - tempah = 1; - tempah |= 0x040; - } - } else { - tempah = 0x040; - } - - if (pVBInfo->VBInfo & SetInSlaveMode) { - tempah = (tempah ^ 0x050); - } - } - */ - xgifb_reg_set(pVBInfo->Part1Port, 0x00, tempah); tempah = 0x08; tempbl = 0xf0; @@ -7093,14 +6789,11 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo, tempah |= 0x080; if (pVBInfo->VBInfo & SetCRT2ToTV) { - /* if (!(pVBInfo->TVInfo & - (SetYPbPrMode525p | SetYPbPrMode750p))) { */ tempah |= 0x020; if (ModeNo > 0x13) { if (pVBInfo->VBInfo & DriverMode) tempah = tempah ^ 0x20; } - /* } */ } xgifb_reg_and_or(pVBInfo->Part4Port, 0x0D, ~0x0BF, tempah); @@ -7110,12 +6803,8 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo, tempah |= 0x40; if (pVBInfo->VBInfo & SetCRT2ToTV) { - /* if ((!(pVBInfo->VBInfo & SetCRT2ToHiVisionTV)) && - (!(pVBInfo->TVInfo & - (SetYPbPrMode525p | SetYPbPrMode750p)))) { */ if (pVBInfo->TVInfo & RPLLDIV2XO) tempah |= 0x40; - /* } */ } if ((pVBInfo->LCDResInfo == Panel1280x1024) @@ -7219,57 +6908,6 @@ unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo) } } -void XGI_LongWait(struct vb_device_info *pVBInfo) -{ - unsigned short i; - - i = xgifb_reg_get(pVBInfo->P3c4, 0x1F); - - if (!(i & 0xC0)) { - for (i = 0; i < 0xFFFF; i++) { - if (!(inb(pVBInfo->P3da) & 0x08)) - break; - } - - for (i = 0; i < 0xFFFF; i++) { - if ((inb(pVBInfo->P3da) & 0x08)) - break; - } - } -} - -static void XGI_VBLongWait(struct vb_device_info *pVBInfo) -{ - unsigned short tempal, temp, i, j; - return; - if (!(pVBInfo->VBInfo & SetCRT2ToTV)) { - temp = 0; - for (i = 0; i < 3; i++) { - for (j = 0; j < 100; j++) { - tempal = inb(pVBInfo->P3da); - if (temp & 0x01) { /* VBWaitMode2 */ - if ((tempal & 0x08)) - continue; - - if (!(tempal & 0x08)) - break; - - } else { /* VBWaitMode1 */ - if (!(tempal & 0x08)) - continue; - - if ((tempal & 0x08)) - break; - } - } - temp = temp ^ 0x01; - } - } else { - XGI_LongWait(pVBInfo); - } - return; -} - unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) @@ -7322,12 +6960,6 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, RefreshRateTableIndex = pVBInfo->EModeIDTable[ModeIdIndex].REFindex; ModeNo = pVBInfo->RefIndex[RefreshRateTableIndex].ModeID; if (pXGIHWDE->jChipType >= XG20) { /* for XG20, XG21, XG27 */ - /* - if (pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag & - XG2xNotSupport) { - index++; - } - */ if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 800) && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes == 600)) { index++; @@ -7371,7 +7003,7 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, temp = XGI_AjustCRT2Rate(ModeNo, ModeIdIndex, RefreshRateTableIndex, &i, pVBInfo); } - return RefreshRateTableIndex + i; /* return (0x01 | (temp1<<1)); */ + return RefreshRateTableIndex + i; } static void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex, @@ -7379,9 +7011,6 @@ static void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) { unsigned short RefreshRateTableIndex; - /* unsigned short temp ; */ - - /* pVBInfo->SelectCRT2Rate = 0; */ pVBInfo->SetFlag |= ProgrammingCRT2; RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, @@ -7394,7 +7023,7 @@ static void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex, XGI_SetCRT2ECLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); } -unsigned char XGI_SetCRT2Group301(unsigned short ModeNo, +static unsigned char XGI_SetCRT2Group301(unsigned short ModeNo, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) { @@ -7499,10 +7128,6 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo) outb((unsigned char) DAC_TEST_PARMS[2], (pVBInfo->P3c8 + 1)); } - XGI_VBLongWait(pVBInfo); - XGI_VBLongWait(pVBInfo); - XGI_VBLongWait(pVBInfo); - mdelay(1); XGI_WaitDisply(pVBInfo); @@ -7532,7 +7157,8 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo) xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F); } -void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, +static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info, + struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) { unsigned short tempah; @@ -7544,7 +7170,6 @@ void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, /* Power on */ xgifb_reg_set(pVBInfo->Part1Port, 0x1E, 0x20); } else { - /* SetCRT2ToLCDA ) */ if (pVBInfo->VBInfo & SetCRT2ToDualEdge) { /* Power on */ xgifb_reg_set(pVBInfo->Part1Port, @@ -7572,10 +7197,8 @@ void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, pVBInfo->Part1Port, 0x2E); if (!(tempah & 0x80)) - /* BVBDOENABLE = 1 */ xgifb_reg_or(pVBInfo->Part1Port, 0x2E, 0x80); - /* BScreenOFF = 0 */ xgifb_reg_and(pVBInfo->Part1Port, 0x00, 0x7F); } } @@ -7638,12 +7261,11 @@ void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_or(pVBInfo->Part4Port, 0x1F, tempah); if (!(pVBInfo->SetFlag & DisableChA)) { - XGI_VBLongWait(pVBInfo); if (!(pVBInfo->SetFlag & GatingCRT)) { XGI_DisableGatingCRT(HwDeviceExtension, pVBInfo); - XGI_DisplayOn(HwDeviceExtension, pVBInfo); - XGI_VBLongWait(pVBInfo); + XGI_DisplayOn(xgifb_info, HwDeviceExtension, + pVBInfo); } } } /* 301 */ @@ -7656,15 +7278,15 @@ void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, tempah = (unsigned char) xgifb_reg_get(pVBInfo->Part1Port, 0x2E); if (!(tempah & 0x80)) - /* BVBDOENABLE = 1 */ xgifb_reg_or(pVBInfo->Part1Port, 0x2E, 0x80); xgifb_reg_and(pVBInfo->Part1Port, 0x00, 0x7F); - XGI_DisplayOn(HwDeviceExtension, pVBInfo); + XGI_DisplayOn(xgifb_info, HwDeviceExtension, pVBInfo); } /* End of VB */ } -static void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, +static void XGI_SetCRT1Group(struct xgifb_video_info *xgifb_info, + struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) { @@ -7672,18 +7294,14 @@ static void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, unsigned short XGINew_P3cc = pVBInfo->P3cc; - /* XGINew_CRT1Mode = ModeNo; // SaveModeID */ StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo); - /* XGI_SetBIOSData(ModeNo, ModeIdIndex); */ - /* XGI_ClearBankRegs(ModeNo, ModeIdIndex); */ XGI_SetSeqRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo); - XGI_SetMiscRegs(StandTableIndex, pVBInfo); + outb(pVBInfo->StandTable[StandTableIndex].MISC, pVBInfo->P3c2); XGI_SetCRTCRegs(HwDeviceExtension, StandTableIndex, pVBInfo); XGI_SetATTRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo); XGI_SetGRCRegs(StandTableIndex, pVBInfo); XGI_ClearExt1Regs(pVBInfo); - /* if (pVBInfo->IF_DEF_ExpLink) */ if (HwDeviceExtension->jChipType == XG27) { if (pVBInfo->IF_DEF_LVDS == 0) XGI_SetDefaultVCLK(pVBInfo); @@ -7735,11 +7353,6 @@ static void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, temp = xgifb_reg_get(pVBInfo->P3d4, 0x38); if (temp & 0xA0) { - /* Enable write GPIOF */ - /* xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~0x20); */ - /* P. DWN */ - /* xgifb_reg_and(pVBInfo->P3d4, 0x48, ~0x20); */ - /* XG21 CRT1 Timing */ if (HwDeviceExtension->jChipType == XG27) XGI_SetXG27CRTC(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); @@ -7754,10 +7367,9 @@ static void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, pVBInfo, RefreshRateTableIndex, ModeNo); if (pVBInfo->IF_DEF_LVDS == 1) - xgifb_set_lvds(HwDeviceExtension->jChipType, + xgifb_set_lvds(xgifb_info, + HwDeviceExtension->jChipType, ModeNo, ModeIdIndex, pVBInfo); - /* P. ON */ - /* xgifb_reg_or(pVBInfo->P3d4, 0x48, 0x20); */ } } @@ -7765,22 +7377,16 @@ static void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, XGI_SetCRT1FIFO(ModeNo, HwDeviceExtension, pVBInfo); XGI_SetCRT1ModeRegs(HwDeviceExtension, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); - - /* XGI_LoadCharacter(); //dif ifdef TVFont */ - XGI_LoadDAC(ModeNo, ModeIdIndex, pVBInfo); - /* XGI_ClearBuffer(HwDeviceExtension, ModeNo, pVBInfo); */ } -unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, +unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, + struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo) { unsigned short ModeIdIndex; - /* unsigned char *pVBInfo->FBAddr = - HwDeviceExtension->pjVideoMemoryAddress; */ struct vb_device_info VBINF; struct vb_device_info *pVBInfo = &VBINF; - pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase; pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress; pVBInfo->IF_DEF_LVDS = 0; pVBInfo->IF_DEF_LCDA = 1; @@ -7831,14 +7437,8 @@ unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, XGI_GetVBType(pVBInfo); InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo); - if (ModeNo & 0x80) { + if (ModeNo & 0x80) ModeNo = ModeNo & 0x7F; - /* XGINew_flag_clearbuffer = 0; */ - } - /* else { - XGINew_flag_clearbuffer = 1; - } - */ xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86); if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 1.Openkey */ @@ -7846,16 +7446,14 @@ unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo); - XGI_GetVGAType(HwDeviceExtension, pVBInfo); - if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ XGI_GetVBInfo(ModeNo, ModeIdIndex, HwDeviceExtension, pVBInfo); XGI_GetTVInfo(ModeNo, ModeIdIndex, pVBInfo); XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo); - XGI_DisableBridge(HwDeviceExtension, pVBInfo); + XGI_DisableBridge(xgifb_info, HwDeviceExtension, pVBInfo); if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) { - XGI_SetCRT1Group(HwDeviceExtension, ModeNo, + XGI_SetCRT1Group(xgifb_info, HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo); if (pVBInfo->VBInfo & SetCRT2ToLCDA) { @@ -7864,7 +7462,8 @@ unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, } } else { if (!(pVBInfo->VBInfo & SwitchToCRT2)) { - XGI_SetCRT1Group(HwDeviceExtension, ModeNo, + XGI_SetCRT1Group(xgifb_info, + HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo); if (pVBInfo->VBInfo & SetCRT2ToLCDA) { XGI_SetLCDAGroup(ModeNo, ModeIdIndex, @@ -7894,11 +7493,11 @@ unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, XGI_SetCRT2ModeRegs(ModeNo, HwDeviceExtension, pVBInfo); XGI_OEM310Setting(ModeNo, ModeIdIndex, pVBInfo); /*0212*/ XGI_CloseCRTC(HwDeviceExtension, pVBInfo); - XGI_EnableBridge(HwDeviceExtension, pVBInfo); + XGI_EnableBridge(xgifb_info, HwDeviceExtension, pVBInfo); } /* !XG20 */ else { if (pVBInfo->IF_DEF_LVDS == 1) - if (!XGI_XG21CheckLVDSMode(ModeNo, + if (!XGI_XG21CheckLVDSMode(xgifb_info, ModeNo, ModeIdIndex, pVBInfo)) return 0; @@ -7914,39 +7513,13 @@ unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, pVBInfo->SetFlag = 0; pVBInfo->VBInfo = DisableCRT2Display; - XGI_DisplayOff(HwDeviceExtension, pVBInfo); + XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo); - XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex, - pVBInfo); + XGI_SetCRT1Group(xgifb_info, HwDeviceExtension, ModeNo, + ModeIdIndex, pVBInfo); - XGI_DisplayOn(HwDeviceExtension, pVBInfo); - /* - if (HwDeviceExtension->jChipType == XG21) - xgifb_reg_and_or(pVBInfo->P3c4, 0x09, ~0x80, 0x80); - */ - } - - /* - if (ModeNo <= 0x13) { - modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; - } else { - modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; + XGI_DisplayOn(xgifb_info, HwDeviceExtension, pVBInfo); } - pVBInfo->ModeType = modeflag&ModeInfoFlag; - pVBInfo->SetFlag = 0x00; - pVBInfo->VBInfo = DisableCRT2Display; - temp = XGINew_CheckMemorySize(HwDeviceExtension, - ModeNo, - ModeIdIndex, - pVBInfo); - - if (temp == 0) - return (0); - - XGI_DisplayOff(HwDeviceExtension, pVBInfo) ; - XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo); - XGI_DisplayOn(HwDeviceExtension, pVBInfo); - */ XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo); diff --git a/drivers/staging/xgifb/vb_setmode.h b/drivers/staging/xgifb/vb_setmode.h index 1bd8667..5524828 100644 --- a/drivers/staging/xgifb/vb_setmode.h +++ b/drivers/staging/xgifb/vb_setmode.h @@ -6,66 +6,22 @@ extern void XGI_UnLockCRT2(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *); extern void XGI_LockCRT2(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *); -extern void XGI_LongWait(struct vb_device_info *); -extern void XGI_SetCRT2ModeRegs(unsigned short ModeNo, - struct xgi_hw_device_info *, - struct vb_device_info *); -extern void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *); -extern void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *); -extern void XGI_DisplayOff(struct xgi_hw_device_info *, +extern void XGI_DisplayOff(struct xgifb_video_info *, + struct xgi_hw_device_info *, struct vb_device_info *); -extern void XGI_DisplayOn(struct xgi_hw_device_info *, - struct vb_device_info *); extern void XGI_GetVBType(struct vb_device_info *); extern void XGI_SenseCRT1(struct vb_device_info *); -extern void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *); -extern void XGI_GetVBInfo(unsigned short ModeNo, - unsigned short ModeIdIndex, - struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *); -extern void XGI_GetTVInfo(unsigned short ModeNo, - unsigned short ModeIdIndex, - struct vb_device_info *); -extern unsigned short XGI_GetResInfo(unsigned short ModeNo, - unsigned short ModeIdIndex, - struct vb_device_info *pVBInfo); - -extern unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, +extern unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, + struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo) ; extern unsigned char XGI_SearchModeID(unsigned short ModeNo, unsigned short *ModeIdIndex, struct vb_device_info *); -extern unsigned char XGI_GetLCDInfo(unsigned short ModeNo, - unsigned short ModeIdIndex, - struct vb_device_info *); extern unsigned char XGI_BridgeIsOn(struct vb_device_info *); - -extern unsigned char -XGI_SetCRT2Group301(unsigned short ModeNo, - struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *); extern unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *); -extern void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo); -extern void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo); -extern void XGI_XG21BLSignalVDD(unsigned short tempbh, - unsigned short tempbl, - struct vb_device_info *pVBInfo); -extern void XGI_XG27BLSignalVDD(unsigned short tempbh, - unsigned short tempbl, - struct vb_device_info *pVBInfo); -extern void XGI_XG21SetPanelDelay(unsigned short tempbl, - struct vb_device_info *pVBInfo); -extern unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, - unsigned short ModeIdIndex, - struct vb_device_info *pVBInfo); -extern unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo); - #endif diff --git a/drivers/staging/xgifb/vb_struct.h b/drivers/staging/xgifb/vb_struct.h index f9ade6f..6556a0d 100644 --- a/drivers/staging/xgifb/vb_struct.h +++ b/drivers/staging/xgifb/vb_struct.h @@ -293,13 +293,12 @@ struct vb_device_info { unsigned short IF_DEF_ExpLink; unsigned short IF_DEF_HiVision; unsigned short LCDResInfo, LCDTypeInfo, VBType;/*301b*/ - unsigned short VBInfo, TVInfo, LCDInfo, Set_VGAType; + unsigned short VBInfo, TVInfo, LCDInfo; unsigned short VBExtInfo;/*301lv*/ unsigned short SetFlag; unsigned short NewFlickerMode; unsigned short SelectCRT2Rate; - unsigned char *ROMAddr; void __iomem *FBAddr; unsigned long BaseAddr; unsigned long RelIO; @@ -376,7 +375,6 @@ struct vb_device_info { unsigned char *pXGINew_CR97 ; struct XGI330_LCDCapStruct *LCDCapList; - struct XGI21_LVDSCapStruct *XG21_LVDSCapList; struct XGI_TimingHStruct *TimingH; struct XGI_TimingVStruct *TimingV; diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index b81ac77..e7946f1 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h @@ -2569,33 +2569,6 @@ static struct XGI330_LCDCapStruct XGI_LCDCapList[] = { 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10} }; -struct XGI21_LVDSCapStruct XGI21_LCDCapList[] = { - {DisableLCD24bpp + LCDPolarity, - 2160, 1250, 1600, 1200, 64, 1, 192, 3, - 0x70, 0x24, 0x20, 0x04, 0x0A, 0x02, 0xC8 - }, - {DisableLCD24bpp + LCDPolarity, - 1688, 1066, 1280, 1024, 48, 1, 112, 3, - 0x70, 0x44, 0x20, 0x04, 0x0A, 0x02, 0xC8 - }, - {DisableLCD24bpp + LCDPolarity + (LCDPolarity << 8), - 1344, 806, 1024, 768, 24, 3, 136, 6, - 0x6C, 0x65, 0x20, 0x04, 0x0A, 0x02, 0xC8 - }, - {DisableLCD24bpp + LCDPolarity, - 1056, 628, 800, 600, 40, 1, 128, 4, - 0x42, 0xE2, 0x20, 0x14, 0x0A, 0x02, 0x00 - }, - {DisableLCD24bpp + LCDPolarity, - 928, 525, 800, 480, 40, 13, 48, 3, - 0x52, 0xC5, 0x20, 0x14, 0x0A, 0x02, 0x00 - }, - {DisableLCD24bpp + LCDPolarity + (LCDPolarity << 8), - 800, 525, 640, 480, 16, 10, 96, 2, - 0x1B, 0xE1, 0x20, 0x04, 0x0A, 0x02, 0xC8 - } -}; - static struct XGI_Ext2Struct XGI330_RefIndex[] = { {Support32Bpp + SupportAllCRT2 + SyncPN, RES320x200, VCLK25_175, 0x00, 0x10, 0x59, 320, 200},/* 00 */ diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h index 9b939b7..9e166bb 100644 --- a/drivers/staging/xgifb/vgatypes.h +++ b/drivers/staging/xgifb/vgatypes.h @@ -51,8 +51,6 @@ struct xgi_hw_device_info { unsigned long ulExternalChip; /* NO VB or other video bridge*/ /* if ujVBChipID = VB_CHIP_UNKNOWN, */ - unsigned char *pjVirtualRomBase; /* ROM image */ - void __iomem *pjVideoMemoryAddress;/* base virtual memory address */ /* of Linear VGA memory */ |