diff options
Diffstat (limited to 'drivers/staging/xgifb')
-rw-r--r-- | drivers/staging/xgifb/XGI_main.h | 54 | ||||
-rw-r--r-- | drivers/staging/xgifb/XGI_main_26.c | 196 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_init.c | 56 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_setmode.c | 667 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_table.h | 9 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_util.h | 4 |
6 files changed, 470 insertions, 516 deletions
diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h index 85079fea7152..7a80a90f229f 100644 --- a/drivers/staging/xgifb/XGI_main.h +++ b/drivers/staging/xgifb/XGI_main.h @@ -139,7 +139,7 @@ static const struct _XGIbios_mode { static const unsigned short XGI310paneltype[] = { LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, - LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960, + LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960, LCD_1152x768, LCD_1400x1050, LCD_1280x768, LCD_1600x1200, LCD_1024x768, LCD_1024x768, LCD_1024x768}; @@ -174,7 +174,7 @@ static const struct _XGI_tvtype { {"NTSC", 2}, {"pal", 1}, {"ntsc", 2}, - {"\0", -1} + {"\0", -1} }; static const struct _XGI_vrate { @@ -183,44 +183,44 @@ static const struct _XGI_vrate { u16 yres; u16 refresh; } XGIfb_vrate[] = { - {1, 640, 480, 60}, {2, 640, 480, 72}, - {3, 640, 480, 75}, {4, 640, 480, 85}, + {1, 640, 480, 60}, {2, 640, 480, 72}, + {3, 640, 480, 75}, {4, 640, 480, 85}, {5, 640, 480, 100}, {6, 640, 480, 120}, - {7, 640, 480, 160}, {8, 640, 480, 200}, + {7, 640, 480, 160}, {8, 640, 480, 200}, - {1, 720, 480, 60}, - {1, 720, 576, 58}, - {1, 800, 480, 60}, {2, 800, 480, 75}, {3, 800, 480, 85}, - {1, 800, 600, 60}, {2, 800, 600, 72}, {3, 800, 600, 75}, - {4, 800, 600, 85}, {5, 800, 600, 100}, - {6, 800, 600, 120}, {7, 800, 600, 160}, + {1, 720, 480, 60}, + {1, 720, 576, 58}, + {1, 800, 480, 60}, {2, 800, 480, 75}, {3, 800, 480, 85}, + {1, 800, 600, 60}, {2, 800, 600, 72}, {3, 800, 600, 75}, + {4, 800, 600, 85}, {5, 800, 600, 100}, + {6, 800, 600, 120}, {7, 800, 600, 160}, - {1, 1024, 768, 60}, {2, 1024, 768, 70}, {3, 1024, 768, 75}, - {4, 1024, 768, 85}, {5, 1024, 768, 100}, {6, 1024, 768, 120}, - {1, 1024, 576, 60}, {2, 1024, 576, 75}, {3, 1024, 576, 85}, - {1, 1024, 600, 60}, - {1, 1152, 768, 60}, - {1, 1280, 720, 60}, {2, 1280, 720, 75}, {3, 1280, 720, 85}, - {1, 1280, 768, 60}, + {1, 1024, 768, 60}, {2, 1024, 768, 70}, {3, 1024, 768, 75}, + {4, 1024, 768, 85}, {5, 1024, 768, 100}, {6, 1024, 768, 120}, + {1, 1024, 576, 60}, {2, 1024, 576, 75}, {3, 1024, 576, 85}, + {1, 1024, 600, 60}, + {1, 1152, 768, 60}, + {1, 1280, 720, 60}, {2, 1280, 720, 75}, {3, 1280, 720, 85}, + {1, 1280, 768, 60}, {1, 1280, 1024, 60}, {2, 1280, 1024, 75}, {3, 1280, 1024, 85}, - {1, 1280, 960, 70}, - {1, 1400, 1050, 60}, - {1, 1600, 1200, 60}, {2, 1600, 1200, 65}, + {1, 1280, 960, 70}, + {1, 1400, 1050, 60}, + {1, 1600, 1200, 60}, {2, 1600, 1200, 65}, {3, 1600, 1200, 70}, {4, 1600, 1200, 75}, - {5, 1600, 1200, 85}, {6, 1600, 1200, 100}, + {5, 1600, 1200, 85}, {6, 1600, 1200, 100}, {7, 1600, 1200, 120}, - {1, 1920, 1440, 60}, {2, 1920, 1440, 65}, + {1, 1920, 1440, 60}, {2, 1920, 1440, 65}, {3, 1920, 1440, 70}, {4, 1920, 1440, 75}, - {5, 1920, 1440, 85}, {6, 1920, 1440, 100}, - {1, 2048, 1536, 60}, {2, 2048, 1536, 65}, + {5, 1920, 1440, 85}, {6, 1920, 1440, 100}, + {1, 2048, 1536, 60}, {2, 2048, 1536, 65}, {3, 2048, 1536, 70}, {4, 2048, 1536, 75}, - {5, 2048, 1536, 85}, - {0, 0, 0, 0} + {5, 2048, 1536, 85}, + {0, 0, 0, 0} }; static const struct _XGI_TV_filter { diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 0c78491ff5a1..777cd6e11694 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -56,8 +56,8 @@ static inline void dumpVGAReg(struct xgifb_video_info *xgifb_info) /* --------------- Hardware Access Routines -------------------------- */ static int XGIfb_mode_rate_to_dclock(struct vb_device_info *XGI_Pr, - struct xgi_hw_device_info *HwDeviceExtension, - unsigned char modeno) + struct xgi_hw_device_info *HwDeviceExtension, + unsigned char modeno) { unsigned short ModeNo = modeno; unsigned short ModeIdIndex = 0, ClockIndex = 0; @@ -68,7 +68,7 @@ static int XGIfb_mode_rate_to_dclock(struct vb_device_info *XGI_Pr, XGI_SearchModeID(ModeNo, &ModeIdIndex); RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, - ModeIdIndex, XGI_Pr); + ModeIdIndex, XGI_Pr); ClockIndex = XGI330_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; @@ -76,11 +76,11 @@ static int XGIfb_mode_rate_to_dclock(struct vb_device_info *XGI_Pr, } static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr, - struct xgi_hw_device_info *HwDeviceExtension, - unsigned char modeno, - u32 *left_margin, u32 *right_margin, u32 *upper_margin, - u32 *lower_margin, u32 *hsync_len, u32 *vsync_len, u32 *sync, - u32 *vmode) + struct xgi_hw_device_info *HwDeviceExtension, + unsigned char modeno, u32 *left_margin, + u32 *right_margin, u32 *upper_margin, + u32 *lower_margin, u32 *hsync_len, + u32 *vsync_len, u32 *sync, u32 *vmode) { unsigned short ModeNo = modeno; unsigned short ModeIdIndex, index = 0; @@ -95,7 +95,7 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr, if (!XGI_SearchModeID(ModeNo, &ModeIdIndex)) return 0; RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, - ModeIdIndex, XGI_Pr); + ModeIdIndex, XGI_Pr); index = XGI330_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; sr_data = XGI_CRT1Table[index].CR[5]; @@ -105,7 +105,7 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr, cr_data = XGI_CRT1Table[index].CR[3]; /* Horizontal retrace (=sync) start */ - HRS = (cr_data & 0xff) | ((unsigned short) (sr_data & 0xC0) << 2); + HRS = (cr_data & 0xff) | ((unsigned short)(sr_data & 0xC0) << 2); F = HRS - HDE - 3; sr_data = XGI_CRT1Table[index].CR[6]; @@ -115,8 +115,8 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr, cr_data2 = XGI_CRT1Table[index].CR[4]; /* Horizontal blank end */ - HBE = (cr_data & 0x1f) | ((unsigned short) (cr_data2 & 0x80) >> 2) - | ((unsigned short) (sr_data & 0x03) << 6); + HBE = (cr_data & 0x1f) | ((unsigned short)(cr_data2 & 0x80) >> 2) + | ((unsigned short)(sr_data & 0x03) << 6); /* Horizontal retrace (=sync) end */ HRE = (cr_data2 & 0x1f) | ((sr_data & 0x04) << 3); @@ -142,15 +142,15 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr, cr_data = XGI_CRT1Table[index].CR[10]; /* Vertical retrace (=sync) start */ - VRS = (cr_data & 0xff) | ((unsigned short) (cr_data2 & 0x04) << 6) - | ((unsigned short) (cr_data2 & 0x80) << 2) - | ((unsigned short) (sr_data & 0x08) << 7); + VRS = (cr_data & 0xff) | ((unsigned short)(cr_data2 & 0x04) << 6) + | ((unsigned short)(cr_data2 & 0x80) << 2) + | ((unsigned short)(sr_data & 0x08) << 7); F = VRS + 1 - VDE; cr_data = XGI_CRT1Table[index].CR[13]; /* Vertical blank end */ - VBE = (cr_data & 0xff) | ((unsigned short) (sr_data & 0x10) << 4); + VBE = (cr_data & 0xff) | ((unsigned short)(sr_data & 0x10) << 4); temp = VBE - ((VDE - 1) & 511); B = (temp > 0) ? temp : (temp + 512); @@ -231,11 +231,11 @@ static int XGIfb_GetXG21DefaultLVDSModeIdx(struct xgifb_video_info *xgifb_info) { int i = 0; - while ((XGIbios_mode[i].mode_no != 0) - && (XGIbios_mode[i].xres <= xgifb_info->lvds_data.LVDSHDE)) { - if ((XGIbios_mode[i].xres == xgifb_info->lvds_data.LVDSHDE) - && (XGIbios_mode[i].yres == xgifb_info->lvds_data.LVDSVDE) - && (XGIbios_mode[i].bpp == 8)) { + while ((XGIbios_mode[i].mode_no != 0) && + (XGIbios_mode[i].xres <= xgifb_info->lvds_data.LVDSHDE)) { + if ((XGIbios_mode[i].xres == xgifb_info->lvds_data.LVDSHDE) && + (XGIbios_mode[i].yres == xgifb_info->lvds_data.LVDSVDE) && + (XGIbios_mode[i].bpp == 8)) { return i; } i++; @@ -384,9 +384,8 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex) return -1; break; case 640: - if ((XGIbios_mode[myindex].yres != 400) - && (XGIbios_mode[myindex].yres - != 480)) + if ((XGIbios_mode[myindex].yres != 400) && + (XGIbios_mode[myindex].yres != 480)) return -1; break; case 800: @@ -518,7 +517,7 @@ static void XGIfb_search_crt2type(const char *name) { int i = 0; - if (name == NULL) + if (!name) return; while (XGI_crt2type[i].type_no != -1) { @@ -562,7 +561,7 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info, != 1)) { pr_debug("Adjusting rate from %d down to %d\n", rate, - XGIfb_vrate[i-1].refresh); + XGIfb_vrate[i - 1].refresh); xgifb_info->rate_idx = XGIfb_vrate[i - 1].idx; xgifb_info->refresh_rate = @@ -589,7 +588,7 @@ static void XGIfb_search_tvstd(const char *name) { int i = 0; - if (name == NULL) + if (!name) return; while (XGI_tvtype[i].type_no != -1) { @@ -683,7 +682,7 @@ static void XGIfb_pre_setmode(struct xgifb_video_info *xgifb_info) xgifb_reg_set(XGICR, IND_XGI_SCRATCH_REG_CR30, cr30); xgifb_reg_set(XGICR, IND_XGI_SCRATCH_REG_CR31, cr31); xgifb_reg_set(XGICR, IND_XGI_SCRATCH_REG_CR33, - (xgifb_info->rate_idx & 0x0F)); + (xgifb_info->rate_idx & 0x0F)); } static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info) @@ -730,7 +729,6 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info) if (xgifb_info->display2 == XGIFB_DISP_TV && xgifb_info->hasVB == HASVB_301) { - reg = xgifb_reg_get(XGIPART4, 0x01); if (reg < 0xB0) { /* Set filter for XGI301 */ @@ -763,16 +761,13 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info) 0x01); if (xgifb_info->TV_type == TVMODE_NTSC) { - xgifb_reg_and(XGIPART2, 0x3a, 0x1f); if (xgifb_info->TV_plug == TVPLUG_SVIDEO) { - xgifb_reg_and(XGIPART2, 0x30, 0xdf); } else if (xgifb_info->TV_plug == TVPLUG_COMPOSITE) { - xgifb_reg_or(XGIPART2, 0x30, 0x20); switch (xgifb_info->video_width) { @@ -822,16 +817,13 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info) } } else if (xgifb_info->TV_type == TVMODE_PAL) { - xgifb_reg_and(XGIPART2, 0x3A, 0x1F); if (xgifb_info->TV_plug == TVPLUG_SVIDEO) { - xgifb_reg_and(XGIPART2, 0x30, 0xDF); } else if (xgifb_info->TV_plug == TVPLUG_COMPOSITE) { - xgifb_reg_or(XGIPART2, 0x30, 0x20); switch (xgifb_info->video_width) { @@ -912,7 +904,7 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info) } static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, - struct fb_info *info) + struct fb_info *info) { struct xgifb_video_info *xgifb_info = info->par; struct xgi_hw_device_info *hw_info = &xgifb_info->hw_info; @@ -945,17 +937,15 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, if (var->pixclock) { drate = 1000000000 / var->pixclock; hrate = (drate * 1000) / htotal; - xgifb_info->refresh_rate = (unsigned int) (hrate * 2 + xgifb_info->refresh_rate = (unsigned int)(hrate * 2 / vtotal); } else { xgifb_info->refresh_rate = 60; } pr_debug("Change mode to %dx%dx%d-%dHz\n", - var->xres, - var->yres, - var->bits_per_pixel, - xgifb_info->refresh_rate); + var->xres, var->yres, var->bits_per_pixel, + xgifb_info->refresh_rate); old_mode = xgifb_info->mode_idx; xgifb_info->mode_idx = 0; @@ -992,7 +982,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, } if (isactive) { - XGIfb_pre_setmode(xgifb_info); if (XGISetModeNew(xgifb_info, hw_info, XGIbios_mode[xgifb_info->mode_idx].mode_no) @@ -1064,7 +1053,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, break; } } - XGIfb_bpp_to_var(xgifb_info, var); /*update ARGB info*/ + XGIfb_bpp_to_var(xgifb_info, var); /* update ARGB info */ dumpVGAReg(xgifb_info); return 0; @@ -1150,7 +1139,7 @@ static int XGIfb_setcolreg(unsigned int regno, unsigned int red, } break; case 16: - ((u32 *) (info->pseudo_palette))[regno] = ((red & 0xf800)) + ((u32 *)(info->pseudo_palette))[regno] = ((red & 0xf800)) | ((green & 0xfc00) >> 5) | ((blue & 0xf800) >> 11); break; @@ -1158,7 +1147,7 @@ static int XGIfb_setcolreg(unsigned int regno, unsigned int red, red >>= 8; green >>= 8; blue >>= 8; - ((u32 *) (info->pseudo_palette))[regno] = (red << 16) | (green + ((u32 *)(info->pseudo_palette))[regno] = (red << 16) | (green << 8) | (blue); break; } @@ -1168,7 +1157,7 @@ static int XGIfb_setcolreg(unsigned int regno, unsigned int red, /* ----------- FBDev related routines for all series ---------- */ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con, - struct fb_info *info) + struct fb_info *info) { struct xgifb_video_info *xgifb_info = info->par; @@ -1250,7 +1239,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) drate = 1000000000 / var->pixclock; hrate = (drate * 1000) / htotal; xgifb_info->refresh_rate = - (unsigned int) (hrate * 2 / vtotal); + (unsigned int)(hrate * 2 / vtotal); pr_debug( "%s: pixclock = %d ,htotal=%d, vtotal=%d\n" "%s: drate=%d, hrate=%d, refresh_rate=%d\n", @@ -1262,10 +1251,10 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) search_idx = 0; while ((XGIbios_mode[search_idx].mode_no != 0) && - (XGIbios_mode[search_idx].xres <= var->xres)) { + (XGIbios_mode[search_idx].xres <= var->xres)) { if ((XGIbios_mode[search_idx].xres == var->xres) && - (XGIbios_mode[search_idx].yres == var->yres) && - (XGIbios_mode[search_idx].bpp == var->bits_per_pixel)) { + (XGIbios_mode[search_idx].yres == var->yres) && + (XGIbios_mode[search_idx].bpp == var->bits_per_pixel)) { if (XGIfb_validate_mode(xgifb_info, search_idx) > 0) { found_mode = 1; break; @@ -1275,9 +1264,8 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) } if (!found_mode) { - pr_err("%dx%dx%d is no valid mode\n", - var->xres, var->yres, var->bits_per_pixel); + var->xres, var->yres, var->bits_per_pixel); search_idx = 0; while (XGIbios_mode[search_idx].mode_no != 0) { if ((var->xres <= XGIbios_mode[search_idx].xres) && @@ -1296,11 +1284,11 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) var->xres = XGIbios_mode[search_idx].xres; var->yres = XGIbios_mode[search_idx].yres; pr_debug("Adapted to mode %dx%dx%d\n", - var->xres, var->yres, var->bits_per_pixel); + var->xres, var->yres, var->bits_per_pixel); } else { pr_err("Failed to find similar mode to %dx%dx%d\n", - var->xres, var->yres, var->bits_per_pixel); + var->xres, var->yres, var->bits_per_pixel); return -EINVAL; } } @@ -1332,7 +1320,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) } static int XGIfb_pan_display(struct fb_var_screeninfo *var, - struct fb_info *info) + struct fb_info *info) { int err; @@ -1344,9 +1332,8 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var, if (var->vmode & FB_VMODE_YWRAP) { if (var->yoffset >= info->var.yres_virtual || var->xoffset) return -EINVAL; - } else if (var->xoffset + info->var.xres > info->var.xres_virtual - || var->yoffset + info->var.yres - > info->var.yres_virtual) { + } else if (var->xoffset + info->var.xres > info->var.xres_virtual || + var->yoffset + info->var.yres > info->var.yres_virtual) { return -EINVAL; } err = XGIfb_pan_var(var, info); @@ -1401,7 +1388,6 @@ static struct fb_ops XGIfb_ops = { static int XGIfb_get_dram_size(struct xgifb_video_info *xgifb_info) { - u8 ChannelNum, tmp; u8 reg = 0; @@ -1474,10 +1460,8 @@ static int XGIfb_get_dram_size(struct xgifb_video_info *xgifb_info) xgifb_info->video_size = xgifb_info->video_size * ChannelNum; pr_info("SR14=%x DramSzie %x ChannelNum %x\n", - reg, - xgifb_info->video_size, ChannelNum); + reg, xgifb_info->video_size, ChannelNum); return 0; - } static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info) @@ -1597,7 +1581,6 @@ static int __init XGIfb_setup(char *options) pr_info("Options: %s\n", options); while ((this_opt = strsep(&options, ",")) != NULL) { - if (!*this_opt) continue; @@ -1634,8 +1617,7 @@ static int __init XGIfb_setup(char *options) return 0; } -static int xgifb_probe(struct pci_dev *pdev, - const struct pci_device_id *ent) +static int xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { u8 reg, reg1; u8 CR48, CR38; @@ -1670,7 +1652,7 @@ static int xgifb_probe(struct pci_dev *pdev, xgifb_info->mmio_size = pci_resource_len(pdev, 1); xgifb_info->vga_base = pci_resource_start(pdev, 2) + 0x30; dev_info(&pdev->dev, "Relocate IO address: %Lx [%08lx]\n", - (u64) pci_resource_start(pdev, 2), + (u64)pci_resource_start(pdev, 2), xgifb_info->vga_base); if (pci_enable_device(pdev)) { @@ -1688,7 +1670,7 @@ static int xgifb_probe(struct pci_dev *pdev, xgifb_reg_set(XGISR, IND_SIS_PASSWORD, SIS_PASSWORD); reg1 = xgifb_reg_get(XGISR, IND_SIS_PASSWORD); - if (reg1 != 0xa1) { /*I/O error */ + if (reg1 != 0xa1) { /* I/O error */ dev_err(&pdev->dev, "I/O error\n"); ret = -EIO; goto error_disable; @@ -1698,7 +1680,7 @@ static int xgifb_probe(struct pci_dev *pdev, case PCI_DEVICE_ID_XGI_20: xgifb_reg_or(XGICR, Index_CR_GPIO_Reg3, GPIOG_EN); CR48 = xgifb_reg_get(XGICR, Index_CR_GPIO_Reg1); - if (CR48&GPIOG_READ) + if (CR48 & GPIOG_READ) xgifb_info->chip = XG21; else xgifb_info->chip = XG20; @@ -1727,7 +1709,7 @@ static int xgifb_probe(struct pci_dev *pdev, xgifb_info->video_size = video_size_max; } - /* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */ + /* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */ xgifb_reg_or(XGISR, IND_SIS_PCI_ADDRESS_SET, (SIS_PCI_ADDR_ENABLE | SIS_MEM_MAP_IO_ENABLE)); @@ -1740,7 +1722,7 @@ static int xgifb_probe(struct pci_dev *pdev, xgifb_info->video_size, "XGIfb FB")) { dev_err(&pdev->dev, "Unable request memory size %x\n", - xgifb_info->video_size); + xgifb_info->video_size); dev_err(&pdev->dev, "Fatal error: Unable to reserve frame buffer memory. Is there another framebuffer driver active?\n"); ret = -ENODEV; @@ -1763,13 +1745,13 @@ static int xgifb_probe(struct pci_dev *pdev, dev_info(&pdev->dev, "Framebuffer at 0x%Lx, mapped to 0x%p, size %dk\n", - (u64) xgifb_info->video_base, + (u64)xgifb_info->video_base, xgifb_info->video_vbase, xgifb_info->video_size / 1024); dev_info(&pdev->dev, "MMIO at 0x%Lx, mapped to 0x%p, size %ldk\n", - (u64) xgifb_info->mmio_base, xgifb_info->mmio_vbase, + (u64)xgifb_info->mmio_base, xgifb_info->mmio_vbase, xgifb_info->mmio_size / 1024); pci_set_drvdata(pdev, xgifb_info); @@ -1784,9 +1766,9 @@ static int xgifb_probe(struct pci_dev *pdev, xgifb_info->hasVB = HASVB_NONE; } else if (xgifb_info->chip == XG21) { CR38 = xgifb_reg_get(XGICR, 0x38); - if ((CR38&0xE0) == 0xC0) + if ((CR38 & 0xE0) == 0xC0) xgifb_info->display2 = XGIFB_DISP_LCD; - else if ((CR38&0xE0) == 0x60) + else if ((CR38 & 0xE0) == 0x60) xgifb_info->hasVB = HASVB_CHRONTEL; else xgifb_info->hasVB = HASVB_NONE; @@ -1903,8 +1885,7 @@ static int xgifb_probe(struct pci_dev *pdev, xgifb_info->refresh_rate = refresh_rate; if (xgifb_info->refresh_rate == 0) xgifb_info->refresh_rate = 60; - if (XGIfb_search_refresh_rate(xgifb_info, - xgifb_info->refresh_rate) == 0) { + if (XGIfb_search_refresh_rate(xgifb_info, xgifb_info->refresh_rate) == 0) { xgifb_info->rate_idx = 1; xgifb_info->refresh_rate = 60; } @@ -1939,15 +1920,13 @@ static int xgifb_probe(struct pci_dev *pdev, default: xgifb_info->video_cmap_len = 16; pr_info("Unsupported depth %d\n", - xgifb_info->video_bpp); + xgifb_info->video_bpp); break; } pr_info("Default mode is %dx%dx%d (%dHz)\n", - xgifb_info->video_width, - xgifb_info->video_height, - xgifb_info->video_bpp, - xgifb_info->refresh_rate); + xgifb_info->video_width, xgifb_info->video_height, + xgifb_info->video_bpp, xgifb_info->refresh_rate); fb_info->var.red.length = 8; fb_info->var.green.length = 8; @@ -1964,22 +1943,20 @@ static int xgifb_probe(struct pci_dev *pdev, XGIfb_bpp_to_var(xgifb_info, &fb_info->var); - fb_info->var.pixclock = (u32) (1000000000 / - XGIfb_mode_rate_to_dclock(&xgifb_info->dev_info, - hw_info, - XGIbios_mode[xgifb_info->mode_idx].mode_no)); - - if (XGIfb_mode_rate_to_ddata(&xgifb_info->dev_info, hw_info, - XGIbios_mode[xgifb_info->mode_idx].mode_no, - &fb_info->var.left_margin, - &fb_info->var.right_margin, - &fb_info->var.upper_margin, - &fb_info->var.lower_margin, - &fb_info->var.hsync_len, - &fb_info->var.vsync_len, - &fb_info->var.sync, - &fb_info->var.vmode)) { - + fb_info->var.pixclock = (u32)(1000000000 / XGIfb_mode_rate_to_dclock + (&xgifb_info->dev_info, hw_info, + XGIbios_mode[xgifb_info->mode_idx].mode_no)); + + if (XGIfb_mode_rate_to_ddata(&xgifb_info->dev_info, + hw_info, XGIbios_mode[xgifb_info->mode_idx].mode_no, + &fb_info->var.left_margin, + &fb_info->var.right_margin, + &fb_info->var.upper_margin, + &fb_info->var.lower_margin, + &fb_info->var.hsync_len, + &fb_info->var.vsync_len, + &fb_info->var.sync, + &fb_info->var.vmode)) { if ((fb_info->var.vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) { fb_info->var.yres <<= 1; @@ -1990,7 +1967,6 @@ static int xgifb_probe(struct pci_dev *pdev, fb_info->var.yres >>= 1; fb_info->var.yres_virtual >>= 1; } - } fb_info->flags = FBINFO_FLAG_DEFAULT; @@ -2028,9 +2004,7 @@ error: return ret; } -/*****************************************************/ -/* PCI DEVICE HANDLING */ -/*****************************************************/ +/* -------------------- PCI DEVICE HANDLING -------------------- */ static void xgifb_remove(struct pci_dev *pdev) { @@ -2054,25 +2028,23 @@ static struct pci_driver xgifb_driver = { .remove = xgifb_remove }; -/*****************************************************/ -/* MODULE */ -/*****************************************************/ +/* -------------------- MODULE -------------------- */ -module_param(mode, charp, 0); +module_param(mode, charp, 0000); MODULE_PARM_DESC(mode, - "Selects the desired default display mode in the format XxYxDepth (eg. 1024x768x16)."); + "Selects the desired default display mode in the format XxYxDepth (eg. 1024x768x16)."); -module_param(forcecrt2type, charp, 0); +module_param(forcecrt2type, charp, 0000); MODULE_PARM_DESC(forcecrt2type, - "Force the second display output type. Possible values are NONE, LCD, TV, VGA, SVIDEO or COMPOSITE."); + "Force the second display output type. Possible values are NONE, LCD, TV, VGA, SVIDEO or COMPOSITE."); -module_param(vesa, int, 0); +module_param(vesa, int, 0000); MODULE_PARM_DESC(vesa, - "Selects the desired default display mode by VESA mode number (eg. 0x117)."); + "Selects the desired default display mode by VESA mode number (eg. 0x117)."); -module_param(filter, int, 0); +module_param(filter, int, 0000); MODULE_PARM_DESC(filter, - "Selects TV flicker filter type (only for systems with a SiS301 video bridge). Possible values 0-7. Default: [no filter])."); + "Selects TV flicker filter type (only for systems with a SiS301 video bridge). Possible values 0-7. Default: [no filter])."); static int __init xgifb_init(void) { diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 062ece22ed84..14af157958cd 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -55,8 +55,9 @@ XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_or(pVBInfo->P3d4, 0x4A, 0x80); /* Enable GPIOH read */ /* GPIOF 0:DVI 1:DVO */ data = xgifb_reg_get(pVBInfo->P3d4, 0x48); - /* HOTPLUG_SUPPORT */ - /* for current XG20 & XG21, GPIOH is floating, driver will + /* + * HOTPLUG_SUPPORT + * for current XG20 & XG21, GPIOH is floating, driver will * fix DDR temporarily */ /* DVI read GPIOH */ @@ -199,7 +200,8 @@ static void XGINew_DDRII_Bootup_XG27( } static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension, - unsigned long P3c4, struct vb_device_info *pVBInfo) + unsigned long P3c4, + struct vb_device_info *pVBInfo) { unsigned long P3d4 = P3c4 + 0x10; @@ -353,8 +355,8 @@ static void XGINew_DDR2_DefaultRegister( unsigned long Port, struct vb_device_info *pVBInfo) { unsigned long P3d4 = Port, P3c4 = Port - 0x10; - - /* keep following setting sequence, each setting in + /* + * keep following setting sequence, each setting in * the same reg insert idle */ xgifb_reg_set(P3d4, 0x82, 0x77); @@ -387,7 +389,7 @@ static void XGINew_DDR2_DefaultRegister( } static void XGI_SetDRAM_Helper(unsigned long P3d4, u8 seed, u8 temp2, u8 reg, - u8 shift_factor, u8 mask1, u8 mask2) + u8 shift_factor, u8 mask1, u8 mask2) { u8 j; @@ -460,15 +462,15 @@ static void XGINew_SetDRAMDefaultRegister340( for (j = 0; j <= 6; j++) /* CR90 - CR96 */ xgifb_reg_set(P3d4, (0x90 + j), - pVBInfo->CR40[14 + j][pVBInfo->ram_type]); + pVBInfo->CR40[14 + j][pVBInfo->ram_type]); for (j = 0; j <= 2; j++) /* CRC3 - CRC5 */ xgifb_reg_set(P3d4, (0xC3 + j), - pVBInfo->CR40[21 + j][pVBInfo->ram_type]); + pVBInfo->CR40[21 + j][pVBInfo->ram_type]); for (j = 0; j < 2; j++) /* CR8A - CR8B */ xgifb_reg_set(P3d4, (0x8A + j), - pVBInfo->CR40[1 + j][pVBInfo->ram_type]); + pVBInfo->CR40[1 + j][pVBInfo->ram_type]); if (HwDeviceExtension->jChipType == XG42) xgifb_reg_set(P3d4, 0x8C, 0x87); @@ -539,7 +541,8 @@ static unsigned short XGINew_SetDRAMSize20Reg( } static int XGINew_ReadWriteRest(unsigned short StopAddr, - unsigned short StartAddr, struct vb_device_info *pVBInfo) + unsigned short StartAddr, + struct vb_device_info *pVBInfo) { int i; unsigned long Position = 0; @@ -583,7 +586,7 @@ static unsigned char XGINew_CheckFrequence(struct vb_device_info *pVBInfo) } static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) + struct vb_device_info *pVBInfo) { unsigned char data; @@ -647,7 +650,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, pVBInfo->ram_bus = 16; /* 16 bits */ /* (0x31:12x8x2) 22bit + 2 rank */ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1); - /* 0x41:16Mx16 bit*/ + /* 0x41:16Mx16 bit */ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x41); usleep_range(15, 1015); @@ -660,7 +663,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x31); - /* 0x31:8Mx16 bit*/ + /* 0x31:8Mx16 bit */ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x31); @@ -678,7 +681,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, pVBInfo->ram_bus = 8; /* 8 bits */ /* (0x31:12x8x2) 22bit + 2 rank */ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1); - /* 0x30:8Mx8 bit*/ + /* 0x30:8Mx8 bit */ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x30); usleep_range(15, 1015); @@ -697,7 +700,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, case XG27: pVBInfo->ram_bus = 16; /* 16 bits */ pVBInfo->ram_channel = 1; /* Single channel */ - xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x51); /* 32Mx16 bit*/ + xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x51); /* 32Mx16 bit */ break; case XG42: /* @@ -785,7 +788,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, } static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) + struct vb_device_info *pVBInfo) { u8 i, size; unsigned short memsize, start_addr; @@ -827,8 +830,8 @@ static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension, } static void XGINew_SetDRAMSize_340(struct xgifb_video_info *xgifb_info, - struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) + struct xgi_hw_device_info *HwDeviceExtension, + struct vb_device_info *pVBInfo) { unsigned short data; @@ -905,9 +908,9 @@ static bool xgifb_read_vbios(struct pci_dev *pdev) goto error; if (j == 0xff) j = 1; - /* - * Read the LVDS table index scratch register set by the BIOS. - */ + + /* Read the LVDS table index scratch register set by the BIOS. */ + entry = xgifb_reg_get(xgifb_info->dev_info.P3d4, 0x36); if (entry >= j) entry = 0; @@ -1039,8 +1042,9 @@ static void XGINew_SetModeScratch(struct vb_device_info *pVBInfo) } tempcl |= SetSimuScanMode; - if ((!(temp & ActiveCRT1)) && ((temp & ActiveLCD) || (temp & ActiveTV) - || (temp & ActiveCRT2))) + if ((!(temp & ActiveCRT1)) && ((temp & ActiveLCD) || + (temp & ActiveTV) || + (temp & ActiveCRT2))) tempcl ^= (SetSimuScanMode | SwitchCRT2); if ((temp & ActiveLCD) && (temp & ActiveTV)) tempcl ^= (SetSimuScanMode | SwitchCRT2); @@ -1085,7 +1089,7 @@ static unsigned short XGINew_SenseLCD(struct xgi_hw_device_info } static void XGINew_GetXG21Sense(struct pci_dev *pdev, - struct vb_device_info *pVBInfo) + struct vb_device_info *pVBInfo) { struct xgifb_video_info *xgifb_info = pci_get_drvdata(pdev); unsigned char Temp; @@ -1095,7 +1099,7 @@ static void XGINew_GetXG21Sense(struct pci_dev *pdev, /* LVDS on chip */ xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xC0); } else { - /* Enable GPIOA/B read */ + /* Enable GPIOA/B read */ xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x03, 0x03); Temp = xgifb_reg_get(pVBInfo->P3d4, 0x48) & 0xC0; if (Temp == 0xC0) { /* DVI & DVO GPIOA/B pull high */ @@ -1119,7 +1123,7 @@ static void XGINew_GetXG27Sense(struct vb_device_info *pVBInfo) unsigned char Temp, bCR4A; bCR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A); - /* Enable GPIOA/B/C read */ + /* Enable GPIOA/B/C read */ xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x07, 0x07); Temp = xgifb_reg_get(pVBInfo->P3d4, 0x48) & 0x07; xgifb_reg_set(pVBInfo->P3d4, 0x4A, bCR4A); diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index d8010c5c1a70..7c7c8c8f1df3 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -55,7 +55,7 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) pVBInfo->XGINew_CR97 = 0xc1; pVBInfo->SR18 = XG27_SR18; - /*Z11m DDR*/ + /* Z11m DDR */ temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */ if (((temp & 0x88) == 0x80) || ((temp & 0x88) == 0x08)) @@ -73,7 +73,7 @@ static void XGI_SetSeqRegs(struct vb_device_info *pVBInfo) /* Get SR1,2,3,4 from file */ /* SR1 is with screen off 0x20 */ SRdata = XGI330_StandTable.SR[i]; - xgifb_reg_set(pVBInfo->P3c4, i+1, SRdata); /* Set SR 1 2 3 4 */ + xgifb_reg_set(pVBInfo->P3c4, i + 1, SRdata); /* Set SR 1 2 3 4 */ } } @@ -167,7 +167,8 @@ static unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo) } static unsigned char XGI_AjustCRT2Rate(unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, unsigned short *i, + unsigned short RefreshRateTableIndex, + unsigned short *i, struct vb_device_info *pVBInfo) { unsigned short tempax, tempbx, resinfo, modeflag, infoflag; @@ -244,7 +245,7 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeIdIndex, } static void XGI_SetSync(unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + struct vb_device_info *pVBInfo) { unsigned short sync, temp; @@ -257,7 +258,7 @@ static void XGI_SetSync(unsigned short RefreshRateTableIndex, } static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo, - struct xgi_hw_device_info *HwDeviceExtension) + struct xgi_hw_device_info *HwDeviceExtension) { unsigned char data, data1, pushax; unsigned short i, j; @@ -359,9 +360,9 @@ static void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, } static void XGI_SetCRT1CRTC(unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo, - struct xgi_hw_device_info *HwDeviceExtension) + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo, + struct xgi_hw_device_info *HwDeviceExtension) { unsigned char index, data; unsigned short i; @@ -390,14 +391,14 @@ static void XGI_SetCRT1CRTC(unsigned short ModeIdIndex, xgifb_reg_set(pVBInfo->P3d4, 0x14, 0x4F); } -/* --------------------------------------------------------------------- */ -/* Function : XGI_SetXG21CRTC */ -/* Input : Stand or enhance CRTC table */ -/* Output : Fill CRT Hsync/Vsync to SR2E/SR2F/SR30/SR33/SR34/SR3F */ -/* Description : Set LCD timing */ -/* --------------------------------------------------------------------- */ +/* + * Function : XGI_SetXG21CRTC + * Input : Stand or enhance CRTC table + * Output : Fill CRT Hsync/Vsync to SR2E/SR2F/SR30/SR33/SR34/SR3F + * Description : Set LCD timing + */ static void XGI_SetXG21CRTC(unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + struct vb_device_info *pVBInfo) { unsigned char index, Tempax, Tempbx, Tempcx, Tempdx; unsigned short Temp1, Temp2, Temp3; @@ -506,8 +507,8 @@ static void XGI_SetXG27CRTC(unsigned short RefreshRateTableIndex, /* SR0B */ Tempax = XGI_CRT1Table[index].CR[5]; - Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ - Tempbx |= (Tempax << 2); /* Tempbx: HRS[9:0] */ + Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8] */ + Tempbx |= Tempax << 2; /* Tempbx: HRS[9:0] */ Tempax = XGI_CRT1Table[index].CR[4]; /* CR5 HRE */ Tempax &= 0x1F; /* Tempax[4:0]: HRE[4:0] */ @@ -530,7 +531,7 @@ static void XGI_SetXG27CRTC(unsigned short RefreshRateTableIndex, Tempax = XGI_CRT1Table[index].CR[5]; /* SR0B */ Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ Tempax >>= 6; /* Tempax[1:0]: HRS[9:8]*/ - Tempax |= ((Tempbx << 2) & 0xFF); /* Tempax[7:2]: HRE[5:0] */ + Tempax |= (Tempbx << 2) & 0xFF; /* Tempax[7:2]: HRE[5:0] */ /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */ xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempax); xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00); @@ -548,12 +549,12 @@ static void XGI_SetXG27CRTC(unsigned short RefreshRateTableIndex, Tempax >>= 2; /* Tempax[0]: VRS[8] */ /* SR35[0]: VRS[8] */ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x01, Tempax); - Tempcx |= (Tempax << 8); /* Tempcx <= VRS[8:0] */ - Tempcx |= ((Tempbx & 0x80) << 2); /* Tempcx <= VRS[9:0] */ + Tempcx |= Tempax << 8; /* Tempcx <= VRS[8:0] */ + Tempcx |= (Tempbx & 0x80) << 2; /* Tempcx <= VRS[9:0] */ /* Tempax: SR0A */ Tempax = XGI_CRT1Table[index].CR[14]; Tempax &= 0x08; /* SR0A[3] VRS[10] */ - Tempcx |= (Tempax << 7); /* Tempcx <= VRS[10:0] */ + Tempcx |= Tempax << 7; /* Tempcx <= VRS[10:0] */ /* Tempax: CR11 VRE */ Tempax = XGI_CRT1Table[index].CR[11]; @@ -636,12 +637,12 @@ static void xgifb_set_lcd(int chip_id, xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80); } -/* --------------------------------------------------------------------- */ -/* Function : XGI_UpdateXG21CRTC */ -/* Input : */ -/* Output : CRT1 CRTC */ -/* Description : Modify CRT1 Hsync/Vsync to fix LCD mode timing */ -/* --------------------------------------------------------------------- */ +/* + * Function : XGI_UpdateXG21CRTC + * Input : + * Output : CRT1 CRTC + * Description : Modify CRT1 Hsync/Vsync to fix LCD mode timing + */ static void XGI_UpdateXG21CRTC(unsigned short ModeNo, struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex) @@ -665,19 +666,19 @@ static void XGI_UpdateXG21CRTC(unsigned short ModeNo, if (index != -1) { xgifb_reg_set(pVBInfo->P3d4, 0x02, - XGI_UpdateCRT1Table[index].CR02); + XGI_UpdateCRT1Table[index].CR02); xgifb_reg_set(pVBInfo->P3d4, 0x03, - XGI_UpdateCRT1Table[index].CR03); + XGI_UpdateCRT1Table[index].CR03); xgifb_reg_set(pVBInfo->P3d4, 0x15, - XGI_UpdateCRT1Table[index].CR15); + XGI_UpdateCRT1Table[index].CR15); xgifb_reg_set(pVBInfo->P3d4, 0x16, - XGI_UpdateCRT1Table[index].CR16); + XGI_UpdateCRT1Table[index].CR16); } } static void XGI_SetCRT1DE(unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo) { unsigned short resindex, tempax, tempbx, tempcx, temp, modeflag; @@ -715,7 +716,7 @@ static void XGI_SetCRT1DE(unsigned short ModeIdIndex, xgifb_reg_set(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */ xgifb_reg_set(pVBInfo->P3d4, 0x01, (unsigned short)(tempcx & 0xff)); xgifb_reg_and_or(pVBInfo->P3d4, 0x0b, ~0x0c, - (unsigned short)((tempcx & 0x0ff00) >> 10)); + (unsigned short)((tempcx & 0x0ff00) >> 10)); xgifb_reg_set(pVBInfo->P3d4, 0x12, (unsigned short)(tempbx & 0xff)); tempax = 0; tempbx >>= 8; @@ -796,7 +797,7 @@ static void XGI_SetCRT1Offset(unsigned short ModeNo, i |= temp; xgifb_reg_set(pVBInfo->P3c4, 0x0E, i); - temp = (unsigned char) temp2; + temp = (unsigned char)temp2; temp &= 0xFF; /* al */ xgifb_reg_set(pVBInfo->P3d4, 0x13, temp); @@ -822,15 +823,15 @@ static void XGI_SetCRT1Offset(unsigned short ModeNo, } static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo) { unsigned short VCLKIndex, modeflag; /* si+Ext_ResInfo */ modeflag = XGI330_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { /*301b*/ + if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { /* 301b */ if (pVBInfo->LCDResInfo != Panel_1024x768) /* LCDXlat2VCLK */ VCLKIndex = VCLK108_2_315 + 5; @@ -951,8 +952,8 @@ static void XGI_SetCRT1FIFO(struct xgi_hw_device_info *HwDeviceExtension, } static void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo) { unsigned short data, data2 = 0; short VCLK; @@ -989,9 +990,9 @@ static void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension, } static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, - unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + unsigned short ModeIdIndex, + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo) { unsigned short data, data2, data3, infoflag = 0, modeflag, resindex, xres; @@ -1087,9 +1088,9 @@ static void XGI_WriteDAC(unsigned short dl, else swap(bl, bh); } - outb((unsigned short) dh, pVBInfo->P3c9); - outb((unsigned short) bh, pVBInfo->P3c9); - outb((unsigned short) bl, pVBInfo->P3c9); + outb((unsigned short)dh, pVBInfo->P3c9); + outb((unsigned short)bh, pVBInfo->P3c9); + outb((unsigned short)bl, pVBInfo->P3c9); } static void XGI_LoadDAC(struct vb_device_info *pVBInfo) @@ -1187,8 +1188,8 @@ static void XGI_GetLVDSResInfo(unsigned short ModeIdIndex, } static void const *XGI_GetLcdPtr(struct XGI330_LCDDataTablStruct const *table, - unsigned short ModeIdIndex, - struct vb_device_info *pVBInfo) + unsigned short ModeIdIndex, + struct vb_device_info *pVBInfo) { unsigned short i, tempdx, tempbx, modeflag; @@ -1201,12 +1202,12 @@ static void const *XGI_GetLcdPtr(struct XGI330_LCDDataTablStruct const *table, while (table[i].PANELID != 0xff) { tempdx = pVBInfo->LCDResInfo; if (tempbx & 0x0080) { /* OEMUtil */ - tempbx &= (~0x0080); + tempbx &= ~0x0080; tempdx = pVBInfo->LCDTypeInfo; } if (pVBInfo->LCDInfo & EnableScalingLCD) - tempdx &= (~PanelResInfo); + tempdx &= ~PanelResInfo; if (table[i].PANELID == tempdx) { tempbx = table[i].MASK; @@ -1226,8 +1227,8 @@ static void const *XGI_GetLcdPtr(struct XGI330_LCDDataTablStruct const *table, } static struct SiS_TVData const *XGI_GetTVPtr(unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo) { unsigned short i, tempdx, tempal, modeflag; @@ -1441,9 +1442,9 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, tempbx >>= 3; xgifb_reg_set(pVBInfo->Part1Port, 0x16, - (unsigned short) (tempbx & 0xff)); + (unsigned short)(tempbx & 0xff)); xgifb_reg_set(pVBInfo->Part1Port, 0x17, - (unsigned short) (tempcx & 0xff)); + (unsigned short)(tempcx & 0xff)); tempax = pVBInfo->HT; @@ -1469,7 +1470,7 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, xgifb_reg_set(pVBInfo->Part1Port, 0x15, tempax); xgifb_reg_set(pVBInfo->Part1Port, 0x14, - (unsigned short) (tempbx & 0xff)); + (unsigned short)(tempbx & 0xff)); tempax = pVBInfo->VT; tempbx = LCDPtr1->LCDVDES; @@ -1480,17 +1481,14 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, if (tempcx >= tempax) tempcx -= tempax; - xgifb_reg_set(pVBInfo->Part1Port, 0x1b, - (unsigned short) (tempbx & 0xff)); - xgifb_reg_set(pVBInfo->Part1Port, 0x1c, - (unsigned short) (tempcx & 0xff)); + xgifb_reg_set(pVBInfo->Part1Port, 0x1b, (unsigned short)(tempbx & 0xff)); + xgifb_reg_set(pVBInfo->Part1Port, 0x1c, (unsigned short)(tempcx & 0xff)); tempbx = (tempbx >> 8) & 0x07; tempcx = (tempcx >> 8) & 0x07; - xgifb_reg_set(pVBInfo->Part1Port, 0x1d, - (unsigned short) ((tempcx << 3) - | tempbx)); + xgifb_reg_set(pVBInfo->Part1Port, 0x1d, (unsigned short)((tempcx << 3) | + tempbx)); tempax = pVBInfo->VT; tempbx = LCDPtr1->LCDVRS; @@ -1504,10 +1502,8 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, if (tempcx >= tempax) tempcx -= tempax; - xgifb_reg_set(pVBInfo->Part1Port, 0x18, - (unsigned short) (tempbx & 0xff)); - xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, ~0x0f, - (unsigned short) (tempcx & 0x0f)); + xgifb_reg_set(pVBInfo->Part1Port, 0x18, (unsigned short)(tempbx & 0xff)); + xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, ~0x0f, (unsigned short)(tempcx & 0x0f)); tempax = ((tempbx >> 8) & 0x07) << 3; @@ -1518,8 +1514,7 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, if (pVBInfo->LCDInfo & XGI_EnableLVDSDDA) tempax |= 0x40; - xgifb_reg_and_or(pVBInfo->Part1Port, 0x1a, 0x07, - tempax); + xgifb_reg_and_or(pVBInfo->Part1Port, 0x1a, 0x07, tempax); tempbx = pVBInfo->VDE; tempax = pVBInfo->VGAVDE; @@ -1527,7 +1522,7 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, temp = tempax; /* 0430 ylshieh */ temp1 = (temp << 18) / tempbx; - tempdx = (unsigned short) ((temp << 18) % tempbx); + tempdx = (unsigned short)((temp << 18) % tempbx); if (tempdx != 0) temp1 += 1; @@ -1535,12 +1530,10 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, temp2 = temp1; push3 = temp2; - xgifb_reg_set(pVBInfo->Part1Port, 0x37, - (unsigned short) (temp2 & 0xff)); - xgifb_reg_set(pVBInfo->Part1Port, 0x36, - (unsigned short) ((temp2 >> 8) & 0xff)); + xgifb_reg_set(pVBInfo->Part1Port, 0x37, (unsigned short)(temp2 & 0xff)); + xgifb_reg_set(pVBInfo->Part1Port, 0x36, (unsigned short)((temp2 >> 8) & 0xff)); - tempbx = (unsigned short) (temp2 >> 16); + tempbx = (unsigned short)(temp2 >> 16); tempax = tempbx & 0x03; tempbx = pVBInfo->VGAVDE; @@ -1553,24 +1546,20 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, temp2 = push3; xgifb_reg_set(pVBInfo->Part4Port, 0x3c, - (unsigned short) (temp2 & 0xff)); + (unsigned short)(temp2 & 0xff)); xgifb_reg_set(pVBInfo->Part4Port, 0x3b, - (unsigned short) ((temp2 >> 8) & + (unsigned short)((temp2 >> 8) & 0xff)); - tempbx = (unsigned short) (temp2 >> 16); - xgifb_reg_and_or(pVBInfo->Part4Port, 0x3a, - ~0xc0, - (unsigned short) ((tempbx & - 0xff) << 6)); + tempbx = (unsigned short)(temp2 >> 16); + xgifb_reg_and_or(pVBInfo->Part4Port, 0x3a, ~0xc0, + (unsigned short)((tempbx & 0xff) << 6)); tempcx = pVBInfo->VGAVDE; if (tempcx == pVBInfo->VDE) - xgifb_reg_and_or(pVBInfo->Part4Port, - 0x30, ~0x0c, 0x00); + xgifb_reg_and_or(pVBInfo->Part4Port, 0x30, ~0x0c, 0x00); else - xgifb_reg_and_or(pVBInfo->Part4Port, - 0x30, ~0x0c, 0x08); + xgifb_reg_and_or(pVBInfo->Part4Port, 0x30, ~0x0c, 0x08); } tempcx = pVBInfo->VGAHDE; @@ -1578,7 +1567,7 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, temp1 = tempcx << 16; - tempax = (unsigned short) (temp1 / tempbx); + tempax = (unsigned short)(temp1 / tempbx); if ((tempbx & 0xffff) == (tempcx & 0xffff)) tempax = 65535; @@ -1592,42 +1581,38 @@ static void XGI_SetLVDSRegs(unsigned short ModeIdIndex, temp3 = (temp3 & 0xffff0000) + (temp1 & 0xffff); - tempax = (unsigned short) (temp3 & 0xff); + tempax = (unsigned short)(temp3 & 0xff); xgifb_reg_set(pVBInfo->Part1Port, 0x1f, tempax); temp1 = pVBInfo->VGAVDE << 18; temp1 = temp1 / push3; - tempbx = (unsigned short) (temp1 & 0xffff); + tempbx = (unsigned short)(temp1 & 0xffff); if (pVBInfo->LCDResInfo == Panel_1024x768) tempbx -= 1; tempax = ((tempbx >> 8) & 0xff) << 3; - tempax |= (unsigned short) ((temp3 >> 8) & 0x07); - xgifb_reg_set(pVBInfo->Part1Port, 0x20, - (unsigned short) (tempax & 0xff)); - xgifb_reg_set(pVBInfo->Part1Port, 0x21, - (unsigned short) (tempbx & 0xff)); + tempax |= (unsigned short)((temp3 >> 8) & 0x07); + xgifb_reg_set(pVBInfo->Part1Port, 0x20, (unsigned short)(tempax & 0xff)); + xgifb_reg_set(pVBInfo->Part1Port, 0x21, (unsigned short)(tempbx & 0xff)); temp3 >>= 16; if (modeflag & HalfDCLK) temp3 >>= 1; - xgifb_reg_set(pVBInfo->Part1Port, 0x22, - (unsigned short) ((temp3 >> 8) & 0xff)); - xgifb_reg_set(pVBInfo->Part1Port, 0x23, - (unsigned short) (temp3 & 0xff)); + xgifb_reg_set(pVBInfo->Part1Port, 0x22, (unsigned short)((temp3 >> 8) & 0xff)); + xgifb_reg_set(pVBInfo->Part1Port, 0x23, (unsigned short)(temp3 & 0xff)); } -/* --------------------------------------------------------------------- */ -/* Function : XGI_GETLCDVCLKPtr */ -/* Input : */ -/* Output : al -> VCLK Index */ -/* Description : */ -/* --------------------------------------------------------------------- */ +/* + * Function : XGI_GETLCDVCLKPtr + * Input : + * Output : al -> VCLK Index + * Description : + */ static void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1, - struct vb_device_info *pVBInfo) + struct vb_device_info *pVBInfo) { unsigned short index; @@ -1645,7 +1630,8 @@ static void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1, } static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, - unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) + unsigned short ModeIdIndex, + struct vb_device_info *pVBInfo) { unsigned short index, modeflag; unsigned char tempal; @@ -1681,15 +1667,11 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, return tempal; } - if (pVBInfo->TVInfo & TVSetYPbPr750p) { - tempal = XGI_YPbPr750pVCLK; - return tempal; - } + if (pVBInfo->TVInfo & TVSetYPbPr750p) + return XGI_YPbPr750pVCLK; - if (pVBInfo->TVInfo & TVSetYPbPr525p) { - tempal = YPbPr525pVCLK; - return tempal; - } + if (pVBInfo->TVInfo & TVSetYPbPr525p) + return YPbPr525pVCLK; tempal = NTSC1024VCLK; @@ -1705,12 +1687,11 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, } /* {End of VB} */ inb((pVBInfo->P3ca + 0x02)); - tempal = XGI330_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; - return tempal; + return XGI330_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; } static void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0, - unsigned char *di_1, struct vb_device_info *pVBInfo) + unsigned char *di_1, struct vb_device_info *pVBInfo) { if (pVBInfo->VBType & (VB_SIS301 | VB_SIS301B | VB_SIS302B | VB_SIS301LV | VB_SIS302LV | VB_XGI301C)) { @@ -1726,8 +1707,8 @@ static void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0, } static void XGI_SetCRT2ECLK(unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo) { unsigned char di_0, di_1, tempal; int i; @@ -1738,7 +1719,7 @@ static void XGI_SetCRT2ECLK(unsigned short ModeIdIndex, for (i = 0; i < 4; i++) { xgifb_reg_and_or(pVBInfo->P3d4, 0x31, ~0x30, - (unsigned short) (0x10 * i)); + (unsigned short)(0x10 * i)); if (!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) && !(pVBInfo->VBInfo & SetInSlaveMode)) { xgifb_reg_set(pVBInfo->P3c4, 0x2e, di_0); @@ -1876,8 +1857,7 @@ finish: pVBInfo->VBType = tempbx; } -static void XGI_GetVBInfo(unsigned short ModeIdIndex, - struct vb_device_info *pVBInfo) +static void XGI_GetVBInfo(unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) { unsigned short tempax, push, tempbx, temp, modeflag; @@ -1921,7 +1901,7 @@ static void XGI_GetVBInfo(unsigned short ModeIdIndex, tempbx |= SetCRT2ToHiVision; if (temp != YPbPrMode1080i) { - tempbx &= (~SetCRT2ToHiVision); + tempbx &= ~SetCRT2ToHiVision; tempbx |= SetCRT2ToYPbPr525750; } } @@ -2002,8 +1982,7 @@ static void XGI_GetVBInfo(unsigned short ModeIdIndex, pVBInfo->VBInfo = tempbx; } -static void XGI_GetTVInfo(unsigned short ModeIdIndex, - struct vb_device_info *pVBInfo) +static void XGI_GetTVInfo(unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) { unsigned short tempbx = 0, resinfo = 0, modeflag, index1; @@ -2078,7 +2057,7 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeIdIndex, pVBInfo->LCDTypeInfo = 0; pVBInfo->LCDInfo = 0; - /* si+Ext_ResInfo // */ + /* si+Ext_ResInfo */ resinfo = XGI330_EModeIDTable[ModeIdIndex].Ext_RESINFO; temp = xgifb_reg_get(pVBInfo->P3d4, 0x36); /* Get LCD Res.Info */ tempbx = temp & 0x0F; @@ -2175,12 +2154,12 @@ static unsigned char XG21GPIODataTransfer(unsigned char ujDate) return ujRet; } -/*----------------------------------------------------------------------------*/ -/* output */ -/* bl[5] : LVDS signal */ -/* bl[1] : LVDS backlight */ -/* bl[0] : LVDS VDD */ -/*----------------------------------------------------------------------------*/ +/* + * output + * bl[5] : LVDS signal + * bl[1] : LVDS backlight + * bl[0] : LVDS VDD + */ static unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo) { unsigned char CR4A, temp; @@ -2196,12 +2175,12 @@ static unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo) return temp; } -/*----------------------------------------------------------------------------*/ -/* output */ -/* bl[5] : LVDS signal */ -/* bl[1] : LVDS backlight */ -/* bl[0] : LVDS VDD */ -/*----------------------------------------------------------------------------*/ +/* + * output + * bl[5] : LVDS signal + * bl[1] : LVDS backlight + * bl[0] : LVDS VDD + */ static unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo) { unsigned char CR4A, CRB4, temp; @@ -2219,17 +2198,17 @@ static unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo) return temp; } -/*----------------------------------------------------------------------------*/ -/* input */ -/* bl[5] : 1;LVDS signal on */ -/* bl[1] : 1;LVDS backlight on */ -/* bl[0] : 1:LVDS VDD on */ -/* bh: 100000b : clear bit 5, to set bit5 */ -/* 000010b : clear bit 1, to set bit1 */ -/* 000001b : clear bit 0, to set bit0 */ -/*----------------------------------------------------------------------------*/ +/* + * input + * bl[5] : 1;LVDS signal on + * bl[1] : 1;LVDS backlight on + * bl[0] : 1:LVDS VDD on + * bh: 100000b : clear bit 5, to set bit5 + * 000010b : clear bit 1, to set bit1 + * 000001b : clear bit 0, to set bit0 + */ static void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, - struct vb_device_info *pVBInfo) + struct vb_device_info *pVBInfo) { unsigned char CR4A, temp; @@ -2254,7 +2233,7 @@ static void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, } static void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, - struct vb_device_info *pVBInfo) + struct vb_device_info *pVBInfo) { unsigned char CR4A, temp; unsigned short tempbh0, tempbl0; @@ -2284,8 +2263,8 @@ static void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, } static void XGI_DisplayOn(struct xgifb_video_info *xgifb_info, - struct xgi_hw_device_info *pXGIHWDE, - struct vb_device_info *pVBInfo) + struct xgi_hw_device_info *pXGIHWDE, + struct vb_device_info *pVBInfo) { xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xDF, 0x00); if (pXGIHWDE->jChipType == XG21) { @@ -2328,8 +2307,8 @@ static void XGI_DisplayOn(struct xgifb_video_info *xgifb_info, } void XGI_DisplayOff(struct xgifb_video_info *xgifb_info, - struct xgi_hw_device_info *pXGIHWDE, - struct vb_device_info *pVBInfo) + struct xgi_hw_device_info *pXGIHWDE, + struct vb_device_info *pVBInfo) { if (pXGIHWDE->jChipType == XG21) { if (pVBInfo->IF_DEF_LVDS == 1) { @@ -2448,7 +2427,7 @@ exit: static unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo) { if ((pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) && - (pVBInfo->LCDInfo & SetLCDDualLink)) /* shampoo0129 */ + (pVBInfo->LCDInfo & SetLCDDualLink)) /* shampoo0129 */ return 1; return 0; @@ -2466,16 +2445,15 @@ static void XGI_GetRAMDAC2DATA(unsigned short ModeIdIndex, modeflag = XGI330_EModeIDTable[ModeIdIndex].Ext_ModeFlag; CRT1Index = XGI330_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; CRT1Index &= IndexMask; - temp1 = (unsigned short) XGI_CRT1Table[CRT1Index].CR[0]; - temp2 = (unsigned short) XGI_CRT1Table[CRT1Index].CR[5]; + temp1 = (unsigned short)XGI_CRT1Table[CRT1Index].CR[0]; + temp2 = (unsigned short)XGI_CRT1Table[CRT1Index].CR[5]; tempax = (temp1 & 0xFF) | ((temp2 & 0x03) << 8); - tempbx = (unsigned short) XGI_CRT1Table[CRT1Index].CR[8]; - tempcx = (unsigned short) - XGI_CRT1Table[CRT1Index].CR[14] << 8; + tempbx = (unsigned short)XGI_CRT1Table[CRT1Index].CR[8]; + tempcx = (unsigned short)XGI_CRT1Table[CRT1Index].CR[14] << 8; tempcx &= 0x0100; tempcx <<= 2; tempbx |= tempcx; - temp1 = (unsigned short) XGI_CRT1Table[CRT1Index].CR[9]; + temp1 = (unsigned short)XGI_CRT1Table[CRT1Index].CR[9]; if (temp1 & 0x01) tempbx |= 0x0100; @@ -2497,8 +2475,8 @@ static void XGI_GetRAMDAC2DATA(unsigned short ModeIdIndex, } static void XGI_GetCRT2Data(unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo) { unsigned short tempax = 0, tempbx = 0, modeflag, resinfo; @@ -2667,8 +2645,8 @@ static void XGI_GetCRT2Data(unsigned short ModeIdIndex, } static void XGI_SetCRT2VCLK(unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo) { unsigned char di_0, di_1, tempal; @@ -2739,9 +2717,9 @@ static unsigned short XGI_GetOffset(unsigned short ModeNo, } static void XGI_SetCRT2Offset(unsigned short ModeNo, - unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + unsigned short ModeIdIndex, + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo) { unsigned short offset; unsigned char temp; @@ -2750,11 +2728,11 @@ static void XGI_SetCRT2Offset(unsigned short ModeNo, return; offset = XGI_GetOffset(ModeNo, ModeIdIndex, RefreshRateTableIndex); - temp = (unsigned char) (offset & 0xFF); + temp = (unsigned char)(offset & 0xFF); xgifb_reg_set(pVBInfo->Part1Port, 0x07, temp); - temp = (unsigned char) ((offset & 0xFF00) >> 8); + temp = (unsigned char)((offset & 0xFF00) >> 8); xgifb_reg_set(pVBInfo->Part1Port, 0x09, temp); - temp = (unsigned char) (((offset >> 3) & 0xFF) + 1); + temp = (unsigned char)(((offset >> 3) & 0xFF) + 1); xgifb_reg_set(pVBInfo->Part1Port, 0x03, temp); } @@ -2767,8 +2745,8 @@ static void XGI_SetCRT2FIFO(struct vb_device_info *pVBInfo) } static void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo) { u8 tempcx; @@ -2783,8 +2761,8 @@ static void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, } static void XGI_SetGroup1(unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo) { unsigned short temp = 0, tempax = 0, tempbx = 0, tempcx = 0, pushbx = 0, CRT1Index, modeflag; @@ -2933,11 +2911,11 @@ static unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo) tempax = (pVBInfo->VT - pVBInfo->VDE) * pVBInfo->RVBHCFACT; tempax = (tempax * pVBInfo->HT) / tempbx; - return (unsigned short) tempax; + return (unsigned short)tempax; } static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, - struct vb_device_info *pVBInfo) + struct vb_device_info *pVBInfo) { unsigned short push1, push2, tempax, tempbx = 0, tempcx, temp, resinfo, modeflag; @@ -3044,14 +3022,14 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, if (ModeNo == 0x50) { if (pVBInfo->TVInfo == SetNTSCTV) { xgifb_reg_set(pVBInfo->Part1Port, - 0x07, 0x30); + 0x07, 0x30); xgifb_reg_set(pVBInfo->Part1Port, - 0x08, 0x03); + 0x08, 0x03); } else { xgifb_reg_set(pVBInfo->Part1Port, - 0x07, 0x2f); + 0x07, 0x2f); xgifb_reg_set(pVBInfo->Part1Port, - 0x08, 0x02); + 0x08, 0x02); } } } @@ -3064,7 +3042,7 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, tempbx = pVBInfo->VGAVT; push1 = tempbx; tempcx = 0x121; - tempbx = pVBInfo->VGAVDE; /* 0x0E Virtical Display End */ + tempbx = pVBInfo->VGAVDE; /* 0x0E Vertical Display End */ if (tempbx == 357) tempbx = 350; @@ -3116,7 +3094,7 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, if (tempbx & 0x0400) tempcx |= 0x0600; - /* 0x11 Vertival Blank End */ + /* 0x11 Vertical Blank End */ xgifb_reg_set(pVBInfo->Part1Port, 0x11, 0x00); tempax = push1; @@ -3227,7 +3205,7 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, } static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, - struct vb_device_info *pVBInfo) + struct vb_device_info *pVBInfo) { unsigned short i, j, tempax, tempbx, tempcx, temp, push1, push2, modeflag; @@ -3315,7 +3293,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, tempax = (tempax & 0x00FF) | ((tempax & 0x00FF) << 8); push1 = tempax; temp = (tempax & 0xFF00) >> 8; - temp += (unsigned short) TimingPoint[0]; + temp += (unsigned short)TimingPoint[0]; if (pVBInfo->VBType & (VB_SIS301B | VB_SIS302B | VB_SIS301LV | VB_SIS302LV | VB_XGI301C)) { @@ -3526,7 +3504,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, tempcx = 0x0101; - if (pVBInfo->VBInfo & SetCRT2ToTV) { /*301b*/ + if (pVBInfo->VBInfo & SetCRT2ToTV) { /* 301b */ if (pVBInfo->VGAHDE >= 1024) { tempcx = 0x1920; if (pVBInfo->VGAHDE >= 1280) { @@ -3562,7 +3540,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, if (temp2 != 0) tempeax += 1; - tempax = (unsigned short) tempeax; + tempax = (unsigned short)tempeax; /* 301b */ if (pVBInfo->VBType & (VB_SIS301B | VB_SIS302B | VB_SIS301LV @@ -3572,9 +3550,9 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, /* end 301b */ tempbx = push1; - tempbx = (unsigned short) (((tempeax & 0x0000FF00) & 0x1F00) + tempbx = (unsigned short)(((tempeax & 0x0000FF00) & 0x1F00) | (tempbx & 0x00FF)); - tempax = (unsigned short) (((tempeax & 0x000000FF) << 8) + tempax = (unsigned short)(((tempeax & 0x000000FF) << 8) | (tempax & 0x00FF)); temp = (tempax & 0xFF00) >> 8; } else { @@ -3622,14 +3600,14 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, xgifb_reg_set(pVBInfo->Part2Port, 0x4d, temp); temp = xgifb_reg_get(pVBInfo->Part2Port, 0x43); /* 301b change */ - xgifb_reg_set(pVBInfo->Part2Port, 0x43, (unsigned short) (temp - 3)); + xgifb_reg_set(pVBInfo->Part2Port, 0x43, (unsigned short)(temp - 3)); if (!(pVBInfo->TVInfo & (TVSetYPbPr525p | TVSetYPbPr750p))) { if (pVBInfo->TVInfo & NTSC1024x768) { TimingPoint = XGI_NTSC1024AdjTime; for (i = 0x1c, j = 0; i <= 0x30; i++, j++) { xgifb_reg_set(pVBInfo->Part2Port, i, - TimingPoint[j]); + TimingPoint[j]); } xgifb_reg_set(pVBInfo->Part2Port, 0x43, 0x72); } @@ -3639,7 +3617,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, if (pVBInfo->VBType & VB_XGI301C) { if (pVBInfo->TVInfo & TVSetPALM) xgifb_reg_and_or(pVBInfo->Part2Port, 0x4E, ~0x08, - 0x08); /* PALM Mode */ + 0x08); /* PALM Mode */ } if (pVBInfo->TVInfo & TVSetPALM) { @@ -3656,8 +3634,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, } } -static void XGI_SetLCDRegs(unsigned short ModeIdIndex, - struct vb_device_info *pVBInfo) +static void XGI_SetLCDRegs(unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) { unsigned short pushbx, tempax, tempbx, tempcx, temp, tempah, tempbh, tempch; @@ -3853,12 +3830,12 @@ static void XGI_SetLCDRegs(unsigned short ModeIdIndex, } } -/* --------------------------------------------------------------------- */ -/* Function : XGI_GetTap4Ptr */ -/* Input : */ -/* Output : di -> Tap4 Reg. Setting Pointer */ -/* Description : */ -/* --------------------------------------------------------------------- */ +/* + * Function : XGI_GetTap4Ptr + * Input : + * Output : di -> Tap4 Reg. Setting Pointer + * Description : + */ static struct XGI301C_Tap4TimingStruct const *XGI_GetTap4Ptr(unsigned short tempcx, struct vb_device_info *pVBInfo) { @@ -3882,7 +3859,7 @@ static struct XGI301C_Tap4TimingStruct const if (pVBInfo->VBInfo & SetCRT2ToYPbPr525750) { if ((pVBInfo->TVInfo & TVSetYPbPr525i) || - (pVBInfo->TVInfo & TVSetYPbPr525p)) + (pVBInfo->TVInfo & TVSetYPbPr525p)) Tap4TimingPtr = xgifb_ntsc_525_tap4_timing; if (pVBInfo->TVInfo & TVSetYPbPr750p) Tap4TimingPtr = YPbPr750pTap4Timing; @@ -3988,8 +3965,8 @@ static void XGI_SetGroup3(unsigned short ModeIdIndex, } static void XGI_SetGroup4(unsigned short ModeIdIndex, - unsigned short RefreshRateTableIndex, - struct vb_device_info *pVBInfo) + unsigned short RefreshRateTableIndex, + struct vb_device_info *pVBInfo) { unsigned short tempax, tempcx, tempbx, modeflag, temp, temp2; @@ -4080,12 +4057,12 @@ static void XGI_SetGroup4(unsigned short ModeIdIndex, if (templong != 0) tempebx++; - temp = (unsigned short) (tempebx & 0x000000FF); + temp = (unsigned short)(tempebx & 0x000000FF); xgifb_reg_set(pVBInfo->Part4Port, 0x1B, temp); - temp = (unsigned short) ((tempebx & 0x0000FF00) >> 8); + temp = (unsigned short)((tempebx & 0x0000FF00) >> 8); xgifb_reg_set(pVBInfo->Part4Port, 0x1A, temp); - tempbx = (unsigned short) (tempebx >> 16); + tempbx = (unsigned short)(tempebx >> 16); temp = tempbx & 0x00FF; temp <<= 4; temp |= ((tempcx & 0xFF00) >> 8); @@ -4132,8 +4109,7 @@ static void XGI_SetGroup4(unsigned short ModeIdIndex, | TVSetHiVision))) { temp |= 0x0001; if ((pVBInfo->VBInfo & SetInSlaveMode) && - !(pVBInfo->TVInfo - & TVSimuMode)) + !(pVBInfo->TVInfo & TVSimuMode)) temp &= (~0x0001); } } @@ -4174,7 +4150,8 @@ static void XGI_DisableGatingCRT(struct vb_device_info *pVBInfo) } static unsigned char XGI_XG21CheckLVDSMode(struct xgifb_video_info *xgifb_info, - unsigned short ModeNo, unsigned short ModeIdIndex) + unsigned short ModeNo, + unsigned short ModeIdIndex) { unsigned short xres, yres, colordepth, modeflag, resindex; @@ -4221,7 +4198,7 @@ static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info, unsigned short LVDSVT, LVDSVBS, LVDSVRS, LVDSVRE, LVDSVBE; unsigned short value; - temp = (unsigned char) ((xgifb_info->lvds_data.LVDS_Capability & + temp = (unsigned char)((xgifb_info->lvds_data.LVDS_Capability & (LCDPolarity << 8)) >> 8); temp &= LCDPolarity; Miscdata = inb(pVBInfo->P3cc); @@ -4354,12 +4331,12 @@ static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info, if (chip_id == XG27) { /* Panel VRS SR35[2:0] SR34[7:0] */ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x07, - (value & 0x700) >> 8); + (value & 0x700) >> 8); xgifb_reg_set(pVBInfo->P3c4, 0x34, value & 0xFF); } else { /* Panel VRS SR3F[1:0] SR34[7:0] SR33[0] */ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0x03, - (value & 0x600) >> 9); + (value & 0x600) >> 9); xgifb_reg_set(pVBInfo->P3c4, 0x34, (value >> 1) & 0xFF); xgifb_reg_and_or(pVBInfo->P3d4, 0x33, ~0x01, value & 0x01); } @@ -4372,11 +4349,11 @@ static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info, /* Panel VRE SR3F[7:2] */ if (chip_id == XG27) xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, - (value << 2) & 0xFC); + (value << 2) & 0xFC); else /* SR3F[7] has to be 0, h/w bug */ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, - (value << 2) & 0x7C); + (value << 2) & 0x7C); for (temp = 0, value = 0; temp < 3; temp++) { xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, value); @@ -4400,13 +4377,13 @@ static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info, } } -/* --------------------------------------------------------------------- */ -/* Function : XGI_IsLCDON */ -/* Input : */ -/* Output : 0 : Skip PSC Control */ -/* 1: Disable PSC */ -/* Description : */ -/* --------------------------------------------------------------------- */ +/* + * Function : XGI_IsLCDON + * Input : + * Output : 0 : Skip PSC Control + * 1: Disable PSC + * Description : + */ static unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo) { unsigned short tempax; @@ -4421,8 +4398,8 @@ static unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo) } static void XGI_DisableBridge(struct xgifb_video_info *xgifb_info, - struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) + struct xgi_hw_device_info *HwDeviceExtension, + struct vb_device_info *pVBInfo) { unsigned short tempah = 0; @@ -4498,23 +4475,23 @@ static void XGI_DisableBridge(struct xgifb_video_info *xgifb_info, } } -/* --------------------------------------------------------------------- */ -/* Function : XGI_GetTVPtrIndex */ -/* Input : */ -/* Output : */ -/* Description : bx 0 : ExtNTSC */ -/* 1 : StNTSC */ -/* 2 : ExtPAL */ -/* 3 : StPAL */ -/* 4 : ExtHiTV */ -/* 5 : StHiTV */ -/* 6 : Ext525i */ -/* 7 : St525i */ -/* 8 : Ext525p */ -/* 9 : St525p */ -/* A : Ext750p */ -/* B : St750p */ -/* --------------------------------------------------------------------- */ +/* + * Function : XGI_GetTVPtrIndex + * Input : + * Output : + * Description : bx 0 : ExtNTSC + * 1 : StNTSC + * 2 : ExtPAL + * 3 : StPAL + * 4 : ExtHiTV + * 5 : StHiTV + * 6 : Ext525i + * 7 : St525i + * 8 : Ext525p + * 9 : St525p + * A : Ext750p + * B : St750p + */ static unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo) { unsigned short tempbx = 0; @@ -4535,24 +4512,24 @@ static unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo) return tempbx; } -/* --------------------------------------------------------------------- */ -/* Function : XGI_GetTVPtrIndex2 */ -/* Input : */ -/* Output : bx 0 : NTSC */ -/* 1 : PAL */ -/* 2 : PALM */ -/* 3 : PALN */ -/* 4 : NTSC1024x768 */ -/* 5 : PAL-M 1024x768 */ -/* 6-7: reserved */ -/* cl 0 : YFilter1 */ -/* 1 : YFilter2 */ -/* ch 0 : 301A */ -/* 1 : 301B/302B/301LV/302LV */ -/* Description : */ -/* --------------------------------------------------------------------- */ +/* + * Function : XGI_GetTVPtrIndex2 + * Input : + * Output : bx 0 : NTSC + * 1 : PAL + * 2 : PALM + * 3 : PALN + * 4 : NTSC1024x768 + * 5 : PAL-M 1024x768 + * 6-7: reserved + * cl 0 : YFilter1 + * 1 : YFilter2 + * ch 0 : 301A + * 1 : 301B/302B/301LV/302LV + * Description : + */ static void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char *tempcl, - unsigned char *tempch, struct vb_device_info *pVBInfo) + unsigned char *tempch, struct vb_device_info *pVBInfo) { *tempbx = 0; *tempcl = 0; @@ -4637,33 +4614,32 @@ static void XGI_SetLCDCap_A(unsigned short tempcx, if (temp & LCDRGB18Bit) { xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, 0x0F, - /* Enable Dither */ - (unsigned short) (0x20 | (tempcx & 0x00C0))); + /* Enable Dither */ + (unsigned short)(0x20 | (tempcx & 0x00C0))); xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80); } else { xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, 0x0F, - (unsigned short) (0x30 | (tempcx & 0x00C0))); + (unsigned short)(0x30 | (tempcx & 0x00C0))); xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00); } } -/* --------------------------------------------------------------------- */ -/* Function : XGI_SetLCDCap_B */ -/* Input : cx -> LCD Capability */ -/* Output : */ -/* Description : */ -/* --------------------------------------------------------------------- */ +/* + * Function : XGI_SetLCDCap_B + * Input : cx -> LCD Capability + * Output : + * Description : + */ static void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo) { if (tempcx & EnableLCD24bpp) /* 24bits */ xgifb_reg_and_or(pVBInfo->Part2Port, 0x1A, 0xE0, - (unsigned short) (((tempcx & 0x00ff) >> 6) - | 0x0c)); + (unsigned short)(((tempcx & 0x00ff) >> 6) | 0x0c)); else xgifb_reg_and_or(pVBInfo->Part2Port, 0x1A, 0xE0, - (unsigned short) (((tempcx & 0x00ff) >> 6) - | 0x18)); /* Enable Dither */ + (unsigned short)(((tempcx & 0x00ff) >> 6) | 0x18)); + /* Enable Dither */ } static void XGI_LongWait(struct vb_device_info *pVBInfo) @@ -4698,13 +4674,13 @@ static void SetSpectrum(struct vb_device_info *pVBInfo) XGI_LongWait(pVBInfo); xgifb_reg_set(pVBInfo->Part4Port, 0x31, - pVBInfo->LCDCapList[index].Spectrum_31); + pVBInfo->LCDCapList[index].Spectrum_31); xgifb_reg_set(pVBInfo->Part4Port, 0x32, - pVBInfo->LCDCapList[index].Spectrum_32); + pVBInfo->LCDCapList[index].Spectrum_32); xgifb_reg_set(pVBInfo->Part4Port, 0x33, - pVBInfo->LCDCapList[index].Spectrum_33); + pVBInfo->LCDCapList[index].Spectrum_33); xgifb_reg_set(pVBInfo->Part4Port, 0x34, - pVBInfo->LCDCapList[index].Spectrum_34); + pVBInfo->LCDCapList[index].Spectrum_34); XGI_LongWait(pVBInfo); xgifb_reg_or(pVBInfo->Part4Port, 0x30, 0x40); /* enable spectrum */ } @@ -4721,13 +4697,13 @@ static void XGI_SetLCDCap(struct vb_device_info *pVBInfo) (VB_SIS301LV | VB_SIS302LV | VB_XGI301C)) { /* Set 301LV Capability */ xgifb_reg_set(pVBInfo->Part4Port, 0x24, - (unsigned char) (tempcx & 0x1F)); + (unsigned char)(tempcx & 0x1F)); } /* VB Driving */ xgifb_reg_and_or(pVBInfo->Part4Port, 0x0D, - ~((EnableVBCLKDRVLOW | EnablePLLSPLOW) >> 8), - (unsigned short) ((tempcx & (EnableVBCLKDRVLOW - | EnablePLLSPLOW)) >> 8)); + ~((EnableVBCLKDRVLOW | EnablePLLSPLOW) >> 8), + (unsigned short)((tempcx & (EnableVBCLKDRVLOW | + EnablePLLSPLOW)) >> 8)); if (pVBInfo->VBInfo & SetCRT2ToLCD) XGI_SetLCDCap_B(tempcx, pVBInfo); @@ -4744,12 +4720,12 @@ static void XGI_SetLCDCap(struct vb_device_info *pVBInfo) } } -/* --------------------------------------------------------------------- */ -/* Function : XGI_SetAntiFlicker */ -/* Input : */ -/* Output : */ -/* Description : Set TV Customized Param. */ -/* --------------------------------------------------------------------- */ +/* + * Function : XGI_SetAntiFlicker + * Input : + * Output : + * Description : Set TV Customized Param. + */ static void XGI_SetAntiFlicker(struct vb_device_info *pVBInfo) { unsigned short tempbx; @@ -4792,13 +4768,13 @@ static void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo) XGI_GetTVPtrIndex2(&tempbx, &tempcl, &tempch, pVBInfo); /* bx, cl, ch */ tempData = TVPhaseList[tempbx]; - xgifb_reg_set(pVBInfo->Part2Port, 0x31, (unsigned short) (tempData + xgifb_reg_set(pVBInfo->Part2Port, 0x31, (unsigned short)(tempData & 0x000000FF)); - xgifb_reg_set(pVBInfo->Part2Port, 0x32, (unsigned short) ((tempData + xgifb_reg_set(pVBInfo->Part2Port, 0x32, (unsigned short)((tempData & 0x0000FF00) >> 8)); - xgifb_reg_set(pVBInfo->Part2Port, 0x33, (unsigned short) ((tempData + xgifb_reg_set(pVBInfo->Part2Port, 0x33, (unsigned short)((tempData & 0x00FF0000) >> 16)); - xgifb_reg_set(pVBInfo->Part2Port, 0x34, (unsigned short) ((tempData + xgifb_reg_set(pVBInfo->Part2Port, 0x34, (unsigned short)((tempData & 0xFF000000) >> 24)); } @@ -4866,12 +4842,12 @@ static void XGI_SetYFilter(unsigned short ModeIdIndex, } } -/* --------------------------------------------------------------------- */ -/* Function : XGI_OEM310Setting */ -/* Input : */ -/* Output : */ -/* Description : Customized Param. for 301 */ -/* --------------------------------------------------------------------- */ +/* + * Function : XGI_OEM310Setting + * Input : + * Output : + * Description : Customized Param. for 301 + */ static void XGI_OEM310Setting(unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) { @@ -4890,12 +4866,12 @@ static void XGI_OEM310Setting(unsigned short ModeIdIndex, } } -/* --------------------------------------------------------------------- */ -/* Function : XGI_SetCRT2ModeRegs */ -/* Input : */ -/* Output : */ -/* Description : Origin code for crt2group */ -/* --------------------------------------------------------------------- */ +/* + * Function : XGI_SetCRT2ModeRegs + * Input : + * Output : + * Description : Origin code for crt2group + */ static void XGI_SetCRT2ModeRegs(struct vb_device_info *pVBInfo) { unsigned short tempbl; @@ -4999,8 +4975,8 @@ reg_and_or: tempah |= 0x40; } - if ((pVBInfo->LCDResInfo == Panel_1280x1024) - || (pVBInfo->LCDResInfo == Panel_1280x1024x75)) + if ((pVBInfo->LCDResInfo == Panel_1280x1024) || + (pVBInfo->LCDResInfo == Panel_1280x1024x75)) tempah |= 0x80; if (pVBInfo->LCDResInfo == Panel_1280x960) @@ -5068,8 +5044,9 @@ void XGI_LockCRT2(struct vb_device_info *pVBInfo) } unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, - unsigned short ModeNo, unsigned short ModeIdIndex, - struct vb_device_info *pVBInfo) + unsigned short ModeNo, + unsigned short ModeIdIndex, + struct vb_device_info *pVBInfo) { const u8 LCDARefreshIndex[] = { 0x00, 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x00 }; @@ -5143,14 +5120,14 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, } static void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex, - struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) + struct xgi_hw_device_info *HwDeviceExtension, + struct vb_device_info *pVBInfo) { unsigned short RefreshRateTableIndex; pVBInfo->SetFlag |= ProgrammingCRT2; RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, - ModeIdIndex, pVBInfo); + ModeIdIndex, pVBInfo); XGI_GetLVDSResInfo(ModeIdIndex, pVBInfo); XGI_GetLVDSData(ModeIdIndex, pVBInfo); XGI_ModCRT1Regs(ModeIdIndex, HwDeviceExtension, pVBInfo); @@ -5159,8 +5136,8 @@ static void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex, } static unsigned char XGI_SetCRT2Group301(unsigned short ModeNo, - struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) + struct xgi_hw_device_info *HwDeviceExtension, + struct vb_device_info *pVBInfo) { unsigned short ModeIdIndex, RefreshRateTableIndex; @@ -5168,7 +5145,7 @@ static unsigned char XGI_SetCRT2Group301(unsigned short ModeNo, XGI_SearchModeID(ModeNo, &ModeIdIndex); pVBInfo->SelectCRT2Rate = 4; RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, - ModeIdIndex, pVBInfo); + ModeIdIndex, pVBInfo); XGI_SaveCRT2Info(ModeNo, pVBInfo); XGI_GetCRT2ResInfo(ModeIdIndex, pVBInfo); XGI_GetCRT2Data(ModeIdIndex, RefreshRateTableIndex, pVBInfo); @@ -5210,39 +5187,39 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo) CR63 = xgifb_reg_get(pVBInfo->P3d4, 0x63); SR01 = xgifb_reg_get(pVBInfo->P3c4, 0x01); - xgifb_reg_set(pVBInfo->P3c4, 0x01, (unsigned char) (SR01 & 0xDF)); - xgifb_reg_set(pVBInfo->P3d4, 0x63, (unsigned char) (CR63 & 0xBF)); + xgifb_reg_set(pVBInfo->P3c4, 0x01, (unsigned char)(SR01 & 0xDF)); + xgifb_reg_set(pVBInfo->P3d4, 0x63, (unsigned char)(CR63 & 0xBF)); CR17 = xgifb_reg_get(pVBInfo->P3d4, 0x17); - xgifb_reg_set(pVBInfo->P3d4, 0x17, (unsigned char) (CR17 | 0x80)); + xgifb_reg_set(pVBInfo->P3d4, 0x17, (unsigned char)(CR17 | 0x80)); SR1F = xgifb_reg_get(pVBInfo->P3c4, 0x1F); - xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) (SR1F | 0x04)); + xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char)(SR1F | 0x04)); SR07 = xgifb_reg_get(pVBInfo->P3c4, 0x07); - xgifb_reg_set(pVBInfo->P3c4, 0x07, (unsigned char) (SR07 & 0xFB)); + xgifb_reg_set(pVBInfo->P3c4, 0x07, (unsigned char)(SR07 & 0xFB)); SR06 = xgifb_reg_get(pVBInfo->P3c4, 0x06); - xgifb_reg_set(pVBInfo->P3c4, 0x06, (unsigned char) (SR06 & 0xC3)); + xgifb_reg_set(pVBInfo->P3c4, 0x06, (unsigned char)(SR06 & 0xC3)); xgifb_reg_set(pVBInfo->P3d4, 0x11, 0x00); for (i = 0; i < 8; i++) - xgifb_reg_set(pVBInfo->P3d4, (unsigned short) i, CRTCData[i]); + xgifb_reg_set(pVBInfo->P3d4, (unsigned short)i, CRTCData[i]); for (i = 8; i < 11; i++) - xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 8), - CRTCData[i]); + xgifb_reg_set(pVBInfo->P3d4, (unsigned short)(i + 8), + CRTCData[i]); for (i = 11; i < 13; i++) - xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 4), - CRTCData[i]); + xgifb_reg_set(pVBInfo->P3d4, (unsigned short)(i + 4), + CRTCData[i]); for (i = 13; i < 16; i++) - xgifb_reg_set(pVBInfo->P3c4, (unsigned short) (i - 3), - CRTCData[i]); + xgifb_reg_set(pVBInfo->P3c4, (unsigned short)(i - 3), + CRTCData[i]); - xgifb_reg_set(pVBInfo->P3c4, 0x0E, (unsigned char) (CRTCData[16] - & 0xE0)); + xgifb_reg_set(pVBInfo->P3c4, 0x0E, (unsigned char)(CRTCData[16] + & 0xE0)); xgifb_reg_set(pVBInfo->P3c4, 0x31, 0x00); xgifb_reg_set(pVBInfo->P3c4, 0x2B, 0x1B); @@ -5275,12 +5252,12 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo) xgifb_reg_set(pVBInfo->P3d4, 0x53, (xgifb_reg_get( pVBInfo->P3d4, 0x53) & 0xFD)); - xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F); + xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char)SR1F); } static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info, - struct xgi_hw_device_info *HwDeviceExtension, - struct vb_device_info *pVBInfo) + struct xgi_hw_device_info *HwDeviceExtension, + struct vb_device_info *pVBInfo) { unsigned short tempah; @@ -5310,11 +5287,11 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info, if (!(pVBInfo->VBInfo & DisableCRT2Display)) { xgifb_reg_and_or(pVBInfo->Part2Port, 0x00, ~0xE0, - 0x20); /* shampoo 0129 */ + 0x20); /* shampoo 0129 */ if (pVBInfo->VBType & (VB_SIS302LV | VB_XGI301C)) { if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) - /* LVDS PLL power on */ + /* LVDS PLL power on */ xgifb_reg_and(pVBInfo->Part4Port, 0x2A, 0x7F); /* LVDS Driver power on */ @@ -5358,9 +5335,9 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info, } static void XGI_SetCRT1Group(struct xgifb_video_info *xgifb_info, - struct xgi_hw_device_info *HwDeviceExtension, - unsigned short ModeNo, unsigned short ModeIdIndex, - struct vb_device_info *pVBInfo) + struct xgi_hw_device_info *HwDeviceExtension, + unsigned short ModeNo, unsigned short ModeIdIndex, + struct vb_device_info *pVBInfo) { unsigned short RefreshRateTableIndex, temp; @@ -5389,14 +5366,14 @@ static void XGI_SetCRT1Group(struct xgifb_video_info *xgifb_info, } RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo, - ModeIdIndex, pVBInfo); + ModeIdIndex, pVBInfo); if (RefreshRateTableIndex != 0xFFFF) { XGI_SetSync(RefreshRateTableIndex, pVBInfo); XGI_SetCRT1CRTC(ModeIdIndex, RefreshRateTableIndex, pVBInfo, HwDeviceExtension); XGI_SetCRT1DE(ModeIdIndex, RefreshRateTableIndex, pVBInfo); XGI_SetCRT1Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex, - HwDeviceExtension, pVBInfo); + HwDeviceExtension, pVBInfo); XGI_SetCRT1VCLK(ModeIdIndex, HwDeviceExtension, RefreshRateTableIndex, pVBInfo); } @@ -5410,15 +5387,15 @@ static void XGI_SetCRT1Group(struct xgifb_video_info *xgifb_info, XGI_SetXG21CRTC(RefreshRateTableIndex, pVBInfo); XGI_UpdateXG21CRTC(ModeNo, pVBInfo, - RefreshRateTableIndex); + RefreshRateTableIndex); xgifb_set_lcd(HwDeviceExtension->jChipType, pVBInfo, RefreshRateTableIndex); if (pVBInfo->IF_DEF_LVDS == 1) xgifb_set_lvds(xgifb_info, - HwDeviceExtension->jChipType, - ModeIdIndex, pVBInfo); + HwDeviceExtension->jChipType, + ModeIdIndex, pVBInfo); } } @@ -5430,8 +5407,8 @@ static void XGI_SetCRT1Group(struct xgifb_video_info *xgifb_info, } unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, - struct xgi_hw_device_info *HwDeviceExtension, - unsigned short ModeNo) + struct xgi_hw_device_info *HwDeviceExtension, + unsigned short ModeNo) { unsigned short ModeIdIndex; struct vb_device_info VBINF; @@ -5440,7 +5417,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, pVBInfo->IF_DEF_LVDS = 0; if (HwDeviceExtension->jChipType >= XG20) - pVBInfo->VBType = 0; /*set VBType default 0*/ + pVBInfo->VBType = 0; /* set VBType default 0 */ XGIRegInit(pVBInfo, xgifb_info->vga_base); @@ -5473,13 +5450,13 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, XGI_DisableBridge(xgifb_info, HwDeviceExtension, pVBInfo); if (pVBInfo->VBInfo & (SetSimuScanMode | XGI_SetCRT2ToLCDA) || - !(pVBInfo->VBInfo & SwitchCRT2)) { + !(pVBInfo->VBInfo & SwitchCRT2)) { XGI_SetCRT1Group(xgifb_info, HwDeviceExtension, ModeNo, - ModeIdIndex, pVBInfo); + ModeIdIndex, pVBInfo); if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { XGI_SetLCDAGroup(ModeNo, ModeIdIndex, - HwDeviceExtension, pVBInfo); + HwDeviceExtension, pVBInfo); } } @@ -5488,7 +5465,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, case VB_CHIP_301: /* fall through */ case VB_CHIP_302: XGI_SetCRT2Group301(ModeNo, HwDeviceExtension, - pVBInfo); /*add for CRT2 */ + pVBInfo); /* add for CRT2 */ break; default: @@ -5497,7 +5474,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, } XGI_SetCRT2ModeRegs(pVBInfo); - XGI_OEM310Setting(ModeIdIndex, pVBInfo); /*0212*/ + XGI_OEM310Setting(ModeIdIndex, pVBInfo); /* 0212 */ XGI_EnableBridge(xgifb_info, HwDeviceExtension, pVBInfo); } /* !XG20 */ else { @@ -5515,7 +5492,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo); XGI_SetCRT1Group(xgifb_info, HwDeviceExtension, ModeNo, - ModeIdIndex, pVBInfo); + ModeIdIndex, pVBInfo); XGI_DisplayOn(xgifb_info, HwDeviceExtension, pVBInfo); } diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index c801deb142f6..f9f98e06e6d5 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h @@ -1701,6 +1701,7 @@ static const struct XGI_LVDSCRT1VDataStruct XGI_LVDSCRT11280x1024_1_Vx75[] = { { {0x28, 0xF5, 0x00, 0x84, 0xFF, 0x29, 0x90} },/* ; 04 (x768) */ { {0x28, 0x5A, 0x13, 0x87, 0xFF, 0x29, 0xA9} } /* ; 05 (x1024) */ }; + /* CR00,CR02,CR03,CR04,CR05,SR0B,SR0C,SR0E */ static const struct XGI_LVDSCRT1HDataStruct XGI_LVDSCRT11280x1024_2_Hx75[] = { { {0x7E, 0x3B, 0x9A, 0x44, 0x12, 0x00, 0x01, 0x00} },/* ; 00 (320x) */ @@ -1886,17 +1887,17 @@ static const struct XGI330_LCDCapStruct XGI_LCDDLCapList[] = { 0x6C, 0xC3, 0x35, 0x62, 0x0A, 0xC0, 0x28, 0x10}, /* LCDCap1280x1024 */ - {Panel_1280x1024, XGI_LCDDualLink+DefaultLCDCap, + {Panel_1280x1024, XGI_LCDDualLink + DefaultLCDCap, 0x70, 0x03, VCLK108_2_315, 0x70, 0x44, 0xF8, 0x2F, 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1400x1050 */ - {Panel_1400x1050, XGI_LCDDualLink+DefaultLCDCap, + {Panel_1400x1050, XGI_LCDDualLink + DefaultLCDCap, 0x70, 0x03, VCLK108_2_315, 0x70, 0x44, 0xF8, 0x2F, 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1600x1200 */ - {Panel_1600x1200, XGI_LCDDualLink+DefaultLCDCap, + {Panel_1600x1200, XGI_LCDDualLink + DefaultLCDCap, 0xC0, 0x03, VCLK162, 0x43, 0x22, 0x70, 0x24, 0x0A, 0xC0, 0x30, 0x10}, @@ -1905,7 +1906,7 @@ static const struct XGI330_LCDCapStruct XGI_LCDDLCapList[] = { 0x2B, 0x61, 0x2B, 0x61, 0x0A, 0xC0, 0x28, 0x10}, /* LCDCap1280x1024x75 */ - {Panel_1280x1024x75, XGI_LCDDualLink+DefaultLCDCap, + {Panel_1280x1024x75, XGI_LCDDualLink + DefaultLCDCap, 0x90, 0x03, VCLK135_5, 0x54, 0x42, 0x4A, 0x61, 0x0A, 0xC0, 0x30, 0x10}, diff --git a/drivers/staging/xgifb/vb_util.h b/drivers/staging/xgifb/vb_util.h index 08db58b396b2..052694e75053 100644 --- a/drivers/staging/xgifb/vb_util.h +++ b/drivers/staging/xgifb/vb_util.h @@ -18,7 +18,7 @@ static inline void xgifb_reg_and_or(unsigned long port, u8 index, u8 temp; temp = xgifb_reg_get(port, index); - temp = (u8) ((temp & data_and) | data_or); + temp = (u8)((temp & data_and) | data_or); xgifb_reg_set(port, index, temp); } @@ -28,7 +28,7 @@ static inline void xgifb_reg_and(unsigned long port, u8 index, u8 temp; temp = xgifb_reg_get(port, index); - temp = (u8) (temp & data_and); + temp = (u8)(temp & data_and); xgifb_reg_set(port, index, temp); } |