staging: xgifb: XGI_GetLcdPtr: add separate table for VB_SIS301LV/VB_SIS302LV
authorAaro Koskinen <aaro.koskinen@iki.fi>
Sun, 4 Nov 2012 19:14:42 +0000 (21:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2012 20:54:18 +0000 (12:54 -0800)
Add a separate data table for VB_SIS301LV/VB_SIS302LV to avoid branching
and to make further cleanups easier.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/xgifb/vb_setmode.c
drivers/staging/xgifb/vb_table.h

index c8561a0b386d50eca565b66d5f236b19f23c2d38..7686e42c9a0086347841c070ec947d586ca8a53e 100644 (file)
@@ -1350,7 +1350,11 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
                tempdi = XGI_LCDDataTable;
                break;
        case 5:
-               tempdi = XGI_LCDDesDataTable;
+               if ((pVBInfo->VBType & VB_SIS301LV) ||
+                   (pVBInfo->VBType & VB_SIS302LV))
+                       tempdi = xgifb_lcddldes;
+               else
+                       tempdi = XGI_LCDDesDataTable;
                break;
        default:
                break;
@@ -1614,6 +1618,30 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
                default:
                        break;
                }
+       } else if (table == 5 && ((pVBInfo->VBType & VB_SIS301LV) ||
+                                 (pVBInfo->VBType & VB_SIS302LV))) {
+               switch (tempdi[i].DATAPTR) {
+               case 0: return &XGI_ExtLCDDes1024x768Data[tempal];
+               case 1: return &XGI_StLCDDes1024x768Data[tempal];
+               case 2: return &XGI_CetLCDDes1024x768Data[tempal];
+               case 3: return &XGI_ExtLCDDLDes1280x1024Data[tempal];
+               case 4: return &XGI_StLCDDLDes1280x1024Data[tempal];
+               case 5: return &XGI_CetLCDDLDes1280x1024Data[tempal];
+               case 6:
+               case 7: return &xgifb_lcddldes_1400x1050[tempal];
+               case 8: return &XGI_CetLCDDes1400x1050Data[tempal];
+               case 9: return &XGI_CetLCDDes1400x1050Data2[tempal];
+               case 10: return &XGI_ExtLCDDLDes1600x1200Data[tempal];
+               case 11: return &XGI_StLCDDLDes1600x1200Data[tempal];
+               case 12: return &XGI_NoScalingDesData[tempal];
+               case 13:
+               case 14: return &xgifb_lcddes_1024x768x75[tempal];
+               case 15: return &XGI_CetLCDDes1024x768x75Data[tempal];
+               case 16:
+               case 17: return &xgifb_lcddldes_1280x1024x75[tempal];
+               case 18: return &XGI_CetLCDDLDes1280x1024x75Data[tempal];
+               case 19: return &XGI_NoScalingDesDatax75[tempal];
+               }
        } else if (table == 5) {
                switch (tempdi[i].DATAPTR) {
                case 0:
@@ -1626,33 +1654,17 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
                        return &XGI_CetLCDDes1024x768Data[tempal];
                        break;
                case 3:
-                       if ((pVBInfo->VBType & VB_SIS301LV) ||
-                               (pVBInfo->VBType & VB_SIS302LV))
-                               return &XGI_ExtLCDDLDes1280x1024Data[tempal];
-                       else
-                               return &XGI_ExtLCDDes1280x1024Data[tempal];
+                       return &XGI_ExtLCDDes1280x1024Data[tempal];
                        break;
                case 4:
-                       if ((pVBInfo->VBType & VB_SIS301LV) ||
-                           (pVBInfo->VBType & VB_SIS302LV))
-                               return &XGI_StLCDDLDes1280x1024Data[tempal];
-                       else
-                               return &XGI_StLCDDes1280x1024Data[tempal];
+                       return &XGI_StLCDDes1280x1024Data[tempal];
                        break;
                case 5:
-                       if ((pVBInfo->VBType & VB_SIS301LV) ||
-                           (pVBInfo->VBType & VB_SIS302LV))
-                               return &XGI_CetLCDDLDes1280x1024Data[tempal];
-                       else
-                               return &XGI_CetLCDDes1280x1024Data[tempal];
+                       return &XGI_CetLCDDes1280x1024Data[tempal];
                        break;
                case 6:
                case 7:
-                       if ((pVBInfo->VBType & VB_SIS301LV) ||
-                           (pVBInfo->VBType & VB_SIS302LV))
-                               return &xgifb_lcddldes_1400x1050[tempal];
-                       else
-                               return &xgifb_lcddes_1400x1050[tempal];
+                       return &xgifb_lcddes_1400x1050[tempal];
                        break;
                case 8:
                        return &XGI_CetLCDDes1400x1050Data[tempal];
@@ -1661,18 +1673,10 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
                        return &XGI_CetLCDDes1400x1050Data2[tempal];
                        break;
                case 10:
-                       if ((pVBInfo->VBType & VB_SIS301LV) ||
-                           (pVBInfo->VBType & VB_SIS302LV))
-                               return &XGI_ExtLCDDLDes1600x1200Data[tempal];
-                       else
-                               return &XGI_ExtLCDDes1600x1200Data[tempal];
+                       return &XGI_ExtLCDDes1600x1200Data[tempal];
                        break;
                case 11:
-                       if ((pVBInfo->VBType & VB_SIS301LV) ||
-                           (pVBInfo->VBType & VB_SIS302LV))
-                               return &XGI_StLCDDLDes1600x1200Data[tempal];
-                       else
-                               return &XGI_StLCDDes1600x1200Data[tempal];
+                       return &XGI_StLCDDes1600x1200Data[tempal];
                        break;
                case 12:
                        return &XGI_NoScalingDesData[tempal];
@@ -1686,18 +1690,10 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
                        break;
                case 16:
                case 17:
-                       if ((pVBInfo->VBType & VB_SIS301LV) ||
-                           (pVBInfo->VBType & VB_SIS302LV))
-                               return &xgifb_lcddldes_1280x1024x75[tempal];
-                       else
-                               return &xgifb_lcddes_1280x1024x75[tempal];
+                       return &xgifb_lcddes_1280x1024x75[tempal];
                        break;
                case 18:
-                       if ((pVBInfo->VBType & VB_SIS301LV) ||
-                           (pVBInfo->VBType & VB_SIS302LV))
-                               return &XGI_CetLCDDLDes1280x1024x75Data[tempal];
-                       else
-                               return &XGI_CetLCDDes1280x1024x75Data[tempal];
+                       return &XGI_CetLCDDes1280x1024x75Data[tempal];
                        break;
                case 19:
                        return &XGI_NoScalingDesDatax75[tempal];
index 180aae042ceaa9f1318bfeb197b1b685be029f17..ace8ac4bb144434da70aad2068cf7b0943d41137 100644 (file)
@@ -1804,6 +1804,30 @@ static struct XGI330_LCDDataTablStruct XGI_LCDDesDataTable[] = {
        {0xFF, 0x0000, 0x0000, 0}
 };
 
+static struct XGI330_LCDDataTablStruct xgifb_lcddldes[] = {
+       {Panel_1024x768, 0x0019, 0x0001, 0}, /* XGI_ExtLCDDes1024x768Data */
+       {Panel_1024x768, 0x0019, 0x0000, 1}, /* XGI_StLCDDes1024x768Data */
+       {Panel_1024x768, 0x0018, 0x0010, 2}, /* XGI_CetLCDDes1024x768Data */
+       {Panel_1280x1024, 0x0019, 0x0001, 3}, /* XGI_ExtLCDDLDes1280x1024Data */
+       {Panel_1280x1024, 0x0019, 0x0000, 4}, /* XGI_StLCDDLDes1280x1024Data */
+       {Panel_1280x1024, 0x0018, 0x0010, 5}, /* XGI_CetLCDDLDes1280x1024Data */
+       {Panel_1400x1050, 0x0019, 0x0001, 6}, /* xgifb_lcddldes_1400x1050 */
+       {Panel_1400x1050, 0x0019, 0x0000, 7}, /* xgifb_lcddldes_1400x1050 */
+       {Panel_1400x1050, 0x0418, 0x0010, 8}, /* XGI_CetLCDDes1400x1050Data */
+       {Panel_1400x1050, 0x0418, 0x0410, 9}, /* XGI_CetLCDDes1400x1050Data2 */
+       {Panel_1600x1200, 0x0019, 0x0001, 10}, /* XGI_ExtLCDDLDes1600x1200Data */
+       {Panel_1600x1200, 0x0019, 0x0000, 11}, /* XGI_StLCDDes1600x1200Data */
+       {PanelRef60Hz, 0x0008, 0x0008, 12}, /* XGI_NoScalingDesData */
+       {Panel_1024x768x75, 0x0019, 0x0001, 13}, /* xgifb_lcddes_1024x768x75 */
+       {Panel_1024x768x75, 0x0019, 0x0000, 14}, /* xgifb_lcddes_1024x768x75 */
+       {Panel_1024x768x75, 0x0018, 0x0010, 15}, /* XGI_CetLCDDes1024x768x75Data */
+       {Panel_1280x1024x75, 0x0019, 0x0001, 16}, /* xgifb_lcddldes_1280x1024x75 */
+       {Panel_1280x1024x75, 0x0019, 0x0000, 17}, /* xgifb_lcddldes_1280x1024x75 */
+       {Panel_1280x1024x75, 0x0018, 0x0010, 18}, /* XGI_CetLCDDes1280x1024x75Data */
+       {PanelRef75Hz, 0x0008, 0x0008, 19}, /* XGI_NoScalingDesDatax75 */
+       {0xFF, 0x0000, 0x0000, 0}
+};
+
 static struct XGI330_LCDDataTablStruct xgifb_epllcd_crt1[] = {
        {Panel_1024x768, 0x0018, 0x0000, 0}, /* XGI_LVDSCRT11024x768_1 */
        {Panel_1024x768, 0x0018, 0x0010, 1}, /* XGI_LVDSCRT11024x768_2 */