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, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 25 | struct xgi_hw_device_info *HwDeviceExtension, |
| 26 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 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, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 33 | unsigned short ModeIdIndex, |
| 34 | unsigned short RefreshRateTableIndex, |
| 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, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 37 | unsigned short *ModeIdIndex, |
| 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, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [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); |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [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, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 49 | unsigned short ModeIdIndex, |
| 50 | unsigned short RefreshRateTableIndex, |
| 51 | struct xgi_hw_device_info *HwDeviceExtension, |
| 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, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 54 | unsigned short ModeNo, |
| 55 | unsigned short ModeIdIndex, |
| 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, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 58 | unsigned short ModeIdIndex, |
| 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, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 61 | unsigned short ModeIdIndex, |
| 62 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 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, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 65 | unsigned short ModeIdIndex, |
| 66 | unsigned short RefreshRateTableIndex, |
| 67 | struct xgi_hw_device_info *HwDeviceExtension, |
| 68 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 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, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 125 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 126 | void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 127 | unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo); |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 128 | void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 129 | unsigned short RefreshRateTableIndex, |
| 130 | struct xgi_hw_device_info *HwDeviceExtension, |
| 131 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 132 | void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 133 | void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 134 | void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 135 | void XGI_GetVBType(struct vb_device_info *pVBInfo); |
| 136 | void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 137 | void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 138 | void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 139 | void InitTo330Pointer(unsigned char, struct vb_device_info *pVBInfo); |
| 140 | void XGI_GetLCDSync(unsigned short *HSyncWidth, unsigned short *VSyncWidth, struct vb_device_info *pVBInfo); |
| 141 | void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 142 | void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); |
| 143 | void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 144 | void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 145 | void XGI_SetDelayComp(struct vb_device_info *pVBInfo); |
| 146 | void XGI_SetLCDCap(struct vb_device_info *pVBInfo); |
| 147 | void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo); |
| 148 | void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo); |
| 149 | void SetSpectrum(struct vb_device_info *pVBInfo); |
| 150 | void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 151 | void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 152 | void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo); |
| 153 | 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] | 154 | void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char* tempcl, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 155 | unsigned char *tempch, struct vb_device_info *pVBInfo); |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 156 | unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo); |
| 157 | void XGI_SetCRT2ModeRegs(unsigned short ModeNo, struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); |
| 158 | void XGI_CloseCRTC(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); |
| 159 | void XGI_OpenCRTC(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); |
| 160 | void XGI_GetRAMDAC2DATA(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo); |
| 161 | void XGI_UnLockCRT2(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); |
| 162 | void XGI_LockCRT2(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo); |
| 163 | void XGINew_EnableCRT2(struct vb_device_info *pVBInfo); |
| 164 | void XGINew_LCD_Wait_Time(unsigned char DelayTime, struct vb_device_info *pVBInfo); |
| 165 | void XGI_LongWait(struct vb_device_info *pVBInfo); |
| 166 | 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] | 167 | void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 168 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 169 | unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 170 | unsigned short ModeNo, |
| 171 | unsigned short ModeIdIndex, |
| 172 | struct vb_device_info *pVBInfo); |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 173 | void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0, |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 174 | unsigned char *di_1, struct vb_device_info *pVBInfo); |
| 175 | unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo); |
| 176 | unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo); |
| 177 | struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx, struct vb_device_info *pVBInfo); |
| 178 | void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo); |
| 179 | void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo); |
| 180 | unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo); |
| 181 | unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo); |
| 182 | void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo); |
| 183 | void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo); |
| 184 | void XGI_XG21SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo); |
| 185 | unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 186 | void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 187 | void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo); |
| 188 | unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 189 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 190 | extern void ReadVBIOSTablData(unsigned char ChipType, struct vb_device_info *pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 191 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 192 | /* 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] | 193 | |
| 194 | |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 195 | static unsigned short XGINew_MDA_DAC[] = { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 196 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 197 | 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, |
| 198 | 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, |
| 199 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, |
| 200 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 201 | 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, |
| 202 | 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, |
| 203 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F}; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 204 | |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 205 | static unsigned short XGINew_CGA_DAC[] = { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 206 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, |
| 207 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, |
| 208 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, |
| 209 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, |
| 210 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, |
| 211 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, |
| 212 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, |
| 213 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F}; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 214 | |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 215 | static unsigned short XGINew_EGA_DAC[] = { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 216 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x05, 0x15, |
| 217 | 0x20, 0x30, 0x24, 0x34, 0x21, 0x31, 0x25, 0x35, |
| 218 | 0x08, 0x18, 0x0C, 0x1C, 0x09, 0x19, 0x0D, 0x1D, |
| 219 | 0x28, 0x38, 0x2C, 0x3C, 0x29, 0x39, 0x2D, 0x3D, |
| 220 | 0x02, 0x12, 0x06, 0x16, 0x03, 0x13, 0x07, 0x17, |
| 221 | 0x22, 0x32, 0x26, 0x36, 0x23, 0x33, 0x27, 0x37, |
| 222 | 0x0A, 0x1A, 0x0E, 0x1E, 0x0B, 0x1B, 0x0F, 0x1F, |
| 223 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F}; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 224 | |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 225 | static unsigned short XGINew_VGA_DAC[] = { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 226 | 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, |
| 227 | 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, |
| 228 | 0x00, 0x05, 0x08, 0x0B, 0x0E, 0x11, 0x14, 0x18, |
| 229 | 0x1C, 0x20, 0x24, 0x28, 0x2D, 0x32, 0x38, 0x3F, |
| 230 | 0x00, 0x10, 0x1F, 0x2F, 0x3F, 0x1F, 0x27, 0x2F, |
| 231 | 0x37, 0x3F, 0x2D, 0x31, 0x36, 0x3A, 0x3F, 0x00, |
| 232 | 0x07, 0x0E, 0x15, 0x1C, 0x0E, 0x11, 0x15, 0x18, |
| 233 | 0x1C, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x00, 0x04, |
| 234 | 0x08, 0x0C, 0x10, 0x08, 0x0A, 0x0C, 0x0E, 0x10, |
| 235 | 0x0B, 0x0C, 0x0D, 0x0F, 0x10}; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 236 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 237 | void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 238 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 239 | pVBInfo->SModeIDTable = (struct XGI_StStruct *) XGI330_SModeIDTable; |
| 240 | pVBInfo->StandTable = (struct XGI_StandTableStruct *) XGI330_StandTable; |
| 241 | pVBInfo->EModeIDTable = (struct XGI_ExtStruct *) XGI330_EModeIDTable; |
| 242 | pVBInfo->RefIndex = (struct XGI_Ext2Struct *) XGI330_RefIndex; |
| 243 | pVBInfo->XGINEWUB_CRT1Table |
| 244 | = (struct XGI_CRT1TableStruct *) XGI_CRT1Table; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 245 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 246 | /* add for new UNIVGABIOS */ |
| 247 | /* XGINew_UBLCDDataTable = (struct XGI_LCDDataTablStruct *) XGI_LCDDataTable; */ |
| 248 | /* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable; */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 249 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 250 | if (ChipType >= XG40) { |
| 251 | pVBInfo->MCLKData |
| 252 | = (struct XGI_MCLKDataStruct *) XGI340New_MCLKData; |
| 253 | pVBInfo->ECLKData |
| 254 | = (struct XGI_ECLKDataStruct *) XGI340_ECLKData; |
| 255 | } else { |
| 256 | pVBInfo->MCLKData |
| 257 | = (struct XGI_MCLKDataStruct *) XGI330New_MCLKData; |
| 258 | pVBInfo->ECLKData |
| 259 | = (struct XGI_ECLKDataStruct *) XGI330_ECLKData; |
| 260 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 261 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 262 | pVBInfo->VCLKData = (struct XGI_VCLKDataStruct *) XGI_VCLKData; |
| 263 | pVBInfo->VBVCLKData = (struct XGI_VBVCLKDataStruct *) XGI_VBVCLKData; |
| 264 | pVBInfo->ScreenOffset = XGI330_ScreenOffset; |
| 265 | pVBInfo->StResInfo = (struct XGI_StResInfoStruct *) XGI330_StResInfo; |
| 266 | pVBInfo->ModeResInfo |
| 267 | = (struct XGI_ModeResInfoStruct *) XGI330_ModeResInfo; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 268 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 269 | pVBInfo->pOutputSelect = &XGI330_OutputSelect; |
| 270 | pVBInfo->pSoftSetting = &XGI330_SoftSetting; |
| 271 | pVBInfo->pSR07 = &XGI330_SR07; |
| 272 | pVBInfo->LCDResInfo = 0; |
| 273 | pVBInfo->LCDTypeInfo = 0; |
| 274 | pVBInfo->LCDInfo = 0; |
| 275 | pVBInfo->VBInfo = 0; |
| 276 | pVBInfo->TVInfo = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 277 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 278 | pVBInfo->SR15 = XGI340_SR13; |
| 279 | pVBInfo->CR40 = XGI340_cr41; |
| 280 | pVBInfo->SR25 = XGI330_sr25; |
| 281 | pVBInfo->pSR31 = &XGI330_sr31; |
| 282 | pVBInfo->pSR32 = &XGI330_sr32; |
| 283 | pVBInfo->CR6B = XGI340_CR6B; |
| 284 | pVBInfo->CR6E = XGI340_CR6E; |
| 285 | pVBInfo->CR6F = XGI340_CR6F; |
| 286 | pVBInfo->CR89 = XGI340_CR89; |
| 287 | pVBInfo->AGPReg = XGI340_AGPReg; |
| 288 | pVBInfo->SR16 = XGI340_SR16; |
| 289 | pVBInfo->pCRCF = &XG40_CRCF; |
| 290 | pVBInfo->pXGINew_DRAMTypeDefinition = &XG40_DRAMTypeDefinition; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 291 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 292 | pVBInfo->CR49 = XGI330_CR49; |
| 293 | pVBInfo->pSR1F = &XGI330_SR1F; |
| 294 | pVBInfo->pSR21 = &XGI330_SR21; |
| 295 | pVBInfo->pSR22 = &XGI330_SR22; |
| 296 | pVBInfo->pSR23 = &XGI330_SR23; |
| 297 | pVBInfo->pSR24 = &XGI330_SR24; |
| 298 | pVBInfo->pSR33 = &XGI330_SR33; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 299 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 300 | pVBInfo->pCRT2Data_1_2 = &XGI330_CRT2Data_1_2; |
| 301 | pVBInfo->pCRT2Data_4_D = &XGI330_CRT2Data_4_D; |
| 302 | pVBInfo->pCRT2Data_4_E = &XGI330_CRT2Data_4_E; |
| 303 | pVBInfo->pCRT2Data_4_10 = &XGI330_CRT2Data_4_10; |
| 304 | pVBInfo->pRGBSenseData = &XGI330_RGBSenseData; |
| 305 | pVBInfo->pVideoSenseData = &XGI330_VideoSenseData; |
| 306 | pVBInfo->pYCSenseData = &XGI330_YCSenseData; |
| 307 | pVBInfo->pRGBSenseData2 = &XGI330_RGBSenseData2; |
| 308 | pVBInfo->pVideoSenseData2 = &XGI330_VideoSenseData2; |
| 309 | pVBInfo->pYCSenseData2 = &XGI330_YCSenseData2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 310 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 311 | pVBInfo->NTSCTiming = XGI330_NTSCTiming; |
| 312 | pVBInfo->PALTiming = XGI330_PALTiming; |
| 313 | pVBInfo->HiTVExtTiming = XGI330_HiTVExtTiming; |
| 314 | pVBInfo->HiTVSt1Timing = XGI330_HiTVSt1Timing; |
| 315 | pVBInfo->HiTVSt2Timing = XGI330_HiTVSt2Timing; |
| 316 | pVBInfo->HiTVTextTiming = XGI330_HiTVTextTiming; |
| 317 | pVBInfo->YPbPr750pTiming = XGI330_YPbPr750pTiming; |
| 318 | pVBInfo->YPbPr525pTiming = XGI330_YPbPr525pTiming; |
| 319 | pVBInfo->YPbPr525iTiming = XGI330_YPbPr525iTiming; |
| 320 | pVBInfo->HiTVGroup3Data = XGI330_HiTVGroup3Data; |
| 321 | pVBInfo->HiTVGroup3Simu = XGI330_HiTVGroup3Simu; |
| 322 | pVBInfo->HiTVGroup3Text = XGI330_HiTVGroup3Text; |
| 323 | pVBInfo->Ren525pGroup3 = XGI330_Ren525pGroup3; |
| 324 | pVBInfo->Ren750pGroup3 = XGI330_Ren750pGroup3; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 325 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 326 | pVBInfo->TimingH = (struct XGI_TimingHStruct *) XGI_TimingH; |
| 327 | pVBInfo->TimingV = (struct XGI_TimingVStruct *) XGI_TimingV; |
| 328 | pVBInfo->UpdateCRT1 = (struct XGI_XG21CRT1Struct *) XGI_UpdateCRT1Table; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 329 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 330 | pVBInfo->CHTVVCLKUNTSC = XGI330_CHTVVCLKUNTSC; |
| 331 | pVBInfo->CHTVVCLKONTSC = XGI330_CHTVVCLKONTSC; |
| 332 | pVBInfo->CHTVVCLKUPAL = XGI330_CHTVVCLKUPAL; |
| 333 | pVBInfo->CHTVVCLKOPAL = XGI330_CHTVVCLKOPAL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 334 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 335 | /* 310 customization related */ |
| 336 | if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType & VB_XGI302LV)) |
| 337 | pVBInfo->LCDCapList = XGI_LCDDLCapList; |
| 338 | else |
| 339 | pVBInfo->LCDCapList = XGI_LCDCapList; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 340 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 341 | if ((ChipType == XG21) || (ChipType == XG27)) |
| 342 | pVBInfo->XG21_LVDSCapList = XGI21_LCDCapList; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 343 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 344 | pVBInfo->XGI_TVDelayList = XGI301TVDelayList; |
| 345 | pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 346 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 347 | pVBInfo->pXGINew_I2CDefinition = &XG40_I2CDefinition; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 348 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 349 | if (ChipType >= XG20) |
| 350 | pVBInfo->pXGINew_CR97 = &XG20_CR97; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 351 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 352 | if (ChipType == XG27) { |
| 353 | pVBInfo->MCLKData |
| 354 | = (struct XGI_MCLKDataStruct *) XGI27New_MCLKData; |
| 355 | pVBInfo->CR40 = XGI27_cr41; |
| 356 | pVBInfo->pXGINew_CR97 = &XG27_CR97; |
| 357 | pVBInfo->pSR36 = &XG27_SR36; |
| 358 | pVBInfo->pCR8F = &XG27_CR8F; |
| 359 | pVBInfo->pCRD0 = XG27_CRD0; |
| 360 | pVBInfo->pCRDE = XG27_CRDE; |
| 361 | pVBInfo->pSR40 = &XG27_SR40; |
| 362 | pVBInfo->pSR41 = &XG27_SR41; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 363 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 364 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 365 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 366 | if (ChipType >= XG20) { |
| 367 | pVBInfo->pDVOSetting = &XG21_DVOSetting; |
| 368 | pVBInfo->pCR2E = &XG21_CR2E; |
| 369 | pVBInfo->pCR2F = &XG21_CR2F; |
| 370 | pVBInfo->pCR46 = &XG21_CR46; |
| 371 | pVBInfo->pCR47 = &XG21_CR47; |
| 372 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 373 | |
| 374 | } |
| 375 | |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 376 | unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 377 | unsigned short ModeNo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 378 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 379 | unsigned short ModeIdIndex; |
| 380 | /* unsigned char *pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; */ |
| 381 | struct vb_device_info VBINF; |
| 382 | struct vb_device_info *pVBInfo = &VBINF; |
| 383 | pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase; |
| 384 | pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress; |
| 385 | pVBInfo->IF_DEF_LVDS = 0; |
| 386 | pVBInfo->IF_DEF_CH7005 = 0; |
| 387 | pVBInfo->IF_DEF_LCDA = 1; |
| 388 | pVBInfo->IF_DEF_CH7017 = 0; |
| 389 | pVBInfo->IF_DEF_CH7007 = 0; /* [Billy] 2007/05/14 */ |
| 390 | pVBInfo->IF_DEF_VideoCapture = 0; |
| 391 | pVBInfo->IF_DEF_ScaleLCD = 0; |
| 392 | pVBInfo->IF_DEF_OEMUtil = 0; |
| 393 | pVBInfo->IF_DEF_PWD = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 394 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 395 | if (HwDeviceExtension->jChipType >= XG20) { /* kuku 2004/06/25 */ |
| 396 | pVBInfo->IF_DEF_YPbPr = 0; |
| 397 | pVBInfo->IF_DEF_HiVision = 0; |
| 398 | pVBInfo->IF_DEF_CRT2Monitor = 0; |
| 399 | pVBInfo->VBType = 0; /*set VBType default 0*/ |
| 400 | } else if (HwDeviceExtension->jChipType >= XG40) { |
| 401 | pVBInfo->IF_DEF_YPbPr = 1; |
| 402 | pVBInfo->IF_DEF_HiVision = 1; |
| 403 | pVBInfo->IF_DEF_CRT2Monitor = 1; |
| 404 | } else { |
| 405 | pVBInfo->IF_DEF_YPbPr = 1; |
| 406 | pVBInfo->IF_DEF_HiVision = 1; |
| 407 | pVBInfo->IF_DEF_CRT2Monitor = 0; |
| 408 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 409 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 410 | pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14; |
| 411 | pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24; |
| 412 | pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10; |
| 413 | pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e; |
| 414 | pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12; |
| 415 | pVBInfo->P3cc = pVBInfo->BaseAddr + 0x1C; |
| 416 | pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a; |
| 417 | pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16; |
| 418 | pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17; |
| 419 | pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18; |
| 420 | pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19; |
| 421 | pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A; |
| 422 | pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00; |
| 423 | pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04; |
| 424 | pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10; |
| 425 | pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12; |
| 426 | pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14; |
| 427 | pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 428 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 429 | if (HwDeviceExtension->jChipType == XG21) { /* for x86 Linux, XG21 LVDS */ |
| 430 | if ((XGINew_GetReg1(pVBInfo->P3d4, 0x38) & 0xE0) == 0xC0) |
| 431 | pVBInfo->IF_DEF_LVDS = 1; |
| 432 | } |
| 433 | if (HwDeviceExtension->jChipType == XG27) { |
| 434 | if ((XGINew_GetReg1(pVBInfo->P3d4, 0x38) & 0xE0) == 0xC0) { |
| 435 | if (XGINew_GetReg1(pVBInfo->P3d4, 0x30) & 0x20) |
| 436 | pVBInfo->IF_DEF_LVDS = 1; |
| 437 | } |
| 438 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 439 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 440 | if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */ |
| 441 | XGI_GetVBType(pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 442 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 443 | InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo); |
| 444 | if (ModeNo & 0x80) { |
| 445 | ModeNo = ModeNo & 0x7F; |
| 446 | /* XGINew_flag_clearbuffer = 0; */ |
| 447 | } |
| 448 | /* else { |
| 449 | XGINew_flag_clearbuffer = 1; |
| 450 | } |
| 451 | */ |
| 452 | XGINew_SetReg1(pVBInfo->P3c4, 0x05, 0x86); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 453 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 454 | if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 1.Openkey */ |
| 455 | XGI_UnLockCRT2(HwDeviceExtension, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 456 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 457 | XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 458 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 459 | XGI_GetVGAType(HwDeviceExtension, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 460 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 461 | if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ |
| 462 | XGI_GetVBInfo(ModeNo, ModeIdIndex, HwDeviceExtension, pVBInfo); |
| 463 | XGI_GetTVInfo(ModeNo, ModeIdIndex, pVBInfo); |
| 464 | XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo); |
| 465 | XGI_DisableBridge(HwDeviceExtension, pVBInfo); |
| 466 | /* XGI_OpenCRTC(HwDeviceExtension, pVBInfo); */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 467 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 468 | if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) { |
| 469 | XGI_SetCRT1Group(HwDeviceExtension, ModeNo, |
| 470 | ModeIdIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 471 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 472 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) { |
| 473 | XGI_SetLCDAGroup(ModeNo, ModeIdIndex, |
| 474 | HwDeviceExtension, pVBInfo); |
| 475 | } |
| 476 | } else { |
| 477 | if (!(pVBInfo->VBInfo & SwitchToCRT2)) { |
| 478 | XGI_SetCRT1Group(HwDeviceExtension, ModeNo, |
| 479 | ModeIdIndex, pVBInfo); |
| 480 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) { |
| 481 | XGI_SetLCDAGroup(ModeNo, ModeIdIndex, |
| 482 | HwDeviceExtension, |
| 483 | pVBInfo); |
| 484 | } |
| 485 | } |
| 486 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 487 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 488 | if (pVBInfo->VBInfo & (SetSimuScanMode | SwitchToCRT2)) { |
| 489 | switch (HwDeviceExtension->ujVBChipID) { |
| 490 | case VB_CHIP_301: |
| 491 | XGI_SetCRT2Group301(ModeNo, HwDeviceExtension, |
| 492 | pVBInfo); /*add for CRT2 */ |
| 493 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 494 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 495 | case VB_CHIP_302: |
| 496 | XGI_SetCRT2Group301(ModeNo, HwDeviceExtension, |
| 497 | pVBInfo); /*add for CRT2 */ |
| 498 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 499 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 500 | default: |
| 501 | break; |
| 502 | } |
| 503 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 504 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 505 | XGI_SetCRT2ModeRegs(ModeNo, HwDeviceExtension, pVBInfo); |
| 506 | XGI_OEM310Setting(ModeNo, ModeIdIndex, pVBInfo); /*0212*/ |
| 507 | XGI_CloseCRTC(HwDeviceExtension, pVBInfo); |
| 508 | XGI_EnableBridge(HwDeviceExtension, pVBInfo); |
| 509 | } /* !XG20 */ |
| 510 | else { |
| 511 | if (pVBInfo->IF_DEF_LVDS == 1) |
| 512 | if (!XGI_XG21CheckLVDSMode(ModeNo, ModeIdIndex, pVBInfo)) |
| 513 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 514 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 515 | if (ModeNo <= 0x13) { |
| 516 | pVBInfo->ModeType |
| 517 | = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag |
| 518 | & ModeInfoFlag; |
| 519 | } else { |
| 520 | pVBInfo->ModeType |
| 521 | = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag |
| 522 | & ModeInfoFlag; |
| 523 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 524 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 525 | pVBInfo->SetFlag = 0; |
| 526 | if (pVBInfo->IF_DEF_CH7007 != 1) |
| 527 | pVBInfo->VBInfo = DisableCRT2Display; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 528 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 529 | XGI_DisplayOff(HwDeviceExtension, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 530 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 531 | XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex, |
| 532 | pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 533 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 534 | XGI_DisplayOn(HwDeviceExtension, pVBInfo); |
| 535 | /* |
| 536 | if (HwDeviceExtension->jChipType == XG21) |
| 537 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x09, ~0x80, 0x80); |
| 538 | */ |
| 539 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 540 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 541 | /* |
| 542 | if (ModeNo <= 0x13) { |
| 543 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 544 | } else { |
| 545 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 546 | } |
| 547 | pVBInfo->ModeType = modeflag&ModeInfoFlag; |
| 548 | pVBInfo->SetFlag = 0x00; |
| 549 | pVBInfo->VBInfo = DisableCRT2Display; |
| 550 | temp = XGINew_CheckMemorySize(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 551 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 552 | if (temp == 0) |
| 553 | return (0); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 554 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 555 | XGI_DisplayOff(HwDeviceExtension, pVBInfo) ; |
| 556 | XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo); |
| 557 | XGI_DisplayOn(HwDeviceExtension, pVBInfo); |
| 558 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 559 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 560 | XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 561 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 562 | if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ |
| 563 | XGI_LockCRT2(HwDeviceExtension, pVBInfo); |
| 564 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 565 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 566 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 567 | } |
| 568 | |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 569 | void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 570 | unsigned short ModeNo, unsigned short ModeIdIndex, |
| 571 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 572 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 573 | unsigned short StandTableIndex, RefreshRateTableIndex, b3CC, temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 574 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 575 | unsigned short XGINew_P3cc = pVBInfo->P3cc; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 576 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 577 | /* XGINew_CRT1Mode = ModeNo; // SaveModeID */ |
| 578 | StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo); |
| 579 | /* XGI_SetBIOSData(ModeNo, ModeIdIndex); */ |
| 580 | /* XGI_ClearBankRegs(ModeNo, ModeIdIndex); */ |
| 581 | XGI_SetSeqRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo); |
| 582 | XGI_SetMiscRegs(StandTableIndex, pVBInfo); |
| 583 | XGI_SetCRTCRegs(HwDeviceExtension, StandTableIndex, pVBInfo); |
| 584 | XGI_SetATTRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo); |
| 585 | XGI_SetGRCRegs(StandTableIndex, pVBInfo); |
| 586 | XGI_ClearExt1Regs(pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 587 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 588 | /* if (pVBInfo->IF_DEF_ExpLink) */ |
| 589 | if (HwDeviceExtension->jChipType == XG27) { |
| 590 | if (pVBInfo->IF_DEF_LVDS == 0) |
| 591 | XGI_SetDefaultVCLK(pVBInfo); |
| 592 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 593 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 594 | temp = ~ProgrammingCRT2; |
| 595 | pVBInfo->SetFlag &= temp; |
| 596 | pVBInfo->SelectCRT2Rate = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 597 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 598 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 599 | | VB_XGI302LV | VB_XGI301C)) { |
| 600 | if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA |
| 601 | | SetInSlaveMode)) { |
| 602 | pVBInfo->SetFlag |= ProgrammingCRT2; |
| 603 | } |
| 604 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 605 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 606 | RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, |
| 607 | ModeIdIndex, pVBInfo); |
| 608 | if (RefreshRateTableIndex != 0xFFFF) { |
| 609 | XGI_SetSync(RefreshRateTableIndex, pVBInfo); |
| 610 | XGI_SetCRT1CRTC(ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 611 | pVBInfo, HwDeviceExtension); |
| 612 | XGI_SetCRT1DE(HwDeviceExtension, ModeNo, ModeIdIndex, |
| 613 | RefreshRateTableIndex, pVBInfo); |
| 614 | XGI_SetCRT1Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 615 | HwDeviceExtension, pVBInfo); |
| 616 | XGI_SetCRT1VCLK(ModeNo, ModeIdIndex, HwDeviceExtension, |
| 617 | RefreshRateTableIndex, pVBInfo); |
| 618 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 619 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 620 | if ((HwDeviceExtension->jChipType >= XG20) |
| 621 | && (HwDeviceExtension->jChipType < XG27)) { /* fix H/W DCLK/2 bug */ |
| 622 | if ((ModeNo == 0x00) | (ModeNo == 0x01)) { |
| 623 | XGINew_SetReg1(pVBInfo->P3c4, 0x2B, 0x4E); |
| 624 | XGINew_SetReg1(pVBInfo->P3c4, 0x2C, 0xE9); |
| 625 | b3CC = (unsigned char) XGINew_GetReg2(XGINew_P3cc); |
| 626 | XGINew_SetReg3(XGINew_P3cc, (b3CC |= 0x0C)); |
| 627 | } else if ((ModeNo == 0x04) | (ModeNo == 0x05) | (ModeNo |
| 628 | == 0x0D)) { |
| 629 | XGINew_SetReg1(pVBInfo->P3c4, 0x2B, 0x1B); |
| 630 | XGINew_SetReg1(pVBInfo->P3c4, 0x2C, 0xE3); |
| 631 | b3CC = (unsigned char) XGINew_GetReg2(XGINew_P3cc); |
| 632 | XGINew_SetReg3(XGINew_P3cc, (b3CC |= 0x0C)); |
| 633 | } |
| 634 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 635 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 636 | if (HwDeviceExtension->jChipType >= XG21) { |
| 637 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x38); |
| 638 | if (temp & 0xA0) { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 639 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 640 | /* XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x20); *//* Enable write GPIOF */ |
| 641 | /* XGINew_SetRegAND(pVBInfo->P3d4, 0x48, ~0x20); *//* P. DWN */ |
| 642 | /* XG21 CRT1 Timing */ |
| 643 | if (HwDeviceExtension->jChipType == XG27) |
| 644 | XGI_SetXG27CRTC(ModeNo, ModeIdIndex, |
| 645 | RefreshRateTableIndex, pVBInfo); |
| 646 | else |
| 647 | XGI_SetXG21CRTC(ModeNo, ModeIdIndex, |
| 648 | RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 649 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 650 | XGI_UpdateXG21CRTC(ModeNo, pVBInfo, |
| 651 | RefreshRateTableIndex); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 652 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 653 | if (HwDeviceExtension->jChipType == XG27) |
| 654 | XGI_SetXG27LCD(pVBInfo, RefreshRateTableIndex, |
| 655 | ModeNo); |
| 656 | else |
| 657 | XGI_SetXG21LCD(pVBInfo, RefreshRateTableIndex, |
| 658 | ModeNo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 659 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 660 | if (pVBInfo->IF_DEF_LVDS == 1) { |
| 661 | if (HwDeviceExtension->jChipType == XG27) |
| 662 | XGI_SetXG27LVDSPara(ModeNo, |
| 663 | ModeIdIndex, pVBInfo); |
| 664 | else |
| 665 | XGI_SetXG21LVDSPara(ModeNo, |
| 666 | ModeIdIndex, pVBInfo); |
| 667 | } |
| 668 | /* XGINew_SetRegOR(pVBInfo->P3d4, 0x48, 0x20); *//* P. ON */ |
| 669 | } |
| 670 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 671 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 672 | pVBInfo->SetFlag &= (~ProgrammingCRT2); |
| 673 | XGI_SetCRT1FIFO(ModeNo, HwDeviceExtension, pVBInfo); |
| 674 | XGI_SetCRT1ModeRegs(HwDeviceExtension, ModeNo, ModeIdIndex, |
| 675 | RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 676 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 677 | /* XGI_LoadCharacter(); //dif ifdef TVFont */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 678 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 679 | XGI_LoadDAC(ModeNo, ModeIdIndex, pVBInfo); |
| 680 | /* XGI_ClearBuffer(HwDeviceExtension, ModeNo, pVBInfo); */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 681 | } |
| 682 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 683 | unsigned char XGI_GetModePtr(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 684 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 685 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 686 | unsigned char index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 687 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 688 | if (ModeNo <= 0x13) |
| 689 | index = pVBInfo->SModeIDTable[ModeIdIndex].St_StTableIndex; |
| 690 | else { |
| 691 | if (pVBInfo->ModeType <= 0x02) |
| 692 | index = 0x1B; /* 02 -> ModeEGA */ |
| 693 | else |
| 694 | index = 0x0F; |
| 695 | } |
| 696 | return index; /* Get pVBInfo->StandTable index */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 697 | } |
| 698 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 699 | /* |
| 700 | unsigned char XGI_SetBIOSData(unsigned short ModeNo, unsigned short ModeIdIndex) { |
| 701 | return (0); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 702 | } |
| 703 | */ |
| 704 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 705 | /* unsigned char XGI_ClearBankRegs(unsigned short ModeNo, unsigned short ModeIdIndex) { |
| 706 | return( 0 ) ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 707 | } |
| 708 | */ |
| 709 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 710 | void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 711 | unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 712 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 713 | unsigned char tempah, SRdata; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 714 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 715 | unsigned short i, modeflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 716 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 717 | if (ModeNo <= 0x13) |
| 718 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 719 | else |
| 720 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 721 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 722 | XGINew_SetReg1(pVBInfo->P3c4, 0x00, 0x03); /* Set SR0 */ |
| 723 | tempah = pVBInfo->StandTable[StandTableIndex].SR[0]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 724 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 725 | i = SetCRT2ToLCDA; |
| 726 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) { |
| 727 | tempah |= 0x01; |
| 728 | } else { |
| 729 | if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD)) { |
| 730 | if (pVBInfo->VBInfo & SetInSlaveMode) |
| 731 | tempah |= 0x01; |
| 732 | } |
| 733 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 734 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 735 | tempah |= 0x20; /* screen off */ |
| 736 | XGINew_SetReg1(pVBInfo->P3c4, 0x01, tempah); /* Set SR1 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 737 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 738 | for (i = 02; i <= 04; i++) { |
| 739 | SRdata = pVBInfo->StandTable[StandTableIndex].SR[i - 1]; /* Get SR2,3,4 from file */ |
| 740 | XGINew_SetReg1(pVBInfo->P3c4, i, SRdata); /* Set SR2 3 4 */ |
| 741 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 742 | } |
| 743 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 744 | void XGI_SetMiscRegs(unsigned short StandTableIndex, |
| 745 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 746 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 747 | unsigned char Miscdata; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 748 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 749 | Miscdata = pVBInfo->StandTable[StandTableIndex].MISC; /* Get Misc from file */ |
| 750 | /* |
| 751 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) { |
| 752 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) { |
| 753 | Miscdata |= 0x0C; |
| 754 | } |
| 755 | } |
| 756 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 757 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 758 | XGINew_SetReg3(pVBInfo->P3c2, Miscdata); /* Set Misc(3c2) */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 759 | } |
| 760 | |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 761 | void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 762 | unsigned short StandTableIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 763 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 764 | unsigned char CRTCdata; |
| 765 | unsigned short i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 766 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 767 | CRTCdata = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
| 768 | CRTCdata &= 0x7f; |
| 769 | XGINew_SetReg1(pVBInfo->P3d4, 0x11, CRTCdata); /* Unlock CRTC */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 770 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 771 | for (i = 0; i <= 0x18; i++) { |
| 772 | CRTCdata = pVBInfo->StandTable[StandTableIndex].CRTC[i]; /* Get CRTC from file */ |
| 773 | XGINew_SetReg1(pVBInfo->P3d4, i, CRTCdata); /* Set CRTC(3d4) */ |
| 774 | } |
| 775 | /* |
| 776 | if ((HwDeviceExtension->jChipType == XGI_630) && (HwDeviceExtension->jChipRevision == 0x30)) { |
| 777 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 778 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { |
| 779 | XGINew_SetReg1(pVBInfo->P3d4, 0x18, 0xFE); |
| 780 | } |
| 781 | } |
| 782 | } |
| 783 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 784 | } |
| 785 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 786 | void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 787 | unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 788 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 789 | unsigned char ARdata; |
| 790 | unsigned short i, modeflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 791 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 792 | if (ModeNo <= 0x13) |
| 793 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 794 | else |
| 795 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 796 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 797 | for (i = 0; i <= 0x13; i++) { |
| 798 | ARdata = pVBInfo->StandTable[StandTableIndex].ATTR[i]; |
| 799 | if (modeflag & Charx8Dot) { /* ifndef Dot9 */ |
| 800 | if (i == 0x13) { |
| 801 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) { |
| 802 | ARdata = 0; |
| 803 | } else { |
| 804 | if (pVBInfo->VBInfo & (SetCRT2ToTV |
| 805 | | SetCRT2ToLCD)) { |
| 806 | if (pVBInfo->VBInfo |
| 807 | & SetInSlaveMode) |
| 808 | ARdata = 0; |
| 809 | } |
| 810 | } |
| 811 | } |
| 812 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 813 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 814 | XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */ |
| 815 | XGINew_SetReg3(pVBInfo->P3c0, i); /* set index */ |
| 816 | XGINew_SetReg3(pVBInfo->P3c0, ARdata); /* set data */ |
| 817 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 818 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 819 | XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */ |
| 820 | XGINew_SetReg3(pVBInfo->P3c0, 0x14); /* set index */ |
| 821 | XGINew_SetReg3(pVBInfo->P3c0, 0x00); /* set data */ |
| 822 | XGINew_GetReg2(pVBInfo->P3da); /* Enable Attribute */ |
| 823 | XGINew_SetReg3(pVBInfo->P3c0, 0x20); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 824 | } |
| 825 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 826 | void XGI_SetGRCRegs(unsigned short StandTableIndex, |
| 827 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 828 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 829 | unsigned char GRdata; |
| 830 | unsigned short i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 831 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 832 | for (i = 0; i <= 0x08; i++) { |
| 833 | GRdata = pVBInfo->StandTable[StandTableIndex].GRC[i]; /* Get GR from file */ |
| 834 | XGINew_SetReg1(pVBInfo->P3ce, i, GRdata); /* Set GR(3ce) */ |
| 835 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 836 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 837 | if (pVBInfo->ModeType > ModeVGA) { |
| 838 | GRdata = (unsigned char) XGINew_GetReg1(pVBInfo->P3ce, 0x05); |
| 839 | GRdata &= 0xBF; /* 256 color disable */ |
| 840 | XGINew_SetReg1(pVBInfo->P3ce, 0x05, GRdata); |
| 841 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 842 | } |
| 843 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 844 | void XGI_ClearExt1Regs(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 845 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 846 | unsigned short i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 847 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 848 | for (i = 0x0A; i <= 0x0E; i++) |
| 849 | XGINew_SetReg1(pVBInfo->P3c4, i, 0x00); /* Clear SR0A-SR0E */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 850 | } |
| 851 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 852 | unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 853 | { |
| 854 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 855 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x31, ~0x30, 0x20); |
| 856 | XGINew_SetReg1(pVBInfo->P3c4, 0x2B, pVBInfo->VCLKData[0].SR2B); |
| 857 | XGINew_SetReg1(pVBInfo->P3c4, 0x2C, pVBInfo->VCLKData[0].SR2C); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 858 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 859 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x31, ~0x30, 0x10); |
| 860 | XGINew_SetReg1(pVBInfo->P3c4, 0x2B, pVBInfo->VCLKData[1].SR2B); |
| 861 | XGINew_SetReg1(pVBInfo->P3c4, 0x2C, pVBInfo->VCLKData[1].SR2C); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 862 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 863 | XGINew_SetRegAND(pVBInfo->P3c4, 0x31, ~0x30); |
| 864 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 865 | } |
| 866 | |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 867 | unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 868 | unsigned short ModeNo, unsigned short ModeIdIndex, |
| 869 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 870 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 871 | short LCDRefreshIndex[] = { 0x00, 0x00, 0x03, 0x01 }, |
| 872 | LCDARefreshIndex[] = { 0x00, 0x00, 0x03, 0x01, 0x01, |
| 873 | 0x01, 0x01 }; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 874 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 875 | unsigned short RefreshRateTableIndex, i, modeflag, index, temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 876 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 877 | if (ModeNo <= 0x13) |
| 878 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 879 | else |
| 880 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 881 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 882 | if (pVBInfo->IF_DEF_CH7005 == 1) { |
| 883 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 884 | if (modeflag & HalfDCLK) |
| 885 | return 0; |
| 886 | } |
| 887 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 888 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 889 | if (ModeNo < 0x14) |
| 890 | return 0xFFFF; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 891 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 892 | index = XGINew_GetReg1(pVBInfo->P3d4, 0x33); |
| 893 | index = index >> pVBInfo->SelectCRT2Rate; |
| 894 | index &= 0x0F; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 895 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 896 | if (pVBInfo->LCDInfo & LCDNonExpanding) |
| 897 | index = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 898 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 899 | if (index > 0) |
| 900 | index--; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 901 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 902 | if (pVBInfo->SetFlag & ProgrammingCRT2) { |
| 903 | if (pVBInfo->IF_DEF_CH7005 == 1) { |
| 904 | if (pVBInfo->VBInfo & SetCRT2ToTV) |
| 905 | index = 0; |
| 906 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 907 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 908 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { |
| 909 | if (pVBInfo->IF_DEF_LVDS == 0) { |
| 910 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B |
| 911 | | VB_XGI301LV | VB_XGI302LV |
| 912 | | VB_XGI301C)) |
| 913 | temp |
| 914 | = LCDARefreshIndex[pVBInfo->LCDResInfo |
| 915 | & 0x0F]; /* 301b */ |
| 916 | else |
| 917 | temp |
| 918 | = LCDRefreshIndex[pVBInfo->LCDResInfo |
| 919 | & 0x0F]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 920 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 921 | if (index > temp) |
| 922 | index = temp; |
| 923 | } else { |
| 924 | index = 0; |
| 925 | } |
| 926 | } |
| 927 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 928 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 929 | RefreshRateTableIndex = pVBInfo->EModeIDTable[ModeIdIndex].REFindex; |
| 930 | ModeNo = pVBInfo->RefIndex[RefreshRateTableIndex].ModeID; |
| 931 | if (pXGIHWDE->jChipType >= XG20) { /* for XG20, XG21, XG27 */ |
| 932 | /* |
| 933 | if (pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag & XG2xNotSupport) { |
| 934 | index++; |
| 935 | } |
| 936 | */ |
| 937 | if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 800) |
| 938 | && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes |
| 939 | == 600)) { |
| 940 | index++; |
| 941 | } |
| 942 | /* Alan 10/19/2007; do the similiar adjustment like XGISearchCRT1Rate() */ |
| 943 | if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1024) |
| 944 | && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes |
| 945 | == 768)) { |
| 946 | index++; |
| 947 | } |
| 948 | if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1280) |
| 949 | && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes |
| 950 | == 1024)) { |
| 951 | index++; |
| 952 | } |
| 953 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 954 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 955 | i = 0; |
| 956 | do { |
| 957 | if (pVBInfo->RefIndex[RefreshRateTableIndex + i].ModeID |
| 958 | != ModeNo) |
| 959 | break; |
| 960 | temp |
| 961 | = pVBInfo->RefIndex[RefreshRateTableIndex + i].Ext_InfoFlag; |
| 962 | temp &= ModeInfoFlag; |
| 963 | if (temp < pVBInfo->ModeType) |
| 964 | break; |
| 965 | i++; |
| 966 | index--; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 967 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 968 | } while (index != 0xFFFF); |
| 969 | if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) { |
| 970 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 971 | temp |
| 972 | = pVBInfo->RefIndex[RefreshRateTableIndex |
| 973 | + i - 1].Ext_InfoFlag; |
| 974 | if (temp & InterlaceMode) |
| 975 | i++; |
| 976 | } |
| 977 | } |
| 978 | i--; |
| 979 | if ((pVBInfo->SetFlag & ProgrammingCRT2)) { |
| 980 | temp = XGI_AjustCRT2Rate(ModeNo, ModeIdIndex, |
| 981 | RefreshRateTableIndex, &i, pVBInfo); |
| 982 | } |
| 983 | return RefreshRateTableIndex + i; /* return (0x01 | (temp1<<1)); */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 984 | } |
| 985 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 986 | unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo, |
| 987 | unsigned short ModeIdIndex, |
| 988 | unsigned short RefreshRateTableIndex, unsigned short *i, |
| 989 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 990 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 991 | unsigned short tempax, tempbx, resinfo, modeflag, infoflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 992 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 993 | if (ModeNo <= 0x13) |
| 994 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ModeFlag */ |
| 995 | else |
| 996 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 997 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 998 | resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; |
| 999 | tempbx = pVBInfo->RefIndex[RefreshRateTableIndex + (*i)].ModeID; |
| 1000 | tempax = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1001 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1002 | if (pVBInfo->IF_DEF_LVDS == 0) { |
| 1003 | if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) { |
| 1004 | tempax |= SupportRAMDAC2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1005 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1006 | if (pVBInfo->VBType & VB_XGI301C) |
| 1007 | tempax |= SupportCRT2in301C; |
| 1008 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1009 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1010 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /* 301b */ |
| 1011 | tempax |= SupportLCD; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1012 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1013 | if (pVBInfo->LCDResInfo != Panel1280x1024) { |
| 1014 | if (pVBInfo->LCDResInfo != Panel1280x960) { |
| 1015 | if (pVBInfo->LCDInfo & LCDNonExpanding) { |
| 1016 | if (resinfo >= 9) { |
| 1017 | tempax = 0; |
| 1018 | return 0; |
| 1019 | } |
| 1020 | } |
| 1021 | } |
| 1022 | } |
| 1023 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1024 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1025 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { /* for HiTV */ |
| 1026 | if ((pVBInfo->VBType & VB_XGI301LV) |
| 1027 | && (pVBInfo->VBExtInfo == VB_YPbPr1080i)) { |
| 1028 | tempax |= SupportYPbPr; |
| 1029 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 1030 | if (resinfo == 4) |
| 1031 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1032 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1033 | if (resinfo == 3) |
| 1034 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1035 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1036 | if (resinfo > 7) |
| 1037 | return 0; |
| 1038 | } |
| 1039 | } else { |
| 1040 | tempax |= SupportHiVisionTV; |
| 1041 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 1042 | if (resinfo == 4) |
| 1043 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1044 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1045 | if (resinfo == 3) { |
| 1046 | if (pVBInfo->SetFlag |
| 1047 | & TVSimuMode) |
| 1048 | return 0; |
| 1049 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1050 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1051 | if (resinfo > 7) |
| 1052 | return 0; |
| 1053 | } |
| 1054 | } |
| 1055 | } else { |
| 1056 | if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO |
| 1057 | | SetCRT2ToSVIDEO | SetCRT2ToSCART |
| 1058 | | SetCRT2ToYPbPr | SetCRT2ToHiVisionTV)) { |
| 1059 | tempax |= SupportTV; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1060 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1061 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B |
| 1062 | | VB_XGI301LV | VB_XGI302LV |
| 1063 | | VB_XGI301C)) { |
| 1064 | tempax |= SupportTV1024; |
| 1065 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1066 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1067 | if (!(pVBInfo->VBInfo & SetPALTV)) { |
| 1068 | if (modeflag & NoSupportSimuTV) { |
| 1069 | if (pVBInfo->VBInfo |
| 1070 | & SetInSlaveMode) { |
| 1071 | if (!(pVBInfo->VBInfo |
| 1072 | & SetNotSimuMode)) { |
| 1073 | return 0; |
| 1074 | } |
| 1075 | } |
| 1076 | } |
| 1077 | } |
| 1078 | } |
| 1079 | } |
| 1080 | } else { /* for LVDS */ |
| 1081 | if (pVBInfo->IF_DEF_CH7005 == 1) { |
| 1082 | if (pVBInfo->VBInfo & SetCRT2ToTV) |
| 1083 | tempax |= SupportCHTV; |
| 1084 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1085 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1086 | if (pVBInfo->VBInfo & SetCRT2ToLCD) { |
| 1087 | tempax |= SupportLCD; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1088 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1089 | if (resinfo > 0x08) |
| 1090 | return 0; /* 1024x768 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1091 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1092 | if (pVBInfo->LCDResInfo < Panel1024x768) { |
| 1093 | if (resinfo > 0x07) |
| 1094 | return 0; /* 800x600 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1095 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1096 | if (resinfo == 0x04) |
| 1097 | return 0; /* 512x384 */ |
| 1098 | } |
| 1099 | } |
| 1100 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1101 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1102 | for (; pVBInfo->RefIndex[RefreshRateTableIndex + (*i)].ModeID == tempbx; (*i)--) { |
| 1103 | infoflag |
| 1104 | = pVBInfo->RefIndex[RefreshRateTableIndex |
| 1105 | + (*i)].Ext_InfoFlag; |
| 1106 | if (infoflag & tempax) |
| 1107 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1108 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1109 | if ((*i) == 0) |
| 1110 | break; |
| 1111 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1112 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1113 | for ((*i) = 0;; (*i)++) { |
| 1114 | infoflag |
| 1115 | = pVBInfo->RefIndex[RefreshRateTableIndex |
| 1116 | + (*i)].Ext_InfoFlag; |
| 1117 | if (pVBInfo->RefIndex[RefreshRateTableIndex + (*i)].ModeID |
| 1118 | != tempbx) { |
| 1119 | return 0; |
| 1120 | } |
| 1121 | |
| 1122 | if (infoflag & tempax) |
| 1123 | return 1; |
| 1124 | } |
| 1125 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1126 | } |
| 1127 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1128 | void XGI_SetSync(unsigned short RefreshRateTableIndex, |
| 1129 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1130 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1131 | unsigned short sync, temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1132 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1133 | sync = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag >> 8; /* di+0x00 */ |
| 1134 | sync &= 0xC0; |
| 1135 | temp = 0x2F; |
| 1136 | temp |= sync; |
| 1137 | XGINew_SetReg3(pVBInfo->P3c2, temp); /* Set Misc(3c2) */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1138 | } |
| 1139 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1140 | void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1141 | unsigned short RefreshRateTableIndex, |
| 1142 | struct vb_device_info *pVBInfo, |
| 1143 | struct xgi_hw_device_info *HwDeviceExtension) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1144 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1145 | unsigned char index, data; |
| 1146 | unsigned short i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1147 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1148 | index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; /* Get index */ |
| 1149 | index = index & IndexMask; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1150 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1151 | data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
| 1152 | data &= 0x7F; |
| 1153 | XGINew_SetReg1(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1154 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1155 | for (i = 0; i < 8; i++) |
| 1156 | pVBInfo->TimingH[0].data[i] |
| 1157 | = pVBInfo->XGINEWUB_CRT1Table[index].CR[i]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1158 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1159 | for (i = 0; i < 7; i++) |
| 1160 | pVBInfo->TimingV[0].data[i] |
| 1161 | = pVBInfo->XGINEWUB_CRT1Table[index].CR[i + 8]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1162 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1163 | XGI_SetCRT1Timing_H(pVBInfo, HwDeviceExtension); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1164 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1165 | XGI_SetCRT1Timing_V(ModeIdIndex, ModeNo, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1166 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1167 | if (pVBInfo->ModeType > 0x03) |
| 1168 | XGINew_SetReg1(pVBInfo->P3d4, 0x14, 0x4F); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1169 | } |
| 1170 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1171 | void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo, |
| 1172 | struct xgi_hw_device_info *HwDeviceExtension) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1173 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1174 | unsigned char data, data1, pushax; |
| 1175 | unsigned short i, j; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1176 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1177 | /* XGINew_SetReg1(pVBInfo->P3d4, 0x51, 0); */ |
| 1178 | /* XGINew_SetReg1(pVBInfo->P3d4, 0x56, 0); */ |
| 1179 | /* XGINew_SetRegANDOR(pVBInfo->P3d4, 0x11, 0x7f, 0x00); */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1180 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1181 | data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11); /* unlock cr0-7 */ |
| 1182 | data &= 0x7F; |
| 1183 | XGINew_SetReg1(pVBInfo->P3d4, 0x11, data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1184 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1185 | data = pVBInfo->TimingH[0].data[0]; |
| 1186 | XGINew_SetReg1(pVBInfo->P3d4, 0, data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1187 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1188 | for (i = 0x01; i <= 0x04; i++) { |
| 1189 | data = pVBInfo->TimingH[0].data[i]; |
| 1190 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 1), data); |
| 1191 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1192 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1193 | for (i = 0x05; i <= 0x06; i++) { |
| 1194 | data = pVBInfo->TimingH[0].data[i]; |
| 1195 | XGINew_SetReg1(pVBInfo->P3c4, (unsigned short) (i + 6), data); |
| 1196 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1197 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1198 | j = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x0e); |
| 1199 | j &= 0x1F; |
| 1200 | data = pVBInfo->TimingH[0].data[7]; |
| 1201 | data &= 0xE0; |
| 1202 | data |= j; |
| 1203 | XGINew_SetReg1(pVBInfo->P3c4, 0x0e, data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1204 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1205 | if (HwDeviceExtension->jChipType >= XG20) { |
| 1206 | data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x04); |
| 1207 | data = data - 1; |
| 1208 | XGINew_SetReg1(pVBInfo->P3d4, 0x04, data); |
| 1209 | data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x05); |
| 1210 | data1 = data; |
| 1211 | data1 &= 0xE0; |
| 1212 | data &= 0x1F; |
| 1213 | if (data == 0) { |
| 1214 | pushax = data; |
| 1215 | data = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, |
| 1216 | 0x0c); |
| 1217 | data &= 0xFB; |
| 1218 | XGINew_SetReg1(pVBInfo->P3c4, 0x0c, data); |
| 1219 | data = pushax; |
| 1220 | } |
| 1221 | data = data - 1; |
| 1222 | data |= data1; |
| 1223 | XGINew_SetReg1(pVBInfo->P3d4, 0x05, data); |
| 1224 | data = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x0e); |
| 1225 | data = data >> 5; |
| 1226 | data = data + 3; |
| 1227 | if (data > 7) |
| 1228 | data = data - 7; |
| 1229 | data = data << 5; |
| 1230 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0e, ~0xE0, data); |
| 1231 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1232 | } |
| 1233 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1234 | void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo, |
| 1235 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1236 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1237 | unsigned char data; |
| 1238 | unsigned short i, j; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1239 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1240 | /* XGINew_SetReg1(pVBInfo->P3d4, 0x51, 0); */ |
| 1241 | /* XGINew_SetReg1(pVBInfo->P3d4, 0x56, 0); */ |
| 1242 | /* XGINew_SetRegANDOR(pVBInfo->P3d4, 0x11, 0x7f, 0x00); */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1243 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1244 | for (i = 0x00; i <= 0x01; i++) { |
| 1245 | data = pVBInfo->TimingV[0].data[i]; |
| 1246 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 6), data); |
| 1247 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1248 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1249 | for (i = 0x02; i <= 0x03; i++) { |
| 1250 | data = pVBInfo->TimingV[0].data[i]; |
| 1251 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 0x0e), data); |
| 1252 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1253 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1254 | for (i = 0x04; i <= 0x05; i++) { |
| 1255 | data = pVBInfo->TimingV[0].data[i]; |
| 1256 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 0x11), data); |
| 1257 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1258 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1259 | j = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x0a); |
| 1260 | j &= 0xC0; |
| 1261 | data = pVBInfo->TimingV[0].data[6]; |
| 1262 | data &= 0x3F; |
| 1263 | data |= j; |
| 1264 | XGINew_SetReg1(pVBInfo->P3c4, 0x0a, data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1265 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1266 | data = pVBInfo->TimingV[0].data[6]; |
| 1267 | data &= 0x80; |
| 1268 | data = data >> 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1269 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1270 | if (ModeNo <= 0x13) |
| 1271 | i = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 1272 | else |
| 1273 | i = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1274 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1275 | i &= DoubleScanMode; |
| 1276 | if (i) |
| 1277 | data |= 0x80; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1278 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1279 | j = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x09); |
| 1280 | j &= 0x5F; |
| 1281 | data |= j; |
| 1282 | XGINew_SetReg1(pVBInfo->P3d4, 0x09, data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1283 | } |
| 1284 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1285 | /* --------------------------------------------------------------------- */ |
| 1286 | /* Function : XGI_SetXG21CRTC */ |
| 1287 | /* Input : Stand or enhance CRTC table */ |
| 1288 | /* Output : Fill CRT Hsync/Vsync to SR2E/SR2F/SR30/SR33/SR34/SR3F */ |
| 1289 | /* Description : Set LCD timing */ |
| 1290 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1291 | void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1292 | unsigned short RefreshRateTableIndex, |
| 1293 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1294 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1295 | unsigned char StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx; |
| 1296 | unsigned short Temp1, Temp2, Temp3; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1297 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1298 | if (ModeNo <= 0x13) { |
| 1299 | StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo); |
| 1300 | Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[4]; /* CR04 HRS */ |
| 1301 | XGINew_SetReg1(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E [7:0]->HRS */ |
| 1302 | Tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[5]; /* Tempbx: CR05 HRE */ |
| 1303 | Tempbx &= 0x1F; /* Tempbx: HRE[4:0] */ |
| 1304 | Tempcx = Tempax; |
| 1305 | Tempcx &= 0xE0; /* Tempcx: HRS[7:5] */ |
| 1306 | Tempdx = Tempcx | Tempbx; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */ |
| 1307 | if (Tempbx < (Tempax & 0x1F)) /* IF HRE < HRS */ |
| 1308 | Tempdx |= 0x20; /* Tempdx: HRE = HRE + 0x20 */ |
| 1309 | Tempdx <<= 2; /* Tempdx << 2 */ |
| 1310 | XGINew_SetReg1(pVBInfo->P3c4, 0x2F, Tempdx); /* SR2F [7:2]->HRE */ |
| 1311 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, 0xE3, 00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1312 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1313 | Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[16]; /* Tempax: CR16 VRS */ |
| 1314 | Tempbx = Tempax; /* Tempbx=Tempax */ |
| 1315 | Tempax &= 0x01; /* Tempax: VRS[0] */ |
| 1316 | XGINew_SetRegOR(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS */ |
| 1317 | Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[7]; /* Tempax: CR7 VRS */ |
| 1318 | Tempdx = Tempbx >> 1; /* Tempdx: VRS[7:1] */ |
| 1319 | Tempcx = Tempax & 0x04; /* Tempcx: CR7[2] */ |
| 1320 | Tempcx <<= 5; /* Tempcx[7]: VRS[8] */ |
| 1321 | Tempdx |= Tempcx; /* Tempdx: VRS[8:1] */ |
| 1322 | XGINew_SetReg1(pVBInfo->P3c4, 0x34, Tempdx); /* SR34[7:0]: VRS[8:1] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1323 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1324 | Temp1 = Tempcx << 1; /* Temp1[8]: VRS[8] unsigned char -> unsigned short */ |
| 1325 | Temp1 |= Tempbx; /* Temp1[8:0]: VRS[8:0] */ |
| 1326 | Tempax &= 0x80; /* Tempax[7]: CR7[7] */ |
| 1327 | Temp2 = Tempax << 2; /* Temp2[9]: VRS[9] */ |
| 1328 | Temp1 |= Temp2; /* Temp1[9:0]: VRS[9:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1329 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1330 | Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[17]; /* CR16 VRE */ |
| 1331 | Tempax &= 0x0F; /* Tempax[3:0]: VRE[3:0] */ |
| 1332 | Temp2 = Temp1 & 0x3F0; /* Temp2[9:4]: VRS[9:4] */ |
| 1333 | Temp2 |= Tempax; /* Temp2[9:0]: VRE[9:0] */ |
| 1334 | Temp3 = Temp1 & 0x0F; /* Temp3[3:0]: VRS[3:0] */ |
| 1335 | if (Tempax < Temp3) /* VRE[3:0]<VRS[3:0] */ |
| 1336 | Temp2 |= 0x10; /* Temp2: VRE + 0x10 */ |
| 1337 | Temp2 &= 0xFF; /* Temp2[7:0]: VRE[7:0] */ |
| 1338 | Tempax = (unsigned char) Temp2; /* Tempax[7:0]: VRE[7:0] */ |
| 1339 | Tempax <<= 2; /* Tempax << 2: VRE[5:0] */ |
| 1340 | Temp1 &= 0x600; /* Temp1[10:9]: VRS[10:9] */ |
| 1341 | Temp1 >>= 9; /* [10:9]->[1:0] */ |
| 1342 | Tempbx = (unsigned char) Temp1; /* Tempbx[1:0]: VRS[10:9] */ |
| 1343 | Tempax |= Tempbx; /* VRE[5:0]VRS[10:9] */ |
| 1344 | Tempax &= 0x7F; |
| 1345 | XGINew_SetReg1(pVBInfo->P3c4, 0x3F, Tempax); /* SR3F D[7:2]->VRE D[1:0]->VRS */ |
| 1346 | } else { |
| 1347 | index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; |
| 1348 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3]; /* Tempax: CR4 HRS */ |
| 1349 | Tempcx = Tempax; /* Tempcx: HRS */ |
| 1350 | XGINew_SetReg1(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E[7:0]->HRS */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1351 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1352 | Tempdx = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SRB */ |
| 1353 | Tempdx &= 0xC0; /* Tempdx[7:6]: SRB[7:6] */ |
| 1354 | Temp1 = Tempdx; /* Temp1[7:6]: HRS[9:8] */ |
| 1355 | Temp1 <<= 2; /* Temp1[9:8]: HRS[9:8] */ |
| 1356 | Temp1 |= Tempax; /* Temp1[9:0]: HRS[9:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1357 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1358 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[4]; /* CR5 HRE */ |
| 1359 | Tempax &= 0x1F; /* Tempax[4:0]: HRE[4:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1360 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1361 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[index].CR[6]; /* SRC */ |
| 1362 | Tempbx &= 0x04; /* Tempbx[2]: HRE[5] */ |
| 1363 | Tempbx <<= 3; /* Tempbx[5]: HRE[5] */ |
| 1364 | Tempax |= Tempbx; /* Tempax[5:0]: HRE[5:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1365 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1366 | Temp2 = Temp1 & 0x3C0; /* Temp2[9:6]: HRS[9:6] */ |
| 1367 | Temp2 |= Tempax; /* Temp2[9:0]: HRE[9:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1368 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1369 | Tempcx &= 0x3F; /* Tempcx[5:0]: HRS[5:0] */ |
| 1370 | if (Tempax < Tempcx) /* HRE < HRS */ |
| 1371 | Temp2 |= 0x40; /* Temp2 + 0x40 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1372 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1373 | Temp2 &= 0xFF; |
| 1374 | Tempax = (unsigned char) Temp2; /* Tempax: HRE[7:0] */ |
| 1375 | Tempax <<= 2; /* Tempax[7:2]: HRE[5:0] */ |
| 1376 | Tempdx >>= 6; /* Tempdx[7:6]->[1:0] HRS[9:8] */ |
| 1377 | Tempax |= Tempdx; /* HRE[5:0]HRS[9:8] */ |
| 1378 | XGINew_SetReg1(pVBInfo->P3c4, 0x2F, Tempax); /* SR2F D[7:2]->HRE, D[1:0]->HRS */ |
| 1379 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, 0xE3, 00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1380 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1381 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[10]; /* CR10 VRS */ |
| 1382 | Tempbx = Tempax; /* Tempbx: VRS */ |
| 1383 | Tempax &= 0x01; /* Tempax[0]: VRS[0] */ |
| 1384 | XGINew_SetRegOR(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS[0] */ |
| 1385 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[9]; /* CR7[2][7] VRE */ |
| 1386 | Tempcx = Tempbx >> 1; /* Tempcx[6:0]: VRS[7:1] */ |
| 1387 | Tempdx = Tempax & 0x04; /* Tempdx[2]: CR7[2] */ |
| 1388 | Tempdx <<= 5; /* Tempdx[7]: VRS[8] */ |
| 1389 | Tempcx |= Tempdx; /* Tempcx[7:0]: VRS[8:1] */ |
| 1390 | XGINew_SetReg1(pVBInfo->P3c4, 0x34, Tempcx); /* SR34[8:1]->VRS */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1391 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1392 | Temp1 = Tempdx; /* Temp1[7]: Tempdx[7] */ |
| 1393 | Temp1 <<= 1; /* Temp1[8]: VRS[8] */ |
| 1394 | Temp1 |= Tempbx; /* Temp1[8:0]: VRS[8:0] */ |
| 1395 | Tempax &= 0x80; |
| 1396 | Temp2 = Tempax << 2; /* Temp2[9]: VRS[9] */ |
| 1397 | Temp1 |= Temp2; /* Temp1[9:0]: VRS[9:0] */ |
| 1398 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[14]; /* Tempax: SRA */ |
| 1399 | Tempax &= 0x08; /* Tempax[3]: VRS[3] */ |
| 1400 | Temp2 = Tempax; |
| 1401 | Temp2 <<= 7; /* Temp2[10]: VRS[10] */ |
| 1402 | Temp1 |= Temp2; /* Temp1[10:0]: VRS[10:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1403 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1404 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[11]; /* Tempax: CR11 VRE */ |
| 1405 | Tempax &= 0x0F; /* Tempax[3:0]: VRE[3:0] */ |
| 1406 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[index].CR[14]; /* Tempbx: SRA */ |
| 1407 | Tempbx &= 0x20; /* Tempbx[5]: VRE[5] */ |
| 1408 | Tempbx >>= 1; /* Tempbx[4]: VRE[4] */ |
| 1409 | Tempax |= Tempbx; /* Tempax[4:0]: VRE[4:0] */ |
| 1410 | Temp2 = Temp1 & 0x7E0; /* Temp2[10:5]: VRS[10:5] */ |
| 1411 | Temp2 |= Tempax; /* Temp2[10:5]: VRE[10:5] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1412 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1413 | Temp3 = Temp1 & 0x1F; /* Temp3[4:0]: VRS[4:0] */ |
| 1414 | if (Tempax < Temp3) /* VRE < VRS */ |
| 1415 | Temp2 |= 0x20; /* VRE + 0x20 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1416 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1417 | Temp2 &= 0xFF; |
| 1418 | Tempax = (unsigned char) Temp2; /* Tempax: VRE[7:0] */ |
| 1419 | Tempax <<= 2; /* Tempax[7:0]; VRE[5:0]00 */ |
| 1420 | Temp1 &= 0x600; /* Temp1[10:9]: VRS[10:9] */ |
| 1421 | Temp1 >>= 9; /* Temp1[1:0]: VRS[10:9] */ |
| 1422 | Tempbx = (unsigned char) Temp1; |
| 1423 | Tempax |= Tempbx; /* Tempax[7:0]: VRE[5:0]VRS[10:9] */ |
| 1424 | Tempax &= 0x7F; |
| 1425 | XGINew_SetReg1(pVBInfo->P3c4, 0x3F, Tempax); /* SR3F D[7:2]->VRE D[1:0]->VRS */ |
| 1426 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1427 | } |
| 1428 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1429 | void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1430 | unsigned short RefreshRateTableIndex, |
| 1431 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1432 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1433 | unsigned short StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1434 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1435 | if (ModeNo <= 0x13) { |
| 1436 | StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo); |
| 1437 | Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[4]; /* CR04 HRS */ |
| 1438 | XGINew_SetReg1(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E [7:0]->HRS */ |
| 1439 | Tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[5]; /* Tempbx: CR05 HRE */ |
| 1440 | Tempbx &= 0x1F; /* Tempbx: HRE[4:0] */ |
| 1441 | Tempcx = Tempax; |
| 1442 | Tempcx &= 0xE0; /* Tempcx: HRS[7:5] */ |
| 1443 | Tempdx = Tempcx | Tempbx; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */ |
| 1444 | if (Tempbx < (Tempax & 0x1F)) /* IF HRE < HRS */ |
| 1445 | Tempdx |= 0x20; /* Tempdx: HRE = HRE + 0x20 */ |
| 1446 | Tempdx <<= 2; /* Tempdx << 2 */ |
| 1447 | XGINew_SetReg1(pVBInfo->P3c4, 0x2F, Tempdx); /* SR2F [7:2]->HRE */ |
| 1448 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, 0xE3, 00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1449 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1450 | Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[16]; /* Tempax: CR10 VRS */ |
| 1451 | XGINew_SetReg1(pVBInfo->P3c4, 0x34, Tempax); /* SR34[7:0]->VRS */ |
| 1452 | Tempcx = Tempax; /* Tempcx=Tempax=VRS[7:0] */ |
| 1453 | Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[7]; /* Tempax[7][2]: CR7[7][2] VRS[9][8] */ |
| 1454 | Tempbx = Tempax; /* Tempbx=CR07 */ |
| 1455 | Tempax &= 0x04; /* Tempax[2]: CR07[2] VRS[8] */ |
| 1456 | Tempax >>= 2; |
| 1457 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x01, Tempax); /* SR35 D[0]->VRS D[8] */ |
| 1458 | Tempcx |= (Tempax << 8); /* Tempcx[8] |= VRS[8] */ |
| 1459 | Tempcx |= (Tempbx & 0x80) << 2; /* Tempcx[9] |= VRS[9] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1460 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1461 | Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[17]; /* CR11 VRE */ |
| 1462 | Tempax &= 0x0F; /* Tempax: VRE[3:0] */ |
| 1463 | Tempbx = Tempcx; /* Tempbx=Tempcx=VRS[9:0] */ |
| 1464 | Tempbx &= 0x3F0; /* Tempbx[9:4]: VRS[9:4] */ |
| 1465 | Tempbx |= Tempax; /* Tempbx[9:0]: VRE[9:0] */ |
| 1466 | if (Tempax <= (Tempcx & 0x0F)) /* VRE[3:0]<=VRS[3:0] */ |
| 1467 | Tempbx |= 0x10; /* Tempbx: VRE + 0x10 */ |
| 1468 | Tempax = (unsigned char) Tempbx & 0xFF; /* Tempax[7:0]: VRE[7:0] */ |
| 1469 | Tempax <<= 2; /* Tempax << 2: VRE[5:0] */ |
| 1470 | Tempcx = (Tempcx & 0x600) >> 8; /* Tempcx VRS[10:9] */ |
| 1471 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax); /* SR3F D[7:2]->VRE D[5:0] */ |
| 1472 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x06, Tempcx); /* SR35 D[2:1]->VRS[10:9] */ |
| 1473 | } else { |
| 1474 | index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; |
| 1475 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3]; /* Tempax: CR4 HRS */ |
| 1476 | Tempbx = Tempax; /* Tempbx: HRS[7:0] */ |
| 1477 | XGINew_SetReg1(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E[7:0]->HRS */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1478 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1479 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SR0B */ |
| 1480 | Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ |
| 1481 | Tempbx |= (Tempax << 2); /* Tempbx: HRS[9:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1482 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1483 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[4]; /* CR5 HRE */ |
| 1484 | Tempax &= 0x1F; /* Tempax[4:0]: HRE[4:0] */ |
| 1485 | Tempcx = Tempax; /* Tempcx: HRE[4:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1486 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1487 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[6]; /* SRC */ |
| 1488 | Tempax &= 0x04; /* Tempax[2]: HRE[5] */ |
| 1489 | Tempax <<= 3; /* Tempax[5]: HRE[5] */ |
| 1490 | Tempcx |= Tempax; /* Tempcx[5:0]: HRE[5:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1491 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1492 | Tempbx = Tempbx & 0x3C0; /* Tempbx[9:6]: HRS[9:6] */ |
| 1493 | Tempbx |= Tempcx; /* Tempbx: HRS[9:6]HRE[5:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1494 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1495 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3]; /* Tempax: CR4 HRS */ |
| 1496 | Tempax &= 0x3F; /* Tempax: HRS[5:0] */ |
| 1497 | if (Tempcx <= Tempax) /* HRE[5:0] < HRS[5:0] */ |
| 1498 | Tempbx += 0x40; /* Tempbx= Tempbx + 0x40 : HRE[9:0]*/ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1499 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1500 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SR0B */ |
| 1501 | Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ |
| 1502 | Tempax >>= 6; /* Tempax[1:0]: HRS[9:8]*/ |
| 1503 | Tempax |= ((Tempbx << 2) & 0xFF); /* Tempax[7:2]: HRE[5:0] */ |
| 1504 | XGINew_SetReg1(pVBInfo->P3c4, 0x2F, Tempax); /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */ |
| 1505 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, 0xE3, 00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1506 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1507 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[10]; /* CR10 VRS */ |
| 1508 | XGINew_SetReg1(pVBInfo->P3c4, 0x34, Tempax); /* SR34[7:0]->VRS[7:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1509 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1510 | Tempcx = Tempax; /* Tempcx <= VRS[7:0] */ |
| 1511 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[9]; /* CR7[7][2] VRS[9][8] */ |
| 1512 | Tempbx = Tempax; /* Tempbx <= CR07[7:0] */ |
| 1513 | Tempax = Tempax & 0x04; /* Tempax[2]: CR7[2]: VRS[8] */ |
| 1514 | Tempax >>= 2; /* Tempax[0]: VRS[8] */ |
| 1515 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x01, Tempax); /* SR35[0]: VRS[8] */ |
| 1516 | Tempcx |= (Tempax << 8); /* Tempcx <= VRS[8:0] */ |
| 1517 | Tempcx |= ((Tempbx & 0x80) << 2); /* Tempcx <= VRS[9:0] */ |
| 1518 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[14]; /* Tempax: SR0A */ |
| 1519 | Tempax &= 0x08; /* SR0A[3] VRS[10] */ |
| 1520 | Tempcx |= (Tempax << 7); /* Tempcx <= VRS[10:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1521 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1522 | Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[11]; /* Tempax: CR11 VRE */ |
| 1523 | Tempax &= 0x0F; /* Tempax[3:0]: VRE[3:0] */ |
| 1524 | Tempbx = pVBInfo->XGINEWUB_CRT1Table[index].CR[14]; /* Tempbx: SR0A */ |
| 1525 | Tempbx &= 0x20; /* Tempbx[5]: SR0A[5]: VRE[4] */ |
| 1526 | Tempbx >>= 1; /* Tempbx[4]: VRE[4] */ |
| 1527 | Tempax |= Tempbx; /* Tempax[4:0]: VRE[4:0] */ |
| 1528 | Tempbx = Tempcx; /* Tempbx: VRS[10:0] */ |
| 1529 | Tempbx &= 0x7E0; /* Tempbx[10:5]: VRS[10:5] */ |
| 1530 | Tempbx |= Tempax; /* Tempbx: VRS[10:5]VRE[4:0] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1531 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1532 | if (Tempbx <= Tempcx) /* VRE <= VRS */ |
| 1533 | Tempbx |= 0x20; /* VRE + 0x20 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1534 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1535 | Tempax = (Tempbx << 2) & 0xFF; /* Tempax: Tempax[7:0]; VRE[5:0]00 */ |
| 1536 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax); /* SR3F[7:2]:VRE[5:0] */ |
| 1537 | Tempax = Tempcx >> 8; |
| 1538 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x07, Tempax); /* SR35[2:0]:VRS[10:8] */ |
| 1539 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1540 | } |
| 1541 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1542 | /* --------------------------------------------------------------------- */ |
| 1543 | /* Function : XGI_SetXG21LCD */ |
| 1544 | /* Input : */ |
| 1545 | /* Output : FCLK duty cycle, FCLK delay compensation */ |
| 1546 | /* Description : All values set zero */ |
| 1547 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 1548 | void XGI_SetXG21LCD(struct vb_device_info *pVBInfo, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1549 | unsigned short RefreshRateTableIndex, unsigned short ModeNo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1550 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1551 | unsigned short Data, Temp, b3CC; |
| 1552 | unsigned short XGI_P3cc; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1553 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1554 | XGI_P3cc = pVBInfo->P3cc; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1555 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1556 | XGINew_SetReg1(pVBInfo->P3d4, 0x2E, 0x00); |
| 1557 | XGINew_SetReg1(pVBInfo->P3d4, 0x2F, 0x00); |
| 1558 | XGINew_SetReg1(pVBInfo->P3d4, 0x46, 0x00); |
| 1559 | XGINew_SetReg1(pVBInfo->P3d4, 0x47, 0x00); |
| 1560 | if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) { |
| 1561 | XGINew_SetReg1(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E); |
| 1562 | XGINew_SetReg1(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F); |
| 1563 | XGINew_SetReg1(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46); |
| 1564 | XGINew_SetReg1(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47); |
| 1565 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1566 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1567 | Temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1568 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1569 | if (Temp & 0x01) { |
| 1570 | XGINew_SetRegOR(pVBInfo->P3c4, 0x06, 0x40); /* 18 bits FP */ |
| 1571 | XGINew_SetRegOR(pVBInfo->P3c4, 0x09, 0x40); |
| 1572 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1573 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1574 | XGINew_SetRegOR(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1575 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1576 | XGINew_SetRegAND(pVBInfo->P3c4, 0x30, ~0x20); |
| 1577 | XGINew_SetRegAND(pVBInfo->P3c4, 0x35, ~0x80); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1578 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1579 | if (ModeNo <= 0x13) { |
| 1580 | b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc); |
| 1581 | if (b3CC & 0x40) |
| 1582 | XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */ |
| 1583 | if (b3CC & 0x80) |
| 1584 | XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */ |
| 1585 | } else { |
| 1586 | Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag; |
| 1587 | if (Data & 0x4000) |
| 1588 | XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */ |
| 1589 | if (Data & 0x8000) |
| 1590 | XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */ |
| 1591 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1592 | } |
| 1593 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 1594 | void XGI_SetXG27LCD(struct vb_device_info *pVBInfo, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1595 | unsigned short RefreshRateTableIndex, unsigned short ModeNo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1596 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1597 | unsigned short Data, Temp, b3CC; |
| 1598 | unsigned short XGI_P3cc; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1599 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1600 | XGI_P3cc = pVBInfo->P3cc; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1601 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1602 | XGINew_SetReg1(pVBInfo->P3d4, 0x2E, 0x00); |
| 1603 | XGINew_SetReg1(pVBInfo->P3d4, 0x2F, 0x00); |
| 1604 | XGINew_SetReg1(pVBInfo->P3d4, 0x46, 0x00); |
| 1605 | XGINew_SetReg1(pVBInfo->P3d4, 0x47, 0x00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1606 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1607 | Temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37); |
| 1608 | if ((Temp & 0x03) == 0) { /* dual 12 */ |
| 1609 | XGINew_SetReg1(pVBInfo->P3d4, 0x46, 0x13); |
| 1610 | XGINew_SetReg1(pVBInfo->P3d4, 0x47, 0x13); |
| 1611 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1612 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1613 | if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) { |
| 1614 | XGINew_SetReg1(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E); |
| 1615 | XGINew_SetReg1(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F); |
| 1616 | XGINew_SetReg1(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46); |
| 1617 | XGINew_SetReg1(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47); |
| 1618 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1619 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1620 | XGI_SetXG27FPBits(pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1621 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1622 | XGINew_SetRegOR(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1623 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1624 | XGINew_SetRegAND(pVBInfo->P3c4, 0x30, ~0x20); /* Hsync polarity */ |
| 1625 | XGINew_SetRegAND(pVBInfo->P3c4, 0x35, ~0x80); /* Vsync polarity */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1626 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1627 | if (ModeNo <= 0x13) { |
| 1628 | b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc); |
| 1629 | if (b3CC & 0x40) |
| 1630 | XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */ |
| 1631 | if (b3CC & 0x80) |
| 1632 | XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */ |
| 1633 | } else { |
| 1634 | Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag; |
| 1635 | if (Data & 0x4000) |
| 1636 | XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */ |
| 1637 | if (Data & 0x8000) |
| 1638 | XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */ |
| 1639 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1640 | } |
| 1641 | |
| 1642 | /* --------------------------------------------------------------------- */ |
| 1643 | /* Function : XGI_UpdateXG21CRTC */ |
| 1644 | /* Input : */ |
| 1645 | /* Output : CRT1 CRTC */ |
| 1646 | /* Description : Modify CRT1 Hsync/Vsync to fix LCD mode timing */ |
| 1647 | /* --------------------------------------------------------------------- */ |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1648 | void XGI_UpdateXG21CRTC(unsigned short ModeNo, struct vb_device_info *pVBInfo, |
| 1649 | unsigned short RefreshRateTableIndex) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1650 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1651 | int i, index = -1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1652 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1653 | XGINew_SetRegAND(pVBInfo->P3d4, 0x11, 0x7F); /* Unlock CR0~7 */ |
| 1654 | if (ModeNo <= 0x13) { |
| 1655 | for (i = 0; i < 12; i++) { |
| 1656 | if (ModeNo == pVBInfo->UpdateCRT1[i].ModeID) |
| 1657 | index = i; |
| 1658 | } |
| 1659 | } else { |
| 1660 | if (ModeNo == 0x2E |
| 1661 | && (pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC |
| 1662 | == RES640x480x60)) |
| 1663 | index = 12; |
| 1664 | else if (ModeNo == 0x2E |
| 1665 | && (pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC |
| 1666 | == RES640x480x72)) |
| 1667 | index = 13; |
| 1668 | else if (ModeNo == 0x2F) |
| 1669 | index = 14; |
| 1670 | else if (ModeNo == 0x50) |
| 1671 | index = 15; |
| 1672 | else if (ModeNo == 0x59) |
| 1673 | index = 16; |
| 1674 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1675 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1676 | if (index != -1) { |
| 1677 | XGINew_SetReg1(pVBInfo->P3d4, 0x02, |
| 1678 | pVBInfo->UpdateCRT1[index].CR02); |
| 1679 | XGINew_SetReg1(pVBInfo->P3d4, 0x03, |
| 1680 | pVBInfo->UpdateCRT1[index].CR03); |
| 1681 | XGINew_SetReg1(pVBInfo->P3d4, 0x15, |
| 1682 | pVBInfo->UpdateCRT1[index].CR15); |
| 1683 | XGINew_SetReg1(pVBInfo->P3d4, 0x16, |
| 1684 | pVBInfo->UpdateCRT1[index].CR16); |
| 1685 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1686 | } |
| 1687 | |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 1688 | void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1689 | unsigned short ModeNo, unsigned short ModeIdIndex, |
| 1690 | unsigned short RefreshRateTableIndex, |
| 1691 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1692 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1693 | unsigned short resindex, tempax, tempbx, tempcx, temp, modeflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1694 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1695 | unsigned char data; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1696 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1697 | resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1698 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1699 | if (ModeNo <= 0x13) { |
| 1700 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 1701 | tempax = pVBInfo->StResInfo[resindex].HTotal; |
| 1702 | tempbx = pVBInfo->StResInfo[resindex].VTotal; |
| 1703 | } else { |
| 1704 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 1705 | tempax = pVBInfo->ModeResInfo[resindex].HTotal; |
| 1706 | tempbx = pVBInfo->ModeResInfo[resindex].VTotal; |
| 1707 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1708 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1709 | if (modeflag & HalfDCLK) |
| 1710 | tempax = tempax >> 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1711 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1712 | if (ModeNo > 0x13) { |
| 1713 | if (modeflag & HalfDCLK) |
| 1714 | tempax = tempax << 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1715 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1716 | temp = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1717 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1718 | if (temp & InterlaceMode) |
| 1719 | tempbx = tempbx >> 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1720 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1721 | if (modeflag & DoubleScanMode) |
| 1722 | tempbx = tempbx << 1; |
| 1723 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1724 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1725 | tempcx = 8; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1726 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1727 | /* if (!(modeflag & Charx8Dot)) */ |
| 1728 | /* tempcx = 9; */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1729 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1730 | tempax /= tempcx; |
| 1731 | tempax -= 1; |
| 1732 | tempbx -= 1; |
| 1733 | tempcx = tempax; |
| 1734 | temp = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
| 1735 | data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
| 1736 | data &= 0x7F; |
| 1737 | XGINew_SetReg1(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */ |
| 1738 | XGINew_SetReg1(pVBInfo->P3d4, 0x01, (unsigned short) (tempcx & 0xff)); |
| 1739 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x0b, ~0x0c, |
| 1740 | (unsigned short) ((tempcx & 0x0ff00) >> 10)); |
| 1741 | XGINew_SetReg1(pVBInfo->P3d4, 0x12, (unsigned short) (tempbx & 0xff)); |
| 1742 | tempax = 0; |
| 1743 | tempbx = tempbx >> 8; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1744 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1745 | if (tempbx & 0x01) |
| 1746 | tempax |= 0x02; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1747 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1748 | if (tempbx & 0x02) |
| 1749 | tempax |= 0x40; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1750 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1751 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x42, tempax); |
| 1752 | data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x07); |
| 1753 | data &= 0xFF; |
| 1754 | tempax = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1755 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1756 | if (tempbx & 0x04) |
| 1757 | tempax |= 0x02; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1758 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1759 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x0a, ~0x02, tempax); |
| 1760 | XGINew_SetReg1(pVBInfo->P3d4, 0x11, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1761 | } |
| 1762 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1763 | unsigned short XGI_GetResInfo(unsigned short ModeNo, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1764 | unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1765 | { |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1766 | unsigned short resindex; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1767 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1768 | if (ModeNo <= 0x13) |
| 1769 | resindex = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; /* si+St_ResInfo */ |
| 1770 | else |
| 1771 | resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo */ |
| 1772 | return resindex; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1773 | } |
| 1774 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1775 | void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 1776 | unsigned short RefreshRateTableIndex, |
| 1777 | struct xgi_hw_device_info *HwDeviceExtension, |
| 1778 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1779 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1780 | unsigned short temp, ah, al, temp2, i, DisplayUnit; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1781 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1782 | /* GetOffset */ |
| 1783 | temp = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeInfo; |
| 1784 | temp = temp >> 8; |
| 1785 | temp = pVBInfo->ScreenOffset[temp]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1786 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1787 | temp2 = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag; |
| 1788 | temp2 &= InterlaceMode; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1789 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1790 | if (temp2) |
| 1791 | temp = temp << 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1792 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1793 | temp2 = pVBInfo->ModeType - ModeEGA; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1794 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1795 | switch (temp2) { |
| 1796 | case 0: |
| 1797 | temp2 = 1; |
| 1798 | break; |
| 1799 | case 1: |
| 1800 | temp2 = 2; |
| 1801 | break; |
| 1802 | case 2: |
| 1803 | temp2 = 4; |
| 1804 | break; |
| 1805 | case 3: |
| 1806 | temp2 = 4; |
| 1807 | break; |
| 1808 | case 4: |
| 1809 | temp2 = 6; |
| 1810 | break; |
| 1811 | case 5: |
| 1812 | temp2 = 8; |
| 1813 | break; |
| 1814 | default: |
| 1815 | break; |
| 1816 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1817 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1818 | if ((ModeNo >= 0x26) && (ModeNo <= 0x28)) |
| 1819 | temp = temp * temp2 + temp2 / 2; |
| 1820 | else |
| 1821 | temp *= temp2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1822 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1823 | /* SetOffset */ |
| 1824 | DisplayUnit = temp; |
| 1825 | temp2 = temp; |
| 1826 | temp = temp >> 8; /* ah */ |
| 1827 | temp &= 0x0F; |
| 1828 | i = XGINew_GetReg1(pVBInfo->P3c4, 0x0E); |
| 1829 | i &= 0xF0; |
| 1830 | i |= temp; |
| 1831 | XGINew_SetReg1(pVBInfo->P3c4, 0x0E, i); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1832 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1833 | temp = (unsigned char) temp2; |
| 1834 | temp &= 0xFF; /* al */ |
| 1835 | XGINew_SetReg1(pVBInfo->P3d4, 0x13, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1836 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1837 | /* SetDisplayUnit */ |
| 1838 | temp2 = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag; |
| 1839 | temp2 &= InterlaceMode; |
| 1840 | if (temp2) |
| 1841 | DisplayUnit >>= 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1842 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1843 | DisplayUnit = DisplayUnit << 5; |
| 1844 | ah = (DisplayUnit & 0xff00) >> 8; |
| 1845 | al = DisplayUnit & 0x00ff; |
| 1846 | if (al == 0) |
| 1847 | ah += 1; |
| 1848 | else |
| 1849 | ah += 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1850 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1851 | if (HwDeviceExtension->jChipType >= XG20) |
| 1852 | if ((ModeNo == 0x4A) | (ModeNo == 0x49)) |
| 1853 | ah -= 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1854 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1855 | XGINew_SetReg1(pVBInfo->P3c4, 0x10, ah); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1856 | } |
| 1857 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1858 | void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1859 | struct xgi_hw_device_info *HwDeviceExtension, |
| 1860 | unsigned short RefreshRateTableIndex, |
| 1861 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1862 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 1863 | unsigned char index, data; |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1864 | unsigned short vclkindex; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1865 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1866 | if (pVBInfo->IF_DEF_LVDS == 1) { |
| 1867 | index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; |
| 1868 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x31) & 0xCF; |
| 1869 | XGINew_SetReg1(pVBInfo->P3c4, 0x31, data); |
| 1870 | XGINew_SetReg1(pVBInfo->P3c4, 0x2B, |
| 1871 | pVBInfo->VCLKData[index].SR2B); |
| 1872 | XGINew_SetReg1(pVBInfo->P3c4, 0x2C, |
| 1873 | pVBInfo->VCLKData[index].SR2C); |
| 1874 | XGINew_SetReg1(pVBInfo->P3c4, 0x2D, 0x01); |
| 1875 | } else if ((pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 1876 | | VB_XGI302LV | VB_XGI301C)) && (pVBInfo->VBInfo |
| 1877 | & SetCRT2ToLCDA)) { |
| 1878 | vclkindex = XGI_GetVCLK2Ptr(ModeNo, ModeIdIndex, |
| 1879 | RefreshRateTableIndex, HwDeviceExtension, |
| 1880 | pVBInfo); |
| 1881 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x31) & 0xCF; |
| 1882 | XGINew_SetReg1(pVBInfo->P3c4, 0x31, data); |
| 1883 | data = pVBInfo->VBVCLKData[vclkindex].Part4_A; |
| 1884 | XGINew_SetReg1(pVBInfo->P3c4, 0x2B, data); |
| 1885 | data = pVBInfo->VBVCLKData[vclkindex].Part4_B; |
| 1886 | XGINew_SetReg1(pVBInfo->P3c4, 0x2C, data); |
| 1887 | XGINew_SetReg1(pVBInfo->P3c4, 0x2D, 0x01); |
| 1888 | } else { |
| 1889 | index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; |
| 1890 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x31) & 0xCF; |
| 1891 | XGINew_SetReg1(pVBInfo->P3c4, 0x31, data); |
| 1892 | XGINew_SetReg1(pVBInfo->P3c4, 0x2B, |
| 1893 | pVBInfo->VCLKData[index].SR2B); |
| 1894 | XGINew_SetReg1(pVBInfo->P3c4, 0x2C, |
| 1895 | pVBInfo->VCLKData[index].SR2C); |
| 1896 | XGINew_SetReg1(pVBInfo->P3c4, 0x2D, 0x01); |
| 1897 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1898 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1899 | if (HwDeviceExtension->jChipType >= XG20) { |
| 1900 | if (pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag & HalfDCLK) { |
| 1901 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x2B); |
| 1902 | XGINew_SetReg1(pVBInfo->P3c4, 0x2B, data); |
| 1903 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x2C); |
| 1904 | index = data; |
| 1905 | index &= 0xE0; |
| 1906 | data &= 0x1F; |
| 1907 | data = data << 1; |
| 1908 | data += 1; |
| 1909 | data |= index; |
| 1910 | XGINew_SetReg1(pVBInfo->P3c4, 0x2C, data); |
| 1911 | } |
| 1912 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1913 | } |
| 1914 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 1915 | void XGI_SetCRT1FIFO(unsigned short ModeNo, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1916 | struct xgi_hw_device_info *HwDeviceExtension, |
| 1917 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1918 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1919 | unsigned short data; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1920 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1921 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x3D); |
| 1922 | data &= 0xfe; |
| 1923 | XGINew_SetReg1(pVBInfo->P3c4, 0x3D, data); /* diable auto-threshold */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1924 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1925 | if (ModeNo > 0x13) { |
| 1926 | XGINew_SetReg1(pVBInfo->P3c4, 0x08, 0x34); |
| 1927 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x09); |
| 1928 | data &= 0xC0; |
| 1929 | XGINew_SetReg1(pVBInfo->P3c4, 0x09, data | 0x30); |
| 1930 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x3D); |
| 1931 | data |= 0x01; |
| 1932 | XGINew_SetReg1(pVBInfo->P3c4, 0x3D, data); |
| 1933 | } else { |
| 1934 | if (HwDeviceExtension->jChipType == XG27) { |
| 1935 | XGINew_SetReg1(pVBInfo->P3c4, 0x08, 0x0E); |
| 1936 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x09); |
| 1937 | data &= 0xC0; |
| 1938 | XGINew_SetReg1(pVBInfo->P3c4, 0x09, data | 0x20); |
| 1939 | } else { |
| 1940 | XGINew_SetReg1(pVBInfo->P3c4, 0x08, 0xAE); |
| 1941 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x09); |
| 1942 | data &= 0xF0; |
| 1943 | XGINew_SetReg1(pVBInfo->P3c4, 0x09, data); |
| 1944 | } |
| 1945 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1946 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1947 | if (HwDeviceExtension->jChipType == XG21) |
| 1948 | XGI_SetXG21FPBits(pVBInfo); /* Fix SR9[7:6] can't read back */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1949 | } |
| 1950 | |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 1951 | void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1952 | unsigned short ModeNo, unsigned short ModeIdIndex, |
| 1953 | unsigned short RefreshRateTableIndex, |
| 1954 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1955 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1956 | unsigned short data, data2, data3, infoflag = 0, modeflag, resindex, |
| 1957 | xres; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1958 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1959 | if (ModeNo > 0x13) { |
| 1960 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 1961 | infoflag |
| 1962 | = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag; |
| 1963 | } else |
| 1964 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ModeFlag */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1965 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1966 | if (XGINew_GetReg1(pVBInfo->P3d4, 0x31) & 0x01) |
| 1967 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x1F, 0x3F, 0x00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1968 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1969 | if (ModeNo > 0x13) |
| 1970 | data = infoflag; |
| 1971 | else |
| 1972 | data = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1973 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1974 | data2 = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1975 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1976 | if (ModeNo > 0x13) { |
| 1977 | if (pVBInfo->ModeType > 0x02) { |
| 1978 | data2 |= 0x02; |
| 1979 | data3 = pVBInfo->ModeType - ModeVGA; |
| 1980 | data3 = data3 << 2; |
| 1981 | data2 |= data3; |
| 1982 | } |
| 1983 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1984 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1985 | data &= InterlaceMode; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1986 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1987 | if (data) |
| 1988 | data2 |= 0x20; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1989 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1990 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x06, ~0x3F, data2); |
| 1991 | /* XGINew_SetReg1(pVBInfo->P3c4,0x06,data2); */ |
| 1992 | resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); |
| 1993 | if (ModeNo <= 0x13) |
| 1994 | xres = pVBInfo->StResInfo[resindex].HTotal; |
| 1995 | else |
| 1996 | xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1997 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 1998 | data = 0x0000; |
| 1999 | if (infoflag & InterlaceMode) { |
| 2000 | if (xres == 1024) |
| 2001 | data = 0x0035; |
| 2002 | else if (xres == 1280) |
| 2003 | data = 0x0048; |
| 2004 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2005 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2006 | data2 = data & 0x00FF; |
| 2007 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x19, 0xFF, data2); |
| 2008 | data2 = (data & 0xFF00) >> 8; |
| 2009 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x19, 0xFC, data2); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2010 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2011 | if (modeflag & HalfDCLK) |
| 2012 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xF7, 0x08); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2013 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2014 | data2 = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2015 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2016 | if (modeflag & LineCompareOff) |
| 2017 | data2 |= 0x08; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2018 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2019 | if (ModeNo > 0x13) { |
| 2020 | if (pVBInfo->ModeType == ModeEGA) |
| 2021 | data2 |= 0x40; |
| 2022 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2023 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2024 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0F, ~0x48, data2); |
| 2025 | data = 0x60; |
| 2026 | if (pVBInfo->ModeType != ModeText) { |
| 2027 | data = data ^ 0x60; |
| 2028 | if (pVBInfo->ModeType != ModeEGA) |
| 2029 | data = data ^ 0xA0; |
| 2030 | } |
| 2031 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x21, 0x1F, data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2032 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2033 | XGI_SetVCLKState(HwDeviceExtension, ModeNo, RefreshRateTableIndex, |
| 2034 | pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2035 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2036 | /* if (modeflag&HalfDCLK) //030305 fix lowresolution bug */ |
| 2037 | /* if (XGINew_IF_DEF_NEW_LOWRES) */ |
| 2038 | /* XGI_VesaLowResolution(ModeNo, ModeIdIndex); //030305 fix lowresolution bug */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2039 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2040 | data = XGINew_GetReg1(pVBInfo->P3d4, 0x31); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2041 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2042 | if (HwDeviceExtension->jChipType == XG27) { |
| 2043 | if (data & 0x40) |
| 2044 | data = 0x2c; |
| 2045 | else |
| 2046 | data = 0x6c; |
| 2047 | XGINew_SetReg1(pVBInfo->P3d4, 0x52, data); |
| 2048 | XGINew_SetRegOR(pVBInfo->P3d4, 0x51, 0x10); |
| 2049 | } else if (HwDeviceExtension->jChipType >= XG20) { |
| 2050 | if (data & 0x40) |
| 2051 | data = 0x33; |
| 2052 | else |
| 2053 | data = 0x73; |
| 2054 | XGINew_SetReg1(pVBInfo->P3d4, 0x52, data); |
| 2055 | XGINew_SetReg1(pVBInfo->P3d4, 0x51, 0x02); |
| 2056 | } else { |
| 2057 | if (data & 0x40) |
| 2058 | data = 0x2c; |
| 2059 | else |
| 2060 | data = 0x6c; |
| 2061 | XGINew_SetReg1(pVBInfo->P3d4, 0x52, data); |
| 2062 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2063 | |
| 2064 | } |
| 2065 | |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 2066 | void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2067 | unsigned short ModeNo, unsigned short RefreshRateTableIndex, |
| 2068 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2069 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2070 | unsigned short data, data2 = 0; |
| 2071 | short VCLK; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2072 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2073 | unsigned char index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2074 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2075 | if (ModeNo <= 0x13) |
| 2076 | VCLK = 0; |
| 2077 | else { |
| 2078 | index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; |
| 2079 | index &= IndexMask; |
| 2080 | VCLK = pVBInfo->VCLKData[index].CLOCK; |
| 2081 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2082 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2083 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x32); |
| 2084 | data &= 0xf3; |
| 2085 | if (VCLK >= 200) |
| 2086 | data |= 0x0c; /* VCLK > 200 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2087 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2088 | if (HwDeviceExtension->jChipType >= XG20) |
| 2089 | data &= ~0x04; /* 2 pixel mode */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2090 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2091 | XGINew_SetReg1(pVBInfo->P3c4, 0x32, data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2092 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2093 | if (HwDeviceExtension->jChipType < XG20) { |
| 2094 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x1F); |
| 2095 | data &= 0xE7; |
| 2096 | if (VCLK < 200) |
| 2097 | data |= 0x10; |
| 2098 | XGINew_SetReg1(pVBInfo->P3c4, 0x1F, data); |
| 2099 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2100 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2101 | /* Jong for Adavantech LCD ripple issue |
| 2102 | if ((VCLK >= 0) && (VCLK < 135)) |
| 2103 | data2 = 0x03; |
| 2104 | else if ((VCLK >= 135) && (VCLK < 160)) |
| 2105 | data2 = 0x02; |
| 2106 | else if ((VCLK >= 160) && (VCLK < 260)) |
| 2107 | data2 = 0x01; |
| 2108 | else if (VCLK > 260) |
| 2109 | data2 = 0x00; |
| 2110 | */ |
| 2111 | data2 = 0x00; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2112 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2113 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x07, 0xFC, data2); |
| 2114 | if (HwDeviceExtension->jChipType >= XG27) |
| 2115 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x40, 0xFC, data2 & 0x03); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2116 | |
| 2117 | } |
| 2118 | |
| 2119 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2120 | /* |
| 2121 | 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] | 2122 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2123 | unsigned short modeflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2124 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2125 | if (ModeNo > 0x13) |
| 2126 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 2127 | else |
| 2128 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2129 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2130 | if (ModeNo > 0x13) { |
| 2131 | if (modeflag & DoubleScanMode) { |
| 2132 | if (modeflag & HalfDCLK) { |
| 2133 | if (pVBInfo->VBType & VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) { |
| 2134 | if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) { |
| 2135 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 2136 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xf7, 0x00); |
| 2137 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0f, 0x7f, 0x00); |
| 2138 | return; |
| 2139 | } |
| 2140 | } |
| 2141 | } |
| 2142 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0f, 0xff, 0x80); |
| 2143 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xf7, 0x00); |
| 2144 | return; |
| 2145 | } |
| 2146 | } |
| 2147 | } |
| 2148 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0f, 0x7f, 0x00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2149 | } |
| 2150 | */ |
| 2151 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2152 | void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 2153 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2154 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2155 | unsigned short data, data2, time, i, j, k, m, n, o, si, di, bx, dl, al, |
| 2156 | ah, dh, *table = NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2157 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2158 | if (ModeNo <= 0x13) |
| 2159 | data = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 2160 | else |
| 2161 | data = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2162 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2163 | data &= DACInfoFlag; |
| 2164 | time = 64; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2165 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2166 | if (data == 0x00) |
| 2167 | table = XGINew_MDA_DAC; |
| 2168 | else if (data == 0x08) |
| 2169 | table = XGINew_CGA_DAC; |
| 2170 | else if (data == 0x10) |
| 2171 | table = XGINew_EGA_DAC; |
| 2172 | else if (data == 0x18) { |
| 2173 | time = 256; |
| 2174 | table = XGINew_VGA_DAC; |
| 2175 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2176 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2177 | if (time == 256) |
| 2178 | j = 16; |
| 2179 | else |
| 2180 | j = time; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2181 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2182 | XGINew_SetReg3(pVBInfo->P3c6, 0xFF); |
| 2183 | XGINew_SetReg3(pVBInfo->P3c8, 0x00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2184 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2185 | for (i = 0; i < j; i++) { |
| 2186 | data = table[i]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2187 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2188 | for (k = 0; k < 3; k++) { |
| 2189 | data2 = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2190 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2191 | if (data & 0x01) |
| 2192 | data2 = 0x2A; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2193 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2194 | if (data & 0x02) |
| 2195 | data2 += 0x15; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2196 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2197 | XGINew_SetReg3(pVBInfo->P3c9, data2); |
| 2198 | data = data >> 2; |
| 2199 | } |
| 2200 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2201 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2202 | if (time == 256) { |
| 2203 | for (i = 16; i < 32; i++) { |
| 2204 | data = table[i]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2205 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2206 | for (k = 0; k < 3; k++) |
| 2207 | XGINew_SetReg3(pVBInfo->P3c9, data); |
| 2208 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2209 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2210 | si = 32; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2211 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2212 | for (m = 0; m < 9; m++) { |
| 2213 | di = si; |
| 2214 | bx = si + 0x04; |
| 2215 | dl = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2216 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2217 | for (n = 0; n < 3; n++) { |
| 2218 | for (o = 0; o < 5; o++) { |
| 2219 | dh = table[si]; |
| 2220 | ah = table[di]; |
| 2221 | al = table[bx]; |
| 2222 | si++; |
| 2223 | XGI_WriteDAC(dl, ah, al, dh, pVBInfo); |
| 2224 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2225 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2226 | si -= 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2227 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2228 | for (o = 0; o < 3; o++) { |
| 2229 | dh = table[bx]; |
| 2230 | ah = table[di]; |
| 2231 | al = table[si]; |
| 2232 | si--; |
| 2233 | XGI_WriteDAC(dl, ah, al, dh, pVBInfo); |
| 2234 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2235 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2236 | dl++; |
| 2237 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2238 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2239 | si += 5; |
| 2240 | } |
| 2241 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2242 | } |
| 2243 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2244 | void XGI_WriteDAC(unsigned short dl, unsigned short ah, unsigned short al, |
| 2245 | unsigned short dh, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2246 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2247 | unsigned short temp, bh, bl; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2248 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2249 | bh = ah; |
| 2250 | bl = al; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2251 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2252 | if (dl != 0) { |
| 2253 | temp = bh; |
| 2254 | bh = dh; |
| 2255 | dh = temp; |
| 2256 | if (dl == 1) { |
| 2257 | temp = bl; |
| 2258 | bl = dh; |
| 2259 | dh = temp; |
| 2260 | } else { |
| 2261 | temp = bl; |
| 2262 | bl = bh; |
| 2263 | bh = temp; |
| 2264 | } |
| 2265 | } |
| 2266 | XGINew_SetReg3(pVBInfo->P3c9, (unsigned short) dh); |
| 2267 | XGINew_SetReg3(pVBInfo->P3c9, (unsigned short) bh); |
| 2268 | XGINew_SetReg3(pVBInfo->P3c9, (unsigned short) bl); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2269 | } |
| 2270 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2271 | void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 2272 | struct xgi_hw_device_info *HwDeviceExtension, |
| 2273 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2274 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2275 | unsigned short RefreshRateTableIndex; |
| 2276 | /* unsigned short temp ; */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2277 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2278 | /* pVBInfo->SelectCRT2Rate = 0; */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2279 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2280 | pVBInfo->SetFlag |= ProgrammingCRT2; |
| 2281 | RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, |
| 2282 | ModeIdIndex, pVBInfo); |
| 2283 | XGI_GetLVDSResInfo(ModeNo, ModeIdIndex, pVBInfo); |
| 2284 | XGI_GetLVDSData(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
| 2285 | XGI_ModCRT1Regs(ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 2286 | HwDeviceExtension, pVBInfo); |
| 2287 | XGI_SetLVDSRegs(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
| 2288 | XGI_SetCRT2ECLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2289 | } |
| 2290 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2291 | void XGI_GetLVDSResInfo(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 2292 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2293 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2294 | unsigned short resindex, xres, yres, modeflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2295 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2296 | if (ModeNo <= 0x13) |
| 2297 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; /* si+St_ResInfo */ |
| 2298 | else |
| 2299 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2300 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2301 | /* if (ModeNo > 0x13) */ |
| 2302 | /* modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; */ |
| 2303 | /* else */ |
| 2304 | /* modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2305 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2306 | if (ModeNo <= 0x13) |
| 2307 | resindex = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; /* si+St_ResInfo */ |
| 2308 | else |
| 2309 | resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2310 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2311 | /* resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2312 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2313 | if (ModeNo <= 0x13) { |
| 2314 | xres = pVBInfo->StResInfo[resindex].HTotal; |
| 2315 | yres = pVBInfo->StResInfo[resindex].VTotal; |
| 2316 | } else { |
| 2317 | xres = pVBInfo->ModeResInfo[resindex].HTotal; |
| 2318 | yres = pVBInfo->ModeResInfo[resindex].VTotal; |
| 2319 | } |
| 2320 | if (ModeNo > 0x13) { |
| 2321 | if (modeflag & HalfDCLK) |
| 2322 | xres = xres << 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2323 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2324 | if (modeflag & DoubleScanMode) |
| 2325 | yres = yres << 1; |
| 2326 | } |
| 2327 | /* if (modeflag & Charx8Dot) */ |
| 2328 | /* { */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2329 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2330 | if (xres == 720) |
| 2331 | xres = 640; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2332 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2333 | /* } */ |
| 2334 | pVBInfo->VGAHDE = xres; |
| 2335 | pVBInfo->HDE = xres; |
| 2336 | pVBInfo->VGAVDE = yres; |
| 2337 | pVBInfo->VDE = yres; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2338 | } |
| 2339 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2340 | void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 2341 | unsigned short RefreshRateTableIndex, |
| 2342 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2343 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2344 | unsigned short tempbx; |
| 2345 | struct XGI330_LVDSDataStruct *LCDPtr = NULL; |
| 2346 | struct XGI330_CHTVDataStruct *TVPtr = NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2347 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2348 | tempbx = 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2349 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2350 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { |
| 2351 | LCDPtr = (struct XGI330_LVDSDataStruct *) XGI_GetLcdPtr(tempbx, |
| 2352 | ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 2353 | pVBInfo); |
| 2354 | pVBInfo->VGAHT = LCDPtr->VGAHT; |
| 2355 | pVBInfo->VGAVT = LCDPtr->VGAVT; |
| 2356 | pVBInfo->HT = LCDPtr->LCDHT; |
| 2357 | pVBInfo->VT = LCDPtr->LCDVT; |
| 2358 | } |
| 2359 | if (pVBInfo->IF_DEF_CH7017 == 1) { |
| 2360 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 2361 | TVPtr = (struct XGI330_CHTVDataStruct *) XGI_GetTVPtr( |
| 2362 | tempbx, ModeNo, ModeIdIndex, |
| 2363 | RefreshRateTableIndex, pVBInfo); |
| 2364 | pVBInfo->VGAHT = TVPtr->VGAHT; |
| 2365 | pVBInfo->VGAVT = TVPtr->VGAVT; |
| 2366 | pVBInfo->HT = TVPtr->LCDHT; |
| 2367 | pVBInfo->VT = TVPtr->LCDVT; |
| 2368 | } |
| 2369 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2370 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2371 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { |
| 2372 | if (!(pVBInfo->LCDInfo & (SetLCDtoNonExpanding |
| 2373 | | EnableScalingLCD))) { |
| 2374 | if ((pVBInfo->LCDResInfo == Panel1024x768) |
| 2375 | || (pVBInfo->LCDResInfo |
| 2376 | == Panel1024x768x75)) { |
| 2377 | pVBInfo->HDE = 1024; |
| 2378 | pVBInfo->VDE = 768; |
| 2379 | } else if ((pVBInfo->LCDResInfo == Panel1280x1024) |
| 2380 | || (pVBInfo->LCDResInfo |
| 2381 | == Panel1280x1024x75)) { |
| 2382 | pVBInfo->HDE = 1280; |
| 2383 | pVBInfo->VDE = 1024; |
| 2384 | } else if (pVBInfo->LCDResInfo == Panel1400x1050) { |
| 2385 | pVBInfo->HDE = 1400; |
| 2386 | pVBInfo->VDE = 1050; |
| 2387 | } else { |
| 2388 | pVBInfo->HDE = 1600; |
| 2389 | pVBInfo->VDE = 1200; |
| 2390 | } |
| 2391 | } |
| 2392 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2393 | } |
| 2394 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2395 | void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2396 | unsigned short RefreshRateTableIndex, |
| 2397 | struct xgi_hw_device_info *HwDeviceExtension, |
| 2398 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2399 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2400 | unsigned char index; |
| 2401 | unsigned short tempbx, i; |
| 2402 | struct XGI_LVDSCRT1HDataStruct *LCDPtr = NULL; |
| 2403 | struct XGI_LVDSCRT1VDataStruct *LCDPtr1 = NULL; |
| 2404 | /* struct XGI330_CHTVDataStruct *TVPtr = NULL; */ |
| 2405 | struct XGI_CH7007TV_TimingHStruct *CH7007TV_TimingHPtr = NULL; |
| 2406 | struct XGI_CH7007TV_TimingVStruct *CH7007TV_TimingVPtr = NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2407 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2408 | if (ModeNo <= 0x13) |
| 2409 | index = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; |
| 2410 | else |
| 2411 | index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2412 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2413 | index = index & IndexMask; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2414 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2415 | if ((pVBInfo->IF_DEF_ScaleLCD == 0) || ((pVBInfo->IF_DEF_ScaleLCD == 1) |
| 2416 | && (!(pVBInfo->LCDInfo & EnableScalingLCD)))) { |
| 2417 | tempbx = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2418 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2419 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { |
| 2420 | LCDPtr |
| 2421 | = (struct XGI_LVDSCRT1HDataStruct *) XGI_GetLcdPtr( |
| 2422 | tempbx, ModeNo, |
| 2423 | ModeIdIndex, |
| 2424 | RefreshRateTableIndex, |
| 2425 | pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2426 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2427 | for (i = 0; i < 8; i++) |
| 2428 | pVBInfo->TimingH[0].data[i] = LCDPtr[0].Reg[i]; |
| 2429 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2430 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2431 | if (pVBInfo->IF_DEF_CH7007 == 1) { |
| 2432 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 2433 | CH7007TV_TimingHPtr |
| 2434 | = (struct XGI_CH7007TV_TimingHStruct *) XGI_GetTVPtr( |
| 2435 | tempbx, |
| 2436 | ModeNo, |
| 2437 | ModeIdIndex, |
| 2438 | RefreshRateTableIndex, |
| 2439 | pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2440 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2441 | for (i = 0; i < 8; i++) |
| 2442 | pVBInfo->TimingH[0].data[i] |
| 2443 | = CH7007TV_TimingHPtr[0].data[i]; |
| 2444 | } |
| 2445 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2446 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2447 | /* if (pVBInfo->IF_DEF_CH7017 == 1) { |
| 2448 | if (pVBInfo->VBInfo & SetCRT2ToTV) |
| 2449 | TVPtr = (struct XGI330_CHTVDataStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
| 2450 | } |
| 2451 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2452 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2453 | XGI_SetCRT1Timing_H(pVBInfo, HwDeviceExtension); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2454 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2455 | if (pVBInfo->IF_DEF_CH7007 == 1) { |
| 2456 | XGINew_SetReg1(pVBInfo->P3c4, 0x2E, |
| 2457 | CH7007TV_TimingHPtr[0].data[8]); |
| 2458 | XGINew_SetReg1(pVBInfo->P3c4, 0x2F, |
| 2459 | CH7007TV_TimingHPtr[0].data[9]); |
| 2460 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2461 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2462 | tempbx = 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2463 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2464 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { |
| 2465 | LCDPtr1 |
| 2466 | = (struct XGI_LVDSCRT1VDataStruct *) XGI_GetLcdPtr( |
| 2467 | tempbx, ModeNo, |
| 2468 | ModeIdIndex, |
| 2469 | RefreshRateTableIndex, |
| 2470 | pVBInfo); |
| 2471 | for (i = 0; i < 7; i++) |
| 2472 | pVBInfo->TimingV[0].data[i] = LCDPtr1[0].Reg[i]; |
| 2473 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2474 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2475 | if (pVBInfo->IF_DEF_CH7007 == 1) { |
| 2476 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 2477 | CH7007TV_TimingVPtr |
| 2478 | = (struct XGI_CH7007TV_TimingVStruct *) XGI_GetTVPtr( |
| 2479 | tempbx, |
| 2480 | ModeNo, |
| 2481 | ModeIdIndex, |
| 2482 | RefreshRateTableIndex, |
| 2483 | pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2484 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2485 | for (i = 0; i < 7; i++) |
| 2486 | pVBInfo->TimingV[0].data[i] |
| 2487 | = CH7007TV_TimingVPtr[0].data[i]; |
| 2488 | } |
| 2489 | } |
| 2490 | /* if (pVBInfo->IF_DEF_CH7017 == 1) { |
| 2491 | if (pVBInfo->VBInfo & SetCRT2ToTV) |
| 2492 | TVPtr = (struct XGI330_CHTVDataStruct *)XGI_GetTVPtr(tempbx, ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
| 2493 | } |
| 2494 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2495 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2496 | XGI_SetCRT1Timing_V(ModeIdIndex, ModeNo, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2497 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2498 | if (pVBInfo->IF_DEF_CH7007 == 1) { |
| 2499 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x33, ~0x01, |
| 2500 | CH7007TV_TimingVPtr[0].data[7] & 0x01); |
| 2501 | XGINew_SetReg1(pVBInfo->P3c4, 0x34, |
| 2502 | CH7007TV_TimingVPtr[0].data[8]); |
| 2503 | XGINew_SetReg1(pVBInfo->P3c4, 0x3F, |
| 2504 | CH7007TV_TimingVPtr[0].data[9]); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2505 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2506 | } |
| 2507 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2508 | } |
| 2509 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 2510 | void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2511 | unsigned short RefreshRateTableIndex, |
| 2512 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2513 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2514 | unsigned short tempbx, tempax, tempcx, tempdx, push1, push2, modeflag; |
| 2515 | unsigned long temp, temp1, temp2, temp3, push3; |
| 2516 | struct XGI330_LCDDataDesStruct *LCDPtr = NULL; |
| 2517 | struct XGI330_LCDDataDesStruct2 *LCDPtr1 = NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2518 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2519 | if (ModeNo > 0x13) |
| 2520 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 2521 | else |
| 2522 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2523 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2524 | if (!(pVBInfo->SetFlag & Win9xDOSMode)) { |
| 2525 | if ((pVBInfo->IF_DEF_CH7017 == 0) || (pVBInfo->VBInfo |
| 2526 | & (SetCRT2ToLCD | SetCRT2ToLCDA))) { |
| 2527 | if (pVBInfo->IF_DEF_OEMUtil == 1) { |
| 2528 | tempbx = 8; |
| 2529 | LCDPtr |
| 2530 | = (struct XGI330_LCDDataDesStruct *) XGI_GetLcdPtr( |
| 2531 | tempbx, |
| 2532 | ModeNo, |
| 2533 | ModeIdIndex, |
| 2534 | RefreshRateTableIndex, |
| 2535 | pVBInfo); |
| 2536 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2537 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2538 | if ((pVBInfo->IF_DEF_OEMUtil == 0) || (LCDPtr == NULL)) { |
| 2539 | tempbx = 3; |
| 2540 | if (pVBInfo->LCDInfo & EnableScalingLCD) |
| 2541 | LCDPtr1 |
| 2542 | = (struct XGI330_LCDDataDesStruct2 *) XGI_GetLcdPtr( |
| 2543 | tempbx, |
| 2544 | ModeNo, |
| 2545 | ModeIdIndex, |
| 2546 | RefreshRateTableIndex, |
| 2547 | pVBInfo); |
| 2548 | else |
| 2549 | LCDPtr |
| 2550 | = (struct XGI330_LCDDataDesStruct *) XGI_GetLcdPtr( |
| 2551 | tempbx, |
| 2552 | ModeNo, |
| 2553 | ModeIdIndex, |
| 2554 | RefreshRateTableIndex, |
| 2555 | pVBInfo); |
| 2556 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2557 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2558 | XGI_GetLCDSync(&tempax, &tempbx, pVBInfo); |
| 2559 | push1 = tempbx; |
| 2560 | push2 = tempax; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2561 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2562 | /* GetLCDResInfo */ |
| 2563 | if ((pVBInfo->LCDResInfo == Panel1024x768) |
| 2564 | || (pVBInfo->LCDResInfo |
| 2565 | == Panel1024x768x75)) { |
| 2566 | tempax = 1024; |
| 2567 | tempbx = 768; |
| 2568 | } else if ((pVBInfo->LCDResInfo == Panel1280x1024) |
| 2569 | || (pVBInfo->LCDResInfo |
| 2570 | == Panel1280x1024x75)) { |
| 2571 | tempax = 1280; |
| 2572 | tempbx = 1024; |
| 2573 | } else if (pVBInfo->LCDResInfo == Panel1400x1050) { |
| 2574 | tempax = 1400; |
| 2575 | tempbx = 1050; |
| 2576 | } else { |
| 2577 | tempax = 1600; |
| 2578 | tempbx = 1200; |
| 2579 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2580 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2581 | if (pVBInfo->LCDInfo & SetLCDtoNonExpanding) { |
| 2582 | pVBInfo->HDE = tempax; |
| 2583 | pVBInfo->VDE = tempbx; |
| 2584 | pVBInfo->VGAHDE = tempax; |
| 2585 | pVBInfo->VGAVDE = tempbx; |
| 2586 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2587 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2588 | if ((pVBInfo->IF_DEF_ScaleLCD == 1) |
| 2589 | && (pVBInfo->LCDInfo & EnableScalingLCD)) { |
| 2590 | tempax = pVBInfo->HDE; |
| 2591 | tempbx = pVBInfo->VDE; |
| 2592 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2593 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2594 | tempax = pVBInfo->HT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2595 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2596 | if (pVBInfo->LCDInfo & EnableScalingLCD) |
| 2597 | tempbx = LCDPtr1->LCDHDES; |
| 2598 | else |
| 2599 | tempbx = LCDPtr->LCDHDES; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2600 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2601 | tempcx = pVBInfo->HDE; |
| 2602 | tempbx = tempbx & 0x0fff; |
| 2603 | tempcx += tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2604 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2605 | if (tempcx >= tempax) |
| 2606 | tempcx -= tempax; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2607 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2608 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1A, tempbx & 0x07); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2609 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2610 | tempcx = tempcx >> 3; |
| 2611 | tempbx = tempbx >> 3; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2612 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2613 | XGINew_SetReg1(pVBInfo->Part1Port, 0x16, |
| 2614 | (unsigned short) (tempbx & 0xff)); |
| 2615 | XGINew_SetReg1(pVBInfo->Part1Port, 0x17, |
| 2616 | (unsigned short) (tempcx & 0xff)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2617 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2618 | tempax = pVBInfo->HT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2619 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2620 | if (pVBInfo->LCDInfo & EnableScalingLCD) |
| 2621 | tempbx = LCDPtr1->LCDHRS; |
| 2622 | else |
| 2623 | tempbx = LCDPtr->LCDHRS; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2624 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2625 | tempcx = push2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2626 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2627 | if (pVBInfo->LCDInfo & EnableScalingLCD) |
| 2628 | tempcx = LCDPtr1->LCDHSync; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2629 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2630 | tempcx += tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2631 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2632 | if (tempcx >= tempax) |
| 2633 | tempcx -= tempax; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2634 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2635 | tempax = tempbx & 0x07; |
| 2636 | tempax = tempax >> 5; |
| 2637 | tempcx = tempcx >> 3; |
| 2638 | tempbx = tempbx >> 3; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2639 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2640 | tempcx &= 0x1f; |
| 2641 | tempax |= tempcx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2642 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2643 | XGINew_SetReg1(pVBInfo->Part1Port, 0x15, tempax); |
| 2644 | XGINew_SetReg1(pVBInfo->Part1Port, 0x14, |
| 2645 | (unsigned short) (tempbx & 0xff)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2646 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2647 | tempax = pVBInfo->VT; |
| 2648 | if (pVBInfo->LCDInfo & EnableScalingLCD) |
| 2649 | tempbx = LCDPtr1->LCDVDES; |
| 2650 | else |
| 2651 | tempbx = LCDPtr->LCDVDES; |
| 2652 | tempcx = pVBInfo->VDE; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2653 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2654 | tempbx = tempbx & 0x0fff; |
| 2655 | tempcx += tempbx; |
| 2656 | if (tempcx >= tempax) |
| 2657 | tempcx -= tempax; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2658 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2659 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1b, |
| 2660 | (unsigned short) (tempbx & 0xff)); |
| 2661 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1c, |
| 2662 | (unsigned short) (tempcx & 0xff)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2663 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2664 | tempbx = (tempbx >> 8) & 0x07; |
| 2665 | tempcx = (tempcx >> 8) & 0x07; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2666 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2667 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1d, |
| 2668 | (unsigned short) ((tempcx << 3) |
| 2669 | | tempbx)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2670 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2671 | tempax = pVBInfo->VT; |
| 2672 | if (pVBInfo->LCDInfo & EnableScalingLCD) |
| 2673 | tempbx = LCDPtr1->LCDVRS; |
| 2674 | else |
| 2675 | tempbx = LCDPtr->LCDVRS; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2676 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2677 | /* tempbx = tempbx >> 4; */ |
| 2678 | tempcx = push1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2679 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2680 | if (pVBInfo->LCDInfo & EnableScalingLCD) |
| 2681 | tempcx = LCDPtr1->LCDVSync; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2682 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2683 | tempcx += tempbx; |
| 2684 | if (tempcx >= tempax) |
| 2685 | tempcx -= tempax; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2686 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2687 | XGINew_SetReg1(pVBInfo->Part1Port, 0x18, |
| 2688 | (unsigned short) (tempbx & 0xff)); |
| 2689 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, ~0x0f, |
| 2690 | (unsigned short) (tempcx & 0x0f)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2691 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2692 | tempax = ((tempbx >> 8) & 0x07) << 3; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2693 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2694 | tempbx = pVBInfo->VGAVDE; |
| 2695 | if (tempbx != pVBInfo->VDE) |
| 2696 | tempax |= 0x40; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2697 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2698 | if (pVBInfo->LCDInfo & EnableLVDSDDA) |
| 2699 | tempax |= 0x40; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2700 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2701 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1a, 0x07, |
| 2702 | tempax); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2703 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2704 | tempcx = pVBInfo->VGAVT; |
| 2705 | tempbx = pVBInfo->VDE; |
| 2706 | tempax = pVBInfo->VGAVDE; |
| 2707 | tempcx -= tempax; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2708 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2709 | temp = tempax; /* 0430 ylshieh */ |
| 2710 | temp1 = (temp << 18) / tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2711 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2712 | tempdx = (unsigned short) ((temp << 18) % tempbx); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2713 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2714 | if (tempdx != 0) |
| 2715 | temp1 += 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2716 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2717 | temp2 = temp1; |
| 2718 | push3 = temp2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2719 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2720 | XGINew_SetReg1(pVBInfo->Part1Port, 0x37, |
| 2721 | (unsigned short) (temp2 & 0xff)); |
| 2722 | XGINew_SetReg1(pVBInfo->Part1Port, 0x36, |
| 2723 | (unsigned short) ((temp2 >> 8) & 0xff)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2724 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2725 | tempbx = (unsigned short) (temp2 >> 16); |
| 2726 | tempax = tempbx & 0x03; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2727 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2728 | tempbx = pVBInfo->VGAVDE; |
| 2729 | if (tempbx == pVBInfo->VDE) |
| 2730 | tempax |= 0x04; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2731 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2732 | XGINew_SetReg1(pVBInfo->Part1Port, 0x35, tempax); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2733 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2734 | if (pVBInfo->VBType & VB_XGI301C) { |
| 2735 | temp2 = push3; |
| 2736 | XGINew_SetReg1(pVBInfo->Part4Port, 0x3c, |
| 2737 | (unsigned short) (temp2 & 0xff)); |
| 2738 | XGINew_SetReg1(pVBInfo->Part4Port, 0x3b, |
| 2739 | (unsigned short) ((temp2 >> 8) |
| 2740 | & 0xff)); |
| 2741 | tempbx = (unsigned short) (temp2 >> 16); |
| 2742 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x3a, |
| 2743 | ~0xc0, |
| 2744 | (unsigned short) ((tempbx |
| 2745 | & 0xff) << 6)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2746 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2747 | tempcx = pVBInfo->VGAVDE; |
| 2748 | if (tempcx == pVBInfo->VDE) |
| 2749 | XGINew_SetRegANDOR(pVBInfo->Part4Port, |
| 2750 | 0x30, ~0x0c, 0x00); |
| 2751 | else |
| 2752 | XGINew_SetRegANDOR(pVBInfo->Part4Port, |
| 2753 | 0x30, ~0x0c, 0x08); |
| 2754 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2755 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2756 | tempcx = pVBInfo->VGAHDE; |
| 2757 | tempbx = pVBInfo->HDE; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2758 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2759 | temp1 = tempcx << 16; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2760 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2761 | tempax = (unsigned short) (temp1 / tempbx); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2762 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2763 | if ((tempbx & 0xffff) == (tempcx & 0xffff)) |
| 2764 | tempax = 65535; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2765 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2766 | temp3 = tempax; |
| 2767 | temp1 = pVBInfo->VGAHDE << 16; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2768 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2769 | temp1 /= temp3; |
| 2770 | temp3 = temp3 << 16; |
| 2771 | temp1 -= 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2772 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2773 | temp3 = (temp3 & 0xffff0000) + (temp1 & 0xffff); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2774 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2775 | tempax = (unsigned short) (temp3 & 0xff); |
| 2776 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1f, tempax); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2777 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2778 | temp1 = pVBInfo->VGAVDE << 18; |
| 2779 | temp1 = temp1 / push3; |
| 2780 | tempbx = (unsigned short) (temp1 & 0xffff); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2781 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2782 | if (pVBInfo->LCDResInfo == Panel1024x768) |
| 2783 | tempbx -= 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2784 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2785 | tempax = ((tempbx >> 8) & 0xff) << 3; |
| 2786 | tempax |= (unsigned short) ((temp3 >> 8) & 0x07); |
| 2787 | XGINew_SetReg1(pVBInfo->Part1Port, 0x20, |
| 2788 | (unsigned short) (tempax & 0xff)); |
| 2789 | XGINew_SetReg1(pVBInfo->Part1Port, 0x21, |
| 2790 | (unsigned short) (tempbx & 0xff)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2791 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2792 | temp3 = temp3 >> 16; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2793 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2794 | if (modeflag & HalfDCLK) |
| 2795 | temp3 = temp3 >> 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2796 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2797 | XGINew_SetReg1(pVBInfo->Part1Port, 0x22, |
| 2798 | (unsigned short) ((temp3 >> 8) & 0xff)); |
| 2799 | XGINew_SetReg1(pVBInfo->Part1Port, 0x23, |
| 2800 | (unsigned short) (temp3 & 0xff)); |
| 2801 | } |
| 2802 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2803 | } |
| 2804 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2805 | void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 2806 | unsigned short RefreshRateTableIndex, |
| 2807 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2808 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2809 | unsigned char di_0, di_1, tempal; |
| 2810 | int i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2811 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2812 | tempal = XGI_GetVCLKPtr(RefreshRateTableIndex, ModeNo, ModeIdIndex, |
| 2813 | pVBInfo); |
| 2814 | XGI_GetVCLKLen(tempal, &di_0, &di_1, pVBInfo); |
| 2815 | XGI_GetLCDVCLKPtr(&di_0, &di_1, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2816 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2817 | for (i = 0; i < 4; i++) { |
| 2818 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x31, ~0x30, |
| 2819 | (unsigned short) (0x10 * i)); |
| 2820 | if (pVBInfo->IF_DEF_CH7007 == 1) { |
| 2821 | XGINew_SetReg1(pVBInfo->P3c4, 0x2b, di_0); |
| 2822 | XGINew_SetReg1(pVBInfo->P3c4, 0x2c, di_1); |
| 2823 | } else if ((!(pVBInfo->VBInfo & SetCRT2ToLCDA)) |
| 2824 | && (!(pVBInfo->VBInfo & SetInSlaveMode))) { |
| 2825 | XGINew_SetReg1(pVBInfo->P3c4, 0x2e, di_0); |
| 2826 | XGINew_SetReg1(pVBInfo->P3c4, 0x2f, di_1); |
| 2827 | } else { |
| 2828 | XGINew_SetReg1(pVBInfo->P3c4, 0x2b, di_0); |
| 2829 | XGINew_SetReg1(pVBInfo->P3c4, 0x2c, di_1); |
| 2830 | } |
| 2831 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2832 | } |
| 2833 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2834 | void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension, |
| 2835 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2836 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2837 | unsigned short tempcl, tempch, temp, tempbl, tempax; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2838 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2839 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 2840 | | VB_XGI302LV | VB_XGI301C)) { |
| 2841 | tempcl = 0; |
| 2842 | tempch = 0; |
| 2843 | temp = XGINew_GetReg1(pVBInfo->P3c4, 0x01); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2844 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2845 | if (!(temp & 0x20)) { |
| 2846 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x17); |
| 2847 | if (temp & 0x80) { |
| 2848 | if ((HwDeviceExtension->jChipType >= XG20) |
| 2849 | || (HwDeviceExtension->jChipType |
| 2850 | >= XG40)) |
| 2851 | temp = XGINew_GetReg1(pVBInfo->P3d4, |
| 2852 | 0x53); |
| 2853 | else |
| 2854 | temp = XGINew_GetReg1(pVBInfo->P3d4, |
| 2855 | 0x63); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2856 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2857 | if (!(temp & 0x40)) |
| 2858 | tempcl |= ActiveCRT1; |
| 2859 | } |
| 2860 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2861 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2862 | temp = XGINew_GetReg1(pVBInfo->Part1Port, 0x2e); |
| 2863 | temp &= 0x0f; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2864 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2865 | if (!(temp == 0x08)) { |
| 2866 | tempax = XGINew_GetReg1(pVBInfo->Part1Port, 0x13); /* Check ChannelA by Part1_13 [2003/10/03] */ |
| 2867 | if (tempax & 0x04) |
| 2868 | tempcl = tempcl | ActiveLCD; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2869 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2870 | temp &= 0x05; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2871 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2872 | if (!(tempcl & ActiveLCD)) |
| 2873 | if (temp == 0x01) |
| 2874 | tempcl |= ActiveCRT2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2875 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2876 | if (temp == 0x04) |
| 2877 | tempcl |= ActiveLCD; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2878 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2879 | if (temp == 0x05) { |
| 2880 | temp = XGINew_GetReg1(pVBInfo->Part2Port, 0x00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2881 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2882 | if (!(temp & 0x08)) |
| 2883 | tempch |= ActiveAVideo; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2884 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2885 | if (!(temp & 0x04)) |
| 2886 | tempch |= ActiveSVideo; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2887 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2888 | if (temp & 0x02) |
| 2889 | tempch |= ActiveSCART; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2890 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2891 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { |
| 2892 | if (temp & 0x01) |
| 2893 | tempch |= ActiveHiTV; |
| 2894 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2895 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2896 | if (pVBInfo->VBInfo & SetCRT2ToYPbPr) { |
| 2897 | temp = XGINew_GetReg1( |
| 2898 | pVBInfo->Part2Port, |
| 2899 | 0x4d); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2900 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2901 | if (temp & 0x10) |
| 2902 | tempch |= ActiveYPbPr; |
| 2903 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2904 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2905 | if (tempch != 0) |
| 2906 | tempcl |= ActiveTV; |
| 2907 | } |
| 2908 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2909 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2910 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x3d); |
| 2911 | if (tempcl & ActiveLCD) { |
| 2912 | if ((pVBInfo->SetFlag & ReserveTVOption)) { |
| 2913 | if (temp & ActiveTV) |
| 2914 | tempcl |= ActiveTV; |
| 2915 | } |
| 2916 | } |
| 2917 | temp = tempcl; |
| 2918 | tempbl = ~ModeSwitchStatus; |
| 2919 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x3d, tempbl, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2920 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2921 | if (!(pVBInfo->SetFlag & ReserveTVOption)) |
| 2922 | XGINew_SetReg1(pVBInfo->P3d4, 0x3e, tempch); |
| 2923 | } else { |
| 2924 | return; |
| 2925 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2926 | } |
| 2927 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2928 | void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension, |
| 2929 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2930 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2931 | /* |
| 2932 | if ( HwDeviceExtension->jChipType >= XG20 ) { |
| 2933 | pVBInfo->Set_VGAType = XG20; |
| 2934 | } else if (HwDeviceExtension->jChipType >= XG40) { |
| 2935 | pVBInfo->Set_VGAType = VGA_XGI340; |
| 2936 | } |
| 2937 | */ |
| 2938 | pVBInfo->Set_VGAType = HwDeviceExtension->jChipType; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2939 | } |
| 2940 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 2941 | void XGI_GetVBType(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2942 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2943 | unsigned short flag, tempbx, tempah; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2944 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2945 | if (pVBInfo->IF_DEF_CH7007 == 1) { |
| 2946 | pVBInfo->VBType = VB_CH7007; |
| 2947 | return; |
| 2948 | } |
| 2949 | if (pVBInfo->IF_DEF_LVDS == 0) { |
| 2950 | tempbx = VB_XGI302B; |
| 2951 | flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x00); |
| 2952 | if (flag != 0x02) { |
| 2953 | tempbx = VB_XGI301; |
| 2954 | flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x01); |
| 2955 | if (flag >= 0xB0) { |
| 2956 | tempbx = VB_XGI301B; |
| 2957 | if (flag >= 0xC0) { |
| 2958 | tempbx = VB_XGI301C; |
| 2959 | if (flag >= 0xD0) { |
| 2960 | tempbx = VB_XGI301LV; |
| 2961 | if (flag >= 0xE0) { |
| 2962 | tempbx = VB_XGI302LV; |
| 2963 | tempah |
| 2964 | = XGINew_GetReg1( |
| 2965 | pVBInfo->Part4Port, |
| 2966 | 0x39); |
| 2967 | if (tempah != 0xFF) |
| 2968 | tempbx |
| 2969 | = VB_XGI301C; |
| 2970 | } |
| 2971 | } |
| 2972 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2973 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2974 | if (tempbx & (VB_XGI301B | VB_XGI302B)) { |
| 2975 | flag = XGINew_GetReg1( |
| 2976 | pVBInfo->Part4Port, |
| 2977 | 0x23); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2978 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2979 | if (!(flag & 0x02)) |
| 2980 | tempbx = tempbx | VB_NoLCD; |
| 2981 | } |
| 2982 | } |
| 2983 | } |
| 2984 | pVBInfo->VBType = tempbx; |
| 2985 | } |
| 2986 | /* |
| 2987 | else if (pVBInfo->IF_DEF_CH7017 == 1) |
| 2988 | pVBInfo->VBType = VB_CH7017; |
| 2989 | else //LVDS |
| 2990 | pVBInfo->VBType = VB_LVDS_NS; |
| 2991 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2992 | |
| 2993 | } |
| 2994 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2995 | void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 2996 | struct xgi_hw_device_info *HwDeviceExtension, |
| 2997 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 2998 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 2999 | unsigned short tempax, push, tempbx, temp, modeflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3000 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3001 | if (ModeNo <= 0x13) |
| 3002 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 3003 | else |
| 3004 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3005 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3006 | pVBInfo->SetFlag = 0; |
| 3007 | pVBInfo->ModeType = modeflag & ModeInfoFlag; |
| 3008 | tempbx = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3009 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3010 | if (pVBInfo->VBType & 0xFFFF) { |
| 3011 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x30); /* Check Display Device */ |
| 3012 | tempbx = tempbx | temp; |
| 3013 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x31); |
| 3014 | push = temp; |
| 3015 | push = push << 8; |
| 3016 | tempax = temp << 8; |
| 3017 | tempbx = tempbx | tempax; |
| 3018 | temp = (SetCRT2ToDualEdge | SetCRT2ToYPbPr | SetCRT2ToLCDA |
| 3019 | | SetInSlaveMode | DisableCRT2Display); |
| 3020 | temp = 0xFFFF ^ temp; |
| 3021 | tempbx &= temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3022 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3023 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x38); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3024 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3025 | if (pVBInfo->IF_DEF_LCDA == 1) { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3026 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3027 | if ((pVBInfo->Set_VGAType >= XG20) |
| 3028 | || (pVBInfo->Set_VGAType >= XG40)) { |
| 3029 | if (pVBInfo->IF_DEF_LVDS == 0) { |
| 3030 | /* if ((pVBInfo->VBType & VB_XGI302B) || (pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType & VB_XGI302LV) || (pVBInfo->VBType & VB_XGI301C)) */ |
| 3031 | if (pVBInfo->VBType & (VB_XGI302B |
| 3032 | | VB_XGI301LV |
| 3033 | | VB_XGI302LV |
| 3034 | | VB_XGI301C)) { |
| 3035 | if (temp & EnableDualEdge) { |
| 3036 | tempbx |
| 3037 | |= SetCRT2ToDualEdge; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3038 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3039 | if (temp & SetToLCDA) |
| 3040 | tempbx |
| 3041 | |= SetCRT2ToLCDA; |
| 3042 | } |
| 3043 | } |
| 3044 | } else if (pVBInfo->IF_DEF_CH7017 == 1) { |
| 3045 | if (pVBInfo->VBType & VB_CH7017) { |
| 3046 | if (temp & EnableDualEdge) { |
| 3047 | tempbx |
| 3048 | |= SetCRT2ToDualEdge; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3049 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3050 | if (temp & SetToLCDA) |
| 3051 | tempbx |
| 3052 | |= SetCRT2ToLCDA; |
| 3053 | } |
| 3054 | } |
| 3055 | } |
| 3056 | } |
| 3057 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3058 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3059 | if (pVBInfo->IF_DEF_YPbPr == 1) { |
| 3060 | if (((pVBInfo->IF_DEF_LVDS == 0) && ((pVBInfo->VBType |
| 3061 | & VB_XGI301LV) || (pVBInfo->VBType |
| 3062 | & VB_XGI302LV) || (pVBInfo->VBType |
| 3063 | & VB_XGI301C))) |
| 3064 | || ((pVBInfo->IF_DEF_CH7017 == 1) |
| 3065 | && (pVBInfo->VBType |
| 3066 | & VB_CH7017)) |
| 3067 | || ((pVBInfo->IF_DEF_CH7007 == 1) |
| 3068 | && (pVBInfo->VBType |
| 3069 | & VB_CH7007))) { /* [Billy] 07/05/04 */ |
| 3070 | if (temp & SetYPbPr) { /* temp = CR38 */ |
| 3071 | if (pVBInfo->IF_DEF_HiVision == 1) { |
| 3072 | temp = XGINew_GetReg1( |
| 3073 | pVBInfo->P3d4, |
| 3074 | 0x35); /* shampoo add for new scratch */ |
| 3075 | temp &= YPbPrMode; |
| 3076 | tempbx |= SetCRT2ToHiVisionTV; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3077 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3078 | if (temp != YPbPrMode1080i) { |
| 3079 | tempbx |
| 3080 | &= (~SetCRT2ToHiVisionTV); |
| 3081 | tempbx |
| 3082 | |= SetCRT2ToYPbPr; |
| 3083 | } |
| 3084 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3085 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3086 | /* tempbx |= SetCRT2ToYPbPr; */ |
| 3087 | } |
| 3088 | } |
| 3089 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3090 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3091 | tempax = push; /* restore CR31 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3092 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3093 | if (pVBInfo->IF_DEF_LVDS == 0) { |
| 3094 | if (pVBInfo->IF_DEF_YPbPr == 1) { |
| 3095 | if (pVBInfo->IF_DEF_HiVision == 1) |
| 3096 | temp = 0x09FC; |
| 3097 | else |
| 3098 | temp = 0x097C; |
| 3099 | } else { |
| 3100 | if (pVBInfo->IF_DEF_HiVision == 1) |
| 3101 | temp = 0x01FC; |
| 3102 | else |
| 3103 | temp = 0x017C; |
| 3104 | } |
| 3105 | } else { /* 3nd party chip */ |
| 3106 | if (pVBInfo->IF_DEF_CH7017 == 1) |
| 3107 | temp = (SetCRT2ToTV | SetCRT2ToLCD |
| 3108 | | SetCRT2ToLCDA); |
| 3109 | else if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 07/05/03 */ |
| 3110 | temp = SetCRT2ToTV; |
| 3111 | } else |
| 3112 | temp = SetCRT2ToLCD; |
| 3113 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3114 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3115 | if (!(tempbx & temp)) { |
| 3116 | tempax |= DisableCRT2Display; |
| 3117 | tempbx = 0; |
| 3118 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3119 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3120 | if (pVBInfo->IF_DEF_LCDA == 1) { /* Select Display Device */ |
| 3121 | if (!(pVBInfo->VBType & VB_NoLCD)) { |
| 3122 | if (tempbx & SetCRT2ToLCDA) { |
| 3123 | if (tempbx & SetSimuScanMode) |
| 3124 | tempbx |
| 3125 | &= (~(SetCRT2ToLCD |
| 3126 | | SetCRT2ToRAMDAC |
| 3127 | | SwitchToCRT2)); |
| 3128 | else |
| 3129 | tempbx |
| 3130 | &= (~(SetCRT2ToLCD |
| 3131 | | SetCRT2ToRAMDAC |
| 3132 | | SetCRT2ToTV |
| 3133 | | SwitchToCRT2)); |
| 3134 | } |
| 3135 | } |
| 3136 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3137 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3138 | /* shampoo add */ |
| 3139 | if (!(tempbx & (SwitchToCRT2 | SetSimuScanMode))) { /* for driver abnormal */ |
| 3140 | if (pVBInfo->IF_DEF_CRT2Monitor == 1) { |
| 3141 | if (tempbx & SetCRT2ToRAMDAC) { |
| 3142 | tempbx &= (0xFF00 | SetCRT2ToRAMDAC |
| 3143 | | SwitchToCRT2 |
| 3144 | | SetSimuScanMode); |
| 3145 | tempbx &= (0x00FF | (~SetCRT2ToYPbPr)); |
| 3146 | } |
| 3147 | } else { |
| 3148 | tempbx &= (~(SetCRT2ToRAMDAC | SetCRT2ToLCD |
| 3149 | | SetCRT2ToTV)); |
| 3150 | } |
| 3151 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3152 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3153 | if (!(pVBInfo->VBType & VB_NoLCD)) { |
| 3154 | if (tempbx & SetCRT2ToLCD) { |
| 3155 | tempbx &= (0xFF00 | SetCRT2ToLCD | SwitchToCRT2 |
| 3156 | | SetSimuScanMode); |
| 3157 | tempbx &= (0x00FF | (~SetCRT2ToYPbPr)); |
| 3158 | } |
| 3159 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3160 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3161 | if (tempbx & SetCRT2ToSCART) { |
| 3162 | tempbx &= (0xFF00 | SetCRT2ToSCART | SwitchToCRT2 |
| 3163 | | SetSimuScanMode); |
| 3164 | tempbx &= (0x00FF | (~SetCRT2ToYPbPr)); |
| 3165 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3166 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3167 | if (pVBInfo->IF_DEF_YPbPr == 1) { |
| 3168 | if (tempbx & SetCRT2ToYPbPr) |
| 3169 | tempbx &= (0xFF00 | SwitchToCRT2 |
| 3170 | | SetSimuScanMode); |
| 3171 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3172 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3173 | if (pVBInfo->IF_DEF_HiVision == 1) { |
| 3174 | if (tempbx & SetCRT2ToHiVisionTV) |
| 3175 | tempbx &= (0xFF00 | SetCRT2ToHiVisionTV |
| 3176 | | SwitchToCRT2 |
| 3177 | | SetSimuScanMode); |
| 3178 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3179 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3180 | if (tempax & DisableCRT2Display) { /* Set Display Device Info */ |
| 3181 | if (!(tempbx & (SwitchToCRT2 | SetSimuScanMode))) |
| 3182 | tempbx = DisableCRT2Display; |
| 3183 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3184 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3185 | if (!(tempbx & DisableCRT2Display)) { |
| 3186 | if ((!(tempbx & DriverMode)) |
| 3187 | || (!(modeflag & CRT2Mode))) { |
| 3188 | if (pVBInfo->IF_DEF_LCDA == 1) { |
| 3189 | if (!(tempbx & SetCRT2ToLCDA)) |
| 3190 | tempbx |
| 3191 | |= (SetInSlaveMode |
| 3192 | | SetSimuScanMode); |
| 3193 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3194 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3195 | if (pVBInfo->IF_DEF_VideoCapture == 1) { |
| 3196 | if (((HwDeviceExtension->jChipType |
| 3197 | == XG40) |
| 3198 | && (pVBInfo->Set_VGAType |
| 3199 | == XG40)) |
| 3200 | || ((HwDeviceExtension->jChipType |
| 3201 | == XG41) |
| 3202 | && (pVBInfo->Set_VGAType |
| 3203 | == XG41)) |
| 3204 | || ((HwDeviceExtension->jChipType |
| 3205 | == XG42) |
| 3206 | && (pVBInfo->Set_VGAType |
| 3207 | == XG42)) |
| 3208 | || ((HwDeviceExtension->jChipType |
| 3209 | == XG45) |
| 3210 | && (pVBInfo->Set_VGAType |
| 3211 | == XG45))) { |
| 3212 | if (ModeNo <= 13) { |
| 3213 | if (!(tempbx |
| 3214 | & SetCRT2ToRAMDAC)) { /*CRT2 not need to support*/ |
| 3215 | tempbx |
| 3216 | &= (0x00FF |
| 3217 | | (~SetInSlaveMode)); |
| 3218 | pVBInfo->SetFlag |
| 3219 | |= EnableVCMode; |
| 3220 | } |
| 3221 | } |
| 3222 | } |
| 3223 | } |
| 3224 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3225 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3226 | /* LCD+TV can't support in slave mode (Force LCDA+TV->LCDB) */ |
| 3227 | if ((tempbx & SetInSlaveMode) && (tempbx |
| 3228 | & SetCRT2ToLCDA)) { |
| 3229 | tempbx ^= (SetCRT2ToLCD | SetCRT2ToLCDA |
| 3230 | | SetCRT2ToDualEdge); |
| 3231 | pVBInfo->SetFlag |= ReserveTVOption; |
| 3232 | } |
| 3233 | } |
| 3234 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3235 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3236 | pVBInfo->VBInfo = tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3237 | } |
| 3238 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3239 | void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 3240 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3241 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3242 | unsigned short temp, tempbx = 0, resinfo = 0, modeflag, index1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3243 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3244 | tempbx = 0; |
| 3245 | resinfo = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3246 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3247 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 3248 | if (ModeNo <= 0x13) { |
| 3249 | modeflag |
| 3250 | = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ModeFlag */ |
| 3251 | resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; /* si+St_ResInfo */ |
| 3252 | } else { |
| 3253 | modeflag |
| 3254 | = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 3255 | resinfo |
| 3256 | = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo */ |
| 3257 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3258 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3259 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 3260 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x35); |
| 3261 | tempbx = temp; |
| 3262 | if (tempbx & SetPALTV) { |
| 3263 | tempbx &= (SetCHTVOverScan | SetPALMTV |
| 3264 | | SetPALNTV | SetPALTV); |
| 3265 | if (tempbx & SetPALMTV) |
| 3266 | tempbx &= ~SetPALTV; /* set to NTSC if PAL-M */ |
| 3267 | } else |
| 3268 | tempbx &= (SetCHTVOverScan | SetNTSCJ |
| 3269 | | SetPALTV); |
| 3270 | /* |
| 3271 | if (pVBInfo->IF_DEF_LVDS == 0) { |
| 3272 | index1 = XGINew_GetReg1(pVBInfo->P3d4, 0x38); //PAL-M/PAL-N Info |
| 3273 | temp2 = (index1 & 0xC0) >> 5; //00:PAL, 01:PAL-M, 10:PAL-N |
| 3274 | tempbx |= temp2; |
| 3275 | if (temp2 & 0x02) //PAL-M |
| 3276 | tempbx &= (~SetPALTV); |
| 3277 | } |
| 3278 | */ |
| 3279 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3280 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3281 | if (pVBInfo->IF_DEF_CH7017 == 1) { |
| 3282 | tempbx = XGINew_GetReg1(pVBInfo->P3d4, 0x35); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3283 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3284 | if (tempbx & TVOverScan) |
| 3285 | tempbx |= SetCHTVOverScan; |
| 3286 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3287 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3288 | if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 07/05/04 */ |
| 3289 | tempbx = XGINew_GetReg1(pVBInfo->P3d4, 0x35); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3290 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3291 | if (tempbx & TVOverScan) |
| 3292 | tempbx |= SetCHTVOverScan; |
| 3293 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3294 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3295 | if (pVBInfo->IF_DEF_LVDS == 0) { |
| 3296 | if (pVBInfo->VBInfo & SetCRT2ToSCART) |
| 3297 | tempbx |= SetPALTV; |
| 3298 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3299 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3300 | if (pVBInfo->IF_DEF_YPbPr == 1) { |
| 3301 | if (pVBInfo->VBInfo & SetCRT2ToYPbPr) { |
| 3302 | index1 = XGINew_GetReg1(pVBInfo->P3d4, 0x35); |
| 3303 | index1 &= YPbPrMode; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3304 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3305 | if (index1 == YPbPrMode525i) |
| 3306 | tempbx |= SetYPbPrMode525i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3307 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3308 | if (index1 == YPbPrMode525p) |
| 3309 | tempbx = tempbx | SetYPbPrMode525p; |
| 3310 | if (index1 == YPbPrMode750p) |
| 3311 | tempbx = tempbx | SetYPbPrMode750p; |
| 3312 | } |
| 3313 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3314 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3315 | if (pVBInfo->IF_DEF_HiVision == 1) { |
| 3316 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) |
| 3317 | tempbx = tempbx | SetYPbPrMode1080i | SetPALTV; |
| 3318 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3319 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3320 | if (pVBInfo->IF_DEF_LVDS == 0) { /* shampoo */ |
| 3321 | if ((pVBInfo->VBInfo & SetInSlaveMode) |
| 3322 | && (!(pVBInfo->VBInfo & SetNotSimuMode))) |
| 3323 | tempbx |= TVSimuMode; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3324 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3325 | if (!(tempbx & SetPALTV) && (modeflag > 13) && (resinfo |
| 3326 | == 8)) /* NTSC 1024x768, */ |
| 3327 | tempbx |= NTSC1024x768; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3328 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3329 | tempbx |= RPLLDIV2XO; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3330 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3331 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { |
| 3332 | if (pVBInfo->VBInfo & SetInSlaveMode) |
| 3333 | tempbx &= (~RPLLDIV2XO); |
| 3334 | } else { |
| 3335 | if (tempbx & (SetYPbPrMode525p |
| 3336 | | SetYPbPrMode750p)) |
| 3337 | tempbx &= (~RPLLDIV2XO); |
| 3338 | else if (!(pVBInfo->VBType & (VB_XGI301B |
| 3339 | | VB_XGI302B | VB_XGI301LV |
| 3340 | | VB_XGI302LV | VB_XGI301C))) { |
| 3341 | if (tempbx & TVSimuMode) |
| 3342 | tempbx &= (~RPLLDIV2XO); |
| 3343 | } |
| 3344 | } |
| 3345 | } |
| 3346 | } |
| 3347 | pVBInfo->TVInfo = tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3348 | } |
| 3349 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 3350 | unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3351 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3352 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3353 | unsigned short temp, tempax, tempbx, modeflag, resinfo = 0, LCDIdIndex; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3354 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3355 | pVBInfo->LCDResInfo = 0; |
| 3356 | pVBInfo->LCDTypeInfo = 0; |
| 3357 | pVBInfo->LCDInfo = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3358 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3359 | if (ModeNo <= 0x13) { |
| 3360 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ModeFlag // */ |
| 3361 | } else { |
| 3362 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 3363 | resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo // */ |
| 3364 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3365 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3366 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x36); /* Get LCD Res.Info */ |
| 3367 | tempbx = temp & 0x0F; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3368 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3369 | if (tempbx == 0) |
| 3370 | tempbx = Panel1024x768; /* default */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3371 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3372 | /* LCD75 [2003/8/22] Vicent */ |
| 3373 | if ((tempbx == Panel1024x768) || (tempbx == Panel1280x1024)) { |
| 3374 | if (pVBInfo->VBInfo & DriverMode) { |
| 3375 | tempax = XGINew_GetReg1(pVBInfo->P3d4, 0x33); |
| 3376 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) |
| 3377 | tempax &= 0x0F; |
| 3378 | else |
| 3379 | tempax = tempax >> 4; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3380 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3381 | if ((resinfo == 6) || (resinfo == 9)) { |
| 3382 | if (tempax >= 3) |
| 3383 | tempbx |= PanelRef75Hz; |
| 3384 | } else if ((resinfo == 7) || (resinfo == 8)) { |
| 3385 | if (tempax >= 4) |
| 3386 | tempbx |= PanelRef75Hz; |
| 3387 | } |
| 3388 | } |
| 3389 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3390 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3391 | pVBInfo->LCDResInfo = tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3392 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3393 | /* End of LCD75 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3394 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3395 | if (pVBInfo->IF_DEF_OEMUtil == 1) |
| 3396 | pVBInfo->LCDTypeInfo = (temp & 0xf0) >> 4; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3397 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3398 | if (!(pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) |
| 3399 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3400 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3401 | tempbx = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3402 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3403 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3404 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3405 | temp &= (ScalingLCD | LCDNonExpanding | LCDSyncBit | SetPWDEnable); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3406 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3407 | if ((pVBInfo->IF_DEF_ScaleLCD == 1) && (temp & LCDNonExpanding)) |
| 3408 | temp &= ~EnableScalingLCD; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3409 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3410 | tempbx |= temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3411 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3412 | LCDIdIndex = XGI_GetLCDCapPtr1(pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3413 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3414 | tempax = pVBInfo->LCDCapList[LCDIdIndex].LCD_Capability; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3415 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3416 | if (pVBInfo->IF_DEF_LVDS == 0) { /* shampoo */ |
| 3417 | if (((pVBInfo->VBType & VB_XGI302LV) || (pVBInfo->VBType |
| 3418 | & VB_XGI301C)) && (tempax & LCDDualLink)) { |
| 3419 | tempbx |= SetLCDDualLink; |
| 3420 | } |
| 3421 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3422 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3423 | if (pVBInfo->IF_DEF_CH7017 == 1) { |
| 3424 | if (tempax & LCDDualLink) |
| 3425 | tempbx |= SetLCDDualLink; |
| 3426 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3427 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3428 | if (pVBInfo->IF_DEF_LVDS == 0) { |
| 3429 | if ((pVBInfo->LCDResInfo == Panel1400x1050) && (pVBInfo->VBInfo |
| 3430 | & SetCRT2ToLCD) && (ModeNo > 0x13) && (resinfo |
| 3431 | == 9) && (!(tempbx & EnableScalingLCD))) |
| 3432 | tempbx |= SetLCDtoNonExpanding; /* set to center in 1280x1024 LCDB for Panel1400x1050 */ |
| 3433 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3434 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3435 | /* |
| 3436 | if (tempax & LCDBToA) { |
| 3437 | tempbx |= SetLCDBToA; |
| 3438 | } |
| 3439 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3440 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3441 | if (pVBInfo->IF_DEF_ExpLink == 1) { |
| 3442 | if (modeflag & HalfDCLK) { |
| 3443 | /* if (!(pVBInfo->LCDInfo&LCDNonExpanding)) */ |
| 3444 | if (!(tempbx & SetLCDtoNonExpanding)) { |
| 3445 | tempbx |= EnableLVDSDDA; |
| 3446 | } else { |
| 3447 | if (ModeNo > 0x13) { |
| 3448 | if (pVBInfo->LCDResInfo |
| 3449 | == Panel1024x768) { |
| 3450 | if (resinfo == 4) { /* 512x384 */ |
| 3451 | tempbx |= EnableLVDSDDA; |
| 3452 | } |
| 3453 | } |
| 3454 | } |
| 3455 | } |
| 3456 | } |
| 3457 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3458 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3459 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 3460 | if (pVBInfo->VBInfo & SetNotSimuMode) |
| 3461 | tempbx |= LCDVESATiming; |
| 3462 | } else { |
| 3463 | tempbx |= LCDVESATiming; |
| 3464 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3465 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3466 | pVBInfo->LCDInfo = tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3467 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3468 | if (pVBInfo->IF_DEF_PWD == 1) { |
| 3469 | if (pVBInfo->LCDInfo & SetPWDEnable) { |
| 3470 | if ((pVBInfo->VBType & VB_XGI302LV) || (pVBInfo->VBType |
| 3471 | & VB_XGI301C)) { |
| 3472 | if (!(tempax & PWDEnable)) |
| 3473 | pVBInfo->LCDInfo &= ~SetPWDEnable; |
| 3474 | } |
| 3475 | } |
| 3476 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3477 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3478 | if (pVBInfo->IF_DEF_LVDS == 0) { |
| 3479 | if (tempax & (LockLCDBToA | StLCDBToA)) { |
| 3480 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 3481 | if (!(tempax & LockLCDBToA)) { |
| 3482 | if (ModeNo <= 0x13) { |
| 3483 | pVBInfo->VBInfo |
| 3484 | &= ~(SetSimuScanMode |
| 3485 | | SetInSlaveMode |
| 3486 | | SetCRT2ToLCD); |
| 3487 | pVBInfo->VBInfo |
| 3488 | |= SetCRT2ToLCDA |
| 3489 | | SetCRT2ToDualEdge; |
| 3490 | } |
| 3491 | } |
| 3492 | } |
| 3493 | } |
| 3494 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3495 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3496 | /* |
| 3497 | if (pVBInfo->IF_DEF_LVDS == 0) { |
| 3498 | if (tempax & (LockLCDBToA | StLCDBToA)) { |
| 3499 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 3500 | if (!((!(tempax & LockLCDBToA)) && (ModeNo > 0x13))) { |
| 3501 | pVBInfo->VBInfo&=~(SetSimuScanMode|SetInSlaveMode|SetCRT2ToLCD); |
| 3502 | pVBInfo->VBInfo|=SetCRT2ToLCDA|SetCRT2ToDualEdge; |
| 3503 | } |
| 3504 | } |
| 3505 | } |
| 3506 | } |
| 3507 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3508 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3509 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3510 | } |
| 3511 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 3512 | unsigned char XGI_SearchModeID(unsigned short ModeNo, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3513 | unsigned short *ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3514 | { |
| 3515 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3516 | #ifdef LINUX /* chiawen for linux solution */ |
| 3517 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3518 | if (ModeNo <= 5) |
| 3519 | ModeNo |= 1; |
| 3520 | if (ModeNo <= 0x13) { |
| 3521 | /* for (*ModeIdIndex=0; *ModeIdIndex < sizeof(pVBInfo->SModeIDTable) / sizeof(struct XGI_StStruct); (*ModeIdIndex)++) */ |
| 3522 | for (*ModeIdIndex = 0;; (*ModeIdIndex)++) { |
| 3523 | if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == ModeNo) |
| 3524 | break; |
| 3525 | if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF) |
| 3526 | return 0; |
| 3527 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3528 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3529 | if (ModeNo == 0x07) |
| 3530 | (*ModeIdIndex)++; /* 400 lines */ |
| 3531 | if (ModeNo <= 3) |
| 3532 | (*ModeIdIndex) += 2; /* 400 lines */ |
| 3533 | /* else 350 lines */ |
| 3534 | } else { |
| 3535 | /* for (*ModeIdIndex=0; *ModeIdIndex < sizeof(pVBInfo->EModeIDTable) / sizeof(struct XGI_ExtStruct); (*ModeIdIndex)++) */ |
| 3536 | for (*ModeIdIndex = 0;; (*ModeIdIndex)++) { |
| 3537 | if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == ModeNo) |
| 3538 | break; |
| 3539 | if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF) |
| 3540 | return 0; |
| 3541 | } |
| 3542 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3543 | |
| 3544 | #endif |
| 3545 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3546 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3547 | } |
| 3548 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3549 | /* win2000 MM adapter not support standard mode! */ |
| 3550 | |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 3551 | #if 0 |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 3552 | static unsigned char XGINew_CheckMemorySize( |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3553 | struct xgi_hw_device_info *HwDeviceExtension, |
| 3554 | unsigned short ModeNo, |
| 3555 | unsigned short ModeIdIndex, |
| 3556 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3557 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3558 | unsigned short memorysize, modeflag, temp, temp1, tmp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3559 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3560 | /* |
| 3561 | if ((HwDeviceExtension->jChipType == XGI_650) || |
| 3562 | (HwDeviceExtension->jChipType == XGI_650M)) { |
| 3563 | return 1; |
| 3564 | } |
| 3565 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3566 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3567 | if (ModeNo <= 0x13) |
| 3568 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 3569 | else |
| 3570 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3571 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3572 | /* ModeType = modeflag&ModeInfoFlag; // Get mode type */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3573 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3574 | memorysize = modeflag & MemoryInfoFlag; |
| 3575 | memorysize = memorysize > MemorySizeShift; |
| 3576 | memorysize++; /* Get memory size */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3577 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3578 | temp = XGINew_GetReg1(pVBInfo->P3c4, 0x14); /* Get DRAM Size */ |
| 3579 | tmp = temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3580 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3581 | if (HwDeviceExtension->jChipType == XG40) { |
| 3582 | temp = 1 << ((temp & 0x0F0) >> 4); /* memory size per channel SR14[7:4] */ |
| 3583 | if ((tmp & 0x0c) == 0x0C) { /* Qual channels */ |
| 3584 | temp <<= 2; |
| 3585 | } else if ((tmp & 0x0c) == 0x08) { /* Dual channels */ |
| 3586 | temp <<= 1; |
| 3587 | } |
| 3588 | } else if (HwDeviceExtension->jChipType == XG42) { |
| 3589 | temp = 1 << ((temp & 0x0F0) >> 4); /* memory size per channel SR14[7:4] */ |
| 3590 | if ((tmp & 0x04) == 0x04) { /* Dual channels */ |
| 3591 | temp <<= 1; |
| 3592 | } |
| 3593 | } else if (HwDeviceExtension->jChipType == XG45) { |
| 3594 | temp = 1 << ((temp & 0x0F0) >> 4); /* memory size per channel SR14[7:4] */ |
| 3595 | if ((tmp & 0x0c) == 0x0C) { /* Qual channels */ |
| 3596 | temp <<= 2; |
| 3597 | } else if ((tmp & 0x0c) == 0x08) { /* triple channels */ |
| 3598 | temp1 = temp; |
| 3599 | temp <<= 1; |
| 3600 | temp += temp1; |
| 3601 | } else if ((tmp & 0x0c) == 0x04) { /* Dual channels */ |
| 3602 | temp <<= 1; |
| 3603 | } |
| 3604 | } |
| 3605 | if (temp < memorysize) |
| 3606 | return 0; |
| 3607 | else |
| 3608 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3609 | } |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 3610 | #endif |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3611 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3612 | /* |
| 3613 | 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] | 3614 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3615 | unsigned short data ; |
| 3616 | unsigned short ModeFlag ; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3617 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3618 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x0F); |
| 3619 | data &= 0x7F; |
| 3620 | XGINew_SetReg1(pVBInfo->P3c4, 0x0F, data); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3621 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3622 | if (ModeNo > 0x13) { |
| 3623 | ModeFlag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 3624 | if ((ModeFlag & HalfDCLK) && (ModeFlag & DoubleScanMode)) { |
| 3625 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x0F); |
| 3626 | data |= 0x80; |
| 3627 | XGINew_SetReg1(pVBInfo->P3c4, 0x0F, data); |
| 3628 | data = XGINew_GetReg1(pVBInfo->P3c4, 0x01); |
| 3629 | data &= 0xF7; |
| 3630 | XGINew_SetReg1(pVBInfo->P3c4, 0x01, data); |
| 3631 | } |
| 3632 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3633 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3634 | */ |
| 3635 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3636 | void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE, |
| 3637 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3638 | { |
| 3639 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3640 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xDF, 0x00); |
| 3641 | if (pXGIHWDE->jChipType == XG21) { |
| 3642 | if (pVBInfo->IF_DEF_LVDS == 1) { |
| 3643 | if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x1)) { |
| 3644 | XGI_XG21BLSignalVDD(0x01, 0x01, pVBInfo); /* LVDS VDD on */ |
| 3645 | XGI_XG21SetPanelDelay(2, pVBInfo); |
| 3646 | } |
| 3647 | if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x20)) |
| 3648 | XGI_XG21BLSignalVDD(0x20, 0x20, pVBInfo); /* LVDS signal on */ |
| 3649 | XGI_XG21SetPanelDelay(3, pVBInfo); |
| 3650 | XGI_XG21BLSignalVDD(0x02, 0x02, pVBInfo); /* LVDS backlight on */ |
| 3651 | } else { |
| 3652 | XGI_XG21BLSignalVDD(0x20, 0x20, pVBInfo); /* DVO/DVI signal on */ |
| 3653 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3654 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3655 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3656 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3657 | if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 07/05/23 For CH7007 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3658 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3659 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3660 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3661 | if (pXGIHWDE->jChipType == XG27) { |
| 3662 | if (pVBInfo->IF_DEF_LVDS == 1) { |
| 3663 | if (!(XGI_XG27GetPSCValue(pVBInfo) & 0x1)) { |
| 3664 | XGI_XG27BLSignalVDD(0x01, 0x01, pVBInfo); /* LVDS VDD on */ |
| 3665 | XGI_XG21SetPanelDelay(2, pVBInfo); |
| 3666 | } |
| 3667 | if (!(XGI_XG27GetPSCValue(pVBInfo) & 0x20)) |
| 3668 | XGI_XG27BLSignalVDD(0x20, 0x20, pVBInfo); /* LVDS signal on */ |
| 3669 | XGI_XG21SetPanelDelay(3, pVBInfo); |
| 3670 | XGI_XG27BLSignalVDD(0x02, 0x02, pVBInfo); /* LVDS backlight on */ |
| 3671 | } else { |
| 3672 | XGI_XG27BLSignalVDD(0x20, 0x20, pVBInfo); /* DVO/DVI signal on */ |
| 3673 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3674 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3675 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3676 | } |
| 3677 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3678 | void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE, |
| 3679 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3680 | { |
| 3681 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3682 | if (pXGIHWDE->jChipType == XG21) { |
| 3683 | if (pVBInfo->IF_DEF_LVDS == 1) { |
| 3684 | XGI_XG21BLSignalVDD(0x02, 0x00, pVBInfo); /* LVDS backlight off */ |
| 3685 | XGI_XG21SetPanelDelay(3, pVBInfo); |
| 3686 | } else { |
| 3687 | XGI_XG21BLSignalVDD(0x20, 0x00, pVBInfo); /* DVO/DVI signal off */ |
| 3688 | } |
| 3689 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3690 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3691 | if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 07/05/23 For CH7007 */ |
| 3692 | /* if (IsCH7007TVMode(pVBInfo) == 0) */ |
| 3693 | { |
| 3694 | } |
| 3695 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3696 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3697 | if (pXGIHWDE->jChipType == XG27) { |
| 3698 | if ((XGI_XG27GetPSCValue(pVBInfo) & 0x2)) { |
| 3699 | XGI_XG27BLSignalVDD(0x02, 0x00, pVBInfo); /* LVDS backlight off */ |
| 3700 | XGI_XG21SetPanelDelay(3, pVBInfo); |
| 3701 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3702 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3703 | if (pVBInfo->IF_DEF_LVDS == 0) |
| 3704 | XGI_XG27BLSignalVDD(0x20, 0x00, pVBInfo); /* DVO/DVI signal off */ |
| 3705 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3706 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3707 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xDF, 0x20); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3708 | } |
| 3709 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 3710 | void XGI_WaitDisply(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3711 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3712 | while ((XGINew_GetReg2(pVBInfo->P3da) & 0x01)) |
| 3713 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3714 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3715 | while (!(XGINew_GetReg2(pVBInfo->P3da) & 0x01)) |
| 3716 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3717 | } |
| 3718 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 3719 | void XGI_SenseCRT1(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3720 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3721 | unsigned char CRTCData[17] = { 0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81, |
| 3722 | 0x0B, 0x3E, 0xE9, 0x0B, 0xDF, 0xE7, 0x04, 0x00, 0x00, |
| 3723 | 0x05, 0x00 }; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3724 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 3725 | unsigned char SR01 = 0, SR1F = 0, SR07 = 0, SR06 = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3726 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 3727 | unsigned char CR17, CR63, SR31; |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3728 | unsigned short temp; |
| 3729 | unsigned char DAC_TEST_PARMS[3] = { 0x0F, 0x0F, 0x0F }; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3730 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3731 | int i; |
| 3732 | XGINew_SetReg1(pVBInfo->P3c4, 0x05, 0x86); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3733 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3734 | /* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */ |
| 3735 | XGINew_SetReg1(pVBInfo->P3d4, 0x57, 0x4A); |
| 3736 | XGINew_SetReg1(pVBInfo->P3d4, 0x53, (unsigned char) (XGINew_GetReg1( |
| 3737 | pVBInfo->P3d4, 0x53) | 0x02)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3738 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3739 | SR31 = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x31); |
| 3740 | CR63 = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x63); |
| 3741 | SR01 = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x01); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3742 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3743 | XGINew_SetReg1(pVBInfo->P3c4, 0x01, (unsigned char) (SR01 & 0xDF)); |
| 3744 | XGINew_SetReg1(pVBInfo->P3d4, 0x63, (unsigned char) (CR63 & 0xBF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3745 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3746 | CR17 = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x17); |
| 3747 | XGINew_SetReg1(pVBInfo->P3d4, 0x17, (unsigned char) (CR17 | 0x80)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3748 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3749 | SR1F = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x1F); |
| 3750 | XGINew_SetReg1(pVBInfo->P3c4, 0x1F, (unsigned char) (SR1F | 0x04)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3751 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3752 | SR07 = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x07); |
| 3753 | XGINew_SetReg1(pVBInfo->P3c4, 0x07, (unsigned char) (SR07 & 0xFB)); |
| 3754 | SR06 = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x06); |
| 3755 | XGINew_SetReg1(pVBInfo->P3c4, 0x06, (unsigned char) (SR06 & 0xC3)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3756 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3757 | XGINew_SetReg1(pVBInfo->P3d4, 0x11, 0x00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3758 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3759 | for (i = 0; i < 8; i++) |
| 3760 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) i, CRTCData[i]); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3761 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3762 | for (i = 8; i < 11; i++) |
| 3763 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 8), |
| 3764 | CRTCData[i]); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3765 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3766 | for (i = 11; i < 13; i++) |
| 3767 | XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 4), |
| 3768 | CRTCData[i]); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3769 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3770 | for (i = 13; i < 16; i++) |
| 3771 | XGINew_SetReg1(pVBInfo->P3c4, (unsigned short) (i - 3), |
| 3772 | CRTCData[i]); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3773 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3774 | XGINew_SetReg1(pVBInfo->P3c4, 0x0E, (unsigned char) (CRTCData[16] |
| 3775 | & 0xE0)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3776 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3777 | XGINew_SetReg1(pVBInfo->P3c4, 0x31, 0x00); |
| 3778 | XGINew_SetReg1(pVBInfo->P3c4, 0x2B, 0x1B); |
| 3779 | XGINew_SetReg1(pVBInfo->P3c4, 0x2C, 0xE1); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3780 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3781 | XGINew_SetReg3(pVBInfo->P3c8, 0x00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3782 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3783 | for (i = 0; i < 256; i++) { |
| 3784 | XGINew_SetReg3((pVBInfo->P3c8 + 1), |
| 3785 | (unsigned char) DAC_TEST_PARMS[0]); |
| 3786 | XGINew_SetReg3((pVBInfo->P3c8 + 1), |
| 3787 | (unsigned char) DAC_TEST_PARMS[1]); |
| 3788 | XGINew_SetReg3((pVBInfo->P3c8 + 1), |
| 3789 | (unsigned char) DAC_TEST_PARMS[2]); |
| 3790 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3791 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3792 | XGI_VBLongWait(pVBInfo); |
| 3793 | XGI_VBLongWait(pVBInfo); |
| 3794 | XGI_VBLongWait(pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3795 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3796 | XGINew_LCD_Wait_Time(0x01, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3797 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3798 | XGI_WaitDisply(pVBInfo); |
| 3799 | temp = XGINew_GetReg2(pVBInfo->P3c2); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3800 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3801 | if (temp & 0x10) |
| 3802 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x32, 0xDF, 0x20); |
| 3803 | else |
| 3804 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x32, 0xDF, 0x00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3805 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3806 | /* alan, avoid display something, set BLACK DAC if not restore DAC */ |
| 3807 | XGINew_SetReg3(pVBInfo->P3c8, 0x00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3808 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3809 | for (i = 0; i < 256; i++) { |
| 3810 | XGINew_SetReg3((pVBInfo->P3c8 + 1), 0); |
| 3811 | XGINew_SetReg3((pVBInfo->P3c8 + 1), 0); |
| 3812 | XGINew_SetReg3((pVBInfo->P3c8 + 1), 0); |
| 3813 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3814 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3815 | XGINew_SetReg1(pVBInfo->P3c4, 0x01, SR01); |
| 3816 | XGINew_SetReg1(pVBInfo->P3d4, 0x63, CR63); |
| 3817 | XGINew_SetReg1(pVBInfo->P3c4, 0x31, SR31); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3818 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3819 | /* [2004/05/11] Vicent */ |
| 3820 | XGINew_SetReg1(pVBInfo->P3d4, 0x53, (unsigned char) (XGINew_GetReg1( |
| 3821 | pVBInfo->P3d4, 0x53) & 0xFD)); |
| 3822 | XGINew_SetReg1(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3823 | } |
| 3824 | |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 3825 | #if 0 |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 3826 | static void XGI_WaitDisplay(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3827 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3828 | while (!(XGINew_GetReg2(pVBInfo->P3da) & 0x01)); |
| 3829 | while (XGINew_GetReg2(pVBInfo->P3da) & 0x01); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3830 | } |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 3831 | #endif |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3832 | |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 3833 | unsigned char XGI_SetCRT2Group301(unsigned short ModeNo, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3834 | struct xgi_hw_device_info *HwDeviceExtension, |
| 3835 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3836 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3837 | unsigned short tempbx, ModeIdIndex, RefreshRateTableIndex; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3838 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3839 | tempbx = pVBInfo->VBInfo; |
| 3840 | pVBInfo->SetFlag |= ProgrammingCRT2; |
| 3841 | XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo); |
| 3842 | pVBInfo->SelectCRT2Rate = 4; |
| 3843 | RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, |
| 3844 | ModeIdIndex, pVBInfo); |
| 3845 | XGI_SaveCRT2Info(ModeNo, pVBInfo); |
| 3846 | XGI_GetCRT2ResInfo(ModeNo, ModeIdIndex, pVBInfo); |
| 3847 | XGI_GetCRT2Data(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
| 3848 | XGI_PreSetGroup1(ModeNo, ModeIdIndex, HwDeviceExtension, |
| 3849 | RefreshRateTableIndex, pVBInfo); |
| 3850 | XGI_SetGroup1(ModeNo, ModeIdIndex, HwDeviceExtension, |
| 3851 | RefreshRateTableIndex, pVBInfo); |
| 3852 | XGI_SetLockRegs(ModeNo, ModeIdIndex, HwDeviceExtension, |
| 3853 | RefreshRateTableIndex, pVBInfo); |
| 3854 | XGI_SetGroup2(ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 3855 | HwDeviceExtension, pVBInfo); |
| 3856 | XGI_SetLCDRegs(ModeNo, ModeIdIndex, HwDeviceExtension, |
| 3857 | RefreshRateTableIndex, pVBInfo); |
| 3858 | XGI_SetTap4Regs(pVBInfo); |
| 3859 | XGI_SetGroup3(ModeNo, ModeIdIndex, pVBInfo); |
| 3860 | XGI_SetGroup4(ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 3861 | HwDeviceExtension, pVBInfo); |
| 3862 | XGI_SetCRT2VCLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
| 3863 | XGI_SetGroup5(ModeNo, ModeIdIndex, pVBInfo); |
| 3864 | XGI_AutoThreshold(pVBInfo); |
| 3865 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3866 | } |
| 3867 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 3868 | void XGI_AutoThreshold(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3869 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3870 | if (!(pVBInfo->SetFlag & Win9xDOSMode)) |
| 3871 | XGINew_SetRegOR(pVBInfo->Part1Port, 0x01, 0x40); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3872 | } |
| 3873 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 3874 | void XGI_SaveCRT2Info(unsigned short ModeNo, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3875 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3876 | unsigned short temp1, temp2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3877 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3878 | XGINew_SetReg1(pVBInfo->P3d4, 0x34, ModeNo); /* reserve CR34 for CRT1 Mode No */ |
| 3879 | temp1 = (pVBInfo->VBInfo & SetInSlaveMode) >> 8; |
| 3880 | temp2 = ~(SetInSlaveMode >> 8); |
| 3881 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x31, temp2, temp1); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3882 | } |
| 3883 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3884 | void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 3885 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3886 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3887 | unsigned short xres, yres, modeflag, resindex; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3888 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3889 | resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); |
| 3890 | if (ModeNo <= 0x13) { |
| 3891 | xres = pVBInfo->StResInfo[resindex].HTotal; |
| 3892 | yres = pVBInfo->StResInfo[resindex].VTotal; |
| 3893 | /* modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; si+St_ResInfo */ |
| 3894 | } else { |
| 3895 | xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */ |
| 3896 | yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */ |
| 3897 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+St_ModeFlag */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3898 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3899 | /* |
| 3900 | if (pVBInfo->IF_DEF_FSTN) { |
| 3901 | xres *= 2; |
| 3902 | yres *= 2; |
| 3903 | } else { |
| 3904 | */ |
| 3905 | if (modeflag & HalfDCLK) |
| 3906 | xres *= 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3907 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3908 | if (modeflag & DoubleScanMode) |
| 3909 | yres *= 2; |
| 3910 | /* } */ |
| 3911 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3912 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3913 | if (pVBInfo->VBInfo & SetCRT2ToLCD) { |
| 3914 | if (pVBInfo->IF_DEF_LVDS == 0) { |
| 3915 | if (pVBInfo->LCDResInfo == Panel1600x1200) { |
| 3916 | if (!(pVBInfo->LCDInfo & LCDVESATiming)) { |
| 3917 | if (yres == 1024) |
| 3918 | yres = 1056; |
| 3919 | } |
| 3920 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3921 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3922 | if (pVBInfo->LCDResInfo == Panel1280x1024) { |
| 3923 | if (yres == 400) |
| 3924 | yres = 405; |
| 3925 | else if (yres == 350) |
| 3926 | yres = 360; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3927 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3928 | if (pVBInfo->LCDInfo & LCDVESATiming) { |
| 3929 | if (yres == 360) |
| 3930 | yres = 375; |
| 3931 | } |
| 3932 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3933 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3934 | if (pVBInfo->LCDResInfo == Panel1024x768) { |
| 3935 | if (!(pVBInfo->LCDInfo & LCDVESATiming)) { |
| 3936 | if (!(pVBInfo->LCDInfo |
| 3937 | & LCDNonExpanding)) { |
| 3938 | if (yres == 350) |
| 3939 | yres = 357; |
| 3940 | else if (yres == 400) |
| 3941 | yres = 420; |
| 3942 | else if (yres == 480) |
| 3943 | yres = 525; |
| 3944 | } |
| 3945 | } |
| 3946 | } |
| 3947 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3948 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3949 | if (xres == 720) |
| 3950 | xres = 640; |
| 3951 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3952 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3953 | pVBInfo->VGAHDE = xres; |
| 3954 | pVBInfo->HDE = xres; |
| 3955 | pVBInfo->VGAVDE = yres; |
| 3956 | pVBInfo->VDE = yres; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3957 | } |
| 3958 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 3959 | unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3960 | { |
| 3961 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3962 | if ((((pVBInfo->VBInfo & SetCRT2ToLCD) | SetCRT2ToLCDA)) |
| 3963 | && (pVBInfo->LCDInfo & SetLCDDualLink)) /* shampoo0129 */ |
| 3964 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3965 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3966 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3967 | } |
| 3968 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3969 | void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 3970 | unsigned short RefreshRateTableIndex, |
| 3971 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3972 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3973 | unsigned short tempax = 0, tempbx, modeflag, resinfo; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3974 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3975 | struct XGI_LCDDataStruct *LCDPtr = NULL; |
| 3976 | struct XGI_TVDataStruct *TVPtr = NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3977 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3978 | if (ModeNo <= 0x13) { |
| 3979 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 3980 | resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; |
| 3981 | } else { |
| 3982 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
| 3983 | resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; |
| 3984 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3985 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3986 | pVBInfo->NewFlickerMode = 0; |
| 3987 | pVBInfo->RVBHRS = 50; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3988 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3989 | if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) { |
| 3990 | XGI_GetRAMDAC2DATA(ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 3991 | pVBInfo); |
| 3992 | return; |
| 3993 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3994 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3995 | tempbx = 4; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 3996 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 3997 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { |
| 3998 | LCDPtr = (struct XGI_LCDDataStruct *) XGI_GetLcdPtr(tempbx, |
| 3999 | ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 4000 | pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4001 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4002 | pVBInfo->RVBHCMAX = LCDPtr->RVBHCMAX; |
| 4003 | pVBInfo->RVBHCFACT = LCDPtr->RVBHCFACT; |
| 4004 | pVBInfo->VGAHT = LCDPtr->VGAHT; |
| 4005 | pVBInfo->VGAVT = LCDPtr->VGAVT; |
| 4006 | pVBInfo->HT = LCDPtr->LCDHT; |
| 4007 | pVBInfo->VT = LCDPtr->LCDVT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4008 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4009 | if (pVBInfo->LCDResInfo == Panel1024x768) { |
| 4010 | tempax = 1024; |
| 4011 | tempbx = 768; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4012 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4013 | if (!(pVBInfo->LCDInfo & LCDVESATiming)) { |
| 4014 | if (pVBInfo->VGAVDE == 357) |
| 4015 | tempbx = 527; |
| 4016 | else if (pVBInfo->VGAVDE == 420) |
| 4017 | tempbx = 620; |
| 4018 | else if (pVBInfo->VGAVDE == 525) |
| 4019 | tempbx = 775; |
| 4020 | else if (pVBInfo->VGAVDE == 600) |
| 4021 | tempbx = 775; |
| 4022 | /* else if (pVBInfo->VGAVDE==350) tempbx=560; */ |
| 4023 | /* else if (pVBInfo->VGAVDE==400) tempbx=640; */ |
| 4024 | else |
| 4025 | tempbx = 768; |
| 4026 | } else |
| 4027 | tempbx = 768; |
| 4028 | } else if (pVBInfo->LCDResInfo == Panel1024x768x75) { |
| 4029 | tempax = 1024; |
| 4030 | tempbx = 768; |
| 4031 | } else if (pVBInfo->LCDResInfo == Panel1280x1024) { |
| 4032 | tempax = 1280; |
| 4033 | if (pVBInfo->VGAVDE == 360) |
| 4034 | tempbx = 768; |
| 4035 | else if (pVBInfo->VGAVDE == 375) |
| 4036 | tempbx = 800; |
| 4037 | else if (pVBInfo->VGAVDE == 405) |
| 4038 | tempbx = 864; |
| 4039 | else |
| 4040 | tempbx = 1024; |
| 4041 | } else if (pVBInfo->LCDResInfo == Panel1280x1024x75) { |
| 4042 | tempax = 1280; |
| 4043 | tempbx = 1024; |
| 4044 | } else if (pVBInfo->LCDResInfo == Panel1280x960) { |
| 4045 | tempax = 1280; |
| 4046 | if (pVBInfo->VGAVDE == 350) |
| 4047 | tempbx = 700; |
| 4048 | else if (pVBInfo->VGAVDE == 400) |
| 4049 | tempbx = 800; |
| 4050 | else if (pVBInfo->VGAVDE == 1024) |
| 4051 | tempbx = 960; |
| 4052 | else |
| 4053 | tempbx = 960; |
| 4054 | } else if (pVBInfo->LCDResInfo == Panel1400x1050) { |
| 4055 | tempax = 1400; |
| 4056 | tempbx = 1050; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4057 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4058 | if (pVBInfo->VGAVDE == 1024) { |
| 4059 | tempax = 1280; |
| 4060 | tempbx = 1024; |
| 4061 | } |
| 4062 | } else if (pVBInfo->LCDResInfo == Panel1600x1200) { |
| 4063 | tempax = 1600; |
| 4064 | tempbx = 1200; /* alan 10/14/2003 */ |
| 4065 | if (!(pVBInfo->LCDInfo & LCDVESATiming)) { |
| 4066 | if (pVBInfo->VGAVDE == 350) |
| 4067 | tempbx = 875; |
| 4068 | else if (pVBInfo->VGAVDE == 400) |
| 4069 | tempbx = 1000; |
| 4070 | } |
| 4071 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4072 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4073 | if (pVBInfo->LCDInfo & LCDNonExpanding) { |
| 4074 | tempax = pVBInfo->VGAHDE; |
| 4075 | tempbx = pVBInfo->VGAVDE; |
| 4076 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4077 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4078 | pVBInfo->HDE = tempax; |
| 4079 | pVBInfo->VDE = tempbx; |
| 4080 | return; |
| 4081 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4082 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4083 | if (pVBInfo->VBInfo & (SetCRT2ToTV)) { |
| 4084 | tempbx = 4; |
| 4085 | TVPtr = (struct XGI_TVDataStruct *) XGI_GetTVPtr(tempbx, |
| 4086 | ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 4087 | pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4088 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4089 | pVBInfo->RVBHCMAX = TVPtr->RVBHCMAX; |
| 4090 | pVBInfo->RVBHCFACT = TVPtr->RVBHCFACT; |
| 4091 | pVBInfo->VGAHT = TVPtr->VGAHT; |
| 4092 | pVBInfo->VGAVT = TVPtr->VGAVT; |
| 4093 | pVBInfo->HDE = TVPtr->TVHDE; |
| 4094 | pVBInfo->VDE = TVPtr->TVVDE; |
| 4095 | pVBInfo->RVBHRS = TVPtr->RVBHRS; |
| 4096 | pVBInfo->NewFlickerMode = TVPtr->FlickerMode; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4097 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4098 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { |
| 4099 | if (resinfo == 0x08) |
| 4100 | pVBInfo->NewFlickerMode = 0x40; |
| 4101 | else if (resinfo == 0x09) |
| 4102 | pVBInfo->NewFlickerMode = 0x40; |
| 4103 | else if (resinfo == 0x12) |
| 4104 | pVBInfo->NewFlickerMode = 0x40; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4105 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4106 | if (pVBInfo->VGAVDE == 350) |
| 4107 | pVBInfo->TVInfo |= TVSimuMode; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4108 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4109 | tempax = ExtHiTVHT; |
| 4110 | tempbx = ExtHiTVVT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4111 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4112 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 4113 | if (pVBInfo->TVInfo & TVSimuMode) { |
| 4114 | tempax = StHiTVHT; |
| 4115 | tempbx = StHiTVVT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4116 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4117 | if (!(modeflag & Charx8Dot)) { |
| 4118 | tempax = StHiTextTVHT; |
| 4119 | tempbx = StHiTextTVVT; |
| 4120 | } |
| 4121 | } |
| 4122 | } |
| 4123 | } else if (pVBInfo->VBInfo & SetCRT2ToYPbPr) { |
| 4124 | if (pVBInfo->TVInfo & SetYPbPrMode750p) { |
| 4125 | tempax = YPbPrTV750pHT; /* Ext750pTVHT */ |
| 4126 | tempbx = YPbPrTV750pVT; /* Ext750pTVVT */ |
| 4127 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4128 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4129 | if (pVBInfo->TVInfo & SetYPbPrMode525p) { |
| 4130 | tempax = YPbPrTV525pHT; /* Ext525pTVHT */ |
| 4131 | tempbx = YPbPrTV525pVT; /* Ext525pTVVT */ |
| 4132 | } else if (pVBInfo->TVInfo & SetYPbPrMode525i) { |
| 4133 | tempax = YPbPrTV525iHT; /* Ext525iTVHT */ |
| 4134 | tempbx = YPbPrTV525iVT; /* Ext525iTVVT */ |
| 4135 | if (pVBInfo->TVInfo & NTSC1024x768) |
| 4136 | tempax = NTSC1024x768HT; |
| 4137 | } |
| 4138 | } else { |
| 4139 | tempax = PALHT; |
| 4140 | tempbx = PALVT; |
| 4141 | if (!(pVBInfo->TVInfo & SetPALTV)) { |
| 4142 | tempax = NTSCHT; |
| 4143 | tempbx = NTSCVT; |
| 4144 | if (pVBInfo->TVInfo & NTSC1024x768) |
| 4145 | tempax = NTSC1024x768HT; |
| 4146 | } |
| 4147 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4148 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4149 | pVBInfo->HT = tempax; |
| 4150 | pVBInfo->VT = tempbx; |
| 4151 | return; |
| 4152 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4153 | } |
| 4154 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4155 | void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 4156 | unsigned short RefreshRateTableIndex, |
| 4157 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4158 | { |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4159 | unsigned char di_0, di_1, tempal; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4160 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4161 | tempal = XGI_GetVCLKPtr(RefreshRateTableIndex, ModeNo, ModeIdIndex, |
| 4162 | pVBInfo); |
| 4163 | XGI_GetVCLKLen(tempal, &di_0, &di_1, pVBInfo); |
| 4164 | XGI_GetLCDVCLKPtr(&di_0, &di_1, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4165 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4166 | if (pVBInfo->VBType & VB_XGI301) { /* shampoo 0129 */ |
| 4167 | /* 301 */ |
| 4168 | XGINew_SetReg1(pVBInfo->Part4Port, 0x0A, 0x10); |
| 4169 | XGINew_SetReg1(pVBInfo->Part4Port, 0x0B, di_1); |
| 4170 | XGINew_SetReg1(pVBInfo->Part4Port, 0x0A, di_0); |
| 4171 | } else { /* 301b/302b/301lv/302lv */ |
| 4172 | XGINew_SetReg1(pVBInfo->Part4Port, 0x0A, di_0); |
| 4173 | XGINew_SetReg1(pVBInfo->Part4Port, 0x0B, di_1); |
| 4174 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4175 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4176 | XGINew_SetReg1(pVBInfo->Part4Port, 0x00, 0x12); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4177 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4178 | if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) |
| 4179 | XGINew_SetRegOR(pVBInfo->Part4Port, 0x12, 0x28); |
| 4180 | else |
| 4181 | XGINew_SetRegOR(pVBInfo->Part4Port, 0x12, 0x08); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4182 | } |
| 4183 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4184 | /* --------------------------------------------------------------------- */ |
| 4185 | /* Function : XGI_GETLCDVCLKPtr */ |
| 4186 | /* Input : */ |
| 4187 | /* Output : al -> VCLK Index */ |
| 4188 | /* Description : */ |
| 4189 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 4190 | void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4191 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4192 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4193 | unsigned short index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4194 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4195 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { |
| 4196 | if (pVBInfo->IF_DEF_ScaleLCD == 1) { |
| 4197 | if (pVBInfo->LCDInfo & EnableScalingLCD) |
| 4198 | return; |
| 4199 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4200 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4201 | /* index = XGI_GetLCDCapPtr(pVBInfo); */ |
| 4202 | index = XGI_GetLCDCapPtr1(pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4203 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4204 | if (pVBInfo->VBInfo & SetCRT2ToLCD) { /* LCDB */ |
| 4205 | *di_0 = pVBInfo->LCDCapList[index].LCUCHAR_VCLKData1; |
| 4206 | *di_1 = pVBInfo->LCDCapList[index].LCUCHAR_VCLKData2; |
| 4207 | } else { /* LCDA */ |
| 4208 | *di_0 = pVBInfo->LCDCapList[index].LCDA_VCLKData1; |
| 4209 | *di_1 = pVBInfo->LCDCapList[index].LCDA_VCLKData2; |
| 4210 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4211 | } |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4212 | return; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4213 | } |
| 4214 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4215 | unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, |
| 4216 | unsigned short ModeNo, unsigned short ModeIdIndex, |
| 4217 | struct vb_device_info *pVBInfo) |
| 4218 | { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4219 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4220 | unsigned short index, modeflag; |
| 4221 | unsigned short tempbx; |
| 4222 | unsigned char tempal; |
| 4223 | unsigned char *CHTVVCLKPtr = NULL; |
| 4224 | |
| 4225 | if (ModeNo <= 0x13) |
| 4226 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 4227 | else |
| 4228 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
| 4229 | |
| 4230 | if ((pVBInfo->SetFlag & ProgrammingCRT2) && (!(pVBInfo->LCDInfo |
| 4231 | & EnableScalingLCD))) { /* {LCDA/LCDB} */ |
| 4232 | index = XGI_GetLCDCapPtr(pVBInfo); |
| 4233 | tempal = pVBInfo->LCDCapList[index].LCD_VCLK; |
| 4234 | |
| 4235 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) |
| 4236 | return tempal; |
| 4237 | |
| 4238 | /* {TV} */ |
| 4239 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 4240 | | VB_XGI302LV | VB_XGI301C)) { |
| 4241 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { |
| 4242 | tempal = HiTVVCLKDIV2; |
| 4243 | if (!(pVBInfo->TVInfo & RPLLDIV2XO)) |
| 4244 | tempal = HiTVVCLK; |
| 4245 | if (pVBInfo->TVInfo & TVSimuMode) { |
| 4246 | tempal = HiTVSimuVCLK; |
| 4247 | if (!(modeflag & Charx8Dot)) |
| 4248 | tempal = HiTVTextVCLK; |
| 4249 | |
| 4250 | } |
| 4251 | return tempal; |
| 4252 | } |
| 4253 | |
| 4254 | if (pVBInfo->TVInfo & SetYPbPrMode750p) { |
| 4255 | tempal = YPbPr750pVCLK; |
| 4256 | return tempal; |
| 4257 | } |
| 4258 | |
| 4259 | if (pVBInfo->TVInfo & SetYPbPrMode525p) { |
| 4260 | tempal = YPbPr525pVCLK; |
| 4261 | return tempal; |
| 4262 | } |
| 4263 | |
| 4264 | tempal = NTSC1024VCLK; |
| 4265 | |
| 4266 | if (!(pVBInfo->TVInfo & NTSC1024x768)) { |
| 4267 | tempal = TVVCLKDIV2; |
| 4268 | if (!(pVBInfo->TVInfo & RPLLDIV2XO)) |
| 4269 | tempal = TVVCLK; |
| 4270 | } |
| 4271 | |
| 4272 | if (pVBInfo->VBInfo & SetCRT2ToTV) |
| 4273 | return tempal; |
| 4274 | } |
| 4275 | /* else if ((pVBInfo->IF_DEF_CH7017==1)&&(pVBInfo->VBType&VB_CH7017)) { |
| 4276 | if (ModeNo<=0x13) |
| 4277 | *tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; |
| 4278 | else |
| 4279 | *tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 4280 | *tempal = *tempal & 0x1F; |
| 4281 | tempbx = 0; |
| 4282 | if (pVBInfo->TVInfo & SetPALTV) |
| 4283 | tempbx = tempbx + 2; |
| 4284 | if (pVBInfo->TVInfo & SetCHTVOverScan) |
| 4285 | tempbx++; |
| 4286 | tempbx = tempbx << 1; |
| 4287 | } */ |
| 4288 | } /* {End of VB} */ |
| 4289 | |
| 4290 | if ((pVBInfo->IF_DEF_CH7007 == 1) && (pVBInfo->VBType & VB_CH7007)) { /* [Billy] 07/05/08 CH7007 */ |
| 4291 | /* VideoDebugPrint((0, "XGI_GetVCLKPtr: pVBInfo->IF_DEF_CH7007==1\n")); */ |
| 4292 | if ((pVBInfo->VBInfo & SetCRT2ToTV)) { |
| 4293 | if (ModeNo <= 0x13) { |
| 4294 | tempal |
| 4295 | = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; |
| 4296 | } else { |
| 4297 | tempal |
| 4298 | = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 4299 | } |
| 4300 | |
| 4301 | tempal = tempal & 0x0F; |
| 4302 | tempbx = 0; |
| 4303 | |
| 4304 | if (pVBInfo->TVInfo & SetPALTV) |
| 4305 | tempbx = tempbx + 2; |
| 4306 | |
| 4307 | if (pVBInfo->TVInfo & SetCHTVOverScan) |
| 4308 | tempbx++; |
| 4309 | |
| 4310 | /** tempbx = tempbx << 1; CH7007 ? **/ |
| 4311 | |
| 4312 | /* [Billy]07/05/29 CH7007 */ |
| 4313 | if (pVBInfo->IF_DEF_CH7007 == 1) { |
| 4314 | switch (tempbx) { |
| 4315 | case 0: |
| 4316 | CHTVVCLKPtr = XGI7007_CHTVVCLKUNTSC; |
| 4317 | break; |
| 4318 | case 1: |
| 4319 | CHTVVCLKPtr = XGI7007_CHTVVCLKONTSC; |
| 4320 | break; |
| 4321 | case 2: |
| 4322 | CHTVVCLKPtr = XGI7007_CHTVVCLKUPAL; |
| 4323 | break; |
| 4324 | case 3: |
| 4325 | CHTVVCLKPtr = XGI7007_CHTVVCLKOPAL; |
| 4326 | break; |
| 4327 | default: |
| 4328 | break; |
| 4329 | |
| 4330 | } |
| 4331 | } |
| 4332 | /* else { |
| 4333 | switch(tempbx) { |
| 4334 | case 0: |
| 4335 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC; |
| 4336 | break; |
| 4337 | case 1: |
| 4338 | CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC; |
| 4339 | break; |
| 4340 | case 2: |
| 4341 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL; |
| 4342 | break; |
| 4343 | case 3: |
| 4344 | CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL; |
| 4345 | break; |
| 4346 | default: |
| 4347 | break; |
| 4348 | } |
| 4349 | } |
| 4350 | */ |
| 4351 | |
| 4352 | tempal = CHTVVCLKPtr[tempal]; |
| 4353 | return tempal; |
| 4354 | } |
| 4355 | |
| 4356 | } |
| 4357 | |
| 4358 | tempal = (unsigned char) XGINew_GetReg2((pVBInfo->P3ca + 0x02)); |
| 4359 | tempal = tempal >> 2; |
| 4360 | tempal &= 0x03; |
| 4361 | |
| 4362 | if ((pVBInfo->LCDInfo & EnableScalingLCD) && (modeflag & Charx8Dot)) /* for Dot8 Scaling LCD */ |
| 4363 | tempal = tempal ^ tempal; /* ; set to VCLK25MHz always */ |
| 4364 | |
| 4365 | if (ModeNo <= 0x13) |
| 4366 | return tempal; |
| 4367 | |
| 4368 | tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; |
| 4369 | return tempal; |
| 4370 | } |
| 4371 | |
| 4372 | void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0, |
| 4373 | unsigned char *di_1, struct vb_device_info *pVBInfo) |
| 4374 | { |
| 4375 | if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 2007/05/16 */ |
| 4376 | /* VideoDebugPrint((0, "XGI_GetVCLKLen: pVBInfo->IF_DEF_CH7007==1\n")); */ |
| 4377 | *di_0 = (unsigned char) XGI_CH7007VCLKData[tempal].SR2B; |
| 4378 | *di_1 = (unsigned char) XGI_CH7007VCLKData[tempal].SR2C; |
| 4379 | } else if (pVBInfo->VBType & (VB_XGI301 | VB_XGI301B | VB_XGI302B |
| 4380 | | VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) { |
| 4381 | if ((!(pVBInfo->VBInfo & SetCRT2ToLCDA)) && (pVBInfo->SetFlag |
| 4382 | & ProgrammingCRT2)) { |
| 4383 | *di_0 = (unsigned char) XGI_VBVCLKData[tempal].SR2B; |
| 4384 | *di_1 = XGI_VBVCLKData[tempal].SR2C; |
| 4385 | } |
| 4386 | } else { |
| 4387 | *di_0 = XGI_VCLKData[tempal].SR2B; |
| 4388 | *di_1 = XGI_VCLKData[tempal].SR2C; |
| 4389 | } |
| 4390 | } |
| 4391 | |
| 4392 | static void XGI_SetCRT2Offset(unsigned short ModeNo, |
| 4393 | unsigned short ModeIdIndex, |
| 4394 | unsigned short RefreshRateTableIndex, |
| 4395 | struct xgi_hw_device_info *HwDeviceExtension, |
| 4396 | struct vb_device_info *pVBInfo) |
| 4397 | { |
| 4398 | unsigned short offset; |
| 4399 | unsigned char temp; |
| 4400 | |
| 4401 | if (pVBInfo->VBInfo & SetInSlaveMode) |
| 4402 | return; |
| 4403 | |
| 4404 | offset = XGI_GetOffset(ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 4405 | HwDeviceExtension, pVBInfo); |
| 4406 | temp = (unsigned char) (offset & 0xFF); |
| 4407 | XGINew_SetReg1(pVBInfo->Part1Port, 0x07, temp); |
| 4408 | temp = (unsigned char) ((offset & 0xFF00) >> 8); |
| 4409 | XGINew_SetReg1(pVBInfo->Part1Port, 0x09, temp); |
| 4410 | temp = (unsigned char) (((offset >> 3) & 0xFF) + 1); |
| 4411 | XGINew_SetReg1(pVBInfo->Part1Port, 0x03, temp); |
| 4412 | } |
| 4413 | |
| 4414 | unsigned short XGI_GetOffset(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 4415 | unsigned short RefreshRateTableIndex, |
| 4416 | struct xgi_hw_device_info *HwDeviceExtension, |
| 4417 | struct vb_device_info *pVBInfo) |
| 4418 | { |
| 4419 | unsigned short temp, colordepth, modeinfo, index, infoflag, |
| 4420 | ColorDepth[] = { 0x01, 0x02, 0x04 }; |
| 4421 | |
| 4422 | modeinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeInfo; |
| 4423 | if (ModeNo <= 0x14) |
| 4424 | infoflag = 0; |
| 4425 | else |
| 4426 | infoflag = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag; |
| 4427 | |
| 4428 | index = (modeinfo >> 8) & 0xFF; |
| 4429 | |
| 4430 | temp = pVBInfo->ScreenOffset[index]; |
| 4431 | |
| 4432 | if (infoflag & InterlaceMode) |
| 4433 | temp = temp << 1; |
| 4434 | |
| 4435 | colordepth = XGI_GetColorDepth(ModeNo, ModeIdIndex, pVBInfo); |
| 4436 | |
| 4437 | if ((ModeNo >= 0x7C) && (ModeNo <= 0x7E)) { |
| 4438 | temp = ModeNo - 0x7C; |
| 4439 | colordepth = ColorDepth[temp]; |
| 4440 | temp = 0x6B; |
| 4441 | if (infoflag & InterlaceMode) |
| 4442 | temp = temp << 1; |
| 4443 | return temp * colordepth; |
| 4444 | } else { |
| 4445 | return temp * colordepth; |
| 4446 | } |
| 4447 | } |
| 4448 | |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 4449 | static void XGI_SetCRT2FIFO(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4450 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4451 | XGINew_SetReg1(pVBInfo->Part1Port, 0x01, 0x3B); /* threshold high ,disable auto threshold */ |
| 4452 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x02, ~(0x3F), 0x04); /* threshold low default 04h */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4453 | } |
| 4454 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4455 | void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4456 | struct xgi_hw_device_info *HwDeviceExtension, |
| 4457 | unsigned short RefreshRateTableIndex, |
| 4458 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4459 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4460 | unsigned short tempcx = 0, CRT1Index = 0, resinfo = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4461 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4462 | if (ModeNo > 0x13) { |
| 4463 | CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; |
| 4464 | CRT1Index &= IndexMask; |
| 4465 | resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; |
| 4466 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4467 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4468 | XGI_SetCRT2Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 4469 | HwDeviceExtension, pVBInfo); |
| 4470 | XGI_SetCRT2FIFO(pVBInfo); |
| 4471 | /* XGI_SetCRT2Sync(ModeNo,RefreshRateTableIndex); */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4472 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4473 | for (tempcx = 4; tempcx < 7; tempcx++) |
| 4474 | XGINew_SetReg1(pVBInfo->Part1Port, tempcx, 0x0); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4475 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4476 | XGINew_SetReg1(pVBInfo->Part1Port, 0x50, 0x00); |
| 4477 | XGINew_SetReg1(pVBInfo->Part1Port, 0x02, 0x44); /* temp 0206 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4478 | } |
| 4479 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 4480 | void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4481 | struct xgi_hw_device_info *HwDeviceExtension, |
| 4482 | unsigned short RefreshRateTableIndex, |
| 4483 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4484 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4485 | unsigned short temp = 0, tempax = 0, tempbx = 0, tempcx = 0, |
| 4486 | pushbx = 0, CRT1Index = 0, modeflag, resinfo = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4487 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4488 | if (ModeNo > 0x13) { |
| 4489 | CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; |
| 4490 | CRT1Index &= IndexMask; |
| 4491 | resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4492 | } |
| 4493 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4494 | if (ModeNo <= 0x13) |
| 4495 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 4496 | else |
| 4497 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4498 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4499 | /* bainy change table name */ |
| 4500 | if (modeflag & HalfDCLK) { |
| 4501 | temp = (pVBInfo->VGAHT / 2 - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */ |
| 4502 | XGINew_SetReg1(pVBInfo->Part1Port, 0x08, temp); |
| 4503 | temp = (((pVBInfo->VGAHT / 2 - 1) & 0xFF00) >> 8) << 4; |
| 4504 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x09, ~0x0F0, temp); |
| 4505 | temp = (pVBInfo->VGAHDE / 2 + 16) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */ |
| 4506 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0A, temp); |
| 4507 | tempcx = ((pVBInfo->VGAHT - pVBInfo->VGAHDE) / 2) >> 2; |
| 4508 | pushbx = pVBInfo->VGAHDE / 2 + 16; |
| 4509 | tempcx = tempcx >> 1; |
| 4510 | tempbx = pushbx + tempcx; /* bx BTVGA@HRS 0x0B,0x0C */ |
| 4511 | tempcx += tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4512 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4513 | if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) { |
| 4514 | tempbx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[4]; |
| 4515 | tempbx |= ((pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14] |
| 4516 | & 0xC0) << 2); |
| 4517 | tempbx = (tempbx - 3) << 3; /* (VGAHRS-3)*8 */ |
| 4518 | tempcx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5]; |
| 4519 | tempcx &= 0x1F; |
| 4520 | temp = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[15]; |
| 4521 | temp = (temp & 0x04) << (5 - 2); /* VGAHRE D[5] */ |
| 4522 | tempcx = ((tempcx | temp) - 3) << 3; /* (VGAHRE-3)*8 */ |
| 4523 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4524 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4525 | tempbx += 4; |
| 4526 | tempcx += 4; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4527 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4528 | if (tempcx > (pVBInfo->VGAHT / 2)) |
| 4529 | tempcx = pVBInfo->VGAHT / 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4530 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4531 | temp = tempbx & 0x00FF; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4532 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4533 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0B, temp); |
| 4534 | } else { |
| 4535 | temp = (pVBInfo->VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */ |
| 4536 | XGINew_SetReg1(pVBInfo->Part1Port, 0x08, temp); |
| 4537 | temp = (((pVBInfo->VGAHT - 1) & 0xFF00) >> 8) << 4; |
| 4538 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x09, ~0x0F0, temp); |
| 4539 | temp = (pVBInfo->VGAHDE + 16) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */ |
| 4540 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0A, temp); |
| 4541 | tempcx = (pVBInfo->VGAHT - pVBInfo->VGAHDE) >> 2; /* cx */ |
| 4542 | pushbx = pVBInfo->VGAHDE + 16; |
| 4543 | tempcx = tempcx >> 1; |
| 4544 | tempbx = pushbx + tempcx; /* bx BTVGA@HRS 0x0B,0x0C */ |
| 4545 | tempcx += tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4546 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4547 | if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) { |
| 4548 | tempbx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[3]; |
| 4549 | tempbx |= ((pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5] |
| 4550 | & 0xC0) << 2); |
| 4551 | tempbx = (tempbx - 3) << 3; /* (VGAHRS-3)*8 */ |
| 4552 | tempcx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[4]; |
| 4553 | tempcx &= 0x1F; |
| 4554 | temp = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[6]; |
| 4555 | temp = (temp & 0x04) << (5 - 2); /* VGAHRE D[5] */ |
| 4556 | tempcx = ((tempcx | temp) - 3) << 3; /* (VGAHRE-3)*8 */ |
| 4557 | tempbx += 16; |
| 4558 | tempcx += 16; |
| 4559 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4560 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4561 | if (tempcx > pVBInfo->VGAHT) |
| 4562 | tempcx = pVBInfo->VGAHT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4563 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4564 | temp = tempbx & 0x00FF; |
| 4565 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0B, temp); |
| 4566 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4567 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4568 | tempax = (tempax & 0x00FF) | (tempbx & 0xFF00); |
| 4569 | tempbx = pushbx; |
| 4570 | tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4); |
| 4571 | tempax |= (tempbx & 0xFF00); |
| 4572 | temp = (tempax & 0xFF00) >> 8; |
| 4573 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0C, temp); |
| 4574 | temp = tempcx & 0x00FF; |
| 4575 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0D, temp); |
| 4576 | tempcx = (pVBInfo->VGAVT - 1); |
| 4577 | temp = tempcx & 0x00FF; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4578 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4579 | if (pVBInfo->IF_DEF_CH7005 == 1) { |
| 4580 | if (pVBInfo->VBInfo & 0x0C) |
| 4581 | temp--; |
| 4582 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4583 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4584 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0E, temp); |
| 4585 | tempbx = pVBInfo->VGAVDE - 1; |
| 4586 | temp = tempbx & 0x00FF; |
| 4587 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0F, temp); |
| 4588 | temp = ((tempbx & 0xFF00) << 3) >> 8; |
| 4589 | temp |= ((tempcx & 0xFF00) >> 8); |
| 4590 | XGINew_SetReg1(pVBInfo->Part1Port, 0x12, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4591 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4592 | tempax = pVBInfo->VGAVDE; |
| 4593 | tempbx = pVBInfo->VGAVDE; |
| 4594 | tempcx = pVBInfo->VGAVT; |
| 4595 | tempbx = (pVBInfo->VGAVT + pVBInfo->VGAVDE) >> 1; /* BTVGA2VRS 0x10,0x11 */ |
| 4596 | tempcx = ((pVBInfo->VGAVT - pVBInfo->VGAVDE) >> 4) + tempbx + 1; /* BTVGA2VRE 0x11 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4597 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4598 | if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) { |
| 4599 | tempbx = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[10]; |
| 4600 | temp = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[9]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4601 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4602 | if (temp & 0x04) |
| 4603 | tempbx |= 0x0100; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4604 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4605 | if (temp & 0x080) |
| 4606 | tempbx |= 0x0200; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4607 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4608 | temp = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4609 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4610 | if (temp & 0x08) |
| 4611 | tempbx |= 0x0400; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4612 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4613 | temp = pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[11]; |
| 4614 | tempcx = (tempcx & 0xFF00) | (temp & 0x00FF); |
| 4615 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4616 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4617 | temp = tempbx & 0x00FF; |
| 4618 | XGINew_SetReg1(pVBInfo->Part1Port, 0x10, temp); |
| 4619 | temp = ((tempbx & 0xFF00) >> 8) << 4; |
| 4620 | temp = ((tempcx & 0x000F) | (temp)); |
| 4621 | XGINew_SetReg1(pVBInfo->Part1Port, 0x11, temp); |
| 4622 | tempax = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4623 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4624 | if (modeflag & DoubleScanMode) |
| 4625 | tempax |= 0x80; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4626 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4627 | if (modeflag & HalfDCLK) |
| 4628 | tempax |= 0x40; |
| 4629 | |
| 4630 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2C, ~0x0C0, tempax); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4631 | } |
| 4632 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4633 | void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 4634 | struct xgi_hw_device_info *HwDeviceExtension, |
| 4635 | unsigned short RefreshRateTableIndex, |
| 4636 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4637 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4638 | unsigned short push1, push2, tempax, tempbx = 0, tempcx, temp, resinfo, |
| 4639 | modeflag, CRT1Index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4640 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4641 | if (ModeNo <= 0x13) { |
| 4642 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 4643 | resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; |
| 4644 | } else { |
| 4645 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
| 4646 | resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; |
| 4647 | CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; |
| 4648 | CRT1Index &= IndexMask; |
| 4649 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4650 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4651 | if (!(pVBInfo->VBInfo & SetInSlaveMode)) |
| 4652 | return; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4653 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4654 | temp = 0xFF; /* set MAX HT */ |
| 4655 | XGINew_SetReg1(pVBInfo->Part1Port, 0x03, temp); |
| 4656 | /* if (modeflag & Charx8Dot) */ |
| 4657 | /* tempcx = 0x08; */ |
| 4658 | /* else */ |
| 4659 | tempcx = 0x08; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4660 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4661 | if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) |
| 4662 | modeflag |= Charx8Dot; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4663 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4664 | tempax = pVBInfo->VGAHDE; /* 0x04 Horizontal Display End */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4665 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4666 | if (modeflag & HalfDCLK) |
| 4667 | tempax = tempax >> 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4668 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4669 | tempax = (tempax / tempcx) - 1; |
| 4670 | tempbx |= ((tempax & 0x00FF) << 8); |
| 4671 | temp = tempax & 0x00FF; |
| 4672 | XGINew_SetReg1(pVBInfo->Part1Port, 0x04, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4673 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4674 | temp = (tempbx & 0xFF00) >> 8; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4675 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4676 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 4677 | if (!(pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 4678 | | VB_XGI302LV | VB_XGI301C))) |
| 4679 | temp += 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4680 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4681 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { |
| 4682 | if (pVBInfo->VBType & VB_XGI301LV) { |
| 4683 | if (pVBInfo->VBExtInfo == VB_YPbPr1080i) { |
| 4684 | if (resinfo == 7) |
| 4685 | temp -= 2; |
| 4686 | } |
| 4687 | } else if (resinfo == 7) { |
| 4688 | temp -= 2; |
| 4689 | } |
| 4690 | } |
| 4691 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4692 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4693 | XGINew_SetReg1(pVBInfo->Part1Port, 0x05, temp); /* 0x05 Horizontal Display Start */ |
| 4694 | XGINew_SetReg1(pVBInfo->Part1Port, 0x06, 0x03); /* 0x06 Horizontal Blank end */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4695 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4696 | if (!(pVBInfo->VBInfo & DisableCRT2Display)) { /* 030226 bainy */ |
| 4697 | if (pVBInfo->VBInfo & SetCRT2ToTV) |
| 4698 | tempax = pVBInfo->VGAHT; |
| 4699 | else |
| 4700 | tempax = XGI_GetVGAHT2(pVBInfo); |
| 4701 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4702 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4703 | if (tempax >= pVBInfo->VGAHT) |
| 4704 | tempax = pVBInfo->VGAHT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4705 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4706 | if (modeflag & HalfDCLK) |
| 4707 | tempax = tempax >> 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4708 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4709 | tempax = (tempax / tempcx) - 5; |
| 4710 | tempcx = tempax; /* 20030401 0x07 horizontal Retrace Start */ |
| 4711 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { |
| 4712 | temp = (tempbx & 0x00FF) - 1; |
| 4713 | if (!(modeflag & HalfDCLK)) { |
| 4714 | temp -= 6; |
| 4715 | if (pVBInfo->TVInfo & TVSimuMode) { |
| 4716 | temp -= 4; |
| 4717 | if (ModeNo > 0x13) |
| 4718 | temp -= 10; |
| 4719 | } |
| 4720 | } |
| 4721 | } else { |
| 4722 | /* tempcx = tempbx & 0x00FF ; */ |
| 4723 | tempbx = (tempbx & 0xFF00) >> 8; |
| 4724 | tempcx = (tempcx + tempbx) >> 1; |
| 4725 | temp = (tempcx & 0x00FF) + 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4726 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4727 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 4728 | temp -= 1; |
| 4729 | if (!(modeflag & HalfDCLK)) { |
| 4730 | if ((modeflag & Charx8Dot)) { |
| 4731 | temp += 4; |
| 4732 | if (pVBInfo->VGAHDE >= 800) |
| 4733 | temp -= 6; |
| 4734 | } |
| 4735 | } |
| 4736 | } else { |
| 4737 | if (!(modeflag & HalfDCLK)) { |
| 4738 | temp -= 4; |
| 4739 | if (pVBInfo->LCDResInfo != Panel1280x960) { |
| 4740 | if (pVBInfo->VGAHDE >= 800) { |
| 4741 | temp -= 7; |
| 4742 | if (pVBInfo->ModeType |
| 4743 | == ModeEGA) { |
| 4744 | if (pVBInfo->VGAVDE |
| 4745 | == 1024) { |
| 4746 | temp += 15; |
| 4747 | if (pVBInfo->LCDResInfo |
| 4748 | != Panel1280x1024) { |
| 4749 | temp |
| 4750 | += 7; |
| 4751 | } |
| 4752 | } |
| 4753 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4754 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4755 | if (pVBInfo->VGAHDE >= 1280) { |
| 4756 | if (pVBInfo->LCDResInfo |
| 4757 | != Panel1280x960) { |
| 4758 | if (pVBInfo->LCDInfo |
| 4759 | & LCDNonExpanding) { |
| 4760 | temp |
| 4761 | += 28; |
| 4762 | } |
| 4763 | } |
| 4764 | } |
| 4765 | } |
| 4766 | } |
| 4767 | } |
| 4768 | } |
| 4769 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4770 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4771 | XGINew_SetReg1(pVBInfo->Part1Port, 0x07, temp); /* 0x07 Horizontal Retrace Start */ |
| 4772 | XGINew_SetReg1(pVBInfo->Part1Port, 0x08, 0); /* 0x08 Horizontal Retrace End */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4773 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4774 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 4775 | if (pVBInfo->TVInfo & TVSimuMode) { |
| 4776 | if ((ModeNo == 0x06) || (ModeNo == 0x10) || (ModeNo |
| 4777 | == 0x11) || (ModeNo == 0x13) || (ModeNo |
| 4778 | == 0x0F)) { |
| 4779 | XGINew_SetReg1(pVBInfo->Part1Port, 0x07, 0x5b); |
| 4780 | XGINew_SetReg1(pVBInfo->Part1Port, 0x08, 0x03); |
| 4781 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4782 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4783 | if ((ModeNo == 0x00) || (ModeNo == 0x01)) { |
| 4784 | if (pVBInfo->TVInfo & SetNTSCTV) { |
| 4785 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4786 | 0x07, 0x2A); |
| 4787 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4788 | 0x08, 0x61); |
| 4789 | } else { |
| 4790 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4791 | 0x07, 0x2A); |
| 4792 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4793 | 0x08, 0x41); |
| 4794 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4795 | 0x0C, 0xF0); |
| 4796 | } |
| 4797 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4798 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4799 | if ((ModeNo == 0x02) || (ModeNo == 0x03) || (ModeNo |
| 4800 | == 0x07)) { |
| 4801 | if (pVBInfo->TVInfo & SetNTSCTV) { |
| 4802 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4803 | 0x07, 0x54); |
| 4804 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4805 | 0x08, 0x00); |
| 4806 | } else { |
| 4807 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4808 | 0x07, 0x55); |
| 4809 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4810 | 0x08, 0x00); |
| 4811 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4812 | 0x0C, 0xF0); |
| 4813 | } |
| 4814 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4815 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4816 | if ((ModeNo == 0x04) || (ModeNo == 0x05) || (ModeNo |
| 4817 | == 0x0D) || (ModeNo == 0x50)) { |
| 4818 | if (pVBInfo->TVInfo & SetNTSCTV) { |
| 4819 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4820 | 0x07, 0x30); |
| 4821 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4822 | 0x08, 0x03); |
| 4823 | } else { |
| 4824 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4825 | 0x07, 0x2f); |
| 4826 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 4827 | 0x08, 0x02); |
| 4828 | } |
| 4829 | } |
| 4830 | } |
| 4831 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4832 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4833 | XGINew_SetReg1(pVBInfo->Part1Port, 0x18, 0x03); /* 0x18 SR0B */ |
| 4834 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0xF0, 0x00); |
| 4835 | XGINew_SetReg1(pVBInfo->Part1Port, 0x09, 0xFF); /* 0x09 Set Max VT */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4836 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4837 | tempbx = pVBInfo->VGAVT; |
| 4838 | push1 = tempbx; |
| 4839 | tempcx = 0x121; |
| 4840 | tempbx = pVBInfo->VGAVDE; /* 0x0E Virtical Display End */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4841 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4842 | if (tempbx == 357) |
| 4843 | tempbx = 350; |
| 4844 | if (tempbx == 360) |
| 4845 | tempbx = 350; |
| 4846 | if (tempbx == 375) |
| 4847 | tempbx = 350; |
| 4848 | if (tempbx == 405) |
| 4849 | tempbx = 400; |
| 4850 | if (tempbx == 525) |
| 4851 | tempbx = 480; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4852 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4853 | push2 = tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4854 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4855 | if (pVBInfo->VBInfo & SetCRT2ToLCD) { |
| 4856 | if (pVBInfo->LCDResInfo == Panel1024x768) { |
| 4857 | if (!(pVBInfo->LCDInfo & LCDVESATiming)) { |
| 4858 | if (tempbx == 350) |
| 4859 | tempbx += 5; |
| 4860 | if (tempbx == 480) |
| 4861 | tempbx += 5; |
| 4862 | } |
| 4863 | } |
| 4864 | } |
| 4865 | tempbx--; |
| 4866 | temp = tempbx & 0x00FF; |
| 4867 | tempbx--; |
| 4868 | temp = tempbx & 0x00FF; |
| 4869 | XGINew_SetReg1(pVBInfo->Part1Port, 0x10, temp); /* 0x10 vertical Blank Start */ |
| 4870 | tempbx = push2; |
| 4871 | tempbx--; |
| 4872 | temp = tempbx & 0x00FF; |
| 4873 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0E, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4874 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4875 | if (tempbx & 0x0100) |
| 4876 | tempcx |= 0x0002; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4877 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4878 | tempax = 0x000B; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4879 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4880 | if (modeflag & DoubleScanMode) |
| 4881 | tempax |= 0x08000; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4882 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4883 | if (tempbx & 0x0200) |
| 4884 | tempcx |= 0x0040; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4885 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4886 | temp = (tempax & 0xFF00) >> 8; |
| 4887 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0B, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4888 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4889 | if (tempbx & 0x0400) |
| 4890 | tempcx |= 0x0600; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 4891 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 4892 | XGINew_SetReg1(pVBInfo->Part1Port, 0x11, 0x00); /* 0x11 Vertival Blank End */ |
| 4893 | |
| 4894 | tempax = push1; |
| 4895 | tempax -= tempbx; /* 0x0C Vertical Retrace Start */ |
| 4896 | tempax = tempax >> 2; |
| 4897 | push1 = tempax; /* push ax */ |
| 4898 | |
| 4899 | if (resinfo != 0x09) { |
| 4900 | tempax = tempax << 1; |
| 4901 | tempbx += tempax; |
| 4902 | } |
| 4903 | |
| 4904 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { |
| 4905 | if (pVBInfo->VBType & VB_XGI301LV) { |
| 4906 | if (pVBInfo->TVInfo & SetYPbPrMode1080i) { |
| 4907 | tempbx -= 10; |
| 4908 | } else { |
| 4909 | if (pVBInfo->TVInfo & TVSimuMode) { |
| 4910 | if (pVBInfo->TVInfo & SetPALTV) { |
| 4911 | if (pVBInfo->VBType |
| 4912 | & VB_XGI301LV) { |
| 4913 | if (!(pVBInfo->TVInfo |
| 4914 | & (SetYPbPrMode525p |
| 4915 | | SetYPbPrMode750p |
| 4916 | | SetYPbPrMode1080i))) |
| 4917 | tempbx += 40; |
| 4918 | } else { |
| 4919 | tempbx += 40; |
| 4920 | } |
| 4921 | } |
| 4922 | } |
| 4923 | } |
| 4924 | } else { |
| 4925 | tempbx -= 10; |
| 4926 | } |
| 4927 | } else { |
| 4928 | if (pVBInfo->TVInfo & TVSimuMode) { |
| 4929 | if (pVBInfo->TVInfo & SetPALTV) { |
| 4930 | if (pVBInfo->VBType & VB_XGI301LV) { |
| 4931 | if (!(pVBInfo->TVInfo |
| 4932 | & (SetYPbPrMode525p |
| 4933 | | SetYPbPrMode750p |
| 4934 | | SetYPbPrMode1080i))) |
| 4935 | tempbx += 40; |
| 4936 | } else { |
| 4937 | tempbx += 40; |
| 4938 | } |
| 4939 | } |
| 4940 | } |
| 4941 | } |
| 4942 | tempax = push1; |
| 4943 | tempax = tempax >> 2; |
| 4944 | tempax++; |
| 4945 | tempax += tempbx; |
| 4946 | push1 = tempax; /* push ax */ |
| 4947 | |
| 4948 | if ((pVBInfo->TVInfo & SetPALTV)) { |
| 4949 | if (tempbx <= 513) { |
| 4950 | if (tempax >= 513) |
| 4951 | tempbx = 513; |
| 4952 | } |
| 4953 | } |
| 4954 | |
| 4955 | temp = tempbx & 0x00FF; |
| 4956 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0C, temp); |
| 4957 | tempbx--; |
| 4958 | temp = tempbx & 0x00FF; |
| 4959 | XGINew_SetReg1(pVBInfo->Part1Port, 0x10, temp); |
| 4960 | |
| 4961 | if (tempbx & 0x0100) |
| 4962 | tempcx |= 0x0008; |
| 4963 | |
| 4964 | if (tempbx & 0x0200) |
| 4965 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x0B, 0x0FF, 0x20); |
| 4966 | |
| 4967 | tempbx++; |
| 4968 | |
| 4969 | if (tempbx & 0x0100) |
| 4970 | tempcx |= 0x0004; |
| 4971 | |
| 4972 | if (tempbx & 0x0200) |
| 4973 | tempcx |= 0x0080; |
| 4974 | |
| 4975 | if (tempbx & 0x0400) |
| 4976 | tempcx |= 0x0C00; |
| 4977 | |
| 4978 | tempbx = push1; /* pop ax */ |
| 4979 | temp = tempbx & 0x00FF; |
| 4980 | temp &= 0x0F; |
| 4981 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0D, temp); /* 0x0D vertical Retrace End */ |
| 4982 | |
| 4983 | if (tempbx & 0x0010) |
| 4984 | tempcx |= 0x2000; |
| 4985 | |
| 4986 | temp = tempcx & 0x00FF; |
| 4987 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0A, temp); /* 0x0A CR07 */ |
| 4988 | temp = (tempcx & 0x0FF00) >> 8; |
| 4989 | XGINew_SetReg1(pVBInfo->Part1Port, 0x17, temp); /* 0x17 SR0A */ |
| 4990 | tempax = modeflag; |
| 4991 | temp = (tempax & 0xFF00) >> 8; |
| 4992 | |
| 4993 | temp = (temp >> 1) & 0x09; |
| 4994 | |
| 4995 | if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) |
| 4996 | temp |= 0x01; |
| 4997 | |
| 4998 | XGINew_SetReg1(pVBInfo->Part1Port, 0x16, temp); /* 0x16 SR01 */ |
| 4999 | XGINew_SetReg1(pVBInfo->Part1Port, 0x0F, 0); /* 0x0F CR14 */ |
| 5000 | XGINew_SetReg1(pVBInfo->Part1Port, 0x12, 0); /* 0x12 CR17 */ |
| 5001 | |
| 5002 | if (pVBInfo->LCDInfo & LCDRGB18Bit) |
| 5003 | temp = 0x80; |
| 5004 | else |
| 5005 | temp = 0x00; |
| 5006 | |
| 5007 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1A, temp); /* 0x1A SR0E */ |
| 5008 | |
| 5009 | return; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5010 | } |
| 5011 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5012 | void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 5013 | unsigned short RefreshRateTableIndex, |
| 5014 | struct xgi_hw_device_info *HwDeviceExtension, |
| 5015 | struct vb_device_info *pVBInfo) |
| 5016 | { |
| 5017 | unsigned short i, j, tempax, tempbx, tempcx, temp, push1, push2, |
| 5018 | modeflag, resinfo, crt2crtc; |
| 5019 | unsigned char *TimingPoint; |
| 5020 | |
| 5021 | unsigned long longtemp, tempeax, tempebx, temp2, tempecx; |
| 5022 | |
| 5023 | if (ModeNo <= 0x13) { |
| 5024 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 5025 | resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; |
| 5026 | crt2crtc = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; |
| 5027 | } else { |
| 5028 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
| 5029 | resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; |
| 5030 | crt2crtc |
| 5031 | = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 5032 | } |
| 5033 | |
| 5034 | tempax = 0; |
| 5035 | |
| 5036 | if (!(pVBInfo->VBInfo & SetCRT2ToAVIDEO)) |
| 5037 | tempax |= 0x0800; |
| 5038 | |
| 5039 | if (!(pVBInfo->VBInfo & SetCRT2ToSVIDEO)) |
| 5040 | tempax |= 0x0400; |
| 5041 | |
| 5042 | if (pVBInfo->VBInfo & SetCRT2ToSCART) |
| 5043 | tempax |= 0x0200; |
| 5044 | |
| 5045 | if (!(pVBInfo->TVInfo & SetPALTV)) |
| 5046 | tempax |= 0x1000; |
| 5047 | |
| 5048 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) |
| 5049 | tempax |= 0x0100; |
| 5050 | |
| 5051 | if (pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p)) |
| 5052 | tempax &= 0xfe00; |
| 5053 | |
| 5054 | tempax = (tempax & 0xff00) >> 8; |
| 5055 | |
| 5056 | XGINew_SetReg1(pVBInfo->Part2Port, 0x0, tempax); |
| 5057 | TimingPoint = pVBInfo->NTSCTiming; |
| 5058 | |
| 5059 | if (pVBInfo->TVInfo & SetPALTV) |
| 5060 | TimingPoint = pVBInfo->PALTiming; |
| 5061 | |
| 5062 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { |
| 5063 | TimingPoint = pVBInfo->HiTVExtTiming; |
| 5064 | |
| 5065 | if (pVBInfo->VBInfo & SetInSlaveMode) |
| 5066 | TimingPoint = pVBInfo->HiTVSt2Timing; |
| 5067 | |
| 5068 | if (pVBInfo->SetFlag & TVSimuMode) |
| 5069 | TimingPoint = pVBInfo->HiTVSt1Timing; |
| 5070 | |
| 5071 | if (!(modeflag & Charx8Dot)) |
| 5072 | TimingPoint = pVBInfo->HiTVTextTiming; |
| 5073 | } |
| 5074 | |
| 5075 | if (pVBInfo->VBInfo & SetCRT2ToYPbPr) { |
| 5076 | if (pVBInfo->TVInfo & SetYPbPrMode525i) |
| 5077 | TimingPoint = pVBInfo->YPbPr525iTiming; |
| 5078 | |
| 5079 | if (pVBInfo->TVInfo & SetYPbPrMode525p) |
| 5080 | TimingPoint = pVBInfo->YPbPr525pTiming; |
| 5081 | |
| 5082 | if (pVBInfo->TVInfo & SetYPbPrMode750p) |
| 5083 | TimingPoint = pVBInfo->YPbPr750pTiming; |
| 5084 | } |
| 5085 | |
| 5086 | for (i = 0x01, j = 0; i <= 0x2D; i++, j++) |
| 5087 | XGINew_SetReg1(pVBInfo->Part2Port, i, TimingPoint[j]); |
| 5088 | |
| 5089 | for (i = 0x39; i <= 0x45; i++, j++) |
| 5090 | XGINew_SetReg1(pVBInfo->Part2Port, i, TimingPoint[j]); /* di->temp2[j] */ |
| 5091 | |
| 5092 | if (pVBInfo->VBInfo & SetCRT2ToTV) |
| 5093 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x3A, 0x1F, 0x00); |
| 5094 | |
| 5095 | temp = pVBInfo->NewFlickerMode; |
| 5096 | temp &= 0x80; |
| 5097 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0A, 0xFF, temp); |
| 5098 | |
| 5099 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) |
| 5100 | tempax = 950; |
| 5101 | |
| 5102 | if (pVBInfo->TVInfo & SetPALTV) |
| 5103 | tempax = 520; |
| 5104 | else |
| 5105 | tempax = 440; |
| 5106 | |
| 5107 | if (pVBInfo->VDE <= tempax) { |
| 5108 | tempax -= pVBInfo->VDE; |
| 5109 | tempax = tempax >> 2; |
| 5110 | tempax = (tempax & 0x00FF) | ((tempax & 0x00FF) << 8); |
| 5111 | push1 = tempax; |
| 5112 | temp = (tempax & 0xFF00) >> 8; |
| 5113 | temp += (unsigned short) TimingPoint[0]; |
| 5114 | |
| 5115 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 5116 | | VB_XGI302LV | VB_XGI301C)) { |
| 5117 | if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO |
| 5118 | | SetCRT2ToSVIDEO | SetCRT2ToSCART |
| 5119 | | SetCRT2ToYPbPr)) { |
| 5120 | tempcx = pVBInfo->VGAHDE; |
| 5121 | if (tempcx >= 1024) { |
| 5122 | temp = 0x17; /* NTSC */ |
| 5123 | if (pVBInfo->TVInfo & SetPALTV) |
| 5124 | temp = 0x19; /* PAL */ |
| 5125 | } |
| 5126 | } |
| 5127 | } |
| 5128 | |
| 5129 | XGINew_SetReg1(pVBInfo->Part2Port, 0x01, temp); |
| 5130 | tempax = push1; |
| 5131 | temp = (tempax & 0xFF00) >> 8; |
| 5132 | temp += TimingPoint[1]; |
| 5133 | |
| 5134 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 5135 | | VB_XGI302LV | VB_XGI301C)) { |
| 5136 | if ((pVBInfo->VBInfo & (SetCRT2ToAVIDEO |
| 5137 | | SetCRT2ToSVIDEO | SetCRT2ToSCART |
| 5138 | | SetCRT2ToYPbPr))) { |
| 5139 | tempcx = pVBInfo->VGAHDE; |
| 5140 | if (tempcx >= 1024) { |
| 5141 | temp = 0x1D; /* NTSC */ |
| 5142 | if (pVBInfo->TVInfo & SetPALTV) |
| 5143 | temp = 0x52; /* PAL */ |
| 5144 | } |
| 5145 | } |
| 5146 | } |
| 5147 | XGINew_SetReg1(pVBInfo->Part2Port, 0x02, temp); |
| 5148 | } |
| 5149 | |
| 5150 | /* 301b */ |
| 5151 | tempcx = pVBInfo->HT; |
| 5152 | |
| 5153 | if (XGI_IsLCDDualLink(pVBInfo)) |
| 5154 | tempcx = tempcx >> 1; |
| 5155 | |
| 5156 | tempcx -= 2; |
| 5157 | temp = tempcx & 0x00FF; |
| 5158 | XGINew_SetReg1(pVBInfo->Part2Port, 0x1B, temp); |
| 5159 | |
| 5160 | temp = (tempcx & 0xFF00) >> 8; |
| 5161 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1D, ~0x0F, temp); |
| 5162 | |
| 5163 | tempcx = pVBInfo->HT >> 1; |
| 5164 | push1 = tempcx; /* push cx */ |
| 5165 | tempcx += 7; |
| 5166 | |
| 5167 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) |
| 5168 | tempcx -= 4; |
| 5169 | |
| 5170 | temp = tempcx & 0x00FF; |
| 5171 | temp = temp << 4; |
| 5172 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x22, 0x0F, temp); |
| 5173 | |
| 5174 | tempbx = TimingPoint[j] | ((TimingPoint[j + 1]) << 8); |
| 5175 | tempbx += tempcx; |
| 5176 | push2 = tempbx; |
| 5177 | temp = tempbx & 0x00FF; |
| 5178 | XGINew_SetReg1(pVBInfo->Part2Port, 0x24, temp); |
| 5179 | temp = (tempbx & 0xFF00) >> 8; |
| 5180 | temp = temp << 4; |
| 5181 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x25, 0x0F, temp); |
| 5182 | |
| 5183 | tempbx = push2; |
| 5184 | tempbx = tempbx + 8; |
| 5185 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { |
| 5186 | tempbx = tempbx - 4; |
| 5187 | tempcx = tempbx; |
| 5188 | } |
| 5189 | |
| 5190 | temp = (tempbx & 0x00FF) << 4; |
| 5191 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x29, 0x0F, temp); |
| 5192 | |
| 5193 | j += 2; |
| 5194 | tempcx += (TimingPoint[j] | ((TimingPoint[j + 1]) << 8)); |
| 5195 | temp = tempcx & 0x00FF; |
| 5196 | XGINew_SetReg1(pVBInfo->Part2Port, 0x27, temp); |
| 5197 | temp = ((tempcx & 0xFF00) >> 8) << 4; |
| 5198 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x28, 0x0F, temp); |
| 5199 | |
| 5200 | tempcx += 8; |
| 5201 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) |
| 5202 | tempcx -= 4; |
| 5203 | |
| 5204 | temp = tempcx & 0xFF; |
| 5205 | temp = temp << 4; |
| 5206 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x2A, 0x0F, temp); |
| 5207 | |
| 5208 | tempcx = push1; /* pop cx */ |
| 5209 | j += 2; |
| 5210 | temp = TimingPoint[j] | ((TimingPoint[j + 1]) << 8); |
| 5211 | tempcx -= temp; |
| 5212 | temp = tempcx & 0x00FF; |
| 5213 | temp = temp << 4; |
| 5214 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x2D, 0x0F, temp); |
| 5215 | |
| 5216 | tempcx -= 11; |
| 5217 | |
| 5218 | if (!(pVBInfo->VBInfo & SetCRT2ToTV)) { |
| 5219 | tempax = XGI_GetVGAHT2(pVBInfo); |
| 5220 | tempcx = tempax - 1; |
| 5221 | } |
| 5222 | temp = tempcx & 0x00FF; |
| 5223 | XGINew_SetReg1(pVBInfo->Part2Port, 0x2E, temp); |
| 5224 | |
| 5225 | tempbx = pVBInfo->VDE; |
| 5226 | |
| 5227 | if (pVBInfo->VGAVDE == 360) |
| 5228 | tempbx = 746; |
| 5229 | if (pVBInfo->VGAVDE == 375) |
| 5230 | tempbx = 746; |
| 5231 | if (pVBInfo->VGAVDE == 405) |
| 5232 | tempbx = 853; |
| 5233 | |
| 5234 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 5235 | if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) { |
| 5236 | if (!(pVBInfo->TVInfo & (SetYPbPrMode525p |
| 5237 | | SetYPbPrMode750p))) |
| 5238 | tempbx = tempbx >> 1; |
| 5239 | } else |
| 5240 | tempbx = tempbx >> 1; |
| 5241 | } |
| 5242 | |
| 5243 | tempbx -= 2; |
| 5244 | temp = tempbx & 0x00FF; |
| 5245 | |
| 5246 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { |
| 5247 | if (pVBInfo->VBType & VB_XGI301LV) { |
| 5248 | if (pVBInfo->TVInfo & SetYPbPrMode1080i) { |
| 5249 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 5250 | if (ModeNo == 0x2f) |
| 5251 | temp += 1; |
| 5252 | } |
| 5253 | } |
| 5254 | } else { |
| 5255 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 5256 | if (ModeNo == 0x2f) |
| 5257 | temp += 1; |
| 5258 | } |
| 5259 | } |
| 5260 | } |
| 5261 | |
| 5262 | XGINew_SetReg1(pVBInfo->Part2Port, 0x2F, temp); |
| 5263 | |
| 5264 | temp = (tempcx & 0xFF00) >> 8; |
| 5265 | temp |= ((tempbx & 0xFF00) >> 8) << 6; |
| 5266 | |
| 5267 | if (!(pVBInfo->VBInfo & SetCRT2ToHiVisionTV)) { |
| 5268 | if (pVBInfo->VBType & VB_XGI301LV) { |
| 5269 | if (pVBInfo->TVInfo & SetYPbPrMode1080i) { |
| 5270 | temp |= 0x10; |
| 5271 | |
| 5272 | if (!(pVBInfo->VBInfo & SetCRT2ToSVIDEO)) |
| 5273 | temp |= 0x20; |
| 5274 | } |
| 5275 | } else { |
| 5276 | temp |= 0x10; |
| 5277 | if (!(pVBInfo->VBInfo & SetCRT2ToSVIDEO)) |
| 5278 | temp |= 0x20; |
| 5279 | } |
| 5280 | } |
| 5281 | |
| 5282 | XGINew_SetReg1(pVBInfo->Part2Port, 0x30, temp); |
| 5283 | |
| 5284 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 5285 | | VB_XGI302LV | VB_XGI301C)) { /* TV gatingno */ |
| 5286 | tempbx = pVBInfo->VDE; |
| 5287 | tempcx = tempbx - 2; |
| 5288 | |
| 5289 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 5290 | if (!(pVBInfo->TVInfo & (SetYPbPrMode525p |
| 5291 | | SetYPbPrMode750p))) |
| 5292 | tempbx = tempbx >> 1; |
| 5293 | } |
| 5294 | |
| 5295 | if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) { |
| 5296 | temp = 0; |
| 5297 | if (tempcx & 0x0400) |
| 5298 | temp |= 0x20; |
| 5299 | |
| 5300 | if (tempbx & 0x0400) |
| 5301 | temp |= 0x40; |
| 5302 | |
| 5303 | XGINew_SetReg1(pVBInfo->Part4Port, 0x10, temp); |
| 5304 | } |
| 5305 | |
| 5306 | temp = (((tempbx - 3) & 0x0300) >> 8) << 5; |
| 5307 | XGINew_SetReg1(pVBInfo->Part2Port, 0x46, temp); |
| 5308 | temp = (tempbx - 3) & 0x00FF; |
| 5309 | XGINew_SetReg1(pVBInfo->Part2Port, 0x47, temp); |
| 5310 | } |
| 5311 | |
| 5312 | tempbx = tempbx & 0x00FF; |
| 5313 | |
| 5314 | if (!(modeflag & HalfDCLK)) { |
| 5315 | tempcx = pVBInfo->VGAHDE; |
| 5316 | if (tempcx >= pVBInfo->HDE) { |
| 5317 | tempbx |= 0x2000; |
| 5318 | tempax &= 0x00FF; |
| 5319 | } |
| 5320 | } |
| 5321 | |
| 5322 | tempcx = 0x0101; |
| 5323 | |
| 5324 | if (pVBInfo->VBInfo & SetCRT2ToTV) { /*301b*/ |
| 5325 | if (pVBInfo->VGAHDE >= 1024) { |
| 5326 | tempcx = 0x1920; |
| 5327 | if (pVBInfo->VGAHDE >= 1280) { |
| 5328 | tempcx = 0x1420; |
| 5329 | tempbx = tempbx & 0xDFFF; |
| 5330 | } |
| 5331 | } |
| 5332 | } |
| 5333 | |
| 5334 | if (!(tempbx & 0x2000)) { |
| 5335 | if (modeflag & HalfDCLK) |
| 5336 | tempcx = (tempcx & 0xFF00) | ((tempcx & 0x00FF) << 1); |
| 5337 | |
| 5338 | push1 = tempbx; |
| 5339 | tempeax = pVBInfo->VGAHDE; |
| 5340 | tempebx = (tempcx & 0xFF00) >> 8; |
| 5341 | longtemp = tempeax * tempebx; |
| 5342 | tempecx = tempcx & 0x00FF; |
| 5343 | longtemp = longtemp / tempecx; |
| 5344 | |
| 5345 | /* 301b */ |
| 5346 | tempecx = 8 * 1024; |
| 5347 | |
| 5348 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 5349 | | VB_XGI302LV | VB_XGI301C)) { |
| 5350 | tempecx = tempecx * 8; |
| 5351 | } |
| 5352 | |
| 5353 | longtemp = longtemp * tempecx; |
| 5354 | tempecx = pVBInfo->HDE; |
| 5355 | temp2 = longtemp % tempecx; |
| 5356 | tempeax = longtemp / tempecx; |
| 5357 | if (temp2 != 0) |
| 5358 | tempeax += 1; |
| 5359 | |
| 5360 | tempax = (unsigned short) tempeax; |
| 5361 | |
| 5362 | /* 301b */ |
| 5363 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 5364 | | VB_XGI302LV | VB_XGI301C)) { |
| 5365 | tempcx = ((tempax & 0xFF00) >> 5) >> 8; |
| 5366 | } |
| 5367 | /* end 301b */ |
| 5368 | |
| 5369 | tempbx = push1; |
| 5370 | tempbx = (unsigned short) (((tempeax & 0x0000FF00) & 0x1F00) |
| 5371 | | (tempbx & 0x00FF)); |
| 5372 | tempax = (unsigned short) (((tempeax & 0x000000FF) << 8) |
| 5373 | | (tempax & 0x00FF)); |
| 5374 | temp = (tempax & 0xFF00) >> 8; |
| 5375 | } else { |
| 5376 | temp = (tempax & 0x00FF) >> 8; |
| 5377 | } |
| 5378 | |
| 5379 | XGINew_SetReg1(pVBInfo->Part2Port, 0x44, temp); |
| 5380 | temp = (tempbx & 0xFF00) >> 8; |
| 5381 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x45, ~0x03F, temp); |
| 5382 | temp = tempcx & 0x00FF; |
| 5383 | |
| 5384 | if (tempbx & 0x2000) |
| 5385 | temp = 0; |
| 5386 | |
| 5387 | if (!(pVBInfo->VBInfo & SetCRT2ToLCD)) |
| 5388 | temp |= 0x18; |
| 5389 | |
| 5390 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x46, ~0x1F, temp); |
| 5391 | if (pVBInfo->TVInfo & SetPALTV) { |
| 5392 | tempbx = 0x0382; |
| 5393 | tempcx = 0x007e; |
| 5394 | } else { |
| 5395 | tempbx = 0x0369; |
| 5396 | tempcx = 0x0061; |
| 5397 | } |
| 5398 | |
| 5399 | temp = tempbx & 0x00FF; |
| 5400 | XGINew_SetReg1(pVBInfo->Part2Port, 0x4b, temp); |
| 5401 | temp = tempcx & 0x00FF; |
| 5402 | XGINew_SetReg1(pVBInfo->Part2Port, 0x4c, temp); |
| 5403 | |
| 5404 | temp = ((tempcx & 0xFF00) >> 8) & 0x03; |
| 5405 | temp = temp << 2; |
| 5406 | temp |= ((tempbx & 0xFF00) >> 8) & 0x03; |
| 5407 | |
| 5408 | if (pVBInfo->VBInfo & SetCRT2ToYPbPr) { |
| 5409 | temp |= 0x10; |
| 5410 | |
| 5411 | if (pVBInfo->TVInfo & SetYPbPrMode525p) |
| 5412 | temp |= 0x20; |
| 5413 | |
| 5414 | if (pVBInfo->TVInfo & SetYPbPrMode750p) |
| 5415 | temp |= 0x60; |
| 5416 | } |
| 5417 | |
| 5418 | XGINew_SetReg1(pVBInfo->Part2Port, 0x4d, temp); |
| 5419 | temp = XGINew_GetReg1(pVBInfo->Part2Port, 0x43); /* 301b change */ |
| 5420 | XGINew_SetReg1(pVBInfo->Part2Port, 0x43, (unsigned short) (temp - 3)); |
| 5421 | |
| 5422 | if (!(pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p))) { |
| 5423 | if (pVBInfo->TVInfo & NTSC1024x768) { |
| 5424 | TimingPoint = XGI_NTSC1024AdjTime; |
| 5425 | for (i = 0x1c, j = 0; i <= 0x30; i++, j++) { |
| 5426 | XGINew_SetReg1(pVBInfo->Part2Port, i, |
| 5427 | TimingPoint[j]); |
| 5428 | } |
| 5429 | XGINew_SetReg1(pVBInfo->Part2Port, 0x43, 0x72); |
| 5430 | } |
| 5431 | } |
| 5432 | |
| 5433 | /* [ycchen] 01/14/03 Modify for 301C PALM Support */ |
| 5434 | if (pVBInfo->VBType & VB_XGI301C) { |
| 5435 | if (pVBInfo->TVInfo & SetPALMTV) |
| 5436 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x4E, ~0x08, |
| 5437 | 0x08); /* PALM Mode */ |
| 5438 | } |
| 5439 | |
| 5440 | if (pVBInfo->TVInfo & SetPALMTV) { |
| 5441 | tempax = (unsigned char) XGINew_GetReg1(pVBInfo->Part2Port, |
| 5442 | 0x01); |
| 5443 | tempax--; |
| 5444 | XGINew_SetRegAND(pVBInfo->Part2Port, 0x01, tempax); |
| 5445 | |
| 5446 | /* if ( !( pVBInfo->VBType & VB_XGI301C ) ) */ |
| 5447 | XGINew_SetRegAND(pVBInfo->Part2Port, 0x00, 0xEF); |
| 5448 | } |
| 5449 | |
| 5450 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { |
| 5451 | if (!(pVBInfo->VBInfo & SetInSlaveMode)) |
| 5452 | XGINew_SetReg1(pVBInfo->Part2Port, 0x0B, 0x00); |
| 5453 | } |
| 5454 | |
| 5455 | if (pVBInfo->VBInfo & SetCRT2ToTV) |
| 5456 | return; |
| 5457 | } |
| 5458 | |
| 5459 | void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 5460 | struct xgi_hw_device_info *HwDeviceExtension, |
| 5461 | unsigned short RefreshRateTableIndex, |
| 5462 | struct vb_device_info *pVBInfo) |
| 5463 | { |
| 5464 | unsigned short push1, push2, pushbx, tempax, tempbx, tempcx, temp, |
| 5465 | tempah, tempbh, tempch, resinfo, modeflag, CRT1Index; |
| 5466 | |
| 5467 | struct XGI_LCDDesStruct *LCDBDesPtr = NULL; |
| 5468 | |
| 5469 | if (ModeNo <= 0x13) { |
| 5470 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 5471 | resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; |
| 5472 | } else { |
| 5473 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
| 5474 | resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; |
| 5475 | CRT1Index |
| 5476 | = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; |
| 5477 | CRT1Index &= IndexMask; |
| 5478 | } |
| 5479 | |
| 5480 | if (!(pVBInfo->VBInfo & SetCRT2ToLCD)) |
| 5481 | return; |
| 5482 | |
| 5483 | tempbx = pVBInfo->HDE; /* RHACTE=HDE-1 */ |
| 5484 | |
| 5485 | if (XGI_IsLCDDualLink(pVBInfo)) |
| 5486 | tempbx = tempbx >> 1; |
| 5487 | |
| 5488 | tempbx -= 1; |
| 5489 | temp = tempbx & 0x00FF; |
| 5490 | XGINew_SetReg1(pVBInfo->Part2Port, 0x2C, temp); |
| 5491 | temp = (tempbx & 0xFF00) >> 8; |
| 5492 | temp = temp << 4; |
| 5493 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x2B, 0x0F, temp); |
| 5494 | temp = 0x01; |
| 5495 | |
| 5496 | if (pVBInfo->LCDResInfo == Panel1280x1024) { |
| 5497 | if (pVBInfo->ModeType == ModeEGA) { |
| 5498 | if (pVBInfo->VGAHDE >= 1024) { |
| 5499 | temp = 0x02; |
| 5500 | if (pVBInfo->LCDInfo & LCDVESATiming) |
| 5501 | temp = 0x01; |
| 5502 | } |
| 5503 | } |
| 5504 | } |
| 5505 | |
| 5506 | XGINew_SetReg1(pVBInfo->Part2Port, 0x0B, temp); |
| 5507 | tempbx = pVBInfo->VDE; /* RTVACTEO=(VDE-1)&0xFF */ |
| 5508 | push1 = tempbx; |
| 5509 | tempbx--; |
| 5510 | temp = tempbx & 0x00FF; |
| 5511 | XGINew_SetReg1(pVBInfo->Part2Port, 0x03, temp); |
| 5512 | temp = ((tempbx & 0xFF00) >> 8) & 0x07; |
| 5513 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0C, ~0x07, temp); |
| 5514 | |
| 5515 | tempcx = pVBInfo->VT - 1; |
| 5516 | push2 = tempcx + 1; |
| 5517 | temp = tempcx & 0x00FF; /* RVTVT=VT-1 */ |
| 5518 | XGINew_SetReg1(pVBInfo->Part2Port, 0x19, temp); |
| 5519 | temp = (tempcx & 0xFF00) >> 8; |
| 5520 | temp = temp << 5; |
| 5521 | XGINew_SetReg1(pVBInfo->Part2Port, 0x1A, temp); |
| 5522 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x09, 0xF0, 0x00); |
| 5523 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0A, 0xF0, 0x00); |
| 5524 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x17, 0xFB, 0x00); |
| 5525 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x18, 0xDF, 0x00); |
| 5526 | |
| 5527 | /* Customized LCDB Des no add */ |
| 5528 | tempbx = 5; |
| 5529 | LCDBDesPtr = (struct XGI_LCDDesStruct *) XGI_GetLcdPtr(tempbx, ModeNo, |
| 5530 | ModeIdIndex, RefreshRateTableIndex, pVBInfo); |
| 5531 | tempah = pVBInfo->LCDResInfo; |
| 5532 | tempah &= PanelResInfo; |
| 5533 | |
| 5534 | if ((tempah == Panel1024x768) || (tempah == Panel1024x768x75)) { |
| 5535 | tempbx = 1024; |
| 5536 | tempcx = 768; |
| 5537 | } else if ((tempah == Panel1280x1024) || (tempah == Panel1280x1024x75)) { |
| 5538 | tempbx = 1280; |
| 5539 | tempcx = 1024; |
| 5540 | } else if (tempah == Panel1400x1050) { |
| 5541 | tempbx = 1400; |
| 5542 | tempcx = 1050; |
| 5543 | } else { |
| 5544 | tempbx = 1600; |
| 5545 | tempcx = 1200; |
| 5546 | } |
| 5547 | |
| 5548 | if (pVBInfo->LCDInfo & EnableScalingLCD) { |
| 5549 | tempbx = pVBInfo->HDE; |
| 5550 | tempcx = pVBInfo->VDE; |
| 5551 | } |
| 5552 | |
| 5553 | pushbx = tempbx; |
| 5554 | tempax = pVBInfo->VT; |
| 5555 | pVBInfo->LCDHDES = LCDBDesPtr->LCDHDES; |
| 5556 | pVBInfo->LCDHRS = LCDBDesPtr->LCDHRS; |
| 5557 | pVBInfo->LCDVDES = LCDBDesPtr->LCDVDES; |
| 5558 | pVBInfo->LCDVRS = LCDBDesPtr->LCDVRS; |
| 5559 | tempbx = pVBInfo->LCDVDES; |
| 5560 | tempcx += tempbx; |
| 5561 | |
| 5562 | if (tempcx >= tempax) |
| 5563 | tempcx -= tempax; /* lcdvdes */ |
| 5564 | |
| 5565 | temp = tempbx & 0x00FF; /* RVEQ1EQ=lcdvdes */ |
| 5566 | XGINew_SetReg1(pVBInfo->Part2Port, 0x05, temp); |
| 5567 | temp = tempcx & 0x00FF; |
| 5568 | XGINew_SetReg1(pVBInfo->Part2Port, 0x06, temp); |
| 5569 | tempch = ((tempcx & 0xFF00) >> 8) & 0x07; |
| 5570 | tempbh = ((tempbx & 0xFF00) >> 8) & 0x07; |
| 5571 | tempah = tempch; |
| 5572 | tempah = tempah << 3; |
| 5573 | tempah |= tempbh; |
| 5574 | XGINew_SetReg1(pVBInfo->Part2Port, 0x02, tempah); |
| 5575 | |
| 5576 | /* getlcdsync() */ |
| 5577 | XGI_GetLCDSync(&tempax, &tempbx, pVBInfo); |
| 5578 | tempcx = tempbx; |
| 5579 | tempax = pVBInfo->VT; |
| 5580 | tempbx = pVBInfo->LCDVRS; |
| 5581 | |
| 5582 | /* if (SetLCD_Info & EnableScalingLCD) */ |
| 5583 | tempcx += tempbx; |
| 5584 | if (tempcx >= tempax) |
| 5585 | tempcx -= tempax; |
| 5586 | |
| 5587 | temp = tempbx & 0x00FF; /* RTVACTEE=lcdvrs */ |
| 5588 | XGINew_SetReg1(pVBInfo->Part2Port, 0x04, temp); |
| 5589 | temp = (tempbx & 0xFF00) >> 8; |
| 5590 | temp = temp << 4; |
| 5591 | temp |= (tempcx & 0x000F); |
| 5592 | XGINew_SetReg1(pVBInfo->Part2Port, 0x01, temp); |
| 5593 | tempcx = pushbx; |
| 5594 | tempax = pVBInfo->HT; |
| 5595 | tempbx = pVBInfo->LCDHDES; |
| 5596 | tempbx &= 0x0FFF; |
| 5597 | |
| 5598 | if (XGI_IsLCDDualLink(pVBInfo)) { |
| 5599 | tempax = tempax >> 1; |
| 5600 | tempbx = tempbx >> 1; |
| 5601 | tempcx = tempcx >> 1; |
| 5602 | } |
| 5603 | |
| 5604 | if (pVBInfo->VBType & VB_XGI302LV) |
| 5605 | tempbx += 1; |
| 5606 | |
| 5607 | if (pVBInfo->VBType & VB_XGI301C) /* tap4 */ |
| 5608 | tempbx += 1; |
| 5609 | |
| 5610 | tempcx += tempbx; |
| 5611 | |
| 5612 | if (tempcx >= tempax) |
| 5613 | tempcx -= tempax; |
| 5614 | |
| 5615 | temp = tempbx & 0x00FF; |
| 5616 | XGINew_SetReg1(pVBInfo->Part2Port, 0x1F, temp); /* RHBLKE=lcdhdes */ |
| 5617 | temp = ((tempbx & 0xFF00) >> 8) << 4; |
| 5618 | XGINew_SetReg1(pVBInfo->Part2Port, 0x20, temp); |
| 5619 | temp = tempcx & 0x00FF; |
| 5620 | XGINew_SetReg1(pVBInfo->Part2Port, 0x23, temp); /* RHEQPLE=lcdhdee */ |
| 5621 | temp = (tempcx & 0xFF00) >> 8; |
| 5622 | XGINew_SetReg1(pVBInfo->Part2Port, 0x25, temp); |
| 5623 | |
| 5624 | /* getlcdsync() */ |
| 5625 | XGI_GetLCDSync(&tempax, &tempbx, pVBInfo); |
| 5626 | tempcx = tempax; |
| 5627 | tempax = pVBInfo->HT; |
| 5628 | tempbx = pVBInfo->LCDHRS; |
| 5629 | /* if ( SetLCD_Info & EnableScalingLCD) */ |
| 5630 | if (XGI_IsLCDDualLink(pVBInfo)) { |
| 5631 | tempax = tempax >> 1; |
| 5632 | tempbx = tempbx >> 1; |
| 5633 | tempcx = tempcx >> 1; |
| 5634 | } |
| 5635 | |
| 5636 | if (pVBInfo->VBType & VB_XGI302LV) |
| 5637 | tempbx += 1; |
| 5638 | |
| 5639 | tempcx += tempbx; |
| 5640 | |
| 5641 | if (tempcx >= tempax) |
| 5642 | tempcx -= tempax; |
| 5643 | |
| 5644 | temp = tempbx & 0x00FF; /* RHBURSTS=lcdhrs */ |
| 5645 | XGINew_SetReg1(pVBInfo->Part2Port, 0x1C, temp); |
| 5646 | |
| 5647 | temp = (tempbx & 0xFF00) >> 8; |
| 5648 | temp = temp << 4; |
| 5649 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1D, ~0x0F0, temp); |
| 5650 | temp = tempcx & 0x00FF; /* RHSYEXP2S=lcdhre */ |
| 5651 | XGINew_SetReg1(pVBInfo->Part2Port, 0x21, temp); |
| 5652 | |
| 5653 | if (!(pVBInfo->LCDInfo & LCDVESATiming)) { |
| 5654 | if (pVBInfo->VGAVDE == 525) { |
| 5655 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B |
| 5656 | | VB_XGI301LV | VB_XGI302LV |
| 5657 | | VB_XGI301C)) { |
| 5658 | temp = 0xC6; |
| 5659 | } else |
| 5660 | temp = 0xC4; |
| 5661 | |
| 5662 | XGINew_SetReg1(pVBInfo->Part2Port, 0x2f, temp); |
| 5663 | XGINew_SetReg1(pVBInfo->Part2Port, 0x30, 0xB3); |
| 5664 | } |
| 5665 | |
| 5666 | if (pVBInfo->VGAVDE == 420) { |
| 5667 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B |
| 5668 | | VB_XGI301LV | VB_XGI302LV |
| 5669 | | VB_XGI301C)) { |
| 5670 | temp = 0x4F; |
| 5671 | } else |
| 5672 | temp = 0x4E; |
| 5673 | XGINew_SetReg1(pVBInfo->Part2Port, 0x2f, temp); |
| 5674 | } |
| 5675 | } |
| 5676 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5677 | |
| 5678 | /* --------------------------------------------------------------------- */ |
| 5679 | /* Function : XGI_GetTap4Ptr */ |
| 5680 | /* Input : */ |
| 5681 | /* Output : di -> Tap4 Reg. Setting Pointer */ |
| 5682 | /* Description : */ |
| 5683 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 5684 | struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5685 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5686 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5687 | unsigned short tempax, tempbx, i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5688 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5689 | struct XGI301C_Tap4TimingStruct *Tap4TimingPtr; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5690 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5691 | if (tempcx == 0) { |
| 5692 | tempax = pVBInfo->VGAHDE; |
| 5693 | tempbx = pVBInfo->HDE; |
| 5694 | } else { |
| 5695 | tempax = pVBInfo->VGAVDE; |
| 5696 | tempbx = pVBInfo->VDE; |
| 5697 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5698 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5699 | if (tempax < tempbx) |
| 5700 | return &EnlargeTap4Timing[0]; |
| 5701 | else if (tempax == tempbx) |
| 5702 | return &NoScaleTap4Timing[0]; /* 1:1 */ |
| 5703 | else |
| 5704 | Tap4TimingPtr = NTSCTap4Timing; /* NTSC */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5705 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5706 | if (pVBInfo->TVInfo & SetPALTV) |
| 5707 | Tap4TimingPtr = PALTap4Timing; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5708 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5709 | if (pVBInfo->VBInfo & SetCRT2ToYPbPr) { |
| 5710 | if (pVBInfo->TVInfo & SetYPbPrMode525i) |
| 5711 | Tap4TimingPtr = YPbPr525iTap4Timing; |
| 5712 | if (pVBInfo->TVInfo & SetYPbPrMode525p) |
| 5713 | Tap4TimingPtr = YPbPr525pTap4Timing; |
| 5714 | if (pVBInfo->TVInfo & SetYPbPrMode750p) |
| 5715 | Tap4TimingPtr = YPbPr750pTap4Timing; |
| 5716 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5717 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5718 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) |
| 5719 | Tap4TimingPtr = HiTVTap4Timing; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5720 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5721 | i = 0; |
| 5722 | while (Tap4TimingPtr[i].DE != 0xFFFF) { |
| 5723 | if (Tap4TimingPtr[i].DE == tempax) |
| 5724 | break; |
| 5725 | i++; |
| 5726 | } |
| 5727 | return &Tap4TimingPtr[i]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5728 | } |
| 5729 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 5730 | void XGI_SetTap4Regs(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5731 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5732 | unsigned short i, j; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5733 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5734 | struct XGI301C_Tap4TimingStruct *Tap4TimingPtr; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5735 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5736 | if (!(pVBInfo->VBType & VB_XGI301C)) |
| 5737 | return; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5738 | |
| 5739 | #ifndef Tap4 |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5740 | XGINew_SetRegAND(pVBInfo->Part2Port, 0x4E, 0xEB); /* Disable Tap4 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5741 | #else /* Tap4 Setting */ |
| 5742 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5743 | Tap4TimingPtr = XGI_GetTap4Ptr(0, pVBInfo); /* Set Horizontal Scaling */ |
| 5744 | for (i = 0x80, j = 0; i <= 0xBF; i++, j++) |
| 5745 | XGINew_SetReg1(pVBInfo->Part2Port, i, Tap4TimingPtr->Reg[j]); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5746 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5747 | if ((pVBInfo->VBInfo & SetCRT2ToTV) && (!(pVBInfo->VBInfo & SetCRT2ToHiVisionTV))) { |
| 5748 | Tap4TimingPtr = XGI_GetTap4Ptr(1, pVBInfo); /* Set Vertical Scaling */ |
| 5749 | for (i = 0xC0, j = 0; i < 0xFF; i++, j++) |
| 5750 | XGINew_SetReg1(pVBInfo->Part2Port, i, Tap4TimingPtr->Reg[j]); |
| 5751 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5752 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5753 | if ((pVBInfo->VBInfo & SetCRT2ToTV) && (!(pVBInfo->VBInfo & SetCRT2ToHiVisionTV))) |
| 5754 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x4E, ~0x14, 0x04); /* Enable V.Scaling */ |
| 5755 | else |
| 5756 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x4E, ~0x14, 0x10); /* Enable H.Scaling */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5757 | #endif |
| 5758 | } |
| 5759 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5760 | void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 5761 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5762 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5763 | unsigned short i; |
| 5764 | unsigned char *tempdi; |
| 5765 | unsigned short modeflag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5766 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5767 | if (ModeNo <= 0x13) |
| 5768 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 5769 | else |
| 5770 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5771 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5772 | XGINew_SetReg1(pVBInfo->Part3Port, 0x00, 0x00); |
| 5773 | if (pVBInfo->TVInfo & SetPALTV) { |
| 5774 | XGINew_SetReg1(pVBInfo->Part3Port, 0x13, 0xFA); |
| 5775 | XGINew_SetReg1(pVBInfo->Part3Port, 0x14, 0xC8); |
| 5776 | } else { |
| 5777 | XGINew_SetReg1(pVBInfo->Part3Port, 0x13, 0xF5); |
| 5778 | XGINew_SetReg1(pVBInfo->Part3Port, 0x14, 0xB7); |
| 5779 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5780 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5781 | if (!(pVBInfo->VBInfo & SetCRT2ToTV)) |
| 5782 | return; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5783 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5784 | if (pVBInfo->TVInfo & SetPALMTV) { |
| 5785 | XGINew_SetReg1(pVBInfo->Part3Port, 0x13, 0xFA); |
| 5786 | XGINew_SetReg1(pVBInfo->Part3Port, 0x14, 0xC8); |
| 5787 | XGINew_SetReg1(pVBInfo->Part3Port, 0x3D, 0xA8); |
| 5788 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5789 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5790 | if ((pVBInfo->VBInfo & SetCRT2ToHiVisionTV) || (pVBInfo->VBInfo |
| 5791 | & SetCRT2ToYPbPr)) { |
| 5792 | if (pVBInfo->TVInfo & SetYPbPrMode525i) |
| 5793 | return; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5794 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5795 | tempdi = pVBInfo->HiTVGroup3Data; |
| 5796 | if (pVBInfo->SetFlag & TVSimuMode) { |
| 5797 | tempdi = pVBInfo->HiTVGroup3Simu; |
| 5798 | if (!(modeflag & Charx8Dot)) |
| 5799 | tempdi = pVBInfo->HiTVGroup3Text; |
| 5800 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5801 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5802 | if (pVBInfo->TVInfo & SetYPbPrMode525p) |
| 5803 | tempdi = pVBInfo->Ren525pGroup3; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5804 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5805 | if (pVBInfo->TVInfo & SetYPbPrMode750p) |
| 5806 | tempdi = pVBInfo->Ren750pGroup3; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5807 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5808 | for (i = 0; i <= 0x3E; i++) |
| 5809 | XGINew_SetReg1(pVBInfo->Part3Port, i, tempdi[i]); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5810 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5811 | if (pVBInfo->VBType & VB_XGI301C) { /* Marcovision */ |
| 5812 | if (pVBInfo->TVInfo & SetYPbPrMode525p) |
| 5813 | XGINew_SetReg1(pVBInfo->Part3Port, 0x28, 0x3f); |
| 5814 | } |
| 5815 | } |
| 5816 | return; |
| 5817 | } /* {end of XGI_SetGroup3} */ |
| 5818 | |
| 5819 | void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 5820 | unsigned short RefreshRateTableIndex, |
| 5821 | struct xgi_hw_device_info *HwDeviceExtension, |
| 5822 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5823 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5824 | unsigned short tempax, tempcx, tempbx, modeflag, temp, temp2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5825 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5826 | unsigned long tempebx, tempeax, templong; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5827 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5828 | if (ModeNo <= 0x13) |
| 5829 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 5830 | else |
| 5831 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5832 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5833 | temp = pVBInfo->RVBHCFACT; |
| 5834 | XGINew_SetReg1(pVBInfo->Part4Port, 0x13, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5835 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5836 | tempbx = pVBInfo->RVBHCMAX; |
| 5837 | temp = tempbx & 0x00FF; |
| 5838 | XGINew_SetReg1(pVBInfo->Part4Port, 0x14, temp); |
| 5839 | temp2 = ((tempbx & 0xFF00) >> 8) << 7; |
| 5840 | tempcx = pVBInfo->VGAHT - 1; |
| 5841 | temp = tempcx & 0x00FF; |
| 5842 | XGINew_SetReg1(pVBInfo->Part4Port, 0x16, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5843 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5844 | temp = ((tempcx & 0xFF00) >> 8) << 3; |
| 5845 | temp2 |= temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5846 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5847 | tempcx = pVBInfo->VGAVT - 1; |
| 5848 | if (!(pVBInfo->VBInfo & SetCRT2ToTV)) |
| 5849 | tempcx -= 5; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5850 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5851 | temp = tempcx & 0x00FF; |
| 5852 | XGINew_SetReg1(pVBInfo->Part4Port, 0x17, temp); |
| 5853 | temp = temp2 | ((tempcx & 0xFF00) >> 8); |
| 5854 | XGINew_SetReg1(pVBInfo->Part4Port, 0x15, temp); |
| 5855 | XGINew_SetRegOR(pVBInfo->Part4Port, 0x0D, 0x08); |
| 5856 | tempcx = pVBInfo->VBInfo; |
| 5857 | tempbx = pVBInfo->VGAHDE; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5858 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5859 | if (modeflag & HalfDCLK) |
| 5860 | tempbx = tempbx >> 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5861 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5862 | if (XGI_IsLCDDualLink(pVBInfo)) |
| 5863 | tempbx = tempbx >> 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5864 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5865 | if (tempcx & SetCRT2ToHiVisionTV) { |
| 5866 | temp = 0; |
| 5867 | if (tempbx <= 1024) |
| 5868 | temp = 0xA0; |
| 5869 | if (tempbx == 1280) |
| 5870 | temp = 0xC0; |
| 5871 | } else if (tempcx & SetCRT2ToTV) { |
| 5872 | temp = 0xA0; |
| 5873 | if (tempbx <= 800) |
| 5874 | temp = 0x80; |
| 5875 | } else { |
| 5876 | temp = 0x80; |
| 5877 | if (pVBInfo->VBInfo & SetCRT2ToLCD) { |
| 5878 | temp = 0; |
| 5879 | if (tempbx > 800) |
| 5880 | temp = 0x60; |
| 5881 | } |
| 5882 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5883 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5884 | if (pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p)) { |
| 5885 | temp = 0x00; |
| 5886 | if (pVBInfo->VGAHDE == 1280) |
| 5887 | temp = 0x40; |
| 5888 | if (pVBInfo->VGAHDE == 1024) |
| 5889 | temp = 0x20; |
| 5890 | } |
| 5891 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0E, ~0xEF, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5892 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5893 | tempebx = pVBInfo->VDE; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5894 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5895 | if (tempcx & SetCRT2ToHiVisionTV) { |
| 5896 | if (!(temp & 0xE000)) |
| 5897 | tempbx = tempbx >> 1; |
| 5898 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5899 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5900 | tempcx = pVBInfo->RVBHRS; |
| 5901 | temp = tempcx & 0x00FF; |
| 5902 | XGINew_SetReg1(pVBInfo->Part4Port, 0x18, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5903 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5904 | tempeax = pVBInfo->VGAVDE; |
| 5905 | tempcx |= 0x04000; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5906 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5907 | if (tempeax <= tempebx) { |
| 5908 | tempcx = (tempcx & (~0x4000)); |
| 5909 | tempeax = pVBInfo->VGAVDE; |
| 5910 | } else { |
| 5911 | tempeax -= tempebx; |
| 5912 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5913 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5914 | templong = (tempeax * 256 * 1024) % tempebx; |
| 5915 | tempeax = (tempeax * 256 * 1024) / tempebx; |
| 5916 | tempebx = tempeax; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5917 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5918 | if (templong != 0) |
| 5919 | tempebx++; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5920 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5921 | temp = (unsigned short) (tempebx & 0x000000FF); |
| 5922 | XGINew_SetReg1(pVBInfo->Part4Port, 0x1B, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5923 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5924 | temp = (unsigned short) ((tempebx & 0x0000FF00) >> 8); |
| 5925 | XGINew_SetReg1(pVBInfo->Part4Port, 0x1A, temp); |
| 5926 | tempbx = (unsigned short) (tempebx >> 16); |
| 5927 | temp = tempbx & 0x00FF; |
| 5928 | temp = temp << 4; |
| 5929 | temp |= ((tempcx & 0xFF00) >> 8); |
| 5930 | XGINew_SetReg1(pVBInfo->Part4Port, 0x19, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5931 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5932 | /* 301b */ |
| 5933 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 5934 | | VB_XGI302LV | VB_XGI301C)) { |
| 5935 | temp = 0x0028; |
| 5936 | XGINew_SetReg1(pVBInfo->Part4Port, 0x1C, temp); |
| 5937 | tempax = pVBInfo->VGAHDE; |
| 5938 | if (modeflag & HalfDCLK) |
| 5939 | tempax = tempax >> 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5940 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5941 | if (XGI_IsLCDDualLink(pVBInfo)) |
| 5942 | tempax = tempax >> 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5943 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5944 | /* if((pVBInfo->VBInfo&(SetCRT2ToLCD))||((pVBInfo->TVInfo&SetYPbPrMode525p)||(pVBInfo->TVInfo&SetYPbPrMode750p))) { */ |
| 5945 | if (pVBInfo->VBInfo & SetCRT2ToLCD) { |
| 5946 | if (tempax > 800) |
| 5947 | tempax -= 800; |
| 5948 | } else { |
| 5949 | if (pVBInfo->VGAHDE > 800) { |
| 5950 | if (pVBInfo->VGAHDE == 1024) |
| 5951 | tempax = (tempax * 25 / 32) - 1; |
| 5952 | else |
| 5953 | tempax = (tempax * 20 / 32) - 1; |
| 5954 | } |
| 5955 | } |
| 5956 | tempax -= 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5957 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5958 | /* |
| 5959 | if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToHiVisionTV)) { |
| 5960 | if (pVBInfo->VBType & VB_XGI301LV) { |
| 5961 | if (!(pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p | SetYPbPrMode1080i))) { |
| 5962 | if (pVBInfo->VGAHDE > 800) { |
| 5963 | if (pVBInfo->VGAHDE == 1024) |
| 5964 | tempax = (tempax * 25 / 32) - 1; |
| 5965 | else |
| 5966 | tempax = (tempax * 20 / 32) - 1; |
| 5967 | } |
| 5968 | } |
| 5969 | } else { |
| 5970 | if (pVBInfo->VGAHDE > 800) { |
| 5971 | if (pVBInfo->VGAHDE == 1024) |
| 5972 | tempax = (tempax * 25 / 32) - 1; |
| 5973 | else |
| 5974 | tempax = (tempax * 20 / 32) - 1; |
| 5975 | } |
| 5976 | } |
| 5977 | } |
| 5978 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5979 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5980 | temp = (tempax & 0xFF00) >> 8; |
| 5981 | temp = ((temp & 0x0003) << 4); |
| 5982 | XGINew_SetReg1(pVBInfo->Part4Port, 0x1E, temp); |
| 5983 | temp = (tempax & 0x00FF); |
| 5984 | XGINew_SetReg1(pVBInfo->Part4Port, 0x1D, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5985 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5986 | if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToHiVisionTV)) { |
| 5987 | if (pVBInfo->VGAHDE > 800) |
| 5988 | XGINew_SetRegOR(pVBInfo->Part4Port, 0x1E, 0x08); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5989 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5990 | } |
| 5991 | temp = 0x0036; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 5992 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 5993 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 5994 | if (!(pVBInfo->TVInfo & (NTSC1024x768 |
| 5995 | | SetYPbPrMode525p | SetYPbPrMode750p |
| 5996 | | SetYPbPrMode1080i))) { |
| 5997 | temp |= 0x0001; |
| 5998 | if ((pVBInfo->VBInfo & SetInSlaveMode) |
| 5999 | && (!(pVBInfo->TVInfo |
| 6000 | & TVSimuMode))) |
| 6001 | temp &= (~0x0001); |
| 6002 | } |
| 6003 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6004 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6005 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x1F, 0x00C0, temp); |
| 6006 | tempbx = pVBInfo->HT; |
| 6007 | if (XGI_IsLCDDualLink(pVBInfo)) |
| 6008 | tempbx = tempbx >> 1; |
| 6009 | tempbx = (tempbx >> 1) - 2; |
| 6010 | temp = ((tempbx & 0x0700) >> 8) << 3; |
| 6011 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x21, 0x00C0, temp); |
| 6012 | temp = tempbx & 0x00FF; |
| 6013 | XGINew_SetReg1(pVBInfo->Part4Port, 0x22, temp); |
| 6014 | } |
| 6015 | /* end 301b */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6016 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6017 | if (pVBInfo->ISXPDOS == 0) |
| 6018 | XGI_SetCRT2VCLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 6019 | pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6020 | } |
| 6021 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6022 | void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 6023 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6024 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6025 | unsigned short Pindex, Pdata; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6026 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6027 | Pindex = pVBInfo->Part5Port; |
| 6028 | Pdata = pVBInfo->Part5Port + 1; |
| 6029 | if (pVBInfo->ModeType == ModeVGA) { |
| 6030 | if (!(pVBInfo->VBInfo & (SetInSlaveMode | LoadDACFlag |
| 6031 | | CRT2DisplayFlag))) { |
| 6032 | XGINew_EnableCRT2(pVBInfo); |
| 6033 | /* LoadDAC2(pVBInfo->Part5Port, ModeNo, ModeIdIndex); */ |
| 6034 | } |
| 6035 | } |
| 6036 | return; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6037 | } |
| 6038 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6039 | void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo, |
| 6040 | unsigned short ModeIdIndex, |
| 6041 | unsigned short RefreshRateTableIndex, |
| 6042 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6043 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6044 | unsigned short i, tempdx, tempcx, tempbx, tempal, modeflag, table; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6045 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6046 | struct XGI330_LCDDataTablStruct *tempdi = NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6047 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6048 | tempbx = BX; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6049 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6050 | if (ModeNo <= 0x13) { |
| 6051 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 6052 | tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; |
| 6053 | } else { |
| 6054 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 6055 | tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 6056 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6057 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6058 | tempal = tempal & 0x0f; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6059 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6060 | if (tempbx <= 1) { /* ExpLink */ |
| 6061 | if (ModeNo <= 0x13) { |
| 6062 | tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; /* find no Ext_CRT2CRTC2 */ |
| 6063 | } else { |
| 6064 | tempal |
| 6065 | = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 6066 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6067 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6068 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) { |
| 6069 | if (ModeNo <= 0x13) |
| 6070 | tempal |
| 6071 | = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC2; |
| 6072 | else |
| 6073 | tempal |
| 6074 | = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC2; |
| 6075 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6076 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6077 | if (tempbx & 0x01) |
| 6078 | tempal = (tempal >> 4); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6079 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6080 | tempal = (tempal & 0x0f); |
| 6081 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6082 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6083 | tempcx = LCDLenList[tempbx]; /* mov cl,byte ptr cs:LCDLenList[bx] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6084 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6085 | if (pVBInfo->LCDInfo & EnableScalingLCD) { /* ScaleLCD */ |
| 6086 | if ((tempbx == 5) || (tempbx) == 7) |
| 6087 | tempcx = LCDDesDataLen2; |
| 6088 | else if ((tempbx == 3) || (tempbx == 8)) |
| 6089 | tempcx = LVDSDesDataLen2; |
| 6090 | } |
| 6091 | /* mov di, word ptr cs:LCDDataList[bx] */ |
| 6092 | /* tempdi = pVideoMemory[LCDDataList + tempbx * 2] | (pVideoMemory[LCDDataList + tempbx * 2 + 1] << 8); */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6093 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6094 | switch (tempbx) { |
| 6095 | case 0: |
| 6096 | tempdi = XGI_EPLLCDCRT1Ptr_H; |
| 6097 | break; |
| 6098 | case 1: |
| 6099 | tempdi = XGI_EPLLCDCRT1Ptr_V; |
| 6100 | break; |
| 6101 | case 2: |
| 6102 | tempdi = XGI_EPLLCDDataPtr; |
| 6103 | break; |
| 6104 | case 3: |
| 6105 | tempdi = XGI_EPLLCDDesDataPtr; |
| 6106 | break; |
| 6107 | case 4: |
| 6108 | tempdi = XGI_LCDDataTable; |
| 6109 | break; |
| 6110 | case 5: |
| 6111 | tempdi = XGI_LCDDesDataTable; |
| 6112 | break; |
| 6113 | case 6: |
| 6114 | tempdi = XGI_EPLCHLCDRegPtr; |
| 6115 | break; |
| 6116 | case 7: |
| 6117 | case 8: |
| 6118 | case 9: |
| 6119 | tempdi = NULL; |
| 6120 | break; |
| 6121 | default: |
| 6122 | break; |
| 6123 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6124 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6125 | if (tempdi == NULL) /* OEMUtil */ |
| 6126 | return NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6127 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6128 | table = tempbx; |
| 6129 | i = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6130 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6131 | while (tempdi[i].PANELID != 0xff) { |
| 6132 | tempdx = pVBInfo->LCDResInfo; |
| 6133 | if (tempbx & 0x0080) { /* OEMUtil */ |
| 6134 | tempbx &= (~0x0080); |
| 6135 | tempdx = pVBInfo->LCDTypeInfo; |
| 6136 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6137 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6138 | if (pVBInfo->LCDInfo & EnableScalingLCD) |
| 6139 | tempdx &= (~PanelResInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6140 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6141 | if (tempdi[i].PANELID == tempdx) { |
| 6142 | tempbx = tempdi[i].MASK; |
| 6143 | tempdx = pVBInfo->LCDInfo; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6144 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6145 | if (ModeNo <= 0x13) /* alan 09/10/2003 */ |
| 6146 | tempdx |= SetLCDStdMode; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6147 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6148 | if (modeflag & HalfDCLK) |
| 6149 | tempdx |= SetLCDLowResolution; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6150 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6151 | tempbx &= tempdx; |
| 6152 | if (tempbx == tempdi[i].CAP) |
| 6153 | break; |
| 6154 | } |
| 6155 | i++; |
| 6156 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6157 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6158 | if (table == 0) { |
| 6159 | switch (tempdi[i].DATAPTR) { |
| 6160 | case 0: |
| 6161 | return &XGI_LVDSCRT11024x768_1_H[tempal]; |
| 6162 | break; |
| 6163 | case 1: |
| 6164 | return &XGI_LVDSCRT11024x768_2_H[tempal]; |
| 6165 | break; |
| 6166 | case 2: |
| 6167 | return &XGI_LVDSCRT11280x1024_1_H[tempal]; |
| 6168 | break; |
| 6169 | case 3: |
| 6170 | return &XGI_LVDSCRT11280x1024_2_H[tempal]; |
| 6171 | break; |
| 6172 | case 4: |
| 6173 | return &XGI_LVDSCRT11400x1050_1_H[tempal]; |
| 6174 | break; |
| 6175 | case 5: |
| 6176 | return &XGI_LVDSCRT11400x1050_2_H[tempal]; |
| 6177 | break; |
| 6178 | case 6: |
| 6179 | return &XGI_LVDSCRT11600x1200_1_H[tempal]; |
| 6180 | break; |
| 6181 | case 7: |
| 6182 | return &XGI_LVDSCRT11024x768_1_Hx75[tempal]; |
| 6183 | break; |
| 6184 | case 8: |
| 6185 | return &XGI_LVDSCRT11024x768_2_Hx75[tempal]; |
| 6186 | break; |
| 6187 | case 9: |
| 6188 | return &XGI_LVDSCRT11280x1024_1_Hx75[tempal]; |
| 6189 | break; |
| 6190 | case 10: |
| 6191 | return &XGI_LVDSCRT11280x1024_2_Hx75[tempal]; |
| 6192 | break; |
| 6193 | default: |
| 6194 | break; |
| 6195 | } |
| 6196 | } else if (table == 1) { |
| 6197 | switch (tempdi[i].DATAPTR) { |
| 6198 | case 0: |
| 6199 | return &XGI_LVDSCRT11024x768_1_V[tempal]; |
| 6200 | break; |
| 6201 | case 1: |
| 6202 | return &XGI_LVDSCRT11024x768_2_V[tempal]; |
| 6203 | break; |
| 6204 | case 2: |
| 6205 | return &XGI_LVDSCRT11280x1024_1_V[tempal]; |
| 6206 | break; |
| 6207 | case 3: |
| 6208 | return &XGI_LVDSCRT11280x1024_2_V[tempal]; |
| 6209 | break; |
| 6210 | case 4: |
| 6211 | return &XGI_LVDSCRT11400x1050_1_V[tempal]; |
| 6212 | break; |
| 6213 | case 5: |
| 6214 | return &XGI_LVDSCRT11400x1050_2_V[tempal]; |
| 6215 | break; |
| 6216 | case 6: |
| 6217 | return &XGI_LVDSCRT11600x1200_1_V[tempal]; |
| 6218 | break; |
| 6219 | case 7: |
| 6220 | return &XGI_LVDSCRT11024x768_1_Vx75[tempal]; |
| 6221 | break; |
| 6222 | case 8: |
| 6223 | return &XGI_LVDSCRT11024x768_2_Vx75[tempal]; |
| 6224 | break; |
| 6225 | case 9: |
| 6226 | return &XGI_LVDSCRT11280x1024_1_Vx75[tempal]; |
| 6227 | break; |
| 6228 | case 10: |
| 6229 | return &XGI_LVDSCRT11280x1024_2_Vx75[tempal]; |
| 6230 | break; |
| 6231 | default: |
| 6232 | break; |
| 6233 | } |
| 6234 | } else if (table == 2) { |
| 6235 | switch (tempdi[i].DATAPTR) { |
| 6236 | case 0: |
| 6237 | return &XGI_LVDS1024x768Data_1[tempal]; |
| 6238 | break; |
| 6239 | case 1: |
| 6240 | return &XGI_LVDS1024x768Data_2[tempal]; |
| 6241 | break; |
| 6242 | case 2: |
| 6243 | return &XGI_LVDS1280x1024Data_1[tempal]; |
| 6244 | break; |
| 6245 | case 3: |
| 6246 | return &XGI_LVDS1280x1024Data_2[tempal]; |
| 6247 | break; |
| 6248 | case 4: |
| 6249 | return &XGI_LVDS1400x1050Data_1[tempal]; |
| 6250 | break; |
| 6251 | case 5: |
| 6252 | return &XGI_LVDS1400x1050Data_2[tempal]; |
| 6253 | break; |
| 6254 | case 6: |
| 6255 | return &XGI_LVDS1600x1200Data_1[tempal]; |
| 6256 | break; |
| 6257 | case 7: |
| 6258 | return &XGI_LVDSNoScalingData[tempal]; |
| 6259 | break; |
| 6260 | case 8: |
| 6261 | return &XGI_LVDS1024x768Data_1x75[tempal]; |
| 6262 | break; |
| 6263 | case 9: |
| 6264 | return &XGI_LVDS1024x768Data_2x75[tempal]; |
| 6265 | break; |
| 6266 | case 10: |
| 6267 | return &XGI_LVDS1280x1024Data_1x75[tempal]; |
| 6268 | break; |
| 6269 | case 11: |
| 6270 | return &XGI_LVDS1280x1024Data_2x75[tempal]; |
| 6271 | break; |
| 6272 | case 12: |
| 6273 | return &XGI_LVDSNoScalingDatax75[tempal]; |
| 6274 | break; |
| 6275 | default: |
| 6276 | break; |
| 6277 | } |
| 6278 | } else if (table == 3) { |
| 6279 | switch (tempdi[i].DATAPTR) { |
| 6280 | case 0: |
| 6281 | return &XGI_LVDS1024x768Des_1[tempal]; |
| 6282 | break; |
| 6283 | case 1: |
| 6284 | return &XGI_LVDS1024x768Des_3[tempal]; |
| 6285 | break; |
| 6286 | case 2: |
| 6287 | return &XGI_LVDS1024x768Des_2[tempal]; |
| 6288 | break; |
| 6289 | case 3: |
| 6290 | return &XGI_LVDS1280x1024Des_1[tempal]; |
| 6291 | break; |
| 6292 | case 4: |
| 6293 | return &XGI_LVDS1280x1024Des_2[tempal]; |
| 6294 | break; |
| 6295 | case 5: |
| 6296 | return &XGI_LVDS1400x1050Des_1[tempal]; |
| 6297 | break; |
| 6298 | case 6: |
| 6299 | return &XGI_LVDS1400x1050Des_2[tempal]; |
| 6300 | break; |
| 6301 | case 7: |
| 6302 | return &XGI_LVDS1600x1200Des_1[tempal]; |
| 6303 | break; |
| 6304 | case 8: |
| 6305 | return &XGI_LVDSNoScalingDesData[tempal]; |
| 6306 | break; |
| 6307 | case 9: |
| 6308 | return &XGI_LVDS1024x768Des_1x75[tempal]; |
| 6309 | break; |
| 6310 | case 10: |
| 6311 | return &XGI_LVDS1024x768Des_3x75[tempal]; |
| 6312 | break; |
| 6313 | case 11: |
| 6314 | return &XGI_LVDS1024x768Des_2x75[tempal]; |
| 6315 | break; |
| 6316 | case 12: |
| 6317 | return &XGI_LVDS1280x1024Des_1x75[tempal]; |
| 6318 | break; |
| 6319 | case 13: |
| 6320 | return &XGI_LVDS1280x1024Des_2x75[tempal]; |
| 6321 | break; |
| 6322 | case 14: |
| 6323 | return &XGI_LVDSNoScalingDesDatax75[tempal]; |
| 6324 | break; |
| 6325 | default: |
| 6326 | break; |
| 6327 | } |
| 6328 | } else if (table == 4) { |
| 6329 | switch (tempdi[i].DATAPTR) { |
| 6330 | case 0: |
| 6331 | return &XGI_ExtLCD1024x768Data[tempal]; |
| 6332 | break; |
| 6333 | case 1: |
| 6334 | return &XGI_StLCD1024x768Data[tempal]; |
| 6335 | break; |
| 6336 | case 2: |
| 6337 | return &XGI_CetLCD1024x768Data[tempal]; |
| 6338 | break; |
| 6339 | case 3: |
| 6340 | return &XGI_ExtLCD1280x1024Data[tempal]; |
| 6341 | break; |
| 6342 | case 4: |
| 6343 | return &XGI_StLCD1280x1024Data[tempal]; |
| 6344 | break; |
| 6345 | case 5: |
| 6346 | return &XGI_CetLCD1280x1024Data[tempal]; |
| 6347 | break; |
| 6348 | case 6: |
| 6349 | return &XGI_ExtLCD1400x1050Data[tempal]; |
| 6350 | break; |
| 6351 | case 7: |
| 6352 | return &XGI_StLCD1400x1050Data[tempal]; |
| 6353 | break; |
| 6354 | case 8: |
| 6355 | return &XGI_CetLCD1400x1050Data[tempal]; |
| 6356 | break; |
| 6357 | case 9: |
| 6358 | return &XGI_ExtLCD1600x1200Data[tempal]; |
| 6359 | break; |
| 6360 | case 10: |
| 6361 | return &XGI_StLCD1600x1200Data[tempal]; |
| 6362 | break; |
| 6363 | case 11: |
| 6364 | return &XGI_NoScalingData[tempal]; |
| 6365 | break; |
| 6366 | case 12: |
| 6367 | return &XGI_ExtLCD1024x768x75Data[tempal]; |
| 6368 | break; |
| 6369 | case 13: |
| 6370 | return &XGI_ExtLCD1024x768x75Data[tempal]; |
| 6371 | break; |
| 6372 | case 14: |
| 6373 | return &XGI_CetLCD1024x768x75Data[tempal]; |
| 6374 | break; |
| 6375 | case 15: |
| 6376 | return &XGI_ExtLCD1280x1024x75Data[tempal]; |
| 6377 | break; |
| 6378 | case 16: |
| 6379 | return &XGI_StLCD1280x1024x75Data[tempal]; |
| 6380 | break; |
| 6381 | case 17: |
| 6382 | return &XGI_CetLCD1280x1024x75Data[tempal]; |
| 6383 | break; |
| 6384 | case 18: |
| 6385 | return &XGI_NoScalingDatax75[tempal]; |
| 6386 | break; |
| 6387 | default: |
| 6388 | break; |
| 6389 | } |
| 6390 | } else if (table == 5) { |
| 6391 | switch (tempdi[i].DATAPTR) { |
| 6392 | case 0: |
| 6393 | return &XGI_ExtLCDDes1024x768Data[tempal]; |
| 6394 | break; |
| 6395 | case 1: |
| 6396 | return &XGI_StLCDDes1024x768Data[tempal]; |
| 6397 | break; |
| 6398 | case 2: |
| 6399 | return &XGI_CetLCDDes1024x768Data[tempal]; |
| 6400 | break; |
| 6401 | case 3: |
| 6402 | if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType |
| 6403 | & VB_XGI302LV)) |
| 6404 | return &XGI_ExtLCDDLDes1280x1024Data[tempal]; |
| 6405 | else |
| 6406 | return &XGI_ExtLCDDes1280x1024Data[tempal]; |
| 6407 | break; |
| 6408 | case 4: |
| 6409 | if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType |
| 6410 | & VB_XGI302LV)) |
| 6411 | return &XGI_StLCDDLDes1280x1024Data[tempal]; |
| 6412 | else |
| 6413 | return &XGI_StLCDDes1280x1024Data[tempal]; |
| 6414 | break; |
| 6415 | case 5: |
| 6416 | if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType |
| 6417 | & VB_XGI302LV)) |
| 6418 | return &XGI_CetLCDDLDes1280x1024Data[tempal]; |
| 6419 | else |
| 6420 | return &XGI_CetLCDDes1280x1024Data[tempal]; |
| 6421 | break; |
| 6422 | case 6: |
| 6423 | if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType |
| 6424 | & VB_XGI302LV)) |
| 6425 | return &XGI_ExtLCDDLDes1400x1050Data[tempal]; |
| 6426 | else |
| 6427 | return &XGI_ExtLCDDes1400x1050Data[tempal]; |
| 6428 | break; |
| 6429 | case 7: |
| 6430 | if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType |
| 6431 | & VB_XGI302LV)) |
| 6432 | return &XGI_StLCDDLDes1400x1050Data[tempal]; |
| 6433 | else |
| 6434 | return &XGI_StLCDDes1400x1050Data[tempal]; |
| 6435 | break; |
| 6436 | case 8: |
| 6437 | return &XGI_CetLCDDes1400x1050Data[tempal]; |
| 6438 | break; |
| 6439 | case 9: |
| 6440 | return &XGI_CetLCDDes1400x1050Data2[tempal]; |
| 6441 | break; |
| 6442 | case 10: |
| 6443 | if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType |
| 6444 | & VB_XGI302LV)) |
| 6445 | return &XGI_ExtLCDDLDes1600x1200Data[tempal]; |
| 6446 | else |
| 6447 | return &XGI_ExtLCDDes1600x1200Data[tempal]; |
| 6448 | break; |
| 6449 | case 11: |
| 6450 | if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType |
| 6451 | & VB_XGI302LV)) |
| 6452 | return &XGI_StLCDDLDes1600x1200Data[tempal]; |
| 6453 | else |
| 6454 | return &XGI_StLCDDes1600x1200Data[tempal]; |
| 6455 | break; |
| 6456 | case 12: |
| 6457 | return &XGI_NoScalingDesData[tempal]; |
| 6458 | break; |
| 6459 | case 13: |
| 6460 | return &XGI_ExtLCDDes1024x768x75Data[tempal]; |
| 6461 | break; |
| 6462 | case 14: |
| 6463 | return &XGI_StLCDDes1024x768x75Data[tempal]; |
| 6464 | break; |
| 6465 | case 15: |
| 6466 | return &XGI_CetLCDDes1024x768x75Data[tempal]; |
| 6467 | break; |
| 6468 | case 16: |
| 6469 | if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType |
| 6470 | & VB_XGI302LV)) |
| 6471 | return &XGI_ExtLCDDLDes1280x1024x75Data[tempal]; |
| 6472 | else |
| 6473 | return &XGI_ExtLCDDes1280x1024x75Data[tempal]; |
| 6474 | break; |
| 6475 | case 17: |
| 6476 | if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType |
| 6477 | & VB_XGI302LV)) |
| 6478 | return &XGI_StLCDDLDes1280x1024x75Data[tempal]; |
| 6479 | else |
| 6480 | return &XGI_StLCDDes1280x1024x75Data[tempal]; |
| 6481 | break; |
| 6482 | case 18: |
| 6483 | if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType |
| 6484 | & VB_XGI302LV)) |
| 6485 | return &XGI_CetLCDDLDes1280x1024x75Data[tempal]; |
| 6486 | else |
| 6487 | return &XGI_CetLCDDes1280x1024x75Data[tempal]; |
| 6488 | break; |
| 6489 | case 19: |
| 6490 | return &XGI_NoScalingDesDatax75[tempal]; |
| 6491 | break; |
| 6492 | default: |
| 6493 | break; |
| 6494 | } |
| 6495 | } else if (table == 6) { |
| 6496 | switch (tempdi[i].DATAPTR) { |
| 6497 | case 0: |
| 6498 | return &XGI_CH7017LV1024x768[tempal]; |
| 6499 | break; |
| 6500 | case 1: |
| 6501 | return &XGI_CH7017LV1400x1050[tempal]; |
| 6502 | break; |
| 6503 | default: |
| 6504 | break; |
| 6505 | } |
| 6506 | } |
| 6507 | return NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6508 | } |
| 6509 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6510 | void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6511 | unsigned short ModeIdIndex, |
| 6512 | unsigned short RefreshRateTableIndex, |
| 6513 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6514 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6515 | unsigned short i, tempdx, tempbx, tempal, modeflag, table; |
| 6516 | struct XGI330_TVDataTablStruct *tempdi = NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6517 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6518 | tempbx = BX; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6519 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6520 | if (ModeNo <= 0x13) { |
| 6521 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 6522 | tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; |
| 6523 | } else { |
| 6524 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 6525 | tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 6526 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6527 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6528 | tempal = tempal & 0x3f; |
| 6529 | table = tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6530 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6531 | switch (tempbx) { |
| 6532 | case 0: |
| 6533 | tempdi = NULL; /*EPLCHTVCRT1Ptr_H;*/ |
| 6534 | if (pVBInfo->IF_DEF_CH7007 == 1) |
| 6535 | tempdi = XGI_EPLCHTVCRT1Ptr; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6536 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6537 | break; |
| 6538 | case 1: |
| 6539 | tempdi = NULL; /*EPLCHTVCRT1Ptr_V;*/ |
| 6540 | if (pVBInfo->IF_DEF_CH7007 == 1) |
| 6541 | tempdi = XGI_EPLCHTVCRT1Ptr; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6542 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6543 | break; |
| 6544 | case 2: |
| 6545 | tempdi = XGI_EPLCHTVDataPtr; |
| 6546 | break; |
| 6547 | case 3: |
| 6548 | tempdi = NULL; |
| 6549 | break; |
| 6550 | case 4: |
| 6551 | tempdi = XGI_TVDataTable; |
| 6552 | break; |
| 6553 | case 5: |
| 6554 | tempdi = NULL; |
| 6555 | break; |
| 6556 | case 6: |
| 6557 | tempdi = XGI_EPLCHTVRegPtr; |
| 6558 | break; |
| 6559 | default: |
| 6560 | break; |
| 6561 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6562 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6563 | if (tempdi == NULL) /* OEMUtil */ |
| 6564 | return NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6565 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6566 | tempdx = pVBInfo->TVInfo; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6567 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6568 | if (pVBInfo->VBInfo & SetInSlaveMode) |
| 6569 | tempdx = tempdx | SetTVLockMode; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6570 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6571 | if (modeflag & HalfDCLK) |
| 6572 | tempdx = tempdx | SetTVLowResolution; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6573 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6574 | i = 0; |
| 6575 | |
| 6576 | while (tempdi[i].MASK != 0xffff) { |
| 6577 | if ((tempdx & tempdi[i].MASK) == tempdi[i].CAP) |
| 6578 | break; |
| 6579 | i++; |
| 6580 | } |
| 6581 | |
| 6582 | if (table == 0x00) { /* 07/05/22 */ |
| 6583 | } else if (table == 0x01) { |
| 6584 | } else if (table == 0x04) { |
| 6585 | switch (tempdi[i].DATAPTR) { |
| 6586 | case 0: |
| 6587 | return &XGI_ExtPALData[tempal]; |
| 6588 | break; |
| 6589 | case 1: |
| 6590 | return &XGI_ExtNTSCData[tempal]; |
| 6591 | break; |
| 6592 | case 2: |
| 6593 | return &XGI_StPALData[tempal]; |
| 6594 | break; |
| 6595 | case 3: |
| 6596 | return &XGI_StNTSCData[tempal]; |
| 6597 | break; |
| 6598 | case 4: |
| 6599 | return &XGI_ExtHiTVData[tempal]; |
| 6600 | break; |
| 6601 | case 5: |
| 6602 | return &XGI_St2HiTVData[tempal]; |
| 6603 | break; |
| 6604 | case 6: |
| 6605 | return &XGI_ExtYPbPr525iData[tempal]; |
| 6606 | break; |
| 6607 | case 7: |
| 6608 | return &XGI_ExtYPbPr525pData[tempal]; |
| 6609 | break; |
| 6610 | case 8: |
| 6611 | return &XGI_ExtYPbPr750pData[tempal]; |
| 6612 | break; |
| 6613 | case 9: |
| 6614 | return &XGI_StYPbPr525iData[tempal]; |
| 6615 | break; |
| 6616 | case 10: |
| 6617 | return &XGI_StYPbPr525pData[tempal]; |
| 6618 | break; |
| 6619 | case 11: |
| 6620 | return &XGI_StYPbPr750pData[tempal]; |
| 6621 | break; |
| 6622 | case 12: /* avoid system hang */ |
| 6623 | return &XGI_ExtNTSCData[tempal]; |
| 6624 | break; |
| 6625 | case 13: |
| 6626 | return &XGI_St1HiTVData[tempal]; |
| 6627 | break; |
| 6628 | default: |
| 6629 | break; |
| 6630 | } |
| 6631 | } else if (table == 0x02) { |
| 6632 | switch (tempdi[i].DATAPTR) { |
| 6633 | case 0: |
| 6634 | return &XGI_CHTVUNTSCData[tempal]; |
| 6635 | break; |
| 6636 | case 1: |
| 6637 | return &XGI_CHTVONTSCData[tempal]; |
| 6638 | break; |
| 6639 | case 2: |
| 6640 | return &XGI_CHTVUPALData[tempal]; |
| 6641 | break; |
| 6642 | case 3: |
| 6643 | return &XGI_CHTVOPALData[tempal]; |
| 6644 | break; |
| 6645 | default: |
| 6646 | break; |
| 6647 | } |
| 6648 | } else if (table == 0x06) { |
| 6649 | } |
| 6650 | return NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6651 | } |
| 6652 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6653 | /* --------------------------------------------------------------------- */ |
| 6654 | /* Function : XGI_BacklightByDrv */ |
| 6655 | /* Input : */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 6656 | /* Output : 1 -> Skip backlight control */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6657 | /* Description : */ |
| 6658 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 6659 | unsigned char XGI_BacklightByDrv(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6660 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6661 | unsigned char tempah; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6662 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6663 | tempah = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x3A); |
| 6664 | if (tempah & BacklightControlBit) |
| 6665 | return 1; |
| 6666 | else |
| 6667 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6668 | } |
| 6669 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6670 | /* --------------------------------------------------------------------- */ |
| 6671 | /* Function : XGI_FirePWDDisable */ |
| 6672 | /* Input : */ |
| 6673 | /* Output : */ |
| 6674 | /* Description : Turn off VDD & Backlight : Fire disable procedure */ |
| 6675 | /* --------------------------------------------------------------------- */ |
| 6676 | /* |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 6677 | void XGI_FirePWDDisable(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6678 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6679 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x26, 0x00, 0xFC); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6680 | } |
| 6681 | */ |
| 6682 | |
| 6683 | /* --------------------------------------------------------------------- */ |
| 6684 | /* Function : XGI_FirePWDEnable */ |
| 6685 | /* Input : */ |
| 6686 | /* Output : */ |
| 6687 | /* Description : Turn on VDD & Backlight : Fire enable procedure */ |
| 6688 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 6689 | void XGI_FirePWDEnable(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6690 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6691 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x26, 0x03, 0xFC); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6692 | } |
| 6693 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6694 | void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, |
| 6695 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6696 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6697 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x63, 0xBF, 0x40); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6698 | } |
| 6699 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6700 | void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, |
| 6701 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6702 | { |
| 6703 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6704 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x63, 0xBF, 0x00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6705 | } |
| 6706 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6707 | /* --------------------------------------------------------------------- */ |
| 6708 | /* Function : XGI_SetPanelDelay */ |
| 6709 | /* Input : */ |
| 6710 | /* Output : */ |
| 6711 | /* Description : */ |
| 6712 | /* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */ |
| 6713 | /* : bl : 2 ; T2 : the duration signal on and Vdd on */ |
| 6714 | /* : bl : 3 ; T3 : the duration between CPL off and signal off */ |
| 6715 | /* : bl : 4 ; T4 : the duration signal off and Vdd off */ |
| 6716 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 6717 | void XGI_SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6718 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6719 | unsigned short index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6720 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6721 | index = XGI_GetLCDCapPtr(pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6722 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6723 | if (tempbl == 1) |
| 6724 | XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S1, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6725 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6726 | if (tempbl == 2) |
| 6727 | XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S2, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6728 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6729 | if (tempbl == 3) |
| 6730 | XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S3, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6731 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6732 | if (tempbl == 4) |
| 6733 | XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S4, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6734 | } |
| 6735 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6736 | /* --------------------------------------------------------------------- */ |
| 6737 | /* Function : XGI_SetPanelPower */ |
| 6738 | /* Input : */ |
| 6739 | /* Output : */ |
| 6740 | /* Description : */ |
| 6741 | /* I/O : ah = 0011b = 03h ; Backlight on, Power on */ |
| 6742 | /* = 0111b = 07h ; Backlight on, Power off */ |
| 6743 | /* = 1011b = 0Bh ; Backlight off, Power on */ |
| 6744 | /* = 1111b = 0Fh ; Backlight off, Power off */ |
| 6745 | /* --------------------------------------------------------------------- */ |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6746 | void XGI_SetPanelPower(unsigned short tempah, unsigned short tempbl, |
| 6747 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6748 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6749 | if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) |
| 6750 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x26, tempbl, tempah); |
| 6751 | else |
| 6752 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x11, tempbl, tempah); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6753 | } |
| 6754 | |
Randy Dunlap | 8922967 | 2010-08-10 08:46:44 -0700 | [diff] [blame] | 6755 | static unsigned char XG21GPIODataTransfer(unsigned char ujDate) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6756 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6757 | unsigned char ujRet = 0; |
| 6758 | unsigned char i = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6759 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6760 | for (i = 0; i < 8; i++) { |
| 6761 | ujRet = ujRet << 1; |
| 6762 | /* ujRet |= GETBITS(ujDate >> i, 0:0); */ |
| 6763 | ujRet |= (ujDate >> i) & 1; |
| 6764 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6765 | |
| 6766 | return ujRet; |
| 6767 | } |
| 6768 | |
| 6769 | /*----------------------------------------------------------------------------*/ |
| 6770 | /* output */ |
| 6771 | /* bl[5] : LVDS signal */ |
| 6772 | /* bl[1] : LVDS backlight */ |
| 6773 | /* bl[0] : LVDS VDD */ |
| 6774 | /*----------------------------------------------------------------------------*/ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 6775 | unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6776 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6777 | unsigned char CR4A, temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6778 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6779 | CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A); |
| 6780 | XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x23); /* enable GPIO write */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6781 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6782 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6783 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6784 | temp = XG21GPIODataTransfer(temp); |
| 6785 | temp &= 0x23; |
| 6786 | XGINew_SetReg1(pVBInfo->P3d4, 0x4A, CR4A); |
| 6787 | return temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6788 | } |
| 6789 | |
| 6790 | /*----------------------------------------------------------------------------*/ |
| 6791 | /* output */ |
| 6792 | /* bl[5] : LVDS signal */ |
| 6793 | /* bl[1] : LVDS backlight */ |
| 6794 | /* bl[0] : LVDS VDD */ |
| 6795 | /*----------------------------------------------------------------------------*/ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 6796 | unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6797 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6798 | unsigned char CR4A, CRB4, temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6799 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6800 | CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A); |
| 6801 | XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x0C); /* enable GPIO write */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6802 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6803 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6804 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6805 | temp &= 0x0C; |
| 6806 | temp >>= 2; |
| 6807 | XGINew_SetReg1(pVBInfo->P3d4, 0x4A, CR4A); |
| 6808 | CRB4 = XGINew_GetReg1(pVBInfo->P3d4, 0xB4); |
| 6809 | temp |= ((CRB4 & 0x04) << 3); |
| 6810 | return temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6811 | } |
| 6812 | /*----------------------------------------------------------------------------*/ |
| 6813 | /* input */ |
| 6814 | /* bl[5] : 1;LVDS signal on */ |
| 6815 | /* bl[1] : 1;LVDS backlight on */ |
| 6816 | /* bl[0] : 1:LVDS VDD on */ |
| 6817 | /* bh: 100000b : clear bit 5, to set bit5 */ |
| 6818 | /* 000010b : clear bit 1, to set bit1 */ |
| 6819 | /* 000001b : clear bit 0, to set bit0 */ |
| 6820 | /*----------------------------------------------------------------------------*/ |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6821 | void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, |
| 6822 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6823 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6824 | unsigned char CR4A, temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6825 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6826 | CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A); |
| 6827 | tempbh &= 0x23; |
| 6828 | tempbl &= 0x23; |
| 6829 | XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6830 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6831 | if (tempbh & 0x20) { |
| 6832 | temp = (tempbl >> 4) & 0x02; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6833 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6834 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0xB4, ~0x02, temp); /* CR B4[1] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6835 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6836 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6837 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6838 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6839 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6840 | temp = XG21GPIODataTransfer(temp); |
| 6841 | temp &= ~tempbh; |
| 6842 | temp |= tempbl; |
| 6843 | XGINew_SetReg1(pVBInfo->P3d4, 0x48, temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6844 | } |
| 6845 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6846 | void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, |
| 6847 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6848 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6849 | unsigned char CR4A, temp; |
| 6850 | unsigned short tempbh0, tempbl0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6851 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6852 | tempbh0 = tempbh; |
| 6853 | tempbl0 = tempbl; |
| 6854 | tempbh0 &= 0x20; |
| 6855 | tempbl0 &= 0x20; |
| 6856 | tempbh0 >>= 3; |
| 6857 | tempbl0 >>= 3; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6858 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6859 | if (tempbh & 0x20) { |
| 6860 | temp = (tempbl >> 4) & 0x02; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6861 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6862 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0xB4, ~0x02, temp); /* CR B4[1] */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6863 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6864 | } |
| 6865 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0xB4, ~tempbh0, tempbl0); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6866 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6867 | CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A); |
| 6868 | tempbh &= 0x03; |
| 6869 | tempbl &= 0x03; |
| 6870 | tempbh <<= 2; |
| 6871 | tempbl <<= 2; /* GPIOC,GPIOD */ |
| 6872 | XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */ |
| 6873 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x48, ~tempbh, tempbl); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6874 | } |
| 6875 | |
| 6876 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 6877 | unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6878 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6879 | unsigned short index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6880 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6881 | index = XGINew_GetReg1(pVBInfo->P3d4, 0x36); |
| 6882 | if (index < sizeof(XGI21_LCDCapList) |
| 6883 | / sizeof(struct XGI21_LVDSCapStruct)) |
| 6884 | return index; |
| 6885 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6886 | } |
| 6887 | |
| 6888 | /* --------------------------------------------------------------------- */ |
| 6889 | /* Function : XGI_XG21SetPanelDelay */ |
| 6890 | /* Input : */ |
| 6891 | /* Output : */ |
| 6892 | /* Description : */ |
| 6893 | /* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */ |
| 6894 | /* : bl : 2 ; T2 : the duration signal on and Vdd on */ |
| 6895 | /* : bl : 3 ; T3 : the duration between CPL off and signal off */ |
| 6896 | /* : bl : 4 ; T4 : the duration signal off and Vdd off */ |
| 6897 | /* --------------------------------------------------------------------- */ |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6898 | void XGI_XG21SetPanelDelay(unsigned short tempbl, |
| 6899 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6900 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6901 | unsigned short index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6902 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6903 | index = XGI_GetLVDSOEMTableIndex(pVBInfo); |
| 6904 | if (tempbl == 1) |
| 6905 | XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S1, |
| 6906 | pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6907 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6908 | if (tempbl == 2) |
| 6909 | XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S2, |
| 6910 | pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6911 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6912 | if (tempbl == 3) |
| 6913 | XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S3, |
| 6914 | pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6915 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6916 | if (tempbl == 4) |
| 6917 | XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S4, |
| 6918 | pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6919 | } |
| 6920 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6921 | unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6922 | unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6923 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6924 | unsigned short xres, yres, colordepth, modeflag, resindex, |
| 6925 | lvdstableindex; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6926 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6927 | resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); |
| 6928 | if (ModeNo <= 0x13) { |
| 6929 | xres = pVBInfo->StResInfo[resindex].HTotal; |
| 6930 | yres = pVBInfo->StResInfo[resindex].VTotal; |
| 6931 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 6932 | } else { |
| 6933 | xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */ |
| 6934 | yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */ |
| 6935 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+St_ModeFlag */ |
| 6936 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6937 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6938 | if (!(modeflag & Charx8Dot)) { |
| 6939 | xres /= 9; |
| 6940 | xres *= 8; |
| 6941 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6942 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6943 | if (ModeNo > 0x13) { |
| 6944 | if ((ModeNo > 0x13) && (modeflag & HalfDCLK)) |
| 6945 | xres *= 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6946 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6947 | if ((ModeNo > 0x13) && (modeflag & DoubleScanMode)) |
| 6948 | yres *= 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6949 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6950 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6951 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6952 | lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo); |
| 6953 | if (xres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE)) |
| 6954 | return 0; |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 6955 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6956 | if (yres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE)) |
| 6957 | return 0; |
| 6958 | |
| 6959 | if (ModeNo > 0x13) { |
| 6960 | if ((xres |
| 6961 | != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE)) |
| 6962 | || (yres |
| 6963 | != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE))) { |
| 6964 | colordepth = XGI_GetColorDepth(ModeNo, ModeIdIndex, |
| 6965 | pVBInfo); |
| 6966 | if (colordepth > 2) |
| 6967 | return 0; |
| 6968 | |
| 6969 | } |
| 6970 | } |
| 6971 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6972 | } |
| 6973 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 6974 | void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6975 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6976 | unsigned char temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6977 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6978 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37); /* D[0] 1: 18bit */ |
| 6979 | temp = (temp & 1) << 6; |
| 6980 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x06, ~0x40, temp); /* SR06[6] 18bit Dither */ |
| 6981 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: dual 12bits */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6982 | |
| 6983 | } |
| 6984 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 6985 | void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6986 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6987 | unsigned char temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6988 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6989 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37); /* D[1:0] 01: 18bit, 00: dual 12, 10: single 24 */ |
| 6990 | temp = (temp & 3) << 6; |
| 6991 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x06, ~0xc0, temp & 0x80); /* SR06[7]0: dual 12/1: single 24 [6] 18bit Dither <= 0 h/w recommend */ |
| 6992 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: 24bits */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6993 | |
| 6994 | } |
| 6995 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 6996 | void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6997 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 6998 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 6999 | unsigned char temp, Miscdata; |
| 7000 | unsigned short xres, yres, modeflag, resindex, lvdstableindex; |
| 7001 | unsigned short LVDSHT, LVDSHBS, LVDSHRS, LVDSHRE, LVDSHBE; |
| 7002 | unsigned short LVDSVT, LVDSVBS, LVDSVRS, LVDSVRE, LVDSVBE; |
| 7003 | unsigned short value; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7004 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7005 | lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7006 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7007 | temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability |
| 7008 | & (LCDPolarity << 8)) >> 8); |
| 7009 | temp &= LCDPolarity; |
| 7010 | Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7011 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7012 | XGINew_SetReg3(pVBInfo->P3c2, (Miscdata & 0x3F) | temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7013 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7014 | temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability |
| 7015 | & LCDPolarity); |
| 7016 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80); /* SR35[7] FP VSync polarity */ |
| 7017 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, ~0x20, (temp & 0x40) >> 1); /* SR30[5] FP HSync polarity */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7018 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7019 | XGI_SetXG21FPBits(pVBInfo); |
| 7020 | resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); |
| 7021 | if (ModeNo <= 0x13) { |
| 7022 | xres = pVBInfo->StResInfo[resindex].HTotal; |
| 7023 | yres = pVBInfo->StResInfo[resindex].VTotal; |
| 7024 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 7025 | } else { |
| 7026 | xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */ |
| 7027 | yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */ |
| 7028 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+St_ModeFlag */ |
| 7029 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7030 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7031 | if (!(modeflag & Charx8Dot)) |
| 7032 | xres = xres * 8 / 9; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7033 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7034 | LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7035 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7036 | LVDSHBS = xres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE |
| 7037 | - xres) / 2; |
| 7038 | if ((ModeNo <= 0x13) && (modeflag & HalfDCLK)) |
| 7039 | LVDSHBS -= xres / 4; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7040 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7041 | if (LVDSHBS > LVDSHT) |
| 7042 | LVDSHBS -= LVDSHT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7043 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7044 | LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP; |
| 7045 | if (LVDSHRS > LVDSHT) |
| 7046 | LVDSHRS -= LVDSHT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7047 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7048 | LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC; |
| 7049 | if (LVDSHRE > LVDSHT) |
| 7050 | LVDSHRE -= LVDSHT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7051 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7052 | LVDSHBE = LVDSHBS + LVDSHT |
| 7053 | - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7054 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7055 | LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7056 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7057 | LVDSVBS = yres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE |
| 7058 | - yres) / 2; |
| 7059 | if ((ModeNo > 0x13) && (modeflag & DoubleScanMode)) |
| 7060 | LVDSVBS += yres / 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7061 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7062 | if (LVDSVBS > LVDSVT) |
| 7063 | LVDSVBS -= LVDSVT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7064 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7065 | LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP; |
| 7066 | if (LVDSVRS > LVDSVT) |
| 7067 | LVDSVRS -= LVDSVT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7068 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7069 | LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC; |
| 7070 | if (LVDSVRE > LVDSVT) |
| 7071 | LVDSVRE -= LVDSVT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7072 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7073 | LVDSVBE = LVDSVBS + LVDSVT |
| 7074 | - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7075 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7076 | temp = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
| 7077 | XGINew_SetReg1(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7078 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7079 | if (!(modeflag & Charx8Dot)) |
| 7080 | XGINew_SetRegOR(pVBInfo->P3c4, 0x1, 0x1); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7081 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7082 | /* HT SR0B[1:0] CR00 */ |
| 7083 | value = (LVDSHT >> 3) - 5; |
| 7084 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0x03, (value & 0x300) >> 8); |
| 7085 | XGINew_SetReg1(pVBInfo->P3d4, 0x0, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7086 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7087 | /* HBS SR0B[5:4] CR02 */ |
| 7088 | value = (LVDSHBS >> 3) - 1; |
| 7089 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0x30, (value & 0x300) >> 4); |
| 7090 | XGINew_SetReg1(pVBInfo->P3d4, 0x2, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7091 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7092 | /* HBE SR0C[1:0] CR05[7] CR03[4:0] */ |
| 7093 | value = (LVDSHBE >> 3) - 1; |
| 7094 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0C, ~0x03, (value & 0xC0) >> 6); |
| 7095 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x05, ~0x80, (value & 0x20) << 2); |
| 7096 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x03, ~0x1F, value & 0x1F); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7097 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7098 | /* HRS SR0B[7:6] CR04 */ |
| 7099 | value = (LVDSHRS >> 3) + 2; |
| 7100 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0xC0, (value & 0x300) >> 2); |
| 7101 | XGINew_SetReg1(pVBInfo->P3d4, 0x4, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7102 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7103 | /* Panel HRS SR2F[1:0] SR2E[7:0] */ |
| 7104 | value--; |
| 7105 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x2F, ~0x03, (value & 0x300) >> 8); |
| 7106 | XGINew_SetReg1(pVBInfo->P3c4, 0x2E, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7107 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7108 | /* HRE SR0C[2] CR05[4:0] */ |
| 7109 | value = (LVDSHRE >> 3) + 2; |
| 7110 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0C, ~0x04, (value & 0x20) >> 3); |
| 7111 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x05, ~0x1F, value & 0x1F); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7112 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7113 | /* Panel HRE SR2F[7:2] */ |
| 7114 | value--; |
| 7115 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x2F, ~0xFC, value << 2); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7116 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7117 | /* VT SR0A[0] CR07[5][0] CR06 */ |
| 7118 | value = LVDSVT - 2; |
| 7119 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x01, (value & 0x400) >> 10); |
| 7120 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x20, (value & 0x200) >> 4); |
| 7121 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x01, (value & 0x100) >> 8); |
| 7122 | XGINew_SetReg1(pVBInfo->P3d4, 0x06, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7123 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7124 | /* VBS SR0A[2] CR09[5] CR07[3] CR15 */ |
| 7125 | value = LVDSVBS - 1; |
| 7126 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x04, (value & 0x400) >> 8); |
| 7127 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x09, ~0x20, (value & 0x200) >> 4); |
| 7128 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x08, (value & 0x100) >> 5); |
| 7129 | XGINew_SetReg1(pVBInfo->P3d4, 0x15, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7130 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7131 | /* VBE SR0A[4] CR16 */ |
| 7132 | value = LVDSVBE - 1; |
| 7133 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4); |
| 7134 | XGINew_SetReg1(pVBInfo->P3d4, 0x16, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7135 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7136 | /* VRS SR0A[3] CR7[7][2] CR10 */ |
| 7137 | value = LVDSVRS - 1; |
| 7138 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x08, (value & 0x400) >> 7); |
| 7139 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x80, (value & 0x200) >> 2); |
| 7140 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x04, (value & 0x100) >> 6); |
| 7141 | XGINew_SetReg1(pVBInfo->P3d4, 0x10, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7142 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7143 | /* Panel VRS SR3F[1:0] SR34[7:0] SR33[0] */ |
| 7144 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0x03, (value & 0x600) >> 9); |
| 7145 | XGINew_SetReg1(pVBInfo->P3c4, 0x34, (value >> 1) & 0xFF); |
| 7146 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x33, ~0x01, value & 0x01); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7147 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7148 | /* VRE SR0A[5] CR11[3:0] */ |
| 7149 | value = LVDSVRE - 1; |
| 7150 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x20, (value & 0x10) << 1); |
| 7151 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x11, ~0x0F, value & 0x0F); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7152 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7153 | /* Panel VRE SR3F[7:2] *//* SR3F[7] has to be 0, h/w bug */ |
| 7154 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0xFC, (value << 2) & 0x7C); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7155 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7156 | for (temp = 0, value = 0; temp < 3; temp++) { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7157 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7158 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x31, ~0x30, value); |
| 7159 | XGINew_SetReg1(pVBInfo->P3c4, |
| 7160 | 0x2B, |
| 7161 | pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1); |
| 7162 | XGINew_SetReg1(pVBInfo->P3c4, |
| 7163 | 0x2C, |
| 7164 | pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2); |
| 7165 | value += 0x10; |
| 7166 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7167 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7168 | if (!(modeflag & Charx8Dot)) { |
| 7169 | XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */ |
| 7170 | XGINew_SetReg3(pVBInfo->P3c0, 0x13); /* set index */ |
| 7171 | XGINew_SetReg3(pVBInfo->P3c0, 0x00); /* set data, panning = 0, shift left 1 dot*/ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7172 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7173 | XGINew_GetReg2(pVBInfo->P3da); /* Enable Attribute */ |
| 7174 | XGINew_SetReg3(pVBInfo->P3c0, 0x20); |
| 7175 | |
| 7176 | XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */ |
| 7177 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7178 | |
| 7179 | } |
| 7180 | |
| 7181 | /* no shadow case */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 7182 | void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7183 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7184 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7185 | unsigned char temp, Miscdata; |
| 7186 | unsigned short xres, yres, modeflag, resindex, lvdstableindex; |
| 7187 | unsigned short LVDSHT, LVDSHBS, LVDSHRS, LVDSHRE, LVDSHBE; |
| 7188 | unsigned short LVDSVT, LVDSVBS, LVDSVRS, LVDSVRE, LVDSVBE; |
| 7189 | unsigned short value; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7190 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7191 | lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo); |
| 7192 | temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability |
| 7193 | & (LCDPolarity << 8)) >> 8); |
| 7194 | temp &= LCDPolarity; |
| 7195 | Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7196 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7197 | XGINew_SetReg3(pVBInfo->P3c2, (Miscdata & 0x3F) | temp); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7198 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7199 | temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability |
| 7200 | & LCDPolarity); |
| 7201 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80); /* SR35[7] FP VSync polarity */ |
| 7202 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, ~0x20, (temp & 0x40) >> 1); /* SR30[5] FP HSync polarity */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7203 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7204 | XGI_SetXG27FPBits(pVBInfo); |
| 7205 | resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); |
| 7206 | if (ModeNo <= 0x13) { |
| 7207 | xres = pVBInfo->StResInfo[resindex].HTotal; |
| 7208 | yres = pVBInfo->StResInfo[resindex].VTotal; |
| 7209 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 7210 | } else { |
| 7211 | xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */ |
| 7212 | yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */ |
| 7213 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+St_ModeFlag */ |
| 7214 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7215 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7216 | if (!(modeflag & Charx8Dot)) |
| 7217 | xres = xres * 8 / 9; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7218 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7219 | LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7220 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7221 | LVDSHBS = xres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE |
| 7222 | - xres) / 2; |
| 7223 | if ((ModeNo <= 0x13) && (modeflag & HalfDCLK)) |
| 7224 | LVDSHBS -= xres / 4; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7225 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7226 | if (LVDSHBS > LVDSHT) |
| 7227 | LVDSHBS -= LVDSHT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7228 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7229 | LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP; |
| 7230 | if (LVDSHRS > LVDSHT) |
| 7231 | LVDSHRS -= LVDSHT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7232 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7233 | LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC; |
| 7234 | if (LVDSHRE > LVDSHT) |
| 7235 | LVDSHRE -= LVDSHT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7236 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7237 | LVDSHBE = LVDSHBS + LVDSHT |
| 7238 | - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7239 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7240 | LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7241 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7242 | LVDSVBS = yres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE |
| 7243 | - yres) / 2; |
| 7244 | if ((ModeNo > 0x13) && (modeflag & DoubleScanMode)) |
| 7245 | LVDSVBS += yres / 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7246 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7247 | if (LVDSVBS > LVDSVT) |
| 7248 | LVDSVBS -= LVDSVT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7249 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7250 | LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP; |
| 7251 | if (LVDSVRS > LVDSVT) |
| 7252 | LVDSVRS -= LVDSVT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7253 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7254 | LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC; |
| 7255 | if (LVDSVRE > LVDSVT) |
| 7256 | LVDSVRE -= LVDSVT; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7257 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7258 | LVDSVBE = LVDSVBS + LVDSVT |
| 7259 | - pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7260 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7261 | temp = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11); |
| 7262 | XGINew_SetReg1(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7263 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7264 | if (!(modeflag & Charx8Dot)) |
| 7265 | XGINew_SetRegOR(pVBInfo->P3c4, 0x1, 0x1); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7266 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7267 | /* HT SR0B[1:0] CR00 */ |
| 7268 | value = (LVDSHT >> 3) - 5; |
| 7269 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0x03, (value & 0x300) >> 8); |
| 7270 | XGINew_SetReg1(pVBInfo->P3d4, 0x0, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7271 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7272 | /* HBS SR0B[5:4] CR02 */ |
| 7273 | value = (LVDSHBS >> 3) - 1; |
| 7274 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0x30, (value & 0x300) >> 4); |
| 7275 | XGINew_SetReg1(pVBInfo->P3d4, 0x2, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7276 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7277 | /* HBE SR0C[1:0] CR05[7] CR03[4:0] */ |
| 7278 | value = (LVDSHBE >> 3) - 1; |
| 7279 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0C, ~0x03, (value & 0xC0) >> 6); |
| 7280 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x05, ~0x80, (value & 0x20) << 2); |
| 7281 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x03, ~0x1F, value & 0x1F); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7282 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7283 | /* HRS SR0B[7:6] CR04 */ |
| 7284 | value = (LVDSHRS >> 3) + 2; |
| 7285 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0xC0, (value & 0x300) >> 2); |
| 7286 | XGINew_SetReg1(pVBInfo->P3d4, 0x4, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7287 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7288 | /* Panel HRS SR2F[1:0] SR2E[7:0] */ |
| 7289 | value--; |
| 7290 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x2F, ~0x03, (value & 0x300) >> 8); |
| 7291 | XGINew_SetReg1(pVBInfo->P3c4, 0x2E, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7292 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7293 | /* HRE SR0C[2] CR05[4:0] */ |
| 7294 | value = (LVDSHRE >> 3) + 2; |
| 7295 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0C, ~0x04, (value & 0x20) >> 3); |
| 7296 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x05, ~0x1F, value & 0x1F); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7297 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7298 | /* Panel HRE SR2F[7:2] */ |
| 7299 | value--; |
| 7300 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x2F, ~0xFC, value << 2); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7301 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7302 | /* VT SR0A[0] CR07[5][0] CR06 */ |
| 7303 | value = LVDSVT - 2; |
| 7304 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x01, (value & 0x400) >> 10); |
| 7305 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x20, (value & 0x200) >> 4); |
| 7306 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x01, (value & 0x100) >> 8); |
| 7307 | XGINew_SetReg1(pVBInfo->P3d4, 0x06, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7308 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7309 | /* VBS SR0A[2] CR09[5] CR07[3] CR15 */ |
| 7310 | value = LVDSVBS - 1; |
| 7311 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x04, (value & 0x400) >> 8); |
| 7312 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x09, ~0x20, (value & 0x200) >> 4); |
| 7313 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x08, (value & 0x100) >> 5); |
| 7314 | XGINew_SetReg1(pVBInfo->P3d4, 0x15, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7315 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7316 | /* VBE SR0A[4] CR16 */ |
| 7317 | value = LVDSVBE - 1; |
| 7318 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4); |
| 7319 | XGINew_SetReg1(pVBInfo->P3d4, 0x16, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7320 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7321 | /* VRS SR0A[3] CR7[7][2] CR10 */ |
| 7322 | value = LVDSVRS - 1; |
| 7323 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x08, (value & 0x400) >> 7); |
| 7324 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x80, (value & 0x200) >> 2); |
| 7325 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x04, (value & 0x100) >> 6); |
| 7326 | XGINew_SetReg1(pVBInfo->P3d4, 0x10, (value & 0xFF)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7327 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7328 | /* Panel VRS SR35[2:0] SR34[7:0] */ |
| 7329 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x07, (value & 0x700) >> 8); |
| 7330 | XGINew_SetReg1(pVBInfo->P3c4, 0x34, value & 0xFF); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7331 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7332 | /* VRE SR0A[5] CR11[3:0] */ |
| 7333 | value = LVDSVRE - 1; |
| 7334 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x20, (value & 0x10) << 1); |
| 7335 | XGINew_SetRegANDOR(pVBInfo->P3d4, 0x11, ~0x0F, value & 0x0F); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7336 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7337 | /* Panel VRE SR3F[7:2] */ |
| 7338 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0xFC, (value << 2) & 0xFC); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7339 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7340 | for (temp = 0, value = 0; temp < 3; temp++) { |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7341 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7342 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x31, ~0x30, value); |
| 7343 | XGINew_SetReg1(pVBInfo->P3c4, |
| 7344 | 0x2B, |
| 7345 | pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1); |
| 7346 | XGINew_SetReg1(pVBInfo->P3c4, |
| 7347 | 0x2C, |
| 7348 | pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2); |
| 7349 | value += 0x10; |
| 7350 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7351 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7352 | if (!(modeflag & Charx8Dot)) { |
| 7353 | XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */ |
| 7354 | XGINew_SetReg3(pVBInfo->P3c0, 0x13); /* set index */ |
| 7355 | XGINew_SetReg3(pVBInfo->P3c0, 0x00); /* set data, panning = 0, shift left 1 dot*/ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7356 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7357 | XGINew_GetReg2(pVBInfo->P3da); /* Enable Attribute */ |
| 7358 | XGINew_SetReg3(pVBInfo->P3c0, 0x20); |
| 7359 | |
| 7360 | XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */ |
| 7361 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7362 | |
| 7363 | } |
| 7364 | |
| 7365 | /* --------------------------------------------------------------------- */ |
| 7366 | /* Function : XGI_IsLCDON */ |
| 7367 | /* Input : */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 7368 | /* Output : 0 : Skip PSC Control */ |
| 7369 | /* 1: Disable PSC */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7370 | /* Description : */ |
| 7371 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 7372 | unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7373 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7374 | unsigned short tempax; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7375 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7376 | tempax = pVBInfo->VBInfo; |
| 7377 | if (tempax & SetCRT2ToDualEdge) |
| 7378 | return 0; |
| 7379 | else if (tempax & (DisableCRT2Display | SwitchToCRT2 | SetSimuScanMode)) |
| 7380 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7381 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7382 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7383 | } |
| 7384 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 7385 | void XGI_EnablePWD(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7386 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7387 | unsigned short index, temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7388 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7389 | index = XGI_GetLCDCapPtr(pVBInfo); |
| 7390 | temp = pVBInfo->LCDCapList[index].PWD_2B; |
| 7391 | XGINew_SetReg1(pVBInfo->Part4Port, 0x2B, temp); |
| 7392 | XGINew_SetReg1(pVBInfo->Part4Port, 0x2C, |
| 7393 | pVBInfo->LCDCapList[index].PWD_2C); |
| 7394 | XGINew_SetReg1(pVBInfo->Part4Port, 0x2D, |
| 7395 | pVBInfo->LCDCapList[index].PWD_2D); |
| 7396 | XGINew_SetReg1(pVBInfo->Part4Port, 0x2E, |
| 7397 | pVBInfo->LCDCapList[index].PWD_2E); |
| 7398 | XGINew_SetReg1(pVBInfo->Part4Port, 0x2F, |
| 7399 | pVBInfo->LCDCapList[index].PWD_2F); |
| 7400 | XGINew_SetRegOR(pVBInfo->Part4Port, 0x27, 0x80); /* enable PWD */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7401 | } |
| 7402 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 7403 | void XGI_DisablePWD(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7404 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7405 | XGINew_SetRegAND(pVBInfo->Part4Port, 0x27, 0x7F); /* disable PWD */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7406 | } |
| 7407 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7408 | /* --------------------------------------------------------------------- */ |
| 7409 | /* Function : XGI_DisableChISLCD */ |
| 7410 | /* Input : */ |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 7411 | /* Output : 0 -> Not LCD Mode */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7412 | /* Description : */ |
| 7413 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 7414 | unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7415 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7416 | unsigned short tempbx, tempah; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7417 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7418 | tempbx = pVBInfo->SetFlag & (DisableChA | DisableChB); |
| 7419 | tempah = ~((unsigned short) XGINew_GetReg1(pVBInfo->Part1Port, 0x2E)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7420 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7421 | if (tempbx & (EnableChA | DisableChA)) { |
| 7422 | if (!(tempah & 0x08)) /* Chk LCDA Mode */ |
| 7423 | return 0; |
| 7424 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7425 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7426 | if (!(tempbx & (EnableChB | DisableChB))) |
| 7427 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7428 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7429 | if (tempah & 0x01) /* Chk LCDB Mode */ |
| 7430 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7431 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7432 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7433 | } |
| 7434 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7435 | /* --------------------------------------------------------------------- */ |
| 7436 | /* Function : XGI_EnableChISLCD */ |
| 7437 | /* Input : */ |
| 7438 | /* Output : 0 -> Not LCD mode */ |
| 7439 | /* Description : */ |
| 7440 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 7441 | unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7442 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7443 | unsigned short tempbx, tempah; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7444 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7445 | tempbx = pVBInfo->SetFlag & (EnableChA | EnableChB); |
| 7446 | tempah = ~((unsigned short) XGINew_GetReg1(pVBInfo->Part1Port, 0x2E)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7447 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7448 | if (tempbx & (EnableChA | DisableChA)) { |
| 7449 | if (!(tempah & 0x08)) /* Chk LCDA Mode */ |
| 7450 | return 0; |
| 7451 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7452 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7453 | if (!(tempbx & (EnableChB | DisableChB))) |
Bill Pemberton | dda08c5 | 2010-06-17 13:10:42 -0400 | [diff] [blame] | 7454 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7455 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7456 | if (tempah & 0x01) /* Chk LCDB Mode */ |
| 7457 | return 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7458 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7459 | return 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7460 | } |
| 7461 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 7462 | unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7463 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7464 | unsigned char tempal, tempah, tempbl, i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7465 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7466 | tempah = XGINew_GetReg1(pVBInfo->P3d4, 0x36); |
| 7467 | tempal = tempah & 0x0F; |
| 7468 | tempah = tempah & 0xF0; |
| 7469 | i = 0; |
| 7470 | tempbl = pVBInfo->LCDCapList[i].LCD_ID; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7471 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7472 | while (tempbl != 0xFF) { |
| 7473 | if (tempbl & 0x80) { /* OEMUtil */ |
| 7474 | tempal = tempah; |
| 7475 | tempbl = tempbl & ~(0x80); |
| 7476 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7477 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7478 | if (tempal == tempbl) |
| 7479 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7480 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7481 | i++; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7482 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7483 | tempbl = pVBInfo->LCDCapList[i].LCD_ID; |
| 7484 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7485 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7486 | return i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7487 | } |
| 7488 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 7489 | unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7490 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7491 | unsigned short tempah, tempal, tempbl, i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7492 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7493 | tempal = pVBInfo->LCDResInfo; |
| 7494 | tempah = pVBInfo->LCDTypeInfo; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7495 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7496 | i = 0; |
| 7497 | tempbl = pVBInfo->LCDCapList[i].LCD_ID; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7498 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7499 | while (tempbl != 0xFF) { |
| 7500 | if ((tempbl & 0x80) && (tempbl != 0x80)) { |
| 7501 | tempal = tempah; |
| 7502 | tempbl &= ~0x80; |
| 7503 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7504 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7505 | if (tempal == tempbl) |
| 7506 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7507 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7508 | i++; |
| 7509 | tempbl = pVBInfo->LCDCapList[i].LCD_ID; |
| 7510 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7511 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7512 | if (tempbl == 0xFF) { |
| 7513 | pVBInfo->LCDResInfo = Panel1024x768; |
| 7514 | pVBInfo->LCDTypeInfo = 0; |
| 7515 | i = 0; |
| 7516 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7517 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7518 | return i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7519 | } |
| 7520 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7521 | void XGI_GetLCDSync(unsigned short *HSyncWidth, unsigned short *VSyncWidth, |
| 7522 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7523 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7524 | unsigned short Index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7525 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7526 | Index = XGI_GetLCDCapPtr(pVBInfo); |
| 7527 | *HSyncWidth = pVBInfo->LCDCapList[Index].LCD_HSyncWidth; |
| 7528 | *VSyncWidth = pVBInfo->LCDCapList[Index].LCD_VSyncWidth; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7529 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7530 | return; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7531 | } |
| 7532 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7533 | void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, |
| 7534 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7535 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7536 | unsigned short tempbl, tempah; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7537 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7538 | if (pVBInfo->SetFlag == Win9xDOSMode) { |
| 7539 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 7540 | | VB_XGI302LV | VB_XGI301C)) { |
| 7541 | XGI_DisplayOn(HwDeviceExtension, pVBInfo); |
| 7542 | return; |
| 7543 | } else |
| 7544 | /* LVDS or CH7017 */ |
| 7545 | return; |
| 7546 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7547 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7548 | if (HwDeviceExtension->jChipType < XG40) { |
| 7549 | if (!XGI_DisableChISLCD(pVBInfo)) { |
| 7550 | if ((XGI_EnableChISLCD(pVBInfo)) || (pVBInfo->VBInfo |
| 7551 | & (SetCRT2ToLCD | SetCRT2ToLCDA))) { |
| 7552 | if (pVBInfo->LCDInfo & SetPWDEnable) { |
| 7553 | XGI_EnablePWD(pVBInfo); |
| 7554 | } else { |
| 7555 | pVBInfo->LCDInfo &= (~SetPWDEnable); |
| 7556 | if (pVBInfo->VBType & (VB_XGI301LV |
| 7557 | | VB_XGI302LV |
| 7558 | | VB_XGI301C)) { |
| 7559 | tempbl = 0xFD; |
| 7560 | tempah = 0x02; |
| 7561 | } else { |
| 7562 | tempbl = 0xFB; |
| 7563 | tempah = 0x00; |
| 7564 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7565 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7566 | XGI_SetPanelPower(tempah, tempbl, |
| 7567 | pVBInfo); |
| 7568 | XGI_SetPanelDelay(1, pVBInfo); |
| 7569 | } |
| 7570 | } |
| 7571 | } |
| 7572 | } /* Not 340 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7573 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7574 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 7575 | | VB_XGI302LV | VB_XGI301C)) { |
| 7576 | if (!(pVBInfo->SetFlag & DisableChA)) { |
| 7577 | if (pVBInfo->SetFlag & EnableChA) { |
| 7578 | XGINew_SetReg1(pVBInfo->Part1Port, 0x1E, 0x20); /* Power on */ |
| 7579 | } else { |
| 7580 | if (pVBInfo->VBInfo & SetCRT2ToDualEdge) { /* SetCRT2ToLCDA ) */ |
| 7581 | XGINew_SetReg1(pVBInfo->Part1Port, |
| 7582 | 0x1E, 0x20); /* Power on */ |
| 7583 | } |
| 7584 | } |
| 7585 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7586 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7587 | if (!(pVBInfo->SetFlag & DisableChB)) { |
| 7588 | if ((pVBInfo->SetFlag & EnableChB) || (pVBInfo->VBInfo |
| 7589 | & (SetCRT2ToLCD | SetCRT2ToTV |
| 7590 | | SetCRT2ToRAMDAC))) { |
| 7591 | tempah = (unsigned char) XGINew_GetReg1( |
| 7592 | pVBInfo->P3c4, 0x32); |
| 7593 | tempah &= 0xDF; |
| 7594 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 7595 | if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) |
| 7596 | tempah |= 0x20; |
| 7597 | } |
| 7598 | XGINew_SetReg1(pVBInfo->P3c4, 0x32, tempah); |
| 7599 | XGINew_SetRegOR(pVBInfo->P3c4, 0x1E, 0x20); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7600 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7601 | tempah = (unsigned char) XGINew_GetReg1( |
| 7602 | pVBInfo->Part1Port, 0x2E); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7603 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7604 | if (!(tempah & 0x80)) |
| 7605 | XGINew_SetRegOR(pVBInfo->Part1Port, |
| 7606 | 0x2E, 0x80); /* BVBDOENABLE = 1 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7607 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7608 | XGINew_SetRegAND(pVBInfo->Part1Port, 0x00, 0x7F); /* BScreenOFF = 0 */ |
| 7609 | } |
| 7610 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7611 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7612 | if ((pVBInfo->SetFlag & (EnableChA | EnableChB)) |
| 7613 | || (!(pVBInfo->VBInfo & DisableCRT2Display))) { |
| 7614 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x00, ~0xE0, |
| 7615 | 0x20); /* shampoo 0129 */ |
| 7616 | if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) { |
| 7617 | if (!XGI_DisableChISLCD(pVBInfo)) { |
| 7618 | if (XGI_EnableChISLCD(pVBInfo) |
| 7619 | || (pVBInfo->VBInfo |
| 7620 | & (SetCRT2ToLCD |
| 7621 | | SetCRT2ToLCDA))) |
| 7622 | XGINew_SetRegAND( |
| 7623 | pVBInfo->Part4Port, |
| 7624 | 0x2A, 0x7F); /* LVDS PLL power on */ |
| 7625 | } |
| 7626 | XGINew_SetRegAND(pVBInfo->Part4Port, 0x30, 0x7F); /* LVDS Driver power on */ |
| 7627 | } |
| 7628 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7629 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7630 | tempah = 0x00; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7631 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7632 | if (!(pVBInfo->VBInfo & DisableCRT2Display)) { |
| 7633 | tempah = 0xc0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7634 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7635 | if (!(pVBInfo->VBInfo & SetSimuScanMode)) { |
| 7636 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) { |
| 7637 | if (pVBInfo->VBInfo & SetCRT2ToDualEdge) { |
| 7638 | tempah = tempah & 0x40; |
| 7639 | if (pVBInfo->VBInfo |
| 7640 | & SetCRT2ToLCDA) |
| 7641 | tempah = tempah ^ 0xC0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7642 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7643 | if (pVBInfo->SetFlag |
| 7644 | & DisableChB) |
| 7645 | tempah &= 0xBF; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7646 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7647 | if (pVBInfo->SetFlag |
| 7648 | & DisableChA) |
| 7649 | tempah &= 0x7F; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7650 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7651 | if (pVBInfo->SetFlag |
| 7652 | & EnableChB) |
| 7653 | tempah |= 0x40; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7654 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7655 | if (pVBInfo->SetFlag |
| 7656 | & EnableChA) |
| 7657 | tempah |= 0x80; |
| 7658 | } |
| 7659 | } |
| 7660 | } |
| 7661 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7662 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7663 | XGINew_SetRegOR(pVBInfo->Part4Port, 0x1F, tempah); /* EnablePart4_1F */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7664 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7665 | if (pVBInfo->SetFlag & Win9xDOSMode) { |
| 7666 | XGI_DisplayOn(HwDeviceExtension, pVBInfo); |
| 7667 | return; |
| 7668 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7669 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7670 | if (!(pVBInfo->SetFlag & DisableChA)) { |
| 7671 | XGI_VBLongWait(pVBInfo); |
| 7672 | if (!(pVBInfo->SetFlag & GatingCRT)) { |
| 7673 | XGI_DisableGatingCRT(HwDeviceExtension, pVBInfo); |
| 7674 | XGI_DisplayOn(HwDeviceExtension, pVBInfo); |
| 7675 | XGI_VBLongWait(pVBInfo); |
| 7676 | } |
| 7677 | } |
| 7678 | } /* 301 */ |
| 7679 | else { /* LVDS */ |
| 7680 | if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD |
| 7681 | | SetCRT2ToLCDA)) |
| 7682 | XGINew_SetRegOR(pVBInfo->Part1Port, 0x1E, 0x20); /* enable CRT2 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7683 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7684 | tempah = (unsigned char) XGINew_GetReg1(pVBInfo->Part1Port, |
| 7685 | 0x2E); |
| 7686 | if (!(tempah & 0x80)) |
| 7687 | XGINew_SetRegOR(pVBInfo->Part1Port, 0x2E, 0x80); /* BVBDOENABLE = 1 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7688 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7689 | XGINew_SetRegAND(pVBInfo->Part1Port, 0x00, 0x7F); |
| 7690 | XGI_DisplayOn(HwDeviceExtension, pVBInfo); |
| 7691 | } /* End of VB */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7692 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7693 | if (HwDeviceExtension->jChipType < XG40) { |
| 7694 | if (!XGI_EnableChISLCD(pVBInfo)) { |
| 7695 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { |
| 7696 | if (XGI_BacklightByDrv(pVBInfo)) |
| 7697 | return; |
| 7698 | } else |
| 7699 | return; |
| 7700 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7701 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7702 | if (pVBInfo->LCDInfo & SetPWDEnable) { |
| 7703 | XGI_FirePWDEnable(pVBInfo); |
| 7704 | return; |
| 7705 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7706 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7707 | XGI_SetPanelDelay(2, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7708 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7709 | if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) { |
| 7710 | tempah = 0x01; |
| 7711 | tempbl = 0xFE; /* turn on backlght */ |
| 7712 | } else { |
| 7713 | tempbl = 0xF7; |
| 7714 | tempah = 0x00; |
| 7715 | } |
| 7716 | XGI_SetPanelPower(tempah, tempbl, pVBInfo); |
| 7717 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7718 | } |
| 7719 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7720 | void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, |
| 7721 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7722 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7723 | unsigned short tempax, tempbx, tempah = 0, tempbl = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7724 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7725 | if (pVBInfo->SetFlag == Win9xDOSMode) |
| 7726 | return; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7727 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7728 | if (HwDeviceExtension->jChipType < XG40) { |
| 7729 | if ((!(pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) |
| 7730 | || (XGI_DisableChISLCD(pVBInfo))) { |
| 7731 | if (!XGI_IsLCDON(pVBInfo)) { |
| 7732 | if (pVBInfo->LCDInfo & SetPWDEnable) |
| 7733 | XGI_EnablePWD(pVBInfo); |
| 7734 | else { |
| 7735 | pVBInfo->LCDInfo &= ~SetPWDEnable; |
| 7736 | XGI_DisablePWD(pVBInfo); |
| 7737 | if (pVBInfo->VBType & (VB_XGI301LV |
| 7738 | | VB_XGI302LV |
| 7739 | | VB_XGI301C)) { |
| 7740 | tempbx = 0xFE; /* not 01h */ |
| 7741 | tempax = 0; |
| 7742 | } else { |
| 7743 | tempbx = 0xF7; /* not 08h */ |
| 7744 | tempax = 0x08; |
| 7745 | } |
| 7746 | XGI_SetPanelPower(tempax, tempbx, |
| 7747 | pVBInfo); |
| 7748 | XGI_SetPanelDelay(3, pVBInfo); |
| 7749 | } |
| 7750 | } /* end if (!XGI_IsLCDON(pVBInfo)) */ |
| 7751 | } |
| 7752 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7753 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7754 | /* |
| 7755 | if (CH7017) { |
| 7756 | if (!(pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2toLCDA)) || (XGI_DisableChISLCD(pVBInfo))) { |
| 7757 | if (!XGI_IsLCDON(pVBInfo)) { |
| 7758 | if (DISCHARGE) { |
| 7759 | tempbx = XGINew_GetCH7005(0x61); |
| 7760 | if (tempbx < 0x01) // first time we power up |
| 7761 | XGINew_SetCH7005(0x0066); // and disable power sequence |
| 7762 | else |
| 7763 | XGINew_SetCH7005(0x5f66); // leave VDD on - disable power |
| 7764 | } |
| 7765 | } |
| 7766 | } |
| 7767 | } |
| 7768 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7769 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7770 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 7771 | | VB_XGI302LV | VB_XGI301C)) { |
| 7772 | tempah = 0x3F; |
| 7773 | if (!(pVBInfo->VBInfo & (DisableCRT2Display | SetSimuScanMode))) { |
| 7774 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) { |
| 7775 | if (pVBInfo->VBInfo & SetCRT2ToDualEdge) { |
| 7776 | tempah = 0x7F; /* Disable Channel A */ |
| 7777 | if (!(pVBInfo->VBInfo & SetCRT2ToLCDA)) |
| 7778 | tempah = 0xBF; /* Disable Channel B */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7779 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7780 | if (pVBInfo->SetFlag & DisableChB) |
| 7781 | tempah &= 0xBF; /* force to disable Cahnnel */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7782 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7783 | if (pVBInfo->SetFlag & DisableChA) |
| 7784 | tempah &= 0x7F; /* Force to disable Channel B */ |
| 7785 | } |
| 7786 | } |
| 7787 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7788 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7789 | XGINew_SetRegAND(pVBInfo->Part4Port, 0x1F, tempah); /* disable part4_1f */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7790 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7791 | if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) { |
| 7792 | if (((pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) |
| 7793 | || (XGI_DisableChISLCD(pVBInfo)) |
| 7794 | || (XGI_IsLCDON(pVBInfo))) |
| 7795 | XGINew_SetRegOR(pVBInfo->Part4Port, 0x30, 0x80); /* LVDS Driver power down */ |
| 7796 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7797 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7798 | if ((pVBInfo->SetFlag & DisableChA) || (pVBInfo->VBInfo |
| 7799 | & (DisableCRT2Display | SetCRT2ToLCDA |
| 7800 | | SetSimuScanMode))) { |
| 7801 | if (pVBInfo->SetFlag & GatingCRT) |
| 7802 | XGI_EnableGatingCRT(HwDeviceExtension, pVBInfo); |
| 7803 | XGI_DisplayOff(HwDeviceExtension, pVBInfo); |
| 7804 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7805 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7806 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) { |
| 7807 | if ((pVBInfo->SetFlag & DisableChA) || (pVBInfo->VBInfo |
| 7808 | & SetCRT2ToLCDA)) |
| 7809 | XGINew_SetRegAND(pVBInfo->Part1Port, 0x1e, 0xdf); /* Power down */ |
| 7810 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7811 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7812 | XGINew_SetRegAND(pVBInfo->P3c4, 0x32, 0xdf); /* disable TV as primary VGA swap */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7813 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7814 | if ((pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToDualEdge))) |
| 7815 | XGINew_SetRegAND(pVBInfo->Part2Port, 0x00, 0xdf); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7816 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7817 | if ((pVBInfo->SetFlag & DisableChB) || (pVBInfo->VBInfo |
| 7818 | & (DisableCRT2Display | SetSimuScanMode)) |
| 7819 | || ((!(pVBInfo->VBInfo & SetCRT2ToLCDA)) |
| 7820 | && (pVBInfo->VBInfo |
| 7821 | & (SetCRT2ToRAMDAC |
| 7822 | | SetCRT2ToLCD |
| 7823 | | SetCRT2ToTV)))) |
| 7824 | XGINew_SetRegOR(pVBInfo->Part1Port, 0x00, 0x80); /* BScreenOff=1 */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7825 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7826 | if ((pVBInfo->SetFlag & DisableChB) || (pVBInfo->VBInfo |
| 7827 | & (DisableCRT2Display | SetSimuScanMode)) |
| 7828 | || (!(pVBInfo->VBInfo & SetCRT2ToLCDA)) |
| 7829 | || (pVBInfo->VBInfo & (SetCRT2ToRAMDAC |
| 7830 | | SetCRT2ToLCD | SetCRT2ToTV))) { |
| 7831 | tempah = XGINew_GetReg1(pVBInfo->Part1Port, 0x00); /* save Part1 index 0 */ |
| 7832 | XGINew_SetRegOR(pVBInfo->Part1Port, 0x00, 0x10); /* BTDAC = 1, avoid VB reset */ |
| 7833 | XGINew_SetRegAND(pVBInfo->Part1Port, 0x1E, 0xDF); /* disable CRT2 */ |
| 7834 | XGINew_SetReg1(pVBInfo->Part1Port, 0x00, tempah); /* restore Part1 index 0 */ |
| 7835 | } |
| 7836 | } else { /* {301} */ |
| 7837 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { |
| 7838 | XGINew_SetRegOR(pVBInfo->Part1Port, 0x00, 0x80); /* BScreenOff=1 */ |
| 7839 | XGINew_SetRegAND(pVBInfo->Part1Port, 0x1E, 0xDF); /* Disable CRT2 */ |
| 7840 | XGINew_SetRegAND(pVBInfo->P3c4, 0x32, 0xDF); /* Disable TV asPrimary VGA swap */ |
| 7841 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7842 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7843 | if (pVBInfo->VBInfo & (DisableCRT2Display | SetCRT2ToLCDA |
| 7844 | | SetSimuScanMode)) |
| 7845 | XGI_DisplayOff(HwDeviceExtension, pVBInfo); |
| 7846 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7847 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7848 | if (HwDeviceExtension->jChipType < XG40) { |
| 7849 | if (!(pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) |
| 7850 | || (XGI_DisableChISLCD(pVBInfo)) |
| 7851 | || (XGI_IsLCDON(pVBInfo))) { |
| 7852 | if (pVBInfo->LCDInfo & SetPWDEnable) { |
| 7853 | if (pVBInfo->LCDInfo & SetPWDEnable) |
| 7854 | XGI_BacklightByDrv(pVBInfo); |
| 7855 | else { |
| 7856 | XGI_SetPanelDelay(4, pVBInfo); |
| 7857 | if (pVBInfo->VBType & VB_XGI301LV) { |
| 7858 | tempbl = 0xFD; |
| 7859 | tempah = 0x00; |
| 7860 | } else { |
| 7861 | tempbl = 0xFB; |
| 7862 | tempah = 0x04; |
| 7863 | } |
| 7864 | } |
| 7865 | } |
| 7866 | XGI_SetPanelPower(tempah, tempbl, pVBInfo); |
| 7867 | } |
| 7868 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7869 | } |
| 7870 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7871 | /* --------------------------------------------------------------------- */ |
| 7872 | /* Function : XGI_GetTVPtrIndex */ |
| 7873 | /* Input : */ |
| 7874 | /* Output : */ |
| 7875 | /* Description : bx 0 : ExtNTSC */ |
| 7876 | /* 1 : StNTSC */ |
| 7877 | /* 2 : ExtPAL */ |
| 7878 | /* 3 : StPAL */ |
| 7879 | /* 4 : ExtHiTV */ |
| 7880 | /* 5 : StHiTV */ |
| 7881 | /* 6 : Ext525i */ |
| 7882 | /* 7 : St525i */ |
| 7883 | /* 8 : Ext525p */ |
| 7884 | /* 9 : St525p */ |
| 7885 | /* A : Ext750p */ |
| 7886 | /* B : St750p */ |
| 7887 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 7888 | unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7889 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7890 | unsigned short tempbx = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7891 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7892 | if (pVBInfo->TVInfo & SetPALTV) |
| 7893 | tempbx = 2; |
| 7894 | if (pVBInfo->TVInfo & SetYPbPrMode1080i) |
| 7895 | tempbx = 4; |
| 7896 | if (pVBInfo->TVInfo & SetYPbPrMode525i) |
| 7897 | tempbx = 6; |
| 7898 | if (pVBInfo->TVInfo & SetYPbPrMode525p) |
| 7899 | tempbx = 8; |
| 7900 | if (pVBInfo->TVInfo & SetYPbPrMode750p) |
| 7901 | tempbx = 10; |
| 7902 | if (pVBInfo->TVInfo & TVSimuMode) |
| 7903 | tempbx++; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7904 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7905 | return tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7906 | } |
| 7907 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7908 | /* --------------------------------------------------------------------- */ |
| 7909 | /* Function : XGI_OEM310Setting */ |
| 7910 | /* Input : */ |
| 7911 | /* Output : */ |
| 7912 | /* Description : Customized Param. for 301 */ |
| 7913 | /* --------------------------------------------------------------------- */ |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7914 | void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 7915 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7916 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7917 | if (pVBInfo->SetFlag & Win9xDOSMode) |
| 7918 | return; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7919 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7920 | /* GetPart1IO(); */ |
| 7921 | XGI_SetDelayComp(pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7922 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7923 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) |
| 7924 | XGI_SetLCDCap(pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7925 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7926 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 7927 | /* GetPart2IO() */ |
| 7928 | XGI_SetPhaseIncr(pVBInfo); |
| 7929 | XGI_SetYFilter(ModeNo, ModeIdIndex, pVBInfo); |
| 7930 | XGI_SetAntiFlicker(ModeNo, ModeIdIndex, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7931 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7932 | if (pVBInfo->VBType & VB_XGI301) |
| 7933 | XGI_SetEdgeEnhance(ModeNo, ModeIdIndex, pVBInfo); |
| 7934 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7935 | } |
| 7936 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 7937 | void XGI_SetDelayComp(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7938 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7939 | unsigned short index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7940 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7941 | unsigned char tempah, tempbl, tempbh; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7942 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7943 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 7944 | | VB_XGI302LV | VB_XGI301C)) { |
| 7945 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA |
| 7946 | | SetCRT2ToTV | SetCRT2ToRAMDAC)) { |
| 7947 | tempbl = 0; |
| 7948 | tempbh = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7949 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7950 | index = XGI_GetTVPtrIndex(pVBInfo); /* Get TV Delay */ |
| 7951 | tempbl = pVBInfo->XGI_TVDelayList[index]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7952 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7953 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B |
| 7954 | | VB_XGI301LV | VB_XGI302LV |
| 7955 | | VB_XGI301C)) |
| 7956 | tempbl = pVBInfo->XGI_TVDelayList2[index]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7957 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7958 | if (pVBInfo->VBInfo & SetCRT2ToDualEdge) |
| 7959 | tempbl = tempbl >> 4; |
| 7960 | /* |
| 7961 | if (pVBInfo->VBInfo & SetCRT2ToRAMDAC) |
| 7962 | tempbl = CRT2Delay1; // Get CRT2 Delay |
| 7963 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) |
| 7964 | tempbl = CRT2Delay2; |
| 7965 | */ |
| 7966 | if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { |
| 7967 | index = XGI_GetLCDCapPtr(pVBInfo); /* Get LCD Delay */ |
| 7968 | tempbh = pVBInfo->LCDCapList[index].LCD_DelayCompensation; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7969 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7970 | if (!(pVBInfo->VBInfo & SetCRT2ToLCDA)) |
| 7971 | tempbl = tempbh; |
| 7972 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7973 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7974 | tempbl &= 0x0F; |
| 7975 | tempbh &= 0xF0; |
| 7976 | tempah = XGINew_GetReg1(pVBInfo->Part1Port, 0x2D); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7977 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7978 | if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD |
| 7979 | | SetCRT2ToTV)) { /* Channel B */ |
| 7980 | tempah &= 0xF0; |
| 7981 | tempah |= tempbl; |
| 7982 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 7983 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 7984 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) { /* Channel A */ |
| 7985 | tempah &= 0x0F; |
| 7986 | tempah |= tempbh; |
| 7987 | } |
| 7988 | XGINew_SetReg1(pVBInfo->Part1Port, 0x2D, tempah); |
| 7989 | } |
| 7990 | } else if (pVBInfo->IF_DEF_LVDS == 1) { |
| 7991 | tempbl = 0; |
| 7992 | tempbh = 0; |
| 7993 | if (pVBInfo->VBInfo & SetCRT2ToLCD) { |
| 7994 | tempah |
| 7995 | = pVBInfo->LCDCapList[XGI_GetLCDCapPtr( |
| 7996 | pVBInfo)].LCD_DelayCompensation; /* / Get LCD Delay */ |
| 7997 | tempah &= 0x0f; |
| 7998 | tempah = tempah << 4; |
| 7999 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2D, 0x0f, |
| 8000 | tempah); |
| 8001 | } |
| 8002 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8003 | } |
| 8004 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 8005 | void XGI_SetLCDCap(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8006 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8007 | unsigned short tempcx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8008 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8009 | tempcx = pVBInfo->LCDCapList[XGI_GetLCDCapPtr(pVBInfo)].LCD_Capability; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8010 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8011 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 8012 | | VB_XGI302LV | VB_XGI301C)) { |
| 8013 | if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) { /* 301LV/302LV only */ |
| 8014 | /* Set 301LV Capability */ |
| 8015 | XGINew_SetReg1(pVBInfo->Part4Port, 0x24, |
| 8016 | (unsigned char) (tempcx & 0x1F)); |
| 8017 | } |
| 8018 | /* VB Driving */ |
| 8019 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0D, |
| 8020 | ~((EnableVBCLKDRVLOW | EnablePLLSPLOW) >> 8), |
| 8021 | (unsigned short) ((tempcx & (EnableVBCLKDRVLOW |
| 8022 | | EnablePLLSPLOW)) >> 8)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8023 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8024 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8025 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 8026 | | VB_XGI302LV | VB_XGI301C)) { |
| 8027 | if (pVBInfo->VBInfo & SetCRT2ToLCD) |
| 8028 | XGI_SetLCDCap_B(tempcx, pVBInfo); |
| 8029 | else if (pVBInfo->VBInfo & SetCRT2ToLCDA) |
| 8030 | XGI_SetLCDCap_A(tempcx, pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8031 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8032 | if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) { |
| 8033 | if (tempcx & EnableSpectrum) |
| 8034 | SetSpectrum(pVBInfo); |
| 8035 | } |
| 8036 | } else { |
| 8037 | /* LVDS,CH7017 */ |
| 8038 | XGI_SetLCDCap_A(tempcx, pVBInfo); |
| 8039 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8040 | } |
| 8041 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 8042 | 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] | 8043 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8044 | unsigned short temp; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8045 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8046 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8047 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8048 | if (temp & LCDRGB18Bit) { |
| 8049 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, |
| 8050 | (unsigned short) (0x20 | (tempcx & 0x00C0))); /* Enable Dither */ |
| 8051 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80); |
| 8052 | } else { |
| 8053 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, |
| 8054 | (unsigned short) (0x30 | (tempcx & 0x00C0))); |
| 8055 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00); |
| 8056 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8057 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8058 | /* |
| 8059 | if (tempcx & EnableLCD24bpp) { // 24bits |
| 8060 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, (unsigned short)(0x30 | (tempcx&0x00C0))); |
| 8061 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00); |
| 8062 | } else { |
| 8063 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, (unsigned short)(0x20 | (tempcx&0x00C0))); // Enable Dither |
| 8064 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80); |
| 8065 | } |
| 8066 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8067 | } |
| 8068 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8069 | /* --------------------------------------------------------------------- */ |
| 8070 | /* Function : XGI_SetLCDCap_B */ |
| 8071 | /* Input : cx -> LCD Capability */ |
| 8072 | /* Output : */ |
| 8073 | /* Description : */ |
| 8074 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 8075 | 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] | 8076 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8077 | if (tempcx & EnableLCD24bpp) /* 24bits */ |
| 8078 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0, |
| 8079 | (unsigned short) (((tempcx & 0x00ff) >> 6) |
| 8080 | | 0x0c)); |
| 8081 | else |
| 8082 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0, |
| 8083 | (unsigned short) (((tempcx & 0x00ff) >> 6) |
| 8084 | | 0x18)); /* Enable Dither */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8085 | } |
| 8086 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 8087 | void SetSpectrum(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8088 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8089 | unsigned short index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8090 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8091 | index = XGI_GetLCDCapPtr(pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8092 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8093 | XGINew_SetRegAND(pVBInfo->Part4Port, 0x30, 0x8F); /* disable down spectrum D[4] */ |
| 8094 | XGI_LongWait(pVBInfo); |
| 8095 | XGINew_SetRegOR(pVBInfo->Part4Port, 0x30, 0x20); /* reset spectrum */ |
| 8096 | XGI_LongWait(pVBInfo); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8097 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8098 | XGINew_SetReg1(pVBInfo->Part4Port, 0x31, |
| 8099 | pVBInfo->LCDCapList[index].Spectrum_31); |
| 8100 | XGINew_SetReg1(pVBInfo->Part4Port, 0x32, |
| 8101 | pVBInfo->LCDCapList[index].Spectrum_32); |
| 8102 | XGINew_SetReg1(pVBInfo->Part4Port, 0x33, |
| 8103 | pVBInfo->LCDCapList[index].Spectrum_33); |
| 8104 | XGINew_SetReg1(pVBInfo->Part4Port, 0x34, |
| 8105 | pVBInfo->LCDCapList[index].Spectrum_34); |
| 8106 | XGI_LongWait(pVBInfo); |
| 8107 | XGINew_SetRegOR(pVBInfo->Part4Port, 0x30, 0x40); /* enable spectrum */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8108 | } |
| 8109 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8110 | /* --------------------------------------------------------------------- */ |
| 8111 | /* Function : XGI_SetAntiFlicker */ |
| 8112 | /* Input : */ |
| 8113 | /* Output : */ |
| 8114 | /* Description : Set TV Customized Param. */ |
| 8115 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8116 | void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8117 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8118 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8119 | unsigned short tempbx, index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8120 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8121 | unsigned char tempah; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8122 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8123 | if (pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p)) |
| 8124 | return; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8125 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8126 | tempbx = XGI_GetTVPtrIndex(pVBInfo); |
| 8127 | tempbx &= 0xFE; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8128 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8129 | if (ModeNo <= 0x13) |
| 8130 | index = pVBInfo->SModeIDTable[ModeIdIndex].VB_StTVFlickerIndex; |
| 8131 | else |
| 8132 | index = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVFlickerIndex; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8133 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8134 | tempbx += index; |
| 8135 | tempah = TVAntiFlickList[tempbx]; |
| 8136 | tempah = tempah << 4; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8137 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8138 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0A, 0x8F, tempah); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8139 | } |
| 8140 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8141 | void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 8142 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8143 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8144 | unsigned short tempbx, index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8145 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8146 | unsigned char tempah; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8147 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8148 | tempbx = XGI_GetTVPtrIndex(pVBInfo); |
| 8149 | tempbx &= 0xFE; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8150 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8151 | if (ModeNo <= 0x13) |
| 8152 | index = pVBInfo->SModeIDTable[ModeIdIndex].VB_StTVEdgeIndex; |
| 8153 | else |
| 8154 | index = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVEdgeIndex; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8155 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8156 | tempbx += index; |
| 8157 | tempah = TVEdgeList[tempbx]; |
| 8158 | tempah = tempah << 5; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8159 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8160 | XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x3A, 0x1F, tempah); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8161 | } |
| 8162 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 8163 | void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8164 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8165 | unsigned short tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8166 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8167 | unsigned char tempcl, tempch; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8168 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8169 | unsigned long tempData; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8170 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8171 | XGI_GetTVPtrIndex2(&tempbx, &tempcl, &tempch, pVBInfo); /* bx, cl, ch */ |
| 8172 | tempData = TVPhaseList[tempbx]; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8173 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8174 | XGINew_SetReg1(pVBInfo->Part2Port, 0x31, (unsigned short) (tempData |
| 8175 | & 0x000000FF)); |
| 8176 | XGINew_SetReg1(pVBInfo->Part2Port, 0x32, (unsigned short) ((tempData |
| 8177 | & 0x0000FF00) >> 8)); |
| 8178 | XGINew_SetReg1(pVBInfo->Part2Port, 0x33, (unsigned short) ((tempData |
| 8179 | & 0x00FF0000) >> 16)); |
| 8180 | XGINew_SetReg1(pVBInfo->Part2Port, 0x34, (unsigned short) ((tempData |
| 8181 | & 0xFF000000) >> 24)); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8182 | } |
| 8183 | |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8184 | void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8185 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8186 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8187 | unsigned short tempbx, index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8188 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8189 | unsigned char tempcl, tempch, tempal, *filterPtr; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8190 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8191 | XGI_GetTVPtrIndex2(&tempbx, &tempcl, &tempch, pVBInfo); /* bx, cl, ch */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8192 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8193 | switch (tempbx) { |
| 8194 | case 0x00: |
| 8195 | case 0x04: |
| 8196 | filterPtr = NTSCYFilter1; |
| 8197 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8198 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8199 | case 0x01: |
| 8200 | filterPtr = PALYFilter1; |
| 8201 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8202 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8203 | case 0x02: |
| 8204 | case 0x05: |
| 8205 | case 0x0D: |
| 8206 | filterPtr = PALMYFilter1; |
| 8207 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8208 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8209 | case 0x03: |
| 8210 | filterPtr = PALNYFilter1; |
| 8211 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8212 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8213 | case 0x08: |
| 8214 | case 0x0C: |
| 8215 | filterPtr = NTSCYFilter2; |
| 8216 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8217 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8218 | case 0x0A: |
| 8219 | filterPtr = PALMYFilter2; |
| 8220 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8221 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8222 | case 0x0B: |
| 8223 | filterPtr = PALNYFilter2; |
| 8224 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8225 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8226 | case 0x09: |
| 8227 | filterPtr = PALYFilter2; |
| 8228 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8229 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8230 | default: |
| 8231 | return; |
| 8232 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8233 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8234 | if (ModeNo <= 0x13) |
| 8235 | tempal = pVBInfo->SModeIDTable[ModeIdIndex].VB_StTVYFilterIndex; |
| 8236 | else |
| 8237 | tempal |
| 8238 | = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVYFilterIndex; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8239 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8240 | if (tempcl == 0) |
| 8241 | index = tempal * 4; |
| 8242 | else |
| 8243 | index = tempal * 7; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8244 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8245 | if ((tempcl == 0) && (tempch == 1)) { |
| 8246 | XGINew_SetReg1(pVBInfo->Part2Port, 0x35, 0); |
| 8247 | XGINew_SetReg1(pVBInfo->Part2Port, 0x36, 0); |
| 8248 | XGINew_SetReg1(pVBInfo->Part2Port, 0x37, 0); |
| 8249 | XGINew_SetReg1(pVBInfo->Part2Port, 0x38, filterPtr[index++]); |
| 8250 | } else { |
| 8251 | XGINew_SetReg1(pVBInfo->Part2Port, 0x35, filterPtr[index++]); |
| 8252 | XGINew_SetReg1(pVBInfo->Part2Port, 0x36, filterPtr[index++]); |
| 8253 | XGINew_SetReg1(pVBInfo->Part2Port, 0x37, filterPtr[index++]); |
| 8254 | XGINew_SetReg1(pVBInfo->Part2Port, 0x38, filterPtr[index++]); |
| 8255 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8256 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8257 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 8258 | | VB_XGI302LV | VB_XGI301C)) { |
| 8259 | XGINew_SetReg1(pVBInfo->Part2Port, 0x48, filterPtr[index++]); |
| 8260 | XGINew_SetReg1(pVBInfo->Part2Port, 0x49, filterPtr[index++]); |
| 8261 | XGINew_SetReg1(pVBInfo->Part2Port, 0x4A, filterPtr[index++]); |
| 8262 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8263 | } |
| 8264 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8265 | /* --------------------------------------------------------------------- */ |
| 8266 | /* Function : XGI_GetTVPtrIndex2 */ |
| 8267 | /* Input : */ |
| 8268 | /* Output : bx 0 : NTSC */ |
| 8269 | /* 1 : PAL */ |
| 8270 | /* 2 : PALM */ |
| 8271 | /* 3 : PALN */ |
| 8272 | /* 4 : NTSC1024x768 */ |
| 8273 | /* 5 : PAL-M 1024x768 */ |
| 8274 | /* 6-7: reserved */ |
| 8275 | /* cl 0 : YFilter1 */ |
| 8276 | /* 1 : YFilter2 */ |
| 8277 | /* ch 0 : 301A */ |
| 8278 | /* 1 : 301B/302B/301LV/302LV */ |
| 8279 | /* Description : */ |
| 8280 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 108afbf | 2010-06-17 13:10:47 -0400 | [diff] [blame] | 8281 | void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char *tempcl, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8282 | unsigned char *tempch, struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8283 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8284 | *tempbx = 0; |
| 8285 | *tempcl = 0; |
| 8286 | *tempch = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8287 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8288 | if (pVBInfo->TVInfo & SetPALTV) |
| 8289 | *tempbx = 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8290 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8291 | if (pVBInfo->TVInfo & SetPALMTV) |
| 8292 | *tempbx = 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8293 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8294 | if (pVBInfo->TVInfo & SetPALNTV) |
| 8295 | *tempbx = 3; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8296 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8297 | if (pVBInfo->TVInfo & NTSC1024x768) { |
| 8298 | *tempbx = 4; |
| 8299 | if (pVBInfo->TVInfo & SetPALMTV) |
| 8300 | *tempbx = 5; |
| 8301 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8302 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8303 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 8304 | | VB_XGI302LV | VB_XGI301C)) { |
| 8305 | if ((!(pVBInfo->VBInfo & SetInSlaveMode)) || (pVBInfo->TVInfo |
| 8306 | & TVSimuMode)) { |
| 8307 | *tempbx += 8; |
| 8308 | *tempcl += 1; |
| 8309 | } |
| 8310 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8311 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8312 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 8313 | | VB_XGI302LV | VB_XGI301C)) |
| 8314 | (*tempch)++; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8315 | } |
| 8316 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8317 | /* --------------------------------------------------------------------- */ |
| 8318 | /* Function : XGI_SetCRT2ModeRegs */ |
| 8319 | /* Input : */ |
| 8320 | /* Output : */ |
| 8321 | /* Description : Origin code for crt2group */ |
| 8322 | /* --------------------------------------------------------------------- */ |
Bill Pemberton | 82d6eb5 | 2010-06-17 13:10:46 -0400 | [diff] [blame] | 8323 | void XGI_SetCRT2ModeRegs(unsigned short ModeNo, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8324 | struct xgi_hw_device_info *HwDeviceExtension, |
| 8325 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8326 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8327 | unsigned short tempbl; |
| 8328 | short tempcl; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8329 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8330 | unsigned char tempah; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8331 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8332 | /* XGINew_SetReg1(pVBInfo->Part1Port, 0x03, 0x00); // fix write part1 index 0 BTDRAM bit Bug */ |
| 8333 | tempah = 0; |
| 8334 | if (!(pVBInfo->VBInfo & DisableCRT2Display)) { |
| 8335 | tempah = XGINew_GetReg1(pVBInfo->Part1Port, 0x00); |
| 8336 | tempah &= ~0x10; /* BTRAMDAC */ |
| 8337 | tempah |= 0x40; /* BTRAM */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8338 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8339 | if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV |
| 8340 | | SetCRT2ToLCD)) { |
| 8341 | tempah = 0x40; /* BTDRAM */ |
| 8342 | if (ModeNo > 0x13) { |
| 8343 | tempcl = pVBInfo->ModeType; |
| 8344 | tempcl -= ModeVGA; |
| 8345 | if (tempcl >= 0) { |
| 8346 | tempah = (0x008 >> tempcl); /* BT Color */ |
| 8347 | if (tempah == 0) |
| 8348 | tempah = 1; |
| 8349 | tempah |= 0x040; |
| 8350 | } |
| 8351 | } |
| 8352 | if (pVBInfo->VBInfo & SetInSlaveMode) |
| 8353 | tempah ^= 0x50; /* BTDAC */ |
| 8354 | } |
| 8355 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8356 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8357 | /* 0210 shampoo |
| 8358 | if (pVBInfo->VBInfo & DisableCRT2Display) { |
| 8359 | tempah = 0; |
| 8360 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8361 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8362 | XGINew_SetReg1(pVBInfo->Part1Port, 0x00, tempah); |
| 8363 | if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD)) { |
| 8364 | tempcl = pVBInfo->ModeType; |
| 8365 | if (ModeNo > 0x13) { |
| 8366 | tempcl -= ModeVGA; |
| 8367 | if ((tempcl > 0) || (tempcl == 0)) { |
| 8368 | tempah=(0x008>>tempcl) ; |
| 8369 | if (tempah == 0) |
| 8370 | tempah = 1; |
| 8371 | tempah |= 0x040; |
| 8372 | } |
| 8373 | } else { |
| 8374 | tempah = 0x040; |
| 8375 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8376 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8377 | if (pVBInfo->VBInfo & SetInSlaveMode) { |
| 8378 | tempah = (tempah ^ 0x050); |
| 8379 | } |
| 8380 | } |
| 8381 | */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8382 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8383 | XGINew_SetReg1(pVBInfo->Part1Port, 0x00, tempah); |
| 8384 | tempah = 0x08; |
| 8385 | tempbl = 0xf0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8386 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8387 | if (pVBInfo->VBInfo & DisableCRT2Display) { |
| 8388 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2e, tempbl, tempah); |
| 8389 | } else { |
| 8390 | tempah = 0x00; |
| 8391 | tempbl = 0xff; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8392 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8393 | if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV |
| 8394 | | SetCRT2ToLCD | SetCRT2ToLCDA)) { |
| 8395 | if ((pVBInfo->VBInfo & SetCRT2ToLCDA) |
| 8396 | && (!(pVBInfo->VBInfo & SetSimuScanMode))) { |
| 8397 | tempbl &= 0xf7; |
| 8398 | tempah |= 0x01; |
| 8399 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2e, |
| 8400 | tempbl, tempah); |
| 8401 | } else { |
| 8402 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) { |
| 8403 | tempbl &= 0xf7; |
| 8404 | tempah |= 0x01; |
| 8405 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8406 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8407 | if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC |
| 8408 | | SetCRT2ToTV | SetCRT2ToLCD)) { |
| 8409 | tempbl &= 0xf8; |
| 8410 | tempah = 0x01; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8411 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8412 | if (!(pVBInfo->VBInfo & SetInSlaveMode)) |
| 8413 | tempah |= 0x02; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8414 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8415 | if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) { |
| 8416 | tempah = tempah ^ 0x05; |
| 8417 | if (!(pVBInfo->VBInfo |
| 8418 | & SetCRT2ToLCD)) |
| 8419 | tempah = tempah ^ 0x01; |
| 8420 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8421 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8422 | if (!(pVBInfo->VBInfo |
| 8423 | & SetCRT2ToDualEdge)) |
| 8424 | tempah |= 0x08; |
| 8425 | XGINew_SetRegANDOR(pVBInfo->Part1Port, |
| 8426 | 0x2e, tempbl, tempah); |
| 8427 | } else { |
| 8428 | XGINew_SetRegANDOR(pVBInfo->Part1Port, |
| 8429 | 0x2e, tempbl, tempah); |
| 8430 | } |
| 8431 | } |
| 8432 | } else { |
| 8433 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2e, tempbl, |
| 8434 | tempah); |
| 8435 | } |
| 8436 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8437 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8438 | if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD |
| 8439 | | SetCRT2ToLCDA)) { |
| 8440 | tempah &= (~0x08); |
| 8441 | if ((pVBInfo->ModeType == ModeVGA) && (!(pVBInfo->VBInfo |
| 8442 | & SetInSlaveMode))) { |
| 8443 | tempah |= 0x010; |
| 8444 | } |
| 8445 | tempah |= 0x080; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8446 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8447 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 8448 | /* if (!(pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p))) { */ |
| 8449 | tempah |= 0x020; |
| 8450 | if (ModeNo > 0x13) { |
| 8451 | if (pVBInfo->VBInfo & DriverMode) |
| 8452 | tempah = tempah ^ 0x20; |
| 8453 | } |
| 8454 | /* } */ |
| 8455 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8456 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8457 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0D, ~0x0BF, tempah); |
| 8458 | tempah = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8459 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8460 | if (pVBInfo->LCDInfo & SetLCDDualLink) |
| 8461 | tempah |= 0x40; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8462 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8463 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 8464 | /* if ((!(pVBInfo->VBInfo & SetCRT2ToHiVisionTV)) && (!(pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p)))) { */ |
| 8465 | if (pVBInfo->TVInfo & RPLLDIV2XO) |
| 8466 | tempah |= 0x40; |
| 8467 | /* } */ |
| 8468 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8469 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8470 | if ((pVBInfo->LCDResInfo == Panel1280x1024) |
| 8471 | || (pVBInfo->LCDResInfo == Panel1280x1024x75)) |
| 8472 | tempah |= 0x80; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8473 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8474 | if (pVBInfo->LCDResInfo == Panel1280x960) |
| 8475 | tempah |= 0x80; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8476 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8477 | XGINew_SetReg1(pVBInfo->Part4Port, 0x0C, tempah); |
| 8478 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8479 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8480 | if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV |
| 8481 | | VB_XGI302LV | VB_XGI301C)) { |
| 8482 | tempah = 0; |
| 8483 | tempbl = 0xfb; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8484 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8485 | if (pVBInfo->VBInfo & SetCRT2ToDualEdge) { |
| 8486 | tempbl = 0xff; |
| 8487 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) |
| 8488 | tempah |= 0x04; /* shampoo 0129 */ |
| 8489 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8490 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8491 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x13, tempbl, tempah); |
| 8492 | tempah = 0x00; |
| 8493 | tempbl = 0xcf; |
| 8494 | if (!(pVBInfo->VBInfo & DisableCRT2Display)) { |
| 8495 | if (pVBInfo->VBInfo & SetCRT2ToDualEdge) |
| 8496 | tempah |= 0x30; |
| 8497 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8498 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8499 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2c, tempbl, tempah); |
| 8500 | tempah = 0; |
| 8501 | tempbl = 0x3f; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8502 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8503 | if (!(pVBInfo->VBInfo & DisableCRT2Display)) { |
| 8504 | if (pVBInfo->VBInfo & SetCRT2ToDualEdge) |
| 8505 | tempah |= 0xc0; |
| 8506 | } |
| 8507 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x21, tempbl, tempah); |
| 8508 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8509 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8510 | tempah = 0; |
| 8511 | tempbl = 0x7f; |
| 8512 | if (!(pVBInfo->VBInfo & SetCRT2ToLCDA)) { |
| 8513 | tempbl = 0xff; |
| 8514 | if (!(pVBInfo->VBInfo & SetCRT2ToDualEdge)) |
| 8515 | tempah |= 0x80; |
| 8516 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8517 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8518 | XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x23, tempbl, tempah); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8519 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8520 | if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) { |
| 8521 | if (pVBInfo->LCDInfo & SetLCDDualLink) { |
| 8522 | XGINew_SetRegOR(pVBInfo->Part4Port, 0x27, 0x20); |
| 8523 | XGINew_SetRegOR(pVBInfo->Part4Port, 0x34, 0x10); |
| 8524 | } |
| 8525 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8526 | } |
| 8527 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8528 | void XGI_CloseCRTC(struct xgi_hw_device_info *HwDeviceExtension, |
| 8529 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8530 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8531 | unsigned short tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8532 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8533 | tempbx = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8534 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8535 | if (pVBInfo->VBInfo & SetCRT2ToLCDA) |
| 8536 | tempbx = 0x08A0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8537 | |
| 8538 | } |
| 8539 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8540 | void XGI_OpenCRTC(struct xgi_hw_device_info *HwDeviceExtension, |
| 8541 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8542 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8543 | unsigned short tempbx; |
| 8544 | tempbx = 0; |
| 8545 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8546 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8547 | void XGI_GetRAMDAC2DATA(unsigned short ModeNo, unsigned short ModeIdIndex, |
| 8548 | unsigned short RefreshRateTableIndex, |
| 8549 | struct vb_device_info *pVBInfo) |
| 8550 | { |
| 8551 | unsigned short tempax, tempbx, temp1, temp2, modeflag = 0, tempcx, |
| 8552 | StandTableIndex, CRT1Index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8553 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8554 | pVBInfo->RVBHCMAX = 1; |
| 8555 | pVBInfo->RVBHCFACT = 1; |
| 8556 | |
| 8557 | if (ModeNo <= 0x13) { |
| 8558 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 8559 | StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo); |
| 8560 | tempax = pVBInfo->StandTable[StandTableIndex].CRTC[0]; |
| 8561 | tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[6]; |
| 8562 | temp1 = pVBInfo->StandTable[StandTableIndex].CRTC[7]; |
| 8563 | } else { |
| 8564 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 8565 | CRT1Index |
| 8566 | = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; |
| 8567 | CRT1Index &= IndexMask; |
| 8568 | temp1 |
| 8569 | = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[0]; |
| 8570 | temp2 |
| 8571 | = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5]; |
| 8572 | tempax = (temp1 & 0xFF) | ((temp2 & 0x03) << 8); |
| 8573 | tempbx |
| 8574 | = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[8]; |
| 8575 | tempcx |
| 8576 | = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14] |
| 8577 | << 8; |
| 8578 | tempcx &= 0x0100; |
| 8579 | tempcx = tempcx << 2; |
| 8580 | tempbx |= tempcx; |
| 8581 | temp1 |
| 8582 | = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[9]; |
| 8583 | } |
| 8584 | |
| 8585 | if (temp1 & 0x01) |
| 8586 | tempbx |= 0x0100; |
| 8587 | |
| 8588 | if (temp1 & 0x20) |
| 8589 | tempbx |= 0x0200; |
| 8590 | tempax += 5; |
| 8591 | |
| 8592 | if (modeflag & Charx8Dot) |
| 8593 | tempax *= 8; |
| 8594 | else |
| 8595 | tempax *= 9; |
| 8596 | |
| 8597 | pVBInfo->VGAHT = tempax; |
| 8598 | pVBInfo->HT = tempax; |
| 8599 | tempbx++; |
| 8600 | pVBInfo->VGAVT = tempbx; |
| 8601 | pVBInfo->VT = tempbx; |
| 8602 | } |
| 8603 | |
| 8604 | unsigned short XGI_GetColorDepth(unsigned short ModeNo, |
| 8605 | unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) |
| 8606 | { |
| 8607 | unsigned short ColorDepth[6] = { 1, 2, 4, 4, 6, 8 }; |
| 8608 | short index; |
| 8609 | unsigned short modeflag; |
| 8610 | |
| 8611 | if (ModeNo <= 0x13) |
| 8612 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 8613 | else |
| 8614 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 8615 | |
| 8616 | index = (modeflag & ModeInfoFlag) - ModeEGA; |
| 8617 | |
| 8618 | if (index < 0) |
| 8619 | index = 0; |
| 8620 | |
| 8621 | return ColorDepth[index]; |
| 8622 | } |
| 8623 | |
| 8624 | void XGI_UnLockCRT2(struct xgi_hw_device_info *HwDeviceExtension, |
| 8625 | struct vb_device_info *pVBInfo) |
| 8626 | { |
| 8627 | |
| 8628 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2f, 0xFF, 0x01); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8629 | |
| 8630 | } |
| 8631 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8632 | void XGI_LockCRT2(struct xgi_hw_device_info *HwDeviceExtension, |
| 8633 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8634 | { |
| 8635 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8636 | XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2F, 0xFE, 0x00); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8637 | |
| 8638 | } |
| 8639 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 8640 | void XGINew_EnableCRT2(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8641 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8642 | XGINew_SetRegANDOR(pVBInfo->P3c4, 0x1E, 0xFF, 0x20); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8643 | } |
| 8644 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8645 | void XGINew_LCD_Wait_Time(unsigned char DelayTime, |
| 8646 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8647 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8648 | unsigned short i, j; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8649 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8650 | unsigned long temp, flag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8651 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8652 | flag = 0; |
| 8653 | /* printk("XGINew_LCD_Wait_Time"); */ |
| 8654 | /* return; */ |
| 8655 | for (i = 0; i < DelayTime; i++) { |
| 8656 | for (j = 0; j < 66; j++) { |
| 8657 | temp = XGINew_GetReg3(0x61); |
| 8658 | /* temp &= 0x10000000; */ |
| 8659 | temp &= 0x10; |
| 8660 | if (temp == flag) |
| 8661 | continue; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8662 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8663 | flag = temp; |
| 8664 | } |
| 8665 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8666 | } |
| 8667 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 8668 | unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8669 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8670 | unsigned short flag; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8671 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8672 | if (pVBInfo->IF_DEF_LVDS == 1) { |
| 8673 | return 1; |
| 8674 | } else { |
| 8675 | flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x00); |
| 8676 | if ((flag == 1) || (flag == 2)) |
| 8677 | return 1; /* 301b */ |
| 8678 | else |
| 8679 | return 0; |
| 8680 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8681 | } |
| 8682 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 8683 | void XGI_LongWait(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8684 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8685 | unsigned short i; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8686 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8687 | i = XGINew_GetReg1(pVBInfo->P3c4, 0x1F); |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8688 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8689 | if (!(i & 0xC0)) { |
| 8690 | for (i = 0; i < 0xFFFF; i++) { |
| 8691 | if (!(XGINew_GetReg2(pVBInfo->P3da) & 0x08)) |
| 8692 | break; |
| 8693 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8694 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8695 | for (i = 0; i < 0xFFFF; i++) { |
| 8696 | if ((XGINew_GetReg2(pVBInfo->P3da) & 0x08)) |
| 8697 | break; |
| 8698 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8699 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8700 | } |
| 8701 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 8702 | void XGI_VBLongWait(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8703 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8704 | unsigned short tempal, temp, i, j; |
| 8705 | return; |
| 8706 | if (!(pVBInfo->VBInfo & SetCRT2ToTV)) { |
| 8707 | temp = 0; |
| 8708 | for (i = 0; i < 3; i++) { |
| 8709 | for (j = 0; j < 100; j++) { |
| 8710 | tempal = XGINew_GetReg2(pVBInfo->P3da); |
| 8711 | if (temp & 0x01) { /* VBWaitMode2 */ |
| 8712 | if ((tempal & 0x08)) |
| 8713 | continue; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8714 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8715 | if (!(tempal & 0x08)) |
| 8716 | break; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8717 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8718 | } else { /* VBWaitMode1 */ |
| 8719 | if (!(tempal & 0x08)) |
| 8720 | continue; |
| 8721 | |
| 8722 | if ((tempal & 0x08)) |
| 8723 | break; |
| 8724 | } |
| 8725 | } |
| 8726 | temp = temp ^ 0x01; |
| 8727 | } |
| 8728 | } else { |
| 8729 | XGI_LongWait(pVBInfo); |
| 8730 | } |
| 8731 | return; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8732 | } |
| 8733 | |
Bill Pemberton | 80adad8 | 2010-06-17 13:10:51 -0400 | [diff] [blame] | 8734 | unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8735 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8736 | unsigned long tempax, tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8737 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8738 | tempbx = ((pVBInfo->VGAVT - pVBInfo->VGAVDE) * pVBInfo->RVBHCMAX) |
| 8739 | & 0xFFFF; |
| 8740 | tempax = (pVBInfo->VT - pVBInfo->VDE) * pVBInfo->RVBHCFACT; |
| 8741 | tempax = (tempax * pVBInfo->HT) / tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8742 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8743 | return (unsigned short) tempax; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8744 | } |
| 8745 | |
Bill Pemberton | e4147ab | 2010-06-17 13:10:50 -0400 | [diff] [blame] | 8746 | unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8747 | unsigned short ModeIdIndex, |
| 8748 | unsigned short RefreshRateTableIndex, |
| 8749 | struct xgi_hw_device_info *HwDeviceExtension, |
| 8750 | struct vb_device_info *pVBInfo) |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8751 | { |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8752 | unsigned short tempbx; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8753 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8754 | unsigned short LCDXlat1VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2, |
| 8755 | VCLK65 + 2 }; |
| 8756 | unsigned short LCDXlat2VCLK[4] = { VCLK108_2 + 5, VCLK108_2 + 5, |
| 8757 | VCLK108_2 + 5, VCLK108_2 + 5 }; |
| 8758 | unsigned short LVDSXlat1VCLK[4] = { VCLK40, VCLK40, VCLK40, VCLK40 }; |
| 8759 | unsigned short LVDSXlat2VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2, |
| 8760 | VCLK65 + 2 }; |
| 8761 | unsigned short LVDSXlat3VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2, |
| 8762 | VCLK65 + 2 }; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8763 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8764 | unsigned short CRT2Index, VCLKIndex; |
| 8765 | unsigned short modeflag, resinfo; |
| 8766 | unsigned char *CHTVVCLKPtr = NULL; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8767 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8768 | if (ModeNo <= 0x13) { |
| 8769 | modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ |
| 8770 | resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; |
| 8771 | CRT2Index = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; |
| 8772 | } else { |
| 8773 | modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ |
| 8774 | resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; |
| 8775 | CRT2Index |
| 8776 | = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 8777 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8778 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8779 | if (pVBInfo->IF_DEF_LVDS == 0) { |
| 8780 | CRT2Index = CRT2Index >> 6; /* for LCD */ |
| 8781 | if (((pVBInfo->VBInfo & SetCRT2ToLCD) | SetCRT2ToLCDA)) { /*301b*/ |
| 8782 | if (pVBInfo->LCDResInfo != Panel1024x768) |
| 8783 | VCLKIndex = LCDXlat2VCLK[CRT2Index]; |
| 8784 | else |
| 8785 | VCLKIndex = LCDXlat1VCLK[CRT2Index]; |
| 8786 | } else { /* for TV */ |
| 8787 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 8788 | if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) { |
| 8789 | if (pVBInfo->SetFlag & RPLLDIV2XO) { |
| 8790 | VCLKIndex = HiTVVCLKDIV2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8791 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8792 | VCLKIndex += 25; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8793 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8794 | } else { |
| 8795 | VCLKIndex = HiTVVCLK; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8796 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8797 | VCLKIndex += 25; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8798 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8799 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8800 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8801 | if (pVBInfo->SetFlag & TVSimuMode) { |
| 8802 | if (modeflag & Charx8Dot) { |
| 8803 | VCLKIndex |
| 8804 | = HiTVSimuVCLK; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8805 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8806 | VCLKIndex += 25; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8807 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8808 | } else { |
| 8809 | VCLKIndex |
| 8810 | = HiTVTextVCLK; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8811 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8812 | VCLKIndex += 25; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8813 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8814 | } |
| 8815 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8816 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8817 | if (pVBInfo->VBType & VB_XGI301LV) { /* 301lv */ |
| 8818 | if (!(pVBInfo->VBExtInfo |
| 8819 | == VB_YPbPr1080i)) { |
| 8820 | VCLKIndex |
| 8821 | = YPbPr750pVCLK; |
| 8822 | if (!(pVBInfo->VBExtInfo |
| 8823 | == VB_YPbPr750p)) { |
| 8824 | VCLKIndex |
| 8825 | = YPbPr525pVCLK; |
| 8826 | if (!(pVBInfo->VBExtInfo |
| 8827 | == VB_YPbPr525p)) { |
| 8828 | VCLKIndex |
| 8829 | = YPbPr525iVCLK_2; |
| 8830 | if (!(pVBInfo->SetFlag |
| 8831 | & RPLLDIV2XO)) |
| 8832 | VCLKIndex |
| 8833 | = YPbPr525iVCLK; |
| 8834 | } |
| 8835 | } |
| 8836 | } |
| 8837 | } |
| 8838 | } else { |
| 8839 | if (pVBInfo->VBInfo & SetCRT2ToTV) { |
| 8840 | if (pVBInfo->SetFlag |
| 8841 | & RPLLDIV2XO) { |
| 8842 | VCLKIndex = TVVCLKDIV2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8843 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8844 | VCLKIndex += 25; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8845 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8846 | } else { |
| 8847 | VCLKIndex = TVVCLK; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8848 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8849 | VCLKIndex += 25; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8850 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8851 | } |
| 8852 | } |
| 8853 | } |
| 8854 | } else { /* for CRT2 */ |
| 8855 | VCLKIndex = (unsigned char) XGINew_GetReg2( |
| 8856 | (pVBInfo->P3ca + 0x02)); /* Port 3cch */ |
| 8857 | VCLKIndex = ((VCLKIndex >> 2) & 0x03); |
| 8858 | if (ModeNo > 0x13) { |
| 8859 | VCLKIndex |
| 8860 | = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; /* di+Ext_CRTVCLK */ |
| 8861 | VCLKIndex &= IndexMask; |
| 8862 | } |
| 8863 | } |
| 8864 | } |
| 8865 | } else { /* LVDS */ |
| 8866 | if (ModeNo <= 0x13) |
| 8867 | VCLKIndex = CRT2Index; |
| 8868 | else |
| 8869 | VCLKIndex = CRT2Index; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8870 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8871 | if (pVBInfo->IF_DEF_CH7005 == 1) { |
| 8872 | if (!(pVBInfo->VBInfo & SetCRT2ToLCD)) { |
| 8873 | VCLKIndex &= 0x1f; |
| 8874 | tempbx = 0; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8875 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8876 | if (pVBInfo->VBInfo & SetPALTV) |
| 8877 | tempbx += 2; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8878 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8879 | if (pVBInfo->VBInfo & SetCHTVOverScan) |
| 8880 | tempbx += 1; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8881 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8882 | switch (tempbx) { |
| 8883 | case 0: |
| 8884 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC; |
| 8885 | break; |
| 8886 | case 1: |
| 8887 | CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC; |
| 8888 | break; |
| 8889 | case 2: |
| 8890 | CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL; |
| 8891 | break; |
| 8892 | case 3: |
| 8893 | CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL; |
| 8894 | break; |
| 8895 | default: |
| 8896 | break; |
| 8897 | } |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8898 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8899 | VCLKIndex = CHTVVCLKPtr[VCLKIndex]; |
| 8900 | } |
| 8901 | } else { |
| 8902 | VCLKIndex = VCLKIndex >> 6; |
| 8903 | if ((pVBInfo->LCDResInfo == Panel800x600) |
| 8904 | || (pVBInfo->LCDResInfo == Panel320x480)) |
| 8905 | VCLKIndex = LVDSXlat1VCLK[VCLKIndex]; |
| 8906 | else if ((pVBInfo->LCDResInfo == Panel1024x768) |
| 8907 | || (pVBInfo->LCDResInfo |
| 8908 | == Panel1024x768x75)) |
| 8909 | VCLKIndex = LVDSXlat2VCLK[VCLKIndex]; |
| 8910 | else |
| 8911 | VCLKIndex = LVDSXlat3VCLK[VCLKIndex]; |
| 8912 | } |
| 8913 | } |
| 8914 | /* VCLKIndex = VCLKIndex&IndexMask; */ |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8915 | |
Prashant P. Shah | 21df8fc | 2010-09-03 22:12:12 +0530 | [diff] [blame^] | 8916 | return VCLKIndex; |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 8917 | } |
| 8918 | |