aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/xgifb
AgeCommit message (Collapse)Author
2013-03-28staging: xgifb: rename SR15/SR13 arrays to SR18Aaro Koskinen
Since we are programming SR register 18, better name structs/arrays accordingly to avoid confusion. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28staging: xgifb: make SR15/SR13 arrays single dimensionalAaro Koskinen
Since we only access the third row, we can delete the others. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28staging: xgifb: XGINew_SetDRAMDefaultRegister340: inline the value of SR1BAaro Koskinen
SR1B register value is always 3 regardless of video card or RAM type. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28staging: xgifb: delete pXGINew_DRAMTypeDefinitionAaro Koskinen
Delete unused struct field. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28staging: xgifb: delete XGI330_LCDCapStruct.PWD_2xAaro Koskinen
Delete unused XGI330_LCDCapStruct fields. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28staging: xgifb: delete XGI330_LCDCapStruct.PSC_SxAaro Koskinen
Delete unused XGI330_LCDCapStruct fields. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28staging: xgifb: delete LCD_SetFlagAaro Koskinen
Delete redundant XGI330_LCDCapStruct field. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28staging: xgifb: delete IF_DEF_TRUMPION and IF_DEF_DSTNAaro Koskinen
Delete some unused flags. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28staging: xgifb: eliminate IF_DEF_LVDS checks from vb_initAaro Koskinen
Inside vb_init, IF_DEF_LVDS tells only if the vbios was succesfully read on XG21. Rearrange the code so that we don't need to set or care about this flag. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28staging: xgifb: delete redundant IF_DEF_LVDS checkAaro Koskinen
IF_DEF_LVDS can be set only on XG21. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15staging/xgifb: Remove duplicated code in loops.Peter Huewe
Instead of calling the same function three times in a loop, multiply the loop counter by three. And since the value in DAC_TEST_PARMS is always the same we can use the value directly. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15staging/xgifb: Consolidate return pathsPeter Huewe
Both branches of this if statement end in the same return statement. -> move the return to the bottom and get rid of the else statement. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15staging/xgifb: Remove code without effectPeter Huewe
The tempal variable is assigned and then immediately overwritten. -> remove everything without effect. The inb is kept for possible side effects. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15staging/xgifb: Remove unnecessary castsPeter Huewe
Both functions xgifb_reg_get and inb return an u8 value, so we don't need to cast their return value to unsigned char. -> remove the cast Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15staging/xgifb: Consolidate if/else if with identical code branchesPeter Huewe
Both branches of this if statement execute the same code. Thus we can || them together and remove code duplication Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-08staging: xgifb: XGI_SetDelayComp(): delete IF_DEF_LVDS checkAaro Koskinen
Delete IF_DEF_LVDS check, this function is never called when it's true. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-08staging: xgifb: XGI_GetCRT2ResInfo(): delete IF_DEF_LVDS checkAaro Koskinen
Delete IF_DEF_LVDS check, this function is never called when it's true. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-08staging: xgifb: XGI_GetLCDInfo(): delete IF_DEF_LVDS checkAaro Koskinen
Delete IF_DEF_LVDS check, this function is never called when it's true. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-08staging: xgifb: XGI_GetTVInfo(): delete IF_DEF_LVDS checksAaro Koskinen
This function is never called when pVBInfo->IF_DEF_LVDS is true, so we can remove checks and reduce complexity. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-08staging: xgifb: XGI_GetVBInfo(): delete IF_DEF_LVDS checkAaro Koskinen
Delete IF_DEF_LVDS check, this function is never called when it's true. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-08staging: xgifb: XGI_GetVCLK2Ptr(): delete IF_DEF_LVDS checkAaro Koskinen
Delete IF_DEF_LVDS check, this function is never called when it's true. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-07staging: xgifb: initialize register 3cc addressAaro Koskinen
Commit 56810a92c689c64d586a51a1078c5d307b24e8eb (staging: xgifb: use XGIRegInit()) left 3cc uninitialized, and it may trigger a panic during probe. Fix this. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove always false if statementPeter Huewe
MCLKData does not contain any 0x1C value for its field SR28 nor does XGI340_ECLKData contain any 0x1C or 0x22 value for its field SR2E. -> the statement always evaluates to false. -> remove Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove unneeded conditional assignmentPeter Huewe
pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2 -> The conditional assignment is not needed here as it always evaluates to true. -> remove Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove unused values in XGI340_ECLKDataPeter Huewe
In the lookup table XGI340_ECLKData only the first three 'lines' are used, thus the remaining entries can be removed. Rationale: - vb_init.c uses pVBInfo->ram_type as the index for XGI340_ECLKData. - pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2 -> only the first three values are used. -> remove the remeining entries. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove unused entries in XGI340New_MCLKData and XGI27New_MCLKDataPeter Huewe
In the lookup tables XGI340New_MCLKData and XGI27New_MCLKData only the first three 'lines' are used, thus the remaining fields can be removed. Rationale: - vb_init.c uses pVBInfo->ram_type as the index for pVBInfo->MCLKData - pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2 - pVBInfo->MCLKData is assigned to either XGI340New_MCLKData or XGI27New_MCLKData in vb_setmode.c -> only the first three values are used, the rest can be removed. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove unused values in XG27_SR13 and XGI340_SR13Peter Huewe
In the lookup tables XG27_SR13 and XGI340_SR13 only the first three values are used of each 'line', thus the remaining fields can be removed. Rationale: - vb_init.c uses pVBInfo->ram_type for the 'column' index for pVBInfo->SR15. - pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2 - pVBInfo->SR15 is assigned to either XG27_SR13 or XGI340_SR13 in vb_setmode.c -> only the first three values are used. This becomes also evident as values 3-7 are all 0. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove unused values in XGI340_cr41 and XGI27_cr41Peter Huewe
In the lookup tables XGI340_cr41 and XGI27_cr41 only the first three values are used of each 'line', thus the remaining fields can be removed. Rationale: - vb_init.c uses pVBInfo->ram_type for the 'column' index for pVBInfo->CR40. - pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2 - pVBInfo->CR40 is assigned to either XGI340_cr41 or XGI27_cr41 in vb_setmode.c -> only the first three values are used. This becomes also evident as values 3-7 are all 0. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove unused variablePeter Huewe
After the patch 'staging/xgifb: Don't write the same values x times' the local variable i is unused, which leads to the following warning: driverrs/staging/xgifb/vb_init.c: In function ‘XGINew_SetDRAMDefaultRegister340’: drivers/staging/xgifb/vb_init.c:433:43: warning: unused variable ‘i’ [-Wunused-variable] This patch fixes this Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Consolidate if branches with similar conditionsPeter Huewe
1) The same condition (pVBInfo->IF_DEF_LVDS == 0) was checked in the if clause directly in front of this one. 2) The same condition pVBInfo->VBType & (VB_SIS301B | VB_SIS302B | VB_SIS301LV | VB_SIS302LV | VB_XGI301C) was checked in the if clause directly in front of this one. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Consolidate if/else for 'identical' branchesPeter Huewe
Since XGI_LCDDesStruct is fully contained in XGI330_LCDDataDesStruct2 and the offsets for the first members is identical we can consolidate the if/else branches here and use XGI330_LCDDataDesStruct2 for everything. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Don't write the same values x timesPeter Huewe
With the previous patch 'Move duplicated code for dram to helper function' it becomes evident that the code is performing the same thing 4 or 8 times in a row without changing arguments to the function and thus writing the same values over and over again. It was tested that these repeats are unnecessary. -> we can safely remove them. Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Move duplicated code for dram to helper functionPeter Huewe
XGINew_SetDRAMDefaultRegister340 uses the same code fragment 4 times with only a slight variation each time. -> Move this code to a helper function - this saves some lines and ~450bytes in the .o / .ko Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Replace XGI340_CR6B table with simple if/elsePeter Huewe
The XGI340_CR6B lookup table consists of the entries {0xaa, 0xaa, 0xaa, 0xaa} for an index <= 2 and {0x00, 0x00, 0x00, 0x00} for all other indices. The only user XGINew_SetDRAMDefaultRegister340 loops over these 4 values of a line with a for loop and since all entries are the same for each line we can simply replace the whole lookup table with a simple if/else assignment. Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04staging/xgifb: Simplify XGISetModeNewPeter Huewe
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-04staging/xgifb: Consolidate XGI_EnableChISLCD and XGI_DisableChISLCDPeter Huewe
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-04staging/xgifb: Remove unnecessary bitshifts in XGI_SetCRT1ModeRegsPeter Huewe
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-04staging/xgifb: remove unnecessary temp variable in XGIfb_mode_rate_to_ddataPeter Huewe
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-04staging/xgifb: rewrite XGIfb_get_cmap_lenPeter Huewe
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-04staging/xgifb: Simplify XGI_SetSeqRegsPeter Huewe
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-04staging/xgifb: Fix return of uninitialized variablePeter Huewe
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-04staging/xgifb: mttr must be (signed) intPeter Huewe
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-04staging/xgifb: Remove always false comparisonsPeter Huewe
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-04staging/xgifb: Simplify XGI_GetRatePtrCRT2Peter Huewe
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-03staging/xgifb: remove unused variablesPeter Huewe
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-03staging/xgifb: Remove redundant if statementPeter Huewe
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-03staging/xgifb: Remove unused variablesPeter Huewe
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-03staging/xgifb: Remove unused variable and dead assignmentPeter Huewe
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-03staging/xgifb: Remove unused variablePeter Huewe
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-03staging/xgifb: Remove unused variables and dead assignmentsPeter Huewe
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>