Commit graph

528 commits

Author SHA1 Message Date
Peter Huewe e44adfdb67 staging/xgifb: Simplify XGISetModeNew
This patch simplifies the code of XGISetModeNew by reordering the
if/else if/case conditions when both branches are doing exactly the
same.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:28 -08:00
Peter Huewe 06cc47b90b staging/xgifb: Consolidate XGI_EnableChISLCD and XGI_DisableChISLCD
These two functions share the same code except one line - thus we can
simply merge them and add a parameter to switch between both variants.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:28 -08:00
Peter Huewe 5d1c2a9b28 staging/xgifb: Remove unnecessary bitshifts in XGI_SetCRT1ModeRegs
Since data can only be 0x0000, 0x0035 or 0x0048 we can simply skip the
bit shifting and masking as data & 0xFF is always equal to data and
data & 0xFF00 is always 0.
So we simply use data and 0 directly and save the assignment.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:28 -08:00
Peter Huewe a5e080b83e staging/xgifb: remove unnecessary temp variable in XGIfb_mode_rate_to_ddata
Instead of subtracting one and then assign a different name and add 1
again we simply use HDE directly. HDE wasn't used directly before, so no
change in functionality.
Same applies to VDE.

-> now we can remove the variable with the very descriptive name E ;)

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:27 -08:00
Peter Huewe bae31702cd staging/xgifb: rewrite XGIfb_get_cmap_len
We don't need to use this switch-case here for a simple two case
if-else.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:27 -08:00
Peter Huewe 76a5899b0c staging/xgifb: Simplify XGI_SetSeqRegs
Since SR[0] in the (readonly) XGI330_StandTable is always 0x01 we can
skip or'ing with 0x01 and make the code simpler by removing the if
statements.

Since this function is the only user of the XGI330_StandTable we can
also include the unconditional |= 0x20 into the input data and move the
assignment to SR1 into the loop, which I prefer to start at 0.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:27 -08:00
Peter Huewe fd1bbbb79e staging/xgifb: Fix return of uninitialized variable
Clang warning:
drivers/staging/xgifb/XGI_main_26.c: warning: variable 'ret' is
used uninitialized whenever 'if' condition:
	if (xgifb_info->mode_idx < 0) {
evaluates to true.

drivers/staging/xgifb/XGI_main_26.c:
note: uninitialized use occurs here
	return ret;

This patch initializes the variable in this case.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:27 -08:00
Peter Huewe 8cedcc7022 staging/xgifb: mttr must be (signed) int
The mttr field must be declared as signed int (as in every other fb
driver) for the mttr functions to work properly.
Moreover the value should be initialized with -1.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:27 -08:00
Peter Huewe 44e1312c68 staging/xgifb: Remove always false comparisons
This patch removes some comparisons that always evaluate to false since
xoffset and yoffset are defined as __u32 in fb_var_screeninfo in
include/linux/fb.h and thus can never be negative.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:27 -08:00
Peter Huewe f2c22605c5 staging/xgifb: Simplify XGI_GetRatePtrCRT2
Since the smaller LCDRefreshIndex is contained identically in LCDARefreshIndex
we can simply use LCDARefreshIndex and skip the if/else.

Since LCDARefreshIndex is only used readonly and contains only small
unsigned values we also change its declaration to const u8.

In order to prevent an out-of-bounds access I changed the mask from 0x0F
to 0x07 and added a dummy value.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:27 -08:00
Peter Huewe e2e544c9d5 staging/xgifb: remove unused variables
XGI_P3cc is unused and the assignment without side effects -> remove;
Data can be simply replaced by the Temp variable, which was changed to
temp in order to make checkpatch happy.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-03 19:26:14 -06:00
Peter Huewe 5fc699f608 staging/xgifb: Remove redundant if statement
The code checks twice for if (pVBInfo->VBInfo & SetCRT2ToTV) without any
changes in between -> we can remove the second check.
And while at it we can also save the temp variable and use tempbx
directly.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-03 19:26:14 -06:00
Peter Huewe a9e29e6d41 staging/xgifb: Remove unused variables
Pindex and Pdata are unused -> remove
tempbx is unused -> remove

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-03 19:26:13 -06:00
Peter Huewe ef9a6b99a0 staging/xgifb: Remove unused variable and dead assignment
modeflag is unused in XGI_SetSeqRegs, XGI_GetTVInfo,
  XGI_SetLCDRegs, XGI_GetRatePtrCRT2 -> remove

resinfo is unused in XGI_PreSetGroup1, XGI_SetGroup1, XGI_SetGroup2,
  XGI_SetLCDRegs -> remove

push1,push2 are unused in XGI_SetLCDRegs -> remove

CRT1Index is unused in XGI_PreSetGroup1, XGI_SetLockRegs,
  XGI_SetLCDRegs -> remove

tempcx in XGI_PreSetGroup1 only holds the values 4,5,6
  -> change its type to u8

crt2crtc is unused in XGI_SetGroup2 -> remove

CRT2Index is unused in XGI_GetVCLK2Ptr -> remove.

Assignment to i is dead in XGI_SetSeqRegs since it is not used before
  the next assignment -> remove the dead assignment.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-03 19:26:13 -06:00
Peter Huewe e91b50ecf3 staging/xgifb: Remove unused variable
Index is not used here -> remove.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-03 19:26:13 -06:00
Peter Huewe ecfaa00c00 staging/xgifb: Remove unused variables and dead assignments
The variables A,HBS and VBS are never read in XGIfb_mode_rate_to_ddata
and the assignment has no side effects -> so we can simply remove them.
Removing them causes VT, HT and cr_data3 to be unused -> remove them as well
and remove the assignmens to cr_data which are shadowed by a different
assignment a few lines later.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-03 19:26:13 -06:00
Aaro Koskinen cdbbc618f8 staging: xgifb: delete pVBInfo->BaseAddr
Delete redundant field.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-21 14:00:10 -08:00
Aaro Koskinen b8e1cc5c8d staging: xgifb: do not use pVBInfo->BaseAddr
Use pre-calculated register addresses instead of pVBInfo->BaseAddr.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-21 14:00:10 -08:00
Aaro Koskinen 56810a92c6 staging: xgifb: use XGIRegInit()
Avoid copy-paste and use XGIRegInit() to initialize registers addresses.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-21 14:00:10 -08:00
Bill Pemberton 8db72ff521 staging: xgifb: remove use of __devexit
CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 15:05:12 -08:00
Bill Pemberton 89f6883c70 staging: xgifb: remove use of __devinit
CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 15:05:00 -08:00
Bill Pemberton 2c4ae9d218 staging: xgifb: remove use of __devexit_p
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 15:05:00 -08:00
Aaro Koskinen a68292fce1 staging: xgifb: make remaining data tables const
Remaining vb_table.h data can be trivially made const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:30 -08:00
Aaro Koskinen 1cccd9e41d staging: xgifb: constify Tap4 data
Make Tap4 data const and adjust functions accordingly.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:30 -08:00
Aaro Koskinen ea12b4e077 staging: xgifb: eliminate pVBInfo->AGPReg
Access XGI340_AGPReg directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:30 -08:00
Aaro Koskinen 0904f7f315 staging: xgifb: eliminate pVBInfo->SR16
Inline constant values that are used only once.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:30 -08:00
Aaro Koskinen 5ce24760f6 staging: xgifb: eliminate pVBInfo->CR6B
Access XGI340_CR6B directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:30 -08:00
Aaro Koskinen 38c09652a0 staging: xgifb: eliminate pVBInfo->SR21/22/25
In-line constants that are used only once.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:29 -08:00
Aaro Koskinen c705ea8165 staging: xgifb: eliminate pVBInfo->StResInfo
Delete unused data.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:29 -08:00
Aaro Koskinen e8e6c754e5 staging: xgifb: eliminate pVBInfo->ModeResInfo
Access XGI330_ModeResInfo directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:24 -08:00
Aaro Koskinen 224114c788 staging: xgifb: eliminate pVBInfo->ScreenOffset
Access XGI330_ScreenOffset directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:21 -08:00
Aaro Koskinen acfe093e82 staging: xgifb: eliminate pVBInfo->VCLKData/VBVCLKData
Access XGI_VCLKData and XGI_VBVCLKData directly and make them const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:20 -08:00
Aaro Koskinen 9b04745816 staging: xgifb: eliminate pVBInfo->ECLKData
Access XGI340_ECLKData directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:20 -08:00
Aaro Koskinen 7e29d632f3 staging: xgifb: eliminate pVBInfo->CR6E/6F/89
Eliminate dummy zero read-only global data.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:20 -08:00
Aaro Koskinen 7c5c07a611 staging: xgifb: eliminate pVBInfo->UpdateCRT1
Access XGI_UpdateCRT1Table directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:20 -08:00
Aaro Koskinen 7853bced96 staging: xgifb: eliminate pVBInfo->XGINEWUB_CRT1Table
Access XGI_CRT1Table directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:20 -08:00
Aaro Koskinen a39325d24f staging: xgifb: eliminate pVBInfo->RefIndex
Access XGI330_RefIndex directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:20 -08:00
Aaro Koskinen b397992e88 staging: xgifb: eliminate pVBInfo->EModeIDTable
Access XGI330_EModeIDTable directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:19 -08:00
Aaro Koskinen 3625c9a782 staging: xgifb: eliminate pVBInfo->StandTable
Access XGI330_StandTable directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:19 -08:00
Aaro Koskinen 6154e7f48a staging: xgifb: eliminate global TimingV/TimingH data
Use private data instead of global variables for timing data. Also,
get rid of the single element arrays.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:19 -08:00
Aaro Koskinen 6008f87765 staging: xgifb: refactor XGI_GetLVDSData()
Refactor XGI_GetLVDSData() to avoid nesting and redundant ifs.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:19 -08:00
Aaro Koskinen bdb381ec74 staging: xgifb: vb_init.h: delete redundant declaration
XGI21_LCDCapList does not exist.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:19 -08:00
Aaro Koskinen bdc9eb142c staging: xgifb: constify LCD data
Make read-only LCD data tables const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:19 -08:00
Aaro Koskinen 9d1c629925 staging: xgifb: XGI_GetLcdPtr: pass the table pointer directly
Let the caller pass the table pointer directly instead of using a magic
number to indicate which table to use.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:18 -08:00
Aaro Koskinen 6c27b37091 staging: xgifb: XGI_GetLcdPtr: delete redundant code
tempal is a write-only stack variable, and code touching it can be
deleted.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:18 -08:00
Aaro Koskinen 4736783cca staging: xgifb: XGI_GetLcdPtr: use real pointers for data tables
Use real pointers for LCD data tables to simplify the code.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:18 -08:00
Aaro Koskinen 515e9a603f staging: xgifb: XGI_GetLcdPtr: replace xgifb_epllcd_crt1
Replace xgifb_epllcd_crt1 with two different tables to make further
cleanups easier.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:18 -08:00
Aaro Koskinen 3e779fc949 staging: xgifb: XGI_GetLcdPtr: add separate table for VB_SIS301LV/VB_SIS302LV
Add a separate data table for VB_SIS301LV/VB_SIS302LV to avoid branching
and to make further cleanups easier.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:18 -08:00
Justin P. Mattock 558f758bd2 staging "xgifb" Fix typos.
Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22 11:41:13 -07:00
Aaro Koskinen d42bb0fbd9 staging: xgifb: delete bogus video RAM configuration
The driver reconfigures DRAM size register to 8M (regardless what the
actual size was) once the init has been completed, overwriting the
correct value written during the early init. As a result if the driver
is unloaded and reloaded, the user will be limited to 8M video memory
and may lose some of the available video modes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-13 20:41:57 -07:00
Aaro Koskinen 98f4eade14 staging: xgifb: setup initial video RAM size for systems without BIOS
On embedded systems without a BIOS, the DRAM sizing register is 0 after
the boot, and the driver thinks we have only 1 MB video memory. On such
cases, use the PCI window size for the initial size. This information
is needed only to create the I/O mapping - the driver will later detect
and configure the memory size correctly. Limit the size to 16 MB as it
should be sufficient for all supported video modes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-13 20:41:56 -07:00
Aaro Koskinen 6b2a7e0c9b staging: xgifb: prevent video RAM size exceeding PCI window size
Add a sanity check for the video RAM size. It should fit into the
PCI window.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-12 09:47:09 -07:00
Aaro Koskinen a09f347c6c staging: xgifb: validate the mode against video memory size
It's possible to select video mode that exceeds the available video
memory. This is potentially dangerous, fix by adding a check.

The patch fixes system hangs seen occasionally when playing random videos
with mplayer.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-12 09:45:58 -07:00
Aaro Koskinen a7e46d8b5c staging: xgifb: delete redundant casts
Delete some redundant casts.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:17 -07:00
Aaro Koskinen e8cb03d422 staging: xgifb: use correct type for VBVCLKData
Use correct type to eliminate casting.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:17 -07:00
Aaro Koskinen 8951dadc97 staging: xgifb: delete ISXPDOS
Delete unneeded flag.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:17 -07:00
Aaro Koskinen d21222d186 staging: xgifb: mark constant data with const
Mark some data tables as const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:17 -07:00
Aaro Koskinen 073b61e8c1 staging: xgifb: access static data tables directly
Access some data tables directly instead of using pointers.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:17 -07:00
Aaro Koskinen d3ae5762c6 staging: xgifb: use "else if"
Use "else if" when possible to reduce nesting.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:17 -07:00
Aaro Koskinen 14f7c11187 staging: xgifb: delete XGI_LCDDataTablStruct
Delete an unused structure.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:17 -07:00
Aaro Koskinen 898df16401 staging: xgifb: delete LCDLenList
LCDLenList is redundant. It's only used for modifying a write-only stack
variable. Delete also related #defines.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:17 -07:00
Aaro Koskinen 378fd8a582 staging: xgifb: XGI_GetLcdPtr: delete dead code
Only table values 0..5 are ever used.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:17 -07:00
Aaro Koskinen bc9ffcc2c6 staging: xgifb: delete Chrontel 7017 LCD data
Delete unused Chrontel 7017 LCD data.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:16 -07:00
Aaro Koskinen 18ba866bb4 staging: xgifb: use a real pointer for TV DATAPTR
Replace DATAPTR numbers with a real pointer to make code simpler.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:16 -07:00
Aaro Koskinen 2457254560 staging: xgifb: use proper typing for TV data
There's a dangerous cast from XGI330_TVDataStruct to SiS_TVData. Use
SiS_TVData everywhere, also the data can be made const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:16 -07:00
Aaro Koskinen 6265ee4c0b staging: xgifb: delete Chrontel TV data
Delete unused Chrontel TV data.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:16 -07:00
Aaro Koskinen 56d276cad4 staging: xgifb: XGI_GetTVPtr: drop the table parameter
Only one TV data table is used by the driver, delete unneeded complexity.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:16 -07:00
Aaro Koskinen 4c047ac461 staging: xgifb: avoid copy-pasting LCD data
Share the common data tables instead of having the same data in multiple
tables.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:16 -07:00
Aaro Koskinen 4d8f5ca7d2 staging: xgifb: delete redundant chip type check
All chip type values are covered by (chip >= XG20 || chip >= XG40).

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:16 -07:00
Aaro Koskinen c62c517e51 staging: xgifb: delete some unused #defines
Delete some unused #defines.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:16 -07:00
Aaro Koskinen 31fb40fd13 staging: xgifb: delete IF_DEF_LCDA
IF_DEF_LCDA is always true.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:16 -07:00
Aaro Koskinen 6e90d0570d staging: xgifb: delete IF_DEF_ExpLink
Delete a flag which is never set.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:15 -07:00
Aaro Koskinen 886230c12d staging: xgifb: replace XGI_XG21SetPanelDelay() with mdelay()
Eliminate a trivial wrapper function.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:15 -07:00
Aaro Koskinen 2fd002bc7b staging: xgifb: document some LVDS data delay values
Document some delay values based on the comments in
XGI_XG21SetPanelDelay().

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:15 -07:00
Dan Carpenter 2f123cbcf0 Staging: xgifb: fix bitwise vs logical bug
This is a static checker fix and not something I can test.  The intent
of the code here is to set some bit flags.  For a logical OR the ">> 1"
shift wouldn't make a difference.  So it should be using a bitwise OR.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-14 16:46:33 -07:00
Andy Shevchenko 977310bbc3 staging: xgifb: print small buffers via %*ph
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-13 19:23:18 -07:00
Miguel Gómez f6002041af Staging: xgifb: Remove useless condition.
Remove last if branch in XGIfb_do_set_var(), as it has no action assigned.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:32 -07:00
Miguel Gómez 3bcc246016 Staging: xgifb: Fix coding style.
Fix small coding style warnings in several files.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:32 -07:00
Miguel Gómez e123e46630 Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs().
Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:31 -07:00
Miguel Gómez b1bf998c67 Staging: xgifb: Rework conditions in XGI_EnableBridge().
Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:31 -07:00
Miguel Gómez 470c533896 Staging: xgifb: Rework conditions in XGI_SetLockRegs().
Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:31 -07:00
Miguel Gómez 3339db8a0c Staging: xgifb: Refactor XGI_GetCRT2ResInfo().
Use a goto to remove one level of indentation, fixing style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:31 -07:00
Miguel Gómez f93173515f Staging: xgifb: Rework conditions in XGI_GetVBInfo().
Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:30 -07:00
Miguel Gómez 7eec23a7b3 Staging: xgifb: Refactor XGI_GetVBType().
Refactor XGI_GetVBType() to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:30 -07:00
Miguel Gómez 3b175621a2 Staging: xgifb: Refactor XGI_AjustCRT2Rate().
Refactor some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:30 -07:00
Miguel Gómez 661a6384f8 Staging: xgifb: Rework conditions in XGI_SetATTRegs().
Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:30 -07:00
Miguel Gómez 8afb7d3528 Staging: xgifb: Remove useless always true condition.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:29 -07:00
Miguel Gómez 4362f5becd Staging: xgifb: Remove unneeded var and condition in XGIfb_search_vesamode().
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:29 -07:00
Miguel Gómez 791fef1b30 Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx().
Simplify the code and make it more readable.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:29 -07:00
Miguel Gómez 1cd1703081 Staging: xgifb: Remove useless switch in XGIfb_detect_VB().
The switch performs no action so it can be removed.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:29 -07:00
Miguel Gómez be25aef0ca Staging: xgifb: Improve debug strings.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:28 -07:00
Miguel Gómez 61439fa873 Staging: xgifb: Remove unused struct _chswtable.
Struct _chswtable and the variable mychswtable are not used anywhere, so remove
them.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:28 -07:00
Miguel Gómez 469b43c0a6 Staging: xgifb: Remove LCDA detection in xgifb_probe().
The piece of code that checks for LCDA in xgifb_probe() just checks for some
register values but doesn't really do anything in response to them (the actions
that should be executed are commented).
As nothing is really being done, the code can be safely removed.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:28 -07:00
Miguel Gómez c2dd691eed Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration.
LCD_TYPEs are taken from drivers/video/sis/sis.h, so this enumeration is not
needed.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:27 -07:00
Miguel Gómez 949eb0aeb9 Staging: xgifb: Comment cleaning.
Remove commented code and useless comments. Leave only those with relevant
hints to the code.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:27 -07:00
Miguel Gómez 1918570388 Staging: xgifb: Replace pr_* with dev_* when possible.
Replace pr_* calls with dev_* ones when the device structure is available.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:21 -07:00
Miguel Gómez e054102b9f Staging: xgifb: Fix sparse warnings.
Add include files with function definitions to avoid sparse warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:21 -07:00
Miguel Gómez 448810662a Staging: xgifb: Remove printk usage.
Replace meaninful printks with pr_debug and remove useless ones.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:21 -07:00
Miguel Gómez 47cee13d1d Staging: xgifb: Remove XGIFAIL() macro and its calls.
XGIFAIL() prints a message and returns a value, but it's used only in one
place. Better remove it and replace the call with the macro content.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:20 -07:00
Miguel Gómez 96cd1f8b41 Staging: xgifb: define real dumpVGAReg() content only in DEBUG mode.
Define real content of dumpVGAReg() only in debug mode. Remove old condition.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:20 -07:00
Miguel Gómez d56b4c3dff Staging: xgifb: remove DPRINTK() macro and replace it with pr_debug.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:20 -07:00
Miguel Gómez 67c0bf7ac7 Staging: xgifb: remove DEBUGPRN() macro and its uses.
Remove DEBUGPRN() macro which is defined as empty.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:20 -07:00
Miguel Gómez 560e8788eb Staging: xgifb: reformat module parameter descriptions.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:20 -07:00
Peter Huewe 6d12dae47e staging/xgifb: Cleanup vb_device_info struct
This patch cleans up the vb_device_info struct and the related
functions.
The cleanup decreases the size of the compiled module by
about 10kB.

== Remove fields in vb_device_info that are never read: ==
pOutputSelect
pRGBSenseData
pRGBSenseData2
pVideoSenseData
pVideoSenseData2
pYCSenseData
pYCSenseData2
CR49
pXGINew_I2CDefinition
pCR2E
pCR2F
pCR46
pCR47
pCRD0
pCRDE
pSR40
pSR41
pCR47

=== Remove the corresponding 'constants' ===
XGI330_RGBSenseData
XGI330_RGBSenseData2
XGI330_VideoSenseData
XGI330_VideoSenseData2
XGI330_YCSenseData
XGI330_YCSenseData2
XGI330_CR49
XG40_I2CDefinition
XG21_CR2E
XG21_CR2F
XG21_CR46
XG21_CR47
XG27_CRD0
XG27_CRDE
XGI330_OutputSelect

== Remove 'constant fields' and replace constant value with #define ==
pSR07 = XGI330_SR07 -> 0x18
pSR1F = XGI330_SR1F -> 0
pSR23 = XGI330_SR23 -> 0xf6
pSR24 = XGI330_SR24 -> 0x0d
pSR33 = XGI330_SR33 ->0
pCRT2Data_1_2 = XGI330_CRT2Data_1_2 -> 0
pCRT2Data_4_D = XGI330_CRT2Data_4_D -> 0
pCRT2Data_4_E = XGI330_CRT2Data_4_E -> 0
pCRT2Data_4_10 = XGI330_CRT2Data_4_10 -> 0x80
pSR36 = XG27_SR36 -> 0x30
pCR8F = &XG27_CR8F -> 0x0C
pSR40 = XG27_SR40 -> 0x04
pSR41 = XG27_SR41 ->0x00
pSR31 = XGI330_SR31 -> 0xc0
pSR32 = XGI330_SR32 -> 0xc0
SR25 = XGI330_sr25 -> 0 (we only use XGI330_sr25[0])

== Constant fields with 'dead' code: ==
pSoftSetting is set to XGI330_SoftSetting = 0x30
-> if (*pVBInfo->pSoftSetting & SoftDRAMType) is never true since
SoftDRAMType = 0x80
-> if (*pVBInfo->pSoftSetting & ModeSoftSetting) is never true since
ModeSoftSetting = 0x04
--> remove the code, remove pSoftSetting, remove XGI330_SoftSetting

pDVOSetting is set to XG21_DVOSetting = 0
-> if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) is never true
--> remove the code, remove pDVOSetting, remove XG21_DVOSetting

pXGINew_DRAMTypeDefinition is set to &XG40_DRAMTypeDefinition 0xFF
-> if (*pVBInfo->pXGINew_DRAMTypeDefinition != 0x0C) is always true
--> remove the if and remove pXGINew_DRAMTypeDefinition
remove XG40_DRAMTypeDefinition

== Replace pointer to unsigned char with unsigned char variable
and assign value of referenced pointer: ==
pSR21 -> SR21, remove XGI330_SR21
pSR22 -> SR22, remove XGI330_SR22
pXGINew_CR97 -> XGINew_CR97, remove XG20_CR97, XG27_CR97 and Z11m_CR97

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:15:43 -07:00
Peter Huewe 51f984bc06 staging/xgifb: Use SiS structs
This patch replaces some of the XGI internal structs by their
counterparts in the SiS driver.
XGI330_LVDSDataStruct -> SiS_LVDSData
XGI330_LCDDataStruct -> SiS_LCDData
XGI330_CHTVDataStruct -> SiS_LVDSData

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:15:43 -07:00
Peter Huewe 03f76fc617 staging/xgifb: Replace delay lookup tables with constant values
For TV Devices:
The values taken from XGI_TVDelayList are always overwritten with the
values from XGI_TVDelayList2 since the if condition for using the values
from XGI_TVDelayList2 is identical with the check to enter this scope and
thus always true.
The delay values in XGI_TVDelayList2 is always 0x22 so we
can simply replace it with this constant value.

For LCD Devices:
The LCD_DelayCompensation field is always set to 0x12 so we can simply
replace this field with a constant value.

This saves about 500 bytes in compiled size.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:15:43 -07:00
Peter Huewe 64e2498b6c staging/xgifb: Remove useless function XGI_CloseCRTC
Since XGI_CloseCRTC does not perform anything useful we can simply
remove it.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:15:42 -07:00
Peter Huewe 950725920a staging/xgifb: Simplyfy XGI_GetVCLK2Ptr a bit
This patch simplyfies the XGI_GetVCLK2Ptr a bit by moving the +=25 to
a define and removing statements without effect.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:15:42 -07:00
Peter Huewe f477d3e6bb staging/xgifb: Replace constant arrays with constant values
This patch removes the arrays in XGI_GetVCLK2Ptr which each contain only
one value four times and replaces them with their constant value.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:15:42 -07:00
Peter Huewe d6461e49c0 staging/xgifb: Remove unnecessary fields of XGINew_DDRDRAM_TYPE{340, 20}
Since the first three entries in XGINew_DDRDRAM_TYPE{340,20} are never
used, we can simply remove them;
and instead of passing XGINew_DDRDRAM_TYPE with an index we can simply
pass the value directly to XGINew_SetDRAMSize20Reg.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:15:42 -07:00
Peter Huewe 4e55d0b3ee staging/xgifb: Inline XGINew_SetDRAMSizingType
Since the function XGINew_SetDRAMSizingType is only called from one
location and consist only of 2 valuable lines we can simply inline it
here.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:15:41 -07:00
Peter Huewe 672f5ee27e staging/xgifb: Remove duplicated code from XGINew_DDRSizing340
Since XGINew_SetDRAMSize20Reg now handles both cases we can remove
the code duplication in XGINew_DDRSizing340.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:15:41 -07:00
Peter Huewe 391f695b90 staging/xgifb: Consolidate XGINew_SetDRAMSize{,20}Reg
This patch consolidates the almost identical functions
XGINew_SetDRAMSizeReg and XGINew_SetDRAMSize20Reg as they are
implemented identically except one division factor.

The changed factor is now reflected in the input data.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:15:41 -07:00
Peter Huewe f3ca589baf staging/xgifb: Remove superfluous header includes
This patch removes all unnecessary, redundant and superfluous header
includes from xgifb.

Tested on hp t5325 (XGI Z11)

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:14:49 -07:00
Peter Huewe ac326fb96b staging/xgifb: Add header #include guards to vb_table.h
This patch adds a simple #include guard to vb_table.h

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:13:22 -07:00
Peter Huewe 95649c425f staging/xgifb: Add mutext for fb_mmap locking
This adds a mutex for fb_mmap around smem_start and smem_len
so the mutex inside the fb_mmap() is actually used.  Changing of
these fields before calling the framebuffer_register() are not mutexed.

We check whether framebuffer_register has been called by reading
fbinfo->count.

See 537a1bf0 - "fbdev: add mutex for fb_mmap locking" by Krzysztof Helt
for details.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:13:22 -07:00
Peter Huewe 176f7842a8 staging/xgifb: Remove assignments without effect
This patch removes assignments to the fb_fix_screeninfo struct which are
overwritten by the memset in XGIfb_get_fix() a few lines later.
Since the name/id might be useful this was moved to XGIfb_get_fix().

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:13:21 -07:00
Miguel Gómez bf55b48371 Staging: xgifb: disable pci device on pci remove function.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-11 17:02:12 -07:00
Miguel Gómez 05e06036dd Staging: xgifb: disable pci device if there's an error after enabling it.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-11 17:02:12 -07:00
Miguel Gómez d049053ef0 Staging: xgifb: reorder the code a bit to be more module friendly
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-11 17:02:11 -07:00
Miguel Gómez f059077388 Staging: xgifb: Remove #ifdef MODULE
Check for MODULE is not needed. In a static compilation the parameters
definition is valid and module_exit() does nothing.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-11 17:02:11 -07:00
Greg Kroah-Hartman d210267741 Merge 3.4-rc5 into staging-next
This resolves the conflict in:
	drivers/staging/vt6656/ioctl.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-02 11:48:07 -07:00
Aaro Koskinen 6c0965fd7b staging: xgifb: inline XGI_GetResInfo()
Inline a trivial function.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:20:09 -07:00
Aaro Koskinen d00d12f87a staging: xgifb: eliminate redundant struct definition
Replace XGI330_LCDDataDesStruct with identical XGI_LCDDesStruct.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:20:09 -07:00
Aaro Koskinen 354f49fa12 staging: xgifb: delete VB_ExtTVEdgeIndex
Delete VB_ExtTVEdgeIndex. It's 0 for all video modes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:20:09 -07:00
Aaro Koskinen 36ae035b45 staging: xgifb: delete VB_ExtTVFlickerIndex
Delete VB_ExtTVFlickerIndex. It's 0 for all video modes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:20:08 -07:00
Aaro Koskinen 66f38592a0 staging: xgifb: XGI_ExtStruct: delete unused fields
Delete unused struct fields.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:20:08 -07:00
Aaro Koskinen 1bb52cc9d5 staging: xgifb: delete legacy DAC data
Delete DAC data for unsupported legacy modes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:20:08 -07:00
Aaro Koskinen a157961ca4 staging: xgifb: delete StandTableIndex parameters
Delete unused function parameters.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:20:08 -07:00
Aaro Koskinen fb60d0c4f7 staging: xgifb: truncate XGI330_StandTable
Only single element from XGI330_StandTable is used, so the array can be
truncated.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:20:08 -07:00
Aaro Koskinen 969f7f3b1d staging: xgifb: delete code for EGA or lower modes
All supported modes have ModeType > 2.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:20:08 -07:00
Aaro Koskinen ace1055e5e staging: xgifb: delete SModeIDTable
Delete unused data.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:20:08 -07:00
Aaro Koskinen 34c13ee2b6 staging: xgifb: drop code for legacy VGA modes
Drop code for mode_no <= 14. These are not supported so this is all
just dead code.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:20:07 -07:00
Aaro Koskinen 77f3e4b159 staging: xgifb: unwrap mode table lines
Unwrap lines to improve readability. Comments were deleted as they were not
really informative.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:20:07 -07:00
Aaro Koskinen ac64fdf488 staging: xgifb: delete MD_XGI300
Nobody cares about this bit.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:09 -07:00
Aaro Koskinen c6d5841b5f staging: xgifb: delete mode rows and columns
Delete redudant rows and columns data.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:08 -07:00
Aaro Koskinen 283b846940 staging: xgifb: delete mode names from the mode table
Delete mode names from the table. They are just redundant data.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:08 -07:00
Aaro Koskinen ba6288f6ac staging: xgifb: drop redudant mode table entries
Since the mode search is not string-based anymore, we can drop XxYx24
entries which were just duplicated XxYx32 entries.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:08 -07:00
Aaro Koskinen f9e5de0f17 staging: xgifb: eliminate string comparison from mode search
Eliminate string comparison from the video mode search.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:08 -07:00
Aaro Koskinen f47f12d621 staging: xgifb: delete rate_idx from mode table
The default rate_idx is same for all video modes, no need to keep that
in the table.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:08 -07:00
Aaro Koskinen b07b3a9059 staging: xgifb: delete XGI300paneltype
Delete unused table.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:08 -07:00
Aaro Koskinen c38d044bf2 staging: xgifb: drop XG45 code
XG45 is not recognized/supported by the driver.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:07 -07:00
Aaro Koskinen 18408da0e8 staging: xgifb: drop XG41 code
XG_41 is not listed in xgifb_pci_table, so the code can be safely dropped.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:07 -07:00
Aaro Koskinen aca03bcc29 staging: xgifb: XGIfb_mode_rate_to_dclock: initialize ModeIdIndex properly
Initialize ModeIdIndex according to the selected video mode. Currently
index 0 is always used and wrong clock data may be used.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:55:09 -07:00
Aaro Koskinen e484975a23 staging: xgifb: XGIfb_mode_rate_to_dclock: delete commented-out code
Delete code that has been commented out.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:55:09 -07:00
Aaro Koskinen 051ff1bb3c staging: xgifb: XGIfb_mode_rate_to_ddata: initialize ModeIdIndex properly
Initialize ModeIdIndex according to the selected video mode. Currently
index 0 is always used and wrong video mode data may be used.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:55:09 -07:00
Aaro Koskinen 3a05de3304 staging: xgifb: XGIfb_mode_rate_to_ddata: delete commented-out code
Delete code that has been commented out.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:55:08 -07:00
Dmitry Eremin-Solenikov f650caaa49 staging/xgifb: fix addressing issues on platform with long physical addressing
Some platforms (e.g. ppc460ex) have 36-bit physical addressing, while
sizeof(unsigned long) == 4. Adapt xgifb driver to use phys_addr_t for
physical address variables instead of unsigned long.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:52:58 -07:00
Dmitry Eremin-Solenikov 9a801f252a staging/xgifb: simplify vga I/O ports handling
XGIfb driver transfers integer port number through several typecasts via
pjIOAddress field. Drop that field completely and use vga_base field of
xgifb_info directly.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:52:58 -07:00
Dmitry Eremin-Solenikov 30b7681615 staging/xgifb: drop RelIO from vb_device_info
The RelIO field is unused in the driver, drop it.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:52:58 -07:00