diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2011-10-11 14:47:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-12 11:51:49 -0400 |
commit | 289ea5249c4615f21dc01e28aefce4c995f07402 (patch) | |
tree | 336c9f6b674b49d5a0e611acf092bc8bc4b701fe /drivers/staging/xgifb/XGI_main_26.c | |
parent | 3261f2a1716993c5d88ab767d36a14bbc30d3717 (diff) |
staging: xgifb: clean up 2nd display state
Convert the display type to enum and rename disp_state to display2.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/xgifb/XGI_main_26.c')
-rw-r--r-- | drivers/staging/xgifb/XGI_main_26.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 03b6f78a667..36db231cd80 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c | |||
@@ -507,8 +507,7 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) | |||
507 | struct xgi_hw_device_info *hw_info = &xgifb_info->hw_info; | 507 | struct xgi_hw_device_info *hw_info = &xgifb_info->hw_info; |
508 | 508 | ||
509 | if (xgifb_info->chip == XG21) { | 509 | if (xgifb_info->chip == XG21) { |
510 | if ((xgifb_info->disp_state & DISPTYPE_DISP2) | 510 | if (xgifb_info->display2 == XGIFB_DISP_LCD) { |
511 | == DISPTYPE_LCD) { | ||
512 | xres = XGI21_LCDCapList[0].LVDSHDE; | 511 | xres = XGI21_LCDCapList[0].LVDSHDE; |
513 | yres = XGI21_LCDCapList[0].LVDSVDE; | 512 | yres = XGI21_LCDCapList[0].LVDSVDE; |
514 | if (XGIbios_mode[myindex].xres > xres) | 513 | if (XGIbios_mode[myindex].xres > xres) |
@@ -533,8 +532,8 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) | |||
533 | if (!(XGIbios_mode[myindex].chipset & MD_XGI315)) | 532 | if (!(XGIbios_mode[myindex].chipset & MD_XGI315)) |
534 | return -1; | 533 | return -1; |
535 | 534 | ||
536 | switch (xgifb_info->disp_state & DISPTYPE_DISP2) { | 535 | switch (xgifb_info->display2) { |
537 | case DISPTYPE_LCD: | 536 | case XGIFB_DISP_LCD: |
538 | switch (hw_info->ulCRT2LCDType) { | 537 | switch (hw_info->ulCRT2LCDType) { |
539 | case LCD_640x480: | 538 | case LCD_640x480: |
540 | xres = 640; | 539 | xres = 640; |
@@ -685,7 +684,7 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) | |||
685 | } | 684 | } |
686 | } | 685 | } |
687 | break; | 686 | break; |
688 | case DISPTYPE_TV: | 687 | case XGIFB_DISP_TV: |
689 | switch (XGIbios_mode[myindex].xres) { | 688 | switch (XGIbios_mode[myindex].xres) { |
690 | case 512: | 689 | case 512: |
691 | case 640: | 690 | case 640: |
@@ -715,10 +714,12 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) | |||
715 | return -1; | 714 | return -1; |
716 | } | 715 | } |
717 | break; | 716 | break; |
718 | case DISPTYPE_CRT2: | 717 | case XGIFB_DISP_CRT: |
719 | if (XGIbios_mode[myindex].xres > 1280) | 718 | if (XGIbios_mode[myindex].xres > 1280) |
720 | return -1; | 719 | return -1; |
721 | break; | 720 | break; |
721 | case XGIFB_DISP_NONE: | ||
722 | break; | ||
722 | } | 723 | } |
723 | return myindex; | 724 | return myindex; |
724 | 725 | ||
@@ -857,16 +858,16 @@ static void XGIfb_pre_setmode(struct xgifb_video_info *xgifb_info) | |||
857 | cr31 = xgifb_reg_get(XGICR, 0x31); | 858 | cr31 = xgifb_reg_get(XGICR, 0x31); |
858 | cr31 &= ~0x60; | 859 | cr31 &= ~0x60; |
859 | 860 | ||
860 | switch (xgifb_info->disp_state & DISPTYPE_DISP2) { | 861 | switch (xgifb_info->display2) { |
861 | case DISPTYPE_CRT2: | 862 | case XGIFB_DISP_CRT: |
862 | cr30 = (XGI_VB_OUTPUT_CRT2 | XGI_SIMULTANEOUS_VIEW_ENABLE); | 863 | cr30 = (XGI_VB_OUTPUT_CRT2 | XGI_SIMULTANEOUS_VIEW_ENABLE); |
863 | cr31 |= XGI_DRIVER_MODE; | 864 | cr31 |= XGI_DRIVER_MODE; |
864 | break; | 865 | break; |
865 | case DISPTYPE_LCD: | 866 | case XGIFB_DISP_LCD: |
866 | cr30 = (XGI_VB_OUTPUT_LCD | XGI_SIMULTANEOUS_VIEW_ENABLE); | 867 | cr30 = (XGI_VB_OUTPUT_LCD | XGI_SIMULTANEOUS_VIEW_ENABLE); |
867 | cr31 |= XGI_DRIVER_MODE; | 868 | cr31 |= XGI_DRIVER_MODE; |
868 | break; | 869 | break; |
869 | case DISPTYPE_TV: | 870 | case XGIFB_DISP_TV: |
870 | if (xgifb_info->TV_type == TVMODE_HIVISION) | 871 | if (xgifb_info->TV_type == TVMODE_HIVISION) |
871 | cr30 = (XGI_VB_OUTPUT_HIVISION | 872 | cr30 = (XGI_VB_OUTPUT_HIVISION |
872 | | XGI_SIMULTANEOUS_VIEW_ENABLE); | 873 | | XGI_SIMULTANEOUS_VIEW_ENABLE); |
@@ -916,7 +917,7 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info) | |||
916 | } | 917 | } |
917 | /* TW: We can't switch off CRT1 on 301B-DH | 918 | /* TW: We can't switch off CRT1 on 301B-DH |
918 | * in 8bpp Modes if using LCD */ | 919 | * in 8bpp Modes if using LCD */ |
919 | if (xgifb_info->disp_state & DISPTYPE_LCD) | 920 | if (xgifb_info->display2 == XGIFB_DISP_LCD) |
920 | doit = 0; | 921 | doit = 0; |
921 | } | 922 | } |
922 | 923 | ||
@@ -940,8 +941,8 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info) | |||
940 | 941 | ||
941 | xgifb_reg_and(XGISR, IND_XGI_RAMDAC_CONTROL, ~0x04); | 942 | xgifb_reg_and(XGISR, IND_XGI_RAMDAC_CONTROL, ~0x04); |
942 | 943 | ||
943 | if ((xgifb_info->disp_state & DISPTYPE_TV) && (xgifb_info->hasVB | 944 | if (xgifb_info->display2 == XGIFB_DISP_TV && |
944 | == HASVB_301)) { | 945 | xgifb_info->hasVB == HASVB_301) { |
945 | 946 | ||
946 | reg = xgifb_reg_get(XGIPART4, 0x01); | 947 | reg = xgifb_reg_get(XGIPART4, 0x01); |
947 | 948 | ||
@@ -1339,7 +1340,7 @@ static int XGIfb_pan_var(struct xgifb_video_info *xgifb_info, | |||
1339 | xgifb_reg_set(XGISR, 0x37, (base >> 24) & 0x03); | 1340 | xgifb_reg_set(XGISR, 0x37, (base >> 24) & 0x03); |
1340 | xgifb_reg_and_or(XGISR, 0x37, 0xDF, (base >> 21) & 0x04); | 1341 | xgifb_reg_and_or(XGISR, 0x37, 0xDF, (base >> 21) & 0x04); |
1341 | 1342 | ||
1342 | if (xgifb_info->disp_state & DISPTYPE_DISP2) { | 1343 | if (xgifb_info->display2 != XGIFB_DISP_NONE) { |
1343 | xgifb_reg_or(XGIPART1, IND_XGI_CRT2_WRITE_ENABLE_315, 0x01); | 1344 | xgifb_reg_or(XGIPART1, IND_XGI_CRT2_WRITE_ENABLE_315, 0x01); |
1344 | xgifb_reg_set(XGIPART1, 0x06, (base & 0xFF)); | 1345 | xgifb_reg_set(XGIPART1, 0x06, (base & 0xFF)); |
1345 | xgifb_reg_set(XGIPART1, 0x05, ((base >> 8) & 0xFF)); | 1346 | xgifb_reg_set(XGIPART1, 0x05, ((base >> 8) & 0xFF)); |
@@ -1395,7 +1396,7 @@ static int XGIfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1395 | outb((red >> 10), XGIDACD); | 1396 | outb((red >> 10), XGIDACD); |
1396 | outb((green >> 10), XGIDACD); | 1397 | outb((green >> 10), XGIDACD); |
1397 | outb((blue >> 10), XGIDACD); | 1398 | outb((blue >> 10), XGIDACD); |
1398 | if (xgifb_info->disp_state & DISPTYPE_DISP2) { | 1399 | if (xgifb_info->display2 != XGIFB_DISP_NONE) { |
1399 | outb(regno, XGIDAC2A); | 1400 | outb(regno, XGIDAC2A); |
1400 | outb((red >> 8), XGIDAC2D); | 1401 | outb((red >> 8), XGIDAC2D); |
1401 | outb((green >> 8), XGIDAC2D); | 1402 | outb((green >> 8), XGIDAC2D); |
@@ -1806,15 +1807,15 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info) | |||
1806 | 1807 | ||
1807 | if (XGIfb_crt2type != -1) | 1808 | if (XGIfb_crt2type != -1) |
1808 | /* TW: Override with option */ | 1809 | /* TW: Override with option */ |
1809 | xgifb_info->disp_state = XGIfb_crt2type; | 1810 | xgifb_info->display2 = XGIfb_crt2type; |
1810 | else if (cr32 & XGI_VB_TV) | 1811 | else if (cr32 & XGI_VB_TV) |
1811 | xgifb_info->disp_state = DISPTYPE_TV; | 1812 | xgifb_info->display2 = XGIFB_DISP_TV; |
1812 | else if (cr32 & XGI_VB_LCD) | 1813 | else if (cr32 & XGI_VB_LCD) |
1813 | xgifb_info->disp_state = DISPTYPE_LCD; | 1814 | xgifb_info->display2 = XGIFB_DISP_LCD; |
1814 | else if (cr32 & XGI_VB_CRT2) | 1815 | else if (cr32 & XGI_VB_CRT2) |
1815 | xgifb_info->disp_state = DISPTYPE_CRT2; | 1816 | xgifb_info->display2 = XGIFB_DISP_CRT; |
1816 | else | 1817 | else |
1817 | xgifb_info->disp_state = 0; | 1818 | xgifb_info->display2 = XGIFB_DISP_NONE; |
1818 | 1819 | ||
1819 | if (XGIfb_tvplug != -1) | 1820 | if (XGIfb_tvplug != -1) |
1820 | /* PR/TW: Override with option */ | 1821 | /* PR/TW: Override with option */ |
@@ -1932,7 +1933,7 @@ static int __init XGIfb_setup(char *options) | |||
1932 | } else if (!strncmp(this_opt, "dstn", 4)) { | 1933 | } else if (!strncmp(this_opt, "dstn", 4)) { |
1933 | enable_dstn = 1; | 1934 | enable_dstn = 1; |
1934 | /* TW: DSTN overrules forcecrt2type */ | 1935 | /* TW: DSTN overrules forcecrt2type */ |
1935 | XGIfb_crt2type = DISPTYPE_LCD; | 1936 | XGIfb_crt2type = XGIFB_DISP_LCD; |
1936 | } else if (!strncmp(this_opt, "noypan", 6)) { | 1937 | } else if (!strncmp(this_opt, "noypan", 6)) { |
1937 | XGIfb_ypan = 0; | 1938 | XGIfb_ypan = 0; |
1938 | } else if (!strncmp(this_opt, "userom:", 7)) { | 1939 | } else if (!strncmp(this_opt, "userom:", 7)) { |
@@ -2126,7 +2127,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, | |||
2126 | } else if (xgifb_info->chip == XG21) { | 2127 | } else if (xgifb_info->chip == XG21) { |
2127 | CR38 = xgifb_reg_get(XGICR, 0x38); | 2128 | CR38 = xgifb_reg_get(XGICR, 0x38); |
2128 | if ((CR38&0xE0) == 0xC0) { | 2129 | if ((CR38&0xE0) == 0xC0) { |
2129 | xgifb_info->disp_state = DISPTYPE_LCD; | 2130 | xgifb_info->display2 = XGIFB_DISP_LCD; |
2130 | if (!XGIfb_GetXG21LVDSData(xgifb_info)) | 2131 | if (!XGIfb_GetXG21LVDSData(xgifb_info)) |
2131 | xgi21_drvlcdcaplist = true; | 2132 | xgi21_drvlcdcaplist = true; |
2132 | } else if ((CR38&0xE0) == 0x60) { | 2133 | } else if ((CR38&0xE0) == 0x60) { |
@@ -2204,7 +2205,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, | |||
2204 | if (xgifb_info->hasVB != HASVB_NONE) | 2205 | if (xgifb_info->hasVB != HASVB_NONE) |
2205 | XGIfb_detect_VB(xgifb_info); | 2206 | XGIfb_detect_VB(xgifb_info); |
2206 | 2207 | ||
2207 | if (xgifb_info->disp_state & DISPTYPE_LCD) { | 2208 | if (xgifb_info->display2 == XGIFB_DISP_LCD) { |
2208 | if (!enable_dstn) { | 2209 | if (!enable_dstn) { |
2209 | reg = xgifb_reg_get(XGICR, IND_XGI_LCD_PANEL); | 2210 | reg = xgifb_reg_get(XGICR, IND_XGI_LCD_PANEL); |
2210 | reg &= 0x0f; | 2211 | reg &= 0x0f; |
@@ -2261,8 +2262,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, | |||
2261 | XGIfb_validate_mode(xgifb_info, xgifb_info->mode_idx); | 2262 | XGIfb_validate_mode(xgifb_info, xgifb_info->mode_idx); |
2262 | 2263 | ||
2263 | if (xgifb_info->mode_idx < 0) { | 2264 | if (xgifb_info->mode_idx < 0) { |
2264 | if ((xgifb_info->disp_state & DISPTYPE_DISP2) == | 2265 | if (xgifb_info->display2 == XGIFB_DISP_LCD && |
2265 | DISPTYPE_LCD && | ||
2266 | xgifb_info->chip == XG21) | 2266 | xgifb_info->chip == XG21) |
2267 | xgifb_info->mode_idx = | 2267 | xgifb_info->mode_idx = |
2268 | XGIfb_GetXG21DefaultLVDSModeIdx(); | 2268 | XGIfb_GetXG21DefaultLVDSModeIdx(); |