Commit 289ea524 authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Greg Kroah-Hartman

staging: xgifb: clean up 2nd display state

Convert the display type to enum and rename disp_state to display2.
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3261f2a1
...@@ -326,19 +326,19 @@ static const struct _XGI_crt2type { ...@@ -326,19 +326,19 @@ static const struct _XGI_crt2type {
int tvplug_no; int tvplug_no;
} XGI_crt2type[] = { } XGI_crt2type[] = {
{"NONE", 0, -1}, {"NONE", 0, -1},
{"LCD", DISPTYPE_LCD, -1}, {"LCD", XGIFB_DISP_LCD, -1},
{"TV", DISPTYPE_TV, -1}, {"TV", XGIFB_DISP_TV, -1},
{"VGA", DISPTYPE_CRT2, -1}, {"VGA", XGIFB_DISP_CRT, -1},
{"SVIDEO", DISPTYPE_TV, TVPLUG_SVIDEO}, {"SVIDEO", XGIFB_DISP_TV, TVPLUG_SVIDEO},
{"COMPOSITE", DISPTYPE_TV, TVPLUG_COMPOSITE}, {"COMPOSITE", XGIFB_DISP_TV, TVPLUG_COMPOSITE},
{"SCART", DISPTYPE_TV, TVPLUG_SCART}, {"SCART", XGIFB_DISP_TV, TVPLUG_SCART},
{"none", 0, -1}, {"none", 0, -1},
{"lcd", DISPTYPE_LCD, -1}, {"lcd", XGIFB_DISP_LCD, -1},
{"tv", DISPTYPE_TV, -1}, {"tv", XGIFB_DISP_TV, -1},
{"vga", DISPTYPE_CRT2, -1}, {"vga", XGIFB_DISP_CRT, -1},
{"svideo", DISPTYPE_TV, TVPLUG_SVIDEO}, {"svideo", XGIFB_DISP_TV, TVPLUG_SVIDEO},
{"composite", DISPTYPE_TV, TVPLUG_COMPOSITE}, {"composite", XGIFB_DISP_TV, TVPLUG_COMPOSITE},
{"scart", DISPTYPE_TV, TVPLUG_SCART}, {"scart", XGIFB_DISP_TV, TVPLUG_SCART},
{"\0", -1, -1} {"\0", -1, -1}
}; };
......
...@@ -507,8 +507,7 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) ...@@ -507,8 +507,7 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex)
struct xgi_hw_device_info *hw_info = &xgifb_info->hw_info; struct xgi_hw_device_info *hw_info = &xgifb_info->hw_info;
if (xgifb_info->chip == XG21) { if (xgifb_info->chip == XG21) {
if ((xgifb_info->disp_state & DISPTYPE_DISP2) if (xgifb_info->display2 == XGIFB_DISP_LCD) {
== DISPTYPE_LCD) {
xres = XGI21_LCDCapList[0].LVDSHDE; xres = XGI21_LCDCapList[0].LVDSHDE;
yres = XGI21_LCDCapList[0].LVDSVDE; yres = XGI21_LCDCapList[0].LVDSVDE;
if (XGIbios_mode[myindex].xres > xres) if (XGIbios_mode[myindex].xres > xres)
...@@ -533,8 +532,8 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) ...@@ -533,8 +532,8 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex)
if (!(XGIbios_mode[myindex].chipset & MD_XGI315)) if (!(XGIbios_mode[myindex].chipset & MD_XGI315))
return -1; return -1;
switch (xgifb_info->disp_state & DISPTYPE_DISP2) { switch (xgifb_info->display2) {
case DISPTYPE_LCD: case XGIFB_DISP_LCD:
switch (hw_info->ulCRT2LCDType) { switch (hw_info->ulCRT2LCDType) {
case LCD_640x480: case LCD_640x480:
xres = 640; xres = 640;
...@@ -685,7 +684,7 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) ...@@ -685,7 +684,7 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex)
} }
} }
break; break;
case DISPTYPE_TV: case XGIFB_DISP_TV:
switch (XGIbios_mode[myindex].xres) { switch (XGIbios_mode[myindex].xres) {
case 512: case 512:
case 640: case 640:
...@@ -715,10 +714,12 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) ...@@ -715,10 +714,12 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex)
return -1; return -1;
} }
break; break;
case DISPTYPE_CRT2: case XGIFB_DISP_CRT:
if (XGIbios_mode[myindex].xres > 1280) if (XGIbios_mode[myindex].xres > 1280)
return -1; return -1;
break; break;
case XGIFB_DISP_NONE:
break;
} }
return myindex; return myindex;
...@@ -857,16 +858,16 @@ static void XGIfb_pre_setmode(struct xgifb_video_info *xgifb_info) ...@@ -857,16 +858,16 @@ static void XGIfb_pre_setmode(struct xgifb_video_info *xgifb_info)
cr31 = xgifb_reg_get(XGICR, 0x31); cr31 = xgifb_reg_get(XGICR, 0x31);
cr31 &= ~0x60; cr31 &= ~0x60;
switch (xgifb_info->disp_state & DISPTYPE_DISP2) { switch (xgifb_info->display2) {
case DISPTYPE_CRT2: case XGIFB_DISP_CRT:
cr30 = (XGI_VB_OUTPUT_CRT2 | XGI_SIMULTANEOUS_VIEW_ENABLE); cr30 = (XGI_VB_OUTPUT_CRT2 | XGI_SIMULTANEOUS_VIEW_ENABLE);
cr31 |= XGI_DRIVER_MODE; cr31 |= XGI_DRIVER_MODE;
break; break;
case DISPTYPE_LCD: case XGIFB_DISP_LCD:
cr30 = (XGI_VB_OUTPUT_LCD | XGI_SIMULTANEOUS_VIEW_ENABLE); cr30 = (XGI_VB_OUTPUT_LCD | XGI_SIMULTANEOUS_VIEW_ENABLE);
cr31 |= XGI_DRIVER_MODE; cr31 |= XGI_DRIVER_MODE;
break; break;
case DISPTYPE_TV: case XGIFB_DISP_TV:
if (xgifb_info->TV_type == TVMODE_HIVISION) if (xgifb_info->TV_type == TVMODE_HIVISION)
cr30 = (XGI_VB_OUTPUT_HIVISION cr30 = (XGI_VB_OUTPUT_HIVISION
| XGI_SIMULTANEOUS_VIEW_ENABLE); | XGI_SIMULTANEOUS_VIEW_ENABLE);
...@@ -916,7 +917,7 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info) ...@@ -916,7 +917,7 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info)
} }
/* TW: We can't switch off CRT1 on 301B-DH /* TW: We can't switch off CRT1 on 301B-DH
* in 8bpp Modes if using LCD */ * in 8bpp Modes if using LCD */
if (xgifb_info->disp_state & DISPTYPE_LCD) if (xgifb_info->display2 == XGIFB_DISP_LCD)
doit = 0; doit = 0;
} }
...@@ -940,8 +941,8 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info) ...@@ -940,8 +941,8 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info)
xgifb_reg_and(XGISR, IND_XGI_RAMDAC_CONTROL, ~0x04); xgifb_reg_and(XGISR, IND_XGI_RAMDAC_CONTROL, ~0x04);
if ((xgifb_info->disp_state & DISPTYPE_TV) && (xgifb_info->hasVB if (xgifb_info->display2 == XGIFB_DISP_TV &&
== HASVB_301)) { xgifb_info->hasVB == HASVB_301) {
reg = xgifb_reg_get(XGIPART4, 0x01); reg = xgifb_reg_get(XGIPART4, 0x01);
...@@ -1339,7 +1340,7 @@ static int XGIfb_pan_var(struct xgifb_video_info *xgifb_info, ...@@ -1339,7 +1340,7 @@ static int XGIfb_pan_var(struct xgifb_video_info *xgifb_info,
xgifb_reg_set(XGISR, 0x37, (base >> 24) & 0x03); xgifb_reg_set(XGISR, 0x37, (base >> 24) & 0x03);
xgifb_reg_and_or(XGISR, 0x37, 0xDF, (base >> 21) & 0x04); xgifb_reg_and_or(XGISR, 0x37, 0xDF, (base >> 21) & 0x04);
if (xgifb_info->disp_state & DISPTYPE_DISP2) { if (xgifb_info->display2 != XGIFB_DISP_NONE) {
xgifb_reg_or(XGIPART1, IND_XGI_CRT2_WRITE_ENABLE_315, 0x01); xgifb_reg_or(XGIPART1, IND_XGI_CRT2_WRITE_ENABLE_315, 0x01);
xgifb_reg_set(XGIPART1, 0x06, (base & 0xFF)); xgifb_reg_set(XGIPART1, 0x06, (base & 0xFF));
xgifb_reg_set(XGIPART1, 0x05, ((base >> 8) & 0xFF)); xgifb_reg_set(XGIPART1, 0x05, ((base >> 8) & 0xFF));
...@@ -1395,7 +1396,7 @@ static int XGIfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -1395,7 +1396,7 @@ static int XGIfb_setcolreg(unsigned regno, unsigned red, unsigned green,
outb((red >> 10), XGIDACD); outb((red >> 10), XGIDACD);
outb((green >> 10), XGIDACD); outb((green >> 10), XGIDACD);
outb((blue >> 10), XGIDACD); outb((blue >> 10), XGIDACD);
if (xgifb_info->disp_state & DISPTYPE_DISP2) { if (xgifb_info->display2 != XGIFB_DISP_NONE) {
outb(regno, XGIDAC2A); outb(regno, XGIDAC2A);
outb((red >> 8), XGIDAC2D); outb((red >> 8), XGIDAC2D);
outb((green >> 8), XGIDAC2D); outb((green >> 8), XGIDAC2D);
...@@ -1806,15 +1807,15 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info) ...@@ -1806,15 +1807,15 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info)
if (XGIfb_crt2type != -1) if (XGIfb_crt2type != -1)
/* TW: Override with option */ /* TW: Override with option */
xgifb_info->disp_state = XGIfb_crt2type; xgifb_info->display2 = XGIfb_crt2type;
else if (cr32 & XGI_VB_TV) else if (cr32 & XGI_VB_TV)
xgifb_info->disp_state = DISPTYPE_TV; xgifb_info->display2 = XGIFB_DISP_TV;
else if (cr32 & XGI_VB_LCD) else if (cr32 & XGI_VB_LCD)
xgifb_info->disp_state = DISPTYPE_LCD; xgifb_info->display2 = XGIFB_DISP_LCD;
else if (cr32 & XGI_VB_CRT2) else if (cr32 & XGI_VB_CRT2)
xgifb_info->disp_state = DISPTYPE_CRT2; xgifb_info->display2 = XGIFB_DISP_CRT;
else else
xgifb_info->disp_state = 0; xgifb_info->display2 = XGIFB_DISP_NONE;
if (XGIfb_tvplug != -1) if (XGIfb_tvplug != -1)
/* PR/TW: Override with option */ /* PR/TW: Override with option */
...@@ -1932,7 +1933,7 @@ static int __init XGIfb_setup(char *options) ...@@ -1932,7 +1933,7 @@ static int __init XGIfb_setup(char *options)
} else if (!strncmp(this_opt, "dstn", 4)) { } else if (!strncmp(this_opt, "dstn", 4)) {
enable_dstn = 1; enable_dstn = 1;
/* TW: DSTN overrules forcecrt2type */ /* TW: DSTN overrules forcecrt2type */
XGIfb_crt2type = DISPTYPE_LCD; XGIfb_crt2type = XGIFB_DISP_LCD;
} else if (!strncmp(this_opt, "noypan", 6)) { } else if (!strncmp(this_opt, "noypan", 6)) {
XGIfb_ypan = 0; XGIfb_ypan = 0;
} else if (!strncmp(this_opt, "userom:", 7)) { } else if (!strncmp(this_opt, "userom:", 7)) {
...@@ -2126,7 +2127,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2126,7 +2127,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
} else if (xgifb_info->chip == XG21) { } else if (xgifb_info->chip == XG21) {
CR38 = xgifb_reg_get(XGICR, 0x38); CR38 = xgifb_reg_get(XGICR, 0x38);
if ((CR38&0xE0) == 0xC0) { if ((CR38&0xE0) == 0xC0) {
xgifb_info->disp_state = DISPTYPE_LCD; xgifb_info->display2 = XGIFB_DISP_LCD;
if (!XGIfb_GetXG21LVDSData(xgifb_info)) if (!XGIfb_GetXG21LVDSData(xgifb_info))
xgi21_drvlcdcaplist = true; xgi21_drvlcdcaplist = true;
} else if ((CR38&0xE0) == 0x60) { } else if ((CR38&0xE0) == 0x60) {
...@@ -2204,7 +2205,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2204,7 +2205,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
if (xgifb_info->hasVB != HASVB_NONE) if (xgifb_info->hasVB != HASVB_NONE)
XGIfb_detect_VB(xgifb_info); XGIfb_detect_VB(xgifb_info);
if (xgifb_info->disp_state & DISPTYPE_LCD) { if (xgifb_info->display2 == XGIFB_DISP_LCD) {
if (!enable_dstn) { if (!enable_dstn) {
reg = xgifb_reg_get(XGICR, IND_XGI_LCD_PANEL); reg = xgifb_reg_get(XGICR, IND_XGI_LCD_PANEL);
reg &= 0x0f; reg &= 0x0f;
...@@ -2261,8 +2262,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2261,8 +2262,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
XGIfb_validate_mode(xgifb_info, xgifb_info->mode_idx); XGIfb_validate_mode(xgifb_info, xgifb_info->mode_idx);
if (xgifb_info->mode_idx < 0) { if (xgifb_info->mode_idx < 0) {
if ((xgifb_info->disp_state & DISPTYPE_DISP2) == if (xgifb_info->display2 == XGIFB_DISP_LCD &&
DISPTYPE_LCD &&
xgifb_info->chip == XG21) xgifb_info->chip == XG21)
xgifb_info->mode_idx = xgifb_info->mode_idx =
XGIfb_GetXG21DefaultLVDSModeIdx(); XGIfb_GetXG21DefaultLVDSModeIdx();
......
...@@ -6,10 +6,12 @@ ...@@ -6,10 +6,12 @@
#include "vb_struct.h" #include "vb_struct.h"
#include "vgatypes.h" #include "vgatypes.h"
#define DISPTYPE_CRT2 0x00000004L enum xgifb_display_type {
#define DISPTYPE_LCD 0x00000002L XGIFB_DISP_NONE = 0,
#define DISPTYPE_TV 0x00000001L XGIFB_DISP_CRT,
#define DISPTYPE_DISP2 (DISPTYPE_CRT2 | DISPTYPE_LCD | DISPTYPE_TV) XGIFB_DISP_LCD,
XGIFB_DISP_TV,
};
#define HASVB_NONE 0x00 #define HASVB_NONE 0x00
#define HASVB_301 0x01 #define HASVB_301 0x01
...@@ -83,7 +85,7 @@ struct xgifb_video_info { ...@@ -83,7 +85,7 @@ struct xgifb_video_info {
int video_linelength; int video_linelength;
unsigned int refresh_rate; unsigned int refresh_rate;
unsigned long disp_state; enum xgifb_display_type display2; /* the second display output type */
unsigned char hasVB; unsigned char hasVB;
unsigned char TV_type; unsigned char TV_type;
unsigned char TV_plug; unsigned char TV_plug;
......
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