apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2 | #include <asm/io.h> |
| 3 | #include <linux/types.h> |
| 4 | #include <linux/version.h> |
| 5 | #include "XGIfb.h" |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7 | |
| 8 | #include "vb_def.h" |
| 9 | #include "vgatypes.h" |
| 10 | #include "vb_struct.h" |
| 11 | #include "vb_util.h" |
| 12 | #include "vb_table.h" |
| 13 | |
| 14 | |
| 15 | |
| 16 | #define IndexMask 0xff |
| 17 | #ifndef XGI_MASK_DUAL_CHIP |
| 18 | #define XGI_MASK_DUAL_CHIP 0x04 /* SR3A */ |
| 19 | #endif |
| 20 | |
| 21 | |
| 22 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 23 | unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo); |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 24 | unsigned char XGI_SetCRT2Group301(unsigned short ModeNo, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 25 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 26 | struct vb_device_info *pVBInfo); |
| 27 | unsigned char XGI_BacklightByDrv(struct vb_device_info *pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 28 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 29 | unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo); |
| 30 | unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo); |
| 31 | unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo); |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 32 | unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo, |
| 33 | unsigned short ModeIdIndex, |
| 34 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 35 | unsigned short *i, struct vb_device_info *pVBInfo); |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 36 | unsigned char XGI_SearchModeID(unsigned short ModeNo, |
| 37 | unsigned short *ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 38 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 39 | unsigned char XGI_GetLCDInfo(unsigned short ModeNo, |
| 40 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 41 | struct vb_device_info *pVBInfo); |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 42 | unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 43 | unsigned short ModeNo); |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 44 | unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo); |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 45 | unsigned char XGI_GetModePtr(unsigned short ModeNo, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 46 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 47 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 48 | unsigned short XGI_GetOffset(unsigned short ModeNo, |
| 49 | unsigned short ModeIdIndex, |
| 50 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 51 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 52 | struct vb_device_info *pVBInfo); |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 53 | unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 54 | unsigned short ModeNo, |
| 55 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 56 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 57 | unsigned short XGI_GetResInfo(unsigned short ModeNo, |
| 58 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 59 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 60 | unsigned short XGI_GetColorDepth(unsigned short ModeNo, |
| 61 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 62 | struct vb_device_info *pVBInfo); |
| 63 | unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo); |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 64 | unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, |
| 65 | unsigned short ModeIdIndex, |
| 66 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 67 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 68 | struct vb_device_info *pVBInfo); |
| 69 | void XGI_VBLongWait(struct vb_device_info *pVBInfo); |
| 70 | void XGI_SaveCRT2Info(unsigned short ModeNo, struct vb_device_info *pVBInfo); |
| 71 | void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 72 | void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 73 | void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 74 | void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 75 | void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 76 | void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 77 | void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 78 | void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 79 | void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 80 | void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 81 | void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 82 | void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 83 | void XGI_FirePWDEnable(struct vb_device_info *pVBInfo); |
| 84 | void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 85 | void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 86 | void XGI_SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo); |
| 87 | void XGI_SetPanelPower(unsigned short tempah, unsigned short tempbl, struct vb_device_info *pVBInfo); |
| 88 | void XGI_EnablePWD(struct vb_device_info *pVBInfo); |
| 89 | void XGI_DisablePWD(struct vb_device_info *pVBInfo); |
| 90 | void XGI_AutoThreshold(struct vb_device_info *pVBInfo); |
| 91 | void XGI_SetTap4Regs(struct vb_device_info *pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 92 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 93 | void XGI_DisplayOn(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); |
| 94 | void XGI_DisplayOff(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); |
| 95 | void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 96 | void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 97 | void XGI_SetXG21LCD(struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex, unsigned short ModeNo); |
| 98 | void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 99 | void XGI_SetXG27LCD(struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex, unsigned short ModeNo); |
| 100 | void XGI_UpdateXG21CRTC(unsigned short ModeNo, struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex); |
| 101 | void XGI_WaitDisply(struct vb_device_info *pVBInfo); |
| 102 | void XGI_SenseCRT1(struct vb_device_info *pVBInfo); |
| 103 | void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 104 | void XGI_SetMiscRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo); |
| 105 | void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension, unsigned short StandTableIndex, struct vb_device_info *pVBInfo); |
| 106 | void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 107 | void XGI_SetGRCRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo); |
| 108 | void XGI_ClearExt1Regs(struct vb_device_info *pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 109 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 110 | void XGI_SetSync(unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 111 | void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo, struct xgi_hw_device_info *HwDeviceExtension); |
| 112 | void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo, struct xgi_hw_device_info *HwDeviceExtension); |
| 113 | void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo, struct vb_device_info *pVBInfo); |
| 114 | void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 115 | void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 116 | void XGI_SetCRT1FIFO(unsigned short ModeNo, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 117 | void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 118 | void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 119 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 120 | void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 121 | void XGI_WriteDAC(unsigned short dl, unsigned short ah, unsigned short al, unsigned short dh, struct vb_device_info *pVBInfo); |
| 122 | /*void XGI_ClearBuffer(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, struct vb_device_info *pVBInfo);*/ |
| 123 | void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 124 | void XGI_GetLVDSResInfo(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 125 | struct vb_device_info *pVBInfo); |
| 126 | void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 127 | void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 128 | unsigned short RefreshRateTableIndex, |
| 129 | struct xgi_hw_device_info *HwDeviceExtension, |
| 130 | struct vb_device_info *pVBInfo); |
| 131 | void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 132 | void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 133 | void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 134 | void XGI_GetVBType(struct vb_device_info *pVBInfo); |
| 135 | void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 136 | void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 137 | void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 138 | void InitTo330Pointer(unsigned char, struct vb_device_info *pVBInfo); |
| 139 | void XGI_GetLCDSync(unsigned short *HSyncWidth, unsigned short *VSyncWidth, struct vb_device_info *pVBInfo); |
| 140 | void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 141 | void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 142 | void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 143 | void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 144 | void XGI_SetDelayComp(struct vb_device_info *pVBInfo); |
| 145 | void XGI_SetLCDCap(struct vb_device_info *pVBInfo); |
| 146 | void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo); |
| 147 | void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo); |
| 148 | void SetSpectrum(struct vb_device_info *pVBInfo); |
| 149 | void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 150 | void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 151 | void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo); |
| 152 | void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 153 | void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char* tempcl, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 154 | unsigned char *tempch, struct vb_device_info *pVBInfo); |
| 155 | unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo); |
| 156 | void XGI_SetCRT2ModeRegs(unsigned short ModeNo, struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); |
| 157 | void XGI_CloseCRTC(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); |
| 158 | void XGI_OpenCRTC(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); |
| 159 | void XGI_GetRAMDAC2DATA(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 160 | void XGI_UnLockCRT2(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); |
| 161 | void XGI_LockCRT2(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); |
| 162 | void XGINew_EnableCRT2(struct vb_device_info *pVBInfo); |
| 163 | void XGINew_LCD_Wait_Time(unsigned char DelayTime, struct vb_device_info *pVBInfo); |
| 164 | void XGI_LongWait(struct vb_device_info *pVBInfo); |
| 165 | void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 166 | void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 167 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 168 | unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, |
| 169 | unsigned short ModeNo, |
| 170 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 171 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 172 | void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 173 | unsigned char *di_1, struct vb_device_info *pVBInfo); |
| 174 | unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo); |
| 175 | unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo); |
| 176 | struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx, struct vb_device_info *pVBInfo); |
| 177 | void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo); |
| 178 | void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo); |
| 179 | unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo); |
| 180 | unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo); |
| 181 | void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo); |
| 182 | void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo); |
| 183 | void XGI_XG21SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo); |
| 184 | unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 185 | void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 186 | void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 187 | unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 188 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 189 | extern void ReadVBIOSTablData(unsigned char ChipType, struct vb_device_info *pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 190 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 191 | /* unsigned short XGINew_flag_clearbuffer; 0: no clear frame buffer 1:clear frame buffer */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 192 | |
| 193 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 194 | unsigned short XGINew_MDA_DAC[] = { |
| 195 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 196 | 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, |
| 197 | 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, |
| 198 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, |
| 199 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 200 | 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, |
| 201 | 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, |
| 202 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F}; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 203 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 204 | unsigned short XGINew_CGA_DAC[] = { |
| 205 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, |
| 206 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, |
| 207 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, |
| 208 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, |
| 209 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, |
| 210 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, |
| 211 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, |
| 212 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F}; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 213 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 214 | unsigned short XGINew_EGA_DAC[] = { |
| 215 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x05, 0x15, |
| 216 | 0x20, 0x30, 0x24, 0x34, 0x21, 0x31, 0x25, 0x35, |
| 217 | 0x08, 0x18, 0x0C, 0x1C, 0x09, 0x19, 0x0D, 0x1D, |
| 218 | 0x28, 0x38, 0x2C, 0x3C, 0x29, 0x39, 0x2D, 0x3D, |
| 219 | 0x02, 0x12, 0x06, 0x16, 0x03, 0x13, 0x07, 0x17, |
| 220 | 0x22, 0x32, 0x26, 0x36, 0x23, 0x33, 0x27, 0x37, |
| 221 | 0x0A, 0x1A, 0x0E, 0x1E, 0x0B, 0x1B, 0x0F, 0x1F, |
| 222 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F}; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 223 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 224 | unsigned short XGINew_VGA_DAC[] = { |
| 225 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, |
| 226 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, |
| 227 | 0x00, 0x05, 0x08, 0x0B, 0x0E, 0x11, 0x14, 0x18, |
| 228 | 0x1C, 0x20, 0x24, 0x28, 0x2D, 0x32, 0x38, 0x3F, |
| 229 | 0x00, 0x10, 0x1F, 0x2F, 0x3F, 0x1F, 0x27, 0x2F, |
| 230 | 0x37, 0x3F, 0x2D, 0x31, 0x36, 0x3A, 0x3F, 0x00, |
| 231 | 0x07, 0x0E, 0x15, 0x1C, 0x0E, 0x11, 0x15, 0x18, |
| 232 | 0x1C, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x00, 0x04, |
| 233 | 0x08, 0x0C, 0x10, 0x08, 0x0A, 0x0C, 0x0E, 0x10, |
| 234 | 0x0B, 0x0C, 0x0D, 0x0F, 0x10}; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 235 | |
| 236 | |
| 237 | /* --------------------------------------------------------------------- */ |
| 238 | /* Function : InitTo330Pointer */ |
| 239 | /* Input : */ |
| 240 | /* Output : */ |
| 241 | /* Description : */ |
| 242 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 243 | void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 244 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 245 | pVBInfo->SModeIDTable = (struct XGI_StStruct *) XGI330_SModeIDTable ; |
| 246 | pVBInfo->StandTable = (struct XGI_StandTableStruct *) XGI330_StandTable ; |
| 247 | pVBInfo->EModeIDTable = (struct XGI_ExtStruct *) XGI330_EModeIDTable ; |
| 248 | pVBInfo->RefIndex = (struct XGI_Ext2Struct *) XGI330_RefIndex ; |
| 249 | pVBInfo->XGINEWUB_CRT1Table = (struct XGI_CRT1TableStruct *) XGI_CRT1Table ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 250 | |
| 251 | /* add for new UNIVGABIOS */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 252 | /* XGINew_UBLCDDataTable = (struct XGI_LCDDataTablStruct *) XGI_LCDDataTable ; */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 253 | /* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable ; */ |
| 254 | |
| 255 | |
| 256 | if ( ChipType >= XG40 ) |
| 257 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 258 | pVBInfo->MCLKData = (struct XGI_MCLKDataStruct *) XGI340New_MCLKData; |
| 259 | pVBInfo->ECLKData = (struct XGI_ECLKDataStruct *) XGI340_ECLKData; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 260 | } |
| 261 | else |
| 262 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 263 | pVBInfo->MCLKData = (struct XGI_MCLKDataStruct *) XGI330New_MCLKData; |
| 264 | pVBInfo->ECLKData = (struct XGI_ECLKDataStruct *) XGI330_ECLKData; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 265 | } |
| 266 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 267 | pVBInfo->VCLKData = (struct XGI_VCLKDataStruct *) XGI_VCLKData ; |
| 268 | pVBInfo->VBVCLKData = (struct XGI_VBVCLKDataStruct *) XGI_VBVCLKData ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 269 | pVBInfo->ScreenOffset = XGI330_ScreenOffset ; |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 270 | pVBInfo->StResInfo = (struct XGI_StResInfoStruct *) XGI330_StResInfo ; |
| 271 | pVBInfo->ModeResInfo = (struct XGI_ModeResInfoStruct *) XGI330_ModeResInfo ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 272 | |
| 273 | pVBInfo->pOutputSelect = &XGI330_OutputSelect ; |
| 274 | pVBInfo->pSoftSetting = &XGI330_SoftSetting ; |
| 275 | pVBInfo->pSR07 = &XGI330_SR07 ; |
| 276 | pVBInfo->LCDResInfo = 0 ; |
| 277 | pVBInfo->LCDTypeInfo = 0 ; |
| 278 | pVBInfo->LCDInfo = 0 ; |
| 279 | pVBInfo->VBInfo = 0 ; |
| 280 | pVBInfo->TVInfo = 0; |
| 281 | |
| 282 | |
| 283 | pVBInfo->SR15 = XGI340_SR13 ; |
| 284 | pVBInfo->CR40 = XGI340_cr41 ; |
| 285 | pVBInfo->SR25 = XGI330_sr25 ; |
| 286 | pVBInfo->pSR31 = &XGI330_sr31 ; |
| 287 | pVBInfo->pSR32 = &XGI330_sr32 ; |
| 288 | pVBInfo->CR6B = XGI340_CR6B ; |
| 289 | pVBInfo->CR6E = XGI340_CR6E ; |
| 290 | pVBInfo->CR6F = XGI340_CR6F ; |
| 291 | pVBInfo->CR89 = XGI340_CR89 ; |
| 292 | pVBInfo->AGPReg = XGI340_AGPReg ; |
| 293 | pVBInfo->SR16 = XGI340_SR16 ; |
| 294 | pVBInfo->pCRCF = &XG40_CRCF ; |
| 295 | pVBInfo->pXGINew_DRAMTypeDefinition = &XG40_DRAMTypeDefinition ; |
| 296 | |
| 297 | |
| 298 | pVBInfo->CR49 = XGI330_CR49 ; |
| 299 | pVBInfo->pSR1F = &XGI330_SR1F ; |
| 300 | pVBInfo->pSR21 = &XGI330_SR21 ; |
| 301 | pVBInfo->pSR22 = &XGI330_SR22 ; |
| 302 | pVBInfo->pSR23 = &XGI330_SR23 ; |
| 303 | pVBInfo->pSR24 = &XGI330_SR24 ; |
| 304 | pVBInfo->pSR33 = &XGI330_SR33 ; |
| 305 | |
| 306 | |
| 307 | |
| 308 | pVBInfo->pCRT2Data_1_2 = &XGI330_CRT2Data_1_2 ; |
| 309 | pVBInfo->pCRT2Data_4_D = &XGI330_CRT2Data_4_D ; |
| 310 | pVBInfo->pCRT2Data_4_E = &XGI330_CRT2Data_4_E ; |
| 311 | pVBInfo->pCRT2Data_4_10 = &XGI330_CRT2Data_4_10 ; |
| 312 | pVBInfo->pRGBSenseData = &XGI330_RGBSenseData ; |
| 313 | pVBInfo->pVideoSenseData = &XGI330_VideoSenseData ; |
| 314 | pVBInfo->pYCSenseData = &XGI330_YCSenseData ; |
| 315 | pVBInfo->pRGBSenseData2 = &XGI330_RGBSenseData2 ; |
| 316 | pVBInfo->pVideoSenseData2 = &XGI330_VideoSenseData2 ; |
| 317 | pVBInfo->pYCSenseData2 = &XGI330_YCSenseData2 ; |
| 318 | |
| 319 | pVBInfo->NTSCTiming = XGI330_NTSCTiming ; |
| 320 | pVBInfo->PALTiming = XGI330_PALTiming ; |
| 321 | pVBInfo->HiTVExtTiming = XGI330_HiTVExtTiming ; |
| 322 | pVBInfo->HiTVSt1Timing = XGI330_HiTVSt1Timing ; |
| 323 | pVBInfo->HiTVSt2Timing = XGI330_HiTVSt2Timing ; |
| 324 | pVBInfo->HiTVTextTiming = XGI330_HiTVTextTiming ; |
| 325 | pVBInfo->YPbPr750pTiming = XGI330_YPbPr750pTiming ; |
| 326 | pVBInfo->YPbPr525pTiming = XGI330_YPbPr525pTiming ; |
| 327 | pVBInfo->YPbPr525iTiming = XGI330_YPbPr525iTiming ; |
| 328 | pVBInfo->HiTVGroup3Data = XGI330_HiTVGroup3Data ; |
| 329 | pVBInfo->HiTVGroup3Simu = XGI330_HiTVGroup3Simu ; |
| 330 | pVBInfo->HiTVGroup3Text = XGI330_HiTVGroup3Text ; |
| 331 | pVBInfo->Ren525pGroup3 = XGI330_Ren525pGroup3 ; |
| 332 | pVBInfo->Ren750pGroup3 = XGI330_Ren750pGroup3 ; |
| 333 | |
| 334 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 335 | pVBInfo->TimingH = (struct XGI_TimingHStruct *) XGI_TimingH ; |
| 336 | pVBInfo->TimingV = (struct XGI_TimingVStruct *) XGI_TimingV ; |
| 337 | pVBInfo->UpdateCRT1 = (struct XGI_XG21CRT1Struct *) XGI_UpdateCRT1Table ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 338 | |
| 339 | pVBInfo->CHTVVCLKUNTSC = XGI330_CHTVVCLKUNTSC ; |
| 340 | pVBInfo->CHTVVCLKONTSC = XGI330_CHTVVCLKONTSC ; |
| 341 | pVBInfo->CHTVVCLKUPAL = XGI330_CHTVVCLKUPAL ; |
| 342 | pVBInfo->CHTVVCLKOPAL = XGI330_CHTVVCLKOPAL ; |
| 343 | |
| 344 | /* 310 customization related */ |
| 345 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 346 | pVBInfo->LCDCapList = XGI_LCDDLCapList ; |
| 347 | else |
| 348 | pVBInfo->LCDCapList = XGI_LCDCapList ; |
| 349 | |
| 350 | if ( ( ChipType == XG21 ) || ( ChipType == XG27 ) ) |
| 351 | pVBInfo->XG21_LVDSCapList = XGI21_LCDCapList ; |
| 352 | |
| 353 | pVBInfo->XGI_TVDelayList = XGI301TVDelayList ; |
| 354 | pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2 ; |
| 355 | |
| 356 | |
| 357 | pVBInfo->pXGINew_I2CDefinition = &XG40_I2CDefinition ; |
| 358 | |
| 359 | if ( ChipType >= XG20 ) |
| 360 | pVBInfo->pXGINew_CR97 = &XG20_CR97 ; |
| 361 | |
| 362 | if ( ChipType == XG27 ) |
| 363 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 364 | pVBInfo->MCLKData = (struct XGI_MCLKDataStruct *) XGI27New_MCLKData; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 365 | pVBInfo->CR40 = XGI27_cr41 ; |
| 366 | pVBInfo->pXGINew_CR97 = &XG27_CR97 ; |
| 367 | pVBInfo->pSR36 = &XG27_SR36 ; |
| 368 | pVBInfo->pCR8F = &XG27_CR8F ; |
| 369 | pVBInfo->pCRD0 = XG27_CRD0 ; |
| 370 | pVBInfo->pCRDE = XG27_CRDE ; |
| 371 | pVBInfo->pSR40 = &XG27_SR40 ; |
| 372 | pVBInfo->pSR41 = &XG27_SR41 ; |
| 373 | |
| 374 | } |
| 375 | |
| 376 | if ( ChipType >= XG20 ) |
| 377 | { |
| 378 | pVBInfo->pDVOSetting = &XG21_DVOSetting ; |
| 379 | pVBInfo->pCR2E = &XG21_CR2E ; |
| 380 | pVBInfo->pCR2F = &XG21_CR2F ; |
| 381 | pVBInfo->pCR46 = &XG21_CR46 ; |
| 382 | pVBInfo->pCR47 = &XG21_CR47 ; |
| 383 | } |
| 384 | |
| 385 | } |
| 386 | |
| 387 | |
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | /* --------------------------------------------------------------------- */ |
| 393 | /* Function : XGISetModeNew */ |
| 394 | /* Input : */ |
| 395 | /* Output : */ |
| 396 | /* Description : */ |
| 397 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 398 | unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 399 | unsigned short ModeNo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 400 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 401 | unsigned short ModeIdIndex ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 402 | /* unsigned char *pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress ; */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 403 | struct vb_device_info VBINF; |
| 404 | struct vb_device_info *pVBInfo = &VBINF; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 405 | pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 406 | pVBInfo->BaseAddr = (unsigned long)HwDeviceExtension->pjIOAddress ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 407 | pVBInfo->IF_DEF_LVDS = 0 ; |
| 408 | pVBInfo->IF_DEF_CH7005 = 0 ; |
| 409 | pVBInfo->IF_DEF_LCDA = 1 ; |
| 410 | pVBInfo->IF_DEF_CH7017 = 0 ; |
| 411 | pVBInfo->IF_DEF_CH7007 = 0 ; /* [Billy] 2007/05/14 */ |
| 412 | pVBInfo->IF_DEF_VideoCapture = 0 ; |
| 413 | pVBInfo->IF_DEF_ScaleLCD = 0 ; |
| 414 | pVBInfo->IF_DEF_OEMUtil = 0 ; |
| 415 | pVBInfo->IF_DEF_PWD = 0 ; |
| 416 | |
| 417 | |
| 418 | if ( HwDeviceExtension->jChipType >= XG20 ) /* kuku 2004/06/25 */ |
| 419 | { |
| 420 | pVBInfo->IF_DEF_YPbPr = 0 ; |
| 421 | pVBInfo->IF_DEF_HiVision = 0 ; |
| 422 | pVBInfo->IF_DEF_CRT2Monitor = 0 ; |
| 423 | pVBInfo->VBType = 0 ; /*set VBType default 0*/ |
| 424 | } |
| 425 | else if ( HwDeviceExtension->jChipType >= XG40 ) |
| 426 | { |
| 427 | pVBInfo->IF_DEF_YPbPr = 1 ; |
| 428 | pVBInfo->IF_DEF_HiVision = 1 ; |
| 429 | pVBInfo->IF_DEF_CRT2Monitor = 1 ; |
| 430 | } |
| 431 | else |
| 432 | { |
| 433 | pVBInfo->IF_DEF_YPbPr = 1 ; |
| 434 | pVBInfo->IF_DEF_HiVision = 1 ; |
| 435 | pVBInfo->IF_DEF_CRT2Monitor = 0 ; |
| 436 | } |
| 437 | |
| 438 | pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14 ; |
| 439 | pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24 ; |
| 440 | pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10 ; |
| 441 | pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e ; |
| 442 | pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12 ; |
| 443 | pVBInfo->P3cc = pVBInfo->BaseAddr + 0x1C ; |
| 444 | pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a ; |
| 445 | pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16 ; |
| 446 | pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17 ; |
| 447 | pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18 ; |
| 448 | pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19 ; |
| 449 | pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A ; |
| 450 | pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00 ; |
| 451 | pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04 ; |
| 452 | pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10 ; |
| 453 | pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12 ; |
| 454 | pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 ; |
| 455 | pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2 ; |
| 456 | |
| 457 | if ( HwDeviceExtension->jChipType == XG21 ) /* for x86 Linux, XG21 LVDS */ |
| 458 | { |
| 459 | if ( ( XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) & 0xE0 ) == 0xC0 ) |
| 460 | { |
| 461 | pVBInfo->IF_DEF_LVDS = 1 ; |
| 462 | } |
| 463 | } |
| 464 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 465 | { |
| 466 | if ( ( XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) & 0xE0 ) == 0xC0 ) |
| 467 | { |
| 468 | if ( XGINew_GetReg1( pVBInfo->P3d4 , 0x30 ) & 0x20 ) |
| 469 | { |
| 470 | pVBInfo->IF_DEF_LVDS = 1 ; |
| 471 | } |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */ |
| 476 | XGI_GetVBType( pVBInfo ) ; |
| 477 | |
| 478 | InitTo330Pointer( HwDeviceExtension->jChipType, pVBInfo ) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 479 | if ( ModeNo & 0x80 ) |
| 480 | { |
| 481 | ModeNo = ModeNo & 0x7F ; |
| 482 | /* XGINew_flag_clearbuffer = 0 ; */ |
| 483 | } |
| 484 | /* else |
| 485 | { |
| 486 | XGINew_flag_clearbuffer = 1 ; |
| 487 | } |
| 488 | */ |
| 489 | XGINew_SetReg1( pVBInfo->P3c4 , 0x05 , 0x86 ) ; |
| 490 | |
| 491 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 1.Openkey */ |
| 492 | XGI_UnLockCRT2( HwDeviceExtension , pVBInfo ) ; |
| 493 | |
| 494 | XGI_SearchModeID( ModeNo , &ModeIdIndex, pVBInfo ) ; |
| 495 | |
| 496 | XGI_GetVGAType(HwDeviceExtension, pVBInfo) ; |
| 497 | |
| 498 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */ |
| 499 | { |
| 500 | XGI_GetVBInfo(ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; |
| 501 | XGI_GetTVInfo(ModeNo , ModeIdIndex, pVBInfo ) ; |
| 502 | XGI_GetLCDInfo(ModeNo , ModeIdIndex, pVBInfo ) ; |
| 503 | XGI_DisableBridge( HwDeviceExtension,pVBInfo ) ; |
| 504 | /* XGI_OpenCRTC( HwDeviceExtension, pVBInfo ) ; */ |
| 505 | |
| 506 | if ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToLCDA ) ) |
| 507 | { |
| 508 | XGI_SetCRT1Group(HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 509 | |
| 510 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 511 | { |
| 512 | XGI_SetLCDAGroup(ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; |
| 513 | } |
| 514 | } |
| 515 | else |
| 516 | { |
| 517 | if ( !( pVBInfo->VBInfo & SwitchToCRT2) ) |
| 518 | { |
| 519 | XGI_SetCRT1Group( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 520 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 521 | { |
| 522 | XGI_SetLCDAGroup( ModeNo , ModeIdIndex , HwDeviceExtension, pVBInfo ) ; |
| 523 | } |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | if ( pVBInfo->VBInfo & ( SetSimuScanMode | SwitchToCRT2 ) ) |
| 528 | { |
| 529 | switch( HwDeviceExtension->ujVBChipID ) |
| 530 | { |
| 531 | case VB_CHIP_301: |
| 532 | XGI_SetCRT2Group301( ModeNo , HwDeviceExtension, pVBInfo ) ; /*add for CRT2 */ |
| 533 | break ; |
| 534 | |
| 535 | case VB_CHIP_302: |
| 536 | XGI_SetCRT2Group301(ModeNo , HwDeviceExtension, pVBInfo ) ; /*add for CRT2 */ |
| 537 | break ; |
| 538 | |
| 539 | default: |
| 540 | break ; |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | XGI_SetCRT2ModeRegs( ModeNo, HwDeviceExtension,pVBInfo ) ; |
| 545 | XGI_OEM310Setting( ModeNo, ModeIdIndex,pVBInfo ) ; /*0212*/ |
| 546 | XGI_CloseCRTC( HwDeviceExtension, pVBInfo ) ; |
| 547 | XGI_EnableBridge( HwDeviceExtension ,pVBInfo) ; |
| 548 | } /* !XG20 */ |
| 549 | else |
| 550 | { |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 551 | if (pVBInfo->IF_DEF_LVDS == 1) |
| 552 | if (!XGI_XG21CheckLVDSMode(ModeNo , ModeIdIndex, pVBInfo)) |
| 553 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 554 | |
| 555 | if ( ModeNo <= 0x13 ) |
| 556 | { |
| 557 | pVBInfo->ModeType = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag & ModeInfoFlag; |
| 558 | } |
| 559 | else |
| 560 | { |
| 561 | pVBInfo->ModeType = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag & ModeInfoFlag; |
| 562 | } |
| 563 | |
| 564 | pVBInfo->SetFlag = 0 ; |
| 565 | if ( pVBInfo->IF_DEF_CH7007 != 1 ) |
| 566 | { |
| 567 | pVBInfo->VBInfo = DisableCRT2Display ; |
| 568 | } |
| 569 | |
| 570 | |
| 571 | XGI_DisplayOff(HwDeviceExtension, pVBInfo) ; |
| 572 | |
| 573 | XGI_SetCRT1Group(HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 574 | |
| 575 | XGI_DisplayOn( HwDeviceExtension, pVBInfo ) ; |
| 576 | /* |
| 577 | if( HwDeviceExtension->jChipType == XG21 ) |
| 578 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0x80 , 0x80 ) ; |
| 579 | */ |
| 580 | } |
| 581 | |
| 582 | |
| 583 | /* |
| 584 | if ( ModeNo <= 0x13 ) |
| 585 | { |
| 586 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 587 | } |
| 588 | else |
| 589 | { |
| 590 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 591 | } |
| 592 | pVBInfo->ModeType = modeflag&ModeInfoFlag ; |
| 593 | pVBInfo->SetFlag = 0x00 ; |
| 594 | pVBInfo->VBInfo = DisableCRT2Display ; |
| 595 | temp = XGINew_CheckMemorySize( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 596 | |
| 597 | if ( temp == 0 ) |
| 598 | return( 0 ) ; |
| 599 | |
| 600 | XGI_DisplayOff( HwDeviceExtension, pVBInfo) ; |
| 601 | XGI_SetCRT1Group( HwDeviceExtension , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 602 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; |
| 603 | */ |
| 604 | |
| 605 | XGI_UpdateModeInfo( HwDeviceExtension, pVBInfo ) ; |
| 606 | |
| 607 | if ( HwDeviceExtension->jChipType < XG20 ) /* kuku 2004/06/25 */ |
| 608 | { |
| 609 | XGI_LockCRT2( HwDeviceExtension, pVBInfo ) ; |
| 610 | } |
| 611 | |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 612 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 613 | } |
| 614 | |
| 615 | |
| 616 | /* --------------------------------------------------------------------- */ |
| 617 | /* Function : XGI_SetCRT1Group */ |
| 618 | /* Input : */ |
| 619 | /* Output : */ |
| 620 | /* Description : */ |
| 621 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 622 | void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 623 | unsigned short ModeNo, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 624 | unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 625 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 626 | unsigned short StandTableIndex , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 627 | RefreshRateTableIndex , |
| 628 | b3CC , |
| 629 | temp ; |
| 630 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 631 | unsigned short XGINew_P3cc = pVBInfo->P3cc; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 632 | |
| 633 | /* XGINew_CRT1Mode = ModeNo ; // SaveModeID */ |
| 634 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 635 | /* XGI_SetBIOSData(ModeNo , ModeIdIndex ) ; */ |
| 636 | /* XGI_ClearBankRegs( ModeNo , ModeIdIndex ) ; */ |
| 637 | XGI_SetSeqRegs( ModeNo , StandTableIndex , ModeIdIndex, pVBInfo ) ; |
| 638 | XGI_SetMiscRegs( StandTableIndex, pVBInfo ) ; |
| 639 | XGI_SetCRTCRegs( HwDeviceExtension , StandTableIndex, pVBInfo) ; |
| 640 | XGI_SetATTRegs( ModeNo , StandTableIndex , ModeIdIndex, pVBInfo ) ; |
| 641 | XGI_SetGRCRegs( StandTableIndex, pVBInfo ) ; |
| 642 | XGI_ClearExt1Regs(pVBInfo) ; |
| 643 | |
| 644 | /* if ( pVBInfo->IF_DEF_ExpLink ) */ |
| 645 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 646 | { |
| 647 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 648 | { |
| 649 | XGI_SetDefaultVCLK( pVBInfo ) ; |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | temp = ~ProgrammingCRT2 ; |
| 654 | pVBInfo->SetFlag &= temp ; |
| 655 | pVBInfo->SelectCRT2Rate = 0 ; |
| 656 | |
| 657 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 658 | { |
| 659 | if ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToLCDA | SetInSlaveMode ) ) |
| 660 | { |
| 661 | pVBInfo->SetFlag |= ProgrammingCRT2 ; |
| 662 | } |
| 663 | } |
| 664 | |
| 665 | RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ; |
| 666 | if ( RefreshRateTableIndex != 0xFFFF ) |
| 667 | { |
| 668 | XGI_SetSync( RefreshRateTableIndex, pVBInfo ) ; |
| 669 | XGI_SetCRT1CRTC( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo, HwDeviceExtension ) ; |
| 670 | XGI_SetCRT1DE( HwDeviceExtension , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 671 | XGI_SetCRT1Offset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 672 | XGI_SetCRT1VCLK( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 673 | } |
| 674 | |
| 675 | if ( ( HwDeviceExtension->jChipType >= XG20 )&& |
| 676 | ( HwDeviceExtension->jChipType < XG27 ) ) /* fix H/W DCLK/2 bug */ |
| 677 | { |
| 678 | if ( ( ModeNo == 0x00 ) | (ModeNo == 0x01) ) |
| 679 | { |
| 680 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x4E) ; |
| 681 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE9) ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 682 | b3CC = (unsigned char) XGINew_GetReg2(XGINew_P3cc) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 683 | XGINew_SetReg3(XGINew_P3cc , (b3CC |= 0x0C) ) ; |
| 684 | } |
| 685 | else if ( ( ModeNo == 0x04) | ( ModeNo == 0x05) | ( ModeNo == 0x0D) ) |
| 686 | { |
| 687 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x1B) ; |
| 688 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE3) ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 689 | b3CC = (unsigned char)XGINew_GetReg2(XGINew_P3cc) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 690 | XGINew_SetReg3(XGINew_P3cc , (b3CC |= 0x0C) ) ; |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | if ( HwDeviceExtension->jChipType >= XG21 ) |
| 695 | { |
| 696 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; |
| 697 | if ( temp & 0xA0 ) |
| 698 | { |
| 699 | |
| 700 | /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x20 ) ;*/ /* Enable write GPIOF */ |
| 701 | /*XGINew_SetRegAND( pVBInfo->P3d4 , 0x48 , ~0x20 ) ;*/ /* P. DWN */ |
| 702 | /* XG21 CRT1 Timing */ |
| 703 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 704 | XGI_SetXG27CRTC( ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo ); |
| 705 | else |
| 706 | XGI_SetXG21CRTC( ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo ); |
| 707 | |
| 708 | XGI_UpdateXG21CRTC( ModeNo , pVBInfo , RefreshRateTableIndex) ; |
| 709 | |
| 710 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 711 | XGI_SetXG27LCD( pVBInfo , RefreshRateTableIndex , ModeNo ); |
| 712 | else |
| 713 | XGI_SetXG21LCD( pVBInfo , RefreshRateTableIndex , ModeNo ); |
| 714 | |
| 715 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 716 | { |
| 717 | if ( HwDeviceExtension->jChipType == XG27 ) |
| 718 | XGI_SetXG27LVDSPara(ModeNo,ModeIdIndex, pVBInfo ); |
| 719 | else |
| 720 | XGI_SetXG21LVDSPara(ModeNo,ModeIdIndex, pVBInfo ); |
| 721 | } |
| 722 | /*XGINew_SetRegOR( pVBInfo->P3d4 , 0x48 , 0x20 ) ;*/ /* P. ON */ |
| 723 | } |
| 724 | } |
| 725 | |
| 726 | pVBInfo->SetFlag &= ( ~ProgrammingCRT2 ) ; |
| 727 | XGI_SetCRT1FIFO( ModeNo , HwDeviceExtension, pVBInfo ) ; |
| 728 | XGI_SetCRT1ModeRegs( HwDeviceExtension , ModeNo , ModeIdIndex , RefreshRateTableIndex , pVBInfo) ; |
| 729 | |
| 730 | |
| 731 | /* XGI_LoadCharacter(); //dif ifdef TVFont */ |
| 732 | |
| 733 | XGI_LoadDAC( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 734 | /* XGI_ClearBuffer( HwDeviceExtension , ModeNo, pVBInfo ) ; */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 735 | } |
| 736 | |
| 737 | |
| 738 | /* --------------------------------------------------------------------- */ |
| 739 | /* Function : XGI_GetModePtr */ |
| 740 | /* Input : */ |
| 741 | /* Output : */ |
| 742 | /* Description : */ |
| 743 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 744 | unsigned char XGI_GetModePtr(unsigned short ModeNo, unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 745 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 746 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 747 | unsigned char index ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 748 | |
| 749 | if ( ModeNo <= 0x13 ) |
| 750 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_StTableIndex ; |
| 751 | else |
| 752 | { |
| 753 | if ( pVBInfo->ModeType <= 0x02 ) |
| 754 | index = 0x1B ; /* 02 -> ModeEGA */ |
| 755 | else |
| 756 | index = 0x0F ; |
| 757 | } |
| 758 | return( index ) ; /* Get pVBInfo->StandTable index */ |
| 759 | } |
| 760 | |
| 761 | |
| 762 | /* --------------------------------------------------------------------- */ |
| 763 | /* Function : XGI_SetBIOSData */ |
| 764 | /* Input : */ |
| 765 | /* Output : */ |
| 766 | /* Description : */ |
| 767 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 768 | /*unsigned char XGI_SetBIOSData(unsigned short ModeNo, unsigned short ModeIdIndex) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 769 | { |
| 770 | return( 0 ) ; |
| 771 | } |
| 772 | */ |
| 773 | |
| 774 | /* --------------------------------------------------------------------- */ |
| 775 | /* Function : XGI_ClearBankRegs */ |
| 776 | /* Input : */ |
| 777 | /* Output : */ |
| 778 | /* Description : */ |
| 779 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 780 | /*unsigned char XGI_ClearBankRegs(unsigned short ModeNo, unsigned short ModeIdIndex) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 781 | { |
| 782 | return( 0 ) ; |
| 783 | } |
| 784 | */ |
| 785 | |
| 786 | /* --------------------------------------------------------------------- */ |
| 787 | /* Function : XGI_SetSeqRegs */ |
| 788 | /* Input : */ |
| 789 | /* Output : */ |
| 790 | /* Description : */ |
| 791 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 792 | void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 793 | unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 794 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 795 | unsigned char tempah , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 796 | SRdata ; |
| 797 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 798 | unsigned short i , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 799 | modeflag ; |
| 800 | |
| 801 | if ( ModeNo <= 0x13 ) |
| 802 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 803 | else |
| 804 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 805 | |
| 806 | XGINew_SetReg1( pVBInfo->P3c4 , 0x00 , 0x03 ) ; /* Set SR0 */ |
| 807 | tempah=pVBInfo->StandTable[ StandTableIndex ].SR[ 0 ] ; |
| 808 | |
| 809 | i = SetCRT2ToLCDA ; |
| 810 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 811 | { |
| 812 | tempah |= 0x01 ; |
| 813 | } |
| 814 | else |
| 815 | { |
| 816 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 817 | { |
| 818 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 819 | tempah |= 0x01 ; |
| 820 | } |
| 821 | } |
| 822 | |
| 823 | tempah |= 0x20 ; /* screen off */ |
| 824 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , tempah ) ; /* Set SR1 */ |
| 825 | |
| 826 | for( i = 02 ; i <= 04 ; i++ ) |
| 827 | { |
| 828 | SRdata = pVBInfo->StandTable[ StandTableIndex ].SR[ i - 1 ] ; /* Get SR2,3,4 from file */ |
| 829 | XGINew_SetReg1( pVBInfo->P3c4 , i , SRdata ) ; /* Set SR2 3 4 */ |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | |
| 834 | /* --------------------------------------------------------------------- */ |
| 835 | /* Function : XGI_SetMiscRegs */ |
| 836 | /* Input : */ |
| 837 | /* Output : */ |
| 838 | /* Description : */ |
| 839 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 840 | void XGI_SetMiscRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 841 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 842 | unsigned char Miscdata ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 843 | |
| 844 | Miscdata = pVBInfo->StandTable[ StandTableIndex ].MISC ; /* Get Misc from file */ |
| 845 | /* |
| 846 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 847 | { |
| 848 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 849 | { |
| 850 | Miscdata |= 0x0C ; |
| 851 | } |
| 852 | } |
| 853 | */ |
| 854 | |
| 855 | XGINew_SetReg3( pVBInfo->P3c2 , Miscdata ) ; /* Set Misc(3c2) */ |
| 856 | } |
| 857 | |
| 858 | |
| 859 | /* --------------------------------------------------------------------- */ |
| 860 | /* Function : XGI_SetCRTCRegs */ |
| 861 | /* Input : */ |
| 862 | /* Output : */ |
| 863 | /* Description : */ |
| 864 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 865 | void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 866 | unsigned short StandTableIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 867 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 868 | unsigned char CRTCdata ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 869 | unsigned short i ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 870 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 871 | CRTCdata = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 872 | CRTCdata &= 0x7f ; |
| 873 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , CRTCdata ) ; /* Unlock CRTC */ |
| 874 | |
| 875 | for( i = 0 ; i <= 0x18 ; i++ ) |
| 876 | { |
| 877 | CRTCdata = pVBInfo->StandTable[ StandTableIndex ].CRTC[ i ] ; /* Get CRTC from file */ |
| 878 | XGINew_SetReg1( pVBInfo->P3d4 , i , CRTCdata ) ; /* Set CRTC( 3d4 ) */ |
| 879 | } |
| 880 | /* |
| 881 | if ( ( HwDeviceExtension->jChipType == XGI_630 )&& ( HwDeviceExtension->jChipRevision == 0x30 ) ) |
| 882 | { |
| 883 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 884 | { |
| 885 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV ) ) |
| 886 | { |
| 887 | XGINew_SetReg1( pVBInfo->P3d4 , 0x18 , 0xFE ) ; |
| 888 | } |
| 889 | } |
| 890 | } |
| 891 | */ |
| 892 | } |
| 893 | |
| 894 | |
| 895 | /* --------------------------------------------------------------------- */ |
| 896 | /* Function : */ |
| 897 | /* Input : */ |
| 898 | /* Output : */ |
| 899 | /* Description : */ |
| 900 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 901 | void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 902 | unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 903 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 904 | unsigned char ARdata ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 905 | unsigned short i, modeflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 906 | |
| 907 | if ( ModeNo <= 0x13 ) |
| 908 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 909 | else |
| 910 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 911 | |
| 912 | for( i = 0 ; i <= 0x13 ; i++ ) |
| 913 | { |
| 914 | ARdata = pVBInfo->StandTable[ StandTableIndex ].ATTR[ i ] ; |
| 915 | if ( modeflag & Charx8Dot ) /* ifndef Dot9 */ |
| 916 | { |
| 917 | if ( i == 0x13 ) |
| 918 | { |
| 919 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 920 | ARdata = 0 ; |
| 921 | else |
| 922 | { |
| 923 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 924 | { |
| 925 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 926 | ARdata = 0 ; |
| 927 | } |
| 928 | } |
| 929 | } |
| 930 | } |
| 931 | |
| 932 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 933 | XGINew_SetReg3( pVBInfo->P3c0 , i ) ; /* set index */ |
| 934 | XGINew_SetReg3( pVBInfo->P3c0 , ARdata ) ; /* set data */ |
| 935 | } |
| 936 | |
| 937 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 938 | XGINew_SetReg3( pVBInfo->P3c0 , 0x14 ) ; /* set index */ |
| 939 | XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data */ |
| 940 | XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */ |
| 941 | XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ; |
| 942 | } |
| 943 | |
| 944 | |
| 945 | /* --------------------------------------------------------------------- */ |
| 946 | /* Function : XGI_SetGRCRegs */ |
| 947 | /* Input : */ |
| 948 | /* Output : */ |
| 949 | /* Description : */ |
| 950 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 951 | void XGI_SetGRCRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 952 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 953 | unsigned char GRdata ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 954 | unsigned short i ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 955 | |
| 956 | for( i = 0 ; i <= 0x08 ; i++ ) |
| 957 | { |
| 958 | GRdata = pVBInfo->StandTable[ StandTableIndex ].GRC[ i ] ; /* Get GR from file */ |
| 959 | XGINew_SetReg1( pVBInfo->P3ce , i , GRdata ) ; /* Set GR(3ce) */ |
| 960 | } |
| 961 | |
| 962 | if ( pVBInfo->ModeType > ModeVGA ) |
| 963 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 964 | GRdata = (unsigned char)XGINew_GetReg1(pVBInfo->P3ce, 0x05); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 965 | GRdata &= 0xBF ; /* 256 color disable */ |
| 966 | XGINew_SetReg1( pVBInfo->P3ce , 0x05 , GRdata ) ; |
| 967 | } |
| 968 | } |
| 969 | |
| 970 | |
| 971 | /* --------------------------------------------------------------------- */ |
| 972 | /* Function : XGI_ClearExt1Regs */ |
| 973 | /* Input : */ |
| 974 | /* Output : */ |
| 975 | /* Description : */ |
| 976 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 977 | void XGI_ClearExt1Regs(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 978 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 979 | unsigned short i ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 980 | |
| 981 | for( i = 0x0A ; i <= 0x0E ; i++ ) |
| 982 | XGINew_SetReg1( pVBInfo->P3c4 , i , 0x00 ) ; /* Clear SR0A-SR0E */ |
| 983 | } |
| 984 | |
| 985 | |
| 986 | /* --------------------------------------------------------------------- */ |
| 987 | /* Function : XGI_SetDefaultVCLK */ |
| 988 | /* Input : */ |
| 989 | /* Output : */ |
| 990 | /* Description : */ |
| 991 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 992 | unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 993 | { |
| 994 | |
| 995 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , 0x20 ) ; |
| 996 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ 0 ].SR2B ) ; |
| 997 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ 0 ].SR2C ) ; |
| 998 | |
| 999 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , 0x10 ) ; |
| 1000 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ 1 ].SR2B ) ; |
| 1001 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ 1 ].SR2C ) ; |
| 1002 | |
| 1003 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x31 , ~0x30 ) ; |
| 1004 | return( 0 ) ; |
| 1005 | } |
| 1006 | |
| 1007 | |
| 1008 | /* --------------------------------------------------------------------- */ |
| 1009 | /* Function : XGI_GetRatePtrCRT2 */ |
| 1010 | /* Input : */ |
| 1011 | /* Output : */ |
| 1012 | /* Description : */ |
| 1013 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 1014 | unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1015 | unsigned short ModeNo, |
| 1016 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 1017 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1018 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1019 | short LCDRefreshIndex[] = { 0x00 , 0x00 , 0x03 , 0x01 } , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1020 | LCDARefreshIndex[] = { 0x00 , 0x00 , 0x03 , 0x01 , 0x01 , 0x01 , 0x01 } ; |
| 1021 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1022 | unsigned short RefreshRateTableIndex, i, modeflag, index, temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1023 | |
| 1024 | if ( ModeNo <= 0x13 ) |
| 1025 | { |
| 1026 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 1027 | } |
| 1028 | else |
| 1029 | { |
| 1030 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 1031 | } |
| 1032 | |
| 1033 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 1034 | { |
| 1035 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 1036 | { |
| 1037 | if ( modeflag & HalfDCLK ) |
| 1038 | return( 0 ) ; |
| 1039 | } |
| 1040 | } |
| 1041 | |
| 1042 | if ( ModeNo < 0x14 ) |
| 1043 | return( 0xFFFF ) ; |
| 1044 | |
| 1045 | index = XGINew_GetReg1( pVBInfo->P3d4 , 0x33 ) ; |
| 1046 | index = index >> pVBInfo->SelectCRT2Rate ; |
| 1047 | index &= 0x0F ; |
| 1048 | |
| 1049 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) |
| 1050 | index = 0 ; |
| 1051 | |
| 1052 | if ( index > 0 ) |
| 1053 | index-- ; |
| 1054 | |
| 1055 | if ( pVBInfo->SetFlag & ProgrammingCRT2 ) |
| 1056 | { |
| 1057 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 1058 | { |
| 1059 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 1060 | { |
| 1061 | index = 0 ; |
| 1062 | } |
| 1063 | } |
| 1064 | |
| 1065 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 1066 | { |
| 1067 | if( pVBInfo->IF_DEF_LVDS == 0 ) |
| 1068 | { |
| 1069 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 1070 | temp = LCDARefreshIndex[ pVBInfo->LCDResInfo & 0x0F ] ; /* 301b */ |
| 1071 | else |
| 1072 | temp = LCDRefreshIndex[ pVBInfo->LCDResInfo & 0x0F ] ; |
| 1073 | |
| 1074 | if ( index > temp ) |
| 1075 | { |
| 1076 | index = temp ; |
| 1077 | } |
| 1078 | } |
| 1079 | else |
| 1080 | { |
| 1081 | index = 0 ; |
| 1082 | } |
| 1083 | } |
| 1084 | } |
| 1085 | |
| 1086 | RefreshRateTableIndex = pVBInfo->EModeIDTable[ ModeIdIndex ].REFindex ; |
| 1087 | ModeNo = pVBInfo->RefIndex[ RefreshRateTableIndex ].ModeID ; |
| 1088 | if ( pXGIHWDE->jChipType >= XG20 ) /* for XG20, XG21, XG27 */ |
| 1089 | { |
| 1090 | /* |
| 1091 | if ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag & XG2xNotSupport ) |
| 1092 | { |
| 1093 | index++; |
| 1094 | } |
| 1095 | */ |
| 1096 | if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 800 ) && |
| 1097 | ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 600 ) ) |
| 1098 | { |
| 1099 | index++; |
| 1100 | } |
| 1101 | /* Alan 10/19/2007; do the similiar adjustment like XGISearchCRT1Rate() */ |
| 1102 | if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 1024 ) && |
| 1103 | ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 768 ) ) |
| 1104 | { |
| 1105 | index++; |
| 1106 | } |
| 1107 | if ( ( pVBInfo->RefIndex[ RefreshRateTableIndex ].XRes == 1280 ) && |
| 1108 | ( pVBInfo->RefIndex[ RefreshRateTableIndex ].YRes == 1024 ) ) |
| 1109 | { |
| 1110 | index++; |
| 1111 | } |
| 1112 | } |
| 1113 | |
| 1114 | i = 0 ; |
| 1115 | do |
| 1116 | { |
| 1117 | if ( pVBInfo->RefIndex[ RefreshRateTableIndex + i ].ModeID != ModeNo ) |
| 1118 | break ; |
| 1119 | temp = pVBInfo->RefIndex[ RefreshRateTableIndex + i ].Ext_InfoFlag ; |
| 1120 | temp &= ModeInfoFlag ; |
| 1121 | if ( temp < pVBInfo->ModeType ) |
| 1122 | break ; |
| 1123 | i++ ; |
| 1124 | index-- ; |
| 1125 | |
| 1126 | } while( index != 0xFFFF ) ; |
| 1127 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) |
| 1128 | { |
| 1129 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 1130 | { |
| 1131 | temp = pVBInfo->RefIndex[ RefreshRateTableIndex + i - 1 ].Ext_InfoFlag ; |
| 1132 | if ( temp & InterlaceMode ) |
| 1133 | { |
| 1134 | i++ ; |
| 1135 | } |
| 1136 | } |
| 1137 | } |
| 1138 | i-- ; |
| 1139 | if ( ( pVBInfo->SetFlag & ProgrammingCRT2 ) ) |
| 1140 | { |
| 1141 | temp = XGI_AjustCRT2Rate( ModeNo , ModeIdIndex , RefreshRateTableIndex , &i, pVBInfo) ; |
| 1142 | } |
| 1143 | return( RefreshRateTableIndex + i ) ; /*return(0x01|(temp1<<1)); */ |
| 1144 | } |
| 1145 | |
| 1146 | |
| 1147 | /* --------------------------------------------------------------------- */ |
| 1148 | /* Function : XGI_AjustCRT2Rate */ |
| 1149 | /* Input : */ |
| 1150 | /* Output : */ |
| 1151 | /* Description : */ |
| 1152 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1153 | unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo, unsigned short ModeIdIndex, |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1154 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 1155 | unsigned short *i, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1156 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1157 | unsigned short tempax, tempbx, resinfo, modeflag, infoflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1158 | |
| 1159 | if ( ModeNo <= 0x13 ) |
| 1160 | { |
| 1161 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */ |
| 1162 | } |
| 1163 | else |
| 1164 | { |
| 1165 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 1166 | } |
| 1167 | |
| 1168 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 1169 | tempbx = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID ; |
| 1170 | tempax = 0 ; |
| 1171 | |
| 1172 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 1173 | { |
| 1174 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 1175 | { |
| 1176 | tempax |= SupportRAMDAC2 ; |
| 1177 | |
| 1178 | if ( pVBInfo->VBType & VB_XGI301C ) |
| 1179 | tempax |= SupportCRT2in301C ; |
| 1180 | } |
| 1181 | |
| 1182 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) /* 301b */ |
| 1183 | { |
| 1184 | tempax |= SupportLCD ; |
| 1185 | |
| 1186 | if ( pVBInfo->LCDResInfo != Panel1280x1024 ) |
| 1187 | { |
| 1188 | if ( pVBInfo->LCDResInfo != Panel1280x960 ) |
| 1189 | { |
| 1190 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) |
| 1191 | { |
| 1192 | if ( resinfo >= 9 ) |
| 1193 | { |
| 1194 | tempax = 0 ; |
| 1195 | return( 0 ) ; |
| 1196 | } |
| 1197 | } |
| 1198 | } |
| 1199 | } |
| 1200 | } |
| 1201 | |
| 1202 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) /* for HiTV */ |
| 1203 | { |
| 1204 | if ( ( pVBInfo->VBType & VB_XGI301LV ) && ( pVBInfo->VBExtInfo == VB_YPbPr1080i ) ) |
| 1205 | { |
| 1206 | tempax |= SupportYPbPr ; |
| 1207 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 1208 | { |
| 1209 | if ( resinfo == 4 ) |
| 1210 | return( 0 ) ; |
| 1211 | |
| 1212 | if ( resinfo == 3 ) |
| 1213 | return( 0 ) ; |
| 1214 | |
| 1215 | if ( resinfo > 7 ) |
| 1216 | return( 0 ) ; |
| 1217 | } |
| 1218 | } |
| 1219 | else |
| 1220 | { |
| 1221 | tempax |= SupportHiVisionTV ; |
| 1222 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 1223 | { |
| 1224 | if ( resinfo == 4 ) |
| 1225 | return( 0 ) ; |
| 1226 | |
| 1227 | if ( resinfo == 3 ) |
| 1228 | { |
| 1229 | if ( pVBInfo->SetFlag & TVSimuMode ) |
| 1230 | return( 0 ) ; |
| 1231 | } |
| 1232 | |
| 1233 | if ( resinfo > 7 ) |
| 1234 | return( 0 ) ; |
| 1235 | } |
| 1236 | } |
| 1237 | } |
| 1238 | else |
| 1239 | { |
| 1240 | if ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr | SetCRT2ToHiVisionTV ) ) |
| 1241 | { |
| 1242 | tempax |= SupportTV ; |
| 1243 | |
| 1244 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 1245 | { |
| 1246 | tempax |= SupportTV1024 ; |
| 1247 | } |
| 1248 | |
| 1249 | if ( !( pVBInfo->VBInfo & SetPALTV ) ) |
| 1250 | { |
| 1251 | if ( modeflag & NoSupportSimuTV ) |
| 1252 | { |
| 1253 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 1254 | { |
| 1255 | if ( !( pVBInfo->VBInfo & SetNotSimuMode ) ) |
| 1256 | { |
| 1257 | return( 0 ) ; |
| 1258 | } |
| 1259 | } |
| 1260 | } |
| 1261 | } |
| 1262 | } |
| 1263 | } |
| 1264 | } |
| 1265 | else /* for LVDS */ |
| 1266 | { |
| 1267 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 1268 | { |
| 1269 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 1270 | { |
| 1271 | tempax |= SupportCHTV ; |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 1276 | { |
| 1277 | tempax |= SupportLCD ; |
| 1278 | |
| 1279 | if ( resinfo > 0x08 ) |
| 1280 | return( 0 ) ; /* 1024x768 */ |
| 1281 | |
| 1282 | if ( pVBInfo->LCDResInfo < Panel1024x768 ) |
| 1283 | { |
| 1284 | if ( resinfo > 0x07 ) |
| 1285 | return( 0 ) ; /* 800x600 */ |
| 1286 | |
| 1287 | if ( resinfo == 0x04 ) |
| 1288 | return( 0 ) ; /* 512x384 */ |
| 1289 | } |
| 1290 | } |
| 1291 | } |
| 1292 | |
| 1293 | for( ; pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID == tempbx ; ( *i )-- ) |
| 1294 | { |
| 1295 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].Ext_InfoFlag ; |
| 1296 | if ( infoflag & tempax ) |
| 1297 | { |
| 1298 | return( 1 ) ; |
| 1299 | } |
| 1300 | if ( ( *i ) == 0 ) |
| 1301 | break ; |
| 1302 | } |
| 1303 | |
| 1304 | for( ( *i ) = 0 ; ; ( *i )++ ) |
| 1305 | { |
| 1306 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].Ext_InfoFlag ; |
| 1307 | if ( pVBInfo->RefIndex[ RefreshRateTableIndex + ( *i ) ].ModeID != tempbx ) |
| 1308 | { |
| 1309 | return( 0 ) ; |
| 1310 | } |
| 1311 | |
| 1312 | if ( infoflag & tempax ) |
| 1313 | { |
| 1314 | return( 1 ) ; |
| 1315 | } |
| 1316 | } |
| 1317 | return( 1 ) ; |
| 1318 | } |
| 1319 | |
| 1320 | |
| 1321 | /* --------------------------------------------------------------------- */ |
| 1322 | /* Function : XGI_SetSync */ |
| 1323 | /* Input : */ |
| 1324 | /* Output : */ |
| 1325 | /* Description : */ |
| 1326 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 1327 | void XGI_SetSync(unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1328 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1329 | unsigned short sync , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1330 | temp ; |
| 1331 | |
| 1332 | sync = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag >> 8 ; /* di+0x00 */ |
| 1333 | sync &= 0xC0 ; |
| 1334 | temp = 0x2F ; |
| 1335 | temp |= sync ; |
| 1336 | XGINew_SetReg3( pVBInfo->P3c2 , temp ) ; /* Set Misc(3c2) */ |
| 1337 | } |
| 1338 | |
| 1339 | |
| 1340 | /* --------------------------------------------------------------------- */ |
| 1341 | /* Function : XGI_SetCRT1CRTC */ |
| 1342 | /* Input : */ |
| 1343 | /* Output : */ |
| 1344 | /* Description : */ |
| 1345 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1346 | void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 1347 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 1348 | struct vb_device_info *pVBInfo, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 1349 | struct xgi_hw_device_info *HwDeviceExtension) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1350 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1351 | unsigned char index, data; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1352 | unsigned short i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1353 | |
| 1354 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; /* Get index */ |
| 1355 | index = index&IndexMask ; |
| 1356 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1357 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1358 | data &= 0x7F ; |
| 1359 | XGINew_SetReg1(pVBInfo->P3d4,0x11,data); /* Unlock CRTC */ |
| 1360 | |
| 1361 | for( i = 0 ; i < 8 ; i++ ) |
| 1362 | pVBInfo->TimingH[ 0 ].data[ i ] = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ i ] ; |
| 1363 | |
| 1364 | for( i = 0 ; i < 7 ; i++ ) |
| 1365 | pVBInfo->TimingV[ 0 ].data[ i ] = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ i + 8 ] ; |
| 1366 | |
| 1367 | XGI_SetCRT1Timing_H( pVBInfo, HwDeviceExtension ) ; |
| 1368 | |
| 1369 | |
| 1370 | |
| 1371 | XGI_SetCRT1Timing_V( ModeIdIndex , ModeNo, pVBInfo ) ; |
| 1372 | |
| 1373 | |
| 1374 | if( pVBInfo->ModeType > 0x03 ) |
| 1375 | XGINew_SetReg1( pVBInfo->P3d4 , 0x14 , 0x4F ) ; |
| 1376 | } |
| 1377 | |
| 1378 | |
| 1379 | /* --------------------------------------------------------------------- */ |
| 1380 | /* Function : XGI_SetCRT1Timing_H */ |
| 1381 | /* Input : */ |
| 1382 | /* Output : */ |
| 1383 | /* Description : */ |
| 1384 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 1385 | void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo, struct xgi_hw_device_info *HwDeviceExtension) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1386 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1387 | unsigned char data, data1, pushax; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1388 | unsigned short i, j; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1389 | |
| 1390 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0 ) ; */ |
| 1391 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x56 , 0 ) ; */ |
| 1392 | /* XGINew_SetRegANDOR( pVBInfo->P3d4 ,0x11 , 0x7f , 0x00 ) ; */ |
| 1393 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1394 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11); /* unlock cr0-7 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1395 | data &= 0x7F ; |
| 1396 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , data ) ; |
| 1397 | |
| 1398 | data = pVBInfo->TimingH[ 0 ].data[ 0 ] ; |
| 1399 | XGINew_SetReg1( pVBInfo->P3d4 , 0 , data ) ; |
| 1400 | |
| 1401 | for( i = 0x01 ; i <= 0x04 ; i++ ) |
| 1402 | { |
| 1403 | data = pVBInfo->TimingH[ 0 ].data[ i ] ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1404 | XGINew_SetReg1( pVBInfo->P3d4, (unsigned short)(i + 1), data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1405 | } |
| 1406 | |
| 1407 | for( i = 0x05 ; i <= 0x06 ; i++ ) |
| 1408 | { |
| 1409 | data = pVBInfo->TimingH[ 0 ].data[ i ]; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1410 | XGINew_SetReg1(pVBInfo->P3c4, (unsigned short)(i + 6), data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1411 | } |
| 1412 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1413 | j = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x0e); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1414 | j &= 0x1F ; |
| 1415 | data = pVBInfo->TimingH[ 0 ].data[ 7 ] ; |
| 1416 | data &= 0xE0 ; |
| 1417 | data |= j ; |
| 1418 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0e , data ) ; |
| 1419 | |
| 1420 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 1421 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1422 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x04); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1423 | data = data - 1 ; |
| 1424 | XGINew_SetReg1( pVBInfo->P3d4 , 0x04 , data ) ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1425 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x05); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1426 | data1 = data ; |
| 1427 | data1 &= 0xE0 ; |
| 1428 | data &= 0x1F ; |
| 1429 | if ( data == 0 ) |
| 1430 | { |
| 1431 | pushax = data ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1432 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x0c); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1433 | data &= 0xFB ; |
| 1434 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0c , data ) ; |
| 1435 | data = pushax ; |
| 1436 | } |
| 1437 | data = data - 1 ; |
| 1438 | data |= data1 ; |
| 1439 | XGINew_SetReg1( pVBInfo->P3d4 , 0x05 , data ) ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1440 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x0e); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1441 | data = data >> 5 ; |
| 1442 | data = data + 3 ; |
| 1443 | if ( data > 7 ) |
| 1444 | data = data - 7 ; |
| 1445 | data = data << 5 ; |
| 1446 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0e , ~0xE0 , data ) ; |
| 1447 | } |
| 1448 | } |
| 1449 | |
| 1450 | |
| 1451 | /* --------------------------------------------------------------------- */ |
| 1452 | /* Function : XGI_SetCRT1Timing_V */ |
| 1453 | /* Input : */ |
| 1454 | /* Output : */ |
| 1455 | /* Description : */ |
| 1456 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1457 | void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, |
| 1458 | unsigned short ModeNo, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 1459 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1460 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1461 | unsigned char data; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1462 | unsigned short i, j; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1463 | |
| 1464 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0 ) ; */ |
| 1465 | /* XGINew_SetReg1( pVBInfo->P3d4 , 0x56 , 0 ) ; */ |
| 1466 | /* XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , 0x7f , 0x00 ) ; */ |
| 1467 | |
| 1468 | for( i = 0x00 ; i <= 0x01 ; i++ ) |
| 1469 | { |
| 1470 | data = pVBInfo->TimingV[ 0 ].data[ i ] ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1471 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)(i + 6), data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1472 | } |
| 1473 | |
| 1474 | for( i = 0x02 ; i <= 0x03 ; i++ ) |
| 1475 | { |
| 1476 | data = pVBInfo->TimingV[ 0 ].data[ i ] ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1477 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)(i + 0x0e), data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1478 | } |
| 1479 | |
| 1480 | for( i = 0x04 ; i <= 0x05 ; i++ ) |
| 1481 | { |
| 1482 | data = pVBInfo->TimingV[ 0 ].data[ i ] ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1483 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)(i + 0x11), data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1484 | } |
| 1485 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1486 | j = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x0a); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1487 | j &= 0xC0 ; |
| 1488 | data = pVBInfo->TimingV[ 0 ].data[ 6 ] ; |
| 1489 | data &= 0x3F ; |
| 1490 | data |= j ; |
| 1491 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0a , data ) ; |
| 1492 | |
| 1493 | data = pVBInfo->TimingV[ 0 ].data[ 6 ] ; |
| 1494 | data &= 0x80 ; |
| 1495 | data = data >> 2 ; |
| 1496 | |
| 1497 | if ( ModeNo <= 0x13 ) |
| 1498 | i = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 1499 | else |
| 1500 | i = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 1501 | |
| 1502 | i &= DoubleScanMode ; |
| 1503 | if ( i ) |
| 1504 | data |= 0x80 ; |
| 1505 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1506 | j = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x09); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1507 | j &= 0x5F ; |
| 1508 | data |= j ; |
| 1509 | XGINew_SetReg1( pVBInfo->P3d4 , 0x09 , data ) ; |
| 1510 | } |
| 1511 | |
| 1512 | |
| 1513 | /* --------------------------------------------------------------------- */ |
| 1514 | /* Function : XGI_SetXG21CRTC */ |
| 1515 | /* Input : Stand or enhance CRTC table */ |
| 1516 | /* Output : Fill CRT Hsync/Vsync to SR2E/SR2F/SR30/SR33/SR34/SR3F */ |
| 1517 | /* Description : Set LCD timing */ |
| 1518 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1519 | void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 1520 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 1521 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1522 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1523 | unsigned char StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1524 | unsigned short Temp1, Temp2, Temp3; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1525 | |
| 1526 | if ( ModeNo <= 0x13 ) |
| 1527 | { |
| 1528 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 1529 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 4 ] ; /* CR04 HRS */ |
| 1530 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E [7:0]->HRS */ |
| 1531 | Tempbx = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 5 ] ; /* Tempbx: CR05 HRE */ |
| 1532 | Tempbx &= 0x1F ; /* Tempbx: HRE[4:0] */ |
| 1533 | Tempcx = Tempax ; |
| 1534 | Tempcx &= 0xE0 ; /* Tempcx: HRS[7:5] */ |
| 1535 | Tempdx = Tempcx | Tempbx ; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */ |
| 1536 | if ( Tempbx < ( Tempax & 0x1F ) ) /* IF HRE < HRS */ |
| 1537 | Tempdx |= 0x20 ; /* Tempdx: HRE = HRE + 0x20 */ |
| 1538 | Tempdx <<= 2 ; /* Tempdx << 2 */ |
| 1539 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempdx ) ; /* SR2F [7:2]->HRE */ |
| 1540 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; |
| 1541 | |
| 1542 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 16 ] ; /* Tempax: CR16 VRS */ |
| 1543 | Tempbx = Tempax ; /* Tempbx=Tempax */ |
| 1544 | Tempax &= 0x01 ; /* Tempax: VRS[0] */ |
| 1545 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x33 , Tempax ) ; /* SR33[0]->VRS */ |
| 1546 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; /* Tempax: CR7 VRS */ |
| 1547 | Tempdx = Tempbx >> 1 ; /* Tempdx: VRS[7:1] */ |
| 1548 | Tempcx = Tempax & 0x04 ; /* Tempcx: CR7[2] */ |
| 1549 | Tempcx <<= 5 ; /* Tempcx[7]: VRS[8] */ |
| 1550 | Tempdx |= Tempcx ; /* Tempdx: VRS[8:1] */ |
| 1551 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempdx ) ; /* SR34[7:0]: VRS[8:1] */ |
| 1552 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1553 | Temp1 = Tempcx << 1 ; /* Temp1[8]: VRS[8] unsigned char -> unsigned short */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1554 | Temp1 |= Tempbx ; /* Temp1[8:0]: VRS[8:0] */ |
| 1555 | Tempax &= 0x80 ; /* Tempax[7]: CR7[7] */ |
| 1556 | Temp2 = Tempax << 2 ; /* Temp2[9]: VRS[9] */ |
| 1557 | Temp1 |= Temp2 ; /* Temp1[9:0]: VRS[9:0] */ |
| 1558 | |
| 1559 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 17 ] ; /* CR16 VRE */ |
| 1560 | Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */ |
| 1561 | Temp2 = Temp1 & 0x3F0 ; /* Temp2[9:4]: VRS[9:4] */ |
| 1562 | Temp2 |= Tempax ; /* Temp2[9:0]: VRE[9:0] */ |
| 1563 | Temp3 = Temp1 & 0x0F ; /* Temp3[3:0]: VRS[3:0] */ |
| 1564 | if ( Tempax < Temp3 ) /* VRE[3:0]<VRS[3:0] */ |
| 1565 | Temp2 |= 0x10 ; /* Temp2: VRE + 0x10 */ |
| 1566 | Temp2 &= 0xFF ; /* Temp2[7:0]: VRE[7:0] */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1567 | Tempax = (unsigned char)Temp2; /* Tempax[7:0]: VRE[7:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1568 | Tempax <<= 2 ; /* Tempax << 2: VRE[5:0] */ |
| 1569 | Temp1 &= 0x600 ; /* Temp1[10:9]: VRS[10:9] */ |
| 1570 | Temp1 >>= 9 ; /* [10:9]->[1:0] */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1571 | Tempbx = (unsigned char)Temp1; /* Tempbx[1:0]: VRS[10:9] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1572 | Tempax |= Tempbx ; /* VRE[5:0]VRS[10:9] */ |
| 1573 | Tempax &= 0x7F ; |
| 1574 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , Tempax ) ; /* SR3F D[7:2]->VRE D[1:0]->VRS */ |
| 1575 | } |
| 1576 | else |
| 1577 | { |
| 1578 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 1579 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */ |
| 1580 | Tempcx = Tempax ; /* Tempcx: HRS */ |
| 1581 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E[7:0]->HRS */ |
| 1582 | |
| 1583 | Tempdx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SRB */ |
| 1584 | Tempdx &= 0xC0 ; /* Tempdx[7:6]: SRB[7:6] */ |
| 1585 | Temp1 = Tempdx ; /* Temp1[7:6]: HRS[9:8] */ |
| 1586 | Temp1 <<= 2 ; /* Temp1[9:8]: HRS[9:8] */ |
| 1587 | Temp1 |= Tempax ; /* Temp1[9:0]: HRS[9:0] */ |
| 1588 | |
| 1589 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 4 ] ; /* CR5 HRE */ |
| 1590 | Tempax &= 0x1F ; /* Tempax[4:0]: HRE[4:0] */ |
| 1591 | |
| 1592 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 6 ] ; /* SRC */ |
| 1593 | Tempbx &= 0x04 ; /* Tempbx[2]: HRE[5] */ |
| 1594 | Tempbx <<= 3 ; /* Tempbx[5]: HRE[5] */ |
| 1595 | Tempax |= Tempbx ; /* Tempax[5:0]: HRE[5:0] */ |
| 1596 | |
| 1597 | Temp2 = Temp1 & 0x3C0 ; /* Temp2[9:6]: HRS[9:6] */ |
| 1598 | Temp2 |= Tempax ; /* Temp2[9:0]: HRE[9:0] */ |
| 1599 | |
| 1600 | Tempcx &= 0x3F ; /* Tempcx[5:0]: HRS[5:0] */ |
| 1601 | if( Tempax < Tempcx ) /* HRE < HRS */ |
| 1602 | Temp2 |= 0x40 ; /* Temp2 + 0x40 */ |
| 1603 | |
| 1604 | Temp2 &= 0xFF ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1605 | Tempax = (unsigned char)Temp2; /* Tempax: HRE[7:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1606 | Tempax <<= 2 ; /* Tempax[7:2]: HRE[5:0] */ |
| 1607 | Tempdx >>= 6 ; /* Tempdx[7:6]->[1:0] HRS[9:8] */ |
| 1608 | Tempax |= Tempdx ; /* HRE[5:0]HRS[9:8] */ |
| 1609 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempax ) ; /* SR2F D[7:2]->HRE, D[1:0]->HRS */ |
| 1610 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; |
| 1611 | |
| 1612 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 10 ] ; /* CR10 VRS */ |
| 1613 | Tempbx = Tempax ; /* Tempbx: VRS */ |
| 1614 | Tempax &= 0x01 ; /* Tempax[0]: VRS[0] */ |
| 1615 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x33 , Tempax ) ; /* SR33[0]->VRS[0] */ |
| 1616 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 9 ] ; /* CR7[2][7] VRE */ |
| 1617 | Tempcx = Tempbx >> 1 ; /* Tempcx[6:0]: VRS[7:1] */ |
| 1618 | Tempdx = Tempax & 0x04 ; /* Tempdx[2]: CR7[2] */ |
| 1619 | Tempdx <<= 5 ; /* Tempdx[7]: VRS[8] */ |
| 1620 | Tempcx |= Tempdx ; /* Tempcx[7:0]: VRS[8:1] */ |
| 1621 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempcx ) ; /* SR34[8:1]->VRS */ |
| 1622 | |
| 1623 | Temp1 = Tempdx ; /* Temp1[7]: Tempdx[7] */ |
| 1624 | Temp1 <<= 1 ; /* Temp1[8]: VRS[8] */ |
| 1625 | Temp1 |= Tempbx ; /* Temp1[8:0]: VRS[8:0] */ |
| 1626 | Tempax &= 0x80 ; |
| 1627 | Temp2 = Tempax << 2 ; /* Temp2[9]: VRS[9] */ |
| 1628 | Temp1 |= Temp2 ; /* Temp1[9:0]: VRS[9:0] */ |
| 1629 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempax: SRA */ |
| 1630 | Tempax &= 0x08 ; /* Tempax[3]: VRS[3] */ |
| 1631 | Temp2 = Tempax ; |
| 1632 | Temp2 <<= 7 ; /* Temp2[10]: VRS[10] */ |
| 1633 | Temp1 |= Temp2 ; /* Temp1[10:0]: VRS[10:0] */ |
| 1634 | |
| 1635 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 11 ] ; /* Tempax: CR11 VRE */ |
| 1636 | Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */ |
| 1637 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempbx: SRA */ |
| 1638 | Tempbx &= 0x20 ; /* Tempbx[5]: VRE[5] */ |
| 1639 | Tempbx >>= 1 ; /* Tempbx[4]: VRE[4] */ |
| 1640 | Tempax |= Tempbx ; /* Tempax[4:0]: VRE[4:0] */ |
| 1641 | Temp2 = Temp1 & 0x7E0 ; /* Temp2[10:5]: VRS[10:5] */ |
| 1642 | Temp2 |= Tempax ; /* Temp2[10:5]: VRE[10:5] */ |
| 1643 | |
| 1644 | Temp3 = Temp1 & 0x1F ; /* Temp3[4:0]: VRS[4:0] */ |
| 1645 | if ( Tempax < Temp3 ) /* VRE < VRS */ |
| 1646 | Temp2 |= 0x20 ; /* VRE + 0x20 */ |
| 1647 | |
| 1648 | Temp2 &= 0xFF ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1649 | Tempax = (unsigned char)Temp2; /* Tempax: VRE[7:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1650 | Tempax <<= 2 ; /* Tempax[7:0]; VRE[5:0]00 */ |
| 1651 | Temp1 &= 0x600 ; /* Temp1[10:9]: VRS[10:9] */ |
| 1652 | Temp1 >>= 9 ; /* Temp1[1:0]: VRS[10:9] */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1653 | Tempbx = (unsigned char)Temp1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1654 | Tempax |= Tempbx ; /* Tempax[7:0]: VRE[5:0]VRS[10:9] */ |
| 1655 | Tempax &= 0x7F ; |
| 1656 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , Tempax ) ; /* SR3F D[7:2]->VRE D[1:0]->VRS */ |
| 1657 | } |
| 1658 | } |
| 1659 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1660 | void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 1661 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 1662 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1663 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1664 | unsigned short StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1665 | |
| 1666 | if ( ModeNo <= 0x13 ) |
| 1667 | { |
| 1668 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 1669 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 4 ] ; /* CR04 HRS */ |
| 1670 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E [7:0]->HRS */ |
| 1671 | Tempbx = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 5 ] ; /* Tempbx: CR05 HRE */ |
| 1672 | Tempbx &= 0x1F ; /* Tempbx: HRE[4:0] */ |
| 1673 | Tempcx = Tempax ; |
| 1674 | Tempcx &= 0xE0 ; /* Tempcx: HRS[7:5] */ |
| 1675 | Tempdx = Tempcx | Tempbx ; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */ |
| 1676 | if ( Tempbx < ( Tempax & 0x1F ) ) /* IF HRE < HRS */ |
| 1677 | Tempdx |= 0x20 ; /* Tempdx: HRE = HRE + 0x20 */ |
| 1678 | Tempdx <<= 2 ; /* Tempdx << 2 */ |
| 1679 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempdx ) ; /* SR2F [7:2]->HRE */ |
| 1680 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; |
| 1681 | |
| 1682 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 16 ] ; /* Tempax: CR10 VRS */ |
| 1683 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempax ) ; /* SR34[7:0]->VRS */ |
| 1684 | Tempcx = Tempax ; /* Tempcx=Tempax=VRS[7:0] */ |
| 1685 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; /* Tempax[7][2]: CR7[7][2] VRS[9][8] */ |
| 1686 | Tempbx = Tempax ; /* Tempbx=CR07 */ |
| 1687 | Tempax &= 0x04 ; /* Tempax[2]: CR07[2] VRS[8] */ |
| 1688 | Tempax >>= 2; |
| 1689 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x01, Tempax ) ; /* SR35 D[0]->VRS D[8] */ |
| 1690 | Tempcx |= (Tempax << 8) ; /* Tempcx[8] |= VRS[8] */ |
| 1691 | Tempcx |= (Tempbx & 0x80)<<2; /* Tempcx[9] |= VRS[9] */ |
| 1692 | |
| 1693 | |
| 1694 | Tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 17 ] ; /* CR11 VRE */ |
| 1695 | Tempax &= 0x0F ; /* Tempax: VRE[3:0] */ |
| 1696 | Tempbx = Tempcx ; /* Tempbx=Tempcx=VRS[9:0] */ |
| 1697 | Tempbx &= 0x3F0 ; /* Tempbx[9:4]: VRS[9:4] */ |
| 1698 | Tempbx |= Tempax ; /* Tempbx[9:0]: VRE[9:0] */ |
| 1699 | if ( Tempax <= (Tempcx & 0x0F) ) /* VRE[3:0]<=VRS[3:0] */ |
| 1700 | Tempbx |= 0x10 ; /* Tempbx: VRE + 0x10 */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1701 | Tempax = (unsigned char)Tempbx & 0xFF; /* Tempax[7:0]: VRE[7:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1702 | Tempax <<= 2 ; /* Tempax << 2: VRE[5:0] */ |
| 1703 | Tempcx = (Tempcx&0x600)>>8; /* Tempcx VRS[10:9] */ |
| 1704 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC, Tempax ) ; /* SR3F D[7:2]->VRE D[5:0] */ |
| 1705 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x06, Tempcx ) ; /* SR35 D[2:1]->VRS[10:9] */ |
| 1706 | } |
| 1707 | else |
| 1708 | { |
| 1709 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 1710 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */ |
| 1711 | Tempbx = Tempax ; /* Tempbx: HRS[7:0] */ |
| 1712 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , Tempax ) ; /* SR2E[7:0]->HRS */ |
| 1713 | |
| 1714 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SR0B */ |
| 1715 | Tempax &= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ |
| 1716 | Tempbx |= (Tempax << 2); /* Tempbx: HRS[9:0] */ |
| 1717 | |
| 1718 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 4 ] ; /* CR5 HRE */ |
| 1719 | Tempax &= 0x1F ; /* Tempax[4:0]: HRE[4:0] */ |
| 1720 | Tempcx = Tempax ; /* Tempcx: HRE[4:0] */ |
| 1721 | |
| 1722 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 6 ] ; /* SRC */ |
| 1723 | Tempax &= 0x04 ; /* Tempax[2]: HRE[5] */ |
| 1724 | Tempax <<= 3 ; /* Tempax[5]: HRE[5] */ |
| 1725 | Tempcx |= Tempax ; /* Tempcx[5:0]: HRE[5:0] */ |
| 1726 | |
| 1727 | Tempbx = Tempbx & 0x3C0 ; /* Tempbx[9:6]: HRS[9:6] */ |
| 1728 | Tempbx |= Tempcx ; /* Tempbx: HRS[9:6]HRE[5:0] */ |
| 1729 | |
| 1730 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 3 ] ; /* Tempax: CR4 HRS */ |
| 1731 | Tempax &= 0x3F ; /* Tempax: HRS[5:0] */ |
| 1732 | if( Tempcx <= Tempax ) /* HRE[5:0] < HRS[5:0] */ |
| 1733 | Tempbx += 0x40 ; /* Tempbx= Tempbx + 0x40 : HRE[9:0]*/ |
| 1734 | |
| 1735 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 5 ] ; /* SR0B */ |
| 1736 | Tempax &= 0xC0 ; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ |
| 1737 | Tempax >>= 6; /* Tempax[1:0]: HRS[9:8]*/ |
| 1738 | Tempax |= ((Tempbx << 2) & 0xFF); /* Tempax[7:2]: HRE[5:0] */ |
| 1739 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , Tempax ) ; /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */ |
| 1740 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , 0xE3 , 00 ) ; |
| 1741 | |
| 1742 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 10 ] ; /* CR10 VRS */ |
| 1743 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , Tempax ) ; /* SR34[7:0]->VRS[7:0] */ |
| 1744 | |
| 1745 | Tempcx = Tempax ; /* Tempcx <= VRS[7:0] */ |
| 1746 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 9 ] ; /* CR7[7][2] VRS[9][8] */ |
| 1747 | Tempbx = Tempax ; /* Tempbx <= CR07[7:0] */ |
| 1748 | Tempax = Tempax & 0x04 ; /* Tempax[2]: CR7[2]: VRS[8] */ |
| 1749 | Tempax >>= 2 ; /* Tempax[0]: VRS[8] */ |
| 1750 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x01 , Tempax ) ; /* SR35[0]: VRS[8] */ |
| 1751 | Tempcx |= (Tempax<<8) ; /* Tempcx <= VRS[8:0] */ |
| 1752 | Tempcx |= ((Tempbx&0x80)<<2) ; /* Tempcx <= VRS[9:0] */ |
| 1753 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempax: SR0A */ |
| 1754 | Tempax &= 0x08; /* SR0A[3] VRS[10] */ |
| 1755 | Tempcx |= (Tempax<<7) ; /* Tempcx <= VRS[10:0] */ |
| 1756 | |
| 1757 | |
| 1758 | Tempax = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 11 ] ; /* Tempax: CR11 VRE */ |
| 1759 | Tempax &= 0x0F ; /* Tempax[3:0]: VRE[3:0] */ |
| 1760 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[ index ].CR[ 14 ] ; /* Tempbx: SR0A */ |
| 1761 | Tempbx &= 0x20 ; /* Tempbx[5]: SR0A[5]: VRE[4] */ |
| 1762 | Tempbx >>= 1 ; /* Tempbx[4]: VRE[4] */ |
| 1763 | Tempax |= Tempbx ; /* Tempax[4:0]: VRE[4:0] */ |
| 1764 | Tempbx = Tempcx ; /* Tempbx: VRS[10:0] */ |
| 1765 | Tempbx &= 0x7E0 ; /* Tempbx[10:5]: VRS[10:5] */ |
| 1766 | Tempbx |= Tempax ; /* Tempbx: VRS[10:5]VRE[4:0] */ |
| 1767 | |
| 1768 | if ( Tempbx <= Tempcx ) /* VRE <= VRS */ |
| 1769 | Tempbx |= 0x20 ; /* VRE + 0x20 */ |
| 1770 | |
| 1771 | Tempax = (Tempbx<<2) & 0xFF ; /* Tempax: Tempax[7:0]; VRE[5:0]00 */ |
| 1772 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , Tempax ) ; /* SR3F[7:2]:VRE[5:0] */ |
| 1773 | Tempax = Tempcx >> 8; |
| 1774 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x07 , Tempax ) ; /* SR35[2:0]:VRS[10:8] */ |
| 1775 | } |
| 1776 | } |
| 1777 | |
| 1778 | |
| 1779 | /* --------------------------------------------------------------------- */ |
| 1780 | /* Function : XGI_SetXG21LCD */ |
| 1781 | /* Input : */ |
| 1782 | /* Output : FCLK duty cycle, FCLK delay compensation */ |
| 1783 | /* Description : All values set zero */ |
| 1784 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 1785 | void XGI_SetXG21LCD(struct vb_device_info *pVBInfo, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1786 | unsigned short RefreshRateTableIndex, |
| 1787 | unsigned short ModeNo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1788 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1789 | unsigned short Data, Temp, b3CC; |
| 1790 | unsigned short XGI_P3cc; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1791 | |
| 1792 | XGI_P3cc = pVBInfo->P3cc ; |
| 1793 | |
| 1794 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , 0x00 ) ; |
| 1795 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , 0x00 ) ; |
| 1796 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x00 ) ; |
| 1797 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x00 ) ; |
| 1798 | if ( ((*pVBInfo->pDVOSetting)&0xC0) == 0xC0 ) |
| 1799 | { |
| 1800 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , *pVBInfo->pCR2E ) ; |
| 1801 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , *pVBInfo->pCR2F ) ; |
| 1802 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , *pVBInfo->pCR46 ) ; |
| 1803 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , *pVBInfo->pCR47 ) ; |
| 1804 | } |
| 1805 | |
| 1806 | Temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; |
| 1807 | |
| 1808 | if ( Temp & 0x01 ) |
| 1809 | { |
| 1810 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x06 , 0x40 ) ; /* 18 bits FP */ |
| 1811 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x09 , 0x40 ) ; |
| 1812 | } |
| 1813 | |
| 1814 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x01 ) ; /* Negative blank polarity */ |
| 1815 | |
| 1816 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x30 , ~0x20 ) ; |
| 1817 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x35 , ~0x80 ) ; |
| 1818 | |
| 1819 | if ( ModeNo <= 0x13 ) |
| 1820 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1821 | b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1822 | if ( b3CC & 0x40 ) |
| 1823 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ |
| 1824 | if ( b3CC & 0x80 ) |
| 1825 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ |
| 1826 | } |
| 1827 | else |
| 1828 | { |
| 1829 | Data = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 1830 | if ( Data & 0x4000 ) |
| 1831 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ |
| 1832 | if ( Data & 0x8000 ) |
| 1833 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ |
| 1834 | } |
| 1835 | } |
| 1836 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 1837 | void XGI_SetXG27LCD(struct vb_device_info *pVBInfo, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1838 | unsigned short RefreshRateTableIndex, |
| 1839 | unsigned short ModeNo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1840 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1841 | unsigned short Data , Temp , b3CC ; |
| 1842 | unsigned short XGI_P3cc ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1843 | |
| 1844 | XGI_P3cc = pVBInfo->P3cc ; |
| 1845 | |
| 1846 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , 0x00 ) ; |
| 1847 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , 0x00 ) ; |
| 1848 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x00 ) ; |
| 1849 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x00 ) ; |
| 1850 | |
| 1851 | Temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; |
| 1852 | if ( ( Temp & 0x03 ) == 0 ) /* dual 12 */ |
| 1853 | { |
| 1854 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , 0x13 ) ; |
| 1855 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , 0x13 ) ; |
| 1856 | } |
| 1857 | |
| 1858 | if ( ((*pVBInfo->pDVOSetting)&0xC0) == 0xC0 ) |
| 1859 | { |
| 1860 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2E , *pVBInfo->pCR2E ) ; |
| 1861 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2F , *pVBInfo->pCR2F ) ; |
| 1862 | XGINew_SetReg1( pVBInfo->P3d4 , 0x46 , *pVBInfo->pCR46 ) ; |
| 1863 | XGINew_SetReg1( pVBInfo->P3d4 , 0x47 , *pVBInfo->pCR47 ) ; |
| 1864 | } |
| 1865 | |
| 1866 | XGI_SetXG27FPBits(pVBInfo); |
| 1867 | |
| 1868 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x01 ) ; /* Negative blank polarity */ |
| 1869 | |
| 1870 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x30 , ~0x20 ) ; /* Hsync polarity */ |
| 1871 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x35 , ~0x80 ) ; /* Vsync polarity */ |
| 1872 | |
| 1873 | if ( ModeNo <= 0x13 ) |
| 1874 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1875 | b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1876 | if ( b3CC & 0x40 ) |
| 1877 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ |
| 1878 | if ( b3CC & 0x80 ) |
| 1879 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ |
| 1880 | } |
| 1881 | else |
| 1882 | { |
| 1883 | Data = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 1884 | if ( Data & 0x4000 ) |
| 1885 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x30 , 0x20 ) ; /* Hsync polarity */ |
| 1886 | if ( Data & 0x8000 ) |
| 1887 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x35 , 0x80 ) ; /* Vsync polarity */ |
| 1888 | } |
| 1889 | } |
| 1890 | |
| 1891 | /* --------------------------------------------------------------------- */ |
| 1892 | /* Function : XGI_UpdateXG21CRTC */ |
| 1893 | /* Input : */ |
| 1894 | /* Output : CRT1 CRTC */ |
| 1895 | /* Description : Modify CRT1 Hsync/Vsync to fix LCD mode timing */ |
| 1896 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1897 | void XGI_UpdateXG21CRTC(unsigned short ModeNo, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 1898 | struct vb_device_info *pVBInfo, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1899 | unsigned short RefreshRateTableIndex) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1900 | { |
| 1901 | int i , index = -1; |
| 1902 | |
| 1903 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x11 , 0x7F ) ; /* Unlock CR0~7 */ |
| 1904 | if ( ModeNo <= 0x13 ) |
| 1905 | { |
| 1906 | for( i = 0 ; i < 12 ; i++ ) |
| 1907 | { |
| 1908 | if ( ModeNo == pVBInfo->UpdateCRT1[ i ].ModeID ) |
| 1909 | index = i ; |
| 1910 | } |
| 1911 | } |
| 1912 | else |
| 1913 | { |
| 1914 | if ( ModeNo == 0x2E && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC == RES640x480x60 ) ) |
| 1915 | index = 12 ; |
| 1916 | else if ( ModeNo == 0x2E && ( pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC == RES640x480x72 ) ) |
| 1917 | index = 13 ; |
| 1918 | else if ( ModeNo == 0x2F ) |
| 1919 | index = 14 ; |
| 1920 | else if ( ModeNo == 0x50 ) |
| 1921 | index = 15 ; |
| 1922 | else if ( ModeNo == 0x59 ) |
| 1923 | index = 16 ; |
| 1924 | } |
| 1925 | |
| 1926 | if( index != -1 ) |
| 1927 | { |
| 1928 | XGINew_SetReg1( pVBInfo->P3d4 , 0x02 , pVBInfo->UpdateCRT1[ index ].CR02 ) ; |
| 1929 | XGINew_SetReg1( pVBInfo->P3d4 , 0x03 , pVBInfo->UpdateCRT1[ index ].CR03 ) ; |
| 1930 | XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , pVBInfo->UpdateCRT1[ index ].CR15 ) ; |
| 1931 | XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , pVBInfo->UpdateCRT1[ index ].CR16 ) ; |
| 1932 | } |
| 1933 | } |
| 1934 | |
| 1935 | |
| 1936 | /* --------------------------------------------------------------------- */ |
| 1937 | /* Function : XGI_SetCRT1DE */ |
| 1938 | /* Input : */ |
| 1939 | /* Output : */ |
| 1940 | /* Description : */ |
| 1941 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 1942 | void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1943 | unsigned short ModeNo, |
| 1944 | unsigned short ModeIdIndex, |
| 1945 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 1946 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1947 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1948 | unsigned short resindex, tempax, tempbx, tempcx, temp, modeflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1949 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1950 | unsigned char data; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1951 | |
| 1952 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 1953 | |
| 1954 | if ( ModeNo <= 0x13 ) |
| 1955 | { |
| 1956 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 1957 | tempax = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 1958 | tempbx = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 1959 | } |
| 1960 | else |
| 1961 | { |
| 1962 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 1963 | tempax = pVBInfo->ModeResInfo[ resindex ].HTotal ; |
| 1964 | tempbx = pVBInfo->ModeResInfo[ resindex ].VTotal ; |
| 1965 | } |
| 1966 | |
| 1967 | if ( modeflag & HalfDCLK ) |
| 1968 | tempax = tempax >> 1 ; |
| 1969 | |
| 1970 | if ( ModeNo > 0x13 ) |
| 1971 | { |
| 1972 | if ( modeflag & HalfDCLK ) |
| 1973 | tempax = tempax << 1 ; |
| 1974 | |
| 1975 | temp = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 1976 | |
| 1977 | if ( temp & InterlaceMode ) |
| 1978 | tempbx = tempbx >> 1 ; |
| 1979 | |
| 1980 | if ( modeflag & DoubleScanMode ) |
| 1981 | tempbx = tempbx << 1 ; |
| 1982 | } |
| 1983 | |
| 1984 | tempcx = 8 ; |
| 1985 | |
| 1986 | /* if ( !( modeflag & Charx8Dot ) ) */ |
| 1987 | /* tempcx = 9 ; */ |
| 1988 | |
| 1989 | tempax /= tempcx ; |
| 1990 | tempax -= 1 ; |
| 1991 | tempbx -= 1 ; |
| 1992 | tempcx = tempax ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1993 | temp = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
| 1994 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1995 | data &= 0x7F ; |
| 1996 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , data ) ; /* Unlock CRTC */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1997 | XGINew_SetReg1(pVBInfo->P3d4, 0x01, (unsigned short)(tempcx & 0xff)); |
| 1998 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x0b, ~0x0c, (unsigned short)((tempcx & 0x0ff00) >> 10)); |
| 1999 | XGINew_SetReg1(pVBInfo->P3d4, 0x12, (unsigned short)(tempbx & 0xff)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2000 | tempax = 0 ; |
| 2001 | tempbx = tempbx >> 8 ; |
| 2002 | |
| 2003 | if ( tempbx & 0x01 ) |
| 2004 | tempax |= 0x02 ; |
| 2005 | |
| 2006 | if ( tempbx & 0x02 ) |
| 2007 | tempax |= 0x40 ; |
| 2008 | |
| 2009 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x42 , tempax ) ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 2010 | data = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x07); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2011 | data &= 0xFF ; |
| 2012 | tempax = 0 ; |
| 2013 | |
| 2014 | if ( tempbx & 0x04 ) |
| 2015 | tempax |= 0x02 ; |
| 2016 | |
| 2017 | XGINew_SetRegANDOR( pVBInfo->P3d4 ,0x0a , ~0x02 , tempax ) ; |
| 2018 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp ) ; |
| 2019 | } |
| 2020 | |
| 2021 | |
| 2022 | /* --------------------------------------------------------------------- */ |
| 2023 | /* Function : XGI_GetResInfo */ |
| 2024 | /* Input : */ |
| 2025 | /* Output : */ |
| 2026 | /* Description : */ |
| 2027 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2028 | unsigned short XGI_GetResInfo(unsigned short ModeNo, |
| 2029 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2030 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2031 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2032 | unsigned short resindex; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2033 | |
| 2034 | if ( ModeNo <= 0x13 ) |
| 2035 | { |
| 2036 | resindex = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ |
| 2037 | } |
| 2038 | else |
| 2039 | { |
| 2040 | resindex = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ |
| 2041 | } |
| 2042 | return( resindex ) ; |
| 2043 | } |
| 2044 | |
| 2045 | |
| 2046 | /* --------------------------------------------------------------------- */ |
| 2047 | /* Function : XGI_SetCRT1Offset */ |
| 2048 | /* Input : */ |
| 2049 | /* Output : */ |
| 2050 | /* Description : */ |
| 2051 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2052 | void XGI_SetCRT1Offset(unsigned short ModeNo, |
| 2053 | unsigned short ModeIdIndex, |
| 2054 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 2055 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2056 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2057 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2058 | unsigned short temp , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2059 | ah , |
| 2060 | al , |
| 2061 | temp2 , |
| 2062 | i , |
| 2063 | DisplayUnit ; |
| 2064 | |
| 2065 | /* GetOffset */ |
| 2066 | temp = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeInfo ; |
| 2067 | temp = temp >> 8 ; |
| 2068 | temp = pVBInfo->ScreenOffset[ temp ] ; |
| 2069 | |
| 2070 | temp2 = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 2071 | temp2 &= InterlaceMode ; |
| 2072 | |
| 2073 | if ( temp2 ) |
| 2074 | temp = temp << 1; |
| 2075 | |
| 2076 | temp2 = pVBInfo->ModeType - ModeEGA ; |
| 2077 | |
| 2078 | switch( temp2 ) |
| 2079 | { |
| 2080 | case 0: |
| 2081 | temp2 = 1 ; |
| 2082 | break ; |
| 2083 | case 1: |
| 2084 | temp2 = 2 ; |
| 2085 | break ; |
| 2086 | case 2: |
| 2087 | temp2 = 4 ; |
| 2088 | break ; |
| 2089 | case 3: |
| 2090 | temp2 = 4 ; |
| 2091 | break ; |
| 2092 | case 4: |
| 2093 | temp2 = 6 ; |
| 2094 | break; |
| 2095 | case 5: |
| 2096 | temp2 = 8 ; |
| 2097 | break ; |
| 2098 | default: |
| 2099 | break ; |
| 2100 | } |
| 2101 | |
| 2102 | if ( ( ModeNo >= 0x26 ) && ( ModeNo <= 0x28 ) ) |
| 2103 | temp = temp * temp2 + temp2 / 2 ; |
| 2104 | else |
| 2105 | temp *= temp2 ; |
| 2106 | |
| 2107 | /* SetOffset */ |
| 2108 | DisplayUnit = temp ; |
| 2109 | temp2 = temp ; |
| 2110 | temp = temp >> 8 ; /* ah */ |
| 2111 | temp &= 0x0F ; |
| 2112 | i = XGINew_GetReg1( pVBInfo->P3c4 , 0x0E ) ; |
| 2113 | i &= 0xF0 ; |
| 2114 | i |= temp ; |
| 2115 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0E , i ) ; |
| 2116 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 2117 | temp = (unsigned char)temp2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2118 | temp &= 0xFF ; /* al */ |
| 2119 | XGINew_SetReg1( pVBInfo->P3d4 , 0x13 , temp ) ; |
| 2120 | |
| 2121 | /* SetDisplayUnit */ |
| 2122 | temp2 = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 2123 | temp2 &= InterlaceMode ; |
| 2124 | if ( temp2 ) |
| 2125 | DisplayUnit >>= 1 ; |
| 2126 | |
| 2127 | DisplayUnit = DisplayUnit << 5 ; |
| 2128 | ah = ( DisplayUnit & 0xff00 ) >> 8 ; |
| 2129 | al = DisplayUnit & 0x00ff ; |
| 2130 | if ( al == 0 ) |
| 2131 | ah += 1 ; |
| 2132 | else |
| 2133 | ah += 2 ; |
| 2134 | |
| 2135 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 2136 | if ( ( ModeNo == 0x4A ) | (ModeNo == 0x49 ) ) |
| 2137 | ah -= 1 ; |
| 2138 | |
| 2139 | XGINew_SetReg1( pVBInfo->P3c4 , 0x10 , ah ) ; |
| 2140 | } |
| 2141 | |
| 2142 | |
| 2143 | /* --------------------------------------------------------------------- */ |
| 2144 | /* Function : XGI_SetCRT1VCLK */ |
| 2145 | /* Input : */ |
| 2146 | /* Output : */ |
| 2147 | /* Description : */ |
| 2148 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2149 | void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 2150 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2151 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2152 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2153 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 2154 | unsigned char index, data; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2155 | unsigned short vclkindex ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2156 | |
| 2157 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 2158 | { |
| 2159 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; |
| 2160 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ; |
| 2161 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ; |
| 2162 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ index ].SR2B ) ; |
| 2163 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ index ].SR2C ) ; |
| 2164 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ; |
| 2165 | } |
| 2166 | else if ( ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) && ( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 2167 | { |
| 2168 | vclkindex = XGI_GetVCLK2Ptr( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 2169 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ; |
| 2170 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ; |
| 2171 | data = pVBInfo->VBVCLKData[ vclkindex ].Part4_A ; |
| 2172 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , data ) ; |
| 2173 | data = pVBInfo->VBVCLKData[ vclkindex ].Part4_B ; |
| 2174 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , data ) ; |
| 2175 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ; |
| 2176 | } |
| 2177 | else |
| 2178 | { |
| 2179 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; |
| 2180 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x31 ) & 0xCF ; |
| 2181 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , data ) ; |
| 2182 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->VCLKData[ index ].SR2B ) ; |
| 2183 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->VCLKData[ index ].SR2C ) ; |
| 2184 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2D , 0x01 ) ; |
| 2185 | } |
| 2186 | |
| 2187 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 2188 | { |
| 2189 | if ( pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag & HalfDCLK ) |
| 2190 | { |
| 2191 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x2B ) ; |
| 2192 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , data ) ; |
| 2193 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x2C ) ; |
| 2194 | index = data ; |
| 2195 | index &= 0xE0 ; |
| 2196 | data &= 0x1F ; |
| 2197 | data = data << 1 ; |
| 2198 | data += 1 ; |
| 2199 | data |= index ; |
| 2200 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , data ) ; |
| 2201 | } |
| 2202 | } |
| 2203 | } |
| 2204 | |
| 2205 | |
| 2206 | /* --------------------------------------------------------------------- */ |
| 2207 | /* Function : XGI_SetCRT1FIFO */ |
| 2208 | /* Input : */ |
| 2209 | /* Output : */ |
| 2210 | /* Description : */ |
| 2211 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2212 | void XGI_SetCRT1FIFO(unsigned short ModeNo, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 2213 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2214 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2215 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2216 | unsigned short data ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2217 | |
| 2218 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x3D ) ; |
| 2219 | data &= 0xfe ; |
| 2220 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3D , data ) ; /* diable auto-threshold */ |
| 2221 | |
| 2222 | if ( ModeNo > 0x13 ) |
| 2223 | { |
| 2224 | XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0x34 ) ; |
| 2225 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ; |
| 2226 | data &= 0xC0 ; |
| 2227 | XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data | 0x30) ; |
| 2228 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x3D ) ; |
| 2229 | data |= 0x01 ; |
| 2230 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3D , data ) ; |
| 2231 | } |
| 2232 | else |
| 2233 | { |
| 2234 | if (HwDeviceExtension->jChipType == XG27) |
| 2235 | { |
| 2236 | XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0x0E ) ; |
| 2237 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ; |
| 2238 | data &= 0xC0 ; |
| 2239 | XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data | 0x20 ) ; |
| 2240 | } |
| 2241 | else |
| 2242 | { |
| 2243 | XGINew_SetReg1( pVBInfo->P3c4 , 0x08 , 0xAE ) ; |
| 2244 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x09 ) ; |
| 2245 | data &= 0xF0 ; |
| 2246 | XGINew_SetReg1( pVBInfo->P3c4 , 0x09 , data ) ; |
| 2247 | } |
| 2248 | } |
| 2249 | |
| 2250 | if (HwDeviceExtension->jChipType == XG21) |
| 2251 | { |
| 2252 | XGI_SetXG21FPBits(pVBInfo); /* Fix SR9[7:6] can't read back */ |
| 2253 | } |
| 2254 | } |
| 2255 | |
| 2256 | |
| 2257 | /* --------------------------------------------------------------------- */ |
| 2258 | /* Function : XGI_SetCRT1ModeRegs */ |
| 2259 | /* Input : */ |
| 2260 | /* Output : */ |
| 2261 | /* Description : */ |
| 2262 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 2263 | void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2264 | unsigned short ModeNo, unsigned short ModeIdIndex, |
| 2265 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2266 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2267 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2268 | unsigned short data , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2269 | data2 , |
| 2270 | data3 , |
| 2271 | infoflag = 0 , |
| 2272 | modeflag , |
| 2273 | resindex , |
| 2274 | xres ; |
| 2275 | |
| 2276 | if ( ModeNo > 0x13 ) |
| 2277 | { |
| 2278 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 2279 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 2280 | } |
| 2281 | else |
| 2282 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */ |
| 2283 | |
| 2284 | if ( XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) & 0x01 ) |
| 2285 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x1F , 0x3F , 0x00 ) ; |
| 2286 | |
| 2287 | if ( ModeNo > 0x13 ) |
| 2288 | data = infoflag ; |
| 2289 | else |
| 2290 | data = 0 ; |
| 2291 | |
| 2292 | data2 = 0 ; |
| 2293 | |
| 2294 | if ( ModeNo > 0x13 ) |
| 2295 | { |
| 2296 | if ( pVBInfo->ModeType > 0x02 ) |
| 2297 | { |
| 2298 | data2 |= 0x02 ; |
| 2299 | data3 = pVBInfo->ModeType - ModeVGA ; |
| 2300 | data3 = data3 << 2 ; |
| 2301 | data2 |= data3 ; |
| 2302 | } |
| 2303 | } |
| 2304 | |
| 2305 | data &= InterlaceMode ; |
| 2306 | |
| 2307 | if ( data ) |
| 2308 | data2 |= 0x20 ; |
| 2309 | |
| 2310 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0x3F , data2 ) ; |
| 2311 | /* XGINew_SetReg1(pVBInfo->P3c4,0x06,data2); */ |
| 2312 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 2313 | if ( ModeNo <= 0x13 ) |
| 2314 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 2315 | else |
| 2316 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 2317 | |
| 2318 | data = 0x0000 ; |
| 2319 | if ( infoflag & InterlaceMode ) |
| 2320 | { |
| 2321 | if ( xres == 1024 ) |
| 2322 | data = 0x0035 ; |
| 2323 | else if ( xres == 1280 ) |
| 2324 | data = 0x0048 ; |
| 2325 | } |
| 2326 | |
| 2327 | data2 = data & 0x00FF ; |
| 2328 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x19 , 0xFF , data2 ) ; |
| 2329 | data2 = ( data & 0xFF00 ) >> 8 ; |
| 2330 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x19 , 0xFC , data2 ) ; |
| 2331 | |
| 2332 | if( modeflag & HalfDCLK ) |
| 2333 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xF7 , 0x08 ) ; |
| 2334 | |
| 2335 | data2 = 0 ; |
| 2336 | |
| 2337 | if ( modeflag & LineCompareOff ) |
| 2338 | data2 |= 0x08 ; |
| 2339 | |
| 2340 | if ( ModeNo > 0x13 ) |
| 2341 | { |
| 2342 | if ( pVBInfo->ModeType == ModeEGA ) |
| 2343 | data2 |= 0x40 ; |
| 2344 | } |
| 2345 | |
| 2346 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0F , ~0x48 , data2 ) ; |
| 2347 | data = 0x60 ; |
| 2348 | if ( pVBInfo->ModeType != ModeText ) |
| 2349 | { |
| 2350 | data = data ^ 0x60 ; |
| 2351 | if ( pVBInfo->ModeType != ModeEGA ) |
| 2352 | { |
| 2353 | data = data ^ 0xA0 ; |
| 2354 | } |
| 2355 | } |
| 2356 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x21 , 0x1F , data ) ; |
| 2357 | |
| 2358 | XGI_SetVCLKState( HwDeviceExtension , ModeNo , RefreshRateTableIndex, pVBInfo) ; |
| 2359 | |
| 2360 | /* if(modeflag&HalfDCLK)//030305 fix lowresolution bug */ |
| 2361 | /* if(XGINew_IF_DEF_NEW_LOWRES) */ |
| 2362 | /* XGI_VesaLowResolution(ModeNo,ModeIdIndex);//030305 fix lowresolution bug */ |
| 2363 | |
| 2364 | data=XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) ; |
| 2365 | |
| 2366 | if (HwDeviceExtension->jChipType == XG27 ) |
| 2367 | { |
| 2368 | if ( data & 0x40 ) |
| 2369 | data = 0x2c ; |
| 2370 | else |
| 2371 | data = 0x6c ; |
| 2372 | XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ; |
| 2373 | XGINew_SetRegOR( pVBInfo->P3d4 , 0x51 , 0x10 ) ; |
| 2374 | } |
| 2375 | else |
| 2376 | if (HwDeviceExtension->jChipType >= XG20 ) |
| 2377 | { |
| 2378 | if ( data & 0x40 ) |
| 2379 | data = 0x33 ; |
| 2380 | else |
| 2381 | data = 0x73 ; |
| 2382 | XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ; |
| 2383 | XGINew_SetReg1( pVBInfo->P3d4 , 0x51 , 0x02 ) ; |
| 2384 | } |
| 2385 | else |
| 2386 | { |
| 2387 | if ( data & 0x40 ) |
| 2388 | data = 0x2c ; |
| 2389 | else |
| 2390 | data = 0x6c ; |
| 2391 | XGINew_SetReg1( pVBInfo->P3d4 , 0x52 , data ) ; |
| 2392 | } |
| 2393 | |
| 2394 | } |
| 2395 | |
| 2396 | |
| 2397 | /* --------------------------------------------------------------------- */ |
| 2398 | /* Function : XGI_SetVCLKState */ |
| 2399 | /* Input : */ |
| 2400 | /* Output : */ |
| 2401 | /* Description : */ |
| 2402 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 2403 | void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2404 | unsigned short ModeNo, |
| 2405 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2406 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2407 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2408 | unsigned short data , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2409 | data2 = 0 ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 2410 | short VCLK ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2411 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 2412 | unsigned char index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2413 | |
| 2414 | if ( ModeNo <= 0x13 ) |
| 2415 | VCLK = 0 ; |
| 2416 | else |
| 2417 | { |
| 2418 | index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; |
| 2419 | index &= IndexMask ; |
| 2420 | VCLK = pVBInfo->VCLKData[ index ].CLOCK ; |
| 2421 | } |
| 2422 | |
| 2423 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x32 ) ; |
| 2424 | data &= 0xf3 ; |
| 2425 | if ( VCLK >= 200 ) |
| 2426 | data |= 0x0c ; /* VCLK > 200 */ |
| 2427 | |
| 2428 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 2429 | data &= ~0x04 ; /* 2 pixel mode */ |
| 2430 | |
| 2431 | XGINew_SetReg1( pVBInfo->P3c4 , 0x32 , data ) ; |
| 2432 | |
| 2433 | if ( HwDeviceExtension->jChipType < XG20 ) |
| 2434 | { |
| 2435 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x1F ) ; |
| 2436 | data &= 0xE7 ; |
| 2437 | if ( VCLK < 200 ) |
| 2438 | data |= 0x10 ; |
| 2439 | XGINew_SetReg1( pVBInfo->P3c4 , 0x1F , data ) ; |
| 2440 | } |
| 2441 | |
| 2442 | /* Jong for Adavantech LCD ripple issue |
| 2443 | if ( ( VCLK >= 0 ) && ( VCLK < 135 ) ) |
| 2444 | data2 = 0x03 ; |
| 2445 | else if ( ( VCLK >= 135 ) && ( VCLK < 160 ) ) |
| 2446 | data2 = 0x02 ; |
| 2447 | else if ( ( VCLK >= 160 ) && ( VCLK < 260 ) ) |
| 2448 | data2 = 0x01 ; |
| 2449 | else if ( VCLK > 260 ) |
| 2450 | data2 = 0x00 ; |
| 2451 | */ |
| 2452 | data2 = 0x00 ; |
| 2453 | |
| 2454 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x07 , 0xFC , data2 ) ; |
| 2455 | if (HwDeviceExtension->jChipType >= XG27 ) |
| 2456 | { |
| 2457 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x40 , 0xFC , data2&0x03 ) ; |
| 2458 | } |
| 2459 | |
| 2460 | |
| 2461 | } |
| 2462 | |
| 2463 | |
| 2464 | /* --------------------------------------------------------------------- */ |
| 2465 | /* Function : XGI_VesaLowResolution */ |
| 2466 | /* Input : */ |
| 2467 | /* Output : */ |
| 2468 | /* Description : */ |
| 2469 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2470 | /*void XGI_VesaLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2471 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2472 | unsigned short modeflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2473 | |
| 2474 | if ( ModeNo > 0x13 ) |
| 2475 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 2476 | else |
| 2477 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 2478 | |
| 2479 | if ( ModeNo > 0x13 ) |
| 2480 | { |
| 2481 | if ( modeflag & DoubleScanMode ) |
| 2482 | { |
| 2483 | if ( modeflag & HalfDCLK ) |
| 2484 | { |
| 2485 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 2486 | { |
| 2487 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) |
| 2488 | { |
| 2489 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 2490 | { |
| 2491 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xf7 , 0x00 ) ; |
| 2492 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0x7f , 0x00 ) ; |
| 2493 | return ; |
| 2494 | } |
| 2495 | } |
| 2496 | } |
| 2497 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0xff , 0x80 ) ; |
| 2498 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xf7 , 0x00 ) ; |
| 2499 | return ; |
| 2500 | } |
| 2501 | } |
| 2502 | } |
| 2503 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0f , 0x7f , 0x00 ) ; |
| 2504 | } |
| 2505 | */ |
| 2506 | |
| 2507 | /* --------------------------------------------------------------------- */ |
| 2508 | /* Function : XGI_LoadDAC */ |
| 2509 | /* Input : */ |
| 2510 | /* Output : */ |
| 2511 | /* Description : */ |
| 2512 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2513 | void XGI_LoadDAC(unsigned short ModeNo, |
| 2514 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2515 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2516 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2517 | unsigned short data , data2 , time , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2518 | i , j , k , m , n , o , |
| 2519 | si , di , bx , dl , al , ah , dh , |
| 2520 | *table = NULL ; |
| 2521 | |
| 2522 | if ( ModeNo <= 0x13 ) |
| 2523 | data = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 2524 | else |
| 2525 | data = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 2526 | |
| 2527 | data &= DACInfoFlag ; |
| 2528 | time = 64 ; |
| 2529 | |
| 2530 | if ( data == 0x00 ) |
| 2531 | table = XGINew_MDA_DAC ; |
| 2532 | else if ( data == 0x08 ) |
| 2533 | table = XGINew_CGA_DAC ; |
| 2534 | else if ( data == 0x10 ) |
| 2535 | table = XGINew_EGA_DAC ; |
| 2536 | else if ( data == 0x18 ) |
| 2537 | { |
| 2538 | time = 256 ; |
| 2539 | table = XGINew_VGA_DAC ; |
| 2540 | } |
| 2541 | |
| 2542 | if ( time == 256 ) |
| 2543 | j = 16 ; |
| 2544 | else |
| 2545 | j = time ; |
| 2546 | |
| 2547 | XGINew_SetReg3( pVBInfo->P3c6 , 0xFF ) ; |
| 2548 | XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ; |
| 2549 | |
| 2550 | for( i = 0 ; i < j ; i++ ) |
| 2551 | { |
| 2552 | data = table[ i ] ; |
| 2553 | |
| 2554 | for( k = 0 ; k < 3 ; k++ ) |
| 2555 | { |
| 2556 | data2 = 0 ; |
| 2557 | |
| 2558 | if ( data & 0x01 ) |
| 2559 | data2 = 0x2A ; |
| 2560 | |
| 2561 | if ( data & 0x02 ) |
| 2562 | data2 += 0x15 ; |
| 2563 | |
| 2564 | XGINew_SetReg3( pVBInfo->P3c9 , data2 ) ; |
| 2565 | data = data >> 2 ; |
| 2566 | } |
| 2567 | } |
| 2568 | |
| 2569 | if ( time == 256 ) |
| 2570 | { |
| 2571 | for( i = 16 ; i < 32 ; i++ ) |
| 2572 | { |
| 2573 | data = table[ i ] ; |
| 2574 | |
| 2575 | for( k = 0 ; k < 3 ; k++ ) |
| 2576 | XGINew_SetReg3( pVBInfo->P3c9 , data ) ; |
| 2577 | } |
| 2578 | |
| 2579 | si = 32 ; |
| 2580 | |
| 2581 | for( m = 0 ; m < 9 ; m++ ) |
| 2582 | { |
| 2583 | di = si ; |
| 2584 | bx = si + 0x04 ; |
| 2585 | dl = 0 ; |
| 2586 | |
| 2587 | for( n = 0 ; n < 3 ; n++ ) |
| 2588 | { |
| 2589 | for( o = 0 ; o < 5 ; o++ ) |
| 2590 | { |
| 2591 | dh = table[ si ] ; |
| 2592 | ah = table[ di ] ; |
| 2593 | al = table[ bx ] ; |
| 2594 | si++ ; |
| 2595 | XGI_WriteDAC( dl , ah , al , dh, pVBInfo ) ; |
| 2596 | } |
| 2597 | |
| 2598 | si -= 2 ; |
| 2599 | |
| 2600 | for( o = 0 ; o < 3 ; o++ ) |
| 2601 | { |
| 2602 | dh = table[ bx ] ; |
| 2603 | ah = table[ di ] ; |
| 2604 | al = table[ si ] ; |
| 2605 | si-- ; |
| 2606 | XGI_WriteDAC( dl , ah , al , dh, pVBInfo ) ; |
| 2607 | } |
| 2608 | |
| 2609 | dl++ ; |
| 2610 | } |
| 2611 | |
| 2612 | si += 5 ; |
| 2613 | } |
| 2614 | } |
| 2615 | } |
| 2616 | |
| 2617 | |
| 2618 | /* --------------------------------------------------------------------- */ |
| 2619 | /* Function : XGI_WriteDAC */ |
| 2620 | /* Input : */ |
| 2621 | /* Output : */ |
| 2622 | /* Description : */ |
| 2623 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2624 | void XGI_WriteDAC(unsigned short dl, unsigned short ah, |
| 2625 | unsigned short al, unsigned short dh, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2626 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2627 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2628 | unsigned short temp , bh , bl ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2629 | |
| 2630 | bh = ah ; |
| 2631 | bl = al ; |
| 2632 | |
| 2633 | if ( dl != 0 ) |
| 2634 | { |
| 2635 | temp = bh ; |
| 2636 | bh = dh ; |
| 2637 | dh = temp ; |
| 2638 | if ( dl == 1 ) |
| 2639 | { |
| 2640 | temp = bl ; |
| 2641 | bl = dh ; |
| 2642 | dh = temp ; |
| 2643 | } |
| 2644 | else |
| 2645 | { |
| 2646 | temp = bl ; |
| 2647 | bl = bh ; |
| 2648 | bh = temp ; |
| 2649 | } |
| 2650 | } |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2651 | XGINew_SetReg3(pVBInfo->P3c9, (unsigned short)dh); |
| 2652 | XGINew_SetReg3(pVBInfo->P3c9, (unsigned short)bh); |
| 2653 | XGINew_SetReg3(pVBInfo->P3c9, (unsigned short)bl); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2654 | } |
| 2655 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2656 | /* --------------------------------------------------------------------- */ |
| 2657 | /* Function : XGI_SetLCDAGroup */ |
| 2658 | /* Input : */ |
| 2659 | /* Output : */ |
| 2660 | /* Description : */ |
| 2661 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2662 | void XGI_SetLCDAGroup(unsigned short ModeNo, |
| 2663 | unsigned short ModeIdIndex, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 2664 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2665 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2666 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2667 | unsigned short RefreshRateTableIndex ; |
| 2668 | /* unsigned short temp ; */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2669 | |
| 2670 | /* pVBInfo->SelectCRT2Rate = 0 ; */ |
| 2671 | |
| 2672 | pVBInfo->SetFlag |= ProgrammingCRT2 ; |
| 2673 | RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ; |
| 2674 | XGI_GetLVDSResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 2675 | XGI_GetLVDSData( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo); |
| 2676 | XGI_ModCRT1Regs( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 2677 | XGI_SetLVDSRegs( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2678 | XGI_SetCRT2ECLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 2679 | } |
| 2680 | |
| 2681 | |
| 2682 | /* --------------------------------------------------------------------- */ |
| 2683 | /* Function : XGI_GetLVDSResInfo */ |
| 2684 | /* Input : */ |
| 2685 | /* Output : */ |
| 2686 | /* Description : */ |
| 2687 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2688 | void XGI_GetLVDSResInfo(unsigned short ModeNo, |
| 2689 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2690 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2691 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2692 | unsigned short resindex , xres , yres , modeflag ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2693 | |
| 2694 | if ( ModeNo <= 0x13 ) |
| 2695 | { |
| 2696 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ |
| 2697 | } |
| 2698 | else |
| 2699 | { |
| 2700 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ |
| 2701 | } |
| 2702 | |
| 2703 | |
| 2704 | /* if ( ModeNo > 0x13 ) */ |
| 2705 | /* modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; */ |
| 2706 | /* else */ |
| 2707 | /* modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; */ |
| 2708 | |
| 2709 | if ( ModeNo <= 0x13 ) |
| 2710 | { |
| 2711 | resindex = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ |
| 2712 | } |
| 2713 | else |
| 2714 | { |
| 2715 | resindex = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ |
| 2716 | } |
| 2717 | |
| 2718 | /* resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; */ |
| 2719 | |
| 2720 | if ( ModeNo <= 0x13 ) |
| 2721 | { |
| 2722 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 2723 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 2724 | } |
| 2725 | else |
| 2726 | { |
| 2727 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; |
| 2728 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; |
| 2729 | } |
| 2730 | if ( ModeNo > 0x13 ) |
| 2731 | { |
| 2732 | if ( modeflag & HalfDCLK ) |
| 2733 | xres = xres << 1 ; |
| 2734 | |
| 2735 | if ( modeflag & DoubleScanMode ) |
| 2736 | yres = yres << 1 ; |
| 2737 | } |
| 2738 | /* if ( modeflag & Charx8Dot ) */ |
| 2739 | /* { */ |
| 2740 | |
| 2741 | if ( xres == 720 ) |
| 2742 | xres = 640 ; |
| 2743 | |
| 2744 | /* } */ |
| 2745 | pVBInfo->VGAHDE = xres ; |
| 2746 | pVBInfo->HDE = xres ; |
| 2747 | pVBInfo->VGAVDE = yres ; |
| 2748 | pVBInfo->VDE = yres ; |
| 2749 | } |
| 2750 | |
| 2751 | |
| 2752 | /* --------------------------------------------------------------------- */ |
| 2753 | /* Function : XGI_GetLVDSData */ |
| 2754 | /* Input : */ |
| 2755 | /* Output : */ |
| 2756 | /* Description : */ |
| 2757 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2758 | void XGI_GetLVDSData(unsigned short ModeNo, |
| 2759 | unsigned short ModeIdIndex, |
| 2760 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2761 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2762 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2763 | unsigned short tempbx ; |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2764 | struct XGI330_LVDSDataStruct *LCDPtr = NULL ; |
| 2765 | struct XGI330_CHTVDataStruct *TVPtr = NULL ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2766 | |
| 2767 | tempbx = 2 ; |
| 2768 | |
| 2769 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 2770 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2771 | LCDPtr = (struct XGI330_LVDSDataStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2772 | pVBInfo->VGAHT = LCDPtr->VGAHT ; |
| 2773 | pVBInfo->VGAVT = LCDPtr->VGAVT ; |
| 2774 | pVBInfo->HT = LCDPtr->LCDHT ; |
| 2775 | pVBInfo->VT = LCDPtr->LCDVT ; |
| 2776 | } |
| 2777 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 2778 | { |
| 2779 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2780 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2781 | TVPtr = (struct XGI330_CHTVDataStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2782 | pVBInfo->VGAHT = TVPtr->VGAHT ; |
| 2783 | pVBInfo->VGAVT = TVPtr->VGAVT ; |
| 2784 | pVBInfo->HT = TVPtr->LCDHT ; |
| 2785 | pVBInfo->VT = TVPtr->LCDVT ; |
| 2786 | } |
| 2787 | } |
| 2788 | |
| 2789 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 2790 | { |
| 2791 | if ( !( pVBInfo->LCDInfo & ( SetLCDtoNonExpanding | EnableScalingLCD ) ) ) |
| 2792 | { |
| 2793 | if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) ) |
| 2794 | { |
| 2795 | pVBInfo->HDE = 1024 ; |
| 2796 | pVBInfo->VDE = 768 ; |
| 2797 | } |
| 2798 | else if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) ) |
| 2799 | { |
| 2800 | pVBInfo->HDE = 1280 ; |
| 2801 | pVBInfo->VDE = 1024 ; |
| 2802 | } |
| 2803 | else if ( pVBInfo->LCDResInfo == Panel1400x1050 ) |
| 2804 | { |
| 2805 | pVBInfo->HDE = 1400 ; |
| 2806 | pVBInfo->VDE = 1050 ; |
| 2807 | } |
| 2808 | else |
| 2809 | { |
| 2810 | pVBInfo->HDE = 1600 ; |
| 2811 | pVBInfo->VDE = 1200 ; |
| 2812 | } |
| 2813 | } |
| 2814 | } |
| 2815 | } |
| 2816 | |
| 2817 | |
| 2818 | /* --------------------------------------------------------------------- */ |
| 2819 | /* Function : XGI_ModCRT1Regs */ |
| 2820 | /* Input : */ |
| 2821 | /* Output : */ |
| 2822 | /* Description : */ |
| 2823 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2824 | void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 2825 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 2826 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2827 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2828 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 2829 | unsigned char index; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2830 | unsigned short tempbx , i ; |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2831 | struct XGI_LVDSCRT1HDataStruct *LCDPtr = NULL; |
| 2832 | struct XGI_LVDSCRT1VDataStruct *LCDPtr1 = NULL; |
| 2833 | /* struct XGI330_CHTVDataStruct *TVPtr = NULL ; */ |
| 2834 | struct XGI_CH7007TV_TimingHStruct *CH7007TV_TimingHPtr = NULL; |
| 2835 | struct XGI_CH7007TV_TimingVStruct *CH7007TV_TimingVPtr = NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2836 | |
| 2837 | if( ModeNo <= 0x13 ) |
| 2838 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 2839 | else |
| 2840 | index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 2841 | |
| 2842 | index= index & IndexMask ; |
| 2843 | |
| 2844 | if ( ( pVBInfo->IF_DEF_ScaleLCD == 0 ) || ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( !( pVBInfo->LCDInfo & EnableScalingLCD ) ) ) ) |
| 2845 | { |
| 2846 | tempbx = 0 ; |
| 2847 | |
| 2848 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 2849 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2850 | LCDPtr = (struct XGI_LVDSCRT1HDataStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2851 | |
| 2852 | for( i = 0 ; i < 8 ; i++ ) |
| 2853 | pVBInfo->TimingH[ 0 ].data[ i ] = LCDPtr[ 0 ].Reg[ i ] ; |
| 2854 | } |
| 2855 | |
| 2856 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 2857 | { |
| 2858 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2859 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2860 | CH7007TV_TimingHPtr = (struct XGI_CH7007TV_TimingHStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2861 | |
| 2862 | for( i = 0 ; i < 8 ; i++ ) |
| 2863 | pVBInfo->TimingH[ 0 ].data[ i ] = CH7007TV_TimingHPtr[ 0 ].data[ i ] ; |
| 2864 | } |
| 2865 | } |
| 2866 | |
| 2867 | /* if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 2868 | { |
| 2869 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2870 | TVPtr = ( struct XGI330_CHTVDataStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2871 | } */ |
| 2872 | |
| 2873 | XGI_SetCRT1Timing_H(pVBInfo,HwDeviceExtension) ; |
| 2874 | |
| 2875 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 2876 | { |
| 2877 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , CH7007TV_TimingHPtr[ 0 ].data[ 8 ] ) ; |
| 2878 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2F , CH7007TV_TimingHPtr[ 0 ].data[ 9 ] ) ; |
| 2879 | } |
| 2880 | |
| 2881 | tempbx = 1 ; |
| 2882 | |
| 2883 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 2884 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2885 | LCDPtr1 = (struct XGI_LVDSCRT1VDataStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2886 | for( i = 0 ; i < 7 ; i++ ) |
| 2887 | pVBInfo->TimingV[ 0 ].data[ i ] = LCDPtr1[ 0 ].Reg[ i ] ; |
| 2888 | } |
| 2889 | |
| 2890 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 2891 | { |
| 2892 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 2893 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2894 | CH7007TV_TimingVPtr = (struct XGI_CH7007TV_TimingVStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2895 | |
| 2896 | for( i = 0 ; i < 7 ; i++ ) |
| 2897 | pVBInfo->TimingV[ 0 ].data[ i ] = CH7007TV_TimingVPtr[ 0 ].data[ i ] ; |
| 2898 | } |
| 2899 | } |
| 2900 | /* if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 2901 | { |
| 2902 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2903 | TVPtr = ( struct XGI330_CHTVDataStruct *)XGI_GetTVPtr( tempbx , ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2904 | } */ |
| 2905 | |
| 2906 | XGI_SetCRT1Timing_V( ModeIdIndex , ModeNo , pVBInfo) ; |
| 2907 | |
| 2908 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 2909 | { |
| 2910 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x33 , ~0x01 , CH7007TV_TimingVPtr[ 0 ].data[ 7 ]&0x01 ) ; |
| 2911 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , CH7007TV_TimingVPtr[ 0 ].data[8 ] ) ; |
| 2912 | XGINew_SetReg1( pVBInfo->P3c4 , 0x3F , CH7007TV_TimingVPtr[ 0 ].data[9 ] ) ; |
| 2913 | |
| 2914 | } |
| 2915 | } |
| 2916 | } |
| 2917 | |
| 2918 | |
| 2919 | |
| 2920 | /* --------------------------------------------------------------------- */ |
| 2921 | /* Function : XGI_SetLVDSRegs */ |
| 2922 | /* Input : */ |
| 2923 | /* Output : */ |
| 2924 | /* Description : */ |
| 2925 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2926 | void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 2927 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2928 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2929 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2930 | unsigned short tempbx , tempax , tempcx , tempdx , push1 , push2 , modeflag ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2931 | unsigned long temp , temp1 , temp2 , temp3 , push3 ; |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2932 | struct XGI330_LCDDataDesStruct *LCDPtr = NULL ; |
| 2933 | struct XGI330_LCDDataDesStruct2 *LCDPtr1 = NULL ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2934 | |
| 2935 | if ( ModeNo > 0x13 ) |
| 2936 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 2937 | else |
| 2938 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 2939 | |
| 2940 | if ( !( pVBInfo->SetFlag & Win9xDOSMode ) ) |
| 2941 | { |
| 2942 | if ( ( pVBInfo->IF_DEF_CH7017 == 0 ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) |
| 2943 | { |
| 2944 | if ( pVBInfo->IF_DEF_OEMUtil == 1 ) |
| 2945 | { |
| 2946 | tempbx = 8 ; |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2947 | LCDPtr = (struct XGI330_LCDDataDesStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2948 | } |
| 2949 | |
| 2950 | if ( ( pVBInfo->IF_DEF_OEMUtil == 0 ) || ( LCDPtr == 0 ) ) |
| 2951 | { |
| 2952 | tempbx = 3 ; |
| 2953 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2954 | LCDPtr1 = (struct XGI330_LCDDataDesStruct2 *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2955 | else |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 2956 | LCDPtr = (struct XGI330_LCDDataDesStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2957 | } |
| 2958 | |
| 2959 | XGI_GetLCDSync( &tempax , &tempbx ,pVBInfo) ; |
| 2960 | push1 = tempbx ; |
| 2961 | push2 = tempax ; |
| 2962 | |
| 2963 | /* GetLCDResInfo */ |
| 2964 | if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) ) |
| 2965 | { |
| 2966 | tempax = 1024 ; |
| 2967 | tempbx = 768 ; |
| 2968 | } |
| 2969 | else if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) ) |
| 2970 | { |
| 2971 | tempax = 1280 ; |
| 2972 | tempbx = 1024 ; |
| 2973 | } |
| 2974 | else if ( pVBInfo->LCDResInfo == Panel1400x1050 ) |
| 2975 | { |
| 2976 | tempax = 1400 ; |
| 2977 | tempbx = 1050 ; |
| 2978 | } |
| 2979 | else |
| 2980 | { |
| 2981 | tempax = 1600 ; |
| 2982 | tempbx = 1200 ; |
| 2983 | } |
| 2984 | |
| 2985 | if ( pVBInfo->LCDInfo & SetLCDtoNonExpanding ) |
| 2986 | { |
| 2987 | pVBInfo->HDE=tempax; |
| 2988 | pVBInfo->VDE=tempbx; |
| 2989 | pVBInfo->VGAHDE=tempax; |
| 2990 | pVBInfo->VGAVDE=tempbx; |
| 2991 | } |
| 2992 | |
| 2993 | if ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( pVBInfo->LCDInfo & EnableScalingLCD ) ) |
| 2994 | { |
| 2995 | tempax=pVBInfo->HDE; |
| 2996 | tempbx=pVBInfo->VDE; |
| 2997 | } |
| 2998 | |
| 2999 | tempax = pVBInfo->HT ; |
| 3000 | |
| 3001 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3002 | tempbx = LCDPtr1->LCDHDES ; |
| 3003 | else |
| 3004 | tempbx = LCDPtr->LCDHDES ; |
| 3005 | |
| 3006 | tempcx = pVBInfo->HDE ; |
| 3007 | tempbx = tempbx & 0x0fff ; |
| 3008 | tempcx += tempbx ; |
| 3009 | |
| 3010 | if ( tempcx >= tempax ) |
| 3011 | tempcx -= tempax ; |
| 3012 | |
| 3013 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1A , tempbx & 0x07 ) ; |
| 3014 | |
| 3015 | tempcx = tempcx >> 3 ; |
| 3016 | tempbx = tempbx >> 3 ; |
| 3017 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3018 | XGINew_SetReg1(pVBInfo->Part1Port, 0x16, (unsigned short)(tempbx & 0xff)); |
| 3019 | XGINew_SetReg1(pVBInfo->Part1Port, 0x17, (unsigned short)(tempcx & 0xff)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3020 | |
| 3021 | tempax = pVBInfo->HT ; |
| 3022 | |
| 3023 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3024 | tempbx = LCDPtr1->LCDHRS ; |
| 3025 | else |
| 3026 | tempbx = LCDPtr->LCDHRS ; |
| 3027 | |
| 3028 | tempcx = push2 ; |
| 3029 | |
| 3030 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3031 | tempcx = LCDPtr1->LCDHSync ; |
| 3032 | |
| 3033 | tempcx += tempbx ; |
| 3034 | |
| 3035 | if ( tempcx >= tempax ) |
| 3036 | tempcx -= tempax ; |
| 3037 | |
| 3038 | tempax = tempbx & 0x07 ; |
| 3039 | tempax = tempax >> 5 ; |
| 3040 | tempcx = tempcx >> 3 ; |
| 3041 | tempbx = tempbx >> 3 ; |
| 3042 | |
| 3043 | tempcx &= 0x1f ; |
| 3044 | tempax |= tempcx ; |
| 3045 | |
| 3046 | XGINew_SetReg1( pVBInfo->Part1Port , 0x15 , tempax ) ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3047 | XGINew_SetReg1(pVBInfo->Part1Port, 0x14, (unsigned short)(tempbx & 0xff)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3048 | |
| 3049 | tempax = pVBInfo->VT ; |
| 3050 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3051 | tempbx = LCDPtr1->LCDVDES ; |
| 3052 | else |
| 3053 | tempbx = LCDPtr->LCDVDES ; |
| 3054 | tempcx = pVBInfo->VDE ; |
| 3055 | |
| 3056 | tempbx = tempbx & 0x0fff ; |
| 3057 | tempcx += tempbx ; |
| 3058 | if ( tempcx >= tempax ) |
| 3059 | tempcx -= tempax ; |
| 3060 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3061 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1b, (unsigned short)(tempbx & 0xff)); |
| 3062 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1c, (unsigned short)(tempcx & 0xff)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3063 | |
| 3064 | tempbx = ( tempbx >> 8 ) & 0x07 ; |
| 3065 | tempcx = ( tempcx >> 8 ) & 0x07 ; |
| 3066 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3067 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1d, (unsigned short)((tempcx << 3) | tempbx)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3068 | |
| 3069 | tempax = pVBInfo->VT ; |
| 3070 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3071 | tempbx = LCDPtr1->LCDVRS ; |
| 3072 | else |
| 3073 | tempbx = LCDPtr->LCDVRS ; |
| 3074 | |
| 3075 | /* tempbx = tempbx >> 4 ; */ |
| 3076 | tempcx = push1 ; |
| 3077 | |
| 3078 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 3079 | tempcx = LCDPtr1->LCDVSync ; |
| 3080 | |
| 3081 | tempcx += tempbx ; |
| 3082 | if ( tempcx >= tempax ) |
| 3083 | tempcx -= tempax ; |
| 3084 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3085 | XGINew_SetReg1(pVBInfo->Part1Port, 0x18, (unsigned short)(tempbx & 0xff)); |
| 3086 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, ~0x0f, (unsigned short)(tempcx & 0x0f)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3087 | |
| 3088 | tempax = ( ( tempbx >> 8 ) & 0x07 ) << 3 ; |
| 3089 | |
| 3090 | tempbx = pVBInfo->VGAVDE ; |
| 3091 | if ( tempbx != pVBInfo->VDE ) |
| 3092 | tempax |= 0x40 ; |
| 3093 | |
| 3094 | if ( pVBInfo->LCDInfo & EnableLVDSDDA ) |
| 3095 | tempax |= 0x40 ; |
| 3096 | |
| 3097 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1a , 0x07 , tempax ) ; |
| 3098 | |
| 3099 | tempcx = pVBInfo->VGAVT ; |
| 3100 | tempbx = pVBInfo->VDE ; |
| 3101 | tempax = pVBInfo->VGAVDE ; |
| 3102 | tempcx -= tempax ; |
| 3103 | |
| 3104 | temp = tempax ; /* 0430 ylshieh */ |
| 3105 | temp1 = ( temp << 18 ) / tempbx ; |
| 3106 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3107 | tempdx = (unsigned short)((temp << 18) % tempbx); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3108 | |
| 3109 | if ( tempdx != 0 ) |
| 3110 | temp1 += 1 ; |
| 3111 | |
| 3112 | temp2 = temp1 ; |
| 3113 | push3 = temp2 ; |
| 3114 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3115 | XGINew_SetReg1(pVBInfo->Part1Port, 0x37, (unsigned short)(temp2 & 0xff)); |
| 3116 | XGINew_SetReg1(pVBInfo->Part1Port, 0x36, (unsigned short)((temp2 >> 8) & 0xff)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3117 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3118 | tempbx = (unsigned short)(temp2 >> 16); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3119 | tempax = tempbx & 0x03 ; |
| 3120 | |
| 3121 | tempbx = pVBInfo->VGAVDE ; |
| 3122 | if ( tempbx == pVBInfo->VDE ) |
| 3123 | tempax |= 0x04 ; |
| 3124 | |
| 3125 | XGINew_SetReg1( pVBInfo->Part1Port , 0x35 , tempax ) ; |
| 3126 | |
| 3127 | if ( pVBInfo->VBType & VB_XGI301C ) |
| 3128 | { |
| 3129 | temp2 = push3 ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3130 | XGINew_SetReg1(pVBInfo->Part4Port, 0x3c, (unsigned short)(temp2 & 0xff)); |
| 3131 | XGINew_SetReg1(pVBInfo->Part4Port, 0x3b, (unsigned short)((temp2 >> 8) & 0xff)); |
| 3132 | tempbx = (unsigned short)(temp2 >> 16); |
| 3133 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x3a, ~0xc0, (unsigned short)((tempbx & 0xff) << 6)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3134 | |
| 3135 | tempcx = pVBInfo->VGAVDE ; |
| 3136 | if ( tempcx == pVBInfo->VDE ) |
| 3137 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x30 , ~0x0c , 0x00 ) ; |
| 3138 | else |
| 3139 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x30 , ~0x0c , 0x08 ) ; |
| 3140 | } |
| 3141 | |
| 3142 | tempcx = pVBInfo->VGAHDE ; |
| 3143 | tempbx = pVBInfo->HDE ; |
| 3144 | |
| 3145 | temp1 = tempcx << 16 ; |
| 3146 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3147 | tempax = (unsigned short)(temp1 / tempbx); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3148 | |
| 3149 | if ( ( tempbx & 0xffff ) == ( tempcx & 0xffff ) ) |
| 3150 | tempax = 65535 ; |
| 3151 | |
| 3152 | temp3 = tempax ; |
| 3153 | temp1 = pVBInfo->VGAHDE << 16 ; |
| 3154 | |
| 3155 | temp1 /= temp3 ; |
| 3156 | temp3 = temp3 << 16 ; |
| 3157 | temp1 -= 1 ; |
| 3158 | |
| 3159 | temp3 = ( temp3 & 0xffff0000 ) + ( temp1 & 0xffff ) ; |
| 3160 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3161 | tempax = (unsigned short)(temp3 & 0xff); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3162 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1f , tempax ) ; |
| 3163 | |
| 3164 | temp1 = pVBInfo->VGAVDE << 18 ; |
| 3165 | temp1 = temp1 / push3 ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3166 | tempbx = (unsigned short)(temp1 & 0xffff); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3167 | |
| 3168 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 3169 | tempbx -= 1 ; |
| 3170 | |
| 3171 | tempax = ( ( tempbx >> 8 ) & 0xff ) << 3 ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3172 | tempax |= (unsigned short)((temp3 >> 8) & 0x07); |
| 3173 | XGINew_SetReg1(pVBInfo->Part1Port, 0x20, (unsigned short)(tempax & 0xff)); |
| 3174 | XGINew_SetReg1(pVBInfo->Part1Port, 0x21, (unsigned short)(tempbx & 0xff)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3175 | |
| 3176 | temp3 = temp3 >> 16 ; |
| 3177 | |
| 3178 | if ( modeflag & HalfDCLK ) |
| 3179 | temp3 = temp3 >> 1 ; |
| 3180 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3181 | XGINew_SetReg1(pVBInfo->Part1Port , 0x22, (unsigned short)((temp3 >> 8) & 0xff)); |
| 3182 | XGINew_SetReg1(pVBInfo->Part1Port , 0x23, (unsigned short)(temp3 & 0xff)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3183 | } |
| 3184 | } |
| 3185 | } |
| 3186 | |
| 3187 | |
| 3188 | /* --------------------------------------------------------------------- */ |
| 3189 | /* Function : XGI_SetCRT2ECLK */ |
| 3190 | /* Input : */ |
| 3191 | /* Output : */ |
| 3192 | /* Description : */ |
| 3193 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 3194 | void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3195 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 3196 | unsigned char di_0, di_1, tempal; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3197 | int i ; |
| 3198 | |
| 3199 | tempal = XGI_GetVCLKPtr( RefreshRateTableIndex , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 3200 | XGI_GetVCLKLen( tempal , &di_0 , &di_1, pVBInfo ) ; |
| 3201 | XGI_GetLCDVCLKPtr( &di_0 , &di_1, pVBInfo ) ; |
| 3202 | |
| 3203 | for( i = 0 ; i < 4 ; i++ ) |
| 3204 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3205 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x31, ~0x30, (unsigned short)(0x10 * i)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3206 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 3207 | { |
| 3208 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2b , di_0 ) ; |
| 3209 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2c , di_1 ) ; |
| 3210 | } |
| 3211 | else if ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) ) |
| 3212 | { |
| 3213 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2e , di_0 ) ; |
| 3214 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2f , di_1 ) ; |
| 3215 | } |
| 3216 | else |
| 3217 | { |
| 3218 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2b , di_0 ) ; |
| 3219 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2c , di_1 ) ; |
| 3220 | } |
| 3221 | } |
| 3222 | } |
| 3223 | |
| 3224 | |
| 3225 | /* --------------------------------------------------------------------- */ |
| 3226 | /* Function : XGI_UpdateModeInfo */ |
| 3227 | /* Input : */ |
| 3228 | /* Output : */ |
| 3229 | /* Description : */ |
| 3230 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 3231 | void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3232 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3233 | unsigned short tempcl , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3234 | tempch , |
| 3235 | temp , |
| 3236 | tempbl , |
| 3237 | tempax ; |
| 3238 | |
| 3239 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 3240 | { |
| 3241 | tempcl = 0 ; |
| 3242 | tempch = 0 ; |
| 3243 | temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ; |
| 3244 | |
| 3245 | if ( !( temp & 0x20 ) ) |
| 3246 | { |
| 3247 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x17 ) ; |
| 3248 | if ( temp & 0x80 ) |
| 3249 | { |
| 3250 | if ( ( HwDeviceExtension->jChipType >= XG20 ) || ( HwDeviceExtension->jChipType >= XG40 ) ) |
| 3251 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x53 ) ; |
| 3252 | else |
| 3253 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x63 ) ; |
| 3254 | |
| 3255 | if ( !( temp & 0x40 ) ) |
| 3256 | tempcl |= ActiveCRT1 ; |
| 3257 | } |
| 3258 | } |
| 3259 | |
| 3260 | temp = XGINew_GetReg1( pVBInfo->Part1Port , 0x2e ) ; |
| 3261 | temp &= 0x0f ; |
| 3262 | |
| 3263 | if ( !( temp == 0x08 ) ) |
| 3264 | { |
| 3265 | tempax = XGINew_GetReg1( pVBInfo->Part1Port , 0x13 ) ; /* Check ChannelA by Part1_13 [2003/10/03] */ |
| 3266 | if ( tempax & 0x04 ) |
| 3267 | tempcl = tempcl | ActiveLCD ; |
| 3268 | |
| 3269 | temp &= 0x05 ; |
| 3270 | |
| 3271 | if ( !( tempcl & ActiveLCD ) ) |
| 3272 | if ( temp == 0x01 ) |
| 3273 | tempcl |= ActiveCRT2 ; |
| 3274 | |
| 3275 | if ( temp == 0x04 ) |
| 3276 | tempcl |= ActiveLCD ; |
| 3277 | |
| 3278 | if ( temp == 0x05 ) |
| 3279 | { |
| 3280 | temp = XGINew_GetReg1( pVBInfo->Part2Port , 0x00 ) ; |
| 3281 | |
| 3282 | if( !( temp & 0x08 ) ) |
| 3283 | tempch |= ActiveAVideo ; |
| 3284 | |
| 3285 | if ( !( temp & 0x04 ) ) |
| 3286 | tempch |= ActiveSVideo ; |
| 3287 | |
| 3288 | if ( temp & 0x02 ) |
| 3289 | tempch |= ActiveSCART ; |
| 3290 | |
| 3291 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 3292 | { |
| 3293 | if ( temp & 0x01 ) |
| 3294 | tempch |= ActiveHiTV ; |
| 3295 | } |
| 3296 | |
| 3297 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 3298 | { |
| 3299 | temp = XGINew_GetReg1( pVBInfo->Part2Port , 0x4d ) ; |
| 3300 | |
| 3301 | if ( temp & 0x10 ) |
| 3302 | tempch |= ActiveYPbPr ; |
| 3303 | } |
| 3304 | |
| 3305 | if ( tempch != 0 ) |
| 3306 | tempcl |= ActiveTV ; |
| 3307 | } |
| 3308 | } |
| 3309 | |
| 3310 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x3d ) ; |
| 3311 | if ( tempcl & ActiveLCD ) |
| 3312 | { |
| 3313 | if ( ( pVBInfo->SetFlag & ReserveTVOption ) ) |
| 3314 | { |
| 3315 | if ( temp & ActiveTV ) |
| 3316 | tempcl |= ActiveTV ; |
| 3317 | } |
| 3318 | } |
| 3319 | temp = tempcl ; |
| 3320 | tempbl = ~ModeSwitchStatus ; |
| 3321 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x3d , tempbl , temp ) ; |
| 3322 | |
| 3323 | if ( !( pVBInfo->SetFlag & ReserveTVOption ) ) |
| 3324 | XGINew_SetReg1( pVBInfo->P3d4 , 0x3e , tempch ) ; |
| 3325 | } |
| 3326 | else |
| 3327 | { |
| 3328 | return ; |
| 3329 | } |
| 3330 | } |
| 3331 | |
| 3332 | |
| 3333 | /* --------------------------------------------------------------------- */ |
| 3334 | /* Function : XGI_GetVGAType */ |
| 3335 | /* Input : */ |
| 3336 | /* Output : */ |
| 3337 | /* Description : */ |
| 3338 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 3339 | void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3340 | { |
| 3341 | /* |
| 3342 | if ( HwDeviceExtension->jChipType >= XG20 ) |
| 3343 | { |
| 3344 | pVBInfo->Set_VGAType = XG20; |
| 3345 | } |
| 3346 | else if ( HwDeviceExtension->jChipType >= XG40 ) |
| 3347 | { |
| 3348 | pVBInfo->Set_VGAType = VGA_XGI340 ; |
| 3349 | } |
| 3350 | */ |
| 3351 | pVBInfo->Set_VGAType = HwDeviceExtension->jChipType; |
| 3352 | } |
| 3353 | |
| 3354 | |
| 3355 | /* --------------------------------------------------------------------- */ |
| 3356 | /* Function : XGI_GetVBType */ |
| 3357 | /* Input : */ |
| 3358 | /* Output : */ |
| 3359 | /* Description : */ |
| 3360 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 3361 | void XGI_GetVBType(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3362 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3363 | unsigned short flag , tempbx , tempah ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3364 | |
| 3365 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 3366 | { |
| 3367 | pVBInfo->VBType = VB_CH7007 ; |
| 3368 | return; |
| 3369 | } |
| 3370 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3371 | { |
| 3372 | tempbx = VB_XGI302B ; |
| 3373 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x00 ) ; |
| 3374 | if ( flag != 0x02 ) |
| 3375 | { |
| 3376 | tempbx = VB_XGI301 ; |
| 3377 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x01 ) ; |
| 3378 | if ( flag >= 0xB0 ) |
| 3379 | { |
| 3380 | tempbx = VB_XGI301B ; |
| 3381 | if ( flag >= 0xC0 ) |
| 3382 | { |
| 3383 | tempbx = VB_XGI301C ; |
| 3384 | if ( flag >= 0xD0 ) |
| 3385 | { |
| 3386 | tempbx = VB_XGI301LV ; |
| 3387 | if ( flag >= 0xE0 ) |
| 3388 | { |
| 3389 | tempbx = VB_XGI302LV ; |
| 3390 | tempah = XGINew_GetReg1( pVBInfo->Part4Port , 0x39 ) ; |
| 3391 | if ( tempah != 0xFF ) |
| 3392 | tempbx = VB_XGI301C ; |
| 3393 | } |
| 3394 | } |
| 3395 | } |
| 3396 | |
| 3397 | if ( tempbx & ( VB_XGI301B | VB_XGI302B ) ) |
| 3398 | { |
| 3399 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x23 ) ; |
| 3400 | |
| 3401 | if ( !( flag & 0x02 ) ) |
| 3402 | tempbx = tempbx | VB_NoLCD ; |
| 3403 | } |
| 3404 | } |
| 3405 | } |
| 3406 | pVBInfo->VBType = tempbx ; |
| 3407 | } |
| 3408 | /* |
| 3409 | else if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3410 | pVBInfo->VBType = VB_CH7017 ; |
| 3411 | else //LVDS |
| 3412 | pVBInfo->VBType = VB_LVDS_NS ; |
| 3413 | */ |
| 3414 | |
| 3415 | } |
| 3416 | |
| 3417 | |
| 3418 | /* --------------------------------------------------------------------- */ |
| 3419 | /* Function : XGI_GetVBInfo */ |
| 3420 | /* Input : */ |
| 3421 | /* Output : */ |
| 3422 | /* Description : */ |
| 3423 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 3424 | void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3425 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3426 | unsigned short tempax , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3427 | push , |
| 3428 | tempbx , |
| 3429 | temp , |
| 3430 | modeflag ; |
| 3431 | |
| 3432 | if ( ModeNo <= 0x13 ) |
| 3433 | { |
| 3434 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 3435 | } |
| 3436 | else |
| 3437 | { |
| 3438 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 3439 | } |
| 3440 | |
| 3441 | pVBInfo->SetFlag = 0 ; |
| 3442 | pVBInfo->ModeType = modeflag & ModeInfoFlag ; |
| 3443 | tempbx = 0 ; |
| 3444 | |
| 3445 | if ( pVBInfo->VBType & 0xFFFF ) |
| 3446 | { |
| 3447 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x30 ) ; /* Check Display Device */ |
| 3448 | tempbx = tempbx | temp ; |
| 3449 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x31 ) ; |
| 3450 | push = temp ; |
| 3451 | push = push << 8 ; |
| 3452 | tempax = temp << 8 ; |
| 3453 | tempbx = tempbx | tempax ; |
| 3454 | temp = ( SetCRT2ToDualEdge | SetCRT2ToYPbPr | SetCRT2ToLCDA | SetInSlaveMode | DisableCRT2Display ) ; |
| 3455 | temp = 0xFFFF ^ temp ; |
| 3456 | tempbx &= temp ; |
| 3457 | |
| 3458 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; |
| 3459 | |
| 3460 | if ( pVBInfo->IF_DEF_LCDA == 1 ) |
| 3461 | { |
| 3462 | |
| 3463 | if ( ( pVBInfo->Set_VGAType >= XG20 ) || ( pVBInfo->Set_VGAType >= XG40 )) |
| 3464 | { |
| 3465 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3466 | { |
| 3467 | /* if ( ( pVBInfo->VBType & VB_XGI302B ) || ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) */ |
| 3468 | if ( pVBInfo->VBType & ( VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 3469 | { |
| 3470 | if ( temp & EnableDualEdge ) |
| 3471 | { |
| 3472 | tempbx |= SetCRT2ToDualEdge ; |
| 3473 | |
| 3474 | if ( temp & SetToLCDA ) |
| 3475 | tempbx |= SetCRT2ToLCDA ; |
| 3476 | } |
| 3477 | } |
| 3478 | } |
| 3479 | else if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3480 | { |
| 3481 | if ( pVBInfo->VBType & VB_CH7017 ) |
| 3482 | { |
| 3483 | if ( temp & EnableDualEdge ) |
| 3484 | { |
| 3485 | tempbx |= SetCRT2ToDualEdge ; |
| 3486 | |
| 3487 | if ( temp & SetToLCDA ) |
| 3488 | tempbx |= SetCRT2ToLCDA ; |
| 3489 | } |
| 3490 | } |
| 3491 | } |
| 3492 | } |
| 3493 | } |
| 3494 | |
| 3495 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) |
| 3496 | { |
| 3497 | if ( ( ( pVBInfo->IF_DEF_LVDS == 0 ) && ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) ) |
| 3498 | || ( ( pVBInfo->IF_DEF_CH7017 == 1 ) && ( pVBInfo->VBType&VB_CH7017 ) ) || ( (pVBInfo->IF_DEF_CH7007 == 1) && (pVBInfo->VBType&VB_CH7007) ) ) /* [Billy] 07/05/04 */ |
| 3499 | { |
| 3500 | if ( temp & SetYPbPr ) /* temp = CR38 */ |
| 3501 | { |
| 3502 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3503 | { |
| 3504 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; /* shampoo add for new scratch */ |
| 3505 | temp &= YPbPrMode ; |
| 3506 | tempbx |= SetCRT2ToHiVisionTV ; |
| 3507 | |
| 3508 | if ( temp != YPbPrMode1080i ) { |
| 3509 | tempbx &= ( ~SetCRT2ToHiVisionTV ) ; |
| 3510 | tempbx |= SetCRT2ToYPbPr ; } |
| 3511 | } |
| 3512 | |
| 3513 | /* tempbx |= SetCRT2ToYPbPr ; */ |
| 3514 | } |
| 3515 | } |
| 3516 | } |
| 3517 | |
| 3518 | tempax = push ; /* restore CR31 */ |
| 3519 | |
| 3520 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3521 | { |
| 3522 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) |
| 3523 | { |
| 3524 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3525 | temp = 0x09FC ; |
| 3526 | else |
| 3527 | temp = 0x097C ; |
| 3528 | } |
| 3529 | else |
| 3530 | { |
| 3531 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3532 | temp = 0x01FC ; |
| 3533 | else |
| 3534 | temp = 0x017C ; |
| 3535 | } |
| 3536 | } |
| 3537 | else /* 3nd party chip */ |
| 3538 | { |
| 3539 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3540 | temp = ( SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ; |
| 3541 | else if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 07/05/03 */ |
| 3542 | { |
| 3543 | temp = SetCRT2ToTV ; |
| 3544 | } |
| 3545 | else |
| 3546 | temp = SetCRT2ToLCD ; |
| 3547 | } |
| 3548 | |
| 3549 | if ( !( tempbx & temp ) ) |
| 3550 | { |
| 3551 | tempax |= DisableCRT2Display ; |
| 3552 | tempbx = 0 ; |
| 3553 | } |
| 3554 | |
| 3555 | if ( pVBInfo->IF_DEF_LCDA == 1 ) /* Select Display Device */ |
| 3556 | { |
| 3557 | if ( !( pVBInfo->VBType & VB_NoLCD ) ) |
| 3558 | { |
| 3559 | if ( tempbx & SetCRT2ToLCDA ) |
| 3560 | { |
| 3561 | if ( tempbx & SetSimuScanMode ) |
| 3562 | tempbx &= ( ~( SetCRT2ToLCD | SetCRT2ToRAMDAC | SwitchToCRT2 ) ) ; |
| 3563 | else |
| 3564 | tempbx &= ( ~( SetCRT2ToLCD | SetCRT2ToRAMDAC | SetCRT2ToTV | SwitchToCRT2 ) ) ; |
| 3565 | } |
| 3566 | } |
| 3567 | } |
| 3568 | |
| 3569 | /* shampoo add */ |
| 3570 | if ( !( tempbx & ( SwitchToCRT2 | SetSimuScanMode ) ) ) /* for driver abnormal */ |
| 3571 | { |
| 3572 | if ( pVBInfo->IF_DEF_CRT2Monitor == 1 ) |
| 3573 | { |
| 3574 | if ( tempbx & SetCRT2ToRAMDAC ) |
| 3575 | { |
| 3576 | tempbx &= ( 0xFF00 | SetCRT2ToRAMDAC | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3577 | tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ; |
| 3578 | } |
| 3579 | } |
| 3580 | else |
| 3581 | tempbx &= ( ~( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ; |
| 3582 | } |
| 3583 | |
| 3584 | if ( !( pVBInfo->VBType & VB_NoLCD ) ) |
| 3585 | { |
| 3586 | if ( tempbx & SetCRT2ToLCD ) |
| 3587 | { |
| 3588 | tempbx &= ( 0xFF00 | SetCRT2ToLCD | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3589 | tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ; |
| 3590 | } |
| 3591 | } |
| 3592 | |
| 3593 | if ( tempbx & SetCRT2ToSCART ) |
| 3594 | { |
| 3595 | tempbx &= ( 0xFF00 | SetCRT2ToSCART | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3596 | tempbx &= ( 0x00FF | ( ~SetCRT2ToYPbPr ) ) ; |
| 3597 | } |
| 3598 | |
| 3599 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) |
| 3600 | { |
| 3601 | if ( tempbx & SetCRT2ToYPbPr ) |
| 3602 | tempbx &= ( 0xFF00 | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3603 | } |
| 3604 | |
| 3605 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3606 | { |
| 3607 | if ( tempbx & SetCRT2ToHiVisionTV ) |
| 3608 | tempbx &= ( 0xFF00 | SetCRT2ToHiVisionTV | SwitchToCRT2 | SetSimuScanMode ) ; |
| 3609 | } |
| 3610 | |
| 3611 | if ( tempax & DisableCRT2Display ) /* Set Display Device Info */ |
| 3612 | { |
| 3613 | if ( !( tempbx & ( SwitchToCRT2 | SetSimuScanMode ) ) ) |
| 3614 | tempbx = DisableCRT2Display ; |
| 3615 | } |
| 3616 | |
| 3617 | if ( !( tempbx & DisableCRT2Display ) ) |
| 3618 | { |
| 3619 | if ( ( !( tempbx & DriverMode ) ) || ( !( modeflag & CRT2Mode ) ) ) |
| 3620 | { |
| 3621 | if ( pVBInfo->IF_DEF_LCDA == 1 ) |
| 3622 | { |
| 3623 | if ( !( tempbx & SetCRT2ToLCDA ) ) |
| 3624 | tempbx |= ( SetInSlaveMode | SetSimuScanMode ) ; |
| 3625 | } |
| 3626 | |
| 3627 | if ( pVBInfo->IF_DEF_VideoCapture == 1 ) |
| 3628 | { |
| 3629 | if ( ( ( HwDeviceExtension->jChipType == XG40 ) && ( pVBInfo->Set_VGAType == XG40 ) ) |
| 3630 | || ( ( HwDeviceExtension->jChipType == XG41 ) && ( pVBInfo->Set_VGAType == XG41 ) ) |
| 3631 | || ( ( HwDeviceExtension->jChipType == XG42 ) && ( pVBInfo->Set_VGAType == XG42 ) ) |
| 3632 | || ( ( HwDeviceExtension->jChipType == XG45 ) && ( pVBInfo->Set_VGAType == XG45 ) ) ) |
| 3633 | { |
| 3634 | if ( ModeNo <= 13 ) |
| 3635 | { |
| 3636 | if ( !( tempbx & SetCRT2ToRAMDAC ) ) /*CRT2 not need to support*/ |
| 3637 | { |
| 3638 | tempbx &= ( 0x00FF | ( ~SetInSlaveMode ) ) ; |
| 3639 | pVBInfo->SetFlag |= EnableVCMode ; |
| 3640 | } |
| 3641 | } |
| 3642 | } |
| 3643 | } |
| 3644 | } |
| 3645 | |
| 3646 | /*LCD+TV can't support in slave mode (Force LCDA+TV->LCDB)*/ |
| 3647 | if ( ( tempbx & SetInSlaveMode ) && ( tempbx & SetCRT2ToLCDA ) ) |
| 3648 | { |
| 3649 | tempbx ^= ( SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToDualEdge ) ; |
| 3650 | pVBInfo->SetFlag |= ReserveTVOption ; |
| 3651 | } |
| 3652 | } |
| 3653 | } |
| 3654 | |
| 3655 | pVBInfo->VBInfo = tempbx ; |
| 3656 | } |
| 3657 | |
| 3658 | |
| 3659 | /* --------------------------------------------------------------------- */ |
| 3660 | /* Function : XGI_GetTVInfo */ |
| 3661 | /* Input : */ |
| 3662 | /* Output : */ |
| 3663 | /* Description : */ |
| 3664 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 3665 | void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3666 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3667 | unsigned short temp , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3668 | tempbx = 0 , |
| 3669 | resinfo = 0 , |
| 3670 | modeflag , |
| 3671 | index1 ; |
| 3672 | |
| 3673 | tempbx = 0 ; |
| 3674 | resinfo = 0 ; |
| 3675 | |
| 3676 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 3677 | { |
| 3678 | if ( ModeNo <= 0x13 ) |
| 3679 | { |
| 3680 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag */ |
| 3681 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; /* si+St_ResInfo */ |
| 3682 | } |
| 3683 | else |
| 3684 | { |
| 3685 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 3686 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo */ |
| 3687 | } |
| 3688 | |
| 3689 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 3690 | { |
| 3691 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; |
| 3692 | tempbx = temp; |
| 3693 | if ( tempbx & SetPALTV ) |
| 3694 | { |
| 3695 | tempbx &= ( SetCHTVOverScan | SetPALMTV | SetPALNTV | SetPALTV ) ; |
| 3696 | if ( tempbx & SetPALMTV ) |
| 3697 | tempbx &= ~SetPALTV ; /* set to NTSC if PAL-M */ |
| 3698 | } |
| 3699 | else |
| 3700 | tempbx &= ( SetCHTVOverScan | SetNTSCJ | SetPALTV ) ; |
| 3701 | /* |
| 3702 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3703 | { |
| 3704 | index1 = XGINew_GetReg1( pVBInfo->P3d4 , 0x38 ) ; //PAL-M/PAL-N Info |
| 3705 | temp2 = ( index1 & 0xC0 ) >> 5 ; //00:PAL, 01:PAL-M, 10:PAL-N |
| 3706 | tempbx |= temp2 ; |
| 3707 | if ( temp2 & 0x02 ) //PAL-M |
| 3708 | tempbx &= ( ~SetPALTV ) ; |
| 3709 | } |
| 3710 | */ |
| 3711 | } |
| 3712 | |
| 3713 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3714 | { |
| 3715 | tempbx = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; |
| 3716 | |
| 3717 | if ( tempbx & TVOverScan ) |
| 3718 | tempbx |= SetCHTVOverScan ; |
| 3719 | } |
| 3720 | |
| 3721 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 07/05/04 */ |
| 3722 | { |
| 3723 | tempbx = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; |
| 3724 | |
| 3725 | if ( tempbx & TVOverScan ) |
| 3726 | { |
| 3727 | tempbx |= SetCHTVOverScan ; |
| 3728 | } |
| 3729 | } |
| 3730 | |
| 3731 | |
| 3732 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3733 | { |
| 3734 | if ( pVBInfo->VBInfo & SetCRT2ToSCART ) |
| 3735 | tempbx |= SetPALTV ; |
| 3736 | } |
| 3737 | |
| 3738 | if ( pVBInfo->IF_DEF_YPbPr == 1 ) |
| 3739 | { |
| 3740 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 3741 | { |
| 3742 | index1 = XGINew_GetReg1( pVBInfo->P3d4 , 0x35 ) ; |
| 3743 | index1 &= YPbPrMode ; |
| 3744 | |
| 3745 | if ( index1 == YPbPrMode525i ) |
| 3746 | tempbx |= SetYPbPrMode525i ; |
| 3747 | |
| 3748 | if ( index1 == YPbPrMode525p ) |
| 3749 | tempbx = tempbx | SetYPbPrMode525p; |
| 3750 | if ( index1 == YPbPrMode750p) |
| 3751 | tempbx = tempbx | SetYPbPrMode750p; |
| 3752 | } |
| 3753 | } |
| 3754 | |
| 3755 | if ( pVBInfo->IF_DEF_HiVision == 1 ) |
| 3756 | { |
| 3757 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 3758 | { |
| 3759 | tempbx = tempbx | SetYPbPrMode1080i | SetPALTV ; |
| 3760 | } |
| 3761 | } |
| 3762 | |
| 3763 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3764 | { /* shampoo */ |
| 3765 | if ( ( pVBInfo->VBInfo & SetInSlaveMode ) && ( !( pVBInfo->VBInfo & SetNotSimuMode ) ) ) |
| 3766 | tempbx |= TVSimuMode ; |
| 3767 | |
| 3768 | if ( !( tempbx & SetPALTV ) && ( modeflag > 13 ) && ( resinfo == 8 ) ) /* NTSC 1024x768, */ |
| 3769 | tempbx |= NTSC1024x768 ; |
| 3770 | |
| 3771 | tempbx |= RPLLDIV2XO ; |
| 3772 | |
| 3773 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 3774 | { |
| 3775 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 3776 | tempbx &=( ~RPLLDIV2XO ) ; |
| 3777 | } |
| 3778 | else |
| 3779 | { |
| 3780 | if ( tempbx & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) |
| 3781 | tempbx &= ( ~RPLLDIV2XO ) ; |
| 3782 | else if ( !( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) ) |
| 3783 | { |
| 3784 | if ( tempbx & TVSimuMode ) |
| 3785 | tempbx &= ( ~RPLLDIV2XO ) ; |
| 3786 | } |
| 3787 | } |
| 3788 | } |
| 3789 | } |
| 3790 | pVBInfo->TVInfo = tempbx ; |
| 3791 | } |
| 3792 | |
| 3793 | |
| 3794 | /* --------------------------------------------------------------------- */ |
| 3795 | /* Function : XGI_GetLCDInfo */ |
| 3796 | /* Input : */ |
| 3797 | /* Output : */ |
| 3798 | /* Description : */ |
| 3799 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 3800 | unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 3801 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3802 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 3803 | unsigned short temp , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3804 | tempax , |
| 3805 | tempbx , |
| 3806 | modeflag , |
| 3807 | resinfo = 0 , |
| 3808 | LCDIdIndex ; |
| 3809 | |
| 3810 | pVBInfo->LCDResInfo = 0 ; |
| 3811 | pVBInfo->LCDTypeInfo = 0 ; |
| 3812 | pVBInfo->LCDInfo = 0 ; |
| 3813 | |
| 3814 | if ( ModeNo <= 0x13 ) |
| 3815 | { |
| 3816 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ModeFlag // */ |
| 3817 | } |
| 3818 | else |
| 3819 | { |
| 3820 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 3821 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; /* si+Ext_ResInfo// */ |
| 3822 | } |
| 3823 | |
| 3824 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; /* Get LCD Res.Info */ |
| 3825 | tempbx = temp & 0x0F ; |
| 3826 | |
| 3827 | if ( tempbx == 0 ) |
| 3828 | tempbx = Panel1024x768 ; /* default */ |
| 3829 | |
| 3830 | /* LCD75 [2003/8/22] Vicent */ |
| 3831 | if ( ( tempbx == Panel1024x768 ) || ( tempbx == Panel1280x1024 ) ) |
| 3832 | { |
| 3833 | if ( pVBInfo->VBInfo & DriverMode ) |
| 3834 | { |
| 3835 | tempax = XGINew_GetReg1( pVBInfo->P3d4 , 0x33 ) ; |
| 3836 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 3837 | tempax &= 0x0F ; |
| 3838 | else |
| 3839 | tempax = tempax >> 4 ; |
| 3840 | |
| 3841 | if ( ( resinfo == 6 ) || ( resinfo == 9 ) ) |
| 3842 | { |
| 3843 | if ( tempax >= 3 ) |
| 3844 | tempbx |= PanelRef75Hz ; |
| 3845 | } |
| 3846 | else if ( ( resinfo == 7 ) || ( resinfo == 8 ) ) |
| 3847 | { |
| 3848 | if ( tempax >= 4 ) |
| 3849 | tempbx |= PanelRef75Hz ; |
| 3850 | } |
| 3851 | } |
| 3852 | } |
| 3853 | |
| 3854 | pVBInfo->LCDResInfo = tempbx ; |
| 3855 | |
| 3856 | /* End of LCD75 */ |
| 3857 | |
| 3858 | if( pVBInfo->IF_DEF_OEMUtil == 1 ) |
| 3859 | { |
| 3860 | pVBInfo->LCDTypeInfo = ( temp & 0xf0 ) >> 4 ; |
| 3861 | } |
| 3862 | |
| 3863 | if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) |
| 3864 | { |
| 3865 | return 0; |
| 3866 | } |
| 3867 | |
| 3868 | tempbx = 0 ; |
| 3869 | |
| 3870 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; |
| 3871 | |
| 3872 | temp &= ( ScalingLCD | LCDNonExpanding | LCDSyncBit | SetPWDEnable ) ; |
| 3873 | |
| 3874 | if ( ( pVBInfo->IF_DEF_ScaleLCD == 1 ) && ( temp & LCDNonExpanding ) ) |
| 3875 | temp &= ~EnableScalingLCD ; |
| 3876 | |
| 3877 | tempbx |= temp ; |
| 3878 | |
| 3879 | LCDIdIndex = XGI_GetLCDCapPtr1(pVBInfo) ; |
| 3880 | |
| 3881 | tempax = pVBInfo->LCDCapList[ LCDIdIndex ].LCD_Capability ; |
| 3882 | |
| 3883 | if ( pVBInfo->IF_DEF_LVDS == 0 ) /* shampoo */ |
| 3884 | { |
| 3885 | if ( ( ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) && ( tempax & LCDDualLink ) ) |
| 3886 | { |
| 3887 | tempbx |= SetLCDDualLink ; |
| 3888 | } |
| 3889 | } |
| 3890 | |
| 3891 | if ( pVBInfo->IF_DEF_CH7017 == 1 ) |
| 3892 | { |
| 3893 | if ( tempax & LCDDualLink ) |
| 3894 | { |
| 3895 | tempbx |= SetLCDDualLink ; |
| 3896 | } |
| 3897 | } |
| 3898 | |
| 3899 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3900 | { |
| 3901 | if ( ( pVBInfo->LCDResInfo == Panel1400x1050 ) && ( pVBInfo->VBInfo & SetCRT2ToLCD ) && ( ModeNo > 0x13 ) && ( resinfo == 9 ) && ( !( tempbx & EnableScalingLCD ) ) ) |
| 3902 | tempbx |= SetLCDtoNonExpanding ; /* set to center in 1280x1024 LCDB for Panel1400x1050 */ |
| 3903 | } |
| 3904 | |
| 3905 | /* |
| 3906 | if ( tempax & LCDBToA ) |
| 3907 | { |
| 3908 | tempbx |= SetLCDBToA ; |
| 3909 | } |
| 3910 | */ |
| 3911 | |
| 3912 | if ( pVBInfo->IF_DEF_ExpLink == 1 ) |
| 3913 | { |
| 3914 | if ( modeflag & HalfDCLK ) |
| 3915 | { |
| 3916 | /* if ( !( pVBInfo->LCDInfo&LCDNonExpanding ) ) */ |
| 3917 | if ( !( tempbx & SetLCDtoNonExpanding ) ) |
| 3918 | { |
| 3919 | tempbx |= EnableLVDSDDA ; |
| 3920 | } |
| 3921 | else |
| 3922 | { |
| 3923 | if ( ModeNo > 0x13 ) |
| 3924 | { |
| 3925 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 3926 | { |
| 3927 | if ( resinfo == 4 ) |
| 3928 | { /* 512x384 */ |
| 3929 | tempbx |= EnableLVDSDDA ; |
| 3930 | } |
| 3931 | } |
| 3932 | } |
| 3933 | } |
| 3934 | } |
| 3935 | } |
| 3936 | |
| 3937 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 3938 | { |
| 3939 | if ( pVBInfo->VBInfo & SetNotSimuMode ) |
| 3940 | { |
| 3941 | tempbx |= LCDVESATiming ; |
| 3942 | } |
| 3943 | } |
| 3944 | else |
| 3945 | { |
| 3946 | tempbx |= LCDVESATiming ; |
| 3947 | } |
| 3948 | |
| 3949 | pVBInfo->LCDInfo = tempbx ; |
| 3950 | |
| 3951 | if ( pVBInfo->IF_DEF_PWD == 1 ) |
| 3952 | { |
| 3953 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 3954 | { |
| 3955 | if ( ( pVBInfo->VBType & VB_XGI302LV ) || ( pVBInfo->VBType & VB_XGI301C ) ) |
| 3956 | { |
| 3957 | if ( !( tempax & PWDEnable ) ) |
| 3958 | { |
| 3959 | pVBInfo->LCDInfo &= ~SetPWDEnable ; |
| 3960 | } |
| 3961 | } |
| 3962 | } |
| 3963 | } |
| 3964 | |
| 3965 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3966 | { |
| 3967 | if ( tempax & ( LockLCDBToA | StLCDBToA ) ) |
| 3968 | { |
| 3969 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 3970 | { |
| 3971 | if ( !( tempax & LockLCDBToA ) ) |
| 3972 | { |
| 3973 | if ( ModeNo <= 0x13 ) |
| 3974 | { |
| 3975 | pVBInfo->VBInfo &= ~( SetSimuScanMode | SetInSlaveMode | SetCRT2ToLCD ) ; |
| 3976 | pVBInfo->VBInfo |= SetCRT2ToLCDA | SetCRT2ToDualEdge ; |
| 3977 | } |
| 3978 | } |
| 3979 | } |
| 3980 | } |
| 3981 | } |
| 3982 | |
| 3983 | /* |
| 3984 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 3985 | { |
| 3986 | if ( tempax & ( LockLCDBToA | StLCDBToA ) ) |
| 3987 | { |
| 3988 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 3989 | { |
| 3990 | if ( !( ( !( tempax & LockLCDBToA ) ) && ( ModeNo > 0x13 ) ) ) |
| 3991 | { |
| 3992 | pVBInfo->VBInfo&=~(SetSimuScanMode|SetInSlaveMode|SetCRT2ToLCD); |
| 3993 | pVBInfo->VBInfo|=SetCRT2ToLCDA|SetCRT2ToDualEdge; |
| 3994 | } |
| 3995 | } |
| 3996 | } |
| 3997 | } |
| 3998 | */ |
| 3999 | |
| 4000 | return( 1 ) ; |
| 4001 | } |
| 4002 | |
| 4003 | |
| 4004 | /* --------------------------------------------------------------------- */ |
| 4005 | /* Function : XGI_SearchModeID */ |
| 4006 | /* Input : */ |
| 4007 | /* Output : */ |
| 4008 | /* Description : */ |
| 4009 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4010 | unsigned char XGI_SearchModeID(unsigned short ModeNo, |
| 4011 | unsigned short *ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4012 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4013 | { |
| 4014 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4015 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4016 | |
| 4017 | #ifdef LINUX /* chiawen for linux solution */ |
| 4018 | |
| 4019 | if ( ModeNo <= 5 ) |
| 4020 | ModeNo |= 1 ; |
| 4021 | if ( ModeNo <= 0x13 ) |
| 4022 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4023 | /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->SModeIDTable)/sizeof(struct XGI_StStruct);(*ModeIdIndex)++) */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4024 | for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ ) |
| 4025 | { |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 4026 | if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == ModeNo) |
| 4027 | break; |
| 4028 | if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF) |
| 4029 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4030 | } |
| 4031 | |
| 4032 | if ( ModeNo == 0x07 ) |
| 4033 | ( *ModeIdIndex )++ ; /* 400 lines */ |
| 4034 | |
| 4035 | if ( ModeNo <= 3 ) |
| 4036 | ( *ModeIdIndex ) += 2 ; /* 400 lines */ |
| 4037 | /* else 350 lines */ |
| 4038 | } |
| 4039 | else |
| 4040 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4041 | /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->EModeIDTable)/sizeof(struct XGI_ExtStruct);(*ModeIdIndex)++) */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4042 | for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ ) |
| 4043 | { |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 4044 | if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == ModeNo) |
| 4045 | break; |
| 4046 | if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF) |
| 4047 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4048 | } |
| 4049 | } |
| 4050 | |
| 4051 | #endif |
| 4052 | |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 4053 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4054 | } |
| 4055 | |
| 4056 | |
| 4057 | |
| 4058 | |
| 4059 | /* win2000 MM adapter not support standard mode! */ |
| 4060 | |
| 4061 | /* --------------------------------------------------------------------- */ |
| 4062 | /* Function : */ |
| 4063 | /* Input : */ |
| 4064 | /* Output : */ |
| 4065 | /* Description : */ |
| 4066 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 4067 | unsigned char XGINew_CheckMemorySize(struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4068 | unsigned short ModeNo, |
| 4069 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4070 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4071 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4072 | unsigned short memorysize , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4073 | modeflag , |
| 4074 | temp , |
| 4075 | temp1 , |
| 4076 | tmp ; |
| 4077 | |
| 4078 | /* if ( ( HwDeviceExtension->jChipType == XGI_650 ) || |
| 4079 | ( HwDeviceExtension->jChipType == XGI_650M ) ) |
| 4080 | { |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 4081 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4082 | } */ |
| 4083 | |
| 4084 | if ( ModeNo <= 0x13 ) |
| 4085 | { |
| 4086 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 4087 | } |
| 4088 | else { |
| 4089 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 4090 | } |
| 4091 | |
| 4092 | /* ModeType = modeflag&ModeInfoFlag ; // Get mode type */ |
| 4093 | |
| 4094 | memorysize = modeflag & MemoryInfoFlag ; |
| 4095 | memorysize = memorysize > MemorySizeShift ; |
| 4096 | memorysize++ ; /* Get memory size */ |
| 4097 | |
| 4098 | temp = XGINew_GetReg1( pVBInfo->P3c4 , 0x14 ) ; /* Get DRAM Size */ |
| 4099 | tmp = temp ; |
| 4100 | |
| 4101 | if ( HwDeviceExtension->jChipType == XG40 ) |
| 4102 | { |
| 4103 | temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */ |
| 4104 | if ( ( tmp & 0x0c ) == 0x0C ) /* Qual channels */ |
| 4105 | { |
| 4106 | temp <<= 2 ; |
| 4107 | } |
| 4108 | else if ( ( tmp & 0x0c ) == 0x08 ) /* Dual channels */ |
| 4109 | { |
| 4110 | temp <<= 1 ; |
| 4111 | } |
| 4112 | } |
| 4113 | else if ( HwDeviceExtension->jChipType == XG42 ) |
| 4114 | { |
| 4115 | temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */ |
| 4116 | if ( ( tmp & 0x04 ) == 0x04 ) /* Dual channels */ |
| 4117 | { |
| 4118 | temp <<= 1 ; |
| 4119 | } |
| 4120 | } |
| 4121 | else if ( HwDeviceExtension->jChipType == XG45 ) |
| 4122 | { |
| 4123 | temp = 1 << ( ( temp & 0x0F0 ) >> 4 ) ; /* memory size per channel SR14[7:4] */ |
| 4124 | if ( ( tmp & 0x0c ) == 0x0C ) /* Qual channels */ |
| 4125 | { |
| 4126 | temp <<= 2 ; |
| 4127 | } |
| 4128 | else if ( ( tmp & 0x0c ) == 0x08 ) /* triple channels */ |
| 4129 | { |
| 4130 | temp1 = temp ; |
| 4131 | temp <<= 1 ; |
| 4132 | temp += temp1 ; |
| 4133 | } |
| 4134 | else if ( ( tmp & 0x0c ) == 0x04 ) /* Dual channels */ |
| 4135 | { |
| 4136 | temp <<= 1 ; |
| 4137 | } |
| 4138 | } |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 4139 | if (temp < memorysize) |
| 4140 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4141 | else |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 4142 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4143 | } |
| 4144 | |
| 4145 | |
| 4146 | /* --------------------------------------------------------------------- */ |
| 4147 | /* Function : XGINew_IsLowResolution */ |
| 4148 | /* Input : */ |
| 4149 | /* Output : */ |
| 4150 | /* Description : */ |
| 4151 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4152 | /*void XGINew_IsLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned char XGINew_CheckMemorySize(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4153 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4154 | unsigned short data ; |
| 4155 | unsigned short ModeFlag ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4156 | |
| 4157 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x0F ) ; |
| 4158 | data &= 0x7F ; |
| 4159 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0F , data ) ; |
| 4160 | |
| 4161 | if ( ModeNo > 0x13 ) |
| 4162 | { |
| 4163 | ModeFlag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 4164 | if ( ( ModeFlag & HalfDCLK ) && ( ModeFlag & DoubleScanMode ) ) |
| 4165 | { |
| 4166 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x0F ) ; |
| 4167 | data |= 0x80 ; |
| 4168 | XGINew_SetReg1( pVBInfo->P3c4 , 0x0F , data ) ; |
| 4169 | data = XGINew_GetReg1( pVBInfo->P3c4 , 0x01 ) ; |
| 4170 | data &= 0xF7 ; |
| 4171 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , data ) ; |
| 4172 | } |
| 4173 | } |
| 4174 | } |
| 4175 | |
| 4176 | */ |
| 4177 | |
| 4178 | /* --------------------------------------------------------------------- */ |
| 4179 | /* Function : XGI_DisplayOn */ |
| 4180 | /* Input : */ |
| 4181 | /* Output : */ |
| 4182 | /* Description : */ |
| 4183 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4184 | void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4185 | { |
| 4186 | |
| 4187 | XGINew_SetRegANDOR(pVBInfo->P3c4,0x01,0xDF,0x00); |
| 4188 | if ( pXGIHWDE->jChipType == XG21 ) |
| 4189 | { |
| 4190 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 4191 | { |
| 4192 | if (!(XGI_XG21GetPSCValue( pVBInfo )&0x1)) |
| 4193 | { |
| 4194 | XGI_XG21BLSignalVDD( 0x01 , 0x01, pVBInfo ) ; /* LVDS VDD on */ |
| 4195 | XGI_XG21SetPanelDelay( 2,pVBInfo ) ; |
| 4196 | } |
| 4197 | if (!(XGI_XG21GetPSCValue( pVBInfo )&0x20)) |
| 4198 | { |
| 4199 | XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* LVDS signal on */ |
| 4200 | } |
| 4201 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; |
| 4202 | XGI_XG21BLSignalVDD( 0x02 , 0x02, pVBInfo ) ; /* LVDS backlight on */ |
| 4203 | } |
| 4204 | else |
| 4205 | { |
| 4206 | XGI_XG21BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* DVO/DVI signal on */ |
| 4207 | } |
| 4208 | |
| 4209 | } |
| 4210 | |
| 4211 | if (pVBInfo->IF_DEF_CH7007 == 1) /* [Billy] 07/05/23 For CH7007 */ |
| 4212 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4213 | |
| 4214 | } |
| 4215 | |
| 4216 | |
| 4217 | if ( pXGIHWDE->jChipType == XG27 ) |
| 4218 | { |
| 4219 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 4220 | { |
| 4221 | if (!(XGI_XG27GetPSCValue( pVBInfo )&0x1)) |
| 4222 | { |
| 4223 | XGI_XG27BLSignalVDD( 0x01 , 0x01, pVBInfo ) ; /* LVDS VDD on */ |
| 4224 | XGI_XG21SetPanelDelay( 2,pVBInfo ) ; |
| 4225 | } |
| 4226 | if (!(XGI_XG27GetPSCValue( pVBInfo )&0x20)) |
| 4227 | { |
| 4228 | XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* LVDS signal on */ |
| 4229 | } |
| 4230 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; |
| 4231 | XGI_XG27BLSignalVDD( 0x02 , 0x02, pVBInfo ) ; /* LVDS backlight on */ |
| 4232 | } |
| 4233 | else |
| 4234 | { |
| 4235 | XGI_XG27BLSignalVDD( 0x20 , 0x20, pVBInfo ) ; /* DVO/DVI signal on */ |
| 4236 | } |
| 4237 | |
| 4238 | } |
| 4239 | } |
| 4240 | |
| 4241 | |
| 4242 | /* --------------------------------------------------------------------- */ |
| 4243 | /* Function : XGI_DisplayOff */ |
| 4244 | /* Input : */ |
| 4245 | /* Output : */ |
| 4246 | /* Description : */ |
| 4247 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4248 | void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4249 | { |
| 4250 | |
| 4251 | if ( pXGIHWDE->jChipType == XG21 ) |
| 4252 | { |
| 4253 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 4254 | { |
| 4255 | XGI_XG21BLSignalVDD( 0x02 , 0x00, pVBInfo ) ; /* LVDS backlight off */ |
| 4256 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; |
| 4257 | } |
| 4258 | else |
| 4259 | { |
| 4260 | XGI_XG21BLSignalVDD( 0x20 , 0x00, pVBInfo ) ; /* DVO/DVI signal off */ |
| 4261 | } |
| 4262 | } |
| 4263 | |
| 4264 | if (pVBInfo->IF_DEF_CH7007 == 1) /*[Billy] 07/05/23 For CH7007 */ |
| 4265 | { |
| 4266 | /* if( IsCH7007TVMode( pVBInfo ) == 0 ) */ |
| 4267 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4268 | } |
| 4269 | } |
| 4270 | |
| 4271 | |
| 4272 | if ( pXGIHWDE->jChipType == XG27 ) |
| 4273 | { |
| 4274 | if ((XGI_XG27GetPSCValue( pVBInfo )&0x2)) |
| 4275 | { |
| 4276 | XGI_XG27BLSignalVDD( 0x02 , 0x00, pVBInfo ) ; /* LVDS backlight off */ |
| 4277 | XGI_XG21SetPanelDelay( 3,pVBInfo ) ; |
| 4278 | } |
| 4279 | |
| 4280 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 4281 | { |
| 4282 | XGI_XG27BLSignalVDD( 0x20 , 0x00, pVBInfo ) ; /* DVO/DVI signal off */ |
| 4283 | } |
| 4284 | } |
| 4285 | |
| 4286 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x01 , 0xDF , 0x20 ) ; |
| 4287 | } |
| 4288 | |
| 4289 | |
| 4290 | /* --------------------------------------------------------------------- */ |
| 4291 | /* Function : XGI_WaitDisply */ |
| 4292 | /* Input : */ |
| 4293 | /* Output : */ |
| 4294 | /* Description : chiawen for sensecrt1 */ |
| 4295 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4296 | void XGI_WaitDisply(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4297 | { |
| 4298 | while( ( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) |
| 4299 | break ; |
| 4300 | |
| 4301 | while( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) |
| 4302 | break ; |
| 4303 | } |
| 4304 | |
| 4305 | /* --------------------------------------------------------------------- */ |
| 4306 | /* Function : XGI_SenseCRT1 */ |
| 4307 | /* Input : */ |
| 4308 | /* Output : */ |
| 4309 | /* Description : */ |
| 4310 | /* --------------------------------------------------------------------- */ |
| 4311 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4312 | void XGI_SenseCRT1(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4313 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4314 | unsigned char CRTCData[17] = { |
| 4315 | 0x5F , 0x4F , 0x50 , 0x82 , 0x55 , 0x81 , |
| 4316 | 0x0B , 0x3E , 0xE9 , 0x0B , 0xDF , 0xE7 , |
| 4317 | 0x04 , 0x00 , 0x00 , 0x05 , 0x00 }; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4318 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4319 | unsigned char SR01 = 0, SR1F = 0, SR07 = 0, SR06 = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4320 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4321 | unsigned char CR17, CR63, SR31; |
| 4322 | unsigned short temp ; |
| 4323 | unsigned char DAC_TEST_PARMS[3] = { 0x0F, 0x0F, 0x0F } ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4324 | |
| 4325 | int i ; |
| 4326 | XGINew_SetReg1( pVBInfo->P3c4 , 0x05 , 0x86 ) ; |
| 4327 | |
| 4328 | /* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */ |
| 4329 | XGINew_SetReg1( pVBInfo->P3d4 , 0x57 , 0x4A ) ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4330 | XGINew_SetReg1(pVBInfo->P3d4, 0x53, (unsigned char)(XGINew_GetReg1(pVBInfo->P3d4, 0x53) | 0x02)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4331 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4332 | SR31 = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x31); |
| 4333 | CR63 = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x63); |
| 4334 | SR01 = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x01); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4335 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4336 | XGINew_SetReg1(pVBInfo->P3c4, 0x01, (unsigned char)(SR01 & 0xDF)); |
| 4337 | XGINew_SetReg1(pVBInfo->P3d4, 0x63, (unsigned char)(CR63 & 0xBF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4338 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4339 | CR17 = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x17); |
| 4340 | XGINew_SetReg1(pVBInfo->P3d4, 0x17, (unsigned char)(CR17 | 0x80)) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4341 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4342 | SR1F = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x1F); |
| 4343 | XGINew_SetReg1(pVBInfo->P3c4, 0x1F, (unsigned char)(SR1F | 0x04)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4344 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4345 | SR07 = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x07); |
| 4346 | XGINew_SetReg1(pVBInfo->P3c4, 0x07, (unsigned char)(SR07 & 0xFB)); |
| 4347 | SR06 = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x06); |
| 4348 | XGINew_SetReg1(pVBInfo->P3c4, 0x06, (unsigned char)(SR06 & 0xC3)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4349 | |
| 4350 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , 0x00 ) ; |
| 4351 | |
| 4352 | for( i = 0 ; i < 8 ; i++ ) |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4353 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)i, CRTCData[i]); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4354 | |
| 4355 | for( i = 8 ; i < 11 ; i++ ) |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4356 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)(i + 8), CRTCData[i]); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4357 | |
| 4358 | for( i = 11 ; i < 13 ; i++ ) |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4359 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short)(i + 4), CRTCData[i]); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4360 | |
| 4361 | for( i = 13 ; i < 16 ; i++ ) |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4362 | XGINew_SetReg1(pVBInfo->P3c4, (unsigned short)(i - 3), CRTCData[i]); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4363 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4364 | XGINew_SetReg1(pVBInfo->P3c4, 0x0E, (unsigned char)(CRTCData[16] & 0xE0)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4365 | |
| 4366 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , 0x00 ) ; |
| 4367 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , 0x1B ) ; |
| 4368 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , 0xE1 ) ; |
| 4369 | |
| 4370 | XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ; |
| 4371 | |
| 4372 | for( i = 0 ; i < 256 ; i++ ) |
| 4373 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4374 | XGINew_SetReg3((pVBInfo->P3c8 + 1), (unsigned char)DAC_TEST_PARMS[0]); |
| 4375 | XGINew_SetReg3((pVBInfo->P3c8 + 1), (unsigned char)DAC_TEST_PARMS[1]); |
| 4376 | XGINew_SetReg3((pVBInfo->P3c8 + 1), (unsigned char)DAC_TEST_PARMS[2]); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4377 | } |
| 4378 | |
| 4379 | XGI_VBLongWait( pVBInfo ) ; |
| 4380 | XGI_VBLongWait( pVBInfo ) ; |
| 4381 | XGI_VBLongWait( pVBInfo ) ; |
| 4382 | |
| 4383 | XGINew_LCD_Wait_Time( 0x01 , pVBInfo ) ; |
| 4384 | |
| 4385 | XGI_WaitDisply( pVBInfo ) ; |
| 4386 | temp = XGINew_GetReg2( pVBInfo->P3c2 ) ; |
| 4387 | |
| 4388 | if( temp & 0x10 ) |
| 4389 | { |
| 4390 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x32 , 0xDF , 0x20 ) ; |
| 4391 | } |
| 4392 | else |
| 4393 | { |
| 4394 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x32 , 0xDF , 0x00 ) ; |
| 4395 | } |
| 4396 | |
| 4397 | /* alan, avoid display something, set BLACK DAC if not restore DAC */ |
| 4398 | XGINew_SetReg3( pVBInfo->P3c8 , 0x00 ) ; |
| 4399 | |
| 4400 | for( i = 0 ; i < 256 ; i++ ) |
| 4401 | { |
| 4402 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , 0 ) ; |
| 4403 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , 0 ) ; |
| 4404 | XGINew_SetReg3( ( pVBInfo->P3c8 + 1 ) , 0 ) ; |
| 4405 | } |
| 4406 | |
| 4407 | XGINew_SetReg1( pVBInfo->P3c4 , 0x01 , SR01 ) ; |
| 4408 | XGINew_SetReg1( pVBInfo->P3d4 , 0x63 , CR63 ) ; |
| 4409 | XGINew_SetReg1( pVBInfo->P3c4 , 0x31 , SR31 ) ; |
| 4410 | |
| 4411 | /* [2004/05/11] Vicent */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4412 | XGINew_SetReg1(pVBInfo->P3d4, 0x53, |
| 4413 | (unsigned char)(XGINew_GetReg1(pVBInfo->P3d4, 0x53) & 0xFD)); |
| 4414 | XGINew_SetReg1(pVBInfo->P3c4, 0x1F, (unsigned char)SR1F); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4415 | } |
| 4416 | |
| 4417 | |
| 4418 | |
| 4419 | |
| 4420 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4421 | |
| 4422 | |
| 4423 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4424 | |
| 4425 | |
| 4426 | /* --------------------------------------------------------------------- */ |
| 4427 | /* Function : XGI_WaitDisplay */ |
| 4428 | /* Input : */ |
| 4429 | /* Output : */ |
| 4430 | /* Description : */ |
| 4431 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4432 | void XGI_WaitDisplay(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4433 | { |
| 4434 | while( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ) ; |
| 4435 | |
| 4436 | while( XGINew_GetReg2( pVBInfo->P3da ) & 0x01 ) ; |
| 4437 | } |
| 4438 | |
| 4439 | |
| 4440 | |
| 4441 | |
| 4442 | /* --------------------------------------------------------------------- */ |
| 4443 | /* Function : XGI_SetCRT2Group301 */ |
| 4444 | /* Input : */ |
| 4445 | /* Output : */ |
| 4446 | /* Description : */ |
| 4447 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4448 | unsigned char XGI_SetCRT2Group301(unsigned short ModeNo, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 4449 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4450 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4451 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4452 | unsigned short tempbx , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4453 | ModeIdIndex , |
| 4454 | RefreshRateTableIndex ; |
| 4455 | |
| 4456 | tempbx=pVBInfo->VBInfo ; |
| 4457 | pVBInfo->SetFlag |= ProgrammingCRT2 ; |
| 4458 | XGI_SearchModeID( ModeNo , &ModeIdIndex, pVBInfo ) ; |
| 4459 | pVBInfo->SelectCRT2Rate = 4 ; |
| 4460 | RefreshRateTableIndex = XGI_GetRatePtrCRT2( HwDeviceExtension, ModeNo , ModeIdIndex, pVBInfo ) ; |
| 4461 | XGI_SaveCRT2Info( ModeNo, pVBInfo ) ; |
| 4462 | XGI_GetCRT2ResInfo( ModeNo , ModeIdIndex, pVBInfo) ; |
| 4463 | XGI_GetCRT2Data( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 4464 | XGI_PreSetGroup1( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 4465 | XGI_SetGroup1( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 4466 | XGI_SetLockRegs( ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 4467 | XGI_SetGroup2( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 4468 | XGI_SetLCDRegs(ModeNo , ModeIdIndex , HwDeviceExtension , RefreshRateTableIndex, pVBInfo ) ; |
| 4469 | XGI_SetTap4Regs(pVBInfo) ; |
| 4470 | XGI_SetGroup3(ModeNo, ModeIdIndex, pVBInfo); |
| 4471 | XGI_SetGroup4( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 4472 | XGI_SetCRT2VCLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 4473 | XGI_SetGroup5( ModeNo , ModeIdIndex, pVBInfo) ; |
| 4474 | XGI_AutoThreshold( pVBInfo) ; |
| 4475 | return 1 ; |
| 4476 | } |
| 4477 | |
| 4478 | |
| 4479 | /* --------------------------------------------------------------------- */ |
| 4480 | /* Function : XGI_AutoThreshold */ |
| 4481 | /* Input : */ |
| 4482 | /* Output : */ |
| 4483 | /* Description : */ |
| 4484 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4485 | void XGI_AutoThreshold(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4486 | { |
| 4487 | if ( !( pVBInfo->SetFlag & Win9xDOSMode ) ) |
| 4488 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x01 , 0x40 ) ; |
| 4489 | } |
| 4490 | |
| 4491 | |
| 4492 | /* --------------------------------------------------------------------- */ |
| 4493 | /* Function : XGI_SaveCRT2Info */ |
| 4494 | /* Input : */ |
| 4495 | /* Output : */ |
| 4496 | /* Description : */ |
| 4497 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4498 | void XGI_SaveCRT2Info(unsigned short ModeNo, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4499 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4500 | unsigned short temp1 , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4501 | temp2 ; |
| 4502 | |
| 4503 | XGINew_SetReg1( pVBInfo->P3d4 , 0x34 , ModeNo ) ; /* reserve CR34 for CRT1 Mode No */ |
| 4504 | temp1 = ( pVBInfo->VBInfo&SetInSlaveMode ) >> 8 ; |
| 4505 | temp2 = ~( SetInSlaveMode >> 8 ) ; |
| 4506 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x31 , temp2 , temp1 ) ; |
| 4507 | } |
| 4508 | |
| 4509 | |
| 4510 | /* --------------------------------------------------------------------- */ |
| 4511 | /* Function : XGI_GetCRT2ResInfo */ |
| 4512 | /* Input : */ |
| 4513 | /* Output : */ |
| 4514 | /* Description : */ |
| 4515 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4516 | void XGI_GetCRT2ResInfo(unsigned short ModeNo, |
| 4517 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4518 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4519 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4520 | unsigned short xres , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4521 | yres , |
| 4522 | modeflag , |
| 4523 | resindex ; |
| 4524 | |
| 4525 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo) ; |
| 4526 | if ( ModeNo <= 0x13 ) |
| 4527 | { |
| 4528 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 4529 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 4530 | /* modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; si+St_ResInfo */ |
| 4531 | } |
| 4532 | else |
| 4533 | { |
| 4534 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 4535 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ |
| 4536 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ |
| 4537 | |
| 4538 | /* if ( pVBInfo->IF_DEF_FSTN ) |
| 4539 | { |
| 4540 | xres *= 2 ; |
| 4541 | yres *= 2 ; |
| 4542 | } |
| 4543 | else |
| 4544 | { |
| 4545 | */ |
| 4546 | if ( modeflag & HalfDCLK ) |
| 4547 | xres *= 2; |
| 4548 | |
| 4549 | if ( modeflag & DoubleScanMode ) |
| 4550 | yres *= 2 ; |
| 4551 | /* } */ |
| 4552 | } |
| 4553 | |
| 4554 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 4555 | { |
| 4556 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 4557 | { |
| 4558 | if ( pVBInfo->LCDResInfo == Panel1600x1200 ) |
| 4559 | { |
| 4560 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 4561 | { |
| 4562 | if ( yres == 1024 ) |
| 4563 | yres = 1056 ; |
| 4564 | } |
| 4565 | } |
| 4566 | |
| 4567 | if ( pVBInfo->LCDResInfo == Panel1280x1024 ) |
| 4568 | { |
| 4569 | if ( yres == 400 ) |
| 4570 | yres = 405 ; |
| 4571 | else if ( yres == 350 ) |
| 4572 | yres = 360 ; |
| 4573 | |
| 4574 | if ( pVBInfo->LCDInfo & LCDVESATiming ) |
| 4575 | { |
| 4576 | if ( yres == 360 ) |
| 4577 | yres = 375 ; |
| 4578 | } |
| 4579 | } |
| 4580 | |
| 4581 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 4582 | { |
| 4583 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 4584 | { |
| 4585 | if ( !( pVBInfo->LCDInfo & LCDNonExpanding ) ) |
| 4586 | { |
| 4587 | if ( yres == 350 ) |
| 4588 | yres = 357 ; |
| 4589 | else if ( yres == 400 ) |
| 4590 | yres = 420 ; |
| 4591 | else if ( yres == 480 ) |
| 4592 | yres = 525 ; |
| 4593 | } |
| 4594 | } |
| 4595 | } |
| 4596 | } |
| 4597 | |
| 4598 | if ( xres == 720 ) |
| 4599 | xres = 640 ; |
| 4600 | } |
| 4601 | |
| 4602 | pVBInfo->VGAHDE = xres ; |
| 4603 | pVBInfo->HDE = xres ; |
| 4604 | pVBInfo->VGAVDE = yres ; |
| 4605 | pVBInfo->VDE = yres ; |
| 4606 | } |
| 4607 | |
| 4608 | |
| 4609 | /* --------------------------------------------------------------------- */ |
| 4610 | /* Function : XGI_IsLCDDualLink */ |
| 4611 | /* Input : */ |
| 4612 | /* Output : */ |
| 4613 | /* Description : */ |
| 4614 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4615 | unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4616 | { |
| 4617 | |
| 4618 | if ( ( ( ( pVBInfo->VBInfo & SetCRT2ToLCD ) | SetCRT2ToLCDA ) ) && ( pVBInfo->LCDInfo & SetLCDDualLink ) ) /* shampoo0129 */ |
| 4619 | return ( 1 ) ; |
| 4620 | |
| 4621 | return( 0 ) ; |
| 4622 | } |
| 4623 | |
| 4624 | |
| 4625 | /* --------------------------------------------------------------------- */ |
| 4626 | /* Function : XGI_GetCRT2Data */ |
| 4627 | /* Input : */ |
| 4628 | /* Output : */ |
| 4629 | /* Description : */ |
| 4630 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4631 | void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4632 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4633 | unsigned short tempax = 0, |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4634 | tempbx , |
| 4635 | modeflag , |
| 4636 | resinfo ; |
| 4637 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4638 | struct XGI_LCDDataStruct *LCDPtr = NULL ; |
| 4639 | struct XGI_TVDataStruct *TVPtr = NULL ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4640 | |
| 4641 | if ( ModeNo <= 0x13 ) |
| 4642 | { |
| 4643 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 4644 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 4645 | } |
| 4646 | else |
| 4647 | { |
| 4648 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 4649 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 4650 | } |
| 4651 | |
| 4652 | pVBInfo->NewFlickerMode = 0 ; |
| 4653 | pVBInfo->RVBHRS = 50 ; |
| 4654 | |
| 4655 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 4656 | { |
| 4657 | XGI_GetRAMDAC2DATA( ModeNo , ModeIdIndex , RefreshRateTableIndex,pVBInfo ) ; |
| 4658 | return ; |
| 4659 | } |
| 4660 | |
| 4661 | tempbx = 4 ; |
| 4662 | |
| 4663 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 4664 | { |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4665 | LCDPtr = (struct XGI_LCDDataStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4666 | |
| 4667 | pVBInfo->RVBHCMAX = LCDPtr->RVBHCMAX ; |
| 4668 | pVBInfo->RVBHCFACT = LCDPtr->RVBHCFACT ; |
| 4669 | pVBInfo->VGAHT = LCDPtr->VGAHT ; |
| 4670 | pVBInfo->VGAVT = LCDPtr->VGAVT ; |
| 4671 | pVBInfo->HT = LCDPtr->LCDHT ; |
| 4672 | pVBInfo->VT = LCDPtr->LCDVT ; |
| 4673 | |
| 4674 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 4675 | { |
| 4676 | tempax = 1024 ; |
| 4677 | tempbx = 768 ; |
| 4678 | |
| 4679 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 4680 | { |
| 4681 | if ( pVBInfo->VGAVDE == 357 ) |
| 4682 | tempbx = 527 ; |
| 4683 | else if ( pVBInfo->VGAVDE == 420 ) |
| 4684 | tempbx = 620 ; |
| 4685 | else if ( pVBInfo->VGAVDE == 525 ) |
| 4686 | tempbx = 775 ; |
| 4687 | else if ( pVBInfo->VGAVDE == 600 ) |
| 4688 | tempbx = 775 ; |
| 4689 | /* else if(pVBInfo->VGAVDE==350) tempbx=560; */ |
| 4690 | /* else if(pVBInfo->VGAVDE==400) tempbx=640; */ |
| 4691 | else |
| 4692 | tempbx = 768 ; |
| 4693 | } |
| 4694 | else |
| 4695 | tempbx = 768 ; |
| 4696 | } |
| 4697 | else if ( pVBInfo->LCDResInfo == Panel1024x768x75 ) |
| 4698 | { |
| 4699 | tempax = 1024 ; |
| 4700 | tempbx = 768 ; |
| 4701 | } |
| 4702 | else if ( pVBInfo->LCDResInfo == Panel1280x1024 ) |
| 4703 | { |
| 4704 | tempax = 1280 ; |
| 4705 | if ( pVBInfo->VGAVDE == 360 ) |
| 4706 | tempbx = 768 ; |
| 4707 | else if ( pVBInfo->VGAVDE == 375 ) |
| 4708 | tempbx = 800 ; |
| 4709 | else if ( pVBInfo->VGAVDE == 405 ) |
| 4710 | tempbx = 864 ; |
| 4711 | else |
| 4712 | tempbx = 1024 ; |
| 4713 | } |
| 4714 | else if ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) |
| 4715 | { |
| 4716 | tempax = 1280 ; |
| 4717 | tempbx = 1024 ; |
| 4718 | } |
| 4719 | else if ( pVBInfo->LCDResInfo == Panel1280x960 ) |
| 4720 | { |
| 4721 | tempax = 1280 ; |
| 4722 | if ( pVBInfo->VGAVDE == 350 ) |
| 4723 | tempbx = 700 ; |
| 4724 | else if ( pVBInfo->VGAVDE == 400 ) |
| 4725 | tempbx = 800 ; |
| 4726 | else if ( pVBInfo->VGAVDE == 1024 ) |
| 4727 | tempbx = 960 ; |
| 4728 | else |
| 4729 | tempbx = 960 ; |
| 4730 | } |
| 4731 | else if ( pVBInfo->LCDResInfo == Panel1400x1050 ) |
| 4732 | { |
| 4733 | tempax = 1400 ; |
| 4734 | tempbx = 1050 ; |
| 4735 | |
| 4736 | if ( pVBInfo->VGAVDE == 1024 ) |
| 4737 | { |
| 4738 | tempax = 1280 ; |
| 4739 | tempbx = 1024 ; |
| 4740 | } |
| 4741 | } |
| 4742 | else if ( pVBInfo->LCDResInfo == Panel1600x1200 ) |
| 4743 | { |
| 4744 | tempax = 1600 ; |
| 4745 | tempbx = 1200 ; /* alan 10/14/2003 */ |
| 4746 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 4747 | { |
| 4748 | if ( pVBInfo->VGAVDE == 350 ) |
| 4749 | tempbx = 875 ; |
| 4750 | else if ( pVBInfo->VGAVDE == 400 ) |
| 4751 | tempbx = 1000 ; |
| 4752 | } |
| 4753 | } |
| 4754 | |
| 4755 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) |
| 4756 | { |
| 4757 | tempax = pVBInfo->VGAHDE ; |
| 4758 | tempbx = pVBInfo->VGAVDE ; |
| 4759 | } |
| 4760 | |
| 4761 | pVBInfo->HDE = tempax ; |
| 4762 | pVBInfo->VDE = tempbx ; |
| 4763 | return ; |
| 4764 | } |
| 4765 | |
| 4766 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV ) ) |
| 4767 | { |
| 4768 | tempbx = 4 ; |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4769 | TVPtr = (struct XGI_TVDataStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4770 | |
| 4771 | pVBInfo->RVBHCMAX = TVPtr->RVBHCMAX ; |
| 4772 | pVBInfo->RVBHCFACT = TVPtr->RVBHCFACT ; |
| 4773 | pVBInfo->VGAHT = TVPtr->VGAHT ; |
| 4774 | pVBInfo->VGAVT = TVPtr->VGAVT ; |
| 4775 | pVBInfo->HDE = TVPtr->TVHDE ; |
| 4776 | pVBInfo->VDE = TVPtr->TVVDE ; |
| 4777 | pVBInfo->RVBHRS = TVPtr->RVBHRS ; |
| 4778 | pVBInfo->NewFlickerMode = TVPtr->FlickerMode ; |
| 4779 | |
| 4780 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 4781 | { |
| 4782 | if ( resinfo == 0x08 ) |
| 4783 | pVBInfo->NewFlickerMode = 0x40 ; |
| 4784 | else if ( resinfo == 0x09 ) |
| 4785 | pVBInfo->NewFlickerMode = 0x40 ; |
| 4786 | else if ( resinfo == 0x12 ) |
| 4787 | pVBInfo->NewFlickerMode = 0x40 ; |
| 4788 | |
| 4789 | if ( pVBInfo->VGAVDE == 350 ) |
| 4790 | pVBInfo->TVInfo |= TVSimuMode ; |
| 4791 | |
| 4792 | tempax = ExtHiTVHT ; |
| 4793 | tempbx = ExtHiTVVT ; |
| 4794 | |
| 4795 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 4796 | { |
| 4797 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 4798 | { |
| 4799 | tempax = StHiTVHT ; |
| 4800 | tempbx = StHiTVVT ; |
| 4801 | |
| 4802 | if ( !( modeflag & Charx8Dot ) ) |
| 4803 | { |
| 4804 | tempax = StHiTextTVHT ; |
| 4805 | tempbx = StHiTextTVVT ; |
| 4806 | } |
| 4807 | } |
| 4808 | } |
| 4809 | } |
| 4810 | else if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 4811 | { |
| 4812 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 4813 | { |
| 4814 | tempax = YPbPrTV750pHT ; /* Ext750pTVHT */ |
| 4815 | tempbx = YPbPrTV750pVT ; /* Ext750pTVVT */ |
| 4816 | } |
| 4817 | |
| 4818 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 4819 | { |
| 4820 | tempax = YPbPrTV525pHT ; /* Ext525pTVHT */ |
| 4821 | tempbx = YPbPrTV525pVT ; /* Ext525pTVVT */ |
| 4822 | } |
| 4823 | else if ( pVBInfo->TVInfo & SetYPbPrMode525i ) |
| 4824 | { |
| 4825 | tempax = YPbPrTV525iHT ; /* Ext525iTVHT */ |
| 4826 | tempbx = YPbPrTV525iVT ; /* Ext525iTVVT */ |
| 4827 | if ( pVBInfo->TVInfo & NTSC1024x768 ) |
| 4828 | tempax = NTSC1024x768HT ; |
| 4829 | } |
| 4830 | } |
| 4831 | else |
| 4832 | { |
| 4833 | tempax = PALHT ; |
| 4834 | tempbx = PALVT ; |
| 4835 | if ( !( pVBInfo->TVInfo & SetPALTV ) ) |
| 4836 | { |
| 4837 | tempax = NTSCHT ; |
| 4838 | tempbx = NTSCVT ; |
| 4839 | if ( pVBInfo->TVInfo & NTSC1024x768 ) |
| 4840 | tempax = NTSC1024x768HT ; |
| 4841 | } |
| 4842 | } |
| 4843 | |
| 4844 | pVBInfo->HT = tempax ; |
| 4845 | pVBInfo->VT = tempbx ; |
| 4846 | return ; |
| 4847 | } |
| 4848 | } |
| 4849 | |
| 4850 | |
| 4851 | /* --------------------------------------------------------------------- */ |
| 4852 | /* Function : XGI_SetCRT2VCLK */ |
| 4853 | /* Input : */ |
| 4854 | /* Output : */ |
| 4855 | /* Description : */ |
| 4856 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4857 | void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4858 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4859 | unsigned char di_0, di_1, tempal; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4860 | |
| 4861 | tempal = XGI_GetVCLKPtr( RefreshRateTableIndex , ModeNo , ModeIdIndex, pVBInfo ) ; |
| 4862 | XGI_GetVCLKLen( tempal, &di_0 , &di_1, pVBInfo ) ; |
| 4863 | XGI_GetLCDVCLKPtr( &di_0 , &di_1, pVBInfo ) ; |
| 4864 | |
| 4865 | if ( pVBInfo->VBType & VB_XGI301 ) /* shampoo 0129 */ |
| 4866 | { /* 301 */ |
| 4867 | XGINew_SetReg1(pVBInfo->Part4Port , 0x0A , 0x10 ) ; |
| 4868 | XGINew_SetReg1(pVBInfo->Part4Port , 0x0B , di_1 ) ; |
| 4869 | XGINew_SetReg1(pVBInfo->Part4Port , 0x0A , di_0 ) ; |
| 4870 | } |
| 4871 | else |
| 4872 | { /* 301b/302b/301lv/302lv */ |
| 4873 | XGINew_SetReg1( pVBInfo->Part4Port , 0x0A , di_0 ) ; |
| 4874 | XGINew_SetReg1( pVBInfo->Part4Port , 0x0B , di_1 ) ; |
| 4875 | } |
| 4876 | |
| 4877 | XGINew_SetReg1( pVBInfo->Part4Port , 0x00 , 0x12 ) ; |
| 4878 | |
| 4879 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 4880 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x12 , 0x28 ) ; |
| 4881 | else |
| 4882 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x12 , 0x08 ) ; |
| 4883 | } |
| 4884 | |
| 4885 | |
| 4886 | /* --------------------------------------------------------------------- */ |
| 4887 | /* Function : XGI_GETLCDVCLKPtr */ |
| 4888 | /* Input : */ |
| 4889 | /* Output : al -> VCLK Index */ |
| 4890 | /* Description : */ |
| 4891 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4892 | void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4893 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4894 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4895 | unsigned short index ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4896 | |
| 4897 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 4898 | { |
| 4899 | if ( pVBInfo->IF_DEF_ScaleLCD == 1 ) |
| 4900 | { |
| 4901 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 4902 | return ; |
| 4903 | } |
| 4904 | |
| 4905 | /* index = XGI_GetLCDCapPtr(pVBInfo) ; */ |
| 4906 | index = XGI_GetLCDCapPtr1( pVBInfo) ; |
| 4907 | |
| 4908 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 4909 | { /* LCDB */ |
| 4910 | *di_0 = pVBInfo->LCDCapList[ index ].LCUCHAR_VCLKData1 ; |
| 4911 | *di_1 = pVBInfo->LCDCapList[ index ].LCUCHAR_VCLKData2 ; |
| 4912 | } |
| 4913 | else |
| 4914 | { /* LCDA */ |
| 4915 | *di_0 = pVBInfo->LCDCapList[ index ].LCDA_VCLKData1 ; |
| 4916 | *di_1 = pVBInfo->LCDCapList[ index ].LCDA_VCLKData2 ; |
| 4917 | } |
| 4918 | } |
| 4919 | return ; |
| 4920 | } |
| 4921 | |
| 4922 | |
| 4923 | /* --------------------------------------------------------------------- */ |
| 4924 | /* Function : XGI_GetVCLKPtr */ |
| 4925 | /* Input : */ |
| 4926 | /* Output : */ |
| 4927 | /* Description : */ |
| 4928 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4929 | unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, |
| 4930 | unsigned short ModeNo, unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 4931 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4932 | { |
| 4933 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4934 | unsigned short index , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4935 | modeflag ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4936 | unsigned short tempbx ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4937 | unsigned char tempal; |
| 4938 | unsigned char *CHTVVCLKPtr = NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4939 | |
| 4940 | if ( ModeNo <= 0x13 ) |
| 4941 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 4942 | else |
| 4943 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
| 4944 | |
| 4945 | |
| 4946 | if ( ( pVBInfo->SetFlag & ProgrammingCRT2 ) && ( !( pVBInfo->LCDInfo & EnableScalingLCD ) ) ) |
| 4947 | { /* {LCDA/LCDB} */ |
| 4948 | index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 4949 | tempal = pVBInfo->LCDCapList[ index ].LCD_VCLK ; |
| 4950 | |
| 4951 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 4952 | return tempal ; |
| 4953 | |
| 4954 | /* {TV} */ |
| 4955 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV| VB_XGI302LV| VB_XGI301C ) ) |
| 4956 | { |
| 4957 | if(pVBInfo->VBInfo&SetCRT2ToHiVisionTV) |
| 4958 | { |
| 4959 | tempal = HiTVVCLKDIV2; |
| 4960 | if(!(pVBInfo->TVInfo & RPLLDIV2XO)) |
| 4961 | tempal = HiTVVCLK; |
| 4962 | if(pVBInfo->TVInfo & TVSimuMode) |
| 4963 | { |
| 4964 | tempal = HiTVSimuVCLK; |
| 4965 | if(!(modeflag & Charx8Dot)) |
| 4966 | tempal = HiTVTextVCLK; |
| 4967 | |
| 4968 | } |
| 4969 | return tempal; |
| 4970 | } |
| 4971 | |
| 4972 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 4973 | { |
| 4974 | tempal = YPbPr750pVCLK ; |
| 4975 | return tempal ; |
| 4976 | } |
| 4977 | |
| 4978 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 4979 | { |
| 4980 | tempal = YPbPr525pVCLK ; |
| 4981 | return tempal ; |
| 4982 | } |
| 4983 | |
| 4984 | tempal = NTSC1024VCLK ; |
| 4985 | |
| 4986 | if ( !( pVBInfo->TVInfo & NTSC1024x768 ) ) |
| 4987 | { |
| 4988 | tempal = TVVCLKDIV2 ; |
| 4989 | if ( !( pVBInfo->TVInfo & RPLLDIV2XO ) ) |
| 4990 | tempal = TVVCLK ; |
| 4991 | } |
| 4992 | |
| 4993 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 4994 | return tempal ; |
| 4995 | } |
| 4996 | /*else |
| 4997 | if((pVBInfo->IF_DEF_CH7017==1)&&(pVBInfo->VBType&VB_CH7017)) |
| 4998 | { |
| 4999 | if(ModeNo<=0x13) |
| 5000 | *tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; |
| 5001 | else |
| 5002 | *tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 5003 | *tempal = *tempal & 0x1F; |
| 5004 | |
| 5005 | tempbx = 0; |
| 5006 | if(pVBInfo->TVInfo & SetPALTV) |
| 5007 | tempbx = tempbx + 2; |
| 5008 | if(pVBInfo->TVInfo & SetCHTVOverScan) |
| 5009 | tempbx++; |
| 5010 | tempbx = tempbx << 1; |
| 5011 | } */ |
| 5012 | } /* {End of VB} */ |
| 5013 | |
| 5014 | if((pVBInfo->IF_DEF_CH7007==1)&&(pVBInfo->VBType&VB_CH7007)) /* [Billy] 07/05/08 CH7007 */ |
| 5015 | { |
| 5016 | /* VideoDebugPrint((0, "XGI_GetVCLKPtr: pVBInfo->IF_DEF_CH7007==1\n")); */ |
| 5017 | if ( (pVBInfo->VBInfo & SetCRT2ToTV) ) |
| 5018 | { |
| 5019 | if( ModeNo <= 0x13 ) |
| 5020 | { |
| 5021 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 5022 | } |
| 5023 | else |
| 5024 | { |
| 5025 | tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 5026 | } |
| 5027 | |
| 5028 | tempal = tempal & 0x0F; |
| 5029 | tempbx = 0; |
| 5030 | |
| 5031 | if(pVBInfo->TVInfo & SetPALTV) |
| 5032 | { |
| 5033 | tempbx = tempbx + 2; |
| 5034 | } |
| 5035 | if(pVBInfo->TVInfo & SetCHTVOverScan) |
| 5036 | { |
| 5037 | tempbx++; |
| 5038 | } |
| 5039 | /** tempbx = tempbx << 1; CH7007 ? **/ |
| 5040 | |
| 5041 | /*[Billy]07/05/29 CH7007*/ |
| 5042 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 5043 | { |
| 5044 | switch( tempbx ) |
| 5045 | { |
| 5046 | case 0: |
| 5047 | CHTVVCLKPtr = XGI7007_CHTVVCLKUNTSC ; |
| 5048 | break ; |
| 5049 | case 1: |
| 5050 | CHTVVCLKPtr = XGI7007_CHTVVCLKONTSC ; |
| 5051 | break ; |
| 5052 | case 2: |
| 5053 | CHTVVCLKPtr = XGI7007_CHTVVCLKUPAL ; |
| 5054 | break ; |
| 5055 | case 3: |
| 5056 | CHTVVCLKPtr = XGI7007_CHTVVCLKOPAL ; |
| 5057 | break ; |
| 5058 | default: |
| 5059 | break ; |
| 5060 | |
| 5061 | } |
| 5062 | } |
| 5063 | /*else |
| 5064 | { |
| 5065 | switch( tempbx ) |
| 5066 | { |
| 5067 | case 0: |
| 5068 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC ; |
| 5069 | break ; |
| 5070 | case 1: |
| 5071 | CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC ; |
| 5072 | break ; |
| 5073 | case 2: |
| 5074 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL ; |
| 5075 | break ; |
| 5076 | case 3: |
| 5077 | CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL ; |
| 5078 | break ; |
| 5079 | default: |
| 5080 | break ; |
| 5081 | } |
| 5082 | }*/ |
| 5083 | |
| 5084 | tempal = CHTVVCLKPtr[ tempal ] ; |
| 5085 | return tempal ; |
| 5086 | } |
| 5087 | |
| 5088 | } |
| 5089 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 5090 | tempal = (unsigned char)XGINew_GetReg2((pVBInfo->P3ca + 0x02)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5091 | tempal = tempal >> 2 ; |
| 5092 | tempal &= 0x03 ; |
| 5093 | |
| 5094 | if ( ( pVBInfo->LCDInfo & EnableScalingLCD ) && ( modeflag & Charx8Dot ) ) /* for Dot8 Scaling LCD */ |
| 5095 | tempal = tempal ^ tempal ; /* ; set to VCLK25MHz always */ |
| 5096 | |
| 5097 | if ( ModeNo <= 0x13 ) |
| 5098 | return tempal ; |
| 5099 | |
| 5100 | tempal = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; |
| 5101 | return tempal ; |
| 5102 | } |
| 5103 | |
| 5104 | |
| 5105 | /* --------------------------------------------------------------------- */ |
| 5106 | /* Function : XGI_GetVCLKLen */ |
| 5107 | /* Input : */ |
| 5108 | /* Output : */ |
| 5109 | /* Description : */ |
| 5110 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 5111 | void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 5112 | unsigned char *di_1, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5113 | { |
| 5114 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) /* [Billy] 2007/05/16 */ |
| 5115 | { |
| 5116 | /* VideoDebugPrint((0, "XGI_GetVCLKLen: pVBInfo->IF_DEF_CH7007==1\n")); */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 5117 | *di_0 = (unsigned char)XGI_CH7007VCLKData[tempal].SR2B; |
| 5118 | *di_1 = (unsigned char)XGI_CH7007VCLKData[tempal].SR2C; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5119 | } |
| 5120 | else if ( pVBInfo->VBType & ( VB_XGI301 | VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 5121 | { |
| 5122 | if ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( pVBInfo->SetFlag & ProgrammingCRT2 ) ) |
| 5123 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 5124 | *di_0 = (unsigned char)XGI_VBVCLKData[tempal].SR2B; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5125 | *di_1 = XGI_VBVCLKData[ tempal ].SR2C ; |
| 5126 | } |
| 5127 | } |
| 5128 | else |
| 5129 | { |
| 5130 | *di_0 = XGI_VCLKData[ tempal ].SR2B ; |
| 5131 | *di_1 = XGI_VCLKData[ tempal ].SR2C ; |
| 5132 | } |
| 5133 | } |
| 5134 | |
| 5135 | |
| 5136 | /* --------------------------------------------------------------------- */ |
| 5137 | /* Function : XGI_SetCRT2Offset */ |
| 5138 | /* Input : */ |
| 5139 | /* Output : */ |
| 5140 | /* Description : */ |
| 5141 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 5142 | void XGI_SetCRT2Offset(unsigned short ModeNo, |
| 5143 | unsigned short ModeIdIndex, |
| 5144 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 5145 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 5146 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5147 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5148 | unsigned short offset ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 5149 | unsigned char temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5150 | |
| 5151 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 5152 | { |
| 5153 | return ; |
| 5154 | } |
| 5155 | |
| 5156 | offset = XGI_GetOffset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 5157 | temp = (unsigned char)(offset & 0xFF); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5158 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , temp ) ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 5159 | temp = (unsigned char)((offset & 0xFF00) >> 8); |
| 5160 | XGINew_SetReg1(pVBInfo->Part1Port , 0x09 , temp); |
| 5161 | temp = (unsigned char)(((offset >> 3) & 0xFF) + 1) ; |
| 5162 | XGINew_SetReg1(pVBInfo->Part1Port, 0x03, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5163 | } |
| 5164 | |
| 5165 | |
| 5166 | /* --------------------------------------------------------------------- */ |
| 5167 | /* Function : XGI_GetOffset */ |
| 5168 | /* Input : */ |
| 5169 | /* Output : */ |
| 5170 | /* Description : */ |
| 5171 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 5172 | unsigned short XGI_GetOffset(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5173 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5174 | unsigned short temp , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5175 | colordepth , |
| 5176 | modeinfo , |
| 5177 | index , |
| 5178 | infoflag , |
| 5179 | ColorDepth[] = { 0x01 , 0x02 , 0x04 } ; |
| 5180 | |
| 5181 | modeinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeInfo ; |
| 5182 | if ( ModeNo <= 0x14 ) |
| 5183 | infoflag = 0 ; |
| 5184 | else |
| 5185 | infoflag = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_InfoFlag ; |
| 5186 | |
| 5187 | |
| 5188 | index = ( modeinfo >> 8 ) & 0xFF ; |
| 5189 | |
| 5190 | temp = pVBInfo->ScreenOffset[ index ] ; |
| 5191 | |
| 5192 | if ( infoflag & InterlaceMode ) |
| 5193 | { |
| 5194 | temp = temp << 1 ; |
| 5195 | } |
| 5196 | |
| 5197 | colordepth = XGI_GetColorDepth( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 5198 | |
| 5199 | if ( ( ModeNo >= 0x7C ) && ( ModeNo <= 0x7E ) ) |
| 5200 | { |
| 5201 | temp = ModeNo - 0x7C ; |
| 5202 | colordepth = ColorDepth[ temp ] ; |
| 5203 | temp = 0x6B ; |
| 5204 | if ( infoflag & InterlaceMode ) |
| 5205 | { |
| 5206 | temp = temp << 1 ; |
| 5207 | } |
| 5208 | return( temp * colordepth ) ; |
| 5209 | } |
| 5210 | else |
| 5211 | return( temp * colordepth ) ; |
| 5212 | } |
| 5213 | |
| 5214 | |
| 5215 | /* --------------------------------------------------------------------- */ |
| 5216 | /* Function : XGI_SetCRT2FIFO */ |
| 5217 | /* Input : */ |
| 5218 | /* Output : */ |
| 5219 | /* Description : */ |
| 5220 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 5221 | void XGI_SetCRT2FIFO(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5222 | { |
| 5223 | XGINew_SetReg1( pVBInfo->Part1Port , 0x01 , 0x3B ) ; /* threshold high ,disable auto threshold */ |
| 5224 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x02 , ~( 0x3F ) , 0x04 ) ; /* threshold low default 04h */ |
| 5225 | } |
| 5226 | |
| 5227 | |
| 5228 | /* --------------------------------------------------------------------- */ |
| 5229 | /* Function : XGI_PreSetGroup1 */ |
| 5230 | /* Input : */ |
| 5231 | /* Output : */ |
| 5232 | /* Description : */ |
| 5233 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5234 | void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 5235 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5236 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 5237 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5238 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5239 | unsigned short tempcx = 0 , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5240 | CRT1Index = 0 , |
| 5241 | resinfo = 0 ; |
| 5242 | |
| 5243 | if ( ModeNo > 0x13 ) |
| 5244 | { |
| 5245 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 5246 | CRT1Index &= IndexMask ; |
| 5247 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 5248 | } |
| 5249 | |
| 5250 | XGI_SetCRT2Offset( ModeNo , ModeIdIndex , RefreshRateTableIndex , HwDeviceExtension, pVBInfo ) ; |
| 5251 | XGI_SetCRT2FIFO(pVBInfo) ; |
| 5252 | /* XGI_SetCRT2Sync(ModeNo,RefreshRateTableIndex); */ |
| 5253 | |
| 5254 | for( tempcx = 4 ; tempcx < 7 ; tempcx++ ) |
| 5255 | { |
| 5256 | XGINew_SetReg1( pVBInfo->Part1Port , tempcx , 0x0 ) ; |
| 5257 | } |
| 5258 | |
| 5259 | XGINew_SetReg1( pVBInfo->Part1Port , 0x50 , 0x00 ) ; |
| 5260 | XGINew_SetReg1( pVBInfo->Part1Port , 0x02 , 0x44 ) ; /* temp 0206 */ |
| 5261 | } |
| 5262 | |
| 5263 | |
| 5264 | /* --------------------------------------------------------------------- */ |
| 5265 | /* Function : XGI_SetGroup1 */ |
| 5266 | /* Input : */ |
| 5267 | /* Output : */ |
| 5268 | /* Description : */ |
| 5269 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5270 | void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 5271 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5272 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 5273 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5274 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5275 | unsigned short temp = 0 , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5276 | tempax = 0 , |
| 5277 | tempbx = 0 , |
| 5278 | tempcx = 0 , |
| 5279 | pushbx = 0 , |
| 5280 | CRT1Index = 0 , |
| 5281 | modeflag , |
| 5282 | resinfo = 0 ; |
| 5283 | |
| 5284 | if ( ModeNo > 0x13 ) |
| 5285 | { |
| 5286 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 5287 | CRT1Index &= IndexMask ; |
| 5288 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 5289 | } |
| 5290 | |
| 5291 | if ( ModeNo <= 0x13 ) |
| 5292 | { |
| 5293 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 5294 | } |
| 5295 | else |
| 5296 | { |
| 5297 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 5298 | } |
| 5299 | |
| 5300 | /* bainy change table name */ |
| 5301 | if ( modeflag & HalfDCLK ) |
| 5302 | { |
| 5303 | temp = ( pVBInfo->VGAHT / 2 - 1 ) & 0x0FF ; /* BTVGA2HT 0x08,0x09 */ |
| 5304 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , temp ) ; |
| 5305 | temp = ( ( ( pVBInfo->VGAHT / 2 - 1 ) & 0xFF00 ) >> 8 ) << 4 ; |
| 5306 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x09 , ~0x0F0 , temp ) ; |
| 5307 | temp = ( pVBInfo->VGAHDE / 2 + 16 ) & 0x0FF ; /* BTVGA2HDEE 0x0A,0x0C */ |
| 5308 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; |
| 5309 | tempcx = ( ( pVBInfo->VGAHT - pVBInfo->VGAHDE ) / 2 ) >> 2 ; |
| 5310 | pushbx = pVBInfo->VGAHDE / 2 + 16 ; |
| 5311 | tempcx = tempcx >> 1 ; |
| 5312 | tempbx = pushbx + tempcx ; /* bx BTVGA@HRS 0x0B,0x0C */ |
| 5313 | tempcx += tempbx ; |
| 5314 | |
| 5315 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 5316 | { |
| 5317 | tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 4 ] ; |
| 5318 | tempbx |= ( ( pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 14 ] & 0xC0 ) << 2 ) ; |
| 5319 | tempbx = ( tempbx - 3 ) << 3 ; /* (VGAHRS-3)*8 */ |
| 5320 | tempcx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[ 5 ] ; |
| 5321 | tempcx &= 0x1F ; |
| 5322 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 15 ] ; |
| 5323 | temp = ( temp & 0x04 ) << ( 5 - 2 ) ; /* VGAHRE D[5] */ |
| 5324 | tempcx = ( ( tempcx | temp ) - 3 ) << 3 ; /* (VGAHRE-3)*8 */ |
| 5325 | } |
| 5326 | |
| 5327 | tempbx += 4 ; |
| 5328 | tempcx += 4 ; |
| 5329 | |
| 5330 | if ( tempcx > ( pVBInfo->VGAHT / 2 ) ) |
| 5331 | tempcx = pVBInfo->VGAHT / 2 ; |
| 5332 | |
| 5333 | temp = tempbx & 0x00FF ; |
| 5334 | |
| 5335 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ; |
| 5336 | } |
| 5337 | else |
| 5338 | { |
| 5339 | temp = ( pVBInfo->VGAHT - 1 ) & 0x0FF ; /* BTVGA2HT 0x08,0x09 */ |
| 5340 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , temp ) ; |
| 5341 | temp = ( ( ( pVBInfo->VGAHT - 1 ) & 0xFF00 ) >> 8 ) << 4 ; |
| 5342 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x09 , ~0x0F0 , temp ) ; |
| 5343 | temp = ( pVBInfo->VGAHDE + 16 ) & 0x0FF ; /* BTVGA2HDEE 0x0A,0x0C */ |
| 5344 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; |
| 5345 | tempcx = ( pVBInfo->VGAHT - pVBInfo->VGAHDE ) >> 2 ; /* cx */ |
| 5346 | pushbx = pVBInfo->VGAHDE + 16 ; |
| 5347 | tempcx = tempcx >> 1 ; |
| 5348 | tempbx = pushbx + tempcx ; /* bx BTVGA@HRS 0x0B,0x0C */ |
| 5349 | tempcx += tempbx ; |
| 5350 | |
| 5351 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 5352 | { |
| 5353 | tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 3 ] ; |
| 5354 | tempbx |= ( ( pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 5 ] & 0xC0 ) << 2 ) ; |
| 5355 | tempbx = ( tempbx - 3 ) << 3 ; /* (VGAHRS-3)*8 */ |
| 5356 | tempcx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 4 ] ; |
| 5357 | tempcx &= 0x1F ; |
| 5358 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 6 ] ; |
| 5359 | temp = ( temp & 0x04 ) << ( 5 - 2 ) ; /* VGAHRE D[5] */ |
| 5360 | tempcx = ( ( tempcx | temp ) - 3 ) << 3 ; /* (VGAHRE-3)*8 */ |
| 5361 | tempbx += 16 ; |
| 5362 | tempcx += 16 ; |
| 5363 | } |
| 5364 | |
| 5365 | if ( tempcx > pVBInfo->VGAHT ) |
| 5366 | tempcx = pVBInfo->VGAHT ; |
| 5367 | |
| 5368 | temp = tempbx & 0x00FF ; |
| 5369 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ; |
| 5370 | } |
| 5371 | |
| 5372 | tempax = ( tempax & 0x00FF ) | ( tempbx & 0xFF00 ) ; |
| 5373 | tempbx = pushbx ; |
| 5374 | tempbx = ( tempbx & 0x00FF ) | ( ( tempbx & 0xFF00 ) << 4 ) ; |
| 5375 | tempax |= ( tempbx & 0xFF00 ) ; |
| 5376 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 5377 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , temp ) ; |
| 5378 | temp = tempcx & 0x00FF ; |
| 5379 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0D , temp ) ; |
| 5380 | tempcx = ( pVBInfo->VGAVT - 1 ) ; |
| 5381 | temp = tempcx & 0x00FF ; |
| 5382 | |
| 5383 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 5384 | { |
| 5385 | if ( pVBInfo->VBInfo & 0x0C ) |
| 5386 | { |
| 5387 | temp-- ; |
| 5388 | } |
| 5389 | } |
| 5390 | |
| 5391 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0E , temp ) ; |
| 5392 | tempbx = pVBInfo->VGAVDE - 1 ; |
| 5393 | temp = tempbx & 0x00FF ; |
| 5394 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0F , temp ) ; |
| 5395 | temp = ( ( tempbx & 0xFF00 ) << 3 ) >> 8 ; |
| 5396 | temp |= ( ( tempcx & 0xFF00 ) >> 8 ) ; |
| 5397 | XGINew_SetReg1( pVBInfo->Part1Port , 0x12 , temp ) ; |
| 5398 | |
| 5399 | tempax = pVBInfo->VGAVDE ; |
| 5400 | tempbx = pVBInfo->VGAVDE ; |
| 5401 | tempcx = pVBInfo->VGAVT ; |
| 5402 | tempbx = ( pVBInfo->VGAVT + pVBInfo->VGAVDE ) >> 1 ; /* BTVGA2VRS 0x10,0x11 */ |
| 5403 | tempcx = ( ( pVBInfo->VGAVT - pVBInfo->VGAVDE ) >> 4 ) + tempbx + 1 ; /* BTVGA2VRE 0x11 */ |
| 5404 | |
| 5405 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 5406 | { |
| 5407 | tempbx = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 10 ] ; |
| 5408 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 9 ] ; |
| 5409 | |
| 5410 | if ( temp & 0x04 ) |
| 5411 | tempbx |= 0x0100 ; |
| 5412 | |
| 5413 | if ( temp & 0x080 ) |
| 5414 | tempbx |= 0x0200 ; |
| 5415 | |
| 5416 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 14 ] ; |
| 5417 | |
| 5418 | if ( temp & 0x08 ) |
| 5419 | tempbx |= 0x0400 ; |
| 5420 | |
| 5421 | temp = pVBInfo->XGINEWUB_CRT1Table[ CRT1Index ].CR[ 11 ] ; |
| 5422 | tempcx = ( tempcx & 0xFF00 ) | ( temp & 0x00FF ) ; |
| 5423 | } |
| 5424 | |
| 5425 | temp = tempbx & 0x00FF ; |
| 5426 | XGINew_SetReg1( pVBInfo->Part1Port , 0x10 , temp ) ; |
| 5427 | temp = ( ( tempbx & 0xFF00 ) >> 8 ) << 4 ; |
| 5428 | temp = ( ( tempcx & 0x000F ) | ( temp ) ) ; |
| 5429 | XGINew_SetReg1( pVBInfo->Part1Port , 0x11 , temp ) ; |
| 5430 | tempax = 0 ; |
| 5431 | |
| 5432 | if ( modeflag & DoubleScanMode ) |
| 5433 | tempax |= 0x80 ; |
| 5434 | |
| 5435 | if ( modeflag & HalfDCLK ) |
| 5436 | tempax |= 0x40 ; |
| 5437 | |
| 5438 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2C , ~0x0C0 , tempax ) ; |
| 5439 | } |
| 5440 | |
| 5441 | |
| 5442 | /* --------------------------------------------------------------------- */ |
| 5443 | /* Function : XGI_SetLockRegs */ |
| 5444 | /* Input : */ |
| 5445 | /* Output : */ |
| 5446 | /* Description : */ |
| 5447 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5448 | void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 5449 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5450 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 5451 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5452 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5453 | unsigned short push1 , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5454 | push2 , |
| 5455 | tempax , |
| 5456 | tempbx = 0 , |
| 5457 | tempcx , |
| 5458 | temp , |
| 5459 | resinfo , |
| 5460 | modeflag , |
| 5461 | CRT1Index ; |
| 5462 | |
| 5463 | if ( ModeNo <= 0x13 ) |
| 5464 | { |
| 5465 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 5466 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 5467 | } |
| 5468 | else |
| 5469 | { |
| 5470 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 5471 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 5472 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 5473 | CRT1Index &= IndexMask; |
| 5474 | } |
| 5475 | |
| 5476 | if ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) |
| 5477 | { |
| 5478 | return ; |
| 5479 | } |
| 5480 | |
| 5481 | temp = 0xFF ; /* set MAX HT */ |
| 5482 | XGINew_SetReg1( pVBInfo->Part1Port , 0x03 , temp ) ; |
| 5483 | /* if ( modeflag & Charx8Dot ) tempcx = 0x08 ; */ |
| 5484 | /* else */ |
| 5485 | tempcx=0x08; |
| 5486 | |
| 5487 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 5488 | modeflag |= Charx8Dot ; |
| 5489 | |
| 5490 | tempax = pVBInfo->VGAHDE ; /* 0x04 Horizontal Display End */ |
| 5491 | |
| 5492 | if ( modeflag & HalfDCLK ) |
| 5493 | tempax = tempax >> 1 ; |
| 5494 | |
| 5495 | tempax = ( tempax / tempcx ) - 1 ; |
| 5496 | tempbx |= ( ( tempax & 0x00FF ) << 8 ) ; |
| 5497 | temp = tempax & 0x00FF ; |
| 5498 | XGINew_SetReg1( pVBInfo->Part1Port , 0x04 , temp ) ; |
| 5499 | |
| 5500 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 5501 | |
| 5502 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5503 | { |
| 5504 | if ( !( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) ) |
| 5505 | temp += 2 ; |
| 5506 | |
| 5507 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5508 | { |
| 5509 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 5510 | { |
| 5511 | if ( pVBInfo->VBExtInfo == VB_YPbPr1080i ) |
| 5512 | { |
| 5513 | if ( resinfo == 7 ) |
| 5514 | temp -= 2 ; |
| 5515 | } |
| 5516 | } |
| 5517 | else |
| 5518 | if ( resinfo == 7 ) |
| 5519 | temp -= 2 ; |
| 5520 | } |
| 5521 | } |
| 5522 | |
| 5523 | XGINew_SetReg1( pVBInfo->Part1Port , 0x05 , temp ) ; /* 0x05 Horizontal Display Start */ |
| 5524 | XGINew_SetReg1( pVBInfo->Part1Port , 0x06 , 0x03 ) ; /* 0x06 Horizontal Blank end */ |
| 5525 | |
| 5526 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 5527 | { /* 030226 bainy */ |
| 5528 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5529 | tempax = pVBInfo->VGAHT ; |
| 5530 | else |
| 5531 | tempax = XGI_GetVGAHT2( pVBInfo) ; |
| 5532 | } |
| 5533 | |
| 5534 | if ( tempax >= pVBInfo->VGAHT ) |
| 5535 | { |
| 5536 | tempax = pVBInfo->VGAHT ; |
| 5537 | } |
| 5538 | |
| 5539 | if ( modeflag & HalfDCLK ) |
| 5540 | { |
| 5541 | tempax = tempax >> 1 ; |
| 5542 | } |
| 5543 | |
| 5544 | tempax = ( tempax / tempcx ) - 5 ; |
| 5545 | tempcx = tempax ; /* 20030401 0x07 horizontal Retrace Start */ |
| 5546 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5547 | { |
| 5548 | temp = ( tempbx & 0x00FF ) - 1 ; |
| 5549 | if ( !( modeflag & HalfDCLK ) ) |
| 5550 | { |
| 5551 | temp -= 6 ; |
| 5552 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 5553 | { |
| 5554 | temp -= 4 ; |
| 5555 | if ( ModeNo > 0x13 ) |
| 5556 | temp -= 10 ; |
| 5557 | } |
| 5558 | } |
| 5559 | } |
| 5560 | else |
| 5561 | { |
| 5562 | /* tempcx = tempbx & 0x00FF ; */ |
| 5563 | tempbx = ( tempbx & 0xFF00 ) >> 8 ; |
| 5564 | tempcx = ( tempcx + tempbx ) >> 1 ; |
| 5565 | temp = ( tempcx & 0x00FF ) + 2 ; |
| 5566 | |
| 5567 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5568 | { |
| 5569 | temp -= 1 ; |
| 5570 | if ( !( modeflag & HalfDCLK ) ) |
| 5571 | { |
| 5572 | if ( ( modeflag & Charx8Dot ) ) |
| 5573 | { |
| 5574 | temp += 4 ; |
| 5575 | if ( pVBInfo->VGAHDE >= 800 ) |
| 5576 | { |
| 5577 | temp -= 6 ; |
| 5578 | } |
| 5579 | } |
| 5580 | } |
| 5581 | } |
| 5582 | else |
| 5583 | { |
| 5584 | if ( !( modeflag & HalfDCLK ) ) |
| 5585 | { |
| 5586 | temp -= 4 ; |
| 5587 | if ( pVBInfo->LCDResInfo != Panel1280x960 ) |
| 5588 | { |
| 5589 | if( pVBInfo->VGAHDE >= 800 ) |
| 5590 | { |
| 5591 | temp -= 7 ; |
| 5592 | if ( pVBInfo->ModeType == ModeEGA ) |
| 5593 | { |
| 5594 | if ( pVBInfo->VGAVDE == 1024 ) |
| 5595 | { |
| 5596 | temp += 15 ; |
| 5597 | if ( pVBInfo->LCDResInfo != Panel1280x1024 ) |
| 5598 | { |
| 5599 | temp += 7 ; |
| 5600 | } |
| 5601 | } |
| 5602 | } |
| 5603 | |
| 5604 | if ( pVBInfo->VGAHDE >= 1280 ) |
| 5605 | { |
| 5606 | if ( pVBInfo->LCDResInfo != Panel1280x960 ) |
| 5607 | { |
| 5608 | if ( pVBInfo->LCDInfo & LCDNonExpanding ) |
| 5609 | { |
| 5610 | temp += 28 ; |
| 5611 | } |
| 5612 | } |
| 5613 | } |
| 5614 | } |
| 5615 | } |
| 5616 | } |
| 5617 | } |
| 5618 | } |
| 5619 | |
| 5620 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , temp ) ; /* 0x07 Horizontal Retrace Start */ |
| 5621 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0 ) ; /* 0x08 Horizontal Retrace End */ |
| 5622 | |
| 5623 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5624 | { |
| 5625 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 5626 | { |
| 5627 | if ( ( ModeNo == 0x06 ) || ( ModeNo == 0x10 ) || ( ModeNo == 0x11 ) || ( ModeNo == 0x13 ) || ( ModeNo == 0x0F ) ) |
| 5628 | { |
| 5629 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x5b ) ; |
| 5630 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x03 ) ; |
| 5631 | } |
| 5632 | |
| 5633 | if ( ( ModeNo == 0x00 ) || ( ModeNo == 0x01 ) ) |
| 5634 | { |
| 5635 | if ( pVBInfo->TVInfo & SetNTSCTV ) |
| 5636 | { |
| 5637 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2A ) ; |
| 5638 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x61 ) ; |
| 5639 | } |
| 5640 | else |
| 5641 | { |
| 5642 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2A ) ; |
| 5643 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x41 ) ; |
| 5644 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , 0xF0 ) ; |
| 5645 | } |
| 5646 | } |
| 5647 | |
| 5648 | if ( ( ModeNo == 0x02 ) || ( ModeNo == 0x03 ) || ( ModeNo == 0x07 ) ) |
| 5649 | { |
| 5650 | if ( pVBInfo->TVInfo & SetNTSCTV ) |
| 5651 | { |
| 5652 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x54 ) ; |
| 5653 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x00 ) ; |
| 5654 | } |
| 5655 | else |
| 5656 | { |
| 5657 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x55 ) ; |
| 5658 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x00 ) ; |
| 5659 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , 0xF0 ) ; |
| 5660 | } |
| 5661 | } |
| 5662 | |
| 5663 | if ( ( ModeNo == 0x04 ) || ( ModeNo == 0x05 ) || ( ModeNo == 0x0D ) || ( ModeNo == 0x50 ) ) |
| 5664 | { |
| 5665 | if ( pVBInfo->TVInfo & SetNTSCTV ) |
| 5666 | { |
| 5667 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x30 ) ; |
| 5668 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x03 ) ; |
| 5669 | } |
| 5670 | else |
| 5671 | { |
| 5672 | XGINew_SetReg1( pVBInfo->Part1Port , 0x07 , 0x2f ) ; |
| 5673 | XGINew_SetReg1( pVBInfo->Part1Port , 0x08 , 0x02 ) ; |
| 5674 | } |
| 5675 | } |
| 5676 | } |
| 5677 | } |
| 5678 | |
| 5679 | XGINew_SetReg1( pVBInfo->Part1Port , 0x18 , 0x03 ) ; /* 0x18 SR0B */ |
| 5680 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x19 , 0xF0 , 0x00 ) ; |
| 5681 | XGINew_SetReg1( pVBInfo->Part1Port , 0x09 , 0xFF ) ; /* 0x09 Set Max VT */ |
| 5682 | |
| 5683 | tempbx = pVBInfo->VGAVT ; |
| 5684 | push1 = tempbx ; |
| 5685 | tempcx = 0x121 ; |
| 5686 | tempbx = pVBInfo->VGAVDE ; /* 0x0E Virtical Display End */ |
| 5687 | |
| 5688 | if ( tempbx == 357 ) |
| 5689 | tempbx = 350 ; |
| 5690 | if ( tempbx == 360 ) |
| 5691 | tempbx =350 ; |
| 5692 | if ( tempbx == 375 ) |
| 5693 | tempbx = 350 ; |
| 5694 | if ( tempbx == 405 ) |
| 5695 | tempbx = 400 ; |
| 5696 | if ( tempbx == 525 ) |
| 5697 | tempbx = 480 ; |
| 5698 | |
| 5699 | push2 = tempbx ; |
| 5700 | |
| 5701 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 5702 | { |
| 5703 | if ( pVBInfo->LCDResInfo == Panel1024x768 ) |
| 5704 | { |
| 5705 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 5706 | { |
| 5707 | if ( tempbx == 350 ) |
| 5708 | tempbx += 5 ; |
| 5709 | if ( tempbx == 480 ) |
| 5710 | tempbx += 5 ; |
| 5711 | } |
| 5712 | } |
| 5713 | } |
| 5714 | tempbx-- ; |
| 5715 | temp = tempbx & 0x00FF ; |
| 5716 | tempbx-- ; |
| 5717 | temp = tempbx & 0x00FF ; |
| 5718 | XGINew_SetReg1( pVBInfo->Part1Port , 0x10 ,temp ) ; /* 0x10 vertical Blank Start */ |
| 5719 | tempbx = push2 ; |
| 5720 | tempbx-- ; |
| 5721 | temp = tempbx & 0x00FF ; |
| 5722 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0E , temp ) ; |
| 5723 | |
| 5724 | if ( tempbx & 0x0100 ) |
| 5725 | { |
| 5726 | tempcx |= 0x0002 ; |
| 5727 | } |
| 5728 | |
| 5729 | tempax = 0x000B ; |
| 5730 | |
| 5731 | if ( modeflag & DoubleScanMode ) |
| 5732 | { |
| 5733 | tempax |= 0x08000 ; |
| 5734 | } |
| 5735 | |
| 5736 | if ( tempbx & 0x0200 ) |
| 5737 | { |
| 5738 | tempcx |= 0x0040 ; |
| 5739 | } |
| 5740 | |
| 5741 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 5742 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0B , temp ) ; |
| 5743 | |
| 5744 | if ( tempbx & 0x0400 ) |
| 5745 | { |
| 5746 | tempcx |= 0x0600 ; |
| 5747 | } |
| 5748 | |
| 5749 | XGINew_SetReg1( pVBInfo->Part1Port , 0x11 , 0x00 ) ; /* 0x11 Vertival Blank End */ |
| 5750 | |
| 5751 | tempax = push1 ; |
| 5752 | tempax -= tempbx ; /* 0x0C Vertical Retrace Start */ |
| 5753 | tempax = tempax >> 2 ; |
| 5754 | push1 = tempax ; /* push ax */ |
| 5755 | |
| 5756 | if ( resinfo != 0x09 ) |
| 5757 | { |
| 5758 | tempax = tempax << 1 ; |
| 5759 | tempbx += tempax ; |
| 5760 | } |
| 5761 | |
| 5762 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5763 | { |
| 5764 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 5765 | { |
| 5766 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) |
| 5767 | tempbx -= 10 ; |
| 5768 | else |
| 5769 | { |
| 5770 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 5771 | { |
| 5772 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 5773 | { |
| 5774 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 5775 | { |
| 5776 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) |
| 5777 | tempbx += 40 ; |
| 5778 | } |
| 5779 | else |
| 5780 | tempbx += 40 ; |
| 5781 | } |
| 5782 | } |
| 5783 | } |
| 5784 | } |
| 5785 | else |
| 5786 | tempbx -= 10 ; |
| 5787 | } |
| 5788 | else |
| 5789 | { |
| 5790 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 5791 | { |
| 5792 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 5793 | { |
| 5794 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 5795 | { |
| 5796 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) |
| 5797 | tempbx += 40 ; |
| 5798 | } |
| 5799 | else |
| 5800 | tempbx += 40 ; |
| 5801 | } |
| 5802 | } |
| 5803 | } |
| 5804 | tempax = push1 ; |
| 5805 | tempax = tempax >> 2 ; |
| 5806 | tempax++ ; |
| 5807 | tempax += tempbx ; |
| 5808 | push1 = tempax ; /* push ax */ |
| 5809 | |
| 5810 | if ( ( pVBInfo->TVInfo & SetPALTV ) ) |
| 5811 | { |
| 5812 | if ( tempbx <= 513 ) |
| 5813 | { |
| 5814 | if ( tempax >= 513 ) |
| 5815 | { |
| 5816 | tempbx = 513 ; |
| 5817 | } |
| 5818 | } |
| 5819 | } |
| 5820 | |
| 5821 | temp = tempbx & 0x00FF ; |
| 5822 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0C , temp ) ; |
| 5823 | tempbx-- ; |
| 5824 | temp = tempbx & 0x00FF ; |
| 5825 | XGINew_SetReg1( pVBInfo->Part1Port , 0x10 , temp ) ; |
| 5826 | |
| 5827 | if ( tempbx & 0x0100 ) |
| 5828 | { |
| 5829 | tempcx |= 0x0008 ; |
| 5830 | } |
| 5831 | |
| 5832 | if ( tempbx & 0x0200 ) |
| 5833 | { |
| 5834 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x0B , 0x0FF , 0x20 ) ; |
| 5835 | } |
| 5836 | |
| 5837 | tempbx++ ; |
| 5838 | |
| 5839 | if ( tempbx & 0x0100 ) |
| 5840 | { |
| 5841 | tempcx |= 0x0004 ; |
| 5842 | } |
| 5843 | |
| 5844 | if ( tempbx & 0x0200 ) |
| 5845 | { |
| 5846 | tempcx |= 0x0080 ; |
| 5847 | } |
| 5848 | |
| 5849 | if ( tempbx & 0x0400 ) |
| 5850 | { |
| 5851 | tempcx |= 0x0C00 ; |
| 5852 | } |
| 5853 | |
| 5854 | tempbx = push1 ; /* pop ax */ |
| 5855 | temp = tempbx & 0x00FF ; |
| 5856 | temp &= 0x0F ; |
| 5857 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0D , temp ) ; /* 0x0D vertical Retrace End */ |
| 5858 | |
| 5859 | if ( tempbx & 0x0010 ) |
| 5860 | { |
| 5861 | tempcx |= 0x2000 ; |
| 5862 | } |
| 5863 | |
| 5864 | temp = tempcx & 0x00FF ; |
| 5865 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0A , temp ) ; /* 0x0A CR07 */ |
| 5866 | temp = ( tempcx & 0x0FF00 ) >> 8 ; |
| 5867 | XGINew_SetReg1( pVBInfo->Part1Port , 0x17 , temp ) ; /* 0x17 SR0A */ |
| 5868 | tempax = modeflag ; |
| 5869 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 5870 | |
| 5871 | temp = ( temp >> 1 ) & 0x09 ; |
| 5872 | |
| 5873 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 5874 | temp |= 0x01 ; |
| 5875 | |
| 5876 | XGINew_SetReg1( pVBInfo->Part1Port , 0x16 , temp ) ; /* 0x16 SR01 */ |
| 5877 | XGINew_SetReg1( pVBInfo->Part1Port , 0x0F , 0 ) ; /* 0x0F CR14 */ |
| 5878 | XGINew_SetReg1( pVBInfo->Part1Port , 0x12 , 0 ) ; /* 0x12 CR17 */ |
| 5879 | |
| 5880 | if ( pVBInfo->LCDInfo & LCDRGB18Bit ) |
| 5881 | temp = 0x80 ; |
| 5882 | else |
| 5883 | temp = 0x00 ; |
| 5884 | |
| 5885 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1A , temp ) ; /* 0x1A SR0E */ |
| 5886 | |
| 5887 | return ; |
| 5888 | } |
| 5889 | |
| 5890 | |
| 5891 | /* --------------------------------------------------------------------- */ |
| 5892 | /* Function : XGI_SetGroup2 */ |
| 5893 | /* Input : */ |
| 5894 | /* Output : */ |
| 5895 | /* Description : */ |
| 5896 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5897 | void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 5898 | struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5899 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5900 | unsigned short i , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5901 | j , |
| 5902 | tempax , |
| 5903 | tempbx , |
| 5904 | tempcx , |
| 5905 | temp , |
| 5906 | push1 , |
| 5907 | push2 , |
| 5908 | modeflag , |
| 5909 | resinfo , |
| 5910 | crt2crtc ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 5911 | unsigned char *TimingPoint ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5912 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 5913 | unsigned long longtemp , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5914 | tempeax , |
| 5915 | tempebx , |
| 5916 | temp2 , |
| 5917 | tempecx ; |
| 5918 | |
| 5919 | if ( ModeNo <= 0x13 ) |
| 5920 | { |
| 5921 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 5922 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 5923 | crt2crtc = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 5924 | } |
| 5925 | else |
| 5926 | { |
| 5927 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 5928 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 5929 | crt2crtc = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 5930 | } |
| 5931 | |
| 5932 | tempax = 0 ; |
| 5933 | |
| 5934 | if ( !( pVBInfo->VBInfo & SetCRT2ToAVIDEO ) ) |
| 5935 | tempax |= 0x0800 ; |
| 5936 | |
| 5937 | if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) ) |
| 5938 | tempax |= 0x0400 ; |
| 5939 | |
| 5940 | if ( pVBInfo->VBInfo & SetCRT2ToSCART ) |
| 5941 | tempax |= 0x0200 ; |
| 5942 | |
| 5943 | if ( !( pVBInfo->TVInfo & SetPALTV ) ) |
| 5944 | tempax |= 0x1000 ; |
| 5945 | |
| 5946 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5947 | tempax |= 0x0100 ; |
| 5948 | |
| 5949 | if ( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) |
| 5950 | tempax &= 0xfe00 ; |
| 5951 | |
| 5952 | tempax = ( tempax & 0xff00 ) >> 8 ; |
| 5953 | |
| 5954 | XGINew_SetReg1( pVBInfo->Part2Port , 0x0 , tempax ) ; |
| 5955 | TimingPoint = pVBInfo->NTSCTiming ; |
| 5956 | |
| 5957 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 5958 | { |
| 5959 | TimingPoint = pVBInfo->PALTiming ; |
| 5960 | } |
| 5961 | |
| 5962 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 5963 | { |
| 5964 | TimingPoint = pVBInfo->HiTVExtTiming ; |
| 5965 | |
| 5966 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 5967 | TimingPoint = pVBInfo->HiTVSt2Timing ; |
| 5968 | |
| 5969 | if ( pVBInfo->SetFlag & TVSimuMode ) |
| 5970 | TimingPoint = pVBInfo->HiTVSt1Timing ; |
| 5971 | |
| 5972 | if ( !(modeflag & Charx8Dot) ) |
| 5973 | TimingPoint = pVBInfo->HiTVTextTiming ; |
| 5974 | } |
| 5975 | |
| 5976 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 5977 | { |
| 5978 | if ( pVBInfo->TVInfo & SetYPbPrMode525i ) |
| 5979 | TimingPoint = pVBInfo->YPbPr525iTiming ; |
| 5980 | |
| 5981 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 5982 | TimingPoint = pVBInfo->YPbPr525pTiming ; |
| 5983 | |
| 5984 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 5985 | TimingPoint = pVBInfo->YPbPr750pTiming ; |
| 5986 | } |
| 5987 | |
| 5988 | for( i = 0x01 , j = 0 ; i <= 0x2D ; i++ , j++ ) |
| 5989 | { |
| 5990 | XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; |
| 5991 | } |
| 5992 | |
| 5993 | for( i = 0x39 ; i <= 0x45 ; i++ , j++ ) |
| 5994 | { |
| 5995 | XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; /* di->temp2[j] */ |
| 5996 | } |
| 5997 | |
| 5998 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 5999 | { |
| 6000 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x3A , 0x1F , 0x00 ) ; |
| 6001 | } |
| 6002 | |
| 6003 | temp = pVBInfo->NewFlickerMode ; |
| 6004 | temp &= 0x80 ; |
| 6005 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0xFF , temp ) ; |
| 6006 | |
| 6007 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6008 | tempax = 950 ; |
| 6009 | |
| 6010 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6011 | tempax = 520 ; |
| 6012 | else |
| 6013 | tempax = 440 ; |
| 6014 | |
| 6015 | if ( pVBInfo->VDE <= tempax ) |
| 6016 | { |
| 6017 | tempax -= pVBInfo->VDE ; |
| 6018 | tempax = tempax >> 2 ; |
| 6019 | tempax = ( tempax & 0x00FF ) | ( ( tempax & 0x00FF ) << 8 ) ; |
| 6020 | push1 = tempax ; |
| 6021 | temp = ( tempax & 0xFF00 ) >> 8 ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6022 | temp += (unsigned short)TimingPoint[0]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6023 | |
| 6024 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6025 | { |
| 6026 | if ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr ) ) |
| 6027 | { |
| 6028 | tempcx=pVBInfo->VGAHDE; |
| 6029 | if ( tempcx >= 1024 ) |
| 6030 | { |
| 6031 | temp = 0x17 ; /* NTSC */ |
| 6032 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6033 | temp = 0x19 ; /* PAL */ |
| 6034 | } |
| 6035 | } |
| 6036 | } |
| 6037 | |
| 6038 | XGINew_SetReg1( pVBInfo->Part2Port , 0x01 , temp ) ; |
| 6039 | tempax = push1 ; |
| 6040 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 6041 | temp += TimingPoint[ 1 ] ; |
| 6042 | |
| 6043 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6044 | { |
| 6045 | if ( ( pVBInfo->VBInfo & ( SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART | SetCRT2ToYPbPr ) ) ) |
| 6046 | { |
| 6047 | tempcx = pVBInfo->VGAHDE ; |
| 6048 | if ( tempcx >= 1024 ) |
| 6049 | { |
| 6050 | temp = 0x1D ; /* NTSC */ |
| 6051 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6052 | temp = 0x52 ; /* PAL */ |
| 6053 | } |
| 6054 | } |
| 6055 | } |
| 6056 | XGINew_SetReg1( pVBInfo->Part2Port , 0x02 , temp ) ; |
| 6057 | } |
| 6058 | |
| 6059 | /* 301b */ |
| 6060 | tempcx = pVBInfo->HT ; |
| 6061 | |
| 6062 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 6063 | tempcx = tempcx >> 1 ; |
| 6064 | |
| 6065 | tempcx -= 2 ; |
| 6066 | temp = tempcx & 0x00FF ; |
| 6067 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1B , temp ) ; |
| 6068 | |
| 6069 | temp = ( tempcx & 0xFF00 ) >> 8 ; |
| 6070 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1D , ~0x0F , temp ) ; |
| 6071 | |
| 6072 | tempcx = pVBInfo->HT >> 1 ; |
| 6073 | push1 = tempcx ; /* push cx */ |
| 6074 | tempcx += 7 ; |
| 6075 | |
| 6076 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6077 | { |
| 6078 | tempcx -= 4 ; |
| 6079 | } |
| 6080 | |
| 6081 | temp = tempcx & 0x00FF ; |
| 6082 | temp = temp << 4 ; |
| 6083 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x22 , 0x0F , temp ) ; |
| 6084 | |
| 6085 | tempbx = TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ; |
| 6086 | tempbx += tempcx ; |
| 6087 | push2 = tempbx ; |
| 6088 | temp = tempbx & 0x00FF ; |
| 6089 | XGINew_SetReg1( pVBInfo->Part2Port , 0x24 , temp ) ; |
| 6090 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6091 | temp = temp << 4 ; |
| 6092 | XGINew_SetRegANDOR(pVBInfo->Part2Port,0x25,0x0F,temp); |
| 6093 | |
| 6094 | tempbx=push2; |
| 6095 | tempbx=tempbx+8; |
| 6096 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6097 | { |
| 6098 | tempbx=tempbx-4; |
| 6099 | tempcx=tempbx; |
| 6100 | } |
| 6101 | |
| 6102 | temp = ( tempbx & 0x00FF ) << 4 ; |
| 6103 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x29 , 0x0F , temp ) ; |
| 6104 | |
| 6105 | j += 2 ; |
| 6106 | tempcx += ( TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ) ; |
| 6107 | temp = tempcx & 0x00FF ; |
| 6108 | XGINew_SetReg1( pVBInfo->Part2Port , 0x27 , temp ) ; |
| 6109 | temp = ( ( tempcx & 0xFF00 ) >> 8 ) << 4 ; |
| 6110 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x28 , 0x0F , temp ) ; |
| 6111 | |
| 6112 | tempcx += 8 ; |
| 6113 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6114 | { |
| 6115 | tempcx -= 4 ; |
| 6116 | } |
| 6117 | |
| 6118 | temp = tempcx & 0xFF ; |
| 6119 | temp = temp << 4 ; |
| 6120 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2A , 0x0F , temp ) ; |
| 6121 | |
| 6122 | tempcx = push1 ; /* pop cx */ |
| 6123 | j += 2 ; |
| 6124 | temp = TimingPoint[ j ] | ( ( TimingPoint[ j + 1 ] ) << 8 ) ; |
| 6125 | tempcx -= temp ; |
| 6126 | temp = tempcx & 0x00FF ; |
| 6127 | temp = temp << 4 ; |
| 6128 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2D , 0x0F ,temp ) ; |
| 6129 | |
| 6130 | tempcx -= 11 ; |
| 6131 | |
| 6132 | if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) ) |
| 6133 | { |
| 6134 | tempax = XGI_GetVGAHT2( pVBInfo) ; |
| 6135 | tempcx = tempax - 1 ; |
| 6136 | } |
| 6137 | temp = tempcx & 0x00FF ; |
| 6138 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2E , temp ) ; |
| 6139 | |
| 6140 | tempbx = pVBInfo->VDE ; |
| 6141 | |
| 6142 | if ( pVBInfo->VGAVDE == 360 ) |
| 6143 | tempbx = 746 ; |
| 6144 | if ( pVBInfo->VGAVDE == 375 ) |
| 6145 | tempbx = 746 ; |
| 6146 | if ( pVBInfo->VGAVDE == 405 ) |
| 6147 | tempbx = 853 ; |
| 6148 | |
| 6149 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 6150 | { |
| 6151 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6152 | { |
| 6153 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) |
| 6154 | tempbx = tempbx >> 1 ; |
| 6155 | } |
| 6156 | else |
| 6157 | tempbx = tempbx >> 1 ; |
| 6158 | } |
| 6159 | |
| 6160 | tempbx -= 2 ; |
| 6161 | temp = tempbx & 0x00FF ; |
| 6162 | |
| 6163 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6164 | { |
| 6165 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 6166 | { |
| 6167 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) |
| 6168 | { |
| 6169 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 6170 | { |
| 6171 | if ( ModeNo == 0x2f ) |
| 6172 | temp += 1 ; |
| 6173 | } |
| 6174 | } |
| 6175 | } |
| 6176 | else |
| 6177 | { |
| 6178 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 6179 | { |
| 6180 | if ( ModeNo == 0x2f ) |
| 6181 | temp += 1 ; |
| 6182 | } |
| 6183 | } |
| 6184 | } |
| 6185 | |
| 6186 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2F , temp ) ; |
| 6187 | |
| 6188 | temp = ( tempcx & 0xFF00 ) >> 8 ; |
| 6189 | temp |= ( ( tempbx & 0xFF00 ) >> 8 ) << 6 ; |
| 6190 | |
| 6191 | if ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) |
| 6192 | { |
| 6193 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 6194 | { |
| 6195 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) |
| 6196 | { |
| 6197 | temp |= 0x10 ; |
| 6198 | |
| 6199 | if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) ) |
| 6200 | temp |= 0x20 ; |
| 6201 | } |
| 6202 | } |
| 6203 | else |
| 6204 | { |
| 6205 | temp |= 0x10 ; |
| 6206 | if ( !( pVBInfo->VBInfo & SetCRT2ToSVIDEO ) ) |
| 6207 | temp |= 0x20 ; |
| 6208 | } |
| 6209 | } |
| 6210 | |
| 6211 | XGINew_SetReg1( pVBInfo->Part2Port , 0x30 , temp ) ; |
| 6212 | |
| 6213 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) /* TV gatingno */ |
| 6214 | { |
| 6215 | tempbx = pVBInfo->VDE ; |
| 6216 | tempcx = tempbx - 2 ; |
| 6217 | |
| 6218 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 6219 | { |
| 6220 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) |
| 6221 | tempbx = tempbx >> 1 ; |
| 6222 | } |
| 6223 | |
| 6224 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 6225 | { |
| 6226 | temp=0; |
| 6227 | if( tempcx & 0x0400 ) |
| 6228 | temp |= 0x20 ; |
| 6229 | |
| 6230 | if ( tempbx & 0x0400 ) |
| 6231 | temp |= 0x40 ; |
| 6232 | |
| 6233 | XGINew_SetReg1( pVBInfo->Part4Port , 0x10 , temp ) ; |
| 6234 | } |
| 6235 | |
| 6236 | temp = ( ( ( tempbx - 3 ) & 0x0300 ) >> 8 ) << 5 ; |
| 6237 | XGINew_SetReg1( pVBInfo->Part2Port , 0x46 , temp ) ; |
| 6238 | temp = ( tempbx - 3 ) & 0x00FF ; |
| 6239 | XGINew_SetReg1( pVBInfo->Part2Port , 0x47 , temp ) ; |
| 6240 | } |
| 6241 | |
| 6242 | tempbx = tempbx & 0x00FF ; |
| 6243 | |
| 6244 | if ( !( modeflag & HalfDCLK ) ) |
| 6245 | { |
| 6246 | tempcx = pVBInfo->VGAHDE ; |
| 6247 | if ( tempcx >= pVBInfo->HDE ) |
| 6248 | { |
| 6249 | tempbx |= 0x2000 ; |
| 6250 | tempax &= 0x00FF ; |
| 6251 | } |
| 6252 | } |
| 6253 | |
| 6254 | tempcx = 0x0101 ; |
| 6255 | |
| 6256 | if( pVBInfo->VBInfo & SetCRT2ToTV ) { /*301b*/ |
| 6257 | if(pVBInfo->VGAHDE>=1024) |
| 6258 | { |
| 6259 | tempcx=0x1920; |
| 6260 | if(pVBInfo->VGAHDE>=1280) |
| 6261 | { |
| 6262 | tempcx=0x1420; |
| 6263 | tempbx=tempbx&0xDFFF; |
| 6264 | } |
| 6265 | } |
| 6266 | } |
| 6267 | |
| 6268 | if ( !( tempbx & 0x2000 ) ) |
| 6269 | { |
| 6270 | if ( modeflag & HalfDCLK ) |
| 6271 | { |
| 6272 | tempcx = ( tempcx & 0xFF00 ) | ( ( tempcx & 0x00FF ) << 1 ) ; |
| 6273 | } |
| 6274 | |
| 6275 | push1 = tempbx ; |
| 6276 | tempeax = pVBInfo->VGAHDE ; |
| 6277 | tempebx = ( tempcx & 0xFF00 ) >> 8 ; |
| 6278 | longtemp = tempeax * tempebx ; |
| 6279 | tempecx = tempcx & 0x00FF ; |
| 6280 | longtemp = longtemp / tempecx ; |
| 6281 | |
| 6282 | /* 301b */ |
| 6283 | tempecx = 8 * 1024 ; |
| 6284 | |
| 6285 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6286 | { |
| 6287 | tempecx = tempecx * 8 ; |
| 6288 | } |
| 6289 | |
| 6290 | longtemp = longtemp * tempecx ; |
| 6291 | tempecx = pVBInfo->HDE ; |
| 6292 | temp2 = longtemp % tempecx ; |
| 6293 | tempeax = longtemp / tempecx ; |
| 6294 | if ( temp2 != 0 ) |
| 6295 | { |
| 6296 | tempeax += 1 ; |
| 6297 | } |
| 6298 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6299 | tempax = (unsigned short)tempeax; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6300 | |
| 6301 | /* 301b */ |
| 6302 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6303 | { |
| 6304 | tempcx = ( ( tempax & 0xFF00 ) >> 5 ) >> 8 ; |
| 6305 | } |
| 6306 | /* end 301b */ |
| 6307 | |
| 6308 | tempbx = push1 ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6309 | tempbx = (unsigned short)(((tempeax & 0x0000FF00) & 0x1F00) | (tempbx & 0x00FF)); |
| 6310 | tempax = (unsigned short)(((tempeax & 0x000000FF) << 8) | (tempax & 0x00FF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6311 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 6312 | } |
| 6313 | else |
| 6314 | { |
| 6315 | temp = ( tempax & 0x00FF ) >> 8 ; |
| 6316 | } |
| 6317 | |
| 6318 | XGINew_SetReg1( pVBInfo->Part2Port , 0x44 , temp ) ; |
| 6319 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6320 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x45 , ~0x03F , temp ) ; |
| 6321 | temp = tempcx & 0x00FF ; |
| 6322 | |
| 6323 | if ( tempbx & 0x2000 ) |
| 6324 | temp = 0 ; |
| 6325 | |
| 6326 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) |
| 6327 | temp |= 0x18 ; |
| 6328 | |
| 6329 | XGINew_SetRegANDOR(pVBInfo->Part2Port,0x46,~0x1F,temp); |
| 6330 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6331 | { |
| 6332 | tempbx = 0x0382 ; |
| 6333 | tempcx = 0x007e ; |
| 6334 | } |
| 6335 | else |
| 6336 | { |
| 6337 | tempbx = 0x0369 ; |
| 6338 | tempcx = 0x0061 ; |
| 6339 | } |
| 6340 | |
| 6341 | temp = tempbx & 0x00FF ; |
| 6342 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4b , temp ) ; |
| 6343 | temp = tempcx & 0x00FF ; |
| 6344 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4c , temp ) ; |
| 6345 | |
| 6346 | temp = ( ( tempcx & 0xFF00 ) >> 8 ) & 0x03 ; |
| 6347 | temp = temp << 2 ; |
| 6348 | temp |= ( ( tempbx & 0xFF00 ) >> 8 ) & 0x03 ; |
| 6349 | |
| 6350 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 6351 | { |
| 6352 | temp |= 0x10 ; |
| 6353 | |
| 6354 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 6355 | temp |= 0x20 ; |
| 6356 | |
| 6357 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 6358 | temp |= 0x60 ; |
| 6359 | } |
| 6360 | |
| 6361 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4d , temp ) ; |
| 6362 | temp=XGINew_GetReg1( pVBInfo->Part2Port , 0x43 ) ; /* 301b change */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6363 | XGINew_SetReg1( pVBInfo->Part2Port , 0x43, (unsigned short)( temp - 3 ) ) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6364 | |
| 6365 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) |
| 6366 | { |
| 6367 | if ( pVBInfo->TVInfo & NTSC1024x768 ) |
| 6368 | { |
| 6369 | TimingPoint = XGI_NTSC1024AdjTime ; |
| 6370 | for( i = 0x1c , j = 0 ; i <= 0x30 ; i++ , j++ ) |
| 6371 | { |
| 6372 | XGINew_SetReg1( pVBInfo->Part2Port , i , TimingPoint[ j ] ) ; |
| 6373 | } |
| 6374 | XGINew_SetReg1( pVBInfo->Part2Port , 0x43 , 0x72 ) ; |
| 6375 | } |
| 6376 | } |
| 6377 | |
| 6378 | /* [ycchen] 01/14/03 Modify for 301C PALM Support */ |
| 6379 | if ( pVBInfo->VBType & VB_XGI301C ) |
| 6380 | { |
| 6381 | if ( pVBInfo->TVInfo & SetPALMTV ) |
| 6382 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x08 , 0x08 ) ; /* PALM Mode */ |
| 6383 | } |
| 6384 | |
| 6385 | if ( pVBInfo->TVInfo & SetPALMTV ) |
| 6386 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 6387 | tempax = (unsigned char)XGINew_GetReg1(pVBInfo->Part2Port, 0x01); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6388 | tempax-- ; |
| 6389 | XGINew_SetRegAND( pVBInfo->Part2Port , 0x01 , tempax ) ; |
| 6390 | |
| 6391 | /* if ( !( pVBInfo->VBType & VB_XGI301C ) ) */ |
| 6392 | XGINew_SetRegAND( pVBInfo->Part2Port , 0x00 , 0xEF ) ; |
| 6393 | } |
| 6394 | |
| 6395 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6396 | { |
| 6397 | if ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) |
| 6398 | { |
| 6399 | XGINew_SetReg1( pVBInfo->Part2Port , 0x0B , 0x00 ) ; |
| 6400 | } |
| 6401 | } |
| 6402 | |
| 6403 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 6404 | { |
| 6405 | return ; |
| 6406 | } |
| 6407 | } |
| 6408 | |
| 6409 | |
| 6410 | /* --------------------------------------------------------------------- */ |
| 6411 | /* Function : XGI_SetLCDRegs */ |
| 6412 | /* Input : */ |
| 6413 | /* Output : */ |
| 6414 | /* Description : */ |
| 6415 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 6416 | void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6417 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6418 | unsigned short push1 , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6419 | push2 , |
| 6420 | pushbx , |
| 6421 | tempax , |
| 6422 | tempbx , |
| 6423 | tempcx , |
| 6424 | temp , |
| 6425 | tempah , |
| 6426 | tempbh , |
| 6427 | tempch , |
| 6428 | resinfo , |
| 6429 | modeflag , |
| 6430 | CRT1Index ; |
| 6431 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 6432 | struct XGI_LCDDesStruct *LCDBDesPtr = NULL ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6433 | |
| 6434 | |
| 6435 | if ( ModeNo <= 0x13 ) |
| 6436 | { |
| 6437 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 6438 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 6439 | } |
| 6440 | else |
| 6441 | { |
| 6442 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 6443 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 6444 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 6445 | CRT1Index &= IndexMask ; |
| 6446 | } |
| 6447 | |
| 6448 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) |
| 6449 | { |
| 6450 | return ; |
| 6451 | } |
| 6452 | |
| 6453 | tempbx = pVBInfo->HDE ; /* RHACTE=HDE-1 */ |
| 6454 | |
| 6455 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 6456 | tempbx = tempbx >> 1 ; |
| 6457 | |
| 6458 | tempbx -= 1 ; |
| 6459 | temp = tempbx & 0x00FF ; |
| 6460 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2C , temp ) ; |
| 6461 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6462 | temp = temp << 4 ; |
| 6463 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x2B , 0x0F , temp ) ; |
| 6464 | temp = 0x01 ; |
| 6465 | |
| 6466 | if ( pVBInfo->LCDResInfo == Panel1280x1024 ) |
| 6467 | { |
| 6468 | if ( pVBInfo->ModeType == ModeEGA ) |
| 6469 | { |
| 6470 | if ( pVBInfo->VGAHDE >= 1024 ) |
| 6471 | { |
| 6472 | temp = 0x02 ; |
| 6473 | if ( pVBInfo->LCDInfo & LCDVESATiming ) |
| 6474 | temp = 0x01 ; |
| 6475 | } |
| 6476 | } |
| 6477 | } |
| 6478 | |
| 6479 | XGINew_SetReg1( pVBInfo->Part2Port , 0x0B , temp ) ; |
| 6480 | tempbx = pVBInfo->VDE ; /* RTVACTEO=(VDE-1)&0xFF */ |
| 6481 | push1 = tempbx ; |
| 6482 | tempbx-- ; |
| 6483 | temp = tempbx & 0x00FF ; |
| 6484 | XGINew_SetReg1( pVBInfo->Part2Port , 0x03 , temp ) ; |
| 6485 | temp = ( ( tempbx & 0xFF00 ) >> 8 ) & 0x07 ; |
| 6486 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0C , ~0x07 , temp ) ; |
| 6487 | |
| 6488 | tempcx = pVBInfo->VT - 1 ; |
| 6489 | push2 = tempcx + 1 ; |
| 6490 | temp = tempcx & 0x00FF ; /* RVTVT=VT-1 */ |
| 6491 | XGINew_SetReg1( pVBInfo->Part2Port , 0x19 , temp ) ; |
| 6492 | temp = ( tempcx & 0xFF00 ) >> 8 ; |
| 6493 | temp = temp << 5 ; |
| 6494 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1A , temp ) ; |
| 6495 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x09 , 0xF0 , 0x00 ) ; |
| 6496 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0xF0 , 0x00 ) ; |
| 6497 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x17 , 0xFB , 0x00 ) ; |
| 6498 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x18 , 0xDF , 0x00 ) ; |
| 6499 | |
| 6500 | /* Customized LCDB Des no add */ |
| 6501 | tempbx = 5 ; |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 6502 | LCDBDesPtr = (struct XGI_LCDDesStruct *)XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6503 | tempah = pVBInfo->LCDResInfo ; |
| 6504 | tempah &= PanelResInfo ; |
| 6505 | |
| 6506 | if ( ( tempah == Panel1024x768 ) || ( tempah == Panel1024x768x75 ) ) |
| 6507 | { |
| 6508 | tempbx = 1024 ; |
| 6509 | tempcx = 768 ; |
| 6510 | } |
| 6511 | else if ( ( tempah == Panel1280x1024 ) || ( tempah == Panel1280x1024x75 ) ) |
| 6512 | { |
| 6513 | tempbx = 1280 ; |
| 6514 | tempcx = 1024 ; |
| 6515 | } |
| 6516 | else if ( tempah == Panel1400x1050 ) |
| 6517 | { |
| 6518 | tempbx = 1400 ; |
| 6519 | tempcx = 1050 ; |
| 6520 | } |
| 6521 | else |
| 6522 | { |
| 6523 | tempbx = 1600 ; |
| 6524 | tempcx = 1200 ; |
| 6525 | } |
| 6526 | |
| 6527 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 6528 | { |
| 6529 | tempbx = pVBInfo->HDE ; |
| 6530 | tempcx = pVBInfo->VDE ; |
| 6531 | } |
| 6532 | |
| 6533 | pushbx = tempbx ; |
| 6534 | tempax = pVBInfo->VT ; |
| 6535 | pVBInfo->LCDHDES = LCDBDesPtr->LCDHDES ; |
| 6536 | pVBInfo->LCDHRS = LCDBDesPtr->LCDHRS ; |
| 6537 | pVBInfo->LCDVDES = LCDBDesPtr->LCDVDES ; |
| 6538 | pVBInfo->LCDVRS = LCDBDesPtr->LCDVRS ; |
| 6539 | tempbx = pVBInfo->LCDVDES ; |
| 6540 | tempcx += tempbx ; |
| 6541 | |
| 6542 | if ( tempcx >= tempax ) |
| 6543 | tempcx -= tempax ; /* lcdvdes */ |
| 6544 | |
| 6545 | temp = tempbx & 0x00FF ; /* RVEQ1EQ=lcdvdes */ |
| 6546 | XGINew_SetReg1( pVBInfo->Part2Port , 0x05 , temp ) ; |
| 6547 | temp = tempcx & 0x00FF ; |
| 6548 | XGINew_SetReg1( pVBInfo->Part2Port , 0x06 , temp ) ; |
| 6549 | tempch = ( ( tempcx & 0xFF00 ) >> 8 ) & 0x07 ; |
| 6550 | tempbh = ( ( tempbx & 0xFF00 ) >> 8 ) & 0x07 ; |
| 6551 | tempah = tempch ; |
| 6552 | tempah = tempah << 3 ; |
| 6553 | tempah |= tempbh ; |
| 6554 | XGINew_SetReg1( pVBInfo->Part2Port , 0x02 , tempah ) ; |
| 6555 | |
| 6556 | /* getlcdsync() */ |
| 6557 | XGI_GetLCDSync( &tempax , &tempbx,pVBInfo ) ; |
| 6558 | tempcx = tempbx ; |
| 6559 | tempax = pVBInfo->VT ; |
| 6560 | tempbx = pVBInfo->LCDVRS ; |
| 6561 | |
| 6562 | /* if ( SetLCD_Info & EnableScalingLCD ) */ |
| 6563 | tempcx += tempbx ; |
| 6564 | if ( tempcx >= tempax ) |
| 6565 | tempcx -= tempax ; |
| 6566 | |
| 6567 | temp = tempbx & 0x00FF ; /* RTVACTEE=lcdvrs */ |
| 6568 | XGINew_SetReg1( pVBInfo->Part2Port , 0x04 , temp ) ; |
| 6569 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6570 | temp = temp << 4 ; |
| 6571 | temp |= ( tempcx & 0x000F ) ; |
| 6572 | XGINew_SetReg1( pVBInfo->Part2Port , 0x01 , temp ) ; |
| 6573 | tempcx = pushbx ; |
| 6574 | tempax = pVBInfo->HT ; |
| 6575 | tempbx = pVBInfo->LCDHDES ; |
| 6576 | tempbx &= 0x0FFF ; |
| 6577 | |
| 6578 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 6579 | { |
| 6580 | tempax = tempax >> 1 ; |
| 6581 | tempbx = tempbx >> 1 ; |
| 6582 | tempcx = tempcx >> 1 ; |
| 6583 | } |
| 6584 | |
| 6585 | if ( pVBInfo->VBType & VB_XGI302LV ) |
| 6586 | tempbx += 1 ; |
| 6587 | |
| 6588 | if ( pVBInfo->VBType & VB_XGI301C ) /* tap4 */ |
| 6589 | tempbx += 1 ; |
| 6590 | |
| 6591 | tempcx += tempbx ; |
| 6592 | |
| 6593 | if ( tempcx >= tempax ) |
| 6594 | tempcx -= tempax ; |
| 6595 | |
| 6596 | temp = tempbx & 0x00FF ; |
| 6597 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1F , temp ) ; /* RHBLKE=lcdhdes */ |
| 6598 | temp = ( ( tempbx & 0xFF00 ) >> 8 ) << 4 ; |
| 6599 | XGINew_SetReg1( pVBInfo->Part2Port , 0x20 , temp ) ; |
| 6600 | temp = tempcx & 0x00FF ; |
| 6601 | XGINew_SetReg1( pVBInfo->Part2Port , 0x23 , temp ) ; /* RHEQPLE=lcdhdee */ |
| 6602 | temp = ( tempcx & 0xFF00 ) >> 8 ; |
| 6603 | XGINew_SetReg1( pVBInfo->Part2Port , 0x25 , temp ) ; |
| 6604 | |
| 6605 | /* getlcdsync() */ |
| 6606 | XGI_GetLCDSync( &tempax , &tempbx ,pVBInfo) ; |
| 6607 | tempcx = tempax ; |
| 6608 | tempax = pVBInfo->HT ; |
| 6609 | tempbx = pVBInfo->LCDHRS ; |
| 6610 | /* if ( SetLCD_Info & EnableScalingLCD) */ |
| 6611 | if ( XGI_IsLCDDualLink( pVBInfo) ) |
| 6612 | { |
| 6613 | tempax = tempax >> 1 ; |
| 6614 | tempbx = tempbx >> 1 ; |
| 6615 | tempcx = tempcx >> 1 ; |
| 6616 | } |
| 6617 | |
| 6618 | if ( pVBInfo->VBType & VB_XGI302LV ) |
| 6619 | tempbx += 1 ; |
| 6620 | |
| 6621 | tempcx += tempbx ; |
| 6622 | |
| 6623 | if ( tempcx >= tempax ) |
| 6624 | tempcx -= tempax ; |
| 6625 | |
| 6626 | temp = tempbx & 0x00FF ; /* RHBURSTS=lcdhrs */ |
| 6627 | XGINew_SetReg1( pVBInfo->Part2Port , 0x1C , temp ) ; |
| 6628 | |
| 6629 | temp = ( tempbx & 0xFF00 ) >> 8 ; |
| 6630 | temp = temp << 4 ; |
| 6631 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x1D , ~0x0F0 , temp ) ; |
| 6632 | temp = tempcx & 0x00FF ; /* RHSYEXP2S=lcdhre */ |
| 6633 | XGINew_SetReg1( pVBInfo->Part2Port , 0x21 , temp ) ; |
| 6634 | |
| 6635 | if ( !( pVBInfo->LCDInfo & LCDVESATiming ) ) |
| 6636 | { |
| 6637 | if ( pVBInfo->VGAVDE == 525 ) |
| 6638 | { |
| 6639 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6640 | { |
| 6641 | temp = 0xC6 ; |
| 6642 | } |
| 6643 | else |
| 6644 | temp = 0xC4 ; |
| 6645 | |
| 6646 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2f , temp ) ; |
| 6647 | XGINew_SetReg1( pVBInfo->Part2Port , 0x30 , 0xB3 ) ; |
| 6648 | } |
| 6649 | |
| 6650 | if ( pVBInfo->VGAVDE == 420 ) |
| 6651 | { |
| 6652 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 6653 | { |
| 6654 | temp = 0x4F ; |
| 6655 | } |
| 6656 | else |
| 6657 | temp = 0x4E ; |
| 6658 | XGINew_SetReg1( pVBInfo->Part2Port , 0x2f , temp ) ; |
| 6659 | } |
| 6660 | } |
| 6661 | } |
| 6662 | |
| 6663 | |
| 6664 | /* --------------------------------------------------------------------- */ |
| 6665 | /* Function : XGI_GetTap4Ptr */ |
| 6666 | /* Input : */ |
| 6667 | /* Output : di -> Tap4 Reg. Setting Pointer */ |
| 6668 | /* Description : */ |
| 6669 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 6670 | struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx, |
| 6671 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6672 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6673 | unsigned short tempax , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6674 | tempbx , |
| 6675 | i ; |
| 6676 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 6677 | struct XGI301C_Tap4TimingStruct *Tap4TimingPtr ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6678 | |
| 6679 | if ( tempcx == 0 ) |
| 6680 | { |
| 6681 | tempax = pVBInfo->VGAHDE ; |
| 6682 | tempbx = pVBInfo->HDE ; |
| 6683 | } |
| 6684 | else |
| 6685 | { |
| 6686 | tempax = pVBInfo->VGAVDE ; |
| 6687 | tempbx = pVBInfo->VDE ; |
| 6688 | } |
| 6689 | |
| 6690 | if ( tempax < tempbx ) |
| 6691 | return &EnlargeTap4Timing[ 0 ] ; |
| 6692 | else if( tempax == tempbx ) |
| 6693 | return &NoScaleTap4Timing[ 0 ] ; /* 1:1 */ |
| 6694 | else |
| 6695 | Tap4TimingPtr = NTSCTap4Timing ; /* NTSC */ |
| 6696 | |
| 6697 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 6698 | Tap4TimingPtr = PALTap4Timing ; |
| 6699 | |
| 6700 | |
| 6701 | if ( pVBInfo->VBInfo & SetCRT2ToYPbPr ) |
| 6702 | { |
| 6703 | if ( pVBInfo->TVInfo & SetYPbPrMode525i ) |
| 6704 | Tap4TimingPtr = YPbPr525iTap4Timing ; |
| 6705 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 6706 | Tap4TimingPtr = YPbPr525pTap4Timing ; |
| 6707 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 6708 | Tap4TimingPtr = YPbPr750pTap4Timing ; |
| 6709 | } |
| 6710 | |
| 6711 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 6712 | Tap4TimingPtr = HiTVTap4Timing ; |
| 6713 | |
| 6714 | i = 0 ; |
| 6715 | while( Tap4TimingPtr[ i ].DE != 0xFFFF ) |
| 6716 | { |
| 6717 | if ( Tap4TimingPtr[ i ].DE == tempax ) |
| 6718 | break ; |
| 6719 | i++ ; |
| 6720 | } |
| 6721 | return &Tap4TimingPtr[ i ] ; |
| 6722 | } |
| 6723 | |
| 6724 | |
| 6725 | /* --------------------------------------------------------------------- */ |
| 6726 | /* Function : XGI_SetTap4Regs */ |
| 6727 | /* Input : */ |
| 6728 | /* Output : */ |
| 6729 | /* Description : */ |
| 6730 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 6731 | void XGI_SetTap4Regs(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6732 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6733 | unsigned short i , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6734 | j ; |
| 6735 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 6736 | struct XGI301C_Tap4TimingStruct *Tap4TimingPtr ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6737 | |
| 6738 | if ( !( pVBInfo->VBType & VB_XGI301C ) ) |
| 6739 | return ; |
| 6740 | |
| 6741 | #ifndef Tap4 |
| 6742 | XGINew_SetRegAND( pVBInfo->Part2Port , 0x4E , 0xEB ) ; /* Disable Tap4 */ |
| 6743 | #else /* Tap4 Setting */ |
| 6744 | |
| 6745 | Tap4TimingPtr = XGI_GetTap4Ptr( 0 , pVBInfo) ; /* Set Horizontal Scaling */ |
| 6746 | for( i = 0x80 , j = 0 ; i <= 0xBF ; i++ , j++ ) |
| 6747 | XGINew_SetReg1( pVBInfo->Part2Port , i , Tap4TimingPtr->Reg[ j ] ) ; |
| 6748 | |
| 6749 | if ( ( pVBInfo->VBInfo & SetCRT2ToTV ) && ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) ) |
| 6750 | { |
| 6751 | Tap4TimingPtr = XGI_GetTap4Ptr( 1 , pVBInfo); /* Set Vertical Scaling */ |
| 6752 | for( i = 0xC0 , j = 0 ; i < 0xFF ; i++ , j++ ) |
| 6753 | XGINew_SetReg1( pVBInfo->Part2Port , i , Tap4TimingPtr->Reg[ j ] ) ; |
| 6754 | } |
| 6755 | |
| 6756 | if ( ( pVBInfo->VBInfo & SetCRT2ToTV ) && ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) ) |
| 6757 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x14 , 0x04 ) ; /* Enable V.Scaling */ |
| 6758 | else |
| 6759 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x4E , ~0x14 , 0x10 ) ; /* Enable H.Scaling */ |
| 6760 | #endif |
| 6761 | } |
| 6762 | |
| 6763 | /* --------------------------------------------------------------------- */ |
| 6764 | /* Function : XGI_SetGroup3 */ |
| 6765 | /* Input : */ |
| 6766 | /* Output : */ |
| 6767 | /* Description : */ |
| 6768 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 6769 | void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6770 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6771 | unsigned short i; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 6772 | unsigned char *tempdi; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6773 | unsigned short modeflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6774 | |
| 6775 | if(ModeNo<=0x13) |
| 6776 | { |
| 6777 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 6778 | } |
| 6779 | else |
| 6780 | { |
| 6781 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
| 6782 | } |
| 6783 | |
| 6784 | |
| 6785 | XGINew_SetReg1(pVBInfo->Part3Port,0x00,0x00); |
| 6786 | if(pVBInfo->TVInfo&SetPALTV) |
| 6787 | { |
| 6788 | XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xFA); |
| 6789 | XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xC8); |
| 6790 | } |
| 6791 | else |
| 6792 | { |
| 6793 | XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xF5); |
| 6794 | XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xB7); |
| 6795 | } |
| 6796 | |
| 6797 | if(!(pVBInfo->VBInfo&SetCRT2ToTV)) |
| 6798 | { |
| 6799 | return; |
| 6800 | } |
| 6801 | |
| 6802 | if(pVBInfo->TVInfo&SetPALMTV) |
| 6803 | { |
| 6804 | XGINew_SetReg1(pVBInfo->Part3Port,0x13,0xFA); |
| 6805 | XGINew_SetReg1(pVBInfo->Part3Port,0x14,0xC8); |
| 6806 | XGINew_SetReg1(pVBInfo->Part3Port,0x3D,0xA8); |
| 6807 | } |
| 6808 | |
| 6809 | if((pVBInfo->VBInfo&SetCRT2ToHiVisionTV)|| (pVBInfo->VBInfo&SetCRT2ToYPbPr)) |
| 6810 | { |
| 6811 | if(pVBInfo->TVInfo & SetYPbPrMode525i) |
| 6812 | { |
| 6813 | return; |
| 6814 | } |
| 6815 | tempdi=pVBInfo->HiTVGroup3Data; |
| 6816 | if(pVBInfo->SetFlag&TVSimuMode) |
| 6817 | { |
| 6818 | tempdi=pVBInfo->HiTVGroup3Simu; |
| 6819 | if(!(modeflag&Charx8Dot)) |
| 6820 | { |
| 6821 | tempdi=pVBInfo->HiTVGroup3Text; |
| 6822 | } |
| 6823 | } |
| 6824 | |
| 6825 | if(pVBInfo->TVInfo & SetYPbPrMode525p) |
| 6826 | { |
| 6827 | tempdi=pVBInfo->Ren525pGroup3; |
| 6828 | } |
| 6829 | if(pVBInfo->TVInfo & SetYPbPrMode750p) |
| 6830 | { |
| 6831 | tempdi=pVBInfo->Ren750pGroup3; |
| 6832 | } |
| 6833 | |
| 6834 | for(i=0;i<=0x3E;i++) |
| 6835 | { |
| 6836 | XGINew_SetReg1(pVBInfo->Part3Port,i,tempdi[i]); |
| 6837 | } |
| 6838 | if(pVBInfo->VBType&VB_XGI301C) /* Marcovision */ |
| 6839 | { |
| 6840 | if(pVBInfo->TVInfo & SetYPbPrMode525p) |
| 6841 | { |
| 6842 | XGINew_SetReg1(pVBInfo->Part3Port,0x28,0x3f); |
| 6843 | } |
| 6844 | } |
| 6845 | } |
| 6846 | return; |
| 6847 | } /* {end of XGI_SetGroup3} */ |
| 6848 | |
| 6849 | |
| 6850 | /* --------------------------------------------------------------------- */ |
| 6851 | /* Function : XGI_SetGroup4 */ |
| 6852 | /* Input : */ |
| 6853 | /* Output : */ |
| 6854 | /* Description : */ |
| 6855 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 6856 | void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6857 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6858 | unsigned short tempax , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6859 | tempcx , |
| 6860 | tempbx , |
| 6861 | modeflag , |
| 6862 | temp , |
| 6863 | temp2 ; |
| 6864 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6865 | unsigned long tempebx , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6866 | tempeax , |
| 6867 | templong ; |
| 6868 | |
| 6869 | |
| 6870 | if ( ModeNo <= 0x13 ) |
| 6871 | { |
| 6872 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 6873 | } |
| 6874 | else |
| 6875 | { |
| 6876 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 6877 | } |
| 6878 | |
| 6879 | temp = pVBInfo->RVBHCFACT ; |
| 6880 | XGINew_SetReg1( pVBInfo->Part4Port , 0x13 , temp ) ; |
| 6881 | |
| 6882 | tempbx = pVBInfo->RVBHCMAX ; |
| 6883 | temp = tempbx & 0x00FF ; |
| 6884 | XGINew_SetReg1( pVBInfo->Part4Port , 0x14 , temp ) ; |
| 6885 | temp2 = ( ( tempbx & 0xFF00 ) >> 8 ) << 7 ; |
| 6886 | tempcx = pVBInfo->VGAHT - 1 ; |
| 6887 | temp = tempcx & 0x00FF ; |
| 6888 | XGINew_SetReg1( pVBInfo->Part4Port , 0x16 , temp ) ; |
| 6889 | |
| 6890 | temp =( ( tempcx & 0xFF00 ) >> 8 ) << 3 ; |
| 6891 | temp2 |= temp ; |
| 6892 | |
| 6893 | tempcx = pVBInfo->VGAVT - 1 ; |
| 6894 | if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) ) |
| 6895 | { |
| 6896 | tempcx -= 5 ; |
| 6897 | } |
| 6898 | |
| 6899 | temp = tempcx & 0x00FF ; |
| 6900 | XGINew_SetReg1( pVBInfo->Part4Port , 0x17 , temp ) ; |
| 6901 | temp = temp2 | ( ( tempcx & 0xFF00 ) >> 8 ) ; |
| 6902 | XGINew_SetReg1( pVBInfo->Part4Port , 0x15 , temp ) ; |
| 6903 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x0D , 0x08 ) ; |
| 6904 | tempcx = pVBInfo->VBInfo ; |
| 6905 | tempbx = pVBInfo->VGAHDE ; |
| 6906 | |
| 6907 | if ( modeflag & HalfDCLK ) |
| 6908 | { |
| 6909 | tempbx = tempbx >> 1 ; |
| 6910 | } |
| 6911 | |
| 6912 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 6913 | tempbx = tempbx >> 1 ; |
| 6914 | |
| 6915 | if(tempcx&SetCRT2ToHiVisionTV) |
| 6916 | { |
| 6917 | temp=0; |
| 6918 | if(tempbx<=1024) |
| 6919 | temp=0xA0; |
| 6920 | if(tempbx == 1280) |
| 6921 | temp = 0xC0; |
| 6922 | } |
| 6923 | else if(tempcx&SetCRT2ToTV) |
| 6924 | { |
| 6925 | temp=0xA0; |
| 6926 | if(tempbx <= 800) |
| 6927 | temp=0x80; |
| 6928 | } |
| 6929 | else |
| 6930 | { |
| 6931 | temp=0x80; |
| 6932 | if(pVBInfo->VBInfo&SetCRT2ToLCD) |
| 6933 | { |
| 6934 | temp=0; |
| 6935 | if(tempbx>800) |
| 6936 | temp=0x60; |
| 6937 | } |
| 6938 | } |
| 6939 | |
| 6940 | if ( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) |
| 6941 | { |
| 6942 | temp = 0x00 ; |
| 6943 | if ( pVBInfo->VGAHDE == 1280 ) |
| 6944 | temp = 0x40 ; |
| 6945 | if ( pVBInfo->VGAHDE == 1024 ) |
| 6946 | temp = 0x20 ; |
| 6947 | } |
| 6948 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x0E , ~0xEF , temp ) ; |
| 6949 | |
| 6950 | tempebx = pVBInfo->VDE ; |
| 6951 | |
| 6952 | if ( tempcx & SetCRT2ToHiVisionTV ) |
| 6953 | { |
| 6954 | if ( !( temp & 0xE000 ) ) |
| 6955 | tempbx = tempbx >> 1 ; |
| 6956 | } |
| 6957 | |
| 6958 | tempcx = pVBInfo->RVBHRS ; |
| 6959 | temp = tempcx & 0x00FF ; |
| 6960 | XGINew_SetReg1( pVBInfo->Part4Port , 0x18 , temp ); |
| 6961 | |
| 6962 | tempeax = pVBInfo->VGAVDE ; |
| 6963 | tempcx |= 0x04000 ; |
| 6964 | |
| 6965 | |
| 6966 | if ( tempeax <= tempebx ) |
| 6967 | { |
| 6968 | tempcx=(tempcx&(~0x4000)); |
| 6969 | tempeax = pVBInfo->VGAVDE ; |
| 6970 | } |
| 6971 | else |
| 6972 | { |
| 6973 | tempeax -= tempebx ; |
| 6974 | } |
| 6975 | |
| 6976 | |
| 6977 | templong = ( tempeax * 256 * 1024 ) % tempebx ; |
| 6978 | tempeax = ( tempeax * 256 * 1024 ) / tempebx ; |
| 6979 | tempebx = tempeax ; |
| 6980 | |
| 6981 | if ( templong != 0 ) |
| 6982 | { |
| 6983 | tempebx++ ; |
| 6984 | } |
| 6985 | |
| 6986 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6987 | temp = (unsigned short)(tempebx & 0x000000FF); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6988 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1B , temp ) ; |
| 6989 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6990 | temp = (unsigned short)((tempebx & 0x0000FF00) >> 8); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6991 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1A , temp ) ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6992 | tempbx = (unsigned short)(tempebx >> 16); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6993 | temp = tempbx & 0x00FF ; |
| 6994 | temp = temp << 4 ; |
| 6995 | temp |= ( ( tempcx & 0xFF00 ) >> 8 ) ; |
| 6996 | XGINew_SetReg1( pVBInfo->Part4Port , 0x19 , temp ) ; |
| 6997 | |
| 6998 | /* 301b */ |
| 6999 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 7000 | { |
| 7001 | temp = 0x0028 ; |
| 7002 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1C , temp ) ; |
| 7003 | tempax = pVBInfo->VGAHDE ; |
| 7004 | if ( modeflag & HalfDCLK ) |
| 7005 | { |
| 7006 | tempax = tempax >> 1 ; |
| 7007 | } |
| 7008 | |
| 7009 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 7010 | tempax = tempax >> 1 ; |
| 7011 | |
| 7012 | /* if((pVBInfo->VBInfo&(SetCRT2ToLCD))||((pVBInfo->TVInfo&SetYPbPrMode525p)||(pVBInfo->TVInfo&SetYPbPrMode750p))) { */ |
| 7013 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 7014 | { |
| 7015 | if ( tempax > 800 ) |
| 7016 | tempax -= 800 ; |
| 7017 | } |
| 7018 | else |
| 7019 | { |
| 7020 | if ( pVBInfo->VGAHDE > 800 ) |
| 7021 | { |
| 7022 | if ( pVBInfo->VGAHDE == 1024 ) |
| 7023 | tempax = ( tempax * 25 / 32 ) - 1 ; |
| 7024 | else |
| 7025 | tempax = ( tempax * 20 / 32 ) - 1 ; |
| 7026 | } |
| 7027 | } |
| 7028 | tempax -= 1 ; |
| 7029 | |
| 7030 | /* |
| 7031 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToHiVisionTV ) ) |
| 7032 | { |
| 7033 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 7034 | { |
| 7035 | if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) |
| 7036 | { |
| 7037 | if ( pVBInfo->VGAHDE > 800 ) |
| 7038 | { |
| 7039 | if ( pVBInfo->VGAHDE == 1024 ) |
| 7040 | tempax = ( tempax * 25 / 32 ) - 1 ; |
| 7041 | else |
| 7042 | tempax = ( tempax * 20 / 32 ) - 1 ; |
| 7043 | } |
| 7044 | } |
| 7045 | } |
| 7046 | else |
| 7047 | { |
| 7048 | if ( pVBInfo->VGAHDE > 800 ) |
| 7049 | { |
| 7050 | if ( pVBInfo->VGAHDE == 1024 ) |
| 7051 | tempax = ( tempax * 25 / 32 ) - 1 ; |
| 7052 | else |
| 7053 | tempax = ( tempax * 20 / 32 ) - 1 ; |
| 7054 | } |
| 7055 | } |
| 7056 | } |
| 7057 | */ |
| 7058 | |
| 7059 | temp = ( tempax & 0xFF00 ) >> 8 ; |
| 7060 | temp = ( ( temp & 0x0003 ) << 4 ) ; |
| 7061 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1E , temp ) ; |
| 7062 | temp = ( tempax & 0x00FF ) ; |
| 7063 | XGINew_SetReg1( pVBInfo->Part4Port , 0x1D , temp ) ; |
| 7064 | |
| 7065 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToHiVisionTV ) ) |
| 7066 | { |
| 7067 | if ( pVBInfo->VGAHDE > 800 ) |
| 7068 | { |
| 7069 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x1E , 0x08 ) ; |
| 7070 | } |
| 7071 | } |
| 7072 | temp = 0x0036 ; |
| 7073 | |
| 7074 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 7075 | { |
| 7076 | if ( !( pVBInfo->TVInfo & ( NTSC1024x768 | SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i ) ) ) |
| 7077 | { |
| 7078 | temp |= 0x0001 ; |
| 7079 | if ( ( pVBInfo->VBInfo & SetInSlaveMode ) && ( !( pVBInfo->TVInfo & TVSimuMode ) ) ) |
| 7080 | temp &= ( ~0x0001 ) ; |
| 7081 | } |
| 7082 | } |
| 7083 | |
| 7084 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x1F , 0x00C0 , temp ) ; |
| 7085 | tempbx = pVBInfo->HT ; |
| 7086 | if ( XGI_IsLCDDualLink( pVBInfo ) ) |
| 7087 | tempbx = tempbx >> 1 ; |
| 7088 | tempbx = ( tempbx >> 1 ) - 2 ; |
| 7089 | temp = ( ( tempbx & 0x0700 ) >> 8 ) << 3 ; |
| 7090 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x21 , 0x00C0 , temp ) ; |
| 7091 | temp = tempbx & 0x00FF ; |
| 7092 | XGINew_SetReg1( pVBInfo->Part4Port , 0x22 , temp ) ; |
| 7093 | } |
| 7094 | /* end 301b */ |
| 7095 | |
| 7096 | if ( pVBInfo->ISXPDOS == 0 ) |
| 7097 | XGI_SetCRT2VCLK( ModeNo , ModeIdIndex , RefreshRateTableIndex, pVBInfo ) ; |
| 7098 | } |
| 7099 | |
| 7100 | |
| 7101 | /* --------------------------------------------------------------------- */ |
| 7102 | /* Function : XGI_SetGroup5 */ |
| 7103 | /* Input : */ |
| 7104 | /* Output : */ |
| 7105 | /* Description : */ |
| 7106 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7107 | void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7108 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 7109 | unsigned short Pindex , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7110 | Pdata ; |
| 7111 | |
| 7112 | Pindex = pVBInfo->Part5Port ; |
| 7113 | Pdata = pVBInfo->Part5Port + 1 ; |
| 7114 | if ( pVBInfo->ModeType == ModeVGA ) |
| 7115 | { |
| 7116 | if ( !( pVBInfo->VBInfo & ( SetInSlaveMode | LoadDACFlag | CRT2DisplayFlag ) ) ) |
| 7117 | { |
| 7118 | XGINew_EnableCRT2(pVBInfo) ; |
| 7119 | /* LoadDAC2(pVBInfo->Part5Port,ModeNo,ModeIdIndex); */ |
| 7120 | } |
| 7121 | } |
| 7122 | return ; |
| 7123 | } |
| 7124 | |
| 7125 | |
| 7126 | /* --------------------------------------------------------------------- */ |
| 7127 | /* Function : XGI_GetLcdPtr */ |
| 7128 | /* Input : */ |
| 7129 | /* Output : */ |
| 7130 | /* Description : */ |
| 7131 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 7132 | void *XGI_GetLcdPtr(unsigned short BX, |
| 7133 | unsigned short ModeNo, |
| 7134 | unsigned short ModeIdIndex, |
| 7135 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7136 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7137 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 7138 | unsigned short i , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7139 | tempdx , |
| 7140 | tempcx , |
| 7141 | tempbx , |
| 7142 | tempal , |
| 7143 | modeflag , |
| 7144 | table ; |
| 7145 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7146 | struct XGI330_LCDDataTablStruct *tempdi = 0 ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7147 | |
| 7148 | |
| 7149 | tempbx = BX; |
| 7150 | |
| 7151 | if ( ModeNo <= 0x13 ) |
| 7152 | { |
| 7153 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 7154 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 7155 | } |
| 7156 | else |
| 7157 | { |
| 7158 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 7159 | tempal = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 7160 | } |
| 7161 | |
| 7162 | tempal = tempal & 0x0f ; |
| 7163 | |
| 7164 | if ( tempbx <= 1 ) /* ExpLink */ |
| 7165 | { |
| 7166 | if ( ModeNo <= 0x13 ) |
| 7167 | { |
| 7168 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; /* find no Ext_CRT2CRTC2 */ |
| 7169 | } |
| 7170 | else |
| 7171 | { |
| 7172 | tempal= pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 7173 | } |
| 7174 | |
| 7175 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 7176 | { |
| 7177 | if ( ModeNo <= 0x13 ) |
| 7178 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC2 ; |
| 7179 | else |
| 7180 | tempal= pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC2 ; |
| 7181 | } |
| 7182 | |
| 7183 | if ( tempbx & 0x01 ) |
| 7184 | tempal = ( tempal >> 4 ) ; |
| 7185 | |
| 7186 | tempal = ( tempal & 0x0f ) ; |
| 7187 | } |
| 7188 | |
| 7189 | tempcx = LCDLenList[ tempbx ] ; /* mov cl,byte ptr cs:LCDLenList[bx] */ |
| 7190 | |
| 7191 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) /* ScaleLCD */ |
| 7192 | { |
| 7193 | if ( ( tempbx == 5 ) || ( tempbx ) == 7 ) |
| 7194 | tempcx = LCDDesDataLen2 ; |
| 7195 | else if ( ( tempbx == 3 ) || ( tempbx == 8 ) ) |
| 7196 | tempcx = LVDSDesDataLen2 ; |
| 7197 | } |
| 7198 | /* mov di, word ptr cs:LCDDataList[bx] */ |
| 7199 | /* tempdi=pVideoMemory[LCDDataList+tempbx*2]|(pVideoMemory[LCDDataList+tempbx*2+1]<<8); */ |
| 7200 | |
| 7201 | switch( tempbx ) |
| 7202 | { |
| 7203 | case 0: |
| 7204 | tempdi = XGI_EPLLCDCRT1Ptr_H ; |
| 7205 | break ; |
| 7206 | case 1: |
| 7207 | tempdi = XGI_EPLLCDCRT1Ptr_V ; |
| 7208 | break ; |
| 7209 | case 2: |
| 7210 | tempdi = XGI_EPLLCDDataPtr ; |
| 7211 | break ; |
| 7212 | case 3: |
| 7213 | tempdi = XGI_EPLLCDDesDataPtr ; |
| 7214 | break ; |
| 7215 | case 4: |
| 7216 | tempdi = XGI_LCDDataTable ; |
| 7217 | break ; |
| 7218 | case 5: |
| 7219 | tempdi = XGI_LCDDesDataTable ; |
| 7220 | break ; |
| 7221 | case 6: |
| 7222 | tempdi = XGI_EPLCHLCDRegPtr ; |
| 7223 | break ; |
| 7224 | case 7: |
| 7225 | case 8: |
| 7226 | case 9: |
| 7227 | tempdi = 0 ; |
| 7228 | break ; |
| 7229 | default: |
| 7230 | break ; |
| 7231 | } |
| 7232 | |
| 7233 | if ( tempdi == 0x00 ) /* OEMUtil */ |
| 7234 | return 0 ; |
| 7235 | |
| 7236 | table = tempbx ; |
| 7237 | i = 0 ; |
| 7238 | |
| 7239 | while( tempdi[ i ].PANELID != 0xff ) |
| 7240 | { |
| 7241 | tempdx = pVBInfo->LCDResInfo ; |
| 7242 | if ( tempbx & 0x0080 ) /* OEMUtil */ |
| 7243 | { |
| 7244 | tempbx &= ( ~0x0080 ) ; |
| 7245 | tempdx = pVBInfo->LCDTypeInfo ; |
| 7246 | } |
| 7247 | |
| 7248 | if ( pVBInfo->LCDInfo & EnableScalingLCD ) |
| 7249 | tempdx &= ( ~PanelResInfo ) ; |
| 7250 | |
| 7251 | if ( tempdi[ i ].PANELID == tempdx ) |
| 7252 | { |
| 7253 | tempbx = tempdi[ i ].MASK ; |
| 7254 | tempdx = pVBInfo->LCDInfo ; |
| 7255 | |
| 7256 | if ( ModeNo <= 0x13 ) /* alan 09/10/2003 */ |
| 7257 | tempdx |= SetLCDStdMode ; |
| 7258 | |
| 7259 | if ( modeflag & HalfDCLK ) |
| 7260 | tempdx |= SetLCDLowResolution ; |
| 7261 | |
| 7262 | tempbx &= tempdx; |
| 7263 | if ( tempbx == tempdi[ i ].CAP ) |
| 7264 | break ; |
| 7265 | } |
| 7266 | i++ ; |
| 7267 | } |
| 7268 | |
| 7269 | if ( table == 0 ) |
| 7270 | { |
| 7271 | switch( tempdi[ i ].DATAPTR ) |
| 7272 | { |
| 7273 | case 0: |
| 7274 | return &XGI_LVDSCRT11024x768_1_H[ tempal ] ; |
| 7275 | break ; |
| 7276 | case 1: |
| 7277 | return &XGI_LVDSCRT11024x768_2_H[ tempal ] ; |
| 7278 | break ; |
| 7279 | case 2: |
| 7280 | return &XGI_LVDSCRT11280x1024_1_H[ tempal ] ; |
| 7281 | break ; |
| 7282 | case 3: |
| 7283 | return &XGI_LVDSCRT11280x1024_2_H[ tempal ] ; |
| 7284 | break ; |
| 7285 | case 4: |
| 7286 | return &XGI_LVDSCRT11400x1050_1_H[ tempal ] ; |
| 7287 | break ; |
| 7288 | case 5: |
| 7289 | return &XGI_LVDSCRT11400x1050_2_H[ tempal ] ; |
| 7290 | break ; |
| 7291 | case 6: |
| 7292 | return &XGI_LVDSCRT11600x1200_1_H[ tempal ] ; |
| 7293 | break ; |
| 7294 | case 7: |
| 7295 | return &XGI_LVDSCRT11024x768_1_Hx75[ tempal ] ; |
| 7296 | break ; |
| 7297 | case 8: |
| 7298 | return &XGI_LVDSCRT11024x768_2_Hx75[ tempal ] ; |
| 7299 | break ; |
| 7300 | case 9: |
| 7301 | return &XGI_LVDSCRT11280x1024_1_Hx75[ tempal ] ; |
| 7302 | break ; |
| 7303 | case 10: |
| 7304 | return &XGI_LVDSCRT11280x1024_2_Hx75[ tempal ] ; |
| 7305 | break ; |
| 7306 | default: |
| 7307 | break ; |
| 7308 | } |
| 7309 | } |
| 7310 | else if ( table == 1 ) |
| 7311 | { |
| 7312 | switch( tempdi[ i ].DATAPTR ) |
| 7313 | { |
| 7314 | case 0: |
| 7315 | return &XGI_LVDSCRT11024x768_1_V[ tempal ] ; |
| 7316 | break ; |
| 7317 | case 1: |
| 7318 | return &XGI_LVDSCRT11024x768_2_V[ tempal ] ; |
| 7319 | break ; |
| 7320 | case 2: |
| 7321 | return &XGI_LVDSCRT11280x1024_1_V[ tempal ] ; |
| 7322 | break ; |
| 7323 | case 3: |
| 7324 | return &XGI_LVDSCRT11280x1024_2_V[ tempal ] ; |
| 7325 | break ; |
| 7326 | case 4: |
| 7327 | return &XGI_LVDSCRT11400x1050_1_V[ tempal ] ; |
| 7328 | break ; |
| 7329 | case 5: |
| 7330 | return &XGI_LVDSCRT11400x1050_2_V[ tempal ] ; |
| 7331 | break ; |
| 7332 | case 6: |
| 7333 | return &XGI_LVDSCRT11600x1200_1_V[ tempal ] ; |
| 7334 | break ; |
| 7335 | case 7: |
| 7336 | return &XGI_LVDSCRT11024x768_1_Vx75[ tempal ] ; |
| 7337 | break ; |
| 7338 | case 8: |
| 7339 | return &XGI_LVDSCRT11024x768_2_Vx75[ tempal ] ; |
| 7340 | break ; |
| 7341 | case 9: |
| 7342 | return &XGI_LVDSCRT11280x1024_1_Vx75[ tempal ] ; |
| 7343 | break ; |
| 7344 | case 10: |
| 7345 | return &XGI_LVDSCRT11280x1024_2_Vx75[ tempal ] ; |
| 7346 | break ; |
| 7347 | default: |
| 7348 | break ; |
| 7349 | } |
| 7350 | } |
| 7351 | else if ( table == 2 ) |
| 7352 | { |
| 7353 | switch( tempdi[ i ].DATAPTR ) |
| 7354 | { |
| 7355 | case 0: |
| 7356 | return &XGI_LVDS1024x768Data_1[ tempal ] ; |
| 7357 | break ; |
| 7358 | case 1: |
| 7359 | return &XGI_LVDS1024x768Data_2[ tempal ] ; |
| 7360 | break ; |
| 7361 | case 2: |
| 7362 | return &XGI_LVDS1280x1024Data_1[ tempal ] ; |
| 7363 | break ; |
| 7364 | case 3: |
| 7365 | return &XGI_LVDS1280x1024Data_2[ tempal ] ; |
| 7366 | break ; |
| 7367 | case 4: |
| 7368 | return &XGI_LVDS1400x1050Data_1[ tempal ] ; |
| 7369 | break ; |
| 7370 | case 5: |
| 7371 | return &XGI_LVDS1400x1050Data_2[ tempal ] ; |
| 7372 | break ; |
| 7373 | case 6: |
| 7374 | return &XGI_LVDS1600x1200Data_1[ tempal ] ; |
| 7375 | break ; |
| 7376 | case 7: |
| 7377 | return &XGI_LVDSNoScalingData[ tempal ] ; |
| 7378 | break ; |
| 7379 | case 8: |
| 7380 | return &XGI_LVDS1024x768Data_1x75[ tempal ] ; |
| 7381 | break ; |
| 7382 | case 9: |
| 7383 | return &XGI_LVDS1024x768Data_2x75[ tempal ] ; |
| 7384 | break ; |
| 7385 | case 10: |
| 7386 | return &XGI_LVDS1280x1024Data_1x75[ tempal ] ; |
| 7387 | break ; |
| 7388 | case 11: |
| 7389 | return &XGI_LVDS1280x1024Data_2x75[ tempal ] ; |
| 7390 | break ; |
| 7391 | case 12: |
| 7392 | return &XGI_LVDSNoScalingDatax75[ tempal ] ; |
| 7393 | break ; |
| 7394 | default: |
| 7395 | break ; |
| 7396 | } |
| 7397 | } |
| 7398 | else if ( table == 3 ) |
| 7399 | { |
| 7400 | switch( tempdi[ i ].DATAPTR ) |
| 7401 | { |
| 7402 | case 0: |
| 7403 | return &XGI_LVDS1024x768Des_1[ tempal ] ; |
| 7404 | break ; |
| 7405 | case 1: |
| 7406 | return &XGI_LVDS1024x768Des_3[ tempal ] ; |
| 7407 | break ; |
| 7408 | case 2: |
| 7409 | return &XGI_LVDS1024x768Des_2[ tempal ] ; |
| 7410 | break ; |
| 7411 | case 3: |
| 7412 | return &XGI_LVDS1280x1024Des_1[ tempal ] ; |
| 7413 | break ; |
| 7414 | case 4: |
| 7415 | return &XGI_LVDS1280x1024Des_2[ tempal ] ; |
| 7416 | break ; |
| 7417 | case 5: |
| 7418 | return &XGI_LVDS1400x1050Des_1[ tempal ] ; |
| 7419 | break ; |
| 7420 | case 6: |
| 7421 | return &XGI_LVDS1400x1050Des_2[ tempal ] ; |
| 7422 | break ; |
| 7423 | case 7: |
| 7424 | return &XGI_LVDS1600x1200Des_1[ tempal ] ; |
| 7425 | break ; |
| 7426 | case 8: |
| 7427 | return &XGI_LVDSNoScalingDesData[ tempal ] ; |
| 7428 | break ; |
| 7429 | case 9: |
| 7430 | return &XGI_LVDS1024x768Des_1x75[ tempal ] ; |
| 7431 | break ; |
| 7432 | case 10: |
| 7433 | return &XGI_LVDS1024x768Des_3x75[ tempal ] ; |
| 7434 | break ; |
| 7435 | case 11: |
| 7436 | return &XGI_LVDS1024x768Des_2x75[ tempal ] ; |
| 7437 | break; |
| 7438 | case 12: |
| 7439 | return &XGI_LVDS1280x1024Des_1x75[ tempal ] ; |
| 7440 | break ; |
| 7441 | case 13: |
| 7442 | return &XGI_LVDS1280x1024Des_2x75[ tempal ] ; |
| 7443 | break ; |
| 7444 | case 14: |
| 7445 | return &XGI_LVDSNoScalingDesDatax75[ tempal ] ; |
| 7446 | break ; |
| 7447 | default: |
| 7448 | break ; |
| 7449 | } |
| 7450 | } |
| 7451 | else if ( table == 4 ) |
| 7452 | { |
| 7453 | switch( tempdi[ i ].DATAPTR ) |
| 7454 | { |
| 7455 | case 0: |
| 7456 | return &XGI_ExtLCD1024x768Data[ tempal ] ; |
| 7457 | break ; |
| 7458 | case 1: |
| 7459 | return &XGI_StLCD1024x768Data[ tempal ] ; |
| 7460 | break ; |
| 7461 | case 2: |
| 7462 | return &XGI_CetLCD1024x768Data[ tempal ] ; |
| 7463 | break ; |
| 7464 | case 3: |
| 7465 | return &XGI_ExtLCD1280x1024Data[ tempal ] ; |
| 7466 | break ; |
| 7467 | case 4: |
| 7468 | return &XGI_StLCD1280x1024Data[ tempal ] ; |
| 7469 | break ; |
| 7470 | case 5: |
| 7471 | return &XGI_CetLCD1280x1024Data[ tempal ] ; |
| 7472 | break ; |
| 7473 | case 6: |
| 7474 | return &XGI_ExtLCD1400x1050Data[ tempal ] ; |
| 7475 | break ; |
| 7476 | case 7: |
| 7477 | return &XGI_StLCD1400x1050Data[ tempal ] ; |
| 7478 | break ; |
| 7479 | case 8: |
| 7480 | return &XGI_CetLCD1400x1050Data[ tempal ] ; |
| 7481 | break ; |
| 7482 | case 9: |
| 7483 | return &XGI_ExtLCD1600x1200Data[ tempal ] ; |
| 7484 | break ; |
| 7485 | case 10: |
| 7486 | return &XGI_StLCD1600x1200Data[ tempal ] ; |
| 7487 | break ; |
| 7488 | case 11: |
| 7489 | return &XGI_NoScalingData[ tempal ] ; |
| 7490 | break ; |
| 7491 | case 12: |
| 7492 | return &XGI_ExtLCD1024x768x75Data[ tempal ] ; |
| 7493 | break ; |
| 7494 | case 13: |
| 7495 | return &XGI_ExtLCD1024x768x75Data[ tempal ] ; |
| 7496 | break ; |
| 7497 | case 14: |
| 7498 | return &XGI_CetLCD1024x768x75Data[ tempal ] ; |
| 7499 | break ; |
| 7500 | case 15: |
| 7501 | return &XGI_ExtLCD1280x1024x75Data[ tempal ] ; |
| 7502 | break ; |
| 7503 | case 16: |
| 7504 | return &XGI_StLCD1280x1024x75Data[ tempal ] ; |
| 7505 | break; |
| 7506 | case 17: |
| 7507 | return &XGI_CetLCD1280x1024x75Data[ tempal ] ; |
| 7508 | break; |
| 7509 | case 18: |
| 7510 | return &XGI_NoScalingDatax75[ tempal ] ; |
| 7511 | break ; |
| 7512 | default: |
| 7513 | break ; |
| 7514 | } |
| 7515 | } |
| 7516 | else if ( table == 5 ) |
| 7517 | { |
| 7518 | switch( tempdi[ i ].DATAPTR ) |
| 7519 | { |
| 7520 | case 0: |
| 7521 | return &XGI_ExtLCDDes1024x768Data[ tempal ] ; |
| 7522 | break ; |
| 7523 | case 1: |
| 7524 | return &XGI_StLCDDes1024x768Data[ tempal ] ; |
| 7525 | break ; |
| 7526 | case 2: |
| 7527 | return &XGI_CetLCDDes1024x768Data[ tempal ] ; |
| 7528 | break ; |
| 7529 | case 3: |
| 7530 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7531 | return &XGI_ExtLCDDLDes1280x1024Data[ tempal ] ; |
| 7532 | else |
| 7533 | return &XGI_ExtLCDDes1280x1024Data[ tempal ] ; |
| 7534 | break ; |
| 7535 | case 4: |
| 7536 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7537 | return &XGI_StLCDDLDes1280x1024Data[ tempal ] ; |
| 7538 | else |
| 7539 | return &XGI_StLCDDes1280x1024Data[ tempal ] ; |
| 7540 | break ; |
| 7541 | case 5: |
| 7542 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7543 | return &XGI_CetLCDDLDes1280x1024Data[ tempal ] ; |
| 7544 | else |
| 7545 | return &XGI_CetLCDDes1280x1024Data[ tempal ] ; |
| 7546 | break ; |
| 7547 | case 6: |
| 7548 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7549 | return &XGI_ExtLCDDLDes1400x1050Data[ tempal ] ; |
| 7550 | else |
| 7551 | return &XGI_ExtLCDDes1400x1050Data[ tempal ] ; |
| 7552 | break ; |
| 7553 | case 7: |
| 7554 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7555 | return &XGI_StLCDDLDes1400x1050Data[ tempal ] ; |
| 7556 | else |
| 7557 | return &XGI_StLCDDes1400x1050Data[ tempal ] ; |
| 7558 | break ; |
| 7559 | case 8: |
| 7560 | return &XGI_CetLCDDes1400x1050Data[ tempal ] ; |
| 7561 | break ; |
| 7562 | case 9: |
| 7563 | return &XGI_CetLCDDes1400x1050Data2[ tempal ] ; |
| 7564 | break ; |
| 7565 | case 10: |
| 7566 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7567 | return &XGI_ExtLCDDLDes1600x1200Data[ tempal ] ; |
| 7568 | else |
| 7569 | return &XGI_ExtLCDDes1600x1200Data[ tempal ] ; |
| 7570 | break ; |
| 7571 | case 11: |
| 7572 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7573 | return &XGI_StLCDDLDes1600x1200Data[ tempal ] ; |
| 7574 | else |
| 7575 | return &XGI_StLCDDes1600x1200Data[ tempal ] ; |
| 7576 | break ; |
| 7577 | case 12: |
| 7578 | return &XGI_NoScalingDesData[ tempal ] ; |
| 7579 | break; |
| 7580 | case 13: |
| 7581 | return &XGI_ExtLCDDes1024x768x75Data[ tempal ] ; |
| 7582 | break ; |
| 7583 | case 14: |
| 7584 | return &XGI_StLCDDes1024x768x75Data[ tempal ] ; |
| 7585 | break ; |
| 7586 | case 15: |
| 7587 | return &XGI_CetLCDDes1024x768x75Data[ tempal ] ; |
| 7588 | break ; |
| 7589 | case 16: |
| 7590 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7591 | return &XGI_ExtLCDDLDes1280x1024x75Data[ tempal ] ; |
| 7592 | else |
| 7593 | return &XGI_ExtLCDDes1280x1024x75Data[ tempal ] ; |
| 7594 | break ; |
| 7595 | case 17: |
| 7596 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7597 | return &XGI_StLCDDLDes1280x1024x75Data[ tempal ] ; |
| 7598 | else |
| 7599 | return &XGI_StLCDDes1280x1024x75Data[ tempal ] ; |
| 7600 | break ; |
| 7601 | case 18: |
| 7602 | if ( ( pVBInfo->VBType & VB_XGI301LV ) || ( pVBInfo->VBType & VB_XGI302LV ) ) |
| 7603 | return &XGI_CetLCDDLDes1280x1024x75Data[ tempal ] ; |
| 7604 | else |
| 7605 | return &XGI_CetLCDDes1280x1024x75Data[ tempal ] ; |
| 7606 | break ; |
| 7607 | case 19: |
| 7608 | return &XGI_NoScalingDesDatax75[ tempal ] ; |
| 7609 | break ; |
| 7610 | default: |
| 7611 | break ; |
| 7612 | } |
| 7613 | } |
| 7614 | else if ( table == 6 ) |
| 7615 | { |
| 7616 | switch( tempdi[ i ].DATAPTR ) |
| 7617 | { |
| 7618 | case 0: |
| 7619 | return &XGI_CH7017LV1024x768[ tempal ] ; |
| 7620 | break ; |
| 7621 | case 1: |
| 7622 | return &XGI_CH7017LV1400x1050[ tempal ] ; |
| 7623 | break ; |
| 7624 | default: |
| 7625 | break ; |
| 7626 | } |
| 7627 | } |
| 7628 | return 0 ; |
| 7629 | } |
| 7630 | |
| 7631 | |
| 7632 | /* --------------------------------------------------------------------- */ |
| 7633 | /* Function : XGI_GetTVPtr */ |
| 7634 | /* Input : */ |
| 7635 | /* Output : */ |
| 7636 | /* Description : */ |
| 7637 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 7638 | void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo, |
| 7639 | unsigned short ModeIdIndex, |
| 7640 | unsigned short RefreshRateTableIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7641 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7642 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 7643 | unsigned short i , tempdx , tempbx , tempal , modeflag , table ; |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7644 | struct XGI330_TVDataTablStruct *tempdi = 0 ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7645 | |
| 7646 | tempbx = BX ; |
| 7647 | |
| 7648 | if ( ModeNo <= 0x13 ) |
| 7649 | { |
| 7650 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 7651 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 7652 | } |
| 7653 | else |
| 7654 | { |
| 7655 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 7656 | tempal = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 7657 | } |
| 7658 | |
| 7659 | tempal = tempal & 0x3f ; |
| 7660 | table = tempbx ; |
| 7661 | |
| 7662 | switch( tempbx ) |
| 7663 | { |
| 7664 | case 0: |
| 7665 | tempdi = 0 ; /*EPLCHTVCRT1Ptr_H;*/ |
| 7666 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 7667 | { |
| 7668 | tempdi = XGI_EPLCHTVCRT1Ptr; |
| 7669 | } |
| 7670 | break ; |
| 7671 | case 1: |
| 7672 | tempdi = 0 ; /*EPLCHTVCRT1Ptr_V;*/ |
| 7673 | if ( pVBInfo->IF_DEF_CH7007 == 1 ) |
| 7674 | { |
| 7675 | tempdi = XGI_EPLCHTVCRT1Ptr; |
| 7676 | } |
| 7677 | break ; |
| 7678 | case 2: |
| 7679 | tempdi = XGI_EPLCHTVDataPtr ; |
| 7680 | break ; |
| 7681 | case 3: |
| 7682 | tempdi = 0 ; |
| 7683 | break ; |
| 7684 | case 4: |
| 7685 | tempdi = XGI_TVDataTable ; |
| 7686 | break ; |
| 7687 | case 5: |
| 7688 | tempdi = 0 ; |
| 7689 | break ; |
| 7690 | case 6: |
| 7691 | tempdi = XGI_EPLCHTVRegPtr ; |
| 7692 | break ; |
| 7693 | default: |
| 7694 | break ; |
| 7695 | } |
| 7696 | |
| 7697 | if ( tempdi == 0x00 ) /* OEMUtil */ |
| 7698 | return( 0 ) ; |
| 7699 | |
| 7700 | tempdx = pVBInfo->TVInfo ; |
| 7701 | |
| 7702 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 7703 | tempdx = tempdx | SetTVLockMode ; |
| 7704 | |
| 7705 | if ( modeflag & HalfDCLK ) |
| 7706 | tempdx = tempdx | SetTVLowResolution ; |
| 7707 | |
| 7708 | i = 0 ; |
| 7709 | |
| 7710 | while( tempdi[ i ].MASK != 0xffff ) |
| 7711 | { |
| 7712 | if ( ( tempdx & tempdi[ i ].MASK ) == tempdi[ i ].CAP ) |
| 7713 | break ; |
| 7714 | i++ ; |
| 7715 | } |
| 7716 | |
| 7717 | if ( table == 0x00 ) /* 07/05/22 */ |
| 7718 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7719 | } |
| 7720 | else if ( table == 0x01 ) |
| 7721 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7722 | } |
| 7723 | else if ( table == 0x04 ) |
| 7724 | { |
| 7725 | switch( tempdi[ i ].DATAPTR ) |
| 7726 | { |
| 7727 | case 0: |
| 7728 | return &XGI_ExtPALData[ tempal ] ; |
| 7729 | break ; |
| 7730 | case 1: |
| 7731 | return &XGI_ExtNTSCData[ tempal ] ; |
| 7732 | break ; |
| 7733 | case 2: |
| 7734 | return &XGI_StPALData[ tempal ] ; |
| 7735 | break ; |
| 7736 | case 3: |
| 7737 | return &XGI_StNTSCData[ tempal ] ; |
| 7738 | break ; |
| 7739 | case 4: |
| 7740 | return &XGI_ExtHiTVData[ tempal ] ; |
| 7741 | break ; |
| 7742 | case 5: |
| 7743 | return &XGI_St2HiTVData[ tempal ] ; |
| 7744 | break ; |
| 7745 | case 6: |
| 7746 | return &XGI_ExtYPbPr525iData[ tempal ] ; |
| 7747 | break ; |
| 7748 | case 7: |
| 7749 | return &XGI_ExtYPbPr525pData[ tempal ] ; |
| 7750 | break ; |
| 7751 | case 8: |
| 7752 | return &XGI_ExtYPbPr750pData[ tempal ] ; |
| 7753 | break ; |
| 7754 | case 9: |
| 7755 | return &XGI_StYPbPr525iData[ tempal ] ; |
| 7756 | break ; |
| 7757 | case 10: |
| 7758 | return &XGI_StYPbPr525pData[ tempal ] ; |
| 7759 | break ; |
| 7760 | case 11: |
| 7761 | return &XGI_StYPbPr750pData[ tempal ] ; |
| 7762 | break; |
| 7763 | case 12: /* avoid system hang */ |
| 7764 | return &XGI_ExtNTSCData[ tempal ] ; |
| 7765 | break ; |
| 7766 | case 13: |
| 7767 | return &XGI_St1HiTVData[ tempal ] ; |
| 7768 | break ; |
| 7769 | default: |
| 7770 | break ; |
| 7771 | } |
| 7772 | } |
| 7773 | else if( table == 0x02 ) |
| 7774 | { |
| 7775 | switch( tempdi[ i ].DATAPTR ) |
| 7776 | { |
| 7777 | case 0: |
| 7778 | return &XGI_CHTVUNTSCData[ tempal ] ; |
| 7779 | break ; |
| 7780 | case 1: |
| 7781 | return &XGI_CHTVONTSCData[ tempal ] ; |
| 7782 | break ; |
| 7783 | case 2: |
| 7784 | return &XGI_CHTVUPALData[ tempal ] ; |
| 7785 | break ; |
| 7786 | case 3: |
| 7787 | return &XGI_CHTVOPALData[ tempal ] ; |
| 7788 | break ; |
| 7789 | default: |
| 7790 | break ; |
| 7791 | } |
| 7792 | } |
| 7793 | else if( table == 0x06 ) |
| 7794 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7795 | } |
| 7796 | return( 0 ) ; |
| 7797 | } |
| 7798 | |
| 7799 | |
| 7800 | /* --------------------------------------------------------------------- */ |
| 7801 | /* Function : XGI_BacklightByDrv */ |
| 7802 | /* Input : */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 7803 | /* Output : 1 -> Skip backlight control */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7804 | /* Description : */ |
| 7805 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7806 | unsigned char XGI_BacklightByDrv(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7807 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 7808 | unsigned char tempah ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7809 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 7810 | tempah = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x3A) ; |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 7811 | if (tempah & BacklightControlBit) |
| 7812 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7813 | else |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 7814 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7815 | } |
| 7816 | |
| 7817 | |
| 7818 | /* --------------------------------------------------------------------- */ |
| 7819 | /* Function : XGI_FirePWDDisable */ |
| 7820 | /* Input : */ |
| 7821 | /* Output : */ |
| 7822 | /* Description : Turn off VDD & Backlight : Fire disable procedure */ |
| 7823 | /* --------------------------------------------------------------------- */ |
| 7824 | /* |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7825 | void XGI_FirePWDDisable(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7826 | { |
| 7827 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x26 , 0x00 , 0xFC ) ; |
| 7828 | } |
| 7829 | */ |
| 7830 | |
| 7831 | /* --------------------------------------------------------------------- */ |
| 7832 | /* Function : XGI_FirePWDEnable */ |
| 7833 | /* Input : */ |
| 7834 | /* Output : */ |
| 7835 | /* Description : Turn on VDD & Backlight : Fire enable procedure */ |
| 7836 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7837 | void XGI_FirePWDEnable(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7838 | { |
| 7839 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x26 , 0x03 , 0xFC ) ; |
| 7840 | } |
| 7841 | |
| 7842 | |
| 7843 | /* --------------------------------------------------------------------- */ |
| 7844 | /* Function : XGI_EnableGatingCRT */ |
| 7845 | /* Input : */ |
| 7846 | /* Output : */ |
| 7847 | /* Description : */ |
| 7848 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7849 | void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7850 | { |
| 7851 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x63 , 0xBF , 0x40 ) ; |
| 7852 | } |
| 7853 | |
| 7854 | |
| 7855 | /* --------------------------------------------------------------------- */ |
| 7856 | /* Function : XGI_DisableGatingCRT */ |
| 7857 | /* Input : */ |
| 7858 | /* Output : */ |
| 7859 | /* Description : */ |
| 7860 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7861 | void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7862 | { |
| 7863 | |
| 7864 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x63 , 0xBF , 0x00 ) ; |
| 7865 | } |
| 7866 | |
| 7867 | |
| 7868 | /* --------------------------------------------------------------------- */ |
| 7869 | /* Function : XGI_SetPanelDelay */ |
| 7870 | /* Input : */ |
| 7871 | /* Output : */ |
| 7872 | /* Description : */ |
| 7873 | /* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */ |
| 7874 | /* : bl : 2 ; T2 : the duration signal on and Vdd on */ |
| 7875 | /* : bl : 3 ; T3 : the duration between CPL off and signal off */ |
| 7876 | /* : bl : 4 ; T4 : the duration signal off and Vdd off */ |
| 7877 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7878 | void XGI_SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7879 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 7880 | unsigned short index ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7881 | |
| 7882 | index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 7883 | |
| 7884 | if ( tempbl == 1 ) |
| 7885 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S1, pVBInfo ) ; |
| 7886 | |
| 7887 | if ( tempbl == 2 ) |
| 7888 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S2, pVBInfo ) ; |
| 7889 | |
| 7890 | if ( tempbl == 3 ) |
| 7891 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S3, pVBInfo ) ; |
| 7892 | |
| 7893 | if ( tempbl == 4 ) |
| 7894 | XGINew_LCD_Wait_Time( pVBInfo->LCDCapList[ index ].PSC_S4, pVBInfo ) ; |
| 7895 | } |
| 7896 | |
| 7897 | |
| 7898 | /* --------------------------------------------------------------------- */ |
| 7899 | /* Function : XGI_SetPanelPower */ |
| 7900 | /* Input : */ |
| 7901 | /* Output : */ |
| 7902 | /* Description : */ |
| 7903 | /* I/O : ah = 0011b = 03h ; Backlight on, Power on */ |
| 7904 | /* = 0111b = 07h ; Backlight on, Power off */ |
| 7905 | /* = 1011b = 0Bh ; Backlight off, Power on */ |
| 7906 | /* = 1111b = 0Fh ; Backlight off, Power off */ |
| 7907 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7908 | void XGI_SetPanelPower(unsigned short tempah, unsigned short tempbl, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7909 | { |
| 7910 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 7911 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x26 , tempbl , tempah ) ; |
| 7912 | else |
| 7913 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x11 , tempbl , tempah ) ; |
| 7914 | } |
| 7915 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 7916 | unsigned char XG21GPIODataTransfer(unsigned char ujDate) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7917 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 7918 | unsigned char ujRet = 0; |
| 7919 | unsigned char i = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7920 | |
| 7921 | for (i=0; i<8; i++) |
| 7922 | { |
| 7923 | ujRet = ujRet << 1; |
| 7924 | /* ujRet |= GETBITS(ujDate >> i, 0:0); */ |
| 7925 | ujRet |= (ujDate >> i) & 1; |
| 7926 | } |
| 7927 | |
| 7928 | return ujRet; |
| 7929 | } |
| 7930 | |
| 7931 | /*----------------------------------------------------------------------------*/ |
| 7932 | /* output */ |
| 7933 | /* bl[5] : LVDS signal */ |
| 7934 | /* bl[1] : LVDS backlight */ |
| 7935 | /* bl[0] : LVDS VDD */ |
| 7936 | /*----------------------------------------------------------------------------*/ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7937 | unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7938 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 7939 | unsigned char CR4A, temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7940 | |
| 7941 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; |
| 7942 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x23 ) ; /* enable GPIO write */ |
| 7943 | |
| 7944 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ; |
| 7945 | |
| 7946 | temp = XG21GPIODataTransfer(temp); |
| 7947 | temp &= 0x23; |
| 7948 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4A , CR4A ) ; |
| 7949 | return temp; |
| 7950 | } |
| 7951 | |
| 7952 | /*----------------------------------------------------------------------------*/ |
| 7953 | /* output */ |
| 7954 | /* bl[5] : LVDS signal */ |
| 7955 | /* bl[1] : LVDS backlight */ |
| 7956 | /* bl[0] : LVDS VDD */ |
| 7957 | /*----------------------------------------------------------------------------*/ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7958 | unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7959 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 7960 | unsigned char CR4A, CRB4, temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7961 | |
| 7962 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; |
| 7963 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~0x0C ) ; /* enable GPIO write */ |
| 7964 | |
| 7965 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ; |
| 7966 | |
| 7967 | temp &= 0x0C; |
| 7968 | temp >>= 2; |
| 7969 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4A , CR4A ) ; |
| 7970 | CRB4 = XGINew_GetReg1( pVBInfo->P3d4 , 0xB4 ) ; |
| 7971 | temp |= ((CRB4&0x04)<<3); |
| 7972 | return temp; |
| 7973 | } |
| 7974 | /*----------------------------------------------------------------------------*/ |
| 7975 | /* input */ |
| 7976 | /* bl[5] : 1;LVDS signal on */ |
| 7977 | /* bl[1] : 1;LVDS backlight on */ |
| 7978 | /* bl[0] : 1:LVDS VDD on */ |
| 7979 | /* bh: 100000b : clear bit 5, to set bit5 */ |
| 7980 | /* 000010b : clear bit 1, to set bit1 */ |
| 7981 | /* 000001b : clear bit 0, to set bit0 */ |
| 7982 | /*----------------------------------------------------------------------------*/ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 7983 | void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7984 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 7985 | unsigned char CR4A, temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7986 | |
| 7987 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; |
| 7988 | tempbh &= 0x23; |
| 7989 | tempbl &= 0x23; |
| 7990 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~tempbh ) ; /* enable GPIO write */ |
| 7991 | |
| 7992 | if (tempbh&0x20) |
| 7993 | { |
| 7994 | temp = (tempbl>>4)&0x02; |
| 7995 | |
| 7996 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~0x02 , temp) ; /* CR B4[1] */ |
| 7997 | |
| 7998 | } |
| 7999 | |
| 8000 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x48 ) ; |
| 8001 | |
| 8002 | temp = XG21GPIODataTransfer(temp); |
| 8003 | temp &= ~tempbh; |
| 8004 | temp |= tempbl; |
| 8005 | XGINew_SetReg1( pVBInfo->P3d4 , 0x48 , temp ) ; |
| 8006 | } |
| 8007 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8008 | void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8009 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8010 | unsigned char CR4A, temp; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8011 | unsigned short tempbh0, tempbl0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8012 | |
| 8013 | tempbh0 = tempbh; |
| 8014 | tempbl0 = tempbl; |
| 8015 | tempbh0 &= 0x20; |
| 8016 | tempbl0 &= 0x20; |
| 8017 | tempbh0 >>= 3; |
| 8018 | tempbl0 >>= 3; |
| 8019 | |
| 8020 | if (tempbh&0x20) |
| 8021 | { |
| 8022 | temp = (tempbl>>4)&0x02; |
| 8023 | |
| 8024 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~0x02 , temp) ; /* CR B4[1] */ |
| 8025 | |
| 8026 | } |
| 8027 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0xB4 , ~tempbh0 , tempbl0 ) ; |
| 8028 | |
| 8029 | CR4A = XGINew_GetReg1( pVBInfo->P3d4 , 0x4A ) ; |
| 8030 | tempbh &= 0x03; |
| 8031 | tempbl &= 0x03; |
| 8032 | tempbh <<= 2; |
| 8033 | tempbl <<= 2; /* GPIOC,GPIOD */ |
| 8034 | XGINew_SetRegAND( pVBInfo->P3d4 , 0x4A , ~tempbh ) ; /* enable GPIO write */ |
| 8035 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x48 , ~tempbh , tempbl ) ; |
| 8036 | } |
| 8037 | |
| 8038 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8039 | unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8040 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8041 | unsigned short index ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8042 | |
| 8043 | index = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8044 | if (index < sizeof(XGI21_LCDCapList)/sizeof(struct XGI21_LVDSCapStruct)) |
| 8045 | return index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8046 | return 0; |
| 8047 | } |
| 8048 | |
| 8049 | /* --------------------------------------------------------------------- */ |
| 8050 | /* Function : XGI_XG21SetPanelDelay */ |
| 8051 | /* Input : */ |
| 8052 | /* Output : */ |
| 8053 | /* Description : */ |
| 8054 | /* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */ |
| 8055 | /* : bl : 2 ; T2 : the duration signal on and Vdd on */ |
| 8056 | /* : bl : 3 ; T3 : the duration between CPL off and signal off */ |
| 8057 | /* : bl : 4 ; T4 : the duration signal off and Vdd off */ |
| 8058 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8059 | void XGI_XG21SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8060 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8061 | unsigned short index ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8062 | |
| 8063 | index = XGI_GetLVDSOEMTableIndex( pVBInfo ); |
| 8064 | if ( tempbl == 1 ) |
| 8065 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S1, pVBInfo ) ; |
| 8066 | |
| 8067 | if ( tempbl == 2 ) |
| 8068 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S2, pVBInfo ) ; |
| 8069 | |
| 8070 | if ( tempbl == 3 ) |
| 8071 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S3, pVBInfo ) ; |
| 8072 | |
| 8073 | if ( tempbl == 4 ) |
| 8074 | XGINew_LCD_Wait_Time( pVBInfo->XG21_LVDSCapList[ index ].PSC_S4, pVBInfo ) ; |
| 8075 | } |
| 8076 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8077 | unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, |
| 8078 | unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8079 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8080 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8081 | unsigned short xres , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8082 | yres , |
| 8083 | colordepth , |
| 8084 | modeflag , |
| 8085 | resindex , |
| 8086 | lvdstableindex; |
| 8087 | |
| 8088 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 8089 | if ( ModeNo <= 0x13 ) |
| 8090 | { |
| 8091 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 8092 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 8093 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 8094 | } |
| 8095 | else |
| 8096 | { |
| 8097 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 8098 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ |
| 8099 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ |
| 8100 | } |
| 8101 | |
| 8102 | if ( !( modeflag & Charx8Dot ) ) |
| 8103 | { |
| 8104 | xres /= 9; |
| 8105 | xres *= 8; |
| 8106 | } |
| 8107 | |
| 8108 | if ( ModeNo > 0x13 ) |
| 8109 | { |
| 8110 | if ( ( ModeNo>0x13 ) && ( modeflag & HalfDCLK ) ) |
| 8111 | { |
| 8112 | xres *= 2 ; |
| 8113 | } |
| 8114 | if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) ) |
| 8115 | { |
| 8116 | yres *= 2 ; |
| 8117 | } |
| 8118 | } |
| 8119 | |
| 8120 | lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo ); |
| 8121 | if ( xres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE) ) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8122 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8123 | |
| 8124 | if ( yres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE) ) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8125 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8126 | |
| 8127 | if ( ModeNo > 0x13 ) |
| 8128 | { |
| 8129 | if ( ( xres != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE) ) || |
| 8130 | ( yres != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE)) ) |
| 8131 | { |
| 8132 | colordepth = XGI_GetColorDepth( ModeNo , ModeIdIndex, pVBInfo ) ; |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8133 | if (colordepth > 2) |
| 8134 | return 0; |
| 8135 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8136 | } |
| 8137 | } |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8138 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8139 | } |
| 8140 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8141 | void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8142 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8143 | unsigned char temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8144 | |
| 8145 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; /* D[0] 1: 18bit */ |
| 8146 | temp = ( temp & 1 ) << 6; |
| 8147 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0x40 , temp ) ; /* SR06[6] 18bit Dither */ |
| 8148 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0xc0 , temp | 0x80 ) ; /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: dual 12bits */ |
| 8149 | |
| 8150 | } |
| 8151 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8152 | void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8153 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8154 | unsigned char temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8155 | |
| 8156 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; /* D[1:0] 01: 18bit, 00: dual 12, 10: single 24 */ |
| 8157 | temp = ( temp & 3 ) << 6; |
| 8158 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x06 , ~0xc0 , temp & 0x80 ) ; /* SR06[7]0: dual 12/1: single 24 [6] 18bit Dither <= 0 h/w recommend */ |
| 8159 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x09 , ~0xc0 , temp | 0x80 ) ; /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: 24bits */ |
| 8160 | |
| 8161 | } |
| 8162 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8163 | void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8164 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8165 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8166 | unsigned char temp, Miscdata; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8167 | unsigned short xres , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8168 | yres , |
| 8169 | modeflag , |
| 8170 | resindex , |
| 8171 | lvdstableindex ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8172 | unsigned short LVDSHT,LVDSHBS,LVDSHRS,LVDSHRE,LVDSHBE; |
| 8173 | unsigned short LVDSVT,LVDSVBS,LVDSVRS,LVDSVRE,LVDSVBE; |
| 8174 | unsigned short value; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8175 | |
| 8176 | lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo ); |
| 8177 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8178 | temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & (LCDPolarity << 8)) >> 8); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8179 | temp &= LCDPolarity; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8180 | Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8181 | |
| 8182 | XGINew_SetReg3( pVBInfo->P3c2 , (Miscdata & 0x3F) | temp ) ; |
| 8183 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8184 | temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & LCDPolarity) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8185 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x80 , temp&0x80 ) ; /* SR35[7] FP VSync polarity */ |
| 8186 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , ~0x20 , (temp&0x40)>>1 ) ; /* SR30[5] FP HSync polarity */ |
| 8187 | |
| 8188 | XGI_SetXG21FPBits(pVBInfo); |
| 8189 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 8190 | if ( ModeNo <= 0x13 ) |
| 8191 | { |
| 8192 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 8193 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 8194 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 8195 | } |
| 8196 | else |
| 8197 | { |
| 8198 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 8199 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ |
| 8200 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ |
| 8201 | } |
| 8202 | |
| 8203 | if (!( modeflag & Charx8Dot )) |
| 8204 | xres = xres * 8 / 9; |
| 8205 | |
| 8206 | LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT; |
| 8207 | |
| 8208 | LVDSHBS = xres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE - xres ) / 2 ; |
| 8209 | if ( ( ModeNo<=0x13 ) && ( modeflag & HalfDCLK ) ) |
| 8210 | { |
| 8211 | LVDSHBS -= xres/4 ; |
| 8212 | } |
| 8213 | if (LVDSHBS > LVDSHT) LVDSHBS -= LVDSHT ; |
| 8214 | |
| 8215 | LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP ; |
| 8216 | if (LVDSHRS > LVDSHT) LVDSHRS -= LVDSHT ; |
| 8217 | |
| 8218 | LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC ; |
| 8219 | if (LVDSHRE > LVDSHT) LVDSHRE -= LVDSHT ; |
| 8220 | |
| 8221 | LVDSHBE = LVDSHBS + LVDSHT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE ; |
| 8222 | |
| 8223 | LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT; |
| 8224 | |
| 8225 | LVDSVBS = yres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE - yres ) / 2 ; |
| 8226 | if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) ) |
| 8227 | { |
| 8228 | LVDSVBS += yres/2 ; |
| 8229 | } |
| 8230 | if (LVDSVBS > LVDSVT) LVDSVBS -= LVDSVT ; |
| 8231 | |
| 8232 | LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP ; |
| 8233 | if (LVDSVRS > LVDSVT) LVDSVRS -= LVDSVT ; |
| 8234 | |
| 8235 | LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC ; |
| 8236 | if (LVDSVRE > LVDSVT) LVDSVRE -= LVDSVT ; |
| 8237 | |
| 8238 | LVDSVBE = LVDSVBS + LVDSVT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE ; |
| 8239 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8240 | temp = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8241 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp & 0x7f ) ; /* Unlock CRTC */ |
| 8242 | |
| 8243 | if (!( modeflag & Charx8Dot )) |
| 8244 | { |
| 8245 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1 , 0x1 ) ; |
| 8246 | } |
| 8247 | |
| 8248 | /* HT SR0B[1:0] CR00 */ |
| 8249 | value = ( LVDSHT >> 3 ) - 5; |
| 8250 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x03 , ( value & 0x300 ) >> 8 ) ; |
| 8251 | XGINew_SetReg1( pVBInfo->P3d4 , 0x0 , (value & 0xFF) ) ; |
| 8252 | |
| 8253 | /* HBS SR0B[5:4] CR02 */ |
| 8254 | value = ( LVDSHBS >> 3 ) - 1; |
| 8255 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x30 , ( value & 0x300 ) >> 4 ) ; |
| 8256 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2 , (value & 0xFF) ) ; |
| 8257 | |
| 8258 | /* HBE SR0C[1:0] CR05[7] CR03[4:0] */ |
| 8259 | value = ( LVDSHBE >> 3 ) - 1; |
| 8260 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x03 , ( value & 0xC0 ) >> 6 ) ; |
| 8261 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x80 , ( value & 0x20 ) << 2 ) ; |
| 8262 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x03 , ~0x1F , value & 0x1F ) ; |
| 8263 | |
| 8264 | /* HRS SR0B[7:6] CR04 */ |
| 8265 | value = ( LVDSHRS >> 3 ) + 2; |
| 8266 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0xC0 , ( value & 0x300 ) >> 2 ) ; |
| 8267 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4 , (value & 0xFF) ) ; |
| 8268 | |
| 8269 | /* Panel HRS SR2F[1:0] SR2E[7:0] */ |
| 8270 | value--; |
| 8271 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0x03 , ( value & 0x300 ) >> 8 ) ; |
| 8272 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , (value & 0xFF) ) ; |
| 8273 | |
| 8274 | /* HRE SR0C[2] CR05[4:0] */ |
| 8275 | value = ( LVDSHRE >> 3 ) + 2; |
| 8276 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x04 , ( value & 0x20 ) >> 3 ) ; |
| 8277 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x1F , value & 0x1F ) ; |
| 8278 | |
| 8279 | /* Panel HRE SR2F[7:2] */ |
| 8280 | value--; |
| 8281 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0xFC , value << 2 ) ; |
| 8282 | |
| 8283 | /* VT SR0A[0] CR07[5][0] CR06 */ |
| 8284 | value = LVDSVT - 2 ; |
| 8285 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x01 , ( value & 0x400 ) >> 10 ) ; |
| 8286 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x20 , ( value & 0x200 ) >> 4 ) ; |
| 8287 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x01 , ( value & 0x100 ) >> 8 ) ; |
| 8288 | XGINew_SetReg1( pVBInfo->P3d4 , 0x06 , (value & 0xFF) ) ; |
| 8289 | |
| 8290 | /* VBS SR0A[2] CR09[5] CR07[3] CR15 */ |
| 8291 | value = LVDSVBS - 1 ; |
| 8292 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x04 , ( value & 0x400 ) >> 8 ) ; |
| 8293 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x09 , ~0x20 , ( value & 0x200 ) >> 4 ) ; |
| 8294 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x08 , ( value & 0x100 ) >> 5 ) ; |
| 8295 | XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , (value & 0xFF) ) ; |
| 8296 | |
| 8297 | /* VBE SR0A[4] CR16 */ |
| 8298 | value = LVDSVBE - 1; |
| 8299 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x10 , ( value & 0x100 ) >> 4 ) ; |
| 8300 | XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , (value & 0xFF) ) ; |
| 8301 | |
| 8302 | /* VRS SR0A[3] CR7[7][2] CR10 */ |
| 8303 | value = LVDSVRS - 1 ; |
| 8304 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x08 , ( value & 0x400 ) >> 7 ) ; |
| 8305 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x80 , ( value & 0x200 ) >> 2 ) ; |
| 8306 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x04 , ( value & 0x100 ) >> 6 ) ; |
| 8307 | XGINew_SetReg1( pVBInfo->P3d4 , 0x10 , (value & 0xFF) ) ; |
| 8308 | |
| 8309 | /* Panel VRS SR3F[1:0] SR34[7:0] SR33[0] */ |
| 8310 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0x03 , ( value & 0x600 ) >> 9 ) ; |
| 8311 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , (value >> 1) & 0xFF ) ; |
| 8312 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x33 , ~0x01 , value & 0x01 ) ; |
| 8313 | |
| 8314 | /* VRE SR0A[5] CR11[3:0] */ |
| 8315 | value = LVDSVRE - 1; |
| 8316 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x20 , ( value & 0x10 ) << 1 ) ; |
| 8317 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , ~0x0F , value & 0x0F ) ; |
| 8318 | |
| 8319 | /* Panel VRE SR3F[7:2] */ /* SR3F[7] has to be 0, h/w bug */ |
| 8320 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , ( value << 2 ) & 0x7C ) ; |
| 8321 | |
| 8322 | for ( temp=0, value = 0; temp < 3; temp++) |
| 8323 | { |
| 8324 | |
| 8325 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , value ) ; |
| 8326 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1) ; |
| 8327 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2) ; |
| 8328 | value += 0x10; |
| 8329 | } |
| 8330 | |
| 8331 | if (!( modeflag & Charx8Dot )) |
| 8332 | { |
| 8333 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 8334 | XGINew_SetReg3( pVBInfo->P3c0 , 0x13 ) ; /* set index */ |
| 8335 | XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data, panning = 0, shift left 1 dot*/ |
| 8336 | |
| 8337 | XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */ |
| 8338 | XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ; |
| 8339 | |
| 8340 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 8341 | } |
| 8342 | |
| 8343 | |
| 8344 | } |
| 8345 | |
| 8346 | /* no shadow case */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8347 | void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8348 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8349 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8350 | unsigned char temp, Miscdata; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8351 | unsigned short xres , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8352 | yres , |
| 8353 | modeflag , |
| 8354 | resindex , |
| 8355 | lvdstableindex ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8356 | unsigned short LVDSHT,LVDSHBS,LVDSHRS,LVDSHRE,LVDSHBE; |
| 8357 | unsigned short LVDSVT,LVDSVBS,LVDSVRS,LVDSVRE,LVDSVBE; |
| 8358 | unsigned short value; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8359 | |
| 8360 | lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo ); |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8361 | temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & (LCDPolarity << 8)) >> 8); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8362 | temp &= LCDPolarity; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8363 | Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8364 | |
| 8365 | XGINew_SetReg3( pVBInfo->P3c2 , (Miscdata & 0x3F) | temp ) ; |
| 8366 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8367 | temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability & LCDPolarity) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8368 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x80 , temp&0x80 ) ; /* SR35[7] FP VSync polarity */ |
| 8369 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x30 , ~0x20 , (temp&0x40)>>1 ) ; /* SR30[5] FP HSync polarity */ |
| 8370 | |
| 8371 | XGI_SetXG27FPBits(pVBInfo); |
| 8372 | resindex = XGI_GetResInfo( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 8373 | if ( ModeNo <= 0x13 ) |
| 8374 | { |
| 8375 | xres = pVBInfo->StResInfo[ resindex ].HTotal ; |
| 8376 | yres = pVBInfo->StResInfo[ resindex ].VTotal ; |
| 8377 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 8378 | } |
| 8379 | else |
| 8380 | { |
| 8381 | xres = pVBInfo->ModeResInfo[ resindex ].HTotal ; /* xres->ax */ |
| 8382 | yres = pVBInfo->ModeResInfo[ resindex ].VTotal ; /* yres->bx */ |
| 8383 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex].Ext_ModeFlag ; /* si+St_ModeFlag */ |
| 8384 | } |
| 8385 | |
| 8386 | if (!( modeflag & Charx8Dot )) |
| 8387 | xres = xres * 8 / 9; |
| 8388 | |
| 8389 | LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT; |
| 8390 | |
| 8391 | LVDSHBS = xres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE - xres ) / 2 ; |
| 8392 | if ( ( ModeNo<=0x13 ) && ( modeflag & HalfDCLK ) ) |
| 8393 | { |
| 8394 | LVDSHBS -= xres/4 ; |
| 8395 | } |
| 8396 | if (LVDSHBS > LVDSHT) LVDSHBS -= LVDSHT ; |
| 8397 | |
| 8398 | LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP ; |
| 8399 | if (LVDSHRS > LVDSHT) LVDSHRS -= LVDSHT ; |
| 8400 | |
| 8401 | LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC ; |
| 8402 | if (LVDSHRE > LVDSHT) LVDSHRE -= LVDSHT ; |
| 8403 | |
| 8404 | LVDSHBE = LVDSHBS + LVDSHT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE ; |
| 8405 | |
| 8406 | LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT; |
| 8407 | |
| 8408 | LVDSVBS = yres + ( pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE - yres ) / 2 ; |
| 8409 | if ( ( ModeNo>0x13 ) && ( modeflag & DoubleScanMode ) ) |
| 8410 | { |
| 8411 | LVDSVBS += yres/2 ; |
| 8412 | } |
| 8413 | if (LVDSVBS > LVDSVT) LVDSVBS -= LVDSVT ; |
| 8414 | |
| 8415 | LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP ; |
| 8416 | if (LVDSVRS > LVDSVT) LVDSVRS -= LVDSVT ; |
| 8417 | |
| 8418 | LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC ; |
| 8419 | if (LVDSVRE > LVDSVT) LVDSVRE -= LVDSVT ; |
| 8420 | |
| 8421 | LVDSVBE = LVDSVBS + LVDSVT - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE ; |
| 8422 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8423 | temp = (unsigned char)XGINew_GetReg1(pVBInfo->P3d4, 0x11) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8424 | XGINew_SetReg1( pVBInfo->P3d4 , 0x11 , temp & 0x7f ) ; /* Unlock CRTC */ |
| 8425 | |
| 8426 | if (!( modeflag & Charx8Dot )) |
| 8427 | { |
| 8428 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1 , 0x1 ) ; |
| 8429 | } |
| 8430 | |
| 8431 | /* HT SR0B[1:0] CR00 */ |
| 8432 | value = ( LVDSHT >> 3 ) - 5; |
| 8433 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x03 , ( value & 0x300 ) >> 8 ) ; |
| 8434 | XGINew_SetReg1( pVBInfo->P3d4 , 0x0 , (value & 0xFF) ) ; |
| 8435 | |
| 8436 | /* HBS SR0B[5:4] CR02 */ |
| 8437 | value = ( LVDSHBS >> 3 ) - 1; |
| 8438 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0x30 , ( value & 0x300 ) >> 4 ) ; |
| 8439 | XGINew_SetReg1( pVBInfo->P3d4 , 0x2 , (value & 0xFF) ) ; |
| 8440 | |
| 8441 | /* HBE SR0C[1:0] CR05[7] CR03[4:0] */ |
| 8442 | value = ( LVDSHBE >> 3 ) - 1; |
| 8443 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x03 , ( value & 0xC0 ) >> 6 ) ; |
| 8444 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x80 , ( value & 0x20 ) << 2 ) ; |
| 8445 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x03 , ~0x1F , value & 0x1F ) ; |
| 8446 | |
| 8447 | /* HRS SR0B[7:6] CR04 */ |
| 8448 | value = ( LVDSHRS >> 3 ) + 2; |
| 8449 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0B , ~0xC0 , ( value & 0x300 ) >> 2 ) ; |
| 8450 | XGINew_SetReg1( pVBInfo->P3d4 , 0x4 , (value & 0xFF) ) ; |
| 8451 | |
| 8452 | /* Panel HRS SR2F[1:0] SR2E[7:0] */ |
| 8453 | value--; |
| 8454 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0x03 , ( value & 0x300 ) >> 8 ) ; |
| 8455 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2E , (value & 0xFF) ) ; |
| 8456 | |
| 8457 | /* HRE SR0C[2] CR05[4:0] */ |
| 8458 | value = ( LVDSHRE >> 3 ) + 2; |
| 8459 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0C , ~0x04 , ( value & 0x20 ) >> 3 ) ; |
| 8460 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x05 , ~0x1F , value & 0x1F ) ; |
| 8461 | |
| 8462 | /* Panel HRE SR2F[7:2] */ |
| 8463 | value--; |
| 8464 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x2F , ~0xFC , value << 2 ) ; |
| 8465 | |
| 8466 | /* VT SR0A[0] CR07[5][0] CR06 */ |
| 8467 | value = LVDSVT - 2 ; |
| 8468 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x01 , ( value & 0x400 ) >> 10 ) ; |
| 8469 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x20 , ( value & 0x200 ) >> 4 ) ; |
| 8470 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x01 , ( value & 0x100 ) >> 8 ) ; |
| 8471 | XGINew_SetReg1( pVBInfo->P3d4 , 0x06 , (value & 0xFF) ) ; |
| 8472 | |
| 8473 | /* VBS SR0A[2] CR09[5] CR07[3] CR15 */ |
| 8474 | value = LVDSVBS - 1 ; |
| 8475 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x04 , ( value & 0x400 ) >> 8 ) ; |
| 8476 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x09 , ~0x20 , ( value & 0x200 ) >> 4 ) ; |
| 8477 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x08 , ( value & 0x100 ) >> 5 ) ; |
| 8478 | XGINew_SetReg1( pVBInfo->P3d4 , 0x15 , (value & 0xFF) ) ; |
| 8479 | |
| 8480 | /* VBE SR0A[4] CR16 */ |
| 8481 | value = LVDSVBE - 1; |
| 8482 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x10 , ( value & 0x100 ) >> 4 ) ; |
| 8483 | XGINew_SetReg1( pVBInfo->P3d4 , 0x16 , (value & 0xFF) ) ; |
| 8484 | |
| 8485 | /* VRS SR0A[3] CR7[7][2] CR10 */ |
| 8486 | value = LVDSVRS - 1 ; |
| 8487 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x08 , ( value & 0x400 ) >> 7 ) ; |
| 8488 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x80 , ( value & 0x200 ) >> 2 ) ; |
| 8489 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x07 , ~0x04 , ( value & 0x100 ) >> 6 ) ; |
| 8490 | XGINew_SetReg1( pVBInfo->P3d4 , 0x10 , (value & 0xFF) ) ; |
| 8491 | |
| 8492 | /* Panel VRS SR35[2:0] SR34[7:0] */ |
| 8493 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x35 , ~0x07 , ( value & 0x700 ) >> 8 ) ; |
| 8494 | XGINew_SetReg1( pVBInfo->P3c4 , 0x34 , value & 0xFF ) ; |
| 8495 | |
| 8496 | /* VRE SR0A[5] CR11[3:0] */ |
| 8497 | value = LVDSVRE - 1; |
| 8498 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x0A , ~0x20 , ( value & 0x10 ) << 1 ) ; |
| 8499 | XGINew_SetRegANDOR( pVBInfo->P3d4 , 0x11 , ~0x0F , value & 0x0F ) ; |
| 8500 | |
| 8501 | /* Panel VRE SR3F[7:2] */ |
| 8502 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x3F , ~0xFC , ( value << 2 ) & 0xFC ) ; |
| 8503 | |
| 8504 | for ( temp=0, value = 0; temp < 3; temp++) |
| 8505 | { |
| 8506 | |
| 8507 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x31 , ~0x30 , value ) ; |
| 8508 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2B , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1) ; |
| 8509 | XGINew_SetReg1( pVBInfo->P3c4 , 0x2C , pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2) ; |
| 8510 | value += 0x10; |
| 8511 | } |
| 8512 | |
| 8513 | if (!( modeflag & Charx8Dot )) |
| 8514 | { |
| 8515 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 8516 | XGINew_SetReg3( pVBInfo->P3c0 , 0x13 ) ; /* set index */ |
| 8517 | XGINew_SetReg3( pVBInfo->P3c0 , 0x00 ) ; /* set data, panning = 0, shift left 1 dot*/ |
| 8518 | |
| 8519 | XGINew_GetReg2( pVBInfo->P3da ) ; /* Enable Attribute */ |
| 8520 | XGINew_SetReg3( pVBInfo->P3c0 , 0x20 ) ; |
| 8521 | |
| 8522 | XGINew_GetReg2( pVBInfo->P3da ) ; /* reset 3da */ |
| 8523 | } |
| 8524 | |
| 8525 | |
| 8526 | } |
| 8527 | |
| 8528 | /* --------------------------------------------------------------------- */ |
| 8529 | /* Function : XGI_IsLCDON */ |
| 8530 | /* Input : */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8531 | /* Output : 0 : Skip PSC Control */ |
| 8532 | /* 1: Disable PSC */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8533 | /* Description : */ |
| 8534 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8535 | unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8536 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8537 | unsigned short tempax ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8538 | |
| 8539 | tempax = pVBInfo->VBInfo ; |
| 8540 | if ( tempax & SetCRT2ToDualEdge ) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8541 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8542 | else if ( tempax & ( DisableCRT2Display | SwitchToCRT2 | SetSimuScanMode ) ) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8543 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8544 | |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8545 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8546 | } |
| 8547 | |
| 8548 | |
| 8549 | /* --------------------------------------------------------------------- */ |
| 8550 | /* Function : XGI_EnablePWD */ |
| 8551 | /* Input : */ |
| 8552 | /* Output : */ |
| 8553 | /* Description : */ |
| 8554 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8555 | void XGI_EnablePWD(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8556 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8557 | unsigned short index , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8558 | temp ; |
| 8559 | |
| 8560 | index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 8561 | temp = pVBInfo->LCDCapList[ index ].PWD_2B ; |
| 8562 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2B , temp ) ; |
| 8563 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2C , pVBInfo->LCDCapList[ index ].PWD_2C ) ; |
| 8564 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2D , pVBInfo->LCDCapList[ index ].PWD_2D ) ; |
| 8565 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2E , pVBInfo->LCDCapList[ index ].PWD_2E ) ; |
| 8566 | XGINew_SetReg1( pVBInfo->Part4Port , 0x2F , pVBInfo->LCDCapList[ index ].PWD_2F ) ; |
| 8567 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x27 , 0x80 ) ; /* enable PWD */ |
| 8568 | } |
| 8569 | |
| 8570 | |
| 8571 | /* --------------------------------------------------------------------- */ |
| 8572 | /* Function : XGI_DisablePWD */ |
| 8573 | /* Input : */ |
| 8574 | /* Output : */ |
| 8575 | /* Description : */ |
| 8576 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8577 | void XGI_DisablePWD(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8578 | { |
| 8579 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x27 , 0x7F ) ; /* disable PWD */ |
| 8580 | } |
| 8581 | |
| 8582 | |
| 8583 | /* --------------------------------------------------------------------- */ |
| 8584 | /* Function : XGI_DisableChISLCD */ |
| 8585 | /* Input : */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8586 | /* Output : 0 -> Not LCD Mode */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8587 | /* Description : */ |
| 8588 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8589 | unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8590 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8591 | unsigned short tempbx , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8592 | tempah ; |
| 8593 | |
| 8594 | tempbx = pVBInfo->SetFlag & ( DisableChA | DisableChB ) ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8595 | tempah = ~((unsigned short) XGINew_GetReg1(pVBInfo->Part1Port, 0x2E)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8596 | |
| 8597 | if ( tempbx & ( EnableChA | DisableChA ) ) |
| 8598 | { |
| 8599 | if ( !( tempah & 0x08 ) ) /* Chk LCDA Mode */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8600 | return 0 ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8601 | } |
| 8602 | |
| 8603 | if ( !( tempbx & ( EnableChB | DisableChB ) ) ) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8604 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8605 | |
| 8606 | if ( tempah & 0x01 ) /* Chk LCDB Mode */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8607 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8608 | |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8609 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8610 | } |
| 8611 | |
| 8612 | |
| 8613 | /* --------------------------------------------------------------------- */ |
| 8614 | /* Function : XGI_EnableChISLCD */ |
| 8615 | /* Input : */ |
| 8616 | /* Output : 0 -> Not LCD mode */ |
| 8617 | /* Description : */ |
| 8618 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8619 | unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8620 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8621 | unsigned short tempbx , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8622 | tempah ; |
| 8623 | |
| 8624 | |
| 8625 | tempbx = pVBInfo->SetFlag & ( EnableChA | EnableChB ) ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8626 | tempah = ~( (unsigned short)XGINew_GetReg1( pVBInfo->Part1Port , 0x2E ) ) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8627 | |
| 8628 | if ( tempbx & ( EnableChA | DisableChA ) ) |
| 8629 | { |
| 8630 | if ( !( tempah & 0x08 ) ) /* Chk LCDA Mode */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8631 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8632 | } |
| 8633 | |
| 8634 | if ( !( tempbx & ( EnableChB | DisableChB ) ) ) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8635 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8636 | |
| 8637 | if ( tempah & 0x01 ) /* Chk LCDB Mode */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8638 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8639 | |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 8640 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8641 | } |
| 8642 | |
| 8643 | |
| 8644 | /* --------------------------------------------------------------------- */ |
| 8645 | /* Function : XGI_GetLCDCapPtr */ |
| 8646 | /* Input : */ |
| 8647 | /* Output : */ |
| 8648 | /* Description : */ |
| 8649 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8650 | unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8651 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8652 | unsigned char tempal , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8653 | tempah , |
| 8654 | tempbl , |
| 8655 | i ; |
| 8656 | |
| 8657 | tempah = XGINew_GetReg1( pVBInfo->P3d4 , 0x36 ) ; |
| 8658 | tempal = tempah & 0x0F ; |
| 8659 | tempah = tempah & 0xF0 ; |
| 8660 | i = 0 ; |
| 8661 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ; |
| 8662 | |
| 8663 | while( tempbl != 0xFF ) |
| 8664 | { |
| 8665 | if ( tempbl & 0x80 ) /* OEMUtil */ |
| 8666 | { |
| 8667 | tempal = tempah ; |
| 8668 | tempbl = tempbl & ~( 0x80 ) ; |
| 8669 | } |
| 8670 | |
| 8671 | if ( tempal == tempbl ) |
| 8672 | break ; |
| 8673 | |
| 8674 | i++ ; |
| 8675 | |
| 8676 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ; |
| 8677 | } |
| 8678 | |
| 8679 | return i ; |
| 8680 | } |
| 8681 | |
| 8682 | |
| 8683 | /* --------------------------------------------------------------------- */ |
| 8684 | /* Function : XGI_GetLCDCapPtr1 */ |
| 8685 | /* Input : */ |
| 8686 | /* Output : */ |
| 8687 | /* Description : */ |
| 8688 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8689 | unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8690 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8691 | unsigned short tempah , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8692 | tempal , |
| 8693 | tempbl , |
| 8694 | i ; |
| 8695 | |
| 8696 | tempal = pVBInfo->LCDResInfo ; |
| 8697 | tempah = pVBInfo->LCDTypeInfo ; |
| 8698 | |
| 8699 | i = 0 ; |
| 8700 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID; |
| 8701 | |
| 8702 | while( tempbl != 0xFF ) |
| 8703 | { |
| 8704 | if ( ( tempbl & 0x80 ) && ( tempbl != 0x80 ) ) |
| 8705 | { |
| 8706 | tempal = tempah ; |
| 8707 | tempbl &= ~0x80 ; |
| 8708 | } |
| 8709 | |
| 8710 | if ( tempal == tempbl ) |
| 8711 | break ; |
| 8712 | |
| 8713 | i++ ; |
| 8714 | tempbl = pVBInfo->LCDCapList[ i ].LCD_ID ; |
| 8715 | } |
| 8716 | |
| 8717 | if ( tempbl == 0xFF ) |
| 8718 | { |
| 8719 | pVBInfo->LCDResInfo = Panel1024x768 ; |
| 8720 | pVBInfo->LCDTypeInfo = 0 ; |
| 8721 | i = 0 ; |
| 8722 | } |
| 8723 | |
| 8724 | return i ; |
| 8725 | } |
| 8726 | |
| 8727 | |
| 8728 | /* --------------------------------------------------------------------- */ |
| 8729 | /* Function : XGI_GetLCDSync */ |
| 8730 | /* Input : */ |
| 8731 | /* Output : */ |
| 8732 | /* Description : */ |
| 8733 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8734 | void XGI_GetLCDSync(unsigned short *HSyncWidth , unsigned short *VSyncWidth, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8735 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8736 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8737 | unsigned short Index ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8738 | |
| 8739 | Index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 8740 | *HSyncWidth = pVBInfo->LCDCapList[ Index ].LCD_HSyncWidth ; |
| 8741 | *VSyncWidth = pVBInfo->LCDCapList[ Index ].LCD_VSyncWidth ; |
| 8742 | |
| 8743 | return ; |
| 8744 | } |
| 8745 | |
| 8746 | |
| 8747 | |
| 8748 | /* --------------------------------------------------------------------- */ |
| 8749 | /* Function : XGI_EnableBridge */ |
| 8750 | /* Input : */ |
| 8751 | /* Output : */ |
| 8752 | /* Description : */ |
| 8753 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8754 | void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8755 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8756 | unsigned short tempbl , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8757 | tempah ; |
| 8758 | |
| 8759 | if ( pVBInfo->SetFlag == Win9xDOSMode ) |
| 8760 | { |
| 8761 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 8762 | { |
| 8763 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; |
| 8764 | return ; |
| 8765 | } |
| 8766 | else /* LVDS or CH7017 */ |
| 8767 | return ; |
| 8768 | } |
| 8769 | |
| 8770 | |
| 8771 | if ( HwDeviceExtension->jChipType < XG40 ) |
| 8772 | { |
| 8773 | if ( !XGI_DisableChISLCD(pVBInfo) ) |
| 8774 | { |
| 8775 | if ( ( XGI_EnableChISLCD(pVBInfo) ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) |
| 8776 | { |
| 8777 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 8778 | { |
| 8779 | XGI_EnablePWD( pVBInfo); |
| 8780 | } |
| 8781 | else |
| 8782 | { |
| 8783 | pVBInfo->LCDInfo &= ( ~SetPWDEnable ) ; |
| 8784 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 8785 | { |
| 8786 | tempbl = 0xFD ; |
| 8787 | tempah = 0x02 ; |
| 8788 | } |
| 8789 | else |
| 8790 | { |
| 8791 | tempbl = 0xFB ; |
| 8792 | tempah = 0x00 ; |
| 8793 | } |
| 8794 | |
| 8795 | XGI_SetPanelPower( tempah , tempbl, pVBInfo ) ; |
| 8796 | XGI_SetPanelDelay( 1,pVBInfo ) ; |
| 8797 | } |
| 8798 | } |
| 8799 | } |
| 8800 | } /* Not 340 */ |
| 8801 | |
| 8802 | |
| 8803 | |
| 8804 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 8805 | { |
| 8806 | if ( !( pVBInfo->SetFlag & DisableChA ) ) |
| 8807 | { |
| 8808 | if ( pVBInfo->SetFlag & EnableChA ) |
| 8809 | { |
| 8810 | XGINew_SetReg1( pVBInfo->Part1Port , 0x1E , 0x20 ) ; /* Power on */ |
| 8811 | } |
| 8812 | else |
| 8813 | { |
| 8814 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) /* SetCRT2ToLCDA ) */ |
| 8815 | { |
| 8816 | XGINew_SetReg1(pVBInfo->Part1Port,0x1E,0x20); /* Power on */ |
| 8817 | } |
| 8818 | } |
| 8819 | } |
| 8820 | |
| 8821 | if ( !( pVBInfo->SetFlag & DisableChB ) ) |
| 8822 | { |
| 8823 | if ( ( pVBInfo->SetFlag & EnableChB ) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV | SetCRT2ToRAMDAC ) ) ) |
| 8824 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8825 | tempah = (unsigned char)XGINew_GetReg1(pVBInfo->P3c4, 0x32); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8826 | tempah &= 0xDF; |
| 8827 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 8828 | { |
| 8829 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) |
| 8830 | tempah |= 0x20 ; |
| 8831 | } |
| 8832 | XGINew_SetReg1( pVBInfo->P3c4 , 0x32 , tempah ) ; |
| 8833 | XGINew_SetRegOR( pVBInfo->P3c4 , 0x1E , 0x20 ) ; |
| 8834 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8835 | tempah = (unsigned char)XGINew_GetReg1(pVBInfo->Part1Port, 0x2E); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8836 | |
| 8837 | if ( !( tempah & 0x80 ) ) |
| 8838 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x2E , 0x80 ) ; /* BVBDOENABLE = 1 */ |
| 8839 | |
| 8840 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x00 , 0x7F ) ; /* BScreenOFF = 0 */ |
| 8841 | } |
| 8842 | } |
| 8843 | |
| 8844 | if ( ( pVBInfo->SetFlag & ( EnableChA | EnableChB ) ) || ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) ) |
| 8845 | { |
| 8846 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x00 , ~0xE0 , 0x20 ) ; /* shampoo 0129 */ |
| 8847 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 8848 | { |
| 8849 | if ( !XGI_DisableChISLCD(pVBInfo) ) |
| 8850 | { |
| 8851 | if ( XGI_EnableChISLCD( pVBInfo) || ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) |
| 8852 | XGINew_SetRegAND( pVBInfo->Part4Port ,0x2A , 0x7F ) ; /* LVDS PLL power on */ |
| 8853 | } |
| 8854 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x30 , 0x7F ) ; /* LVDS Driver power on */ |
| 8855 | } |
| 8856 | } |
| 8857 | |
| 8858 | tempah = 0x00 ; |
| 8859 | |
| 8860 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 8861 | { |
| 8862 | tempah = 0xc0 ; |
| 8863 | |
| 8864 | if ( !( pVBInfo->VBInfo & SetSimuScanMode ) ) |
| 8865 | { |
| 8866 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 8867 | { |
| 8868 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 8869 | { |
| 8870 | tempah = tempah & 0x40; |
| 8871 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 8872 | tempah = tempah ^ 0xC0 ; |
| 8873 | |
| 8874 | if ( pVBInfo->SetFlag & DisableChB ) |
| 8875 | tempah &= 0xBF ; |
| 8876 | |
| 8877 | if ( pVBInfo->SetFlag & DisableChA ) |
| 8878 | tempah &= 0x7F ; |
| 8879 | |
| 8880 | if ( pVBInfo->SetFlag & EnableChB ) |
| 8881 | tempah |= 0x40 ; |
| 8882 | |
| 8883 | if ( pVBInfo->SetFlag & EnableChA ) |
| 8884 | tempah |= 0x80 ; |
| 8885 | } |
| 8886 | } |
| 8887 | } |
| 8888 | } |
| 8889 | |
| 8890 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x1F , tempah ) ; /* EnablePart4_1F */ |
| 8891 | |
| 8892 | if ( pVBInfo->SetFlag & Win9xDOSMode ) |
| 8893 | { |
| 8894 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; |
| 8895 | return ; |
| 8896 | } |
| 8897 | |
| 8898 | if ( !( pVBInfo->SetFlag & DisableChA ) ) |
| 8899 | { |
| 8900 | XGI_VBLongWait( pVBInfo) ; |
| 8901 | if ( !( pVBInfo->SetFlag & GatingCRT ) ) |
| 8902 | { |
| 8903 | XGI_DisableGatingCRT( HwDeviceExtension, pVBInfo ) ; |
| 8904 | XGI_DisplayOn( HwDeviceExtension, pVBInfo) ; |
| 8905 | XGI_VBLongWait( pVBInfo) ; |
| 8906 | } |
| 8907 | } |
| 8908 | } /* 301 */ |
| 8909 | else /* LVDS */ |
| 8910 | { |
| 8911 | if ( pVBInfo->VBInfo & ( SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 8912 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x1E , 0x20 ) ; /* enable CRT2 */ |
| 8913 | |
| 8914 | |
| 8915 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8916 | tempah = (unsigned char)XGINew_GetReg1(pVBInfo->Part1Port, 0x2E); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8917 | if ( !( tempah & 0x80 ) ) |
| 8918 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x2E , 0x80 ) ; /* BVBDOENABLE = 1 */ |
| 8919 | |
| 8920 | XGINew_SetRegAND(pVBInfo->Part1Port,0x00,0x7F); |
| 8921 | XGI_DisplayOn( HwDeviceExtension, pVBInfo); |
| 8922 | } /* End of VB */ |
| 8923 | |
| 8924 | |
| 8925 | if ( HwDeviceExtension->jChipType < XG40 ) |
| 8926 | { |
| 8927 | if ( !XGI_EnableChISLCD(pVBInfo) ) |
| 8928 | { |
| 8929 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 8930 | { |
| 8931 | if ( XGI_BacklightByDrv(pVBInfo) ) |
| 8932 | return ; |
| 8933 | } |
| 8934 | else |
| 8935 | return ; |
| 8936 | } |
| 8937 | |
| 8938 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 8939 | { |
| 8940 | XGI_FirePWDEnable(pVBInfo) ; |
| 8941 | return ; |
| 8942 | } |
| 8943 | |
| 8944 | XGI_SetPanelDelay( 2,pVBInfo ) ; |
| 8945 | |
| 8946 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 8947 | { |
| 8948 | tempah = 0x01 ; |
| 8949 | tempbl = 0xFE ; /* turn on backlght */ |
| 8950 | } |
| 8951 | else |
| 8952 | { |
| 8953 | tempbl = 0xF7 ; |
| 8954 | tempah = 0x00 ; |
| 8955 | } |
| 8956 | XGI_SetPanelPower( tempah , tempbl , pVBInfo) ; |
| 8957 | } |
| 8958 | } |
| 8959 | |
| 8960 | |
| 8961 | /* --------------------------------------------------------------------- */ |
| 8962 | /* Function : XGI_DisableBridge */ |
| 8963 | /* Input : */ |
| 8964 | /* Output : */ |
| 8965 | /* Description : */ |
| 8966 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 8967 | void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8968 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8969 | unsigned short tempax , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8970 | tempbx , |
| 8971 | tempah = 0 , |
| 8972 | tempbl = 0 ; |
| 8973 | |
| 8974 | if ( pVBInfo->SetFlag == Win9xDOSMode ) |
| 8975 | return ; |
| 8976 | |
| 8977 | |
| 8978 | if ( HwDeviceExtension->jChipType < XG40 ) |
| 8979 | { |
| 8980 | if ( ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) || ( XGI_DisableChISLCD(pVBInfo) ) ) |
| 8981 | { |
| 8982 | if ( !XGI_IsLCDON(pVBInfo) ) |
| 8983 | { |
| 8984 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 8985 | XGI_EnablePWD( pVBInfo) ; |
| 8986 | else |
| 8987 | { |
| 8988 | pVBInfo->LCDInfo &= ~SetPWDEnable ; |
| 8989 | XGI_DisablePWD(pVBInfo) ; |
| 8990 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 8991 | { |
| 8992 | tempbx = 0xFE ; /* not 01h */ |
| 8993 | tempax = 0 ; |
| 8994 | } |
| 8995 | else |
| 8996 | { |
| 8997 | tempbx = 0xF7 ; /* not 08h */ |
| 8998 | tempax = 0x08 ; |
| 8999 | } |
| 9000 | XGI_SetPanelPower( tempax , tempbx , pVBInfo) ; |
| 9001 | XGI_SetPanelDelay( 3,pVBInfo ) ; |
| 9002 | } |
| 9003 | } /* end if(!XGI_IsLCDON(pVBInfo)) */ |
| 9004 | } |
| 9005 | } |
| 9006 | |
| 9007 | /* if ( CH7017 ) |
| 9008 | { |
| 9009 | if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2toLCDA ) ) || ( XGI_DisableChISLCD(pVBInfo) ) ) |
| 9010 | { |
| 9011 | if ( !XGI_IsLCDON(pVBInfo) ) |
| 9012 | { |
| 9013 | if ( DISCHARGE ) |
| 9014 | { |
| 9015 | tempbx = XGINew_GetCH7005( 0x61 ) ; |
| 9016 | if ( tempbx < 0x01 ) //first time we power up |
| 9017 | XGINew_SetCH7005( 0x0066 ) ; //and disable power sequence |
| 9018 | else |
| 9019 | XGINew_SetCH7005( 0x5f66 ) ; //leave VDD on - disable power |
| 9020 | } |
| 9021 | } |
| 9022 | } |
| 9023 | } */ |
| 9024 | |
| 9025 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B| VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9026 | { |
| 9027 | tempah = 0x3F ; |
| 9028 | if ( !( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) ) |
| 9029 | { |
| 9030 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9031 | { |
| 9032 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 9033 | { |
| 9034 | tempah = 0x7F; /* Disable Channel A */ |
| 9035 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 9036 | tempah = 0xBF ; /* Disable Channel B */ |
| 9037 | |
| 9038 | if ( pVBInfo->SetFlag & DisableChB ) |
| 9039 | tempah &= 0xBF ; /* force to disable Cahnnel */ |
| 9040 | |
| 9041 | if ( pVBInfo->SetFlag & DisableChA ) |
| 9042 | tempah &= 0x7F ; /* Force to disable Channel B */ |
| 9043 | } |
| 9044 | } |
| 9045 | } |
| 9046 | |
| 9047 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x1F , tempah ) ; /* disable part4_1f */ |
| 9048 | |
| 9049 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 9050 | { |
| 9051 | if ( ( ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) ) || ( XGI_DisableChISLCD(pVBInfo) ) || ( XGI_IsLCDON(pVBInfo) ) ) |
| 9052 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x80 ) ; /* LVDS Driver power down */ |
| 9053 | } |
| 9054 | |
| 9055 | if ( ( pVBInfo->SetFlag & DisableChA ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetCRT2ToLCDA | SetSimuScanMode ) ) ) |
| 9056 | { |
| 9057 | if ( pVBInfo->SetFlag & GatingCRT ) |
| 9058 | XGI_EnableGatingCRT( HwDeviceExtension, pVBInfo ) ; |
| 9059 | XGI_DisplayOff( HwDeviceExtension, pVBInfo) ; |
| 9060 | } |
| 9061 | |
| 9062 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9063 | { |
| 9064 | if ( ( pVBInfo->SetFlag & DisableChA ) || ( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 9065 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x1e , 0xdf ) ; /* Power down */ |
| 9066 | } |
| 9067 | |
| 9068 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x32 , 0xdf ) ; /* disable TV as primary VGA swap */ |
| 9069 | |
| 9070 | if ( ( pVBInfo->VBInfo & ( SetSimuScanMode | SetCRT2ToDualEdge ) ) ) |
| 9071 | XGINew_SetRegAND(pVBInfo->Part2Port,0x00,0xdf); |
| 9072 | |
| 9073 | if ( ( pVBInfo->SetFlag & DisableChB ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) |
| 9074 | || ( ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) && ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ) ) |
| 9075 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x00 , 0x80 ) ; /* BScreenOff=1 */ |
| 9076 | |
| 9077 | if ( ( pVBInfo->SetFlag & DisableChB ) || ( pVBInfo->VBInfo & ( DisableCRT2Display | SetSimuScanMode ) ) |
| 9078 | || ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) || ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) ) |
| 9079 | { |
| 9080 | tempah= XGINew_GetReg1( pVBInfo->Part1Port , 0x00 ) ; /* save Part1 index 0 */ |
| 9081 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x00 , 0x10 ) ; /* BTDAC = 1, avoid VB reset */ |
| 9082 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x1E , 0xDF ) ; /* disable CRT2 */ |
| 9083 | XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ; /* restore Part1 index 0 */ |
| 9084 | } |
| 9085 | } |
| 9086 | else /* {301} */ |
| 9087 | { |
| 9088 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToTV ) ) |
| 9089 | { |
| 9090 | XGINew_SetRegOR( pVBInfo->Part1Port , 0x00 , 0x80 ) ; /* BScreenOff=1 */ |
| 9091 | XGINew_SetRegAND( pVBInfo->Part1Port , 0x1E , 0xDF ) ; /* Disable CRT2 */ |
| 9092 | XGINew_SetRegAND( pVBInfo->P3c4 , 0x32 , 0xDF ) ; /* Disable TV asPrimary VGA swap */ |
| 9093 | } |
| 9094 | |
| 9095 | if ( pVBInfo->VBInfo & ( DisableCRT2Display | SetCRT2ToLCDA | SetSimuScanMode ) ) |
| 9096 | XGI_DisplayOff( HwDeviceExtension, pVBInfo) ; |
| 9097 | } |
| 9098 | |
| 9099 | |
| 9100 | |
| 9101 | |
| 9102 | if ( HwDeviceExtension->jChipType < XG40 ) |
| 9103 | { |
| 9104 | if ( !( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) || ( XGI_DisableChISLCD(pVBInfo) ) || ( XGI_IsLCDON(pVBInfo) ) ) |
| 9105 | { |
| 9106 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 9107 | { |
| 9108 | if ( pVBInfo->LCDInfo & SetPWDEnable ) |
| 9109 | XGI_BacklightByDrv(pVBInfo) ; |
| 9110 | else |
| 9111 | { |
| 9112 | XGI_SetPanelDelay( 4 ,pVBInfo) ; |
| 9113 | if ( pVBInfo->VBType & VB_XGI301LV ) |
| 9114 | { |
| 9115 | tempbl = 0xFD ; |
| 9116 | tempah = 0x00 ; |
| 9117 | } |
| 9118 | else |
| 9119 | { |
| 9120 | tempbl = 0xFB ; |
| 9121 | tempah = 0x04 ; |
| 9122 | } |
| 9123 | } |
| 9124 | } |
| 9125 | XGI_SetPanelPower( tempah , tempbl , pVBInfo) ; |
| 9126 | } |
| 9127 | } |
| 9128 | } |
| 9129 | |
| 9130 | |
| 9131 | /* --------------------------------------------------------------------- */ |
| 9132 | /* Function : XGI_GetTVPtrIndex */ |
| 9133 | /* Input : */ |
| 9134 | /* Output : */ |
| 9135 | /* Description : bx 0 : ExtNTSC */ |
| 9136 | /* 1 : StNTSC */ |
| 9137 | /* 2 : ExtPAL */ |
| 9138 | /* 3 : StPAL */ |
| 9139 | /* 4 : ExtHiTV */ |
| 9140 | /* 5 : StHiTV */ |
| 9141 | /* 6 : Ext525i */ |
| 9142 | /* 7 : St525i */ |
| 9143 | /* 8 : Ext525p */ |
| 9144 | /* 9 : St525p */ |
| 9145 | /* A : Ext750p */ |
| 9146 | /* B : St750p */ |
| 9147 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9148 | unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9149 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9150 | unsigned short tempbx = 0 ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9151 | |
| 9152 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 9153 | tempbx = 2 ; |
| 9154 | if ( pVBInfo->TVInfo & SetYPbPrMode1080i ) |
| 9155 | tempbx = 4 ; |
| 9156 | if ( pVBInfo->TVInfo & SetYPbPrMode525i ) |
| 9157 | tempbx = 6 ; |
| 9158 | if ( pVBInfo->TVInfo & SetYPbPrMode525p ) |
| 9159 | tempbx = 8 ; |
| 9160 | if ( pVBInfo->TVInfo & SetYPbPrMode750p ) |
| 9161 | tempbx = 10 ; |
| 9162 | if ( pVBInfo->TVInfo & TVSimuMode ) |
| 9163 | tempbx++ ; |
| 9164 | |
| 9165 | return tempbx ; |
| 9166 | } |
| 9167 | |
| 9168 | |
| 9169 | /* --------------------------------------------------------------------- */ |
| 9170 | /* Function : XGI_OEM310Setting */ |
| 9171 | /* Input : */ |
| 9172 | /* Output : */ |
| 9173 | /* Description : Customized Param. for 301 */ |
| 9174 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9175 | void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9176 | { |
| 9177 | if ( pVBInfo->SetFlag & Win9xDOSMode ) |
| 9178 | return ; |
| 9179 | |
| 9180 | /* GetPart1IO(); */ |
| 9181 | XGI_SetDelayComp(pVBInfo) ; |
| 9182 | |
| 9183 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 9184 | XGI_SetLCDCap(pVBInfo) ; |
| 9185 | |
| 9186 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 9187 | { |
| 9188 | /* GetPart2IO() */ |
| 9189 | XGI_SetPhaseIncr(pVBInfo) ; |
| 9190 | XGI_SetYFilter( ModeNo , ModeIdIndex,pVBInfo ) ; |
| 9191 | XGI_SetAntiFlicker( ModeNo , ModeIdIndex,pVBInfo ) ; |
| 9192 | |
| 9193 | if ( pVBInfo->VBType&VB_XGI301) |
| 9194 | XGI_SetEdgeEnhance( ModeNo , ModeIdIndex ,pVBInfo) ; |
| 9195 | } |
| 9196 | } |
| 9197 | |
| 9198 | |
| 9199 | /* --------------------------------------------------------------------- */ |
| 9200 | /* Function : XGI_SetDelayComp */ |
| 9201 | /* Input : */ |
| 9202 | /* Output : */ |
| 9203 | /* Description : */ |
| 9204 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9205 | void XGI_SetDelayComp(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9206 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9207 | unsigned short index ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9208 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 9209 | unsigned char tempah , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9210 | tempbl , |
| 9211 | tempbh ; |
| 9212 | |
| 9213 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9214 | { |
| 9215 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToTV | SetCRT2ToRAMDAC ) ) |
| 9216 | { |
| 9217 | tempbl = 0; |
| 9218 | tempbh = 0; |
| 9219 | |
| 9220 | index = XGI_GetTVPtrIndex(pVBInfo ) ; /* Get TV Delay */ |
| 9221 | tempbl = pVBInfo->XGI_TVDelayList[ index ] ; |
| 9222 | |
| 9223 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9224 | tempbl = pVBInfo->XGI_TVDelayList2[ index ] ; |
| 9225 | |
| 9226 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 9227 | tempbl = tempbl >> 4 ; |
| 9228 | /* |
| 9229 | if ( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) |
| 9230 | tempbl = CRT2Delay1 ; // Get CRT2 Delay |
| 9231 | |
| 9232 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9233 | tempbl = CRT2Delay2 ; |
| 9234 | */ |
| 9235 | if ( pVBInfo->VBInfo & ( SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 9236 | { |
| 9237 | index = XGI_GetLCDCapPtr(pVBInfo) ; /* Get LCD Delay */ |
| 9238 | tempbh=pVBInfo->LCDCapList[ index ].LCD_DelayCompensation ; |
| 9239 | |
| 9240 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 9241 | tempbl = tempbh ; |
| 9242 | } |
| 9243 | |
| 9244 | tempbl &= 0x0F ; |
| 9245 | tempbh &= 0xF0 ; |
| 9246 | tempah = XGINew_GetReg1( pVBInfo->Part1Port , 0x2D ) ; |
| 9247 | |
| 9248 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV ) ) /* Channel B */ |
| 9249 | { |
| 9250 | tempah &= 0xF0 ; |
| 9251 | tempah |= tempbl ; |
| 9252 | } |
| 9253 | |
| 9254 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) /* Channel A */ |
| 9255 | { |
| 9256 | tempah &= 0x0F ; |
| 9257 | tempah |= tempbh ; |
| 9258 | } |
| 9259 | XGINew_SetReg1(pVBInfo->Part1Port,0x2D,tempah); |
| 9260 | } |
| 9261 | } |
| 9262 | else if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 9263 | { |
| 9264 | tempbl = 0; |
| 9265 | tempbh = 0; |
| 9266 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 9267 | { |
| 9268 | tempah = pVBInfo->LCDCapList[ XGI_GetLCDCapPtr(pVBInfo) ].LCD_DelayCompensation ; /* / Get LCD Delay */ |
| 9269 | tempah &= 0x0f ; |
| 9270 | tempah = tempah << 4 ; |
| 9271 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2D , 0x0f , tempah ) ; |
| 9272 | } |
| 9273 | } |
| 9274 | } |
| 9275 | |
| 9276 | |
| 9277 | /* --------------------------------------------------------------------- */ |
| 9278 | /* Function : XGI_SetLCDCap */ |
| 9279 | /* Input : */ |
| 9280 | /* Output : */ |
| 9281 | /* Description : */ |
| 9282 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9283 | void XGI_SetLCDCap(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9284 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9285 | unsigned short tempcx ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9286 | |
| 9287 | tempcx = pVBInfo->LCDCapList[ XGI_GetLCDCapPtr(pVBInfo) ].LCD_Capability ; |
| 9288 | |
| 9289 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9290 | { |
| 9291 | if ( pVBInfo->VBType & ( VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9292 | { /* 301LV/302LV only */ |
| 9293 | /* Set 301LV Capability */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 9294 | XGINew_SetReg1(pVBInfo->Part4Port, 0x24, (unsigned char)(tempcx & 0x1F)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9295 | } |
| 9296 | /* VB Driving */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9297 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0D, |
| 9298 | ~((EnableVBCLKDRVLOW | EnablePLLSPLOW) >> 8), |
| 9299 | (unsigned short)((tempcx & (EnableVBCLKDRVLOW | EnablePLLSPLOW)) >> 8)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9300 | } |
| 9301 | |
| 9302 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9303 | { |
| 9304 | if ( pVBInfo->VBInfo & SetCRT2ToLCD ) |
| 9305 | XGI_SetLCDCap_B( tempcx,pVBInfo ) ; |
| 9306 | else if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9307 | XGI_SetLCDCap_A( tempcx,pVBInfo ) ; |
| 9308 | |
| 9309 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 9310 | { |
| 9311 | if ( tempcx & EnableSpectrum ) |
| 9312 | SetSpectrum( pVBInfo) ; |
| 9313 | } |
| 9314 | } |
| 9315 | else /* LVDS,CH7017 */ |
| 9316 | XGI_SetLCDCap_A( tempcx, pVBInfo ) ; |
| 9317 | } |
| 9318 | |
| 9319 | |
| 9320 | /* --------------------------------------------------------------------- */ |
| 9321 | /* Function : XGI_SetLCDCap_A */ |
| 9322 | /* Input : */ |
| 9323 | /* Output : */ |
| 9324 | /* Description : */ |
| 9325 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9326 | void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9327 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9328 | unsigned short temp ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9329 | |
| 9330 | temp = XGINew_GetReg1( pVBInfo->P3d4 , 0x37 ) ; |
| 9331 | |
| 9332 | if ( temp & LCDRGB18Bit ) |
| 9333 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9334 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, |
| 9335 | (unsigned short)(0x20 | (tempcx & 0x00C0))); /* Enable Dither */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9336 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1A , 0x7F , 0x80 ) ; |
| 9337 | } |
| 9338 | else |
| 9339 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9340 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, |
| 9341 | (unsigned short)(0x30 | (tempcx & 0x00C0))); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9342 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x1A , 0x7F , 0x00 ) ; |
| 9343 | } |
| 9344 | |
| 9345 | /* |
| 9346 | if ( tempcx & EnableLCD24bpp ) // 24bits |
| 9347 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9348 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x19, 0x0F,(unsigned short)(0x30|(tempcx&0x00C0)) ); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9349 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x1A,0x7F,0x00); |
| 9350 | } |
| 9351 | else |
| 9352 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9353 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x19, 0x0F,(unsigned short)(0x20|(tempcx&0x00C0)) ); // Enable Dither |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9354 | XGINew_SetRegANDOR(pVBInfo->Part1Port,0x1A,0x7F,0x80); |
| 9355 | } |
| 9356 | */ |
| 9357 | } |
| 9358 | |
| 9359 | |
| 9360 | /* --------------------------------------------------------------------- */ |
| 9361 | /* Function : XGI_SetLCDCap_B */ |
| 9362 | /* Input : cx -> LCD Capability */ |
| 9363 | /* Output : */ |
| 9364 | /* Description : */ |
| 9365 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9366 | void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9367 | { |
| 9368 | if ( tempcx & EnableLCD24bpp ) /* 24bits */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9369 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0, |
| 9370 | (unsigned short)(((tempcx & 0x00ff) >> 6) | 0x0c)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9371 | else |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9372 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0, |
| 9373 | (unsigned short)(((tempcx & 0x00ff) >> 6) | 0x18)); /* Enable Dither */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9374 | } |
| 9375 | |
| 9376 | |
| 9377 | /* --------------------------------------------------------------------- */ |
| 9378 | /* Function : SetSpectrum */ |
| 9379 | /* Input : */ |
| 9380 | /* Output : */ |
| 9381 | /* Description : */ |
| 9382 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9383 | void SetSpectrum(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9384 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9385 | unsigned short index ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9386 | |
| 9387 | index = XGI_GetLCDCapPtr(pVBInfo) ; |
| 9388 | |
| 9389 | XGINew_SetRegAND( pVBInfo->Part4Port , 0x30 , 0x8F ) ; /* disable down spectrum D[4] */ |
| 9390 | XGI_LongWait(pVBInfo) ; |
| 9391 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x20 ) ; /* reset spectrum */ |
| 9392 | XGI_LongWait(pVBInfo) ; |
| 9393 | |
| 9394 | XGINew_SetReg1( pVBInfo->Part4Port , 0x31 , pVBInfo->LCDCapList[ index ].Spectrum_31 ) ; |
| 9395 | XGINew_SetReg1( pVBInfo->Part4Port , 0x32 , pVBInfo->LCDCapList[ index ].Spectrum_32 ) ; |
| 9396 | XGINew_SetReg1( pVBInfo->Part4Port , 0x33 , pVBInfo->LCDCapList[ index ].Spectrum_33 ) ; |
| 9397 | XGINew_SetReg1( pVBInfo->Part4Port , 0x34 , pVBInfo->LCDCapList[ index ].Spectrum_34 ) ; |
| 9398 | XGI_LongWait(pVBInfo) ; |
| 9399 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x30 , 0x40 ) ; /* enable spectrum */ |
| 9400 | } |
| 9401 | |
| 9402 | |
| 9403 | /* --------------------------------------------------------------------- */ |
| 9404 | /* Function : XGI_SetAntiFlicker */ |
| 9405 | /* Input : */ |
| 9406 | /* Output : */ |
| 9407 | /* Description : Set TV Customized Param. */ |
| 9408 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9409 | void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9410 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9411 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9412 | unsigned short tempbx , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9413 | index ; |
| 9414 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 9415 | unsigned char tempah ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9416 | |
| 9417 | if (pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) |
| 9418 | return ; |
| 9419 | |
| 9420 | tempbx = XGI_GetTVPtrIndex(pVBInfo ) ; |
| 9421 | tempbx &= 0xFE ; |
| 9422 | |
| 9423 | if ( ModeNo <= 0x13 ) |
| 9424 | { |
| 9425 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVFlickerIndex ; |
| 9426 | } |
| 9427 | else |
| 9428 | { |
| 9429 | index = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVFlickerIndex ; |
| 9430 | } |
| 9431 | |
| 9432 | tempbx += index ; |
| 9433 | tempah = TVAntiFlickList[ tempbx ] ; |
| 9434 | tempah = tempah << 4 ; |
| 9435 | |
| 9436 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x0A , 0x8F , tempah ) ; |
| 9437 | } |
| 9438 | |
| 9439 | |
| 9440 | /* --------------------------------------------------------------------- */ |
| 9441 | /* Function : XGI_SetEdgeEnhance */ |
| 9442 | /* Input : */ |
| 9443 | /* Output : */ |
| 9444 | /* Description : */ |
| 9445 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9446 | void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9447 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9448 | unsigned short tempbx , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9449 | index ; |
| 9450 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 9451 | unsigned char tempah ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9452 | |
| 9453 | |
| 9454 | tempbx = XGI_GetTVPtrIndex(pVBInfo ) ; |
| 9455 | tempbx &= 0xFE ; |
| 9456 | |
| 9457 | if ( ModeNo <= 0x13 ) |
| 9458 | { |
| 9459 | index = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVEdgeIndex ; |
| 9460 | } |
| 9461 | else |
| 9462 | { |
| 9463 | index = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVEdgeIndex ; |
| 9464 | } |
| 9465 | |
| 9466 | tempbx += index ; |
| 9467 | tempah = TVEdgeList[ tempbx ] ; |
| 9468 | tempah = tempah << 5 ; |
| 9469 | |
| 9470 | XGINew_SetRegANDOR( pVBInfo->Part2Port , 0x3A , 0x1F , tempah ) ; |
| 9471 | } |
| 9472 | |
| 9473 | |
| 9474 | /* --------------------------------------------------------------------- */ |
| 9475 | /* Function : XGI_SetPhaseIncr */ |
| 9476 | /* Input : */ |
| 9477 | /* Output : */ |
| 9478 | /* Description : */ |
| 9479 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9480 | void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9481 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9482 | unsigned short tempbx ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9483 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 9484 | unsigned char tempcl , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9485 | tempch ; |
| 9486 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9487 | unsigned long tempData ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9488 | |
| 9489 | XGI_GetTVPtrIndex2( &tempbx , &tempcl , &tempch, pVBInfo ) ; /* bx, cl, ch */ |
| 9490 | tempData = TVPhaseList[ tempbx ] ; |
| 9491 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9492 | XGINew_SetReg1(pVBInfo->Part2Port, 0x31, |
| 9493 | (unsigned short)(tempData & 0x000000FF)); |
| 9494 | XGINew_SetReg1(pVBInfo->Part2Port, 0x32, |
| 9495 | (unsigned short)((tempData & 0x0000FF00) >> 8)); |
| 9496 | XGINew_SetReg1(pVBInfo->Part2Port, 0x33, |
| 9497 | (unsigned short)((tempData & 0x00FF0000) >> 16)); |
| 9498 | XGINew_SetReg1(pVBInfo->Part2Port, 0x34, |
| 9499 | (unsigned short)((tempData & 0xFF000000) >> 24)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9500 | } |
| 9501 | |
| 9502 | |
| 9503 | /* --------------------------------------------------------------------- */ |
| 9504 | /* Function : XGI_SetYFilter */ |
| 9505 | /* Input : */ |
| 9506 | /* Output : */ |
| 9507 | /* Description : */ |
| 9508 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9509 | void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9510 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9511 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9512 | unsigned short tempbx , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9513 | index ; |
| 9514 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 9515 | unsigned char tempcl , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9516 | tempch , |
| 9517 | tempal , |
| 9518 | *filterPtr ; |
| 9519 | |
| 9520 | XGI_GetTVPtrIndex2( &tempbx , &tempcl , &tempch, pVBInfo ) ; /* bx, cl, ch */ |
| 9521 | |
| 9522 | switch( tempbx ) |
| 9523 | { |
| 9524 | case 0x00: |
| 9525 | case 0x04: |
| 9526 | filterPtr = NTSCYFilter1 ; |
| 9527 | break ; |
| 9528 | |
| 9529 | case 0x01: |
| 9530 | filterPtr = PALYFilter1 ; |
| 9531 | break ; |
| 9532 | |
| 9533 | case 0x02: |
| 9534 | case 0x05: |
| 9535 | case 0x0D: |
| 9536 | filterPtr = PALMYFilter1 ; |
| 9537 | break ; |
| 9538 | |
| 9539 | case 0x03: |
| 9540 | filterPtr = PALNYFilter1 ; |
| 9541 | break ; |
| 9542 | |
| 9543 | case 0x08: |
| 9544 | case 0x0C: |
| 9545 | filterPtr = NTSCYFilter2 ; |
| 9546 | break ; |
| 9547 | |
| 9548 | case 0x0A: |
| 9549 | filterPtr = PALMYFilter2 ; |
| 9550 | break ; |
| 9551 | |
| 9552 | case 0x0B: |
| 9553 | filterPtr = PALNYFilter2 ; |
| 9554 | break ; |
| 9555 | |
| 9556 | case 0x09: |
| 9557 | filterPtr = PALYFilter2 ; |
| 9558 | break ; |
| 9559 | |
| 9560 | default: |
| 9561 | return ; |
| 9562 | } |
| 9563 | |
| 9564 | if ( ModeNo <= 0x13 ) |
| 9565 | tempal = pVBInfo->SModeIDTable[ ModeIdIndex ].VB_StTVYFilterIndex ; |
| 9566 | else |
| 9567 | tempal = pVBInfo->EModeIDTable[ ModeIdIndex ].VB_ExtTVYFilterIndex ; |
| 9568 | |
| 9569 | if ( tempcl == 0 ) |
| 9570 | index = tempal * 4; |
| 9571 | else |
| 9572 | index = tempal * 7; |
| 9573 | |
| 9574 | if ( ( tempcl == 0 ) && ( tempch == 1 ) ) |
| 9575 | { |
| 9576 | XGINew_SetReg1( pVBInfo->Part2Port , 0x35 , 0 ) ; |
| 9577 | XGINew_SetReg1( pVBInfo->Part2Port , 0x36 , 0 ) ; |
| 9578 | XGINew_SetReg1( pVBInfo->Part2Port , 0x37 , 0 ) ; |
| 9579 | XGINew_SetReg1( pVBInfo->Part2Port , 0x38 , filterPtr[ index++ ] ) ; |
| 9580 | } |
| 9581 | else |
| 9582 | { |
| 9583 | XGINew_SetReg1( pVBInfo->Part2Port , 0x35 , filterPtr[ index++ ] ) ; |
| 9584 | XGINew_SetReg1( pVBInfo->Part2Port , 0x36 , filterPtr[ index++ ] ) ; |
| 9585 | XGINew_SetReg1( pVBInfo->Part2Port , 0x37 , filterPtr[ index++ ] ) ; |
| 9586 | XGINew_SetReg1( pVBInfo->Part2Port , 0x38 , filterPtr[ index++ ] ) ; |
| 9587 | } |
| 9588 | |
| 9589 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9590 | { |
| 9591 | XGINew_SetReg1( pVBInfo->Part2Port , 0x48 , filterPtr[ index++ ] ) ; |
| 9592 | XGINew_SetReg1( pVBInfo->Part2Port , 0x49 , filterPtr[ index++ ] ) ; |
| 9593 | XGINew_SetReg1( pVBInfo->Part2Port , 0x4A , filterPtr[ index++ ] ) ; |
| 9594 | } |
| 9595 | } |
| 9596 | |
| 9597 | |
| 9598 | /* --------------------------------------------------------------------- */ |
| 9599 | /* Function : XGI_GetTVPtrIndex2 */ |
| 9600 | /* Input : */ |
| 9601 | /* Output : bx 0 : NTSC */ |
| 9602 | /* 1 : PAL */ |
| 9603 | /* 2 : PALM */ |
| 9604 | /* 3 : PALN */ |
| 9605 | /* 4 : NTSC1024x768 */ |
| 9606 | /* 5 : PAL-M 1024x768 */ |
| 9607 | /* 6-7: reserved */ |
| 9608 | /* cl 0 : YFilter1 */ |
| 9609 | /* 1 : YFilter2 */ |
| 9610 | /* ch 0 : 301A */ |
| 9611 | /* 1 : 301B/302B/301LV/302LV */ |
| 9612 | /* Description : */ |
| 9613 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 9614 | void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char *tempcl, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9615 | unsigned char *tempch, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9616 | { |
| 9617 | *tempbx = 0 ; |
| 9618 | *tempcl = 0 ; |
| 9619 | *tempch = 0 ; |
| 9620 | |
| 9621 | if ( pVBInfo->TVInfo & SetPALTV ) |
| 9622 | *tempbx = 1 ; |
| 9623 | |
| 9624 | if ( pVBInfo->TVInfo & SetPALMTV ) |
| 9625 | *tempbx = 2 ; |
| 9626 | |
| 9627 | if ( pVBInfo->TVInfo & SetPALNTV ) |
| 9628 | *tempbx = 3 ; |
| 9629 | |
| 9630 | if ( pVBInfo->TVInfo & NTSC1024x768 ) |
| 9631 | { |
| 9632 | *tempbx = 4 ; |
| 9633 | if ( pVBInfo->TVInfo & SetPALMTV ) |
| 9634 | *tempbx = 5 ; |
| 9635 | } |
| 9636 | |
| 9637 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9638 | { |
| 9639 | if ( ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) || ( pVBInfo->TVInfo & TVSimuMode ) ) |
| 9640 | { |
| 9641 | *tempbx += 8 ; |
| 9642 | *tempcl += 1 ; |
| 9643 | } |
| 9644 | } |
| 9645 | |
| 9646 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9647 | (*tempch)++ ; |
| 9648 | } |
| 9649 | |
| 9650 | |
| 9651 | /* --------------------------------------------------------------------- */ |
| 9652 | /* Function : XGI_SetCRT2ModeRegs */ |
| 9653 | /* Input : */ |
| 9654 | /* Output : */ |
| 9655 | /* Description : Origin code for crt2group */ |
| 9656 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9657 | void XGI_SetCRT2ModeRegs(unsigned short ModeNo, |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 9658 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9659 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9660 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9661 | unsigned short tempbl ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 9662 | short tempcl ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9663 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 9664 | unsigned char tempah ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9665 | |
| 9666 | /* XGINew_SetReg1( pVBInfo->Part1Port , 0x03 , 0x00 ) ; // fix write part1 index 0 BTDRAM bit Bug */ |
| 9667 | tempah=0; |
| 9668 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 9669 | { |
| 9670 | tempah=XGINew_GetReg1( pVBInfo->Part1Port , 0x00 ) ; |
| 9671 | tempah &= ~0x10 ; /* BTRAMDAC */ |
| 9672 | tempah |= 0x40 ; /* BTRAM */ |
| 9673 | |
| 9674 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 9675 | { |
| 9676 | tempah=0x40; /* BTDRAM */ |
| 9677 | if ( ModeNo > 0x13 ) |
| 9678 | { |
| 9679 | tempcl = pVBInfo->ModeType ; |
| 9680 | tempcl -= ModeVGA ; |
| 9681 | if ( tempcl >= 0 ) |
| 9682 | { |
| 9683 | tempah = ( 0x008 >> tempcl ) ; /* BT Color */ |
| 9684 | if ( tempah == 0 ) |
| 9685 | tempah = 1 ; |
| 9686 | tempah |= 0x040 ; |
| 9687 | } |
| 9688 | } |
| 9689 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 9690 | tempah ^= 0x50 ; /* BTDAC */ |
| 9691 | } |
| 9692 | } |
| 9693 | |
| 9694 | /* 0210 shampoo |
| 9695 | if ( pVBInfo->VBInfo & DisableCRT2Display ) |
| 9696 | { |
| 9697 | tempah = 0 ; |
| 9698 | } |
| 9699 | |
| 9700 | XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ; |
| 9701 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 9702 | { |
| 9703 | tempcl = pVBInfo->ModeType ; |
| 9704 | if ( ModeNo > 0x13 ) |
| 9705 | { |
| 9706 | tempcl -= ModeVGA ; |
| 9707 | if ( ( tempcl > 0 ) || ( tempcl == 0 ) ) |
| 9708 | { |
| 9709 | tempah=(0x008>>tempcl) ; |
| 9710 | if ( tempah == 0 ) |
| 9711 | tempah = 1 ; |
| 9712 | tempah |= 0x040; |
| 9713 | } |
| 9714 | } |
| 9715 | else |
| 9716 | { |
| 9717 | tempah = 0x040 ; |
| 9718 | } |
| 9719 | |
| 9720 | if ( pVBInfo->VBInfo & SetInSlaveMode ) |
| 9721 | { |
| 9722 | tempah = ( tempah ^ 0x050 ) ; |
| 9723 | } |
| 9724 | } |
| 9725 | */ |
| 9726 | |
| 9727 | XGINew_SetReg1( pVBInfo->Part1Port , 0x00 , tempah ) ; |
| 9728 | tempah = 0x08 ; |
| 9729 | tempbl = 0xf0 ; |
| 9730 | |
| 9731 | if ( pVBInfo->VBInfo & DisableCRT2Display ) |
| 9732 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 9733 | else |
| 9734 | { |
| 9735 | tempah = 0x00 ; |
| 9736 | tempbl = 0xff ; |
| 9737 | |
| 9738 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 9739 | { |
| 9740 | if ( ( pVBInfo->VBInfo & SetCRT2ToLCDA ) && ( !( pVBInfo->VBInfo & SetSimuScanMode ) ) ) |
| 9741 | { |
| 9742 | tempbl &= 0xf7 ; |
| 9743 | tempah |= 0x01 ; |
| 9744 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 9745 | } |
| 9746 | else |
| 9747 | { |
| 9748 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9749 | { |
| 9750 | tempbl &= 0xf7 ; |
| 9751 | tempah |= 0x01 ; |
| 9752 | } |
| 9753 | |
| 9754 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD ) ) |
| 9755 | { |
| 9756 | tempbl &= 0xf8 ; |
| 9757 | tempah = 0x01 ; |
| 9758 | |
| 9759 | if ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) |
| 9760 | tempah |= 0x02 ; |
| 9761 | |
| 9762 | if ( !( pVBInfo->VBInfo & SetCRT2ToRAMDAC ) ) |
| 9763 | { |
| 9764 | tempah = tempah ^ 0x05 ; |
| 9765 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) |
| 9766 | tempah = tempah ^ 0x01 ; |
| 9767 | } |
| 9768 | |
| 9769 | if ( !( pVBInfo->VBInfo & SetCRT2ToDualEdge ) ) |
| 9770 | tempah |= 0x08 ; |
| 9771 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 9772 | } |
| 9773 | else |
| 9774 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 9775 | } |
| 9776 | } |
| 9777 | else |
| 9778 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2e , tempbl , tempah ) ; |
| 9779 | } |
| 9780 | |
| 9781 | if ( pVBInfo->VBInfo & ( SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA ) ) |
| 9782 | { |
| 9783 | tempah &= ( ~0x08 ) ; |
| 9784 | if ( ( pVBInfo->ModeType == ModeVGA ) && ( !( pVBInfo->VBInfo & SetInSlaveMode ) ) ) |
| 9785 | { |
| 9786 | tempah |= 0x010 ; |
| 9787 | } |
| 9788 | tempah |= 0x080 ; |
| 9789 | |
| 9790 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 9791 | { |
| 9792 | /* if ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) */ |
| 9793 | /* { */ |
| 9794 | tempah |= 0x020 ; |
| 9795 | if ( ModeNo > 0x13 ) |
| 9796 | { |
| 9797 | if ( pVBInfo->VBInfo & DriverMode ) |
| 9798 | tempah = tempah ^ 0x20 ; |
| 9799 | } |
| 9800 | /* } */ |
| 9801 | } |
| 9802 | |
| 9803 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x0D , ~0x0BF , tempah ) ; |
| 9804 | tempah = 0 ; |
| 9805 | |
| 9806 | if ( pVBInfo->LCDInfo & SetLCDDualLink ) |
| 9807 | tempah |= 0x40 ; |
| 9808 | |
| 9809 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 9810 | { |
| 9811 | /* if ( ( !( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) ) && ( !( pVBInfo->TVInfo & ( SetYPbPrMode525p | SetYPbPrMode750p ) ) ) ) */ |
| 9812 | /* { */ |
| 9813 | if ( pVBInfo->TVInfo & RPLLDIV2XO ) |
| 9814 | tempah |= 0x40 ; |
| 9815 | /* } */ |
| 9816 | } |
| 9817 | |
| 9818 | if ( ( pVBInfo->LCDResInfo == Panel1280x1024 ) || ( pVBInfo->LCDResInfo == Panel1280x1024x75 ) ) |
| 9819 | tempah |= 0x80 ; |
| 9820 | |
| 9821 | if ( pVBInfo->LCDResInfo == Panel1280x960 ) |
| 9822 | tempah |= 0x80 ; |
| 9823 | |
| 9824 | XGINew_SetReg1( pVBInfo->Part4Port , 0x0C , tempah ) ; |
| 9825 | } |
| 9826 | |
| 9827 | if ( pVBInfo->VBType & ( VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C ) ) |
| 9828 | { |
| 9829 | tempah = 0 ; |
| 9830 | tempbl = 0xfb ; |
| 9831 | |
| 9832 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 9833 | { |
| 9834 | tempbl=0xff; |
| 9835 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9836 | tempah |= 0x04 ; /* shampoo 0129 */ |
| 9837 | } |
| 9838 | |
| 9839 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x13 , tempbl , tempah ) ; |
| 9840 | tempah = 0x00 ; |
| 9841 | tempbl = 0xcf ; |
| 9842 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 9843 | { |
| 9844 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 9845 | tempah |= 0x30 ; |
| 9846 | } |
| 9847 | |
| 9848 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2c , tempbl , tempah ) ; |
| 9849 | tempah = 0 ; |
| 9850 | tempbl = 0x3f ; |
| 9851 | |
| 9852 | if ( !( pVBInfo->VBInfo & DisableCRT2Display ) ) |
| 9853 | { |
| 9854 | if ( pVBInfo->VBInfo & SetCRT2ToDualEdge ) |
| 9855 | tempah |= 0xc0 ; |
| 9856 | } |
| 9857 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x21 , tempbl , tempah ) ; |
| 9858 | } |
| 9859 | |
| 9860 | tempah = 0 ; |
| 9861 | tempbl = 0x7f ; |
| 9862 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCDA ) ) |
| 9863 | { |
| 9864 | tempbl = 0xff ; |
| 9865 | if ( !( pVBInfo->VBInfo & SetCRT2ToDualEdge ) ) |
| 9866 | tempah |= 0x80 ; |
| 9867 | } |
| 9868 | |
| 9869 | XGINew_SetRegANDOR( pVBInfo->Part4Port , 0x23 , tempbl , tempah ) ; |
| 9870 | |
| 9871 | if ( pVBInfo->VBType & ( VB_XGI302LV | VB_XGI301C ) ) |
| 9872 | { |
| 9873 | if ( pVBInfo->LCDInfo & SetLCDDualLink ) |
| 9874 | { |
| 9875 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x27 , 0x20 ) ; |
| 9876 | XGINew_SetRegOR( pVBInfo->Part4Port , 0x34 , 0x10 ) ; |
| 9877 | } |
| 9878 | } |
| 9879 | } |
| 9880 | |
| 9881 | |
| 9882 | /* --------------------------------------------------------------------- */ |
| 9883 | /* Function : XGI_CloseCRTC */ |
| 9884 | /* Input : */ |
| 9885 | /* Output : */ |
| 9886 | /* Description : */ |
| 9887 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9888 | void XGI_CloseCRTC(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9889 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9890 | unsigned short tempbx ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9891 | |
| 9892 | tempbx = 0 ; |
| 9893 | |
| 9894 | if ( pVBInfo->VBInfo & SetCRT2ToLCDA ) |
| 9895 | tempbx = 0x08A0 ; |
| 9896 | |
| 9897 | |
| 9898 | } |
| 9899 | |
| 9900 | |
| 9901 | /* --------------------------------------------------------------------- */ |
| 9902 | /* Function : XGI_OpenCRTC */ |
| 9903 | /* Input : */ |
| 9904 | /* Output : */ |
| 9905 | /* Description : */ |
| 9906 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9907 | void XGI_OpenCRTC(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9908 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9909 | unsigned short tempbx ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9910 | |
| 9911 | tempbx = 0 ; |
| 9912 | |
| 9913 | |
| 9914 | } |
| 9915 | |
| 9916 | |
| 9917 | /* --------------------------------------------------------------------- */ |
| 9918 | /* Function : XGI_GetRAMDAC2DATA */ |
| 9919 | /* Input : */ |
| 9920 | /* Output : */ |
| 9921 | /* Description : */ |
| 9922 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9923 | void XGI_GetRAMDAC2DATA(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9924 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9925 | unsigned short tempax , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9926 | tempbx , |
| 9927 | temp1 , |
| 9928 | temp2 , |
| 9929 | modeflag = 0 , |
| 9930 | tempcx , |
| 9931 | StandTableIndex , |
| 9932 | CRT1Index ; |
| 9933 | |
| 9934 | pVBInfo->RVBHCMAX = 1 ; |
| 9935 | pVBInfo->RVBHCFACT = 1 ; |
| 9936 | |
| 9937 | if ( ModeNo <= 0x13 ) |
| 9938 | { |
| 9939 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 9940 | StandTableIndex = XGI_GetModePtr( ModeNo , ModeIdIndex, pVBInfo ) ; |
| 9941 | tempax = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 0 ] ; |
| 9942 | tempbx = pVBInfo->StandTable[StandTableIndex ].CRTC[ 6 ] ; |
| 9943 | temp1 = pVBInfo->StandTable[ StandTableIndex ].CRTC[ 7 ] ; |
| 9944 | } |
| 9945 | else |
| 9946 | { |
| 9947 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 9948 | CRT1Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT1CRTC ; |
| 9949 | CRT1Index &= IndexMask ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9950 | temp1 = (unsigned short)pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[0]; |
| 9951 | temp2 = (unsigned short)pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9952 | tempax = ( temp1 & 0xFF ) | ( ( temp2 & 0x03 ) << 8 ) ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9953 | tempbx = (unsigned short)pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[8]; |
| 9954 | tempcx = (unsigned short)pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14] << 8; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9955 | tempcx &= 0x0100 ; |
| 9956 | tempcx = tempcx << 2 ; |
| 9957 | tempbx |= tempcx; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9958 | temp1 = (unsigned short)pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[9]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9959 | } |
| 9960 | |
| 9961 | if ( temp1 & 0x01 ) |
| 9962 | tempbx |= 0x0100 ; |
| 9963 | |
| 9964 | if ( temp1 & 0x20 ) |
| 9965 | tempbx |= 0x0200 ; |
| 9966 | tempax += 5 ; |
| 9967 | |
| 9968 | if ( modeflag & Charx8Dot ) |
| 9969 | tempax *= 8 ; |
| 9970 | else |
| 9971 | tempax *= 9 ; |
| 9972 | |
| 9973 | pVBInfo->VGAHT = tempax ; |
| 9974 | pVBInfo->HT = tempax ; |
| 9975 | tempbx++ ; |
| 9976 | pVBInfo->VGAVT = tempbx ; |
| 9977 | pVBInfo->VT = tempbx ; |
| 9978 | } |
| 9979 | |
| 9980 | |
| 9981 | |
| 9982 | /* --------------------------------------------------------------------- */ |
| 9983 | /* Function : XGI_GetColorDepth */ |
| 9984 | /* Input : */ |
| 9985 | /* Output : */ |
| 9986 | /* Description : */ |
| 9987 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 9988 | unsigned short XGI_GetColorDepth(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9989 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9990 | unsigned short ColorDepth[ 6 ] = { 1 , 2 , 4 , 4 , 6 , 8 } ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 9991 | short index ; |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 9992 | unsigned short modeflag ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 9993 | |
| 9994 | if ( ModeNo <= 0x13 ) |
| 9995 | { |
| 9996 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; |
| 9997 | } |
| 9998 | else |
| 9999 | { |
| 10000 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; |
| 10001 | } |
| 10002 | |
| 10003 | index=(modeflag&ModeInfoFlag)-ModeEGA; |
| 10004 | |
| 10005 | if ( index < 0 ) |
| 10006 | index = 0 ; |
| 10007 | |
| 10008 | return( ColorDepth[ index ] ) ; |
| 10009 | } |
| 10010 | |
| 10011 | |
| 10012 | |
| 10013 | /* --------------------------------------------------------------------- */ |
| 10014 | /* Function : XGI_UnLockCRT2 */ |
| 10015 | /* Input : */ |
| 10016 | /* Output : */ |
| 10017 | /* Description : */ |
| 10018 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 10019 | void XGI_UnLockCRT2(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10020 | { |
| 10021 | |
| 10022 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2f , 0xFF , 0x01 ) ; |
| 10023 | |
| 10024 | } |
| 10025 | |
| 10026 | |
| 10027 | /* --------------------------------------------------------------------- */ |
| 10028 | /* Function : XGI_LockCRT2 */ |
| 10029 | /* Input : */ |
| 10030 | /* Output : */ |
| 10031 | /* Description : */ |
| 10032 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 10033 | void XGI_LockCRT2(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10034 | { |
| 10035 | |
| 10036 | XGINew_SetRegANDOR( pVBInfo->Part1Port , 0x2F , 0xFE , 0x00 ) ; |
| 10037 | |
| 10038 | |
| 10039 | } |
| 10040 | |
| 10041 | |
| 10042 | /* --------------------------------------------------------------------- */ |
| 10043 | /* Function : XGINew_EnableCRT2 */ |
| 10044 | /* Input : */ |
| 10045 | /* Output : */ |
| 10046 | /* Description : */ |
| 10047 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 10048 | void XGINew_EnableCRT2(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10049 | { |
| 10050 | XGINew_SetRegANDOR( pVBInfo->P3c4 , 0x1E , 0xFF , 0x20 ) ; |
| 10051 | } |
| 10052 | |
| 10053 | |
| 10054 | |
| 10055 | /* --------------------------------------------------------------------- */ |
| 10056 | /* Function : */ |
| 10057 | /* Input : */ |
| 10058 | /* Output : */ |
| 10059 | /* Description : */ |
| 10060 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 10061 | void XGINew_LCD_Wait_Time(unsigned char DelayTime, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10062 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 10063 | unsigned short i , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10064 | j ; |
| 10065 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 10066 | unsigned long temp , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10067 | flag ; |
| 10068 | |
| 10069 | flag = 0 ; |
| 10070 | //printk("XGINew_LCD_Wait_Time"); |
| 10071 | //return; |
| 10072 | for( i = 0 ; i < DelayTime ; i++ ) |
| 10073 | { |
| 10074 | for( j = 0 ; j < 66 ; j++ ) |
| 10075 | { |
| 10076 | |
| 10077 | temp = XGINew_GetReg3( 0x61 ) ; |
| 10078 | |
| 10079 | //temp &= 0x10000000; |
| 10080 | temp &= 0x10; |
| 10081 | if ( temp == flag ) |
| 10082 | continue ; |
| 10083 | |
| 10084 | flag = temp ; |
| 10085 | } |
| 10086 | } |
| 10087 | } |
| 10088 | |
| 10089 | |
| 10090 | |
| 10091 | |
| 10092 | /* --------------------------------------------------------------------- */ |
| 10093 | /* Function : XGI_BridgeIsOn */ |
| 10094 | /* Input : */ |
| 10095 | /* Output : */ |
| 10096 | /* Description : */ |
| 10097 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 10098 | unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10099 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 10100 | unsigned short flag ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10101 | |
| 10102 | if ( pVBInfo->IF_DEF_LVDS == 1 ) |
| 10103 | { |
| 10104 | return( 1 ) ; |
| 10105 | } |
| 10106 | else |
| 10107 | { |
| 10108 | flag = XGINew_GetReg1( pVBInfo->Part4Port , 0x00 ) ; |
| 10109 | if ( ( flag == 1 ) || ( flag == 2 ) ) |
| 10110 | return( 1 ) ; /* 301b */ |
| 10111 | else |
| 10112 | return( 0 ) ; |
| 10113 | } |
| 10114 | } |
| 10115 | |
| 10116 | |
| 10117 | |
| 10118 | /* --------------------------------------------------------------------- */ |
| 10119 | /* Function : XGI_LongWait */ |
| 10120 | /* Input : */ |
| 10121 | /* Output : */ |
| 10122 | /* Description : */ |
| 10123 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 10124 | void XGI_LongWait(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10125 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 10126 | unsigned short i ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10127 | |
| 10128 | i = XGINew_GetReg1( pVBInfo->P3c4 , 0x1F ) ; |
| 10129 | |
| 10130 | if ( !( i & 0xC0 ) ) |
| 10131 | { |
| 10132 | for( i = 0 ; i < 0xFFFF ; i++ ) |
| 10133 | { |
| 10134 | if ( !( XGINew_GetReg2( pVBInfo->P3da ) & 0x08 ) ) |
| 10135 | break ; |
| 10136 | } |
| 10137 | |
| 10138 | for( i = 0 ; i < 0xFFFF ; i++ ) |
| 10139 | { |
| 10140 | if ( ( XGINew_GetReg2( pVBInfo->P3da ) & 0x08 ) ) |
| 10141 | break ; |
| 10142 | } |
| 10143 | } |
| 10144 | } |
| 10145 | |
| 10146 | |
| 10147 | /* --------------------------------------------------------------------- */ |
| 10148 | /* Function : XGI_VBLongWait */ |
| 10149 | /* Input : */ |
| 10150 | /* Output : */ |
| 10151 | /* Description : */ |
| 10152 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 10153 | void XGI_VBLongWait(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10154 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 10155 | unsigned short tempal , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10156 | temp , |
| 10157 | i , |
| 10158 | j ; |
| 10159 | return ; |
| 10160 | if ( !( pVBInfo->VBInfo & SetCRT2ToTV ) ) |
| 10161 | { |
| 10162 | temp = 0 ; |
| 10163 | for( i = 0 ; i < 3 ; i++ ) |
| 10164 | { |
| 10165 | for( j = 0 ; j < 100 ; j++ ) |
| 10166 | { |
| 10167 | tempal = XGINew_GetReg2( pVBInfo->P3da ) ; |
| 10168 | if ( temp & 0x01 ) |
| 10169 | { /* VBWaitMode2 */ |
| 10170 | if ( ( tempal & 0x08 ) ) |
| 10171 | { |
| 10172 | continue ; |
| 10173 | } |
| 10174 | |
| 10175 | if ( !( tempal & 0x08 ) ) |
| 10176 | { |
| 10177 | break ; |
| 10178 | } |
| 10179 | } |
| 10180 | else |
| 10181 | { /* VBWaitMode1 */ |
| 10182 | if ( !( tempal & 0x08 ) ) |
| 10183 | { |
| 10184 | continue ; |
| 10185 | } |
| 10186 | |
| 10187 | if ( ( tempal & 0x08 ) ) |
| 10188 | { |
| 10189 | break ; |
| 10190 | } |
| 10191 | } |
| 10192 | } |
| 10193 | temp = temp ^ 0x01 ; |
| 10194 | } |
| 10195 | } |
| 10196 | else |
| 10197 | { |
| 10198 | XGI_LongWait(pVBInfo) ; |
| 10199 | } |
| 10200 | return ; |
| 10201 | } |
| 10202 | |
| 10203 | |
| 10204 | |
| 10205 | |
| 10206 | /* --------------------------------------------------------------------- */ |
| 10207 | /* Function : XGI_GetVGAHT2 */ |
| 10208 | /* Input : */ |
| 10209 | /* Output : */ |
| 10210 | /* Description : */ |
| 10211 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 10212 | unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10213 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 10214 | unsigned long tempax , |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10215 | tempbx ; |
| 10216 | |
| 10217 | tempbx = ( ( pVBInfo->VGAVT - pVBInfo->VGAVDE ) * pVBInfo->RVBHCMAX ) & 0xFFFF ; |
| 10218 | tempax = ( pVBInfo->VT - pVBInfo->VDE ) * pVBInfo->RVBHCFACT ; |
| 10219 | tempax = ( tempax * pVBInfo->HT ) /tempbx ; |
| 10220 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 10221 | return( (unsigned short)tempax ) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10222 | } |
| 10223 | |
| 10224 | |
| 10225 | /* --------------------------------------------------------------------- */ |
| 10226 | /* Function : XGI_GetVCLK2Ptr */ |
| 10227 | /* Input : */ |
| 10228 | /* Output : */ |
| 10229 | /* Description : */ |
| 10230 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 10231 | unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, |
| 10232 | unsigned short ModeIdIndex, |
| 10233 | unsigned short RefreshRateTableIndex, |
| 10234 | struct xgi_hw_device_info *HwDeviceExtension, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame^] | 10235 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10236 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 10237 | unsigned short tempbx ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10238 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 10239 | unsigned short LCDXlat1VCLK[ 4 ] = { VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 } ; |
| 10240 | unsigned short LCDXlat2VCLK[ 4 ] = { VCLK108_2 + 5 , VCLK108_2 + 5 , VCLK108_2 + 5 , VCLK108_2 + 5 } ; |
| 10241 | unsigned short LVDSXlat1VCLK[ 4 ] = { VCLK40 , VCLK40 , VCLK40 , VCLK40 } ; |
| 10242 | unsigned short LVDSXlat2VCLK[ 4 ] = { VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 } ; |
| 10243 | unsigned short LVDSXlat3VCLK[ 4 ] = { VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 , VCLK65 + 2 } ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10244 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 10245 | unsigned short CRT2Index , VCLKIndex ; |
| 10246 | unsigned short modeflag , resinfo ; |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 10247 | unsigned char *CHTVVCLKPtr = NULL ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10248 | |
| 10249 | if ( ModeNo <= 0x13 ) |
| 10250 | { |
| 10251 | modeflag = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ModeFlag ; /* si+St_ResInfo */ |
| 10252 | resinfo = pVBInfo->SModeIDTable[ ModeIdIndex ].St_ResInfo ; |
| 10253 | CRT2Index = pVBInfo->SModeIDTable[ ModeIdIndex ].St_CRT2CRTC ; |
| 10254 | } |
| 10255 | else |
| 10256 | { |
| 10257 | modeflag = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_ModeFlag ; /* si+Ext_ResInfo */ |
| 10258 | resinfo = pVBInfo->EModeIDTable[ ModeIdIndex ].Ext_RESINFO ; |
| 10259 | CRT2Index = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRT2CRTC ; |
| 10260 | } |
| 10261 | |
| 10262 | if ( pVBInfo->IF_DEF_LVDS == 0 ) |
| 10263 | { |
| 10264 | CRT2Index = CRT2Index >> 6 ; /* for LCD */ |
| 10265 | if ( ( ( pVBInfo->VBInfo & SetCRT2ToLCD ) | SetCRT2ToLCDA ) ) /*301b*/ |
| 10266 | { |
| 10267 | if ( pVBInfo->LCDResInfo != Panel1024x768 ) |
| 10268 | { |
| 10269 | VCLKIndex = LCDXlat2VCLK[ CRT2Index ] ; |
| 10270 | } |
| 10271 | else |
| 10272 | { |
| 10273 | VCLKIndex = LCDXlat1VCLK[ CRT2Index ] ; |
| 10274 | } |
| 10275 | } |
| 10276 | else /* for TV */ |
| 10277 | { |
| 10278 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 10279 | { |
| 10280 | if ( pVBInfo->VBInfo & SetCRT2ToHiVisionTV ) |
| 10281 | { |
| 10282 | if ( pVBInfo->SetFlag & RPLLDIV2XO ) |
| 10283 | { |
| 10284 | VCLKIndex = HiTVVCLKDIV2 ; |
| 10285 | |
| 10286 | |
| 10287 | VCLKIndex += 25 ; |
| 10288 | |
| 10289 | } |
| 10290 | else |
| 10291 | { |
| 10292 | VCLKIndex = HiTVVCLK ; |
| 10293 | |
| 10294 | |
| 10295 | VCLKIndex += 25 ; |
| 10296 | |
| 10297 | } |
| 10298 | |
| 10299 | if ( pVBInfo->SetFlag & TVSimuMode ) |
| 10300 | { |
| 10301 | if( modeflag & Charx8Dot ) |
| 10302 | { |
| 10303 | VCLKIndex = HiTVSimuVCLK ; |
| 10304 | |
| 10305 | |
| 10306 | VCLKIndex += 25 ; |
| 10307 | |
| 10308 | } |
| 10309 | else |
| 10310 | { |
| 10311 | VCLKIndex = HiTVTextVCLK ; |
| 10312 | |
| 10313 | |
| 10314 | VCLKIndex += 25 ; |
| 10315 | |
| 10316 | } |
| 10317 | } |
| 10318 | |
| 10319 | if ( pVBInfo->VBType & VB_XGI301LV ) /* 301lv */ |
| 10320 | { |
| 10321 | if ( !( pVBInfo->VBExtInfo == VB_YPbPr1080i ) ) |
| 10322 | { |
| 10323 | VCLKIndex = YPbPr750pVCLK ; |
| 10324 | if ( !( pVBInfo->VBExtInfo == VB_YPbPr750p ) ) |
| 10325 | { |
| 10326 | VCLKIndex = YPbPr525pVCLK ; |
| 10327 | if ( !( pVBInfo->VBExtInfo == VB_YPbPr525p ) ) |
| 10328 | { |
| 10329 | VCLKIndex = YPbPr525iVCLK_2 ; |
| 10330 | if ( !( pVBInfo->SetFlag & RPLLDIV2XO ) ) |
| 10331 | VCLKIndex = YPbPr525iVCLK ; |
| 10332 | } |
| 10333 | } |
| 10334 | } |
| 10335 | } |
| 10336 | } |
| 10337 | else |
| 10338 | { |
| 10339 | if ( pVBInfo->VBInfo & SetCRT2ToTV ) |
| 10340 | { |
| 10341 | if ( pVBInfo->SetFlag & RPLLDIV2XO ) |
| 10342 | { |
| 10343 | VCLKIndex = TVVCLKDIV2 ; |
| 10344 | |
| 10345 | |
| 10346 | VCLKIndex += 25 ; |
| 10347 | |
| 10348 | } |
| 10349 | else |
| 10350 | { |
| 10351 | VCLKIndex = TVVCLK ; |
| 10352 | |
| 10353 | |
| 10354 | VCLKIndex += 25 ; |
| 10355 | |
| 10356 | } |
| 10357 | } |
| 10358 | } |
| 10359 | } |
| 10360 | else |
| 10361 | { /* for CRT2 */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 10362 | VCLKIndex = (unsigned char)XGINew_GetReg2((pVBInfo->P3ca + 0x02)); /* Port 3cch */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 10363 | VCLKIndex = ( ( VCLKIndex >> 2 ) & 0x03 ) ; |
| 10364 | if ( ModeNo > 0x13 ) |
| 10365 | { |
| 10366 | VCLKIndex = pVBInfo->RefIndex[ RefreshRateTableIndex ].Ext_CRTVCLK ; /* di+Ext_CRTVCLK */ |
| 10367 | VCLKIndex &= IndexMask ; |
| 10368 | } |
| 10369 | } |
| 10370 | } |
| 10371 | } |
| 10372 | else |
| 10373 | { /* LVDS */ |
| 10374 | if ( ModeNo <= 0x13 ) |
| 10375 | VCLKIndex = CRT2Index ; |
| 10376 | else |
| 10377 | VCLKIndex = CRT2Index ; |
| 10378 | |
| 10379 | if ( pVBInfo->IF_DEF_CH7005 == 1 ) |
| 10380 | { |
| 10381 | if ( !( pVBInfo->VBInfo & SetCRT2ToLCD ) ) |
| 10382 | { |
| 10383 | VCLKIndex &= 0x1f ; |
| 10384 | tempbx = 0 ; |
| 10385 | |
| 10386 | if ( pVBInfo->VBInfo & SetPALTV ) |
| 10387 | tempbx += 2 ; |
| 10388 | |
| 10389 | if ( pVBInfo->VBInfo & SetCHTVOverScan ) |
| 10390 | tempbx += 1 ; |
| 10391 | |
| 10392 | switch( tempbx ) |
| 10393 | { |
| 10394 | case 0: |
| 10395 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC ; |
| 10396 | break ; |
| 10397 | case 1: |
| 10398 | CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC ; |
| 10399 | break; |
| 10400 | case 2: |
| 10401 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL ; |
| 10402 | break ; |
| 10403 | case 3: |
| 10404 | CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL ; |
| 10405 | break ; |
| 10406 | default: |
| 10407 | break ; |
| 10408 | } |
| 10409 | |
| 10410 | VCLKIndex = CHTVVCLKPtr[ VCLKIndex ] ; |
| 10411 | } |
| 10412 | } |
| 10413 | else |
| 10414 | { |
| 10415 | VCLKIndex = VCLKIndex >> 6 ; |
| 10416 | if ( ( pVBInfo->LCDResInfo == Panel800x600 ) || ( pVBInfo->LCDResInfo == Panel320x480 ) ) |
| 10417 | VCLKIndex = LVDSXlat1VCLK[ VCLKIndex ] ; |
| 10418 | else if ( ( pVBInfo->LCDResInfo == Panel1024x768 ) || ( pVBInfo->LCDResInfo == Panel1024x768x75 ) ) |
| 10419 | VCLKIndex = LVDSXlat2VCLK[ VCLKIndex ] ; |
| 10420 | else |
| 10421 | VCLKIndex = LVDSXlat3VCLK[ VCLKIndex ] ; |
| 10422 | } |
| 10423 | } |
| 10424 | /* VCLKIndex = VCLKIndex&IndexMask ; */ |
| 10425 | |
| 10426 | |
| 10427 | |
| 10428 | return( VCLKIndex ) ; |
| 10429 | } |
| 10430 | |