diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2011-03-13 06:26:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-14 14:52:26 -0400 |
commit | 0658733528268ed055d1fd43fc5296b0ac98a7c2 (patch) | |
tree | b0bdf6412dc82833b3c6e7f7cdf7a6c2db44f496 | |
parent | fd0ad4701a3d096e6caf609e15eecae1459cc4b4 (diff) |
staging: xgifb: eliminate redudant chip type >= XG40 checks
Since all chips supported by the driver are >= XG40, these checks are
redundant and the code can be modified accordingly.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/xgifb/XGI_main_26.c | 5 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_ext.c | 8 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_init.c | 70 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_setmode.c | 32 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_table.h | 23 |
5 files changed, 36 insertions, 102 deletions
diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index b2cb7a3889a..ed0d554d595 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c | |||
@@ -1502,10 +1502,7 @@ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con, | |||
1502 | fix->line_length = xgi_video_info.video_linelength; | 1502 | fix->line_length = xgi_video_info.video_linelength; |
1503 | fix->mmio_start = xgi_video_info.mmio_base; | 1503 | fix->mmio_start = xgi_video_info.mmio_base; |
1504 | fix->mmio_len = xgi_video_info.mmio_size; | 1504 | fix->mmio_len = xgi_video_info.mmio_size; |
1505 | if (xgi_video_info.chip >= XG40) | 1505 | fix->accel = FB_ACCEL_XGI_XABRE; |
1506 | fix->accel = FB_ACCEL_XGI_XABRE; | ||
1507 | else | ||
1508 | fix->accel = FB_ACCEL_XGI_GLAMOUR_2; | ||
1509 | 1506 | ||
1510 | DEBUGPRN("end of get_fix"); | 1507 | DEBUGPRN("end of get_fix"); |
1511 | return 0; | 1508 | return 0; |
diff --git a/drivers/staging/xgifb/vb_ext.c b/drivers/staging/xgifb/vb_ext.c index 6863fc22963..5cf094a64f2 100644 --- a/drivers/staging/xgifb/vb_ext.c +++ b/drivers/staging/xgifb/vb_ext.c | |||
@@ -383,13 +383,7 @@ unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *HwDeviceExtension, str | |||
383 | /* unsigned short SoftSetting ; */ | 383 | /* unsigned short SoftSetting ; */ |
384 | unsigned short temp; | 384 | unsigned short temp; |
385 | 385 | ||
386 | if ((HwDeviceExtension->jChipType >= XG20) || (HwDeviceExtension->jChipType >= XG40)) | 386 | temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo); |
387 | temp = 0; | ||
388 | else | ||
389 | temp = XGINew_GetPanelID(pVBInfo); | ||
390 | |||
391 | if (!temp) | ||
392 | temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo); | ||
393 | 387 | ||
394 | return temp; | 388 | return temp; |
395 | } | 389 | } |
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 10c0a3bcbba..86d7333956d 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c | |||
@@ -1382,13 +1382,8 @@ unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension) | |||
1382 | 1382 | ||
1383 | printk("8"); | 1383 | printk("8"); |
1384 | 1384 | ||
1385 | if ((HwDeviceExtension->jChipType >= XG20) || (HwDeviceExtension->jChipType >= XG40)) { | 1385 | for (i = 0x31; i <= 0x3B; i++) |
1386 | for (i = 0x31; i <= 0x3B; i++) | 1386 | XGINew_SetReg1(pVBInfo->P3c4, i, 0); |
1387 | XGINew_SetReg1(pVBInfo->P3c4, i, 0); | ||
1388 | } else { | ||
1389 | for (i = 0x31; i <= 0x3D; i++) | ||
1390 | XGINew_SetReg1(pVBInfo->P3c4, i, 0); | ||
1391 | } | ||
1392 | printk("9"); | 1387 | printk("9"); |
1393 | 1388 | ||
1394 | if (HwDeviceExtension->jChipType == XG42) /* [Hsuan] 2004/08/20 Auto over driver for XG42 */ | 1389 | if (HwDeviceExtension->jChipType == XG42) /* [Hsuan] 2004/08/20 Auto over driver for XG42 */ |
@@ -1407,7 +1402,6 @@ unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension) | |||
1407 | 1402 | ||
1408 | /* 3.SetMemoryClock | 1403 | /* 3.SetMemoryClock |
1409 | 1404 | ||
1410 | if (HwDeviceExtension->jChipType >= XG40) | ||
1411 | XGINew_RAMType = (int)XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo); | 1405 | XGINew_RAMType = (int)XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo); |
1412 | */ | 1406 | */ |
1413 | 1407 | ||
@@ -1467,30 +1461,28 @@ unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension) | |||
1467 | 1461 | ||
1468 | printk("13"); | 1462 | printk("13"); |
1469 | 1463 | ||
1470 | if (HwDeviceExtension->jChipType >= XG40) { | 1464 | /* Set AGP customize registers (in SetDefAGPRegs) Start */ |
1471 | /* Set AGP customize registers (in SetDefAGPRegs) Start */ | 1465 | for (i = 0x47; i <= 0x4C; i++) |
1472 | for (i = 0x47; i <= 0x4C; i++) | 1466 | XGINew_SetReg1(pVBInfo->P3d4, i, pVBInfo->AGPReg[i - 0x47]); |
1473 | XGINew_SetReg1(pVBInfo->P3d4, i, pVBInfo->AGPReg[i - 0x47]); | 1467 | |
1474 | 1468 | for (i = 0x70; i <= 0x71; i++) | |
1475 | for (i = 0x70; i <= 0x71; i++) | 1469 | XGINew_SetReg1(pVBInfo->P3d4, i, pVBInfo->AGPReg[6 + i - 0x70]); |
1476 | XGINew_SetReg1(pVBInfo->P3d4, i, pVBInfo->AGPReg[6 + i - 0x70]); | 1470 | |
1477 | 1471 | for (i = 0x74; i <= 0x77; i++) | |
1478 | for (i = 0x74; i <= 0x77; i++) | 1472 | XGINew_SetReg1(pVBInfo->P3d4, i, pVBInfo->AGPReg[8 + i - 0x74]); |
1479 | XGINew_SetReg1(pVBInfo->P3d4, i, pVBInfo->AGPReg[8 + i - 0x74]); | 1473 | /* Set AGP customize registers (in SetDefAGPRegs) End */ |
1480 | /* Set AGP customize registers (in SetDefAGPRegs) End */ | 1474 | /* [Hsuan]2004/12/14 AGP Input Delay Adjustment on 850 */ |
1481 | /* [Hsuan]2004/12/14 AGP Input Delay Adjustment on 850 */ | 1475 | /* XGINew_SetReg4(0xcf8 , 0x80000000); */ |
1482 | /* XGINew_SetReg4(0xcf8 , 0x80000000); */ | 1476 | /* ChipsetID = XGINew_GetReg3(0x0cfc); */ |
1483 | /* ChipsetID = XGINew_GetReg3(0x0cfc); */ | 1477 | /* if (ChipsetID == 0x25308086) */ |
1484 | /* if (ChipsetID == 0x25308086) */ | 1478 | /* XGINew_SetReg1(pVBInfo->P3d4, 0x77, 0xF0); */ |
1485 | /* XGINew_SetReg1(pVBInfo->P3d4, 0x77, 0xF0); */ | 1479 | |
1486 | 1480 | HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension, 0x50, 0, &Temp); /* Get */ | |
1487 | HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension, 0x50, 0, &Temp); /* Get */ | 1481 | Temp >>= 20; |
1488 | Temp >>= 20; | 1482 | Temp &= 0xF; |
1489 | Temp &= 0xF; | 1483 | |
1490 | 1484 | if (Temp == 1) | |
1491 | if (Temp == 1) | 1485 | XGINew_SetReg1(pVBInfo->P3d4, 0x48, 0x20); /* CR48 */ |
1492 | XGINew_SetReg1(pVBInfo->P3d4, 0x48, 0x20); /* CR48 */ | ||
1493 | } | ||
1494 | printk("14"); | 1486 | printk("14"); |
1495 | } /* != XG20 */ | 1487 | } /* != XG20 */ |
1496 | 1488 | ||
@@ -1529,7 +1521,6 @@ unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension) | |||
1529 | printk("17"); | 1521 | printk("17"); |
1530 | 1522 | ||
1531 | /* | 1523 | /* |
1532 | if (HwDeviceExtension->jChipType >= XG40) | ||
1533 | SetPowerConsume (HwDeviceExtension, pVBInfo->P3c4); */ | 1524 | SetPowerConsume (HwDeviceExtension, pVBInfo->P3c4); */ |
1534 | 1525 | ||
1535 | if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ | 1526 | if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ |
@@ -1578,16 +1569,13 @@ unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension) | |||
1578 | } | 1569 | } |
1579 | printk("19"); | 1570 | printk("19"); |
1580 | 1571 | ||
1581 | if (HwDeviceExtension->jChipType >= XG40) { | 1572 | XGINew_RAMType = (int) XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo); |
1582 | if (HwDeviceExtension->jChipType >= XG40) | ||
1583 | XGINew_RAMType = (int) XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo); | ||
1584 | 1573 | ||
1585 | XGINew_SetDRAMDefaultRegister340(HwDeviceExtension, pVBInfo->P3d4, pVBInfo); | 1574 | XGINew_SetDRAMDefaultRegister340(HwDeviceExtension, pVBInfo->P3d4, pVBInfo); |
1586 | 1575 | ||
1587 | printk("20"); | 1576 | printk("20"); |
1588 | XGINew_SetDRAMSize_340(HwDeviceExtension, pVBInfo); | 1577 | XGINew_SetDRAMSize_340(HwDeviceExtension, pVBInfo); |
1589 | printk("21"); | 1578 | printk("21"); |
1590 | } /* XG40 */ | ||
1591 | 1579 | ||
1592 | printk("22"); | 1580 | printk("22"); |
1593 | 1581 | ||
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 4d5696349bc..c9a97e631bc 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c | |||
@@ -74,18 +74,8 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) | |||
74 | /* XGINew_UBLCDDataTable = (struct XGI_LCDDataTablStruct *) XGI_LCDDataTable; */ | 74 | /* XGINew_UBLCDDataTable = (struct XGI_LCDDataTablStruct *) XGI_LCDDataTable; */ |
75 | /* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable; */ | 75 | /* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable; */ |
76 | 76 | ||
77 | if (ChipType >= XG40) { | 77 | pVBInfo->MCLKData = (struct XGI_MCLKDataStruct *) XGI340New_MCLKData; |
78 | pVBInfo->MCLKData | 78 | pVBInfo->ECLKData = (struct XGI_ECLKDataStruct *) XGI340_ECLKData; |
79 | = (struct XGI_MCLKDataStruct *) XGI340New_MCLKData; | ||
80 | pVBInfo->ECLKData | ||
81 | = (struct XGI_ECLKDataStruct *) XGI340_ECLKData; | ||
82 | } else { | ||
83 | pVBInfo->MCLKData | ||
84 | = (struct XGI_MCLKDataStruct *) XGI330New_MCLKData; | ||
85 | pVBInfo->ECLKData | ||
86 | = (struct XGI_ECLKDataStruct *) XGI330_ECLKData; | ||
87 | } | ||
88 | |||
89 | pVBInfo->VCLKData = (struct XGI_VCLKDataStruct *) XGI_VCLKData; | 79 | pVBInfo->VCLKData = (struct XGI_VCLKDataStruct *) XGI_VCLKData; |
90 | pVBInfo->VBVCLKData = (struct XGI_VBVCLKDataStruct *) XGI_VBVCLKData; | 80 | pVBInfo->VBVCLKData = (struct XGI_VBVCLKDataStruct *) XGI_VBVCLKData; |
91 | pVBInfo->ScreenOffset = XGI330_ScreenOffset; | 81 | pVBInfo->ScreenOffset = XGI330_ScreenOffset; |
@@ -3291,15 +3281,7 @@ static void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension, | |||
3291 | if (!(temp & 0x20)) { | 3281 | if (!(temp & 0x20)) { |
3292 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x17); | 3282 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x17); |
3293 | if (temp & 0x80) { | 3283 | if (temp & 0x80) { |
3294 | if ((HwDeviceExtension->jChipType >= XG20) | 3284 | temp = XGINew_GetReg1(pVBInfo->P3d4, 0x53); |
3295 | || (HwDeviceExtension->jChipType | ||
3296 | >= XG40)) | ||
3297 | temp = XGINew_GetReg1(pVBInfo->P3d4, | ||
3298 | 0x53); | ||
3299 | else | ||
3300 | temp = XGINew_GetReg1(pVBInfo->P3d4, | ||
3301 | 0x63); | ||
3302 | |||
3303 | if (!(temp & 0x40)) | 3285 | if (!(temp & 0x40)) |
3304 | tempcl |= ActiveCRT1; | 3286 | tempcl |= ActiveCRT1; |
3305 | } | 3287 | } |
@@ -3377,7 +3359,7 @@ void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension, | |||
3377 | /* | 3359 | /* |
3378 | if ( HwDeviceExtension->jChipType >= XG20 ) { | 3360 | if ( HwDeviceExtension->jChipType >= XG20 ) { |
3379 | pVBInfo->Set_VGAType = XG20; | 3361 | pVBInfo->Set_VGAType = XG20; |
3380 | } else if (HwDeviceExtension->jChipType >= XG40) { | 3362 | } else { |
3381 | pVBInfo->Set_VGAType = VGA_XGI340; | 3363 | pVBInfo->Set_VGAType = VGA_XGI340; |
3382 | } | 3364 | } |
3383 | */ | 3365 | */ |
@@ -8330,14 +8312,10 @@ unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension, | |||
8330 | pVBInfo->IF_DEF_HiVision = 0; | 8312 | pVBInfo->IF_DEF_HiVision = 0; |
8331 | pVBInfo->IF_DEF_CRT2Monitor = 0; | 8313 | pVBInfo->IF_DEF_CRT2Monitor = 0; |
8332 | pVBInfo->VBType = 0; /*set VBType default 0*/ | 8314 | pVBInfo->VBType = 0; /*set VBType default 0*/ |
8333 | } else if (HwDeviceExtension->jChipType >= XG40) { | ||
8334 | pVBInfo->IF_DEF_YPbPr = 1; | ||
8335 | pVBInfo->IF_DEF_HiVision = 1; | ||
8336 | pVBInfo->IF_DEF_CRT2Monitor = 1; | ||
8337 | } else { | 8315 | } else { |
8338 | pVBInfo->IF_DEF_YPbPr = 1; | 8316 | pVBInfo->IF_DEF_YPbPr = 1; |
8339 | pVBInfo->IF_DEF_HiVision = 1; | 8317 | pVBInfo->IF_DEF_HiVision = 1; |
8340 | pVBInfo->IF_DEF_CRT2Monitor = 0; | 8318 | pVBInfo->IF_DEF_CRT2Monitor = 1; |
8341 | } | 8319 | } |
8342 | 8320 | ||
8343 | pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14; | 8321 | pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14; |
diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index 78b1c796f01..d71cd55a705 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h | |||
@@ -1,17 +1,5 @@ | |||
1 | #define Tap4 | 1 | #define Tap4 |
2 | 2 | ||
3 | |||
4 | static struct XGI_MCLKDataStruct XGI330New_MCLKData[] = | ||
5 | { | ||
6 | { 0x5c,0x23,0x01,166}, | ||
7 | { 0x5c,0x23,0x01,166}, | ||
8 | { 0x7C,0x08,0x80,200}, | ||
9 | { 0x79,0x06,0x80,250}, | ||
10 | { 0x29,0x01,0x81,300}, | ||
11 | { 0x29,0x01,0x81,300}, | ||
12 | { 0x29,0x01,0x81,300}, | ||
13 | { 0x29,0x01,0x81,300} | ||
14 | }; | ||
15 | //yilin modify for xgi20 | 3 | //yilin modify for xgi20 |
16 | static struct XGI_MCLKDataStruct XGI340New_MCLKData[] = | 4 | static struct XGI_MCLKDataStruct XGI340New_MCLKData[] = |
17 | { | 5 | { |
@@ -37,17 +25,6 @@ static struct XGI_MCLKDataStruct XGI27New_MCLKData[] = | |||
37 | { 0x5c,0x23,0x01,166} | 25 | { 0x5c,0x23,0x01,166} |
38 | }; | 26 | }; |
39 | 27 | ||
40 | static struct XGI_ECLKDataStruct XGI330_ECLKData[] = | ||
41 | { | ||
42 | { 0x7c,0x08,0x01,200}, | ||
43 | { 0x7c,0x08,0x01,200}, | ||
44 | { 0x7C,0x08,0x80,200}, | ||
45 | { 0x79,0x06,0x80,250}, | ||
46 | { 0x29,0x01,0x81,300}, | ||
47 | { 0x29,0x01,0x81,300}, | ||
48 | { 0x29,0x01,0x81,300}, | ||
49 | { 0x29,0x01,0x81,300} | ||
50 | }; | ||
51 | //yilin modify for xgi20 | 28 | //yilin modify for xgi20 |
52 | static struct XGI_ECLKDataStruct XGI340_ECLKData[] = | 29 | static struct XGI_ECLKDataStruct XGI340_ECLKData[] = |
53 | { | 30 | { |