Skip to contentSkip to conversation

staging/xgifb: Use sis headers and remove duplicated structs and defines (part II)

PATCH New Peter Huewe 1 participant 8 messages Feb 9, 2012 Staging

lore
Share & tools
lore
#0 lore raw

This is the second big chunk of patches which gets rid of (another set of) duplicated structs and defines in the xgifb driver that are already defined in the sis headers.
This time we tackle the initdef.h.

Since the xgifb driver used the sis driver as a template for development, a lot of defines and structs were redefined with only slightly different names. This patchset tries to remove some of these duplicates by including the sis headers and replacing any xgi struct/define by its identical twin from the sis headers.

The patches should not change any behavior of the driver

git diff --stat origin/staging-next

 drivers/staging/xgifb/XGI_main_26.c |   10 +-
 drivers/staging/xgifb/vb_def.h      |  178 +-------
 drivers/staging/xgifb/vb_init.c     |   18 +-
 drivers/staging/xgifb/vb_setmode.c  |  814 +++++++++++++++++-----------------
 drivers/staging/xgifb/vb_table.h    |  336 +++++++-------
 5 files changed, 602 insertions(+), 754 deletions(-)
#1 lore raw

PATCH 1/7 staging/xgifb: Include sis initdef.h header

This patch includes the initdef.h header from the sis driver. Since the xgi driver used to redefine a lot of stuff from the sis driver, we can simply include the headers of the sis driver itself, so we can remove duplicated stuff later on.

In order to include the initdef.h we have to rename the header guards.

---
 drivers/staging/xgifb/vb_def.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/staging/xgifb/vb_def.h +3 -2
index 5beeef9..0472c86 100644
@@ -1,7 +1,8 @@
 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/xgi/initdef.h
  * ,v 1.4 2000/12/02 01:16:17 dawes Exp $*/
-#ifndef _INITDEF_
-#define _INITDEF_
+#ifndef _VB_DEF_
+#define _VB_DEF_
+#include "../../video/sis/initdef.h"
 
 #define VB_XGI301C      0x0020 /* for 301C */
 /*end 301b*/
Signature · 1 line
1.7.3.4
#2 lore raw

PATCH 2/7 staging/xgifb: Rename panel defines and remove duplicated defines

In reply to Peter Huewe

This patch renames the Panel* defines and their usage to the naming convention of the sis initdef.h and removes the now duplicated defines.

Renames:
Panel320x480 -> Panel_320x480
Panel800x600 -> Panel_800x600
Panel1024x768 -> Panel_1024x768
Panel1024x768x75 -> Panel_1024x768x75
Panel1280x1024 -> Panel_1280x1024
Panel1280x1024x75 -> Panel_1280x1024x75
Panel1280x960 -> Panel_1280x960
Panel1400x1050 -> Panel_1400x1050
Panel1600x1200 -> Panel_1600x1200

---
 drivers/staging/xgifb/vb_def.h     |   13 +--
 drivers/staging/xgifb/vb_setmode.c |   94 ++++++++++----------
 drivers/staging/xgifb/vb_table.h   |  168 ++++++++++++++++++------------------
 3 files changed, 134 insertions(+), 141 deletions(-)
drivers/staging/xgifb/vb_def.h +3 -10
index 0472c86..9b2937c 100644
@@ -19,18 +19,11 @@
 #define PanelRGB18Bit           0x0100
 #define PanelRGB24Bit           0x0000
 
-#define Panel320x480            0x07 /*fstn*/
+#define Panel_320x480            0x07 /*fstn*/
 /* [ycchen] 02/12/03 Modify for Multi-Sync. LCD Support */
 #define PanelResInfo            0x1F /* CR36 Panel Type/LCDResInfo */
-#define Panel800x600            0x01
-#define Panel1024x768           0x02
-#define Panel1024x768x75        0x22
-#define Panel1280x1024          0x03
-#define Panel1280x1024x75       0x23
-#define Panel640x480            0x04
-#define Panel1280x960           0x07
-#define Panel1400x1050          0x09
-#define Panel1600x1200          0x0B
+#define Panel_1024x768x75        0x22
+#define Panel_1280x1024x75       0x23
 
 #define PanelRef60Hz            0x00
 #define PanelRef75Hz            0x20
drivers/staging/xgifb/vb_setmode.c +47 -47

271 lines not on this page · raw message

drivers/staging/xgifb/vb_table.h +84 -84

253 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#3 lore raw

PATCH 3/7 staging/xgifb: Rename Set* defines and remove duplicated defines

In reply to Peter Huewe

This patch renames the Set* defines and their usage to the naming convention of the sis initdef.h and removes the now duplicated defines.

Renames:
SetCRT2ToHiVisionTV -> SetCRT2ToHiVision
SetCRT2ToYPbPr -> SetCRT2ToYPbPr525750

SetNTSCJ -> TVSetNTSCJ
SetPALMTV -> TVSetPALM
SetPALNTV -> TVSetPALN
SetPALTV -> TVSetPAL

SetYPbPrMode1080i -> TVSetHiVision
SetYPbPrMode525i -> TVSetYPbPr525i
SetYPbPrMode525p -> TVSetYPbPr525p
SetYPbPrMode750p -> TVSetYPbPr750p

---
 drivers/staging/xgifb/vb_def.h     |   10 --
 drivers/staging/xgifb/vb_init.c    |    4 +-
 drivers/staging/xgifb/vb_setmode.c |  244 ++++++++++++++++++------------------
 3 files changed, 124 insertions(+), 134 deletions(-)
drivers/staging/xgifb/vb_def.h +0 -10
index 9b2937c..c368322 100644
@@ -131,11 +131,9 @@
 #define SetCRT2ToSCART      0x0010
 #define SetCRT2ToLCD        0x0020
 #define SetCRT2ToRAMDAC     0x0040
-#define SetCRT2ToHiVisionTV 0x0080
 #define SetCRT2ToLCDA       0x0100
 #define SetInSlaveMode      0x0200
 #define SetNotSimuMode      0x0400
-#define SetCRT2ToYPbPr      0x0800
 #define LoadDACFlag         0x1000
 #define DisableCRT2Display  0x2000
 #define DriverMode          0x4000
@@ -150,14 +148,6 @@
 #define EnableChA           0x8000
 
 #define SetNTSCTV           0x0000 /* TV Info */
-#define SetPALTV            0x0001
-#define SetNTSCJ            0x0002
-#define SetPALMTV           0x0004
-#define SetPALNTV           0x0008
-#define SetYPbPrMode525i     0x0020
-#define SetYPbPrMode525p     0x0040
-#define SetYPbPrMode750p     0x0080
-#define SetYPbPrMode1080i    0x0100
 #define SetTVLowResolution   0x0400
 #define TVSimuMode           0x0800
 #define RPLLDIV2XO           0x1000
drivers/staging/xgifb/vb_init.c +2 -2
index a53a097..4c54568 100644
@@ -1268,7 +1268,7 @@ static void XGINew_SetModeScratch(struct xgi_hw_device_info *HwDeviceExtension,
 
 				if (pVBInfo->IF_DEF_HiVision == 1) {
 					if ((temp >> 8) & ActiveHiTV)
-						tempcl |= SetCRT2ToHiVisionTV;
+						tempcl |= SetCRT2ToHiVision;
 				}
 
 				if (pVBInfo->IF_DEF_YPbPr == 1) {
@@ -1287,7 +1287,7 @@ static void XGINew_SetModeScratch(struct xgi_hw_device_info *HwDeviceExtension,
 
 		if (pVBInfo->IF_DEF_HiVision == 1) {
 			if ((temp >> 8) & ActiveHiTV)
-				tempcl |= SetCRT2ToHiVisionTV;
+				tempcl |= SetCRT2ToHiVision;
 		}
 
 		if (pVBInfo->IF_DEF_YPbPr == 1) {
drivers/staging/xgifb/vb_setmode.c +122 -122

696 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#4 lore raw

PATCH 4/7 staging/xgifb: Rename remaining sis initdef.h defines and remove duplicates

In reply to Peter Huewe

This patch renames the remaining duplicate defines and their usage to the naming convention of the sis initdef.h and removes the now duplicated defines.

Renames:
CRT2DisplayFlag -> DisableCRT2Display
ModeInfoFlag -> ModeTypeMask

Support16Bpp -> Mode16Bpp
Support32Bpp -> Mode32Bpp

SupportHiVisionTV -> SupportHiVision
SupportYPbPr -> SupportYPbPr750p
SwitchToCRT2 -> SwitchCRT2

VB_XGI301 -> VB_SIS301
VB_XGI301B -> VB_SIS301B
VB_XGI301LV -> VB_SIS301LV
VB_XGI302B -> VB_SIS302B
VB_XGI302LV -> VB_SIS302LV
VB_YPbPr525p -> YPbPr525p
VB_YPbPr750p -> YPbPr750p

VCLK108_2 -> VCLK108_2_315
VCLK65 -> VCLK65_315

XGI_CRT2_PORT_04 -> SIS_CRT2_PORT_04
XGI_CRT2_PORT_10 -> SIS_CRT2_PORT_10
XGI_CRT2_PORT_12 -> SIS_CRT2_PORT_12
XGI_CRT2_PORT_14 -> SIS_CRT2_PORT_14

---
 drivers/staging/xgifb/XGI_main_26.c |   10 +-
 drivers/staging/xgifb/vb_def.h      |   25 ---
 drivers/staging/xgifb/vb_init.c     |   14 +-
 drivers/staging/xgifb/vb_setmode.c  |  306 +++++++++++++++++-----------------
 drivers/staging/xgifb/vb_table.h    |  172 ++++++++++----------
 5 files changed, 251 insertions(+), 276 deletions(-)
drivers/staging/xgifb/XGI_main_26.c +5 -5
index fb9b5b3..21c0378 100644
@@ -371,15 +371,15 @@ static void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr)
 	XGI_Pr->P3c9 = BaseAddr + 0x19;
 	XGI_Pr->P3da = BaseAddr + 0x2A;
 	/* Digital video interface registers (LCD) */
-	XGI_Pr->Part1Port = BaseAddr + XGI_CRT2_PORT_04;
+	XGI_Pr->Part1Port = BaseAddr + SIS_CRT2_PORT_04;
 	/* 301 TV Encoder registers */
-	XGI_Pr->Part2Port = BaseAddr + XGI_CRT2_PORT_10;
+	XGI_Pr->Part2Port = BaseAddr + SIS_CRT2_PORT_10;
 	/* 301 Macrovision registers */
-	XGI_Pr->Part3Port = BaseAddr + XGI_CRT2_PORT_12;
+	XGI_Pr->Part3Port = BaseAddr + SIS_CRT2_PORT_12;
 	/* 301 VGA2 (and LCD) registers */
-	XGI_Pr->Part4Port = BaseAddr + XGI_CRT2_PORT_14;
+	XGI_Pr->Part4Port = BaseAddr + SIS_CRT2_PORT_14;
 	/* 301 palette address port registers */
-	XGI_Pr->Part5Port = BaseAddr + XGI_CRT2_PORT_14 + 2;
+	XGI_Pr->Part5Port = BaseAddr + SIS_CRT2_PORT_14 + 2;
 
 }
 
drivers/staging/xgifb/vb_def.h +0 -25
index c368322..12454c5 100644
@@ -5,10 +5,6 @@
 #include "../../video/sis/initdef.h"
 
 #define VB_XGI301C      0x0020 /* for 301C */
-/*end 301b*/
-
-#define VB_YPbPr525p    0x01
-#define VB_YPbPr750p    0x02
 #define VB_YPbPr1080i   0x03
 
 #define LVDSCRT1Len     15
@@ -28,16 +24,10 @@
 #define PanelRef60Hz            0x00
 #define PanelRef75Hz            0x20
 
-#define CRT2DisplayFlag         0x2000
-
 #define YPbPr525iVCLK           0x03B
 #define YPbPr525iVCLK_2         0x03A
 
 #define XGI_CRT2_PORT_00        (0x00 - 0x030)
-#define XGI_CRT2_PORT_04        (0x04 - 0x030)
-#define XGI_CRT2_PORT_10        (0x10 - 0x30)
-#define XGI_CRT2_PORT_12        (0x12 - 0x30)
-#define XGI_CRT2_PORT_14        (0x14 - 0x30)
 
 #define _PanelType00             0x00
 #define _PanelType01             0x08
@@ -77,15 +67,9 @@
 #define VCLKLen           4
 #define VGA_XGI340        0x0001       /* 340 series */
 
-#define VB_XGI301         0x0001       /* VB Type Info */
-#define VB_XGI301B        0x0002       /* 301 series */
-#define VB_XGI302B        0x0004
 #define VB_NoLCD          0x8000
-#define VB_XGI301LV       0x0008
-#define VB_XGI302LV       0x0010
 #define VB_LVDS_NS        0x0001       /* 3rd party chip */
 
-#define ModeInfoFlag      0x0007
 #define ModeText          0x0000
 #define ModeEGA           0x0002    /* 16 colors mode */
 #define ModeVGA           0x0003    /* 256 colors mode */
@@ -103,19 +87,14 @@
 #define DoubleScanMode    0x8000
 
 /* -------------- Ext_InfoFlag */
-#define Support16Bpp        0x0005
-#define Support32Bpp        0x0007
-
 #define SupportAllCRT2      0x0078
 #define SupportTV           0x0008
-#define SupportHiVisionTV   0x0010
 #define SupportLCD          0x0020
 #define SupportRAMDAC2      0x0040
 #define NoSupportTV         0x0070
 #define NoSupportHiVisionTV 0x0060
 #define NoSupportLCD        0x0058
 #define SupportTV1024       0x0800 /* 301btest */
-#define SupportYPbPr        0x1000 /* 301lv */
 #define InterlaceMode       0x0080
 #define SyncPP              0x0000
 #define SyncPN              0x4000
@@ -124,7 +103,6 @@
 
 /* -------------- SetMode Stack/Scratch */
 #define SetSimuScanMode     0x0001    /* VBInfo/CR30 & CR31 */
-#define SwitchToCRT2        0x0002
 #define SetCRT2ToTV         0x089C
 #define SetCRT2ToAVIDEO     0x0004
 #define SetCRT2ToSVIDEO     0x0008
@@ -135,7 +113,6 @@
 #define SetInSlaveMode      0x0200
 #define SetNotSimuMode      0x0400
 #define LoadDACFlag         0x1000
-#define DisableCRT2Display  0x2000
 #define DriverMode          0x4000
 #define SetCRT2ToDualEdge   0x8000
 
@@ -275,7 +252,6 @@
 #define VCLK50               0x08
 #define VCLK52_406           0x09
 #define VCLK56_25            0x0A
-#define VCLK65               0x0B
 #define VCLK68_179           0x0D
 #define VCLK72_852           0x0E
 #define VCLK75               0x0F
@@ -284,7 +260,6 @@
 #define VCLK83_95            0x13
 #define VCLK86_6             0x15
 #define VCLK94_5             0x16
-#define VCLK108_2            0x19
 #define VCLK113_309          0x1B
 #define VCLK116_406          0x1C
 #define VCLK135_5            0x1E
drivers/staging/xgifb/vb_init.c +7 -7
index 4c54568..94d5c35 100644
@@ -1299,9 +1299,9 @@ static void XGINew_SetModeScratch(struct xgi_hw_device_info *HwDeviceExtension,
 	tempcl |= SetSimuScanMode;
 	if ((!(temp & ActiveCRT1)) && ((temp & ActiveLCD) || (temp & ActiveTV)
 			|| (temp & ActiveCRT2)))
-		tempcl ^= (SetSimuScanMode | SwitchToCRT2);
+		tempcl ^= (SetSimuScanMode | SwitchCRT2);
 	if ((temp & ActiveLCD) && (temp & ActiveTV))
-		tempcl ^= (SetSimuScanMode | SwitchToCRT2);
+		tempcl ^= (SetSimuScanMode | SwitchCRT2);
 	xgifb_reg_set(pVBInfo->P3d4, 0x30, tempcl);
 
 	CR31Data = xgifb_reg_get(pVBInfo->P3d4, 0x31);
@@ -1516,11 +1516,11 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
 	pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
 	pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
-	pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
-	pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
-	pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
-	pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
-	pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
+	pVBInfo->Part1Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_04;
+	pVBInfo->Part2Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_10;
+	pVBInfo->Part3Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_12;
+	pVBInfo->Part4Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_14;
+	pVBInfo->Part5Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_14 + 2;
 	printk("5");
 
 	if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
drivers/staging/xgifb/vb_setmode.c +153 -153

794 lines not on this page · raw message

drivers/staging/xgifb/vb_table.h +86 -86

289 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#5 lore raw

PATCH 5/7 staging/xgifb: Rename XGI specific initdef.h defines

In reply to Peter Huewe

This patch renames some of the defines that exist in the sis initdef.h but seem to have a different value.
In order to preserve the functionality of the driver, we simply prepend these defines with XGI_ (for now) to resolve conflicts and review them later on.

Renames:
SetCRT2ToLCDA -> XGI_SetCRT2ToLCDA
LCDVESATiming -> XGI_LCDVESATiming
EnableLVDSDDA -> XGI_EnableLVDSDDA
LCDDualLink -> XGI_LCDDualLink
ModeSwitchStatus -> XGI_ModeSwitchStatus
YPbPr750pVCLK -> XGI_YPbPr750pVCLK

---
 drivers/staging/xgifb/vb_def.h     |   12 ++--
 drivers/staging/xgifb/vb_setmode.c |  148 ++++++++++++++++++------------------
 drivers/staging/xgifb/vb_table.h   |    8 +-
 3 files changed, 84 insertions(+), 84 deletions(-)
drivers/staging/xgifb/vb_def.h +6 -6
index 12454c5..a4fedbd 100644
@@ -109,7 +109,7 @@
 #define SetCRT2ToSCART      0x0010
 #define SetCRT2ToLCD        0x0020
 #define SetCRT2ToRAMDAC     0x0040
-#define SetCRT2ToLCDA       0x0100
+#define XGI_SetCRT2ToLCDA   0x0100
 #define SetInSlaveMode      0x0200
 #define SetNotSimuMode      0x0400
 #define LoadDACFlag         0x1000
@@ -131,8 +131,8 @@
 #define NTSC1024x768         0x2000
 #define SetTVLockMode        0x4000
 
-#define LCDVESATiming        0x0001 /* LCD Info/CR37 */
-#define EnableLVDSDDA        0x0002
+#define XGI_LCDVESATiming    0x0001 /* LCD Info/CR37 */
+#define XGI_EnableLVDSDDA    0x0002
 #define EnableScalingLCD     0x0008
 #define SetPWDEnable         0x0004
 #define SetLCDtoNonExpanding 0x0010
@@ -145,7 +145,7 @@
 #define EnableLCD24bpp       0x0004 /* default */
 #define DisableLCD24bpp      0x0000
 #define LCDPolarity          0x00c0 /* default: SyncNN */
-#define LCDDualLink          0x0100
+#define XGI_LCDDualLink      0x0100
 #define EnableSpectrum       0x0200
 #define PWDEnable            0x0400
 #define EnableVBCLKDRVLOW    0x4000
@@ -191,7 +191,7 @@
 #define DisplayDeviceFromCMOS 0x10
 
 /* ---------------------- HK Evnet Definition */
-#define ModeSwitchStatus      0xf0
+#define XGI_ModeSwitchStatus  0xf0
 #define ActiveCRT1            0x10
 #define ActiveLCD             0x0020
 #define ActiveTV              0x40
@@ -286,7 +286,7 @@
 #define VCLK125_999          0x51
 #define VCLK148_5            0x52
 #define VCLK217_325          0x55
-#define YPbPr750pVCLK        0x57
+#define XGI_YPbPr750pVCLK    0x57
 
 #define TVVCLKDIV2           0x3A
 #define TVVCLK               0x3B
drivers/staging/xgifb/vb_setmode.c +74 -74

554 lines not on this page · raw message

drivers/staging/xgifb/vb_table.h +4 -4
index 4f803b6..dddf261 100644
@@ -2505,17 +2505,17 @@ static struct XGI330_LCDCapStruct  XGI_LCDDLCapList[] = {
 	0x6C, 0xC3, 0x35, 0x62, 0x02, 0x14, 0x0A, 0x02, 0x00,
 	0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10},
 /* LCDCap1280x1024 */
-	{Panel_1280x1024, LCDDualLink+DefaultLCDCap, StLCDBToA,
+	{Panel_1280x1024, XGI_LCDDualLink+DefaultLCDCap, StLCDBToA,
 	0x012, 0x70, 0x03, VCLK108_2_315,
 	0x70, 0x44, 0xF8, 0x2F, 0x02, 0x14, 0x0A, 0x02, 0x00,
 	0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10},
 /* LCDCap1400x1050 */
-	{Panel_1400x1050, LCDDualLink+DefaultLCDCap, StLCDBToA,
+	{Panel_1400x1050, XGI_LCDDualLink+DefaultLCDCap, StLCDBToA,
 	0x012, 0x70, 0x03, VCLK108_2_315,
 	 0x70, 0x44, 0xF8, 0x2F, 0x02, 0x14, 0x0A, 0x02, 0x00,
 	 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10},
 /* LCDCap1600x1200 */
-	{Panel_1600x1200, LCDDualLink+DefaultLCDCap, LCDToFull,
+	{Panel_1600x1200, XGI_LCDDualLink+DefaultLCDCap, LCDToFull,
 	0x012, 0xC0, 0x03, VCLK162,
 	 0x43, 0x22, 0x70, 0x24, 0x02, 0x14, 0x0A, 0x02, 0x00,
 	 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10},
@@ -2524,7 +2524,7 @@ static struct XGI330_LCDCapStruct  XGI_LCDDLCapList[] = {
 	 0x2B, 0x61, 0x2B, 0x61, 0x02, 0x14, 0x0A, 0x02, 0x00,
 	 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10},
 /* LCDCap1280x1024x75 */
-	{Panel_1280x1024x75, LCDDualLink+DefaultLCDCap, StLCDBToA,
+	{Panel_1280x1024x75, XGI_LCDDualLink+DefaultLCDCap, StLCDBToA,
 	0x012, 0x90, 0x03, VCLK135_5,
 	 0x54, 0x42, 0x4A, 0x61, 0x02, 0x14, 0x0A, 0x02, 0x00,
 	 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10},
Signature · 1 line
1.7.3.4
#6 lore raw

PATCH 6/7 staging/xgifb: Use TVCLKBASE_315 as a base address

In reply to Peter Huewe

Since the defines TVVCLKDIV2, TVVCLK, HiTVVCLKDIV2, HiTVVCLK, HiTVSimuVCLK and HiTVTextVCLK are now defined as relative values, we have to use TVCLKBASE_315 (0x31) as a base address to get the same values as before the merge.

The old and now duplicated defines were removed

---
 drivers/staging/xgifb/vb_def.h     |    6 ------
 drivers/staging/xgifb/vb_setmode.c |   24 ++++++++++++------------
 2 files changed, 12 insertions(+), 18 deletions(-)
drivers/staging/xgifb/vb_def.h +0 -6
index a4fedbd..d2e0bcd 100644
@@ -288,12 +288,6 @@
 #define VCLK217_325          0x55
 #define XGI_YPbPr750pVCLK    0x57
 
-#define TVVCLKDIV2           0x3A
-#define TVVCLK               0x3B
-#define HiTVVCLKDIV2         0x3C
-#define HiTVVCLK             0x3D
-#define HiTVSimuVCLK         0x3E
-#define HiTVTextVCLK         0x3F
 #define VCLK39_77            0x40
 #define YPbPr525pVCLK           0x3A
 #define NTSC1024VCLK         0x41
drivers/staging/xgifb/vb_setmode.c +12 -12
index 42eaec7..2919924 100644
@@ -1273,19 +1273,19 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
 				VCLKIndex = LCDXlat1VCLK[CRT2Index];
 		} else if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
 			if (pVBInfo->SetFlag & RPLLDIV2XO) {
-				VCLKIndex = HiTVVCLKDIV2;
+				VCLKIndex = TVCLKBASE_315 + HiTVVCLKDIV2;
 				VCLKIndex += 25;
 			} else {
-				VCLKIndex = HiTVVCLK;
+				VCLKIndex = TVCLKBASE_315 + HiTVVCLK;
 				VCLKIndex += 25;
 			}
 
 			if (pVBInfo->SetFlag & TVSimuMode) {
 				if (modeflag & Charx8Dot) {
-					VCLKIndex = HiTVSimuVCLK;
+					VCLKIndex = TVCLKBASE_315 + HiTVSimuVCLK;
 					VCLKIndex += 25;
 				} else {
-					VCLKIndex = HiTVTextVCLK;
+					VCLKIndex = TVCLKBASE_315 + HiTVTextVCLK;
 					VCLKIndex += 25;
 				}
 			}
@@ -1304,10 +1304,10 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
 			}
 		} else if (pVBInfo->VBInfo & SetCRT2ToTV) {
 			if (pVBInfo->SetFlag & RPLLDIV2XO) {
-				VCLKIndex = TVVCLKDIV2;
+				VCLKIndex = TVCLKBASE_315 + TVVCLKDIV2;
 				VCLKIndex += 25;
 			} else {
-				VCLKIndex = TVVCLK;
+				VCLKIndex = TVCLKBASE_315 + TVVCLK;
 				VCLKIndex += 25;
 			}
 		} else { /* for CRT2 */
@@ -2845,13 +2845,13 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
 		     VB_SIS302LV |
 		     VB_XGI301C)) {
 			if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
-				tempal = HiTVVCLKDIV2;
+				tempal = TVCLKBASE_315 + HiTVVCLKDIV2;
 				if (!(pVBInfo->TVInfo & RPLLDIV2XO))
-					tempal = HiTVVCLK;
+					tempal = TVCLKBASE_315 + HiTVVCLK;
 				if (pVBInfo->TVInfo & TVSimuMode) {
-					tempal = HiTVSimuVCLK;
+					tempal = TVCLKBASE_315 + HiTVSimuVCLK;
 					if (!(modeflag & Charx8Dot))
-						tempal = HiTVTextVCLK;
+						tempal = TVCLKBASE_315 + HiTVTextVCLK;
 
 				}
 				return tempal;
@@ -2870,9 +2870,9 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
 			tempal = NTSC1024VCLK;
 
 			if (!(pVBInfo->TVInfo & NTSC1024x768)) {
-				tempal = TVVCLKDIV2;
+				tempal = TVCLKBASE_315 + TVVCLKDIV2;
 				if (!(pVBInfo->TVInfo & RPLLDIV2XO))
-					tempal = TVVCLK;
+					tempal = TVCLKBASE_315 + TVVCLK;
 			}
 
 			if (pVBInfo->VBInfo & SetCRT2ToTV)
Signature · 1 line
1.7.3.4
#7 lore raw

PATCH 7/7 staging/xgifb: remove remaining duplicate initdef.h defines

In reply to Peter Huewe

This patch removes the remaining defines that are already defined identically in the sis initdef.h header.

---
 drivers/staging/xgifb/vb_def.h |  107 +---------------------------------------
 1 files changed, 1 insertions(+), 106 deletions(-)
drivers/staging/xgifb/vb_def.h +1 -106
index d2e0bcd..c731793 100644
@@ -8,12 +8,8 @@
 #define VB_YPbPr1080i   0x03
 
 #define LVDSCRT1Len     15
-
-#define SupportCHTV             0x0800
 #define SupportCRT2in301C       0x0100  /* for 301C */
 #define SetCHTVOverScan         0x8000
-#define PanelRGB18Bit           0x0100
-#define PanelRGB24Bit           0x0000
 
 #define Panel_320x480            0x07 /*fstn*/
 /* [ycchen] 02/12/03 Modify for Multi-Sync. LCD Support */
@@ -29,94 +25,24 @@
 
 #define XGI_CRT2_PORT_00        (0x00 - 0x030)
 
-#define _PanelType00             0x00
-#define _PanelType01             0x08
-#define _PanelType02             0x10
-#define _PanelType03             0x18
-#define _PanelType04             0x20
-#define _PanelType05             0x28
-#define _PanelType06             0x30
-#define _PanelType07             0x38
-#define _PanelType08             0x40
-#define _PanelType09             0x48
-#define _PanelType0A             0x50
-#define _PanelType0B             0x58
-#define _PanelType0C             0x60
-#define _PanelType0D             0x68
-#define _PanelType0E             0x70
-#define _PanelType0F             0x78
-
 /* =============================================================
    for 310
 ============================================================== */
-/* add LCDDataList for GetLCDPtr */
-#define LCDDataList               (VBIOSTablePointerStart+0x22)
-/*  */
-/* Modify from 310.inc */
-/*  */
-/*  */
-
 #define ModeSoftSetting              0x04
 
-#define BoardTVType                  0x02
-
-#define SoftDRAMType                 0x80    /* DRAMSetting */
-
 /* ---------------- SetMode Stack */
 #define CRT1Len           15
 #define VCLKLen           4
-#define VGA_XGI340        0x0001       /* 340 series */
-
-#define VB_NoLCD          0x8000
-#define VB_LVDS_NS        0x0001       /* 3rd party chip */
 
-#define ModeText          0x0000
-#define ModeEGA           0x0002    /* 16 colors mode */
-#define ModeVGA           0x0003    /* 256 colors mode */
-
-#define DACInfoFlag       0x0018
-
-#define MemoryInfoFlag    0x01e0
-#define MemorySizeShift   5
-
-#define Charx8Dot         0x0200
-#define LineCompareOff    0x0400
-#define CRT2Mode          0x0800
-#define HalfDCLK          0x1000
-#define NoSupportSimuTV   0x2000
-#define DoubleScanMode    0x8000
-
-/* -------------- Ext_InfoFlag */
 #define SupportAllCRT2      0x0078
-#define SupportTV           0x0008
-#define SupportLCD          0x0020
-#define SupportRAMDAC2      0x0040
 #define NoSupportTV         0x0070
 #define NoSupportHiVisionTV 0x0060
 #define NoSupportLCD        0x0058
-#define SupportTV1024       0x0800 /* 301btest */
-#define InterlaceMode       0x0080
-#define SyncPP              0x0000
-#define SyncPN              0x4000
-#define SyncNP              0x8000
-#define SyncNN              0xC000
 
 /* -------------- SetMode Stack/Scratch */
-#define SetSimuScanMode     0x0001    /* VBInfo/CR30 & CR31 */
-#define SetCRT2ToTV         0x089C
-#define SetCRT2ToAVIDEO     0x0004
-#define SetCRT2ToSVIDEO     0x0008
-#define SetCRT2ToSCART      0x0010
-#define SetCRT2ToLCD        0x0020
-#define SetCRT2ToRAMDAC     0x0040
 #define XGI_SetCRT2ToLCDA   0x0100
-#define SetInSlaveMode      0x0200
-#define SetNotSimuMode      0x0400
-#define LoadDACFlag         0x1000
-#define DriverMode          0x4000
 #define SetCRT2ToDualEdge   0x8000
 
-#define ProgrammingCRT2     0x0001       /* Set Flag */
 #define ReserveTVOption     0x0008
 #define GatingCRT           0x0800
 #define DisableChB          0x1000
@@ -124,7 +50,6 @@
 #define DisableChA          0x4000
 #define EnableChA           0x8000
 
-#define SetNTSCTV           0x0000 /* TV Info */
 #define SetTVLowResolution   0x0400
 #define TVSimuMode           0x0800
 #define RPLLDIV2XO           0x1000
@@ -167,24 +92,14 @@
 
 #define TVSense              0xc7
 
-#define TVOverScan           0x10               /* CR35 */
-
 #define YPbPrMode            0xe0
 #define YPbPrMode525i        0x00
 #define YPbPrMode525p        0x20
 #define YPbPrMode750p        0x40
 #define YPbPrMode1080i       0x60
 
-
-#define LCDRGB18Bit          0x01               /* CR37 */
-#define LCDNonExpanding      0x10
-#define LCDSync              0x20
-#define LCDSyncBit           0xe0 /* H/V polarity & sync ID */
-
 #define ScalingLCD           0x08
 
-#define EnableDualEdge       0x01 /* CR38 */
-#define SetToLCDA            0x02
 #define SetYPbPr             0x04
 
 /* ---------------------- VUMA Information */
@@ -207,28 +122,13 @@
 /* translated from asm code 301def.h */
 /*  */
 /* --------------------------------------------------------- */
-#define LCDDataLen           8
-#define TVDataLen            12
 #define LVDSCRT1Len_H        8
 #define LVDSCRT1Len_V        7
-#define LVDSDataLen          6
-#define LVDSDesDataLen       6
 #define LCDDesDataLen        6
 #define LVDSDesDataLen2      8
 #define LCDDesDataLen2       8
-#define CHTVRegLen           16
 
-#define StHiTVHT             892
-#define StHiTVVT             1126
-#define StHiTextTVHT         1000
-#define StHiTextTVVT         1126
-#define ExtHiTVHT            2100
-#define ExtHiTVVT            1125
-#define NTSCHT               1716
-#define NTSCVT                525
 #define NTSC1024x768HT       1908
-#define PALHT                1728
-#define PALVT                 625
 
 #define YPbPrTV525iHT        1716 /* YPbPr */
 #define YPbPrTV525iVT         525
@@ -237,15 +137,10 @@
 #define YPbPrTV750pHT        1650
 #define YPbPrTV750pVT         750
 
-#define CRT2Delay1           0x04 /* XGI301 */
-#define CRT2Delay2           0x0A /* 301B,302 */
-
-
 #define VCLK25_175           0x00
 #define VCLK28_322           0x01
 #define VCLK31_5             0x02
 #define VCLK36               0x03
-#define VCLK40               0x04
 #define VCLK43_163           0x05
 #define VCLK44_9             0x06
 #define VCLK49_5             0x07
@@ -289,7 +184,7 @@
 #define XGI_YPbPr750pVCLK    0x57
 
 #define VCLK39_77            0x40
-#define YPbPr525pVCLK           0x3A
+#define YPbPr525pVCLK        0x3A
 #define NTSC1024VCLK         0x41
 #define VCLK35_2             0x49 /* ; 800x480 */
 #define VCLK122_61           0x4A
Signature · 1 line
1.7.3.4