Commit a12c27c5 authored by Kenji Toyama's avatar Kenji Toyama Committed by Greg Kroah-Hartman

Staging: xgifb: Fixed style issues.

Not all warnings/errors were silenced, some of them are related to
simple printk() messages that imho should not be split across multiple
lines (it makes it harder to grep for example), and some of them are
related to long lines that are pretty much impossible to split without
proper code refactoring.

Resubmitting this patch because of conflicts.
Signed-off-by: default avatarDaniel Kenji Toyama <kenji.toyama@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 14e43851
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#define XGIFB_PAN #define XGIFB_PAN
#endif #endif
#include <asm/io.h> #include <linux/io.h>
#ifdef CONFIG_MTRR #ifdef CONFIG_MTRR
#include <asm/mtrr.h> #include <asm/mtrr.h>
#endif #endif
...@@ -349,10 +349,10 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr, ...@@ -349,10 +349,10 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
else { else {
j = 0; j = 0;
while (XGI_Pr->EModeIDTable[j].Ext_ModeID != 0xff) { while (XGI_Pr->EModeIDTable[j].Ext_ModeID != 0xff) {
if (XGI_Pr->EModeIDTable[j].Ext_ModeID if (XGI_Pr->EModeIDTable[j].Ext_ModeID ==
== XGI_Pr->RefIndex[RefreshRateTableIndex].ModeID) { XGI_Pr->RefIndex[RefreshRateTableIndex].ModeID) {
if (XGI_Pr->EModeIDTable[j].Ext_ModeFlag if (XGI_Pr->EModeIDTable[j].Ext_ModeFlag &
& DoubleScanMode) { DoubleScanMode) {
*vmode = FB_VMODE_DOUBLE; *vmode = FB_VMODE_DOUBLE;
} }
break; break;
...@@ -378,11 +378,16 @@ static void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr) ...@@ -378,11 +378,16 @@ static void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr)
XGI_Pr->P3c8 = BaseAddr + 0x18; XGI_Pr->P3c8 = BaseAddr + 0x18;
XGI_Pr->P3c9 = BaseAddr + 0x19; XGI_Pr->P3c9 = BaseAddr + 0x19;
XGI_Pr->P3da = BaseAddr + 0x2A; XGI_Pr->P3da = BaseAddr + 0x2A;
XGI_Pr->Part1Port = BaseAddr + XGI_CRT2_PORT_04; /* Digital video interface registers (LCD) */ /* Digital video interface registers (LCD) */
XGI_Pr->Part2Port = BaseAddr + XGI_CRT2_PORT_10; /* 301 TV Encoder registers */ XGI_Pr->Part1Port = BaseAddr + XGI_CRT2_PORT_04;
XGI_Pr->Part3Port = BaseAddr + XGI_CRT2_PORT_12; /* 301 Macrovision registers */ /* 301 TV Encoder registers */
XGI_Pr->Part4Port = BaseAddr + XGI_CRT2_PORT_14; /* 301 VGA2 (and LCD) registers */ XGI_Pr->Part2Port = BaseAddr + XGI_CRT2_PORT_10;
XGI_Pr->Part5Port = BaseAddr + XGI_CRT2_PORT_14 + 2; /* 301 palette address port registers */ /* 301 Macrovision registers */
XGI_Pr->Part3Port = BaseAddr + XGI_CRT2_PORT_12;
/* 301 VGA2 (and LCD) registers */
XGI_Pr->Part4Port = BaseAddr + XGI_CRT2_PORT_14;
/* 301 palette address port registers */
XGI_Pr->Part5Port = BaseAddr + XGI_CRT2_PORT_14 + 2;
} }
...@@ -511,8 +516,8 @@ static void XGIfb_search_vesamode(unsigned int vesamode) ...@@ -511,8 +516,8 @@ static void XGIfb_search_vesamode(unsigned int vesamode)
vesamode &= 0x1dff; /* Clean VESA mode number from other flags */ vesamode &= 0x1dff; /* Clean VESA mode number from other flags */
while (XGIbios_mode[i].mode_no != 0) { while (XGIbios_mode[i].mode_no != 0) {
if ((XGIbios_mode[i].vesa_mode_no_1 == vesamode) if ((XGIbios_mode[i].vesa_mode_no_1 == vesamode) ||
|| (XGIbios_mode[i].vesa_mode_no_2 == vesamode)) { (XGIbios_mode[i].vesa_mode_no_2 == vesamode)) {
xgifb_mode_idx = i; xgifb_mode_idx = i;
j = 1; j = 1;
break; break;
...@@ -533,7 +538,9 @@ static int XGIfb_GetXG21LVDSData(void) ...@@ -533,7 +538,9 @@ static int XGIfb_GetXG21LVDSData(void)
xgifb_reg_set(XGISR, 0x1e, tmp | 4); xgifb_reg_set(XGISR, 0x1e, tmp | 4);
pData = xgi_video_info.mmio_vbase + 0x20000; pData = xgi_video_info.mmio_vbase + 0x20000;
if ((pData[0x0] == 0x55) && (pData[0x1] == 0xAA) && (pData[0x65] & 0x1)) { if ((pData[0x0] == 0x55) &&
(pData[0x1] == 0xAA) &&
(pData[0x65] & 0x1)) {
i = pData[0x316] | (pData[0x317] << 8); i = pData[0x316] | (pData[0x317] << 8);
j = pData[i - 1]; j = pData[i - 1];
if (j == 0xff) if (j == 0xff)
...@@ -589,8 +596,8 @@ static int XGIfb_validate_mode(int myindex) ...@@ -589,8 +596,8 @@ static int XGIfb_validate_mode(int myindex)
return -1; return -1;
if (XGIbios_mode[myindex].yres > yres) if (XGIbios_mode[myindex].yres > yres)
return -1; return -1;
if ((XGIbios_mode[myindex].xres < xres) if ((XGIbios_mode[myindex].xres < xres) &&
&& (XGIbios_mode[myindex].yres < yres)) { (XGIbios_mode[myindex].yres < yres)) {
if (XGIbios_mode[myindex].bpp > 8) if (XGIbios_mode[myindex].bpp > 8)
return -1; return -1;
} }
...@@ -685,13 +692,11 @@ static int XGIfb_validate_mode(int myindex) ...@@ -685,13 +692,11 @@ static int XGIfb_validate_mode(int myindex)
return -1; return -1;
break; break;
case 1024: case 1024:
if ((XGIbios_mode[myindex].yres != 600) if ((XGIbios_mode[myindex].yres != 600) &&
&& (XGIbios_mode[myindex].yres (XGIbios_mode[myindex].yres != 768))
!= 768))
return -1; return -1;
if ((XGIbios_mode[myindex].yres == 600) if ((XGIbios_mode[myindex].yres == 600) &&
&& (XGIhw_ext.ulCRT2LCDType (XGIhw_ext.ulCRT2LCDType != LCD_1024x600))
!= LCD_1024x600))
return -1; return -1;
break; break;
case 1152: case 1152:
...@@ -701,13 +706,11 @@ static int XGIfb_validate_mode(int myindex) ...@@ -701,13 +706,11 @@ static int XGIfb_validate_mode(int myindex)
return -1; return -1;
break; break;
case 1280: case 1280:
if ((XGIbios_mode[myindex].yres != 768) if ((XGIbios_mode[myindex].yres != 768) &&
&& (XGIbios_mode[myindex].yres (XGIbios_mode[myindex].yres != 1024))
!= 1024))
return -1; return -1;
if ((XGIbios_mode[myindex].yres == 768) if ((XGIbios_mode[myindex].yres == 768) &&
&& (XGIhw_ext.ulCRT2LCDType (XGIhw_ext.ulCRT2LCDType != LCD_1280x768))
!= LCD_1280x768))
return -1; return -1;
break; break;
case 1400: case 1400:
...@@ -728,9 +731,8 @@ static int XGIfb_validate_mode(int myindex) ...@@ -728,9 +731,8 @@ static int XGIfb_validate_mode(int myindex)
return -1; return -1;
break; break;
case 640: case 640:
if ((XGIbios_mode[myindex].yres != 400) if ((XGIbios_mode[myindex].yres != 400) &&
&& (XGIbios_mode[myindex].yres (XGIbios_mode[myindex].yres != 480))
!= 480))
return -1; return -1;
break; break;
case 800: case 800:
...@@ -742,13 +744,12 @@ static int XGIfb_validate_mode(int myindex) ...@@ -742,13 +744,12 @@ static int XGIfb_validate_mode(int myindex)
return -1; return -1;
break; break;
case 1280: case 1280:
if ((XGIbios_mode[myindex].yres != 960) if ((XGIbios_mode[myindex].yres != 960) &&
&& (XGIbios_mode[myindex].yres (XGIbios_mode[myindex].yres != 1024))
!= 1024))
return -1; return -1;
if (XGIbios_mode[myindex].yres == 960) { if (XGIbios_mode[myindex].yres == 960) {
if (XGIhw_ext.ulCRT2LCDType if (XGIhw_ext.ulCRT2LCDType ==
== LCD_1400x1050) LCD_1400x1050)
return -1; return -1;
} }
break; break;
...@@ -780,8 +781,8 @@ static int XGIfb_validate_mode(int myindex) ...@@ -780,8 +781,8 @@ static int XGIfb_validate_mode(int myindex)
return -1; return -1;
} }
/* TW: LVDS/CHRONTEL does not support 720 */ /* TW: LVDS/CHRONTEL does not support 720 */
if (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL if (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL ||
|| xgi_video_info.hasVB == HASVB_CHRONTEL) { xgi_video_info.hasVB == HASVB_CHRONTEL) {
return -1; return -1;
} }
break; break;
...@@ -833,8 +834,8 @@ static u8 XGIfb_search_refresh_rate(unsigned int rate) ...@@ -833,8 +834,8 @@ static u8 XGIfb_search_refresh_rate(unsigned int rate)
XGIfb_rate_idx = 0; XGIfb_rate_idx = 0;
while ((XGIfb_vrate[i].idx != 0) && (XGIfb_vrate[i].xres <= xres)) { while ((XGIfb_vrate[i].idx != 0) && (XGIfb_vrate[i].xres <= xres)) {
if ((XGIfb_vrate[i].xres == xres) && (XGIfb_vrate[i].yres if ((XGIfb_vrate[i].xres == xres) &&
== yres)) { (XGIfb_vrate[i].yres == yres)) {
if (XGIfb_vrate[i].refresh == rate) { if (XGIfb_vrate[i].refresh == rate) {
XGIfb_rate_idx = XGIfb_vrate[i].idx; XGIfb_rate_idx = XGIfb_vrate[i].idx;
break; break;
...@@ -843,16 +844,16 @@ static u8 XGIfb_search_refresh_rate(unsigned int rate) ...@@ -843,16 +844,16 @@ static u8 XGIfb_search_refresh_rate(unsigned int rate)
DPRINTK("XGIfb: Adjusting rate from %d up to %d\n", DPRINTK("XGIfb: Adjusting rate from %d up to %d\n",
rate, XGIfb_vrate[i].refresh); rate, XGIfb_vrate[i].refresh);
XGIfb_rate_idx = XGIfb_vrate[i].idx; XGIfb_rate_idx = XGIfb_vrate[i].idx;
xgi_video_info.refresh_rate xgi_video_info.refresh_rate =
= XGIfb_vrate[i].refresh; XGIfb_vrate[i].refresh;
} else if (((rate - XGIfb_vrate[i - 1].refresh) } else if (((rate - XGIfb_vrate[i - 1].refresh)
<= 2) && (XGIfb_vrate[i].idx <= 2) && (XGIfb_vrate[i].idx
!= 1)) { != 1)) {
DPRINTK("XGIfb: Adjusting rate from %d down to %d\n", DPRINTK("XGIfb: Adjusting rate from %d down to %d\n",
rate, XGIfb_vrate[i-1].refresh); rate, XGIfb_vrate[i-1].refresh);
XGIfb_rate_idx = XGIfb_vrate[i - 1].idx; XGIfb_rate_idx = XGIfb_vrate[i - 1].idx;
xgi_video_info.refresh_rate xgi_video_info.refresh_rate =
= XGIfb_vrate[i - 1].refresh; XGIfb_vrate[i - 1].refresh;
} }
break; break;
} else if ((rate - XGIfb_vrate[i].refresh) <= 2) { } else if ((rate - XGIfb_vrate[i].refresh) <= 2) {
...@@ -867,8 +868,8 @@ static u8 XGIfb_search_refresh_rate(unsigned int rate) ...@@ -867,8 +868,8 @@ static u8 XGIfb_search_refresh_rate(unsigned int rate)
if (XGIfb_rate_idx > 0) { if (XGIfb_rate_idx > 0) {
return XGIfb_rate_idx; return XGIfb_rate_idx;
} else { } else {
printk(KERN_INFO printk(KERN_INFO "XGIfb: Unsupported rate %d for %dx%d\n",
"XGIfb: Unsupported rate %d for %dx%d\n", rate, xres, yres); rate, xres, yres);
return 0; return 0;
} }
} }
...@@ -983,12 +984,14 @@ static void XGIfb_post_setmode(void) ...@@ -983,12 +984,14 @@ static void XGIfb_post_setmode(void)
*test* *test*
*/ */
if (xgi_video_info.video_bpp == 8) { if (xgi_video_info.video_bpp == 8) {
/* TW: We can't switch off CRT1 on LVDS/Chrontel in 8bpp Modes */ /* TW: We can't switch off CRT1 on LVDS/Chrontel
if ((xgi_video_info.hasVB == HASVB_LVDS) * in 8bpp Modes */
|| (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL)) { if ((xgi_video_info.hasVB == HASVB_LVDS) ||
(xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL)) {
doit = 0; doit = 0;
} }
/* TW: We can't switch off CRT1 on 301B-DH in 8bpp Modes if using LCD */ /* TW: We can't switch off CRT1 on 301B-DH
* in 8bpp Modes if using LCD */
if (xgi_video_info.disp_state & DISPTYPE_LCD) if (xgi_video_info.disp_state & DISPTYPE_LCD)
doit = 0; doit = 0;
} }
...@@ -1019,25 +1022,27 @@ static void XGIfb_post_setmode(void) ...@@ -1019,25 +1022,27 @@ static void XGIfb_post_setmode(void)
reg = xgifb_reg_get(XGIPART4, 0x01); reg = xgifb_reg_get(XGIPART4, 0x01);
if (reg < 0xB0) { /* Set filter for XGI301 */ if (reg < 0xB0) { /* Set filter for XGI301 */
switch (xgi_video_info.video_width) { switch (xgi_video_info.video_width) {
case 320: case 320:
filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 4 : 12; filter_tb = (xgi_video_info.TV_type ==
TVMODE_NTSC) ? 4 : 12;
break; break;
case 640: case 640:
filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 5 : 13; filter_tb = (xgi_video_info.TV_type ==
TVMODE_NTSC) ? 5 : 13;
break; break;
case 720: case 720:
filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 6 : 14; filter_tb = (xgi_video_info.TV_type ==
TVMODE_NTSC) ? 6 : 14;
break; break;
case 800: case 800:
filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 7 : 15; filter_tb = (xgi_video_info.TV_type ==
TVMODE_NTSC) ? 7 : 15;
break; break;
default: default:
filter = -1; filter = -1;
break; break;
} }
xgifb_reg_or(XGIPART1, XGIfb_CRT2_write_enable, 0x01); xgifb_reg_or(XGIPART1, XGIfb_CRT2_write_enable, 0x01);
if (xgi_video_info.TV_type == TVMODE_NTSC) { if (xgi_video_info.TV_type == TVMODE_NTSC) {
...@@ -1055,22 +1060,46 @@ static void XGIfb_post_setmode(void) ...@@ -1055,22 +1060,46 @@ static void XGIfb_post_setmode(void)
switch (xgi_video_info.video_width) { switch (xgi_video_info.video_width) {
case 640: case 640:
xgifb_reg_set(XGIPART2, 0x35, 0xEB); xgifb_reg_set(XGIPART2,
xgifb_reg_set(XGIPART2, 0x36, 0x04); 0x35,
xgifb_reg_set(XGIPART2, 0x37, 0x25); 0xEB);
xgifb_reg_set(XGIPART2, 0x38, 0x18); xgifb_reg_set(XGIPART2,
0x36,
0x04);
xgifb_reg_set(XGIPART2,
0x37,
0x25);
xgifb_reg_set(XGIPART2,
0x38,
0x18);
break; break;
case 720: case 720:
xgifb_reg_set(XGIPART2, 0x35, 0xEE); xgifb_reg_set(XGIPART2,
xgifb_reg_set(XGIPART2, 0x36, 0x0C); 0x35,
xgifb_reg_set(XGIPART2, 0x37, 0x22); 0xEE);
xgifb_reg_set(XGIPART2, 0x38, 0x08); xgifb_reg_set(XGIPART2,
0x36,
0x0C);
xgifb_reg_set(XGIPART2,
0x37,
0x22);
xgifb_reg_set(XGIPART2,
0x38,
0x08);
break; break;
case 800: case 800:
xgifb_reg_set(XGIPART2, 0x35, 0xEB); xgifb_reg_set(XGIPART2,
xgifb_reg_set(XGIPART2, 0x36, 0x15); 0x35,
xgifb_reg_set(XGIPART2, 0x37, 0x25); 0xEB);
xgifb_reg_set(XGIPART2, 0x38, 0xF6); xgifb_reg_set(XGIPART2,
0x36,
0x15);
xgifb_reg_set(XGIPART2,
0x37,
0x25);
xgifb_reg_set(XGIPART2,
0x38,
0xF6);
break; break;
} }
} }
...@@ -1090,56 +1119,86 @@ static void XGIfb_post_setmode(void) ...@@ -1090,56 +1119,86 @@ static void XGIfb_post_setmode(void)
switch (xgi_video_info.video_width) { switch (xgi_video_info.video_width) {
case 640: case 640:
xgifb_reg_set(XGIPART2, 0x35, 0xF1); xgifb_reg_set(XGIPART2,
xgifb_reg_set(XGIPART2, 0x36, 0xF7); 0x35,
xgifb_reg_set(XGIPART2, 0x37, 0x1F); 0xF1);
xgifb_reg_set(XGIPART2, 0x38, 0x32); xgifb_reg_set(XGIPART2,
0x36,
0xF7);
xgifb_reg_set(XGIPART2,
0x37,
0x1F);
xgifb_reg_set(XGIPART2,
0x38,
0x32);
break; break;
case 720: case 720:
xgifb_reg_set(XGIPART2, 0x35, 0xF3); xgifb_reg_set(XGIPART2,
xgifb_reg_set(XGIPART2, 0x36, 0x00); 0x35,
xgifb_reg_set(XGIPART2, 0x37, 0x1D); 0xF3);
xgifb_reg_set(XGIPART2, 0x38, 0x20); xgifb_reg_set(XGIPART2,
0x36,
0x00);
xgifb_reg_set(XGIPART2,
0x37,
0x1D);
xgifb_reg_set(XGIPART2,
0x38,
0x20);
break; break;
case 800: case 800:
xgifb_reg_set(XGIPART2, 0x35, 0xFC); xgifb_reg_set(XGIPART2,
xgifb_reg_set(XGIPART2, 0x36, 0xFB); 0x35,
xgifb_reg_set(XGIPART2, 0x37, 0x14); 0xFC);
xgifb_reg_set(XGIPART2, 0x38, 0x2A); xgifb_reg_set(XGIPART2,
0x36,
0xFB);
xgifb_reg_set(XGIPART2,
0x37,
0x14);
xgifb_reg_set(XGIPART2,
0x38,
0x2A);
break; break;
} }
} }
} }
if ((filter >= 0) && (filter <= 7)) { if ((filter >= 0) && (filter <= 7)) {
DPRINTK("FilterTable[%d]-%d: %02x %02x %02x %02x\n", filter_tb, filter, DPRINTK("FilterTable[%d]-%d: %02x %02x %02x %02x\n",
XGI_TV_filter[filter_tb].filter[filter][0], filter_tb, filter,
XGI_TV_filter[filter_tb].filter[filter][1], XGI_TV_filter[filter_tb].
XGI_TV_filter[filter_tb].filter[filter][2], filter[filter][0],
XGI_TV_filter[filter_tb].filter[filter][3] XGI_TV_filter[filter_tb].
filter[filter][1],
XGI_TV_filter[filter_tb].
filter[filter][2],
XGI_TV_filter[filter_tb].
filter[filter][3]
); );
xgifb_reg_set( xgifb_reg_set(
XGIPART2, XGIPART2,
0x35, 0x35,
(XGI_TV_filter[filter_tb].filter[filter][0])); (XGI_TV_filter[filter_tb].
filter[filter][0]));
xgifb_reg_set( xgifb_reg_set(
XGIPART2, XGIPART2,
0x36, 0x36,
(XGI_TV_filter[filter_tb].filter[filter][1])); (XGI_TV_filter[filter_tb].
filter[filter][1]));
xgifb_reg_set( xgifb_reg_set(
XGIPART2, XGIPART2,
0x37, 0x37,
(XGI_TV_filter[filter_tb].filter[filter][2])); (XGI_TV_filter[filter_tb].
filter[filter][2]));
xgifb_reg_set( xgifb_reg_set(
XGIPART2, XGIPART2,
0x38, 0x38,
(XGI_TV_filter[filter_tb].filter[filter][3])); (XGI_TV_filter[filter_tb].
filter[filter][3]));
} }
} }
} }
} }
static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
...@@ -1190,7 +1249,10 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, ...@@ -1190,7 +1249,10 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
} }
printk(KERN_DEBUG "XGIfb: Change mode to %dx%dx%d-%dHz\n", printk(KERN_DEBUG "XGIfb: Change mode to %dx%dx%d-%dHz\n",
var->xres, var->yres, var->bits_per_pixel, xgi_video_info.refresh_rate); var->xres,
var->yres,
var->bits_per_pixel,
xgi_video_info.refresh_rate);
old_mode = xgifb_mode_idx; old_mode = xgifb_mode_idx;
xgifb_mode_idx = 0; xgifb_mode_idx = 0;
...@@ -1215,8 +1277,8 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, ...@@ -1215,8 +1277,8 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
xgifb_mode_idx = -1; xgifb_mode_idx = -1;
if (xgifb_mode_idx < 0) { if (xgifb_mode_idx < 0) {
printk(KERN_ERR "XGIfb: Mode %dx%dx%d not supported\n", var->xres, printk(KERN_ERR "XGIfb: Mode %dx%dx%d not supported\n",
var->yres, var->bits_per_pixel); var->xres, var->yres, var->bits_per_pixel);
xgifb_mode_idx = old_mode; xgifb_mode_idx = old_mode;
return -EINVAL; return -EINVAL;
} }
...@@ -1230,7 +1292,8 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, ...@@ -1230,7 +1292,8 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
XGIfb_pre_setmode(); XGIfb_pre_setmode();
if (XGISetModeNew(&XGIhw_ext, XGIfb_mode_no) == 0) { if (XGISetModeNew(&XGIhw_ext, XGIfb_mode_no) == 0) {
printk(KERN_ERR "XGIfb: Setting mode[0x%x] failed\n", XGIfb_mode_no); printk(KERN_ERR "XGIfb: Setting mode[0x%x] failed\n",
XGIfb_mode_no);
return -EINVAL; return -EINVAL;
} }
info->fix.line_length = ((info->var.xres_virtual info->fix.line_length = ((info->var.xres_virtual
...@@ -1239,7 +1302,9 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, ...@@ -1239,7 +1302,9 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
xgifb_reg_set(XGISR, IND_XGI_PASSWORD, XGI_PASSWORD); xgifb_reg_set(XGISR, IND_XGI_PASSWORD, XGI_PASSWORD);
xgifb_reg_set(XGICR, 0x13, (info->fix.line_length & 0x00ff)); xgifb_reg_set(XGICR, 0x13, (info->fix.line_length & 0x00ff));
xgifb_reg_set(XGISR, 0x0E, (info->fix.line_length & 0xff00) >> 8); xgifb_reg_set(XGISR,
0x0E,
(info->fix.line_length & 0xff00) >> 8);
XGIfb_post_setmode(); XGIfb_post_setmode();
...@@ -1287,7 +1352,8 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, ...@@ -1287,7 +1352,8 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
break; break;
default: default:
xgi_video_info.video_cmap_len = 16; xgi_video_info.video_cmap_len = 16;
printk(KERN_ERR "XGIfb: Unsupported depth %d", xgi_video_info.video_bpp); printk(KERN_ERR "XGIfb: Unsupported depth %d",
xgi_video_info.video_bpp);
break; break;
} }
} }
...@@ -1343,7 +1409,10 @@ static int XGIfb_pan_var(struct fb_var_screeninfo *var) ...@@ -1343,7 +1409,10 @@ static int XGIfb_pan_var(struct fb_var_screeninfo *var)
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));
xgifb_reg_set(XGIPART1, 0x04, ((base >> 16) & 0xFF)); xgifb_reg_set(XGIPART1, 0x04, ((base >> 16) & 0xFF));
xgifb_reg_and_or(XGIPART1, 0x02, 0x7F, ((base >> 24) & 0x01) << 7); xgifb_reg_and_or(XGIPART1,
0x02,
0x7F,
((base >> 24) & 0x01) << 7);
} }
/* printk("End of pan_var"); */ /* printk("End of pan_var"); */
return 0; return 0;
...@@ -1493,7 +1562,8 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -1493,7 +1562,8 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
if (var->pixclock && htotal && vtotal) { if (var->pixclock && htotal && vtotal) {
drate = 1000000000 / var->pixclock; drate = 1000000000 / var->pixclock;
hrate = (drate * 1000) / htotal; hrate = (drate * 1000) / htotal;
xgi_video_info.refresh_rate = (unsigned int) (hrate * 2 / vtotal); xgi_video_info.refresh_rate =
(unsigned int) (hrate * 2 / vtotal);
printk(KERN_DEBUG printk(KERN_DEBUG
"%s: pixclock = %d ,htotal=%d, vtotal=%d\n" "%s: pixclock = %d ,htotal=%d, vtotal=%d\n"
"%s: drate=%d, hrate=%d, refresh_rate=%d\n", "%s: drate=%d, hrate=%d, refresh_rate=%d\n",
...@@ -1536,10 +1606,10 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -1536,10 +1606,10 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
var->xres, var->yres, var->bits_per_pixel); var->xres, var->yres, var->bits_per_pixel);
search_idx = 0; search_idx = 0;
while (XGIbios_mode[search_idx].mode_no != 0) { while (XGIbios_mode[search_idx].mode_no != 0) {
if ((var->xres <= XGIbios_mode[search_idx].xres) && if ((var->xres <= XGIbios_mode[search_idx].xres) &&
(var->yres <= XGIbios_mode[search_idx].yres) && (var->yres <= XGIbios_mode[search_idx].yres) &&
(var->bits_per_pixel == XGIbios_mode[search_idx].bpp)) { (var->bits_per_pixel ==
XGIbios_mode[search_idx].bpp)) {
if (XGIfb_validate_mode(search_idx) > 0) { if (XGIfb_validate_mode(search_idx) > 0) {
found_mode = 1; found_mode = 1;
break; break;
...@@ -1579,7 +1649,8 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -1579,7 +1649,8 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
} /* else { */ } /* else { */
/* TW: Now patch yres_virtual if we use panning */ /* TW: Now patch yres_virtual if we use panning */
/* May I do this? */ /* May I do this? */
/* var->yres_virtual = xgi_video_info.heapstart / (var->xres * (var->bits_per_pixel >> 3)); */ /* var->yres_virtual = xgi_video_info.heapstart /
(var->xres * (var->bits_per_pixel >> 3)); */
/* if (var->yres_virtual <= var->yres) { */ /* if (var->yres_virtual <= var->yres) { */
/* TW: Paranoia check */ /* TW: Paranoia check */
/* var->yres_virtual = var->yres; */ /* var->yres_virtual = var->yres; */
...@@ -1765,7 +1836,8 @@ static int XGIfb_get_dram_size(void) ...@@ -1765,7 +1836,8 @@ static int XGIfb_get_dram_size(void)
/* xgi_video_info.video_size = 0x200000; */ /* 1024x768x16 */ /* xgi_video_info.video_size = 0x200000; */ /* 1024x768x16 */
/* xgi_video_info.video_size = 0x1000000; */ /* benchmark */ /* xgi_video_info.video_size = 0x1000000; */ /* benchmark */
printk("XGIfb: SR14=%x DramSzie %x ChannelNum %x\n", reg, printk("XGIfb: SR14=%x DramSzie %x ChannelNum %x\n",
reg,
xgi_video_info.video_size, ChannelNum); xgi_video_info.video_size, ChannelNum);
return 0; return 0;
...@@ -1897,15 +1969,19 @@ XGIINITSTATIC int __init XGIfb_setup(char *options) ...@@ -1897,15 +1969,19 @@ XGIINITSTATIC int __init XGIfb_setup(char *options)
if (!strncmp(this_opt, "mode:", 5)) { if (!strncmp(this_opt, "mode:", 5)) {
XGIfb_search_mode(this_opt + 5); XGIfb_search_mode(this_opt + 5);
} else if (!strncmp(this_opt, "vesa:", 5)) { } else if (!strncmp(this_opt, "vesa:", 5)) {
XGIfb_search_vesamode(simple_strtoul(this_opt + 5, NULL, 0)); XGIfb_search_vesamode(simple_strtoul(
this_opt + 5, NULL, 0));
} else if (!strncmp(this_opt, "mode:", 5)) { } else if (!strncmp(this_opt, "mode:", 5)) {
XGIfb_search_mode(this_opt + 5); XGIfb_search_mode(this_opt + 5);
} else if (!strncmp(this_opt, "vesa:", 5)) { } else if (!strncmp(this_opt, "vesa:", 5)) {
XGIfb_search_vesamode(simple_strtoul(this_opt + 5, NULL, 0)); XGIfb_search_vesamode(simple_strtoul(
this_opt + 5, NULL, 0));
} else if (!strncmp(this_opt, "vrate:", 6)) { } else if (!strncmp(this_opt, "vrate:", 6)) {
xgi_video_info.refresh_rate = simple_strtoul(this_opt + 6, NULL, 0); xgi_video_info.refresh_rate = simple_strtoul(
this_opt + 6, NULL, 0);
} else if (!strncmp(this_opt, "rate:", 5)) { } else if (!strncmp(this_opt, "rate:", 5)) {
xgi_video_info.refresh_rate = simple_strtoul(this_opt + 5, NULL, 0); xgi_video_info.refresh_rate = simple_strtoul(
this_opt + 5, NULL, 0);
} else if (!strncmp(this_opt, "off", 3)) { } else if (!strncmp(this_opt, "off", 3)) {
XGIfb_off = 1; XGIfb_off = 1;
} else if (!strncmp(this_opt, "crt1off", 7)) { } else if (!strncmp(this_opt, "crt1off", 7)) {
...@@ -1915,7 +1991,8 @@ XGIINITSTATIC int __init XGIfb_setup(char *options) ...@@ -1915,7 +1991,8 @@ XGIINITSTATIC int __init XGIfb_setup(char *options)
} else if (!strncmp(this_opt, "forcecrt2type:", 14)) { } else if (!strncmp(this_opt, "forcecrt2type:", 14)) {
XGIfb_search_crt2type(this_opt + 14); XGIfb_search_crt2type(this_opt + 14);
} else if (!strncmp(this_opt, "forcecrt1:", 10)) { } else if (!strncmp(this_opt, "forcecrt1:", 10)) {
XGIfb_forcecrt1 = (int)simple_strtoul(this_opt + 10, NULL, 0); XGIfb_forcecrt1 = (int)simple_strtoul(
this_opt + 10, NULL, 0);
} else if (!strncmp(this_opt, "tvmode:", 7)) { } else if (!strncmp(this_opt, "tvmode:", 7)) {
XGIfb_search_tvstd(this_opt + 7); XGIfb_search_tvstd(this_opt + 7);
} else if (!strncmp(this_opt, "tvstandard:", 11)) { } else if (!strncmp(this_opt, "tvstandard:", 11)) {
...@@ -1933,12 +2010,15 @@ XGIINITSTATIC int __init XGIfb_setup(char *options) ...@@ -1933,12 +2010,15 @@ XGIINITSTATIC int __init XGIfb_setup(char *options)
} 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)) {
XGIfb_userom = (int)simple_strtoul(this_opt + 7, NULL, 0); XGIfb_userom = (int)simple_strtoul(
this_opt + 7, NULL, 0);
/* } else if (!strncmp(this_opt, "useoem:", 7)) { */ /* } else if (!strncmp(this_opt, "useoem:", 7)) { */
/* XGIfb_useoem = (int)simple_strtoul(this_opt + 7, NULL, 0); */ /* XGIfb_useoem = (int)simple_strtoul(
this_opt + 7, NULL, 0); */
} else { } else {
XGIfb_search_mode(this_opt); XGIfb_search_mode(this_opt);
/* printk(KERN_INFO "XGIfb: Invalid option %s\n", this_opt); */ /* printk(KERN_INFO "XGIfb: Invalid option %s\n",
this_opt); */
} }
/* TW: Panning only with acceleration */ /* TW: Panning only with acceleration */
...@@ -1989,7 +2069,9 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -1989,7 +2069,9 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
return -ENOMEM; return -ENOMEM;
xgi_video_info.chip_id = pdev->device; xgi_video_info.chip_id = pdev->device;
pci_read_config_byte(pdev, PCI_REVISION_ID, &xgi_video_info.revision_id); pci_read_config_byte(pdev,
PCI_REVISION_ID,
&xgi_video_info.revision_id);
XGIhw_ext.jChipRevision = xgi_video_info.revision_id; XGIhw_ext.jChipRevision = xgi_video_info.revision_id;
xgi_video_info.pcibus = pdev->bus->number; xgi_video_info.pcibus = pdev->bus->number;
...@@ -2060,7 +2142,8 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2060,7 +2142,8 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
if ((xgi_video_info.chip == XG21) || (XGIfb_userom)) { if ((xgi_video_info.chip == XG21) || (XGIfb_userom)) {
XGIhw_ext.pjVirtualRomBase = xgifb_copy_rom(pdev); XGIhw_ext.pjVirtualRomBase = xgifb_copy_rom(pdev);
if (XGIhw_ext.pjVirtualRomBase) if (XGIhw_ext.pjVirtualRomBase)
printk(KERN_INFO "XGIfb: Video ROM found and mapped to %p\n", XGIhw_ext.pjVirtualRomBase); printk(KERN_INFO "XGIfb: Video ROM found and mapped to %p\n",
XGIhw_ext.pjVirtualRomBase);
else else
printk(KERN_INFO "XGIfb: Video ROM not found\n"); printk(KERN_INFO "XGIfb: Video ROM not found\n");
} else { } else {
...@@ -2075,17 +2158,23 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2075,17 +2158,23 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
goto error; goto error;
} }
if ((xgifb_mode_idx < 0) || ((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) { if ((xgifb_mode_idx < 0) ||
((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) {
/* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */ /* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */
xgifb_reg_or(XGISR, IND_XGI_PCI_ADDRESS_SET, (XGI_PCI_ADDR_ENABLE | XGI_MEM_MAP_IO_ENABLE)); xgifb_reg_or(XGISR,
IND_XGI_PCI_ADDRESS_SET,
(XGI_PCI_ADDR_ENABLE | XGI_MEM_MAP_IO_ENABLE));
/* Enable 2D accelerator engine */ /* Enable 2D accelerator engine */
xgifb_reg_or(XGISR, IND_XGI_MODULE_ENABLE, XGI_ENABLE_2D); xgifb_reg_or(XGISR, IND_XGI_MODULE_ENABLE, XGI_ENABLE_2D);
} }
XGIhw_ext.ulVideoMemorySize = xgi_video_info.video_size; XGIhw_ext.ulVideoMemorySize = xgi_video_info.video_size;
if (!request_mem_region(xgi_video_info.video_base, xgi_video_info.video_size, "XGIfb FB")) { if (!request_mem_region(xgi_video_info.video_base,
printk("unable request memory size %x", xgi_video_info.video_size); xgi_video_info.video_size,
"XGIfb FB")) {
printk("unable request memory size %x",
xgi_video_info.video_size);
printk(KERN_ERR "XGIfb: Fatal error: Unable to reserve frame buffer memory\n"); printk(KERN_ERR "XGIfb: Fatal error: Unable to reserve frame buffer memory\n");
printk(KERN_ERR "XGIfb: Is there another framebuffer driver active?\n"); printk(KERN_ERR "XGIfb: Is there another framebuffer driver active?\n");
ret = -ENODEV; ret = -ENODEV;
...@@ -2106,7 +2195,9 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2106,7 +2195,9 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
xgi_video_info.mmio_size); xgi_video_info.mmio_size);
printk(KERN_INFO "XGIfb: Framebuffer at 0x%lx, mapped to 0x%p, size %dk\n", printk(KERN_INFO "XGIfb: Framebuffer at 0x%lx, mapped to 0x%p, size %dk\n",
xgi_video_info.video_base, xgi_video_info.video_vbase, xgi_video_info.video_size / 1024); xgi_video_info.video_base,
xgi_video_info.video_vbase,
xgi_video_info.video_size / 1024);
printk(KERN_INFO "XGIfb: MMIO at 0x%lx, mapped to 0x%p, size %ldk\n", printk(KERN_INFO "XGIfb: MMIO at 0x%lx, mapped to 0x%p, size %ldk\n",
xgi_video_info.mmio_base, xgi_video_info.mmio_vbase, xgi_video_info.mmio_base, xgi_video_info.mmio_vbase,
...@@ -2119,9 +2210,11 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2119,9 +2210,11 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
xgi_video_info.mtrr = (unsigned int) 0; xgi_video_info.mtrr = (unsigned int) 0;
if ((xgifb_mode_idx < 0) || ((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) { if ((xgifb_mode_idx < 0) ||
((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) {
xgi_video_info.hasVB = HASVB_NONE; xgi_video_info.hasVB = HASVB_NONE;
if ((xgi_video_info.chip == XG20) || (xgi_video_info.chip == XG27)) { if ((xgi_video_info.chip == XG20) ||
(xgi_video_info.chip == XG27)) {
xgi_video_info.hasVB = HASVB_NONE; xgi_video_info.hasVB = HASVB_NONE;
} else if (xgi_video_info.chip == XG21) { } else if (xgi_video_info.chip == XG21) {
CR38 = xgifb_reg_get(XGICR, 0x38); CR38 = xgifb_reg_get(XGICR, 0x38);
...@@ -2215,9 +2308,11 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2215,9 +2308,11 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
if (XGIfb_crt1off) if (XGIfb_crt1off)
xgi_video_info.disp_state |= DISPMODE_SINGLE; xgi_video_info.disp_state |= DISPMODE_SINGLE;
else else
xgi_video_info.disp_state |= (DISPMODE_MIRROR | DISPTYPE_CRT1); xgi_video_info.disp_state |= (DISPMODE_MIRROR |
DISPTYPE_CRT1);
} else { } else {
xgi_video_info.disp_state = DISPMODE_SINGLE | DISPTYPE_CRT1; xgi_video_info.disp_state = DISPMODE_SINGLE |
DISPTYPE_CRT1;
} }
if (xgi_video_info.disp_state & DISPTYPE_LCD) { if (xgi_video_info.disp_state & DISPTYPE_LCD) {
...@@ -2244,19 +2339,23 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2244,19 +2339,23 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
int tmp; int tmp;
tmp = xgifb_reg_get(XGICR, 0x34); tmp = xgifb_reg_get(XGICR, 0x34);
if (tmp <= 0x13) { if (tmp <= 0x13) {
/* Currently on LCDA? (Some BIOSes leave CR38) */ /* Currently on LCDA?
*(Some BIOSes leave CR38) */
tmp = xgifb_reg_get(XGICR, 0x38); tmp = xgifb_reg_get(XGICR, 0x38);
if ((tmp & 0x03) == 0x03) { if ((tmp & 0x03) == 0x03) {
/* XGI_Pr.XGI_UseLCDA = 1; */ /* XGI_Pr.XGI_UseLCDA = 1; */
} else { } else {
/* Currently on LCDA? (Some newer BIOSes set D0 in CR35) */ /* Currently on LCDA?
*(Some newer BIOSes set D0 in CR35) */
tmp = xgifb_reg_get(XGICR, 0x35); tmp = xgifb_reg_get(XGICR, 0x35);
if (tmp & 0x01) { if (tmp & 0x01) {
/* XGI_Pr.XGI_UseLCDA = 1; */ /* XGI_Pr.XGI_UseLCDA = 1; */
} else { } else {
tmp = xgifb_reg_get(XGICR, 0x30); tmp = xgifb_reg_get(XGICR,
0x30);
if (tmp & 0x20) { if (tmp & 0x20) {
tmp = xgifb_reg_get(XGIPART1, 0x13); tmp = xgifb_reg_get(
XGIPART1, 0x13);
if (tmp & 0x04) { if (tmp & 0x04) {
/* XGI_Pr.XGI_UseLCDA = 1; */ /* XGI_Pr.XGI_UseLCDA = 1; */
} }
...@@ -2275,7 +2374,8 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2275,7 +2374,8 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
case DISPTYPE_LCD: case DISPTYPE_LCD:
xgifb_mode_idx = DEFAULT_LCDMODE; xgifb_mode_idx = DEFAULT_LCDMODE;
if (xgi_video_info.chip == XG21) if (xgi_video_info.chip == XG21)
xgifb_mode_idx = XGIfb_GetXG21DefaultLVDSModeIdx(); xgifb_mode_idx =
XGIfb_GetXG21DefaultLVDSModeIdx();
break; break;
case DISPTYPE_TV: case DISPTYPE_TV:
xgifb_mode_idx = DEFAULT_TVMODE; xgifb_mode_idx = DEFAULT_TVMODE;
...@@ -2288,18 +2388,26 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2288,18 +2388,26 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
XGIfb_mode_no = XGIbios_mode[xgifb_mode_idx].mode_no; XGIfb_mode_no = XGIbios_mode[xgifb_mode_idx].mode_no;
/* yilin set default refresh rate */
if (xgi_video_info.refresh_rate == 0) if (xgi_video_info.refresh_rate == 0)
xgi_video_info.refresh_rate = 60; /* yilin set default refresh rate */ xgi_video_info.refresh_rate = 60;
if (XGIfb_search_refresh_rate(xgi_video_info.refresh_rate) == 0) { if (XGIfb_search_refresh_rate(
xgi_video_info.refresh_rate) == 0) {
XGIfb_rate_idx = XGIbios_mode[xgifb_mode_idx].rate_idx; XGIfb_rate_idx = XGIbios_mode[xgifb_mode_idx].rate_idx;
xgi_video_info.refresh_rate = 60; xgi_video_info.refresh_rate = 60;
} }
xgi_video_info.video_bpp = XGIbios_mode[xgifb_mode_idx].bpp; xgi_video_info.video_bpp = XGIbios_mode[xgifb_mode_idx].bpp;
xgi_video_info.video_vwidth = xgi_video_info.video_width = XGIbios_mode[xgifb_mode_idx].xres; xgi_video_info.video_vwidth =
xgi_video_info.video_vheight = xgi_video_info.video_height = XGIbios_mode[xgifb_mode_idx].yres; xgi_video_info.video_width =
XGIbios_mode[xgifb_mode_idx].xres;
xgi_video_info.video_vheight =
xgi_video_info.video_height =
XGIbios_mode[xgifb_mode_idx].yres;
xgi_video_info.org_x = xgi_video_info.org_y = 0; xgi_video_info.org_x = xgi_video_info.org_y = 0;
xgi_video_info.video_linelength = xgi_video_info.video_width * (xgi_video_info.video_bpp >> 3); xgi_video_info.video_linelength =
xgi_video_info.video_width *
(xgi_video_info.video_bpp >> 3);
switch (xgi_video_info.video_bpp) { switch (xgi_video_info.video_bpp) {
case 8: case 8:
xgi_video_info.DstColor = 0x0000; xgi_video_info.DstColor = 0x0000;
...@@ -2318,16 +2426,23 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2318,16 +2426,23 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
break; break;
default: default:
xgi_video_info.video_cmap_len = 16; xgi_video_info.video_cmap_len = 16;
printk(KERN_INFO "XGIfb: Unsupported depth %d", xgi_video_info.video_bpp); printk(KERN_INFO "XGIfb: Unsupported depth %d",
xgi_video_info.video_bpp);
break; break;
} }
printk(KERN_INFO "XGIfb: Default mode is %dx%dx%d (%dHz)\n", printk(KERN_INFO "XGIfb: Default mode is %dx%dx%d (%dHz)\n",
xgi_video_info.video_width, xgi_video_info.video_height, xgi_video_info.video_bpp, xgi_video_info.video_width,
xgi_video_info.video_height,
xgi_video_info.video_bpp,
xgi_video_info.refresh_rate); xgi_video_info.refresh_rate);
default_var.xres = default_var.xres_virtual = xgi_video_info.video_width; default_var.xres =
default_var.yres = default_var.yres_virtual = xgi_video_info.video_height; default_var.xres_virtual =
xgi_video_info.video_width;
default_var.yres =
default_var.yres_virtual =
xgi_video_info.video_height;
default_var.bits_per_pixel = xgi_video_info.video_bpp; default_var.bits_per_pixel = xgi_video_info.video_bpp;
XGIfb_bpp_to_var(&default_var); XGIfb_bpp_to_var(&default_var);
...@@ -2343,10 +2458,12 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2343,10 +2458,12 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
&default_var.hsync_len, &default_var.vsync_len, &default_var.hsync_len, &default_var.vsync_len,
&default_var.sync, &default_var.vmode)) { &default_var.sync, &default_var.vmode)) {
if ((default_var.vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) { if ((default_var.vmode & FB_VMODE_MASK) ==
FB_VMODE_INTERLACED) {
default_var.yres <<= 1; default_var.yres <<= 1;
default_var.yres_virtual <<= 1; default_var.yres_virtual <<= 1;
} else if ((default_var.vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) { } else if ((default_var.vmode & FB_VMODE_MASK) ==
FB_VMODE_DOUBLE) {
default_var.pixclock >>= 1; default_var.pixclock >>= 1;
default_var.yres >>= 1; default_var.yres >>= 1;
default_var.yres_virtual >>= 1; default_var.yres_virtual >>= 1;
...@@ -2366,7 +2483,8 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2366,7 +2483,8 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
fb_alloc_cmap(&fb_info->cmap, 256 , 0); fb_alloc_cmap(&fb_info->cmap, 256 , 0);
#ifdef CONFIG_MTRR #ifdef CONFIG_MTRR
xgi_video_info.mtrr = mtrr_add((unsigned int) xgi_video_info.video_base, xgi_video_info.mtrr = mtrr_add(
(unsigned int) xgi_video_info.video_base,
(unsigned int) xgi_video_info.video_size, (unsigned int) xgi_video_info.video_size,
MTRR_TYPE_WRCOMB, 1); MTRR_TYPE_WRCOMB, 1);
if (xgi_video_info.mtrr) if (xgi_video_info.mtrr)
......
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