staging: xgifb: move XGI21_LVDSCapStruct into xgifb_video_info

Move the LVDS data into a device-specific data, and eliminate the global
variable usage.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Aaro Koskinen 2011-12-06 00:10:45 +02:00 committed by Greg Kroah-Hartman
parent 64afdf8722
commit fab04b97be
6 changed files with 86 additions and 97 deletions

View File

@ -382,7 +382,7 @@ static void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr)
/* ------------------ Internal helper routines ----------------- */ /* ------------------ Internal helper routines ----------------- */
static int XGIfb_GetXG21DefaultLVDSModeIdx(void) static int XGIfb_GetXG21DefaultLVDSModeIdx(struct xgifb_video_info *xgifb_info)
{ {
int found_mode = 0; int found_mode = 0;
@ -391,11 +391,11 @@ static int XGIfb_GetXG21DefaultLVDSModeIdx(void)
found_mode = 0; found_mode = 0;
while ((XGIbios_mode[XGIfb_mode_idx].mode_no != 0) while ((XGIbios_mode[XGIfb_mode_idx].mode_no != 0)
&& (XGIbios_mode[XGIfb_mode_idx].xres && (XGIbios_mode[XGIfb_mode_idx].xres
<= XGI21_LCDCapList[0].LVDSHDE)) { <= xgifb_info->lvds_data.LVDSHDE)) {
if ((XGIbios_mode[XGIfb_mode_idx].xres if ((XGIbios_mode[XGIfb_mode_idx].xres
== XGI21_LCDCapList[0].LVDSHDE) == xgifb_info->lvds_data.LVDSHDE)
&& (XGIbios_mode[XGIfb_mode_idx].yres && (XGIbios_mode[XGIfb_mode_idx].yres
== XGI21_LCDCapList[0].LVDSVDE) == xgifb_info->lvds_data.LVDSVDE)
&& (XGIbios_mode[XGIfb_mode_idx].bpp == 8)) { && (XGIbios_mode[XGIfb_mode_idx].bpp == 8)) {
found_mode = 1; found_mode = 1;
break; break;
@ -458,8 +458,8 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex)
if (xgifb_info->chip == XG21) { if (xgifb_info->chip == XG21) {
if (xgifb_info->display2 == XGIFB_DISP_LCD) { if (xgifb_info->display2 == XGIFB_DISP_LCD) {
xres = XGI21_LCDCapList[0].LVDSHDE; xres = xgifb_info->lvds_data.LVDSHDE;
yres = XGI21_LCDCapList[0].LVDSVDE; yres = xgifb_info->lvds_data.LVDSVDE;
if (XGIbios_mode[myindex].xres > xres) if (XGIbios_mode[myindex].xres > xres)
return -1; return -1;
if (XGIbios_mode[myindex].yres > yres) if (XGIbios_mode[myindex].yres > yres)
@ -1173,7 +1173,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
if (isactive) { if (isactive) {
XGIfb_pre_setmode(xgifb_info); XGIfb_pre_setmode(xgifb_info);
if (XGISetModeNew(hw_info, if (XGISetModeNew(xgifb_info, hw_info,
XGIbios_mode[xgifb_info->mode_idx].mode_no) XGIbios_mode[xgifb_info->mode_idx].mode_no)
== 0) { == 0) {
printk(KERN_ERR "XGIfb: Setting mode[0x%x] failed\n", printk(KERN_ERR "XGIfb: Setting mode[0x%x] failed\n",
@ -2167,7 +2167,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
if (xgifb_info->display2 == XGIFB_DISP_LCD && if (xgifb_info->display2 == XGIFB_DISP_LCD &&
xgifb_info->chip == XG21) xgifb_info->chip == XG21)
xgifb_info->mode_idx = xgifb_info->mode_idx =
XGIfb_GetXG21DefaultLVDSModeIdx(); XGIfb_GetXG21DefaultLVDSModeIdx(xgifb_info);
else else
xgifb_info->mode_idx = DEFAULT_MODE; xgifb_info->mode_idx = DEFAULT_MODE;
} }

View File

@ -90,6 +90,8 @@ struct xgifb_video_info {
unsigned char TV_type; unsigned char TV_type;
unsigned char TV_plug; unsigned char TV_plug;
struct XGI21_LVDSCapStruct lvds_data;
enum XGI_CHIP_TYPE chip; enum XGI_CHIP_TYPE chip;
unsigned char revision_id; unsigned char revision_id;

View File

@ -1070,19 +1070,20 @@ static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension,
return 0; return 0;
} }
static void XGINew_SetDRAMSize_340(struct xgi_hw_device_info *HwDeviceExtension, static void XGINew_SetDRAMSize_340(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo) struct vb_device_info *pVBInfo)
{ {
unsigned short data; unsigned short data;
pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
XGISetModeNew(HwDeviceExtension, 0x2e); XGISetModeNew(xgifb_info, HwDeviceExtension, 0x2e);
data = xgifb_reg_get(pVBInfo->P3c4, 0x21); data = xgifb_reg_get(pVBInfo->P3c4, 0x21);
/* disable read cache */ /* disable read cache */
xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short) (data & 0xDF)); xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short) (data & 0xDF));
XGI_DisplayOff(HwDeviceExtension, pVBInfo); XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo);
/* data = xgifb_reg_get(pVBInfo->P3c4, 0x1); */ /* data = xgifb_reg_get(pVBInfo->P3c4, 0x1); */
/* data |= 0x20 ; */ /* data |= 0x20 ; */
@ -1156,7 +1157,7 @@ static void xgifb_read_vbios(struct pci_dev *pdev,
if (entry >= j) if (entry >= j)
entry = 0; entry = 0;
i += entry * 25; i += entry * 25;
lvds = &pVBInfo->XG21_LVDSCapList[0]; lvds = &xgifb_info->lvds_data;
if (vbios_size <= i + 24) if (vbios_size <= i + 24)
goto error; goto error;
lvds->LVDS_Capability = vbios[i] | (vbios[i + 1] << 8); lvds->LVDS_Capability = vbios[i] | (vbios[i + 1] << 8);
@ -1779,7 +1780,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
pVBInfo); pVBInfo);
printk("20"); printk("20");
XGINew_SetDRAMSize_340(HwDeviceExtension, pVBInfo); XGINew_SetDRAMSize_340(xgifb_info, HwDeviceExtension, pVBInfo);
printk("21"); printk("21");
printk("22"); printk("22");

View File

@ -143,9 +143,6 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
else else
pVBInfo->LCDCapList = XGI_LCDCapList; pVBInfo->LCDCapList = XGI_LCDCapList;
if ((ChipType == XG21) || (ChipType == XG27))
pVBInfo->XG21_LVDSCapList = XGI21_LCDCapList;
pVBInfo->XGI_TVDelayList = XGI301TVDelayList; pVBInfo->XGI_TVDelayList = XGI301TVDelayList;
pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2; pVBInfo->XGI_TVDelayList2 = XGI301TVDelayList2;
@ -3648,11 +3645,6 @@ static void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl,
xgifb_reg_and_or(pVBInfo->P3d4, 0x48, ~tempbh, tempbl); xgifb_reg_and_or(pVBInfo->P3d4, 0x48, ~tempbh, tempbl);
} }
static unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo)
{
return 0;
}
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* Function : XGI_XG21SetPanelDelay */ /* Function : XGI_XG21SetPanelDelay */
/* Input : */ /* Input : */
@ -3663,26 +3655,25 @@ static unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo)
/* : bl : 3 ; T3 : the duration between CPL off and signal off */ /* : bl : 3 ; T3 : the duration between CPL off and signal off */
/* : bl : 4 ; T4 : the duration signal off and Vdd off */ /* : bl : 4 ; T4 : the duration signal off and Vdd off */
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static void XGI_XG21SetPanelDelay(unsigned short tempbl, static void XGI_XG21SetPanelDelay(struct xgifb_video_info *xgifb_info,
unsigned short tempbl,
struct vb_device_info *pVBInfo) struct vb_device_info *pVBInfo)
{ {
unsigned short index;
index = XGI_GetLVDSOEMTableIndex(pVBInfo);
if (tempbl == 1) if (tempbl == 1)
mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S1); mdelay(xgifb_info->lvds_data.PSC_S1);
if (tempbl == 2) if (tempbl == 2)
mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S2); mdelay(xgifb_info->lvds_data.PSC_S2);
if (tempbl == 3) if (tempbl == 3)
mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S3); mdelay(xgifb_info->lvds_data.PSC_S3);
if (tempbl == 4) if (tempbl == 4)
mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S4); mdelay(xgifb_info->lvds_data.PSC_S4);
} }
static void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE, static void XGI_DisplayOn(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *pXGIHWDE,
struct vb_device_info *pVBInfo) struct vb_device_info *pVBInfo)
{ {
@ -3692,12 +3683,12 @@ static void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE,
if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x1)) { if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x1)) {
/* LVDS VDD on */ /* LVDS VDD on */
XGI_XG21BLSignalVDD(0x01, 0x01, pVBInfo); XGI_XG21BLSignalVDD(0x01, 0x01, pVBInfo);
XGI_XG21SetPanelDelay(2, pVBInfo); XGI_XG21SetPanelDelay(xgifb_info, 2, pVBInfo);
} }
if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x20)) if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x20))
/* LVDS signal on */ /* LVDS signal on */
XGI_XG21BLSignalVDD(0x20, 0x20, pVBInfo); XGI_XG21BLSignalVDD(0x20, 0x20, pVBInfo);
XGI_XG21SetPanelDelay(3, pVBInfo); XGI_XG21SetPanelDelay(xgifb_info, 3, pVBInfo);
/* LVDS backlight on */ /* LVDS backlight on */
XGI_XG21BLSignalVDD(0x02, 0x02, pVBInfo); XGI_XG21BLSignalVDD(0x02, 0x02, pVBInfo);
} else { } else {
@ -3712,12 +3703,12 @@ static void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE,
if (!(XGI_XG27GetPSCValue(pVBInfo) & 0x1)) { if (!(XGI_XG27GetPSCValue(pVBInfo) & 0x1)) {
/* LVDS VDD on */ /* LVDS VDD on */
XGI_XG27BLSignalVDD(0x01, 0x01, pVBInfo); XGI_XG27BLSignalVDD(0x01, 0x01, pVBInfo);
XGI_XG21SetPanelDelay(2, pVBInfo); XGI_XG21SetPanelDelay(xgifb_info, 2, pVBInfo);
} }
if (!(XGI_XG27GetPSCValue(pVBInfo) & 0x20)) if (!(XGI_XG27GetPSCValue(pVBInfo) & 0x20))
/* LVDS signal on */ /* LVDS signal on */
XGI_XG27BLSignalVDD(0x20, 0x20, pVBInfo); XGI_XG27BLSignalVDD(0x20, 0x20, pVBInfo);
XGI_XG21SetPanelDelay(3, pVBInfo); XGI_XG21SetPanelDelay(xgifb_info, 3, pVBInfo);
/* LVDS backlight on */ /* LVDS backlight on */
XGI_XG27BLSignalVDD(0x02, 0x02, pVBInfo); XGI_XG27BLSignalVDD(0x02, 0x02, pVBInfo);
} else { } else {
@ -3728,7 +3719,8 @@ static void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE,
} }
} }
void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE, void XGI_DisplayOff(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *pXGIHWDE,
struct vb_device_info *pVBInfo) struct vb_device_info *pVBInfo)
{ {
@ -3736,7 +3728,7 @@ void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE,
if (pVBInfo->IF_DEF_LVDS == 1) { if (pVBInfo->IF_DEF_LVDS == 1) {
/* LVDS backlight off */ /* LVDS backlight off */
XGI_XG21BLSignalVDD(0x02, 0x00, pVBInfo); XGI_XG21BLSignalVDD(0x02, 0x00, pVBInfo);
XGI_XG21SetPanelDelay(3, pVBInfo); XGI_XG21SetPanelDelay(xgifb_info, 3, pVBInfo);
} else { } else {
/* DVO/DVI signal off */ /* DVO/DVI signal off */
XGI_XG21BLSignalVDD(0x20, 0x00, pVBInfo); XGI_XG21BLSignalVDD(0x20, 0x00, pVBInfo);
@ -3747,7 +3739,7 @@ void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE,
if ((XGI_XG27GetPSCValue(pVBInfo) & 0x2)) { if ((XGI_XG27GetPSCValue(pVBInfo) & 0x2)) {
/* LVDS backlight off */ /* LVDS backlight off */
XGI_XG27BLSignalVDD(0x02, 0x00, pVBInfo); XGI_XG27BLSignalVDD(0x02, 0x00, pVBInfo);
XGI_XG21SetPanelDelay(3, pVBInfo); XGI_XG21SetPanelDelay(xgifb_info, 3, pVBInfo);
} }
if (pVBInfo->IF_DEF_LVDS == 0) if (pVBInfo->IF_DEF_LVDS == 0)
@ -5813,11 +5805,11 @@ static void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension,
xgifb_reg_and_or(pVBInfo->P3d4, 0x63, 0xBF, 0x00); xgifb_reg_and_or(pVBInfo->P3d4, 0x63, 0xBF, 0x00);
} }
static unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, static unsigned char XGI_XG21CheckLVDSMode(struct xgifb_video_info *xgifb_info,
unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{ {
unsigned short xres, yres, colordepth, modeflag, resindex, unsigned short xres, yres, colordepth, modeflag, resindex;
lvdstableindex;
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
if (ModeNo <= 0x13) { if (ModeNo <= 0x13) {
@ -5846,18 +5838,15 @@ static unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo,
} }
lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo); if (xres > xgifb_info->lvds_data.LVDSHDE)
if (xres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE))
return 0; return 0;
if (yres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE)) if (yres > xgifb_info->lvds_data.LVDSVDE)
return 0; return 0;
if (ModeNo > 0x13) { if (ModeNo > 0x13) {
if ((xres != (pVBInfo->XG21_LVDSCapList[lvdstableindex]. if (xres != xgifb_info->lvds_data.LVDSHDE ||
LVDSHDE)) || yres != xgifb_info->lvds_data.LVDSVDE) {
(yres != (pVBInfo->XG21_LVDSCapList[lvdstableindex].
LVDSVDE))) {
colordepth = XGI_GetColorDepth(ModeNo, colordepth = XGI_GetColorDepth(ModeNo,
ModeIdIndex, ModeIdIndex,
pVBInfo); pVBInfo);
@ -5869,28 +5858,26 @@ static unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo,
return 1; return 1;
} }
static void xgifb_set_lvds(int chip_id, static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info,
int chip_id,
unsigned short ModeNo, unsigned short ModeNo,
unsigned short ModeIdIndex, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo) struct vb_device_info *pVBInfo)
{ {
unsigned char temp, Miscdata; unsigned char temp, Miscdata;
unsigned short xres, yres, modeflag, resindex, lvdstableindex; unsigned short xres, yres, modeflag, resindex;
unsigned short LVDSHT, LVDSHBS, LVDSHRS, LVDSHRE, LVDSHBE; unsigned short LVDSHT, LVDSHBS, LVDSHRS, LVDSHRE, LVDSHBE;
unsigned short LVDSVT, LVDSVBS, LVDSVRS, LVDSVRE, LVDSVBE; unsigned short LVDSVT, LVDSVBS, LVDSVRS, LVDSVRE, LVDSVBE;
unsigned short value; unsigned short value;
lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo); temp = (unsigned char) ((xgifb_info->lvds_data.LVDS_Capability &
temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].
LVDS_Capability &
(LCDPolarity << 8)) >> 8); (LCDPolarity << 8)) >> 8);
temp &= LCDPolarity; temp &= LCDPolarity;
Miscdata = (unsigned char) inb(pVBInfo->P3cc); Miscdata = (unsigned char) inb(pVBInfo->P3cc);
outb((Miscdata & 0x3F) | temp, pVBInfo->P3c2); outb((Miscdata & 0x3F) | temp, pVBInfo->P3c2);
temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex]. temp = xgifb_info->lvds_data.LVDS_Capability & LCDPolarity;
LVDS_Capability & LCDPolarity);
/* SR35[7] FP VSync polarity */ /* SR35[7] FP VSync polarity */
xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80); xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80);
/* SR30[5] FP HSync polarity */ /* SR30[5] FP HSync polarity */
@ -5917,48 +5904,43 @@ static void xgifb_set_lvds(int chip_id,
if (!(modeflag & Charx8Dot)) if (!(modeflag & Charx8Dot))
xres = xres * 8 / 9; xres = xres * 8 / 9;
LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT; LVDSHT = xgifb_info->lvds_data.LVDSHT;
LVDSHBS = xres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE LVDSHBS = xres + (xgifb_info->lvds_data.LVDSHDE - xres) / 2;
- xres) / 2;
if ((ModeNo <= 0x13) && (modeflag & HalfDCLK)) if ((ModeNo <= 0x13) && (modeflag & HalfDCLK))
LVDSHBS -= xres / 4; LVDSHBS -= xres / 4;
if (LVDSHBS > LVDSHT) if (LVDSHBS > LVDSHT)
LVDSHBS -= LVDSHT; LVDSHBS -= LVDSHT;
LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP; LVDSHRS = LVDSHBS + xgifb_info->lvds_data.LVDSHFP;
if (LVDSHRS > LVDSHT) if (LVDSHRS > LVDSHT)
LVDSHRS -= LVDSHT; LVDSHRS -= LVDSHT;
LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC; LVDSHRE = LVDSHRS + xgifb_info->lvds_data.LVDSHSYNC;
if (LVDSHRE > LVDSHT) if (LVDSHRE > LVDSHT)
LVDSHRE -= LVDSHT; LVDSHRE -= LVDSHT;
LVDSHBE = LVDSHBS + LVDSHT LVDSHBE = LVDSHBS + LVDSHT - xgifb_info->lvds_data.LVDSHDE;
- pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE;
LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT; LVDSVT = xgifb_info->lvds_data.LVDSVT;
LVDSVBS = yres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE LVDSVBS = yres + (xgifb_info->lvds_data.LVDSVDE - yres) / 2;
- yres) / 2;
if ((ModeNo > 0x13) && (modeflag & DoubleScanMode)) if ((ModeNo > 0x13) && (modeflag & DoubleScanMode))
LVDSVBS += yres / 2; LVDSVBS += yres / 2;
if (LVDSVBS > LVDSVT) if (LVDSVBS > LVDSVT)
LVDSVBS -= LVDSVT; LVDSVBS -= LVDSVT;
LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP; LVDSVRS = LVDSVBS + xgifb_info->lvds_data.LVDSVFP;
if (LVDSVRS > LVDSVT) if (LVDSVRS > LVDSVT)
LVDSVRS -= LVDSVT; LVDSVRS -= LVDSVT;
LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex]. LVDSVRE = LVDSVRS + xgifb_info->lvds_data.LVDSVSYNC;
LVDSVSYNC;
if (LVDSVRE > LVDSVT) if (LVDSVRE > LVDSVT)
LVDSVRE -= LVDSVT; LVDSVRE -= LVDSVT;
LVDSVBE = LVDSVBS + LVDSVT LVDSVBE = LVDSVBS + LVDSVT - xgifb_info->lvds_data.LVDSVDE;
- pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE;
temp = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11); temp = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
xgifb_reg_set(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */ xgifb_reg_set(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */
@ -6058,13 +6040,9 @@ static void xgifb_set_lvds(int chip_id,
xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, value); xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, value);
xgifb_reg_set(pVBInfo->P3c4, xgifb_reg_set(pVBInfo->P3c4,
0x2B, 0x2B, xgifb_info->lvds_data.VCLKData1);
pVBInfo->XG21_LVDSCapList[lvdstableindex].
VCLKData1);
xgifb_reg_set(pVBInfo->P3c4, xgifb_reg_set(pVBInfo->P3c4,
0x2C, 0x2C, xgifb_info->lvds_data.VCLKData2);
pVBInfo->XG21_LVDSCapList[lvdstableindex].
VCLKData2);
value += 0x10; value += 0x10;
} }
@ -6156,7 +6134,8 @@ static unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo)
return 0; return 0;
} }
static void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, static void XGI_DisableBridge(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo) struct vb_device_info *pVBInfo)
{ {
unsigned short tempah = 0; unsigned short tempah = 0;
@ -6200,7 +6179,7 @@ static void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension,
| SetSimuScanMode))) { | SetSimuScanMode))) {
if (pVBInfo->SetFlag & GatingCRT) if (pVBInfo->SetFlag & GatingCRT)
XGI_EnableGatingCRT(HwDeviceExtension, pVBInfo); XGI_EnableGatingCRT(HwDeviceExtension, pVBInfo);
XGI_DisplayOff(HwDeviceExtension, pVBInfo); XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo);
} }
if (pVBInfo->VBInfo & SetCRT2ToLCDA) { if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
@ -6250,7 +6229,7 @@ static void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension,
if (pVBInfo->VBInfo & (DisableCRT2Display | SetCRT2ToLCDA if (pVBInfo->VBInfo & (DisableCRT2Display | SetCRT2ToLCDA
| SetSimuScanMode)) | SetSimuScanMode))
XGI_DisplayOff(HwDeviceExtension, pVBInfo); XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo);
} }
} }
@ -7178,7 +7157,8 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F); xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F);
} }
static void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo) struct vb_device_info *pVBInfo)
{ {
unsigned short tempah; unsigned short tempah;
@ -7284,7 +7264,8 @@ static void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension,
if (!(pVBInfo->SetFlag & GatingCRT)) { if (!(pVBInfo->SetFlag & GatingCRT)) {
XGI_DisableGatingCRT(HwDeviceExtension, XGI_DisableGatingCRT(HwDeviceExtension,
pVBInfo); pVBInfo);
XGI_DisplayOn(HwDeviceExtension, pVBInfo); XGI_DisplayOn(xgifb_info, HwDeviceExtension,
pVBInfo);
} }
} }
} /* 301 */ } /* 301 */
@ -7300,11 +7281,12 @@ static void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension,
xgifb_reg_or(pVBInfo->Part1Port, 0x2E, 0x80); xgifb_reg_or(pVBInfo->Part1Port, 0x2E, 0x80);
xgifb_reg_and(pVBInfo->Part1Port, 0x00, 0x7F); xgifb_reg_and(pVBInfo->Part1Port, 0x00, 0x7F);
XGI_DisplayOn(HwDeviceExtension, pVBInfo); XGI_DisplayOn(xgifb_info, HwDeviceExtension, pVBInfo);
} /* End of VB */ } /* End of VB */
} }
static void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, static void XGI_SetCRT1Group(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo) struct vb_device_info *pVBInfo)
{ {
@ -7385,7 +7367,8 @@ static void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension,
pVBInfo, RefreshRateTableIndex, ModeNo); pVBInfo, RefreshRateTableIndex, ModeNo);
if (pVBInfo->IF_DEF_LVDS == 1) if (pVBInfo->IF_DEF_LVDS == 1)
xgifb_set_lvds(HwDeviceExtension->jChipType, xgifb_set_lvds(xgifb_info,
HwDeviceExtension->jChipType,
ModeNo, ModeIdIndex, pVBInfo); ModeNo, ModeIdIndex, pVBInfo);
} }
} }
@ -7397,7 +7380,8 @@ static void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension,
XGI_LoadDAC(ModeNo, ModeIdIndex, pVBInfo); XGI_LoadDAC(ModeNo, ModeIdIndex, pVBInfo);
} }
unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short ModeNo) unsigned short ModeNo)
{ {
unsigned short ModeIdIndex; unsigned short ModeIdIndex;
@ -7466,10 +7450,10 @@ unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension,
XGI_GetVBInfo(ModeNo, ModeIdIndex, HwDeviceExtension, pVBInfo); XGI_GetVBInfo(ModeNo, ModeIdIndex, HwDeviceExtension, pVBInfo);
XGI_GetTVInfo(ModeNo, ModeIdIndex, pVBInfo); XGI_GetTVInfo(ModeNo, ModeIdIndex, pVBInfo);
XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo); XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo);
XGI_DisableBridge(HwDeviceExtension, pVBInfo); XGI_DisableBridge(xgifb_info, HwDeviceExtension, pVBInfo);
if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) { if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) {
XGI_SetCRT1Group(HwDeviceExtension, ModeNo, XGI_SetCRT1Group(xgifb_info, HwDeviceExtension, ModeNo,
ModeIdIndex, pVBInfo); ModeIdIndex, pVBInfo);
if (pVBInfo->VBInfo & SetCRT2ToLCDA) { if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
@ -7478,7 +7462,8 @@ unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension,
} }
} else { } else {
if (!(pVBInfo->VBInfo & SwitchToCRT2)) { if (!(pVBInfo->VBInfo & SwitchToCRT2)) {
XGI_SetCRT1Group(HwDeviceExtension, ModeNo, XGI_SetCRT1Group(xgifb_info,
HwDeviceExtension, ModeNo,
ModeIdIndex, pVBInfo); ModeIdIndex, pVBInfo);
if (pVBInfo->VBInfo & SetCRT2ToLCDA) { if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
XGI_SetLCDAGroup(ModeNo, ModeIdIndex, XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
@ -7508,11 +7493,11 @@ unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension,
XGI_SetCRT2ModeRegs(ModeNo, HwDeviceExtension, pVBInfo); XGI_SetCRT2ModeRegs(ModeNo, HwDeviceExtension, pVBInfo);
XGI_OEM310Setting(ModeNo, ModeIdIndex, pVBInfo); /*0212*/ XGI_OEM310Setting(ModeNo, ModeIdIndex, pVBInfo); /*0212*/
XGI_CloseCRTC(HwDeviceExtension, pVBInfo); XGI_CloseCRTC(HwDeviceExtension, pVBInfo);
XGI_EnableBridge(HwDeviceExtension, pVBInfo); XGI_EnableBridge(xgifb_info, HwDeviceExtension, pVBInfo);
} /* !XG20 */ } /* !XG20 */
else { else {
if (pVBInfo->IF_DEF_LVDS == 1) if (pVBInfo->IF_DEF_LVDS == 1)
if (!XGI_XG21CheckLVDSMode(ModeNo, if (!XGI_XG21CheckLVDSMode(xgifb_info, ModeNo,
ModeIdIndex, ModeIdIndex,
pVBInfo)) pVBInfo))
return 0; return 0;
@ -7528,12 +7513,12 @@ unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension,
pVBInfo->SetFlag = 0; pVBInfo->SetFlag = 0;
pVBInfo->VBInfo = DisableCRT2Display; pVBInfo->VBInfo = DisableCRT2Display;
XGI_DisplayOff(HwDeviceExtension, pVBInfo); XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo);
XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex, XGI_SetCRT1Group(xgifb_info, HwDeviceExtension, ModeNo,
pVBInfo); ModeIdIndex, pVBInfo);
XGI_DisplayOn(HwDeviceExtension, pVBInfo); XGI_DisplayOn(xgifb_info, HwDeviceExtension, pVBInfo);
} }
XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo); XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo);

View File

@ -6,11 +6,13 @@ extern void XGI_UnLockCRT2(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *); struct vb_device_info *);
extern void XGI_LockCRT2(struct xgi_hw_device_info *HwDeviceExtension, extern void XGI_LockCRT2(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *); struct vb_device_info *);
extern void XGI_DisplayOff(struct xgi_hw_device_info *, extern void XGI_DisplayOff(struct xgifb_video_info *,
struct xgi_hw_device_info *,
struct vb_device_info *); struct vb_device_info *);
extern void XGI_GetVBType(struct vb_device_info *); extern void XGI_GetVBType(struct vb_device_info *);
extern void XGI_SenseCRT1(struct vb_device_info *); extern void XGI_SenseCRT1(struct vb_device_info *);
extern unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, extern unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short ModeNo) ; unsigned short ModeNo) ;
extern unsigned char XGI_SearchModeID(unsigned short ModeNo, extern unsigned char XGI_SearchModeID(unsigned short ModeNo,

View File

@ -375,7 +375,6 @@ struct vb_device_info {
unsigned char *pXGINew_CR97 ; unsigned char *pXGINew_CR97 ;
struct XGI330_LCDCapStruct *LCDCapList; struct XGI330_LCDCapStruct *LCDCapList;
struct XGI21_LVDSCapStruct *XG21_LVDSCapList;
struct XGI_TimingHStruct *TimingH; struct XGI_TimingHStruct *TimingH;
struct XGI_TimingVStruct *TimingV; struct XGI_TimingVStruct *TimingV;