diff options
author | 2016-04-11 10:41:07 +0300 | |
---|---|---|
committer | 2016-04-13 08:17:18 +0300 | |
commit | e09b41010ba33a20a87472ee821fa407a5b8da36 (patch) | |
tree | d10dc367189862e7ca5c592f033dc3726e1df4e3 /kernel/drivers/staging/xgifb | |
parent | f93b97fd65072de626c074dbe099a1fff05ce060 (diff) |
These changes are the raw update to linux-4.4.6-rt14. Kernel sources
are taken from kernel.org, and rt patch from the rt wiki download page.
During the rebasing, the following patch collided:
Force tick interrupt and get rid of softirq magic(I70131fb85).
Collisions have been removed because its logic was found on the
source already.
Change-Id: I7f57a4081d9deaa0d9ccfc41a6c8daccdee3b769
Signed-off-by: José Pekkarinen <jose.pekkarinen@nokia.com>
Diffstat (limited to 'kernel/drivers/staging/xgifb')
-rw-r--r-- | kernel/drivers/staging/xgifb/Makefile | 2 | ||||
-rw-r--r-- | kernel/drivers/staging/xgifb/XGI_main_26.c | 45 | ||||
-rw-r--r-- | kernel/drivers/staging/xgifb/vb_init.c | 103 | ||||
-rw-r--r-- | kernel/drivers/staging/xgifb/vb_init.h | 4 | ||||
-rw-r--r-- | kernel/drivers/staging/xgifb/vb_setmode.c | 21 | ||||
-rw-r--r-- | kernel/drivers/staging/xgifb/vb_setmode.h | 34 | ||||
-rw-r--r-- | kernel/drivers/staging/xgifb/vb_util.c | 42 | ||||
-rw-r--r-- | kernel/drivers/staging/xgifb/vb_util.h | 44 |
8 files changed, 129 insertions, 166 deletions
diff --git a/kernel/drivers/staging/xgifb/Makefile b/kernel/drivers/staging/xgifb/Makefile index 55e519905..964a843c4 100644 --- a/kernel/drivers/staging/xgifb/Makefile +++ b/kernel/drivers/staging/xgifb/Makefile @@ -1,4 +1,4 @@ obj-$(CONFIG_FB_XGI) += xgifb.o -xgifb-y := XGI_main_26.o vb_init.o vb_setmode.o vb_util.o +xgifb-y := XGI_main_26.o vb_init.o vb_setmode.o diff --git a/kernel/drivers/staging/xgifb/XGI_main_26.c b/kernel/drivers/staging/xgifb/XGI_main_26.c index 74e882007..89f5b55ed 100644 --- a/kernel/drivers/staging/xgifb/XGI_main_26.c +++ b/kernel/drivers/staging/xgifb/XGI_main_26.c @@ -8,10 +8,7 @@ #include <linux/sizes.h> #include <linux/module.h> - -#ifdef CONFIG_MTRR -#include <asm/mtrr.h> -#endif +#include <linux/pci.h> #include "XGI_main.h" #include "vb_init.h" @@ -21,8 +18,8 @@ #define Index_CR_GPIO_Reg1 0x48 #define Index_CR_GPIO_Reg3 0x4a -#define GPIOG_EN (1<<6) -#define GPIOG_READ (1<<1) +#define GPIOG_EN BIT(6) +#define GPIOG_READ BIT(1) static char *forcecrt2type; static char *mode; @@ -32,7 +29,7 @@ static unsigned int refresh_rate; /* -------------------- Macro definitions ---------------------------- */ #ifdef DEBUG -static void dumpVGAReg(void) +static void dumpVGAReg(struct xgifb_video_info *xgifb_info) { u8 i, reg; @@ -51,7 +48,7 @@ static void dumpVGAReg(void) } } #else -static inline void dumpVGAReg(void) +static inline void dumpVGAReg(struct xgifb_video_info *xgifb_info) { } #endif @@ -1076,7 +1073,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive, } XGIfb_bpp_to_var(xgifb_info, var); /*update ARGB info*/ - dumpVGAReg(); + dumpVGAReg(xgifb_info); return 0; } @@ -1551,7 +1548,7 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info) } } -static int XGIfb_has_VB(struct xgifb_video_info *xgifb_info) +static bool XGIfb_has_VB(struct xgifb_video_info *xgifb_info) { u8 vb_chipid; @@ -1565,9 +1562,9 @@ static int XGIfb_has_VB(struct xgifb_video_info *xgifb_info) break; default: xgifb_info->hasVB = HASVB_NONE; - return 0; + return false; } - return 1; + return true; } static void XGIfb_get_VB_type(struct xgifb_video_info *xgifb_info) @@ -1770,7 +1767,7 @@ static int xgifb_probe(struct pci_dev *pdev, } xgifb_info->video_vbase = hw_info->pjVideoMemoryAddress = - ioremap(xgifb_info->video_base, xgifb_info->video_size); + ioremap_wc(xgifb_info->video_base, xgifb_info->video_size); xgifb_info->mmio_vbase = ioremap(xgifb_info->mmio_base, xgifb_info->mmio_size); @@ -2014,28 +2011,20 @@ static int xgifb_probe(struct pci_dev *pdev, fb_alloc_cmap(&fb_info->cmap, 256, 0); -#ifdef CONFIG_MTRR - xgifb_info->mtrr = mtrr_add(xgifb_info->video_base, - xgifb_info->video_size, MTRR_TYPE_WRCOMB, 1); - if (xgifb_info->mtrr >= 0) - dev_info(&pdev->dev, "Added MTRR\n"); -#endif + xgifb_info->mtrr = arch_phys_wc_add(xgifb_info->video_base, + xgifb_info->video_size); if (register_framebuffer(fb_info) < 0) { ret = -EINVAL; goto error_mtrr; } - dumpVGAReg(); + dumpVGAReg(xgifb_info); return 0; error_mtrr: -#ifdef CONFIG_MTRR - if (xgifb_info->mtrr >= 0) - mtrr_del(xgifb_info->mtrr, xgifb_info->video_base, - xgifb_info->video_size); -#endif /* CONFIG_MTRR */ + arch_phys_wc_del(xgifb_info->mtrr); error_1: iounmap(xgifb_info->mmio_vbase); iounmap(xgifb_info->video_vbase); @@ -2059,11 +2048,7 @@ static void xgifb_remove(struct pci_dev *pdev) struct fb_info *fb_info = xgifb_info->fb_info; unregister_framebuffer(fb_info); -#ifdef CONFIG_MTRR - if (xgifb_info->mtrr >= 0) - mtrr_del(xgifb_info->mtrr, xgifb_info->video_base, - xgifb_info->video_size); -#endif /* CONFIG_MTRR */ + arch_phys_wc_del(xgifb_info->mtrr); iounmap(xgifb_info->mmio_vbase); iounmap(xgifb_info->video_vbase); release_mem_region(xgifb_info->mmio_base, xgifb_info->mmio_size); diff --git a/kernel/drivers/staging/xgifb/vb_init.c b/kernel/drivers/staging/xgifb/vb_init.c index 2b233af8e..879a7e675 100644 --- a/kernel/drivers/staging/xgifb/vb_init.c +++ b/kernel/drivers/staging/xgifb/vb_init.c @@ -51,7 +51,7 @@ XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension, } else if (HwDeviceExtension->jChipType == XG21) { /* Independent GPIO control */ xgifb_reg_and(pVBInfo->P3d4, 0xB4, ~0x02); - udelay(800); + usleep_range(800, 1800); xgifb_reg_or(pVBInfo->P3d4, 0x4A, 0x80); /* Enable GPIOH read */ /* GPIOF 0:DVI 1:DVO */ data = xgifb_reg_get(pVBInfo->P3d4, 0x48); @@ -80,20 +80,20 @@ static void XGINew_DDR1x_MRS_340(unsigned long P3c4, xgifb_reg_set(P3c4, 0x16, 0x00); xgifb_reg_set(P3c4, 0x16, 0x80); - mdelay(3); + usleep_range(3, 1003); xgifb_reg_set(P3c4, 0x18, 0x00); xgifb_reg_set(P3c4, 0x19, 0x20); xgifb_reg_set(P3c4, 0x16, 0x00); xgifb_reg_set(P3c4, 0x16, 0x80); - udelay(60); + usleep_range(60, 1060); xgifb_reg_set(P3c4, 0x18, pVBInfo->SR18[pVBInfo->ram_type]); /* SR18 */ xgifb_reg_set(P3c4, 0x19, 0x01); xgifb_reg_set(P3c4, 0x16, 0x03); xgifb_reg_set(P3c4, 0x16, 0x83); - mdelay(1); + usleep_range(1, 1001); xgifb_reg_set(P3c4, 0x1B, 0x03); - udelay(500); + usleep_range(500, 1500); xgifb_reg_set(P3c4, 0x18, pVBInfo->SR18[pVBInfo->ram_type]); /* SR18 */ xgifb_reg_set(P3c4, 0x19, 0x00); xgifb_reg_set(P3c4, 0x16, 0x03); @@ -136,66 +136,65 @@ static void XGINew_DDRII_Bootup_XG27( /* Set Double Frequency */ xgifb_reg_set(P3d4, 0x97, pVBInfo->XGINew_CR97); /* CR97 */ - udelay(200); + usleep_range(200, 1200); xgifb_reg_set(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS2 */ xgifb_reg_set(P3c4, 0x19, 0x80); /* Set SR19 */ xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */ - udelay(15); + usleep_range(15, 1015); xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */ - udelay(15); + usleep_range(15, 1015); xgifb_reg_set(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS3 */ xgifb_reg_set(P3c4, 0x19, 0xC0); /* Set SR19 */ xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */ - udelay(15); + usleep_range(15, 1015); xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */ - udelay(15); + usleep_range(15, 1015); xgifb_reg_set(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS1 */ xgifb_reg_set(P3c4, 0x19, 0x40); /* Set SR19 */ xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */ - udelay(30); + usleep_range(30, 1030); xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */ - udelay(15); + usleep_range(15, 1015); xgifb_reg_set(P3c4, 0x18, 0x42); /* Set SR18 */ /* MRS, DLL Enable */ xgifb_reg_set(P3c4, 0x19, 0x0A); /* Set SR19 */ xgifb_reg_set(P3c4, 0x16, 0x00); /* Set SR16 */ - udelay(30); + usleep_range(30, 1030); xgifb_reg_set(P3c4, 0x16, 0x00); /* Set SR16 */ xgifb_reg_set(P3c4, 0x16, 0x80); /* Set SR16 */ xgifb_reg_set(P3c4, 0x1B, 0x04); /* Set SR1B */ - udelay(60); + usleep_range(60, 1060); xgifb_reg_set(P3c4, 0x1B, 0x00); /* Set SR1B */ xgifb_reg_set(P3c4, 0x18, 0x42); /* Set SR18 */ /* MRS, DLL Reset */ xgifb_reg_set(P3c4, 0x19, 0x08); /* Set SR19 */ xgifb_reg_set(P3c4, 0x16, 0x00); /* Set SR16 */ - udelay(30); + usleep_range(30, 1030); xgifb_reg_set(P3c4, 0x16, 0x83); /* Set SR16 */ - udelay(15); + usleep_range(15, 1015); xgifb_reg_set(P3c4, 0x18, 0x80); /* Set SR18 */ /* MRS, ODT */ xgifb_reg_set(P3c4, 0x19, 0x46); /* Set SR19 */ xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */ - udelay(30); + usleep_range(30, 1030); xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */ - udelay(15); + usleep_range(15, 1015); xgifb_reg_set(P3c4, 0x18, 0x00); /* Set SR18 */ /* EMRS */ xgifb_reg_set(P3c4, 0x19, 0x40); /* Set SR19 */ xgifb_reg_set(P3c4, 0x16, 0x20); /* Set SR16 */ - udelay(30); + usleep_range(30, 1030); xgifb_reg_set(P3c4, 0x16, 0xA0); /* Set SR16 */ - udelay(15); + usleep_range(15, 1015); /* Set SR1B refresh control 000:close; 010:open */ xgifb_reg_set(P3c4, 0x1B, 0x04); - udelay(200); - + usleep_range(200, 1200); } static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension, @@ -208,7 +207,7 @@ static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(P3d4, 0x97, 0x11); /* CR97 */ - udelay(200); + usleep_range(200, 1200); xgifb_reg_set(P3c4, 0x18, 0x00); /* EMRS2 */ xgifb_reg_set(P3c4, 0x19, 0x80); xgifb_reg_set(P3c4, 0x16, 0x05); @@ -229,18 +228,18 @@ static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(P3c4, 0x16, 0x05); xgifb_reg_set(P3c4, 0x16, 0x85); - udelay(15); + usleep_range(15, 1015); xgifb_reg_set(P3c4, 0x1B, 0x04); /* SR1B */ - udelay(30); + usleep_range(30, 1030); xgifb_reg_set(P3c4, 0x1B, 0x00); /* SR1B */ - udelay(100); + usleep_range(100, 1100); xgifb_reg_set(P3c4, 0x18, 0x42); /* MRS1 */ xgifb_reg_set(P3c4, 0x19, 0x00); xgifb_reg_set(P3c4, 0x16, 0x05); xgifb_reg_set(P3c4, 0x16, 0x85); - udelay(200); + usleep_range(200, 1200); } static void XGINew_DDR1x_MRS_XG20(unsigned long P3c4, @@ -250,20 +249,20 @@ static void XGINew_DDR1x_MRS_XG20(unsigned long P3c4, xgifb_reg_set(P3c4, 0x19, 0x40); xgifb_reg_set(P3c4, 0x16, 0x00); xgifb_reg_set(P3c4, 0x16, 0x80); - udelay(60); + usleep_range(60, 1060); xgifb_reg_set(P3c4, 0x18, 0x00); xgifb_reg_set(P3c4, 0x19, 0x40); xgifb_reg_set(P3c4, 0x16, 0x00); xgifb_reg_set(P3c4, 0x16, 0x80); - udelay(60); + usleep_range(60, 1060); xgifb_reg_set(P3c4, 0x18, pVBInfo->SR18[pVBInfo->ram_type]); /* SR18 */ xgifb_reg_set(P3c4, 0x19, 0x01); xgifb_reg_set(P3c4, 0x16, 0x03); xgifb_reg_set(P3c4, 0x16, 0x83); - mdelay(1); + usleep_range(1, 1001); xgifb_reg_set(P3c4, 0x1B, 0x03); - udelay(500); + usleep_range(500, 1500); xgifb_reg_set(P3c4, 0x18, pVBInfo->SR18[pVBInfo->ram_type]); /* SR18 */ xgifb_reg_set(P3c4, 0x19, 0x00); xgifb_reg_set(P3c4, 0x16, 0x03); @@ -499,7 +498,6 @@ static void XGINew_SetDRAMDefaultRegister340( xgifb_reg_set(P3c4, 0x1B, 0x03); /* SR1B */ } - static unsigned short XGINew_SetDRAMSize20Reg( unsigned short dram_size, struct vb_device_info *pVBInfo) @@ -533,7 +531,7 @@ static unsigned short XGINew_SetDRAMSize20Reg( 0x14, (xgifb_reg_get(pVBInfo->P3c4, 0x14) & 0x0F) | (data & 0xF0)); - udelay(15); + usleep_range(15, 1015); } return memsize; } @@ -552,7 +550,7 @@ static int XGINew_ReadWriteRest(unsigned short StopAddr, writel(Position, fbaddr + Position); } - udelay(500); /* Fix #1759 Memory Size error in Multi-Adapter. */ + usleep_range(500, 1500); /* Fix #1759 Memory Size error in Multi-Adapter. */ Position = 0; @@ -597,12 +595,11 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, if ((HwDeviceExtension->ulVideoMemorySize - 1) > 0x1000000) { - pVBInfo->ram_bus = 32; /* 32 bits */ /* 22bit + 2 rank + 32bit */ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1); xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x52); - udelay(15); + usleep_range(15, 1015); if (XGINew_ReadWriteRest(24, 23, pVBInfo) == 1) return; @@ -616,7 +613,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x42); - udelay(15); + usleep_range(15, 1015); if (XGINew_ReadWriteRest(23, 23, @@ -631,14 +628,14 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, /* 22bit + 2 rank + 16bit */ xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1); xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x41); - udelay(15); + usleep_range(15, 1015); if (XGINew_ReadWriteRest(23, 22, pVBInfo) == 1) return; xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x31); - udelay(15); + usleep_range(15, 1015); } } else { /* Dual_16_8 */ @@ -649,7 +646,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1); /* 0x41:16Mx16 bit*/ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x41); - udelay(15); + usleep_range(15, 1015); if (XGINew_ReadWriteRest(23, 22, pVBInfo) == 1) return; @@ -664,7 +661,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x31); - udelay(15); + usleep_range(15, 1015); if (XGINew_ReadWriteRest(22, 22, @@ -680,7 +677,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(pVBInfo->P3c4, 0x13, 0xB1); /* 0x30:8Mx8 bit*/ xgifb_reg_set(pVBInfo->P3c4, 0x14, 0x30); - udelay(15); + usleep_range(15, 1015); if (XGINew_ReadWriteRest(22, 21, pVBInfo) == 1) return; @@ -689,7 +686,7 @@ static void XGINew_CheckChannel(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_set(pVBInfo->P3c4, 0x13, 0x31); - udelay(15); + usleep_range(15, 1015); } } break; @@ -808,7 +805,7 @@ static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension, for (i = 0; i < size; i++) { /* SetDRAMSizingType */ xgifb_reg_and_or(pVBInfo->P3c4, 0x13, 0x80, dram_table[i][1]); - udelay(15); /* should delay 50 ns */ + usleep_range(50, 1050); /* should delay 50 ns */ memsize = XGINew_SetDRAMSize20Reg(dram_table[i][0], pVBInfo); @@ -817,7 +814,7 @@ static int XGINew_DDRSizing340(struct xgi_hw_device_info *HwDeviceExtension, memsize += (pVBInfo->ram_channel - 2) + 20; if ((HwDeviceExtension->ulVideoMemorySize - 1) < - (unsigned long) (1 << memsize)) + (unsigned long)(1 << memsize)) continue; if (XGINew_ReadWriteRest(memsize, start_addr, pVBInfo) == 1) @@ -838,13 +835,13 @@ static void XGINew_SetDRAMSize_340(struct xgifb_video_info *xgifb_info, data = xgifb_reg_get(pVBInfo->P3c4, 0x21); /* disable read cache */ - xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short) (data & 0xDF)); + xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short)(data & 0xDF)); XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo); XGINew_DDRSizing340(HwDeviceExtension, pVBInfo); data = xgifb_reg_get(pVBInfo->P3c4, 0x21); /* enable read cache */ - xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short) (data | 0x20)); + xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short)(data | 0x20)); } static u8 *xgifb_copy_rom(struct pci_dev *dev, size_t *rom_size) @@ -853,11 +850,11 @@ static u8 *xgifb_copy_rom(struct pci_dev *dev, size_t *rom_size) u8 *rom_copy; rom_address = pci_map_rom(dev, rom_size); - if (rom_address == NULL) + if (!rom_address) return NULL; rom_copy = vzalloc(XGIFB_ROM_SIZE); - if (rom_copy == NULL) + if (!rom_copy) goto done; *rom_size = min_t(size_t, *rom_size, XGIFB_ROM_SIZE); @@ -879,7 +876,7 @@ static bool xgifb_read_vbios(struct pci_dev *pdev) int entry; vbios = xgifb_copy_rom(pdev, &vbios_size); - if (vbios == NULL) { + if (!vbios) { dev_err(&pdev->dev, "Video BIOS not available\n"); return false; } @@ -1059,7 +1056,6 @@ static void XGINew_SetModeScratch(struct vb_device_info *pVBInfo) CR38Data &= ~SetYPbPr; CR38Data |= tempch; xgifb_reg_set(pVBInfo->P3d4, 0x38, CR38Data); - } static unsigned short XGINew_SenseLCD(struct xgi_hw_device_info @@ -1134,7 +1130,6 @@ static void XGINew_GetXG27Sense(struct vb_device_info *pVBInfo) xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xA0); } xgifb_reg_or(pVBInfo->P3d4, 0x32, LCDSense); - } static unsigned char GetXG21FPBits(struct vb_device_info *pVBInfo) @@ -1191,7 +1186,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev) pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; - if (pVBInfo->FBAddr == NULL) { + if (!pVBInfo->FBAddr) { dev_dbg(&pdev->dev, "pVBInfo->FBAddr == 0\n"); return 0; } @@ -1329,14 +1324,12 @@ unsigned char XGIInitNew(struct pci_dev *pdev) XGI_SenseCRT1(pVBInfo); if (HwDeviceExtension->jChipType == XG21) { - xgifb_reg_and_or(pVBInfo->P3d4, 0x32, ~Monitor1Sense, Monitor1Sense); /* Z9 default has CRT */ temp = GetXG21FPBits(pVBInfo); xgifb_reg_and_or(pVBInfo->P3d4, 0x37, ~0x01, temp); - } if (HwDeviceExtension->jChipType == XG27) { xgifb_reg_and_or(pVBInfo->P3d4, diff --git a/kernel/drivers/staging/xgifb/vb_init.h b/kernel/drivers/staging/xgifb/vb_init.h index 24573026a..500cabe41 100644 --- a/kernel/drivers/staging/xgifb/vb_init.h +++ b/kernel/drivers/staging/xgifb/vb_init.h @@ -1,6 +1,6 @@ #ifndef _VBINIT_ #define _VBINIT_ -extern unsigned char XGIInitNew(struct pci_dev *pdev); -extern void XGIRegInit(struct vb_device_info *, unsigned long); +unsigned char XGIInitNew(struct pci_dev *pdev); +void XGIRegInit(struct vb_device_info *, unsigned long); #endif diff --git a/kernel/drivers/staging/xgifb/vb_setmode.c b/kernel/drivers/staging/xgifb/vb_setmode.c index a47395e92..c886dd289 100644 --- a/kernel/drivers/staging/xgifb/vb_setmode.c +++ b/kernel/drivers/staging/xgifb/vb_setmode.c @@ -940,7 +940,7 @@ static void XGI_SetCRT1FIFO(struct xgi_hw_device_info *HwDeviceExtension, data = xgifb_reg_get(pVBInfo->P3c4, 0x3D); data &= 0xfe; - xgifb_reg_set(pVBInfo->P3c4, 0x3D, data); /* diable auto-threshold */ + xgifb_reg_set(pVBInfo->P3c4, 0x3D, data); /* disable auto-threshold */ xgifb_reg_set(pVBInfo->P3c4, 0x08, 0x34); data = xgifb_reg_get(pVBInfo->P3c4, 0x09); @@ -1081,24 +1081,17 @@ static void XGI_WriteDAC(unsigned short dl, unsigned short dh, struct vb_device_info *pVBInfo) { - unsigned short temp, bh, bl; + unsigned short bh, bl; bh = ah; bl = al; if (dl != 0) { - temp = bh; - bh = dh; - dh = temp; - if (dl == 1) { - temp = bl; - bl = dh; - dh = temp; - } else { - temp = bl; - bl = bh; - bh = temp; - } + swap(bh, dh); + if (dl == 1) + swap(bl, dh); + else + swap(bl, bh); } outb((unsigned short) dh, pVBInfo->P3c9); outb((unsigned short) bh, pVBInfo->P3c9); diff --git a/kernel/drivers/staging/xgifb/vb_setmode.h b/kernel/drivers/staging/xgifb/vb_setmode.h index 5301bec64..6f082a7a5 100644 --- a/kernel/drivers/staging/xgifb/vb_setmode.h +++ b/kernel/drivers/staging/xgifb/vb_setmode.h @@ -1,23 +1,23 @@ #ifndef _VBSETMODE_ #define _VBSETMODE_ -extern void InitTo330Pointer(unsigned char, struct vb_device_info *); -extern void XGI_UnLockCRT2(struct vb_device_info *); -extern void XGI_LockCRT2(struct vb_device_info *); -extern void XGI_DisplayOff(struct xgifb_video_info *, - struct xgi_hw_device_info *, - struct vb_device_info *); -extern void XGI_GetVBType(struct vb_device_info *); -extern void XGI_SenseCRT1(struct vb_device_info *); -extern unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, - struct xgi_hw_device_info *HwDeviceExtension, - unsigned short ModeNo); +void InitTo330Pointer(unsigned char, struct vb_device_info *); +void XGI_UnLockCRT2(struct vb_device_info *); +void XGI_LockCRT2(struct vb_device_info *); +void XGI_DisplayOff(struct xgifb_video_info *, + struct xgi_hw_device_info *, + struct vb_device_info *); +void XGI_GetVBType(struct vb_device_info *); +void XGI_SenseCRT1(struct vb_device_info *); +unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, + struct xgi_hw_device_info *HwDeviceExtension, + unsigned short ModeNo); -extern unsigned char XGI_SearchModeID(unsigned short ModeNo, - unsigned short *ModeIdIndex); -extern unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, - unsigned short ModeNo, - unsigned short ModeIdIndex, - struct vb_device_info *); +unsigned char XGI_SearchModeID(unsigned short ModeNo, + unsigned short *ModeIdIndex); +unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, + unsigned short ModeNo, + unsigned short ModeIdIndex, + struct vb_device_info *); #endif diff --git a/kernel/drivers/staging/xgifb/vb_util.c b/kernel/drivers/staging/xgifb/vb_util.c deleted file mode 100644 index be3437ca3..000000000 --- a/kernel/drivers/staging/xgifb/vb_util.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "vgatypes.h" -#include "vb_util.h" - -void xgifb_reg_set(unsigned long port, u8 index, u8 data) -{ - outb(index, port); - outb(data, port + 1); -} - -u8 xgifb_reg_get(unsigned long port, u8 index) -{ - outb(index, port); - return inb(port + 1); -} - -void xgifb_reg_and_or(unsigned long port, u8 index, - unsigned data_and, unsigned data_or) -{ - u8 temp; - - temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */ - temp = (temp & data_and) | data_or; - xgifb_reg_set(port, index, temp); -} - -void xgifb_reg_and(unsigned long port, u8 index, unsigned data_and) -{ - u8 temp; - - temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */ - temp &= data_and; - xgifb_reg_set(port, index, temp); -} - -void xgifb_reg_or(unsigned long port, u8 index, unsigned data_or) -{ - u8 temp; - - temp = xgifb_reg_get(port, index); /* XGINew_Part1Port index 02 */ - temp |= data_or; - xgifb_reg_set(port, index, temp); -} diff --git a/kernel/drivers/staging/xgifb/vb_util.h b/kernel/drivers/staging/xgifb/vb_util.h index 9161de1d3..f613f54d5 100644 --- a/kernel/drivers/staging/xgifb/vb_util.h +++ b/kernel/drivers/staging/xgifb/vb_util.h @@ -1,9 +1,43 @@ #ifndef _VBUTIL_ #define _VBUTIL_ -extern void xgifb_reg_set(unsigned long, u8, u8); -extern u8 xgifb_reg_get(unsigned long, u8); -extern void xgifb_reg_or(unsigned long, u8, unsigned); -extern void xgifb_reg_and(unsigned long, u8, unsigned); -extern void xgifb_reg_and_or(unsigned long, u8, unsigned, unsigned); +static inline void xgifb_reg_set(unsigned long port, u8 index, u8 data) +{ + outb(index, port); + outb(data, port + 1); +} + +static inline u8 xgifb_reg_get(unsigned long port, u8 index) +{ + outb(index, port); + return inb(port + 1); +} + +static inline void xgifb_reg_and_or(unsigned long port, u8 index, + unsigned data_and, unsigned data_or) +{ + u8 temp; + + temp = xgifb_reg_get(port, index); + temp = (u8) ((temp & data_and) | data_or); + xgifb_reg_set(port, index, temp); +} + +static inline void xgifb_reg_and(unsigned long port, u8 index, unsigned data_and) +{ + u8 temp; + + temp = xgifb_reg_get(port, index); + temp = (u8) (temp & data_and); + xgifb_reg_set(port, index, temp); +} + +static inline void xgifb_reg_or(unsigned long port, u8 index, unsigned data_or) +{ + u8 temp; + + temp = xgifb_reg_get(port, index); + temp |= data_or; + xgifb_reg_set(port, index, temp); +} #endif |