summaryrefslogtreecommitdiff
path: root/drivers/staging/xgifb/XGI_main_26.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-26 18:14:49 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-26 18:14:49 (GMT)
commitb13bc8dda81c54a66a1c84e66f60b8feba659f28 (patch)
tree100a26eada424fa5d9b0e5eaaf4e23b8fa036fc8 /drivers/staging/xgifb/XGI_main_26.c
parent9fc377799bc9bfd8d5cb35d0d1ea2e2458cbdbb3 (diff)
parent419e9266884fa853179ab726c27a63a9d3ae46e3 (diff)
downloadlinux-fsl-qoriq-b13bc8dda81c54a66a1c84e66f60b8feba659f28.tar.xz
Merge tag 'staging-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging tree patches from Greg Kroah-Hartman: "Here's the big staging tree merge for the 3.6-rc1 merge window. There are some patches in here outside of drivers/staging/, notibly the iio code (which is still stradeling the staging / not staging boundry), the pstore code, and the tracing code. All of these have gotten acks from the various subsystem maintainers to be included in this tree. The pstore and tracing patches are related, and are coming here as they replace one of the android staging drivers. Otherwise, the normal staging mess. Lots of cleanups and a few new drivers (some iio drivers, and the large csr wireless driver abomination.) Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" Fixed up trivial conflicts in drivers/staging/comedi/drivers/s626.h and drivers/staging/gdm72xx/netlink_k.c * tag 'staging-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1108 commits) staging: csr: delete a bunch of unused library functions staging: csr: remove csr_utf16.c staging: csr: remove csr_pmem.h staging: csr: remove CsrPmemAlloc staging: csr: remove CsrPmemFree() staging: csr: remove CsrMemAllocDma() staging: csr: remove CsrMemCalloc() staging: csr: remove CsrMemAlloc() staging: csr: remove CsrMemFree() and CsrMemFreeDma() staging: csr: remove csr_util.h staging: csr: remove CsrOffSetOf() stating: csr: remove unneeded #includes in csr_util.c staging: csr: make CsrUInt16ToHex static staging: csr: remove CsrMemCpy() staging: csr: remove CsrStrLen() staging: csr: remove CsrVsnprintf() staging: csr: remove CsrStrDup staging: csr: remove CsrStrChr() staging: csr: remove CsrStrNCmp staging: csr: remove CsrStrCmp ...
Diffstat (limited to 'drivers/staging/xgifb/XGI_main_26.c')
-rw-r--r--drivers/staging/xgifb/XGI_main_26.c492
1 files changed, 153 insertions, 339 deletions
diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 85dbf32..64ffd70 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -6,36 +6,12 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-/* #include <linux/config.h> */
#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/kernel.h>
-#include <linux/spinlock.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/tty.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/fb.h>
-#include <linux/console.h>
-#include <linux/selection.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/vt_kern.h>
-#include <linux/capability.h>
-#include <linux/fs.h>
-#include <linux/types.h>
-#include <linux/proc_fs.h>
-
-#include <linux/io.h>
+
#ifdef CONFIG_MTRR
#include <asm/mtrr.h>
#endif
-#include "XGIfb.h"
-#include "vgatypes.h"
#include "XGI_main.h"
#include "vb_init.h"
#include "vb_util.h"
@@ -54,86 +30,24 @@ static unsigned int refresh_rate;
/* -------------------- Macro definitions ---------------------------- */
-#undef XGIFBDEBUG
-
-#ifdef XGIFBDEBUG
-#define DPRINTK(fmt, args...) pr_debug("%s: " fmt, __func__ , ## args)
-#else
-#define DPRINTK(fmt, args...)
-#endif
-
-#ifdef XGIFBDEBUG
+#ifdef DEBUG
static void dumpVGAReg(void)
{
u8 i, reg;
xgifb_reg_set(XGISR, 0x05, 0x86);
- /*
- xgifb_reg_set(XGISR, 0x08, 0x4f);
- xgifb_reg_set(XGISR, 0x0f, 0x20);
- xgifb_reg_set(XGISR, 0x11, 0x4f);
- xgifb_reg_set(XGISR, 0x13, 0x45);
- xgifb_reg_set(XGISR, 0x14, 0x51);
- xgifb_reg_set(XGISR, 0x1e, 0x41);
- xgifb_reg_set(XGISR, 0x1f, 0x0);
- xgifb_reg_set(XGISR, 0x20, 0xa1);
- xgifb_reg_set(XGISR, 0x22, 0xfb);
- xgifb_reg_set(XGISR, 0x26, 0x22);
- xgifb_reg_set(XGISR, 0x3e, 0x07);
- */
-
- /* xgifb_reg_set(XGICR, 0x19, 0x00); */
- /* xgifb_reg_set(XGICR, 0x1a, 0x3C); */
- /* xgifb_reg_set(XGICR, 0x22, 0xff); */
- /* xgifb_reg_set(XGICR, 0x3D, 0x10); */
-
- /* xgifb_reg_set(XGICR, 0x4a, 0xf3); */
-
- /* xgifb_reg_set(XGICR, 0x57, 0x0); */
- /* xgifb_reg_set(XGICR, 0x7a, 0x2c); */
-
- /* xgifb_reg_set(XGICR, 0x82, 0xcc); */
- /* xgifb_reg_set(XGICR, 0x8c, 0x0); */
- /*
- xgifb_reg_set(XGICR, 0x99, 0x1);
- xgifb_reg_set(XGICR, 0x41, 0x40);
- */
for (i = 0; i < 0x4f; i++) {
reg = xgifb_reg_get(XGISR, i);
- printk("\no 3c4 %x", i);
- printk("\ni 3c5 => %x", reg);
+ pr_debug("o 3c4 %x\n", i);
+ pr_debug("i 3c5 => %x\n", reg);
}
for (i = 0; i < 0xF0; i++) {
reg = xgifb_reg_get(XGICR, i);
- printk("\no 3d4 %x", i);
- printk("\ni 3d5 => %x", reg);
- }
- /*
- xgifb_reg_set(XGIPART1,0x2F,1);
- for (i=1; i < 0x50; i++) {
- reg = xgifb_reg_get(XGIPART1, i);
- printk("\no d004 %x", i);
- printk("\ni d005 => %x", reg);
- }
-
- for (i=0; i < 0x50; i++) {
- reg = xgifb_reg_get(XGIPART2, i);
- printk("\no d010 %x", i);
- printk("\ni d011 => %x", reg);
- }
- for (i=0; i < 0x50; i++) {
- reg = xgifb_reg_get(XGIPART3, i);
- printk("\no d012 %x",i);
- printk("\ni d013 => %x",reg);
+ pr_debug("o 3d4 %x\n", i);
+ pr_debug("i 3d5 => %x\n", reg);
}
- for (i=0; i < 0x50; i++) {
- reg = xgifb_reg_get(XGIPART4, i);
- printk("\no d014 %x",i);
- printk("\ni d015 => %x",reg);
- }
- */
}
#else
static inline void dumpVGAReg(void)
@@ -141,12 +55,6 @@ static inline void dumpVGAReg(void)
}
#endif
-#if 1
-#define DEBUGPRN(x)
-#else
-#define DEBUGPRN(x) pr_info(x "\n");
-#endif
-
/* --------------- Hardware Access Routines -------------------------- */
static int XGIfb_mode_rate_to_dclock(struct vb_device_info *XGI_Pr,
@@ -253,15 +161,6 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
| ((unsigned short) (sr_data & 0x01) << 10);
A = VT + 2;
- /* cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[10]; */
-
- /* Vertical display enable end */
- /*
- VDE = (cr_data & 0xff) |
- ((unsigned short) (cr_data2 & 0x02) << 7) |
- ((unsigned short) (cr_data2 & 0x40) << 3) |
- ((unsigned short) (sr_data & 0x02) << 9);
- */
VDE = XGI_Pr->RefIndex[RefreshRateTableIndex].YRes - 1;
E = VDE + 1;
@@ -363,28 +262,19 @@ static void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr)
static int XGIfb_GetXG21DefaultLVDSModeIdx(struct xgifb_video_info *xgifb_info)
{
+ int i = 0;
- int found_mode = 0;
- int XGIfb_mode_idx = 0;
-
- found_mode = 0;
- while ((XGIbios_mode[XGIfb_mode_idx].mode_no != 0)
- && (XGIbios_mode[XGIfb_mode_idx].xres
- <= xgifb_info->lvds_data.LVDSHDE)) {
- if ((XGIbios_mode[XGIfb_mode_idx].xres
- == xgifb_info->lvds_data.LVDSHDE)
- && (XGIbios_mode[XGIfb_mode_idx].yres
- == xgifb_info->lvds_data.LVDSVDE)
- && (XGIbios_mode[XGIfb_mode_idx].bpp == 8)) {
- found_mode = 1;
- break;
+ 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;
}
- XGIfb_mode_idx++;
+ i++;
}
- if (!found_mode)
- XGIfb_mode_idx = -1;
- return XGIfb_mode_idx;
+ return -1;
}
static void XGIfb_search_mode(struct xgifb_video_info *xgifb_info,
@@ -415,7 +305,7 @@ invalid_mode:
static void XGIfb_search_vesamode(struct xgifb_video_info *xgifb_info,
unsigned int vesamode)
{
- int i = 0, j = 0;
+ int i = 0;
if (vesamode == 0)
goto invalid;
@@ -426,15 +316,13 @@ static void XGIfb_search_vesamode(struct xgifb_video_info *xgifb_info,
if ((XGIbios_mode[i].vesa_mode_no_1 == vesamode) ||
(XGIbios_mode[i].vesa_mode_no_2 == vesamode)) {
xgifb_info->mode_idx = i;
- j = 1;
- break;
+ return;
}
i++;
}
invalid:
- if (!j)
- pr_info("Invalid VESA mode 0x%x'\n", vesamode);
+ pr_info("Invalid VESA mode 0x%x'\n", vesamode);
}
static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex)
@@ -628,7 +516,7 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex)
if (XGIbios_mode[myindex].yres != 576)
return -1;
}
- /* TW: LVDS/CHRONTEL does not support 720 */
+ /* LVDS/CHRONTEL does not support 720 */
if (xgifb_info->hasVB == HASVB_LVDS_CHRONTEL ||
xgifb_info->hasVB == HASVB_CHRONTEL) {
return -1;
@@ -692,8 +580,8 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info,
break;
} else if (XGIfb_vrate[i].refresh > rate) {
if ((XGIfb_vrate[i].refresh - rate) <= 3) {
- DPRINTK("XGIfb: Adjusting rate from %d up to %d\n",
- rate, XGIfb_vrate[i].refresh);
+ pr_debug("Adjusting rate from %d up to %d\n",
+ rate, XGIfb_vrate[i].refresh);
xgifb_info->rate_idx =
XGIfb_vrate[i].idx;
xgifb_info->refresh_rate =
@@ -701,8 +589,9 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info,
} else if (((rate - XGIfb_vrate[i - 1].refresh)
<= 2) && (XGIfb_vrate[i].idx
!= 1)) {
- DPRINTK("XGIfb: Adjusting rate from %d down to %d\n",
- rate, XGIfb_vrate[i-1].refresh);
+ pr_debug("Adjusting rate from %d down to %d\n",
+ rate,
+ XGIfb_vrate[i-1].refresh);
xgifb_info->rate_idx =
XGIfb_vrate[i - 1].idx;
xgifb_info->refresh_rate =
@@ -710,8 +599,8 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info,
}
break;
} else if ((rate - XGIfb_vrate[i].refresh) <= 2) {
- DPRINTK("XGIfb: Adjusting rate from %d down to %d\n",
- rate, XGIfb_vrate[i].refresh);
+ pr_debug("Adjusting rate from %d down to %d\n",
+ rate, XGIfb_vrate[i].refresh);
xgifb_info->rate_idx = XGIfb_vrate[i].idx;
break;
}
@@ -832,26 +721,25 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info)
{
u8 reg;
unsigned char doit = 1;
- /*
- xgifb_reg_set(XGISR,IND_SIS_PASSWORD,SIS_PASSWORD);
- xgifb_reg_set(XGICR, 0x13, 0x00);
- xgifb_reg_and_or(XGISR,0x0E, 0xF0, 0x01);
- *test*
- */
+
if (xgifb_info->video_bpp == 8) {
- /* TW: We can't switch off CRT1 on LVDS/Chrontel
- * in 8bpp Modes */
+ /*
+ * We can't switch off CRT1 on LVDS/Chrontel
+ * in 8bpp Modes
+ */
if ((xgifb_info->hasVB == HASVB_LVDS) ||
(xgifb_info->hasVB == HASVB_LVDS_CHRONTEL)) {
doit = 0;
}
- /* TW: We can't switch off CRT1 on 301B-DH
- * in 8bpp Modes if using LCD */
+ /*
+ * We can't switch off CRT1 on 301B-DH
+ * in 8bpp Modes if using LCD
+ */
if (xgifb_info->display2 == XGIFB_DISP_LCD)
doit = 0;
}
- /* TW: We can't switch off CRT1 if bridge is in slave mode */
+ /* We can't switch off CRT1 if bridge is in slave mode */
if (xgifb_info->hasVB != HASVB_NONE) {
reg = xgifb_reg_get(XGIPART1, 0x00);
@@ -1025,15 +913,15 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info)
}
if ((filter >= 0) && (filter <= 7)) {
- DPRINTK("FilterTable[%d]-%d: %02x %02x %02x %02x\n",
- filter_tb, filter,
- XGI_TV_filter[filter_tb].
+ pr_debug("FilterTable[%d]-%d: %02x %02x %02x %02x\n",
+ filter_tb, filter,
+ XGI_TV_filter[filter_tb].
filter[filter][0],
- XGI_TV_filter[filter_tb].
+ XGI_TV_filter[filter_tb].
filter[filter][1],
- XGI_TV_filter[filter_tb].
+ XGI_TV_filter[filter_tb].
filter[filter][2],
- XGI_TV_filter[filter_tb].
+ XGI_TV_filter[filter_tb].
filter[filter][3]
);
xgifb_reg_set(
@@ -1076,10 +964,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
unsigned int drate = 0, hrate = 0;
int found_mode = 0;
int old_mode;
- /* unsigned char reg, reg1; */
-
- DEBUGPRN("Inside do_set_var");
- /* printk(KERN_DEBUG "XGIfb:var->yres=%d, var->upper_margin=%d, var->lower_margin=%d, var->vsync_len=%d\n", var->yres, var->upper_margin, var->lower_margin, var->vsync_len); */
info->var.xres_virtual = var->xres_virtual;
info->var.yres_virtual = var->yres_virtual;
@@ -1089,13 +973,9 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
vtotal <<= 1;
else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE)
vtotal <<= 2;
- else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
- /* vtotal <<= 1; */
- /* var->yres <<= 1; */
- }
if (!htotal || !vtotal) {
- DPRINTK("XGIfb: Invalid 'var' information\n");
+ pr_debug("Invalid 'var' information\n");
return -EINVAL;
} pr_debug("var->pixclock=%d, htotal=%d, vtotal=%d\n",
var->pixclock, htotal, vtotal);
@@ -1171,11 +1051,11 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
XGIfb_post_setmode(xgifb_info);
- DPRINTK("XGIfb: Set new mode: %dx%dx%d-%d\n",
- XGIbios_mode[xgifb_info->mode_idx].xres,
- XGIbios_mode[xgifb_info->mode_idx].yres,
- XGIbios_mode[xgifb_info->mode_idx].bpp,
- xgifb_info->refresh_rate);
+ pr_debug("Set new mode: %dx%dx%d-%d\n",
+ XGIbios_mode[xgifb_info->mode_idx].xres,
+ XGIbios_mode[xgifb_info->mode_idx].yres,
+ XGIbios_mode[xgifb_info->mode_idx].bpp,
+ xgifb_info->refresh_rate);
xgifb_info->video_bpp = XGIbios_mode[xgifb_info->mode_idx].bpp;
xgifb_info->video_vwidth = info->var.xres_virtual;
@@ -1217,13 +1097,12 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
break;
default:
xgifb_info->video_cmap_len = 16;
- pr_err("Unsupported depth %d",
+ pr_err("Unsupported depth %d\n",
xgifb_info->video_bpp);
break;
}
}
XGIfb_bpp_to_var(xgifb_info, var); /*update ARGB info*/
- DEBUGPRN("End of do_set_var");
dumpVGAReg();
return 0;
@@ -1234,8 +1113,6 @@ static int XGIfb_pan_var(struct fb_var_screeninfo *var, struct fb_info *info)
struct xgifb_video_info *xgifb_info = info->par;
unsigned int base;
- /* printk("Inside pan_var"); */
-
base = var->yoffset * info->var.xres_virtual + var->xoffset;
/* calculate base bpp dep. */
@@ -1269,7 +1146,6 @@ static int XGIfb_pan_var(struct fb_var_screeninfo *var, struct fb_info *info)
0x7F,
((base >> 24) & 0x01) << 7);
}
- /* printk("End of pan_var"); */
return 0;
}
@@ -1345,13 +1221,21 @@ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con,
{
struct xgifb_video_info *xgifb_info = info->par;
- DEBUGPRN("inside get_fix");
memset(fix, 0, sizeof(struct fb_fix_screeninfo));
- fix->smem_start = xgifb_info->video_base;
+ strncpy(fix->id, "XGI", sizeof(fix->id) - 1);
+ /* if register_framebuffer has been called, we must lock */
+ if (atomic_read(&info->count))
+ mutex_lock(&info->mm_lock);
+
+ fix->smem_start = xgifb_info->video_base;
fix->smem_len = xgifb_info->video_size;
+ /* if register_framebuffer has been called, we can unlock */
+ if (atomic_read(&info->count))
+ mutex_unlock(&info->mm_lock);
+
fix->type = FB_TYPE_PACKED_PIXELS;
fix->type_aux = 0;
if (xgifb_info->video_bpp == 8)
@@ -1367,7 +1251,6 @@ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con,
fix->mmio_len = xgifb_info->mmio_size;
fix->accel = FB_ACCEL_SIS_XABRE;
- DEBUGPRN("end of get_fix");
return 0;
}
@@ -1375,12 +1258,10 @@ static int XGIfb_set_par(struct fb_info *info)
{
int err;
- /* printk("XGIfb: inside set_par\n"); */
err = XGIfb_do_set_var(&info->var, 1, info);
if (err)
return err;
XGIfb_get_fix(&info->fix, -1, info);
- /* printk("XGIfb: end of set_par\n"); */
return 0;
}
@@ -1394,8 +1275,6 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
int found_mode = 0;
int refresh_rate, search_idx;
- DEBUGPRN("Inside check_var");
-
if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) {
vtotal = var->upper_margin + var->yres + var->lower_margin
+ var->vsync_len;
@@ -1411,8 +1290,10 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
vtotal = var->upper_margin + var->yres + var->lower_margin
+ var->vsync_len;
- if (!(htotal) || !(vtotal))
- XGIFAIL("XGIfb: no valid timing data");
+ if (!(htotal) || !(vtotal)) {
+ pr_debug("No valid timing data\n");
+ return -EINVAL;
+ }
if (var->pixclock && htotal && vtotal) {
drate = 1000000000 / var->pixclock;
@@ -1428,16 +1309,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
xgifb_info->refresh_rate = 60;
}
- /*
- if ((var->pixclock) && (htotal)) {
- drate = 1E12 / var->pixclock;
- hrate = drate / htotal;
- refresh_rate = (unsigned int) (hrate / vtotal * 2 + 0.5);
- } else {
- refresh_rate = 60;
- }
- */
- /* TW: Calculation wrong for 1024x600 - force it to 60Hz */
+ /* Calculation wrong for 1024x600 - force it to 60Hz */
if ((var->xres == 1024) && (var->yres == 600))
refresh_rate = 60;
@@ -1486,8 +1358,6 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
}
}
- /* TW: TODO: Check the refresh rate */
-
/* Adapt RGB settings */
XGIfb_bpp_to_var(xgifb_info, var);
@@ -1502,16 +1372,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
var->xres_virtual = var->xres;
if (var->yres != var->yres_virtual)
var->yres_virtual = var->yres;
- } /* else { */
- /* TW: Now patch yres_virtual if we use panning */
- /* May I do this? */
- /* var->yres_virtual = xgifb_info->heapstart /
- (var->xres * (var->bits_per_pixel >> 3)); */
- /* if (var->yres_virtual <= var->yres) { */
- /* TW: Paranoia check */
- /* var->yres_virtual = var->yres; */
- /* } */
- /* } */
+ }
/* Truncate offsets to maximum if too high */
if (var->xoffset > var->xres_virtual - var->xres)
@@ -1526,7 +1387,6 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
var->blue.msb_right =
var->transp.offset = var->transp.length = var->transp.msb_right = 0;
- DEBUGPRN("end of check_var");
return 0;
}
@@ -1535,8 +1395,6 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var,
{
int err;
- /* printk("\nInside pan_display:\n"); */
-
if (var->xoffset > (info->var.xres_virtual - info->var.xres))
return -EINVAL;
if (var->yoffset > (info->var.yres_virtual - info->var.yres))
@@ -1563,7 +1421,6 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var,
else
info->var.vmode &= ~FB_VMODE_YWRAP;
- /* printk("End of pan_display\n"); */
return 0;
}
@@ -1597,7 +1454,6 @@ static struct fb_ops XGIfb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
- /* .fb_mmap = XGIfb_mmap, */
};
/* ---------------- Chip generation dependent routines ---------------- */
@@ -1674,9 +1530,6 @@ static int XGIfb_get_dram_size(struct xgifb_video_info *xgifb_info)
}
xgifb_info->video_size = xgifb_info->video_size * ChannelNum;
- /* PLiad fixed for benchmarking and fb set */
- /* xgifb_info->video_size = 0x200000; */ /* 1024x768x16 */
- /* xgifb_info->video_size = 0x1000000; */ /* benchmark */
pr_info("SR14=%x DramSzie %x ChannelNum %x\n",
reg,
@@ -1691,16 +1544,6 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info)
xgifb_info->TV_plug = xgifb_info->TV_type = 0;
- switch (xgifb_info->hasVB) {
- case HASVB_LVDS_CHRONTEL:
- case HASVB_CHRONTEL:
- break;
- case HASVB_301:
- case HASVB_302:
- /* XGI_Sense30x(); */ /* Yi-Lin TV Sense? */
- break;
- }
-
cr32 = xgifb_reg_get(XGICR, IND_XGI_SCRATCH_REG_CR32);
if ((cr32 & SIS_CRT1) && !XGIfb_crt1off)
@@ -1724,7 +1567,7 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info)
}
if (XGIfb_tvplug != -1)
- /* PR/TW: Override with option */
+ /* Override with option */
xgifb_info->TV_plug = XGIfb_tvplug;
else if (cr32 & SIS_VB_HIVISION) {
xgifb_info->TV_type = TVMODE_HIVISION;
@@ -1744,7 +1587,7 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info)
xgifb_info->TV_type = TVMODE_NTSC;
}
- /* TW: Copy forceCRT1 option to CRT1off if option is given */
+ /* Copy forceCRT1 option to CRT1off if option is given */
if (XGIfb_forcecrt1 != -1) {
if (XGIfb_forcecrt1)
XGIfb_crt1off = 0;
@@ -1796,7 +1639,7 @@ static int __init xgifb_optval(char *fullopt, int validx)
unsigned long lres;
if (kstrtoul(fullopt + validx, 0, &lres) < 0 || lres > INT_MAX) {
- pr_err("xgifb: invalid value for option: %s\n", fullopt);
+ pr_err("Invalid value for option: %s\n", fullopt);
return 0;
}
return lres;
@@ -1809,7 +1652,7 @@ static int __init XGIfb_setup(char *options)
if (!options || !*options)
return 0;
- pr_info("xgifb: options: %s\n", options);
+ pr_info("Options: %s\n", options);
while ((this_opt = strsep(&options, ",")) != NULL) {
@@ -1838,7 +1681,7 @@ static int __init XGIfb_setup(char *options)
XGIfb_search_tvstd(this_opt + 7);
} else if (!strncmp(this_opt, "dstn", 4)) {
enable_dstn = 1;
- /* TW: DSTN overrules forcecrt2type */
+ /* DSTN overrules forcecrt2type */
XGIfb_crt2type = XGIFB_DISP_LCD;
} else if (!strncmp(this_opt, "noypan", 6)) {
XGIfb_ypan = 0;
@@ -1882,9 +1725,9 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
xgifb_info->mmio_base = pci_resource_start(pdev, 1);
xgifb_info->mmio_size = pci_resource_len(pdev, 1);
xgifb_info->vga_base = pci_resource_start(pdev, 2) + 0x30;
- pr_info("Relocate IO address: %Lx [%08lx]\n",
- (u64) pci_resource_start(pdev, 2),
- xgifb_info->vga_base);
+ dev_info(&pdev->dev, "Relocate IO address: %Lx [%08lx]\n",
+ (u64) pci_resource_start(pdev, 2),
+ xgifb_info->vga_base);
if (pci_enable_device(pdev)) {
ret = -EIO;
@@ -1902,9 +1745,9 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
reg1 = xgifb_reg_get(XGISR, IND_SIS_PASSWORD);
if (reg1 != 0xa1) { /*I/O error */
- pr_err("I/O error!!!");
+ dev_err(&pdev->dev, "I/O error\n");
ret = -EIO;
- goto error;
+ goto error_disable;
}
switch (xgifb_info->chip_id) {
@@ -1927,16 +1770,17 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
break;
default:
ret = -ENODEV;
- goto error;
+ goto error_disable;
}
- pr_info("chipid = %x\n", xgifb_info->chip);
+ dev_info(&pdev->dev, "chipid = %x\n", xgifb_info->chip);
hw_info->jChipType = xgifb_info->chip;
if (XGIfb_get_dram_size(xgifb_info)) {
- pr_err("Fatal error: Unable to determine RAM size.\n");
+ dev_err(&pdev->dev,
+ "Fatal error: Unable to determine RAM size.\n");
ret = -ENODEV;
- goto error;
+ goto error_disable;
}
/* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */
@@ -1951,18 +1795,20 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
if (!request_mem_region(xgifb_info->video_base,
xgifb_info->video_size,
"XGIfb FB")) {
- pr_err("unable request memory size %x\n",
+ dev_err(&pdev->dev, "Unable request memory size %x\n",
xgifb_info->video_size);
- pr_err("Fatal error: Unable to reserve frame buffer memory\n");
- pr_err("Is there another framebuffer driver active?\n");
+ dev_err(&pdev->dev,
+ "Fatal error: Unable to reserve frame buffer memory. "
+ "Is there another framebuffer driver active?\n");
ret = -ENODEV;
- goto error;
+ goto error_disable;
}
if (!request_mem_region(xgifb_info->mmio_base,
xgifb_info->mmio_size,
"XGIfb MMIO")) {
- pr_err("Fatal error: Unable to reserve MMIO region\n");
+ dev_err(&pdev->dev,
+ "Fatal error: Unable to reserve MMIO region\n");
ret = -ENODEV;
goto error_0;
}
@@ -1972,18 +1818,20 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
xgifb_info->mmio_vbase = ioremap(xgifb_info->mmio_base,
xgifb_info->mmio_size);
- pr_info("Framebuffer at 0x%Lx, mapped to 0x%p, size %dk\n",
- (u64) xgifb_info->video_base,
- xgifb_info->video_vbase,
- xgifb_info->video_size / 1024);
+ dev_info(&pdev->dev,
+ "Framebuffer at 0x%Lx, mapped to 0x%p, size %dk\n",
+ (u64) xgifb_info->video_base,
+ xgifb_info->video_vbase,
+ xgifb_info->video_size / 1024);
- pr_info("MMIO at 0x%Lx, mapped to 0x%p, size %ldk\n",
- (u64) xgifb_info->mmio_base, xgifb_info->mmio_vbase,
- xgifb_info->mmio_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,
+ xgifb_info->mmio_size / 1024);
pci_set_drvdata(pdev, xgifb_info);
if (!XGIInitNew(pdev))
- pr_err("XGIInitNew() failed!\n");
+ dev_err(&pdev->dev, "XGIInitNew() failed!\n");
xgifb_info->mtrr = (unsigned int) 0;
@@ -2012,29 +1860,31 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
reg = xgifb_reg_get(XGIPART4, 0x01);
if (reg >= 0xE0) {
hw_info->ujVBChipID = VB_CHIP_302LV;
- pr_info("XGI302LV bridge detected (revision 0x%02x)\n", reg);
+ dev_info(&pdev->dev,
+ "XGI302LV bridge detected (revision 0x%02x)\n",
+ reg);
} else if (reg >= 0xD0) {
hw_info->ujVBChipID = VB_CHIP_301LV;
- pr_info("XGI301LV bridge detected (revision 0x%02x)\n", reg);
- }
- /* else if (reg >= 0xB0) {
- hw_info->ujVBChipID = VB_CHIP_301B;
- reg1 = xgifb_reg_get(XGIPART4, 0x23);
- printk("XGIfb: XGI301B bridge detected\n");
- } */
- else {
+ dev_info(&pdev->dev,
+ "XGI301LV bridge detected (revision 0x%02x)\n",
+ reg);
+ } else {
hw_info->ujVBChipID = VB_CHIP_301;
- pr_info("XGI301 bridge detected\n");
+ dev_info(&pdev->dev, "XGI301 bridge detected\n");
}
break;
case HASVB_302:
reg = xgifb_reg_get(XGIPART4, 0x01);
if (reg >= 0xE0) {
hw_info->ujVBChipID = VB_CHIP_302LV;
- pr_info("XGI302LV bridge detected (revision 0x%02x)\n", reg);
+ dev_info(&pdev->dev,
+ "XGI302LV bridge detected (revision 0x%02x)\n",
+ reg);
} else if (reg >= 0xD0) {
hw_info->ujVBChipID = VB_CHIP_301LV;
- pr_info("XGI302LV bridge detected (revision 0x%02x)\n", reg);
+ dev_info(&pdev->dev,
+ "XGI302LV bridge detected (revision 0x%02x)\n",
+ reg);
} else if (reg >= 0xB0) {
reg1 = xgifb_reg_get(XGIPART4, 0x23);
@@ -2042,27 +1892,28 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
} else {
hw_info->ujVBChipID = VB_CHIP_302;
- pr_info("XGI302 bridge detected\n");
+ dev_info(&pdev->dev, "XGI302 bridge detected\n");
}
break;
case HASVB_LVDS:
hw_info->ulExternalChip = 0x1;
- pr_info("LVDS transmitter detected\n");
+ dev_info(&pdev->dev, "LVDS transmitter detected\n");
break;
case HASVB_TRUMPION:
hw_info->ulExternalChip = 0x2;
- pr_info("Trumpion Zurac LVDS scaler detected\n");
+ dev_info(&pdev->dev, "Trumpion Zurac LVDS scaler detected\n");
break;
case HASVB_CHRONTEL:
hw_info->ulExternalChip = 0x4;
- pr_info("Chrontel TV encoder detected\n");
+ dev_info(&pdev->dev, "Chrontel TV encoder detected\n");
break;
case HASVB_LVDS_CHRONTEL:
hw_info->ulExternalChip = 0x5;
- pr_info("LVDS transmitter and Chrontel TV encoder detected\n");
+ dev_info(&pdev->dev,
+ "LVDS transmitter and Chrontel TV encoder detected\n");
break;
default:
- pr_info("No or unknown bridge type detected\n");
+ dev_info(&pdev->dev, "No or unknown bridge type detected\n");
break;
}
@@ -2079,36 +1930,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
}
}
- if ((hw_info->ujVBChipID == VB_CHIP_302B) ||
- (hw_info->ujVBChipID == VB_CHIP_301LV) ||
- (hw_info->ujVBChipID == VB_CHIP_302LV)) {
- int tmp;
- tmp = xgifb_reg_get(XGICR, 0x34);
- if (tmp <= 0x13) {
- /* Currently on LCDA?
- *(Some BIOSes leave CR38) */
- tmp = xgifb_reg_get(XGICR, 0x38);
- if ((tmp & 0x03) == 0x03) {
- /* XGI_Pr.XGI_UseLCDA = 1; */
- } else {
- /* Currently on LCDA?
- *(Some newer BIOSes set D0 in CR35) */
- tmp = xgifb_reg_get(XGICR, 0x35);
- if (tmp & 0x01) {
- /* XGI_Pr.XGI_UseLCDA = 1; */
- } else {
- tmp = xgifb_reg_get(XGICR,
- 0x30);
- if (tmp & 0x20) {
- tmp = xgifb_reg_get(
- XGIPART1, 0x13);
- }
- }
- }
- }
-
- }
-
xgifb_info->mode_idx = -1;
if (mode)
@@ -2130,11 +1951,11 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
}
if (xgifb_info->mode_idx < 0) {
- dev_err(&pdev->dev, "no supported video mode found\n");
+ dev_err(&pdev->dev, "No supported video mode found\n");
goto error_1;
}
- /* yilin set default refresh rate */
+ /* set default refresh rate */
xgifb_info->refresh_rate = refresh_rate;
if (xgifb_info->refresh_rate == 0)
xgifb_info->refresh_rate = 60;
@@ -2230,11 +2051,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
}
- strncpy(fb_info->fix.id, "XGI", sizeof(fb_info->fix.id) - 1);
- fb_info->fix.type = FB_TYPE_PACKED_PIXELS;
- fb_info->fix.xpanstep = 1;
- fb_info->fix.ypanstep = 1;
-
fb_info->flags = FBINFO_FLAG_DEFAULT;
fb_info->screen_base = xgifb_info->video_vbase;
fb_info->fbops = &XGIfb_ops;
@@ -2247,7 +2063,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
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");
+ dev_info(&pdev->dev, "Added MTRR\n");
#endif
if (register_framebuffer(fb_info) < 0) {
@@ -2271,6 +2087,8 @@ error_1:
release_mem_region(xgifb_info->mmio_base, xgifb_info->mmio_size);
error_0:
release_mem_region(xgifb_info->video_base, xgifb_info->video_size);
+error_disable:
+ pci_disable_device(pdev);
error:
framebuffer_release(fb_info);
return ret;
@@ -2295,6 +2113,7 @@ static void __devexit xgifb_remove(struct pci_dev *pdev)
iounmap(xgifb_info->video_vbase);
release_mem_region(xgifb_info->mmio_base, xgifb_info->mmio_size);
release_mem_region(xgifb_info->video_base, xgifb_info->video_size);
+ pci_disable_device(pdev);
framebuffer_release(fb_info);
pci_set_drvdata(pdev, NULL);
}
@@ -2306,51 +2125,44 @@ static struct pci_driver xgifb_driver = {
.remove = __devexit_p(xgifb_remove)
};
-static int __init xgifb_init(void)
-{
- char *option = NULL;
- if (forcecrt2type != NULL)
- XGIfb_search_crt2type(forcecrt2type);
- if (fb_get_options("xgifb", &option))
- return -ENODEV;
- XGIfb_setup(option);
-
- return pci_register_driver(&xgifb_driver);
-}
-
-module_init(xgifb_init);
/*****************************************************/
/* MODULE */
/*****************************************************/
-#ifdef MODULE
-
-MODULE_DESCRIPTION("Z7 Z9 Z9S Z11 framebuffer device driver");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("XGITECH , Others");
-
module_param(mode, charp, 0);
-module_param(vesa, int, 0);
-module_param(filter, int, 0);
-module_param(forcecrt2type, charp, 0);
+MODULE_PARM_DESC(mode,
+ "Selects the desired default display mode in the format XxYxDepth "
+ "(eg. 1024x768x16).");
+module_param(forcecrt2type, charp, 0);
MODULE_PARM_DESC(forcecrt2type,
- "\nForce the second display output type. Possible values are NONE,\n"
- "LCD, TV, VGA, SVIDEO or COMPOSITE.\n");
-
-MODULE_PARM_DESC(mode,
- "\nSelects the desired default display mode in the format XxYxDepth,\n"
- "eg. 1024x768x16.\n");
+ "Force the second display output type. Possible values are NONE, "
+ "LCD, TV, VGA, SVIDEO or COMPOSITE.");
+module_param(vesa, int, 0);
MODULE_PARM_DESC(vesa,
- "\nSelects the desired default display mode by VESA mode number, eg.\n"
- "0x117.\n");
+ "Selects the desired default display mode by VESA mode number "
+ "(eg. 0x117).");
+module_param(filter, int, 0);
MODULE_PARM_DESC(filter,
- "\nSelects TV flicker filter type (only for systems with a SiS301 video bridge).\n"
- "(Possible values 0-7, default: [no filter])\n");
+ "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)
+{
+ char *option = NULL;
+
+ if (forcecrt2type != NULL)
+ XGIfb_search_crt2type(forcecrt2type);
+ if (fb_get_options("xgifb", &option))
+ return -ENODEV;
+ XGIfb_setup(option);
+
+ return pci_register_driver(&xgifb_driver);
+}
static void __exit xgifb_remove_module(void)
{
@@ -2358,6 +2170,8 @@ static void __exit xgifb_remove_module(void)
pr_debug("Module unloaded\n");
}
+MODULE_DESCRIPTION("Z7 Z9 Z9S Z11 framebuffer device driver");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("XGITECH , Others");
+module_init(xgifb_init);
module_exit(xgifb_remove_module);
-
-#endif /* /MODULE */