Commit 105d8d0d authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Greg Kroah-Hartman

staging: xgifb: refactor XGI_SetXG21LCD() and XGI_SetXG27LCD()

The code is almost the same for XG21 and XG27, a single routine can
cover both.
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 160b006a
...@@ -988,63 +988,8 @@ static void XGI_SetXG27CRTC(unsigned short ModeNo, ...@@ -988,63 +988,8 @@ static void XGI_SetXG27CRTC(unsigned short ModeNo,
} }
} }
/* --------------------------------------------------------------------- */ static void xgifb_set_lcd(int chip_id,
/* Function : XGI_SetXG21LCD */ struct vb_device_info *pVBInfo,
/* Input : */
/* Output : FCLK duty cycle, FCLK delay compensation */
/* Description : All values set zero */
/* --------------------------------------------------------------------- */
static void XGI_SetXG21LCD(struct vb_device_info *pVBInfo,
unsigned short RefreshRateTableIndex, unsigned short ModeNo)
{
unsigned short Data, Temp, b3CC;
unsigned short XGI_P3cc;
XGI_P3cc = pVBInfo->P3cc;
xgifb_reg_set(pVBInfo->P3d4, 0x2E, 0x00);
xgifb_reg_set(pVBInfo->P3d4, 0x2F, 0x00);
xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x00);
xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x00);
if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) {
xgifb_reg_set(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E);
xgifb_reg_set(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F);
xgifb_reg_set(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46);
xgifb_reg_set(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47);
}
Temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
if (Temp & 0x01) {
xgifb_reg_or(pVBInfo->P3c4, 0x06, 0x40); /* 18 bits FP */
xgifb_reg_or(pVBInfo->P3c4, 0x09, 0x40);
}
xgifb_reg_or(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
xgifb_reg_and(pVBInfo->P3c4, 0x30, ~0x20);
xgifb_reg_and(pVBInfo->P3c4, 0x35, ~0x80);
if (ModeNo <= 0x13) {
b3CC = (unsigned char) inb(XGI_P3cc);
if (b3CC & 0x40)
/* Hsync polarity */
xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20);
if (b3CC & 0x80)
/* Vsync polarity */
xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80);
} else {
Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
if (Data & 0x4000)
/* Hsync polarity */
xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20);
if (Data & 0x8000)
/* Vsync polarity */
xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80);
}
}
static void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
unsigned short RefreshRateTableIndex, unsigned short RefreshRateTableIndex,
unsigned short ModeNo) unsigned short ModeNo)
{ {
...@@ -1058,11 +1003,13 @@ static void XGI_SetXG27LCD(struct vb_device_info *pVBInfo, ...@@ -1058,11 +1003,13 @@ static void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x00); xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x00);
xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x00); xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x00);
if (chip_id == XG27) {
Temp = xgifb_reg_get(pVBInfo->P3d4, 0x37); Temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
if ((Temp & 0x03) == 0) { /* dual 12 */ if ((Temp & 0x03) == 0) { /* dual 12 */
xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x13); xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x13);
xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x13); xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x13);
} }
}
if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) { if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) {
xgifb_reg_set(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E); xgifb_reg_set(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E);
...@@ -1071,7 +1018,16 @@ static void XGI_SetXG27LCD(struct vb_device_info *pVBInfo, ...@@ -1071,7 +1018,16 @@ static void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
xgifb_reg_set(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47); xgifb_reg_set(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47);
} }
if (chip_id == XG27) {
XGI_SetXG27FPBits(pVBInfo); XGI_SetXG27FPBits(pVBInfo);
} else {
Temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
if (Temp & 0x01) {
/* 18 bits FP */
xgifb_reg_or(pVBInfo->P3c4, 0x06, 0x40);
xgifb_reg_or(pVBInfo->P3c4, 0x09, 0x40);
}
}
xgifb_reg_or(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */ xgifb_reg_or(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
...@@ -8278,12 +8234,8 @@ static void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, ...@@ -8278,12 +8234,8 @@ static void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension,
XGI_UpdateXG21CRTC(ModeNo, pVBInfo, XGI_UpdateXG21CRTC(ModeNo, pVBInfo,
RefreshRateTableIndex); RefreshRateTableIndex);
if (HwDeviceExtension->jChipType == XG27) xgifb_set_lcd(HwDeviceExtension->jChipType,
XGI_SetXG27LCD(pVBInfo, RefreshRateTableIndex, pVBInfo, RefreshRateTableIndex, ModeNo);
ModeNo);
else
XGI_SetXG21LCD(pVBInfo, RefreshRateTableIndex,
ModeNo);
if (pVBInfo->IF_DEF_LVDS == 1) { if (pVBInfo->IF_DEF_LVDS == 1) {
if (HwDeviceExtension->jChipType == XG27) if (HwDeviceExtension->jChipType == XG27)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment