* [PATCH 0/4] staging: sm750fb: checkpatch.pl fixes @ 2015-06-20 8:45 ` Juston Li 0 siblings, 0 replies; 16+ messages in thread From: Juston Li @ 2015-06-20 8:45 UTC (permalink / raw) To: gisudipm.mukherjee, teddy.wang, Greg KH, linux-fbdev, devel, linux-kernel This patch set includes 4 patches fixing indentation, spacing, brace placement and missing blank lines from checkpatch.pl warnings/errors in staging/sm750fb. Regards Juston ------------- drivers/staging/sm750fb/ddk750_chip.c | 15 +-- drivers/staging/sm750fb/ddk750_chip.h | 12 +- drivers/staging/sm750fb/ddk750_display.c | 168 +++++++++++++----------- drivers/staging/sm750fb/ddk750_display.h | 11 +- drivers/staging/sm750fb/ddk750_dvi.c | 75 +++++------ drivers/staging/sm750fb/ddk750_dvi.h | 3 +- drivers/staging/sm750fb/ddk750_help.c | 2 +- drivers/staging/sm750fb/ddk750_help.h | 4 +- drivers/staging/sm750fb/ddk750_hwi2c.c | 244 ++++++++++++++++++----------------- drivers/staging/sm750fb/ddk750_mode.c | 164 +++++++++++------------ drivers/staging/sm750fb/ddk750_mode.h | 52 ++++---- drivers/staging/sm750fb/ddk750_power.c | 254 ++++++++++++++++++------------------ drivers/staging/sm750fb/ddk750_power.h | 11 +- drivers/staging/sm750fb/ddk750_reg.h | 18 +-- drivers/staging/sm750fb/ddk750_sii164.c | 394 +++++++++++++++++++++++++++++--------------------------- drivers/staging/sm750fb/ddk750_sii164.h | 32 ++--- drivers/staging/sm750fb/sm750.c | 2 +- drivers/staging/sm750fb/sm750.h | 58 ++++----- drivers/staging/sm750fb/sm750_accel.c | 374 ++++++++++++++++++++++++++++------------------------- drivers/staging/sm750fb/sm750_accel.h | 4 +- drivers/staging/sm750fb/sm750_cursor.c | 49 +++---- drivers/staging/sm750fb/sm750_help.h | 28 ++-- drivers/staging/sm750fb/sm750_hw.c | 205 +++++++++++++++-------------- drivers/staging/sm750fb/sm750_hw.h | 42 +++--- 24 files changed, 1163 insertions(+), 1058 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 0/4] staging: sm750fb: checkpatch.pl fixes @ 2015-06-20 8:45 ` Juston Li 0 siblings, 0 replies; 16+ messages in thread From: Juston Li @ 2015-06-20 8:45 UTC (permalink / raw) To: gisudipm.mukherjee, teddy.wang, Greg KH, linux-fbdev, devel, linux-kernel This patch set includes 4 patches fixing indentation, spacing, brace placement and missing blank lines from checkpatch.pl warnings/errors in staging/sm750fb. Regards Juston ------------- drivers/staging/sm750fb/ddk750_chip.c | 15 +-- drivers/staging/sm750fb/ddk750_chip.h | 12 +- drivers/staging/sm750fb/ddk750_display.c | 168 +++++++++++++----------- drivers/staging/sm750fb/ddk750_display.h | 11 +- drivers/staging/sm750fb/ddk750_dvi.c | 75 +++++------ drivers/staging/sm750fb/ddk750_dvi.h | 3 +- drivers/staging/sm750fb/ddk750_help.c | 2 +- drivers/staging/sm750fb/ddk750_help.h | 4 +- drivers/staging/sm750fb/ddk750_hwi2c.c | 244 ++++++++++++++++++----------------- drivers/staging/sm750fb/ddk750_mode.c | 164 +++++++++++------------ drivers/staging/sm750fb/ddk750_mode.h | 52 ++++---- drivers/staging/sm750fb/ddk750_power.c | 254 ++++++++++++++++++------------------ drivers/staging/sm750fb/ddk750_power.h | 11 +- drivers/staging/sm750fb/ddk750_reg.h | 18 +-- drivers/staging/sm750fb/ddk750_sii164.c | 394 +++++++++++++++++++++++++++++--------------------------- drivers/staging/sm750fb/ddk750_sii164.h | 32 ++--- drivers/staging/sm750fb/sm750.c | 2 +- drivers/staging/sm750fb/sm750.h | 58 ++++----- drivers/staging/sm750fb/sm750_accel.c | 374 ++++++++++++++++++++++++++++------------------------- drivers/staging/sm750fb/sm750_accel.h | 4 +- drivers/staging/sm750fb/sm750_cursor.c | 49 +++---- drivers/staging/sm750fb/sm750_help.h | 28 ++-- drivers/staging/sm750fb/sm750_hw.c | 205 +++++++++++++++-------------- drivers/staging/sm750fb/sm750_hw.h | 42 +++--- 24 files changed, 1163 insertions(+), 1058 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/4] staging: sm750fb: use tabs for indentation 2015-06-20 8:45 ` Juston Li @ 2015-06-20 8:48 ` Juston Li -1 siblings, 0 replies; 16+ messages in thread From: Juston Li @ 2015-06-20 8:48 UTC (permalink / raw) To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, devel, linux-kernel Cc: Juston Li Replace spaces with tabs for indentation to fix the checkpatch.pl error ERROR: code indent should use tabs where possible WARNING: please, no spaces at the start of a line Signed-off-by: Juston Li <juston.h.li@gmail.com> --- drivers/staging/sm750fb/ddk750_display.c | 100 ++++---- drivers/staging/sm750fb/ddk750_display.h | 2 +- drivers/staging/sm750fb/ddk750_dvi.c | 66 ++--- drivers/staging/sm750fb/ddk750_help.h | 4 +- drivers/staging/sm750fb/ddk750_hwi2c.c | 246 +++++++++---------- drivers/staging/sm750fb/ddk750_mode.c | 142 +++++------ drivers/staging/sm750fb/ddk750_mode.h | 46 ++-- drivers/staging/sm750fb/ddk750_power.c | 254 ++++++++++---------- drivers/staging/sm750fb/ddk750_power.h | 8 +- drivers/staging/sm750fb/ddk750_reg.h | 18 +- drivers/staging/sm750fb/ddk750_sii164.c | 399 +++++++++++++++---------------- drivers/staging/sm750fb/ddk750_sii164.h | 29 ++- drivers/staging/sm750fb/sm750.h | 24 +- drivers/staging/sm750fb/sm750_accel.c | 364 ++++++++++++++-------------- drivers/staging/sm750fb/sm750_accel.h | 4 +- drivers/staging/sm750fb/sm750_help.h | 26 +- drivers/staging/sm750fb/sm750_hw.c | 70 +++--- drivers/staging/sm750fb/sm750_hw.h | 28 +-- 18 files changed, 908 insertions(+), 922 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index a3e6720..1c4049f 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -24,7 +24,7 @@ static void setDisplayControl(int ctrl, int dispState) /* Timing should be enabled first before enabling the plane * because changing at the same time does not guarantee that * the plane will also enabled or disabled. - */ + */ ulDisplayCtrlReg = FIELD_SET(ulDisplayCtrlReg, PANEL_DISPLAY_CTRL, TIMING, ENABLE); POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); @@ -135,8 +135,8 @@ static void waitNextVerticalSync(int ctrl, int delay) if(!ctrl){ /* primary controller */ - /* Do not wait when the Primary PLL is off or display control is already off. - This will prevent the software to wait forever. */ + /* Do not wait when the Primary PLL is off or display control is already off. + This will prevent the software to wait forever. */ if ((FIELD_GET(PEEK32(PANEL_PLL_CTRL), PANEL_PLL_CTRL, POWER) = PANEL_PLL_CTRL_POWER_OFF) || (FIELD_GET(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, TIMING) = @@ -145,26 +145,26 @@ static void waitNextVerticalSync(int ctrl, int delay) return; } - while (delay-- > 0) - { - /* Wait for end of vsync. */ - do - { - status = FIELD_GET(PEEK32(SYSTEM_CTRL), - SYSTEM_CTRL, - PANEL_VSYNC); - } - while (status = SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); - - /* Wait for start of vsync. */ - do - { - status = FIELD_GET(PEEK32(SYSTEM_CTRL), - SYSTEM_CTRL, - PANEL_VSYNC); - } - while (status = SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); - } + while (delay-- > 0) + { + /* Wait for end of vsync. */ + do + { + status = FIELD_GET(PEEK32(SYSTEM_CTRL), + SYSTEM_CTRL, + PANEL_VSYNC); + } + while (status = SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); + + /* Wait for start of vsync. */ + do + { + status = FIELD_GET(PEEK32(SYSTEM_CTRL), + SYSTEM_CTRL, + PANEL_VSYNC); + } + while (status = SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); + } }else{ @@ -275,33 +275,33 @@ void ddk750_setLogicalDispOut(disp_output_t output) int ddk750_initDVIDisp(void) { - /* Initialize DVI. If the dviInit fail and the VendorID or the DeviceID are - not zeroed, then set the failure flag. If it is zeroe, it might mean - that the system is in Dual CRT Monitor configuration. */ - - /* De-skew enabled with default 111b value. - This will fix some artifacts problem in some mode on board 2.2. - Somehow this fix does not affect board 2.1. - */ - if ((dviInit(1, /* Select Rising Edge */ - 1, /* Select 24-bit bus */ - 0, /* Select Single Edge clock */ - 1, /* Enable HSync as is */ - 1, /* Enable VSync as is */ - 1, /* Enable De-skew */ - 7, /* Set the de-skew setting to maximum setup */ - 1, /* Enable continuous Sync */ - 1, /* Enable PLL Filter */ - 4 /* Use the recommended value for PLL Filter value */ - ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) - { - return (-1); - } - - /* TODO: Initialize other display component */ - - /* Success */ - return 0; + /* Initialize DVI. If the dviInit fail and the VendorID or the DeviceID are + not zeroed, then set the failure flag. If it is zeroe, it might mean + that the system is in Dual CRT Monitor configuration. */ + + /* De-skew enabled with default 111b value. + This will fix some artifacts problem in some mode on board 2.2. + Somehow this fix does not affect board 2.1. + */ + if ((dviInit(1, /* Select Rising Edge */ + 1, /* Select 24-bit bus */ + 0, /* Select Single Edge clock */ + 1, /* Enable HSync as is */ + 1, /* Enable VSync as is */ + 1, /* Enable De-skew */ + 7, /* Set the de-skew setting to maximum setup */ + 1, /* Enable continuous Sync */ + 1, /* Enable PLL Filter */ + 4 /* Use the recommended value for PLL Filter value */ + ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) + { + return (-1); + } + + /* TODO: Initialize other display component */ + + /* Success */ + return 0; } diff --git a/drivers/staging/sm750fb/ddk750_display.h b/drivers/staging/sm750fb/ddk750_display.h index ae0f84c..018a661 100644 --- a/drivers/staging/sm750fb/ddk750_display.h +++ b/drivers/staging/sm750fb/ddk750_display.h @@ -8,7 +8,7 @@ #define PNL_2_OFFSET 0 #define PNL_2_MASK (3 << PNL_2_OFFSET) #define PNL_2_USAGE (PNL_2_MASK << 16) -#define PNL_2_PRI ((0 << PNL_2_OFFSET)|PNL_2_USAGE) +#define PNL_2_PRI ((0 << PNL_2_OFFSET)|PNL_2_USAGE) #define PNL_2_SEC ((2 << PNL_2_OFFSET)|PNL_2_USAGE) diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index b2bf7e6..35866fa 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -12,35 +12,35 @@ static dvi_ctrl_device_t g_dcftSupportedDviController[] { #ifdef DVI_CTRL_SII164 - { - .pfnInit = sii164InitChip, - .pfnGetVendorId = sii164GetVendorID, - .pfnGetDeviceId = sii164GetDeviceID, + { + .pfnInit = sii164InitChip, + .pfnGetVendorId = sii164GetVendorID, + .pfnGetDeviceId = sii164GetDeviceID, #ifdef SII164_FULL_FUNCTIONS - .pfnResetChip = sii164ResetChip, - .pfnGetChipString = sii164GetChipString, - .pfnSetPower = sii164SetPower, - .pfnEnableHotPlugDetection = sii164EnableHotPlugDetection, - .pfnIsConnected = sii164IsConnected, - .pfnCheckInterrupt = sii164CheckInterrupt, - .pfnClearInterrupt = sii164ClearInterrupt, + .pfnResetChip = sii164ResetChip, + .pfnGetChipString = sii164GetChipString, + .pfnSetPower = sii164SetPower, + .pfnEnableHotPlugDetection = sii164EnableHotPlugDetection, + .pfnIsConnected = sii164IsConnected, + .pfnCheckInterrupt = sii164CheckInterrupt, + .pfnClearInterrupt = sii164ClearInterrupt, #endif - }, + }, #endif }; int dviInit( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue + unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue ) { dvi_ctrl_device_t *pCurrentDviCtrl; @@ -48,8 +48,8 @@ int dviInit( if(pCurrentDviCtrl->pfnInit != NULL) { return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, - vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, - pllFilterEnable, pllFilterValue); + vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, + pllFilterEnable, pllFilterValue); } return -1; /* error */ } @@ -64,13 +64,13 @@ int dviInit( */ unsigned short dviGetVendorID(void) { - dvi_ctrl_device_t *pCurrentDviCtrl; + dvi_ctrl_device_t *pCurrentDviCtrl; - pCurrentDviCtrl = g_dcftSupportedDviController; - if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) - return pCurrentDviCtrl->pfnGetVendorId(); + pCurrentDviCtrl = g_dcftSupportedDviController; + if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) + return pCurrentDviCtrl->pfnGetVendorId(); - return 0x0000; + return 0x0000; } @@ -83,13 +83,13 @@ unsigned short dviGetVendorID(void) */ unsigned short dviGetDeviceID(void) { - dvi_ctrl_device_t *pCurrentDviCtrl; + dvi_ctrl_device_t *pCurrentDviCtrl; pCurrentDviCtrl = g_dcftSupportedDviController; - if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) - return pCurrentDviCtrl->pfnGetDeviceId(); + if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) + return pCurrentDviCtrl->pfnGetDeviceId(); - return 0x0000; + return 0x0000; } #endif diff --git a/drivers/staging/sm750fb/ddk750_help.h b/drivers/staging/sm750fb/ddk750_help.h index 4285b05..3b06aed 100644 --- a/drivers/staging/sm750fb/ddk750_help.h +++ b/drivers/staging/sm750fb/ddk750_help.h @@ -12,8 +12,8 @@ #if 0 /* if 718 big endian turned on,be aware that don't use this driver for general use,only for ppc big-endian */ #warning "big endian on target cpu and enable nature big endian support of 718 capability !" -#define PEEK32(addr) __raw_readl(mmio750 + addr) -#define POKE32(addr, data) __raw_writel(data, mmio750 + addr) +#define PEEK32(addr) __raw_readl(mmio750 + addr) +#define POKE32(addr, data) __raw_writel(data, mmio750 + addr) #else /* software control endianness */ #define PEEK32(addr) readl(addr + mmio750) #define POKE32(addr, data) writel(data, addr + mmio750) diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c index 7826376..7f3b1f9 100644 --- a/drivers/staging/sm750fb/ddk750_hwi2c.c +++ b/drivers/staging/sm750fb/ddk750_hwi2c.c @@ -10,70 +10,70 @@ int hwI2CInit( - unsigned char busSpeedMode +unsigned char busSpeedMode ) { - unsigned int value; + unsigned int value; - /* Enable GPIO 30 & 31 as IIC clock & data */ + /* Enable GPIO 30 & 31 as IIC clock & data */ value = PEEK32(GPIO_MUX); - value = FIELD_SET(value, GPIO_MUX, 30, I2C) | - FIELD_SET(0, GPIO_MUX, 31, I2C); + value = FIELD_SET(value, GPIO_MUX, 30, I2C) | + FIELD_SET(0, GPIO_MUX, 31, I2C); POKE32(GPIO_MUX, value); - /* Enable Hardware I2C power. - TODO: Check if we need to enable GPIO power? - */ - enableI2C(1); - - /* Enable the I2C Controller and set the bus speed mode */ - value = PEEK32(I2C_CTRL); - if (busSpeedMode = 0) - value = FIELD_SET(value, I2C_CTRL, MODE, STANDARD); - else - value = FIELD_SET(value, I2C_CTRL, MODE, FAST); - value = FIELD_SET(value, I2C_CTRL, EN, ENABLE); - POKE32(I2C_CTRL, value); - - return 0; + /* Enable Hardware I2C power. + TODO: Check if we need to enable GPIO power? + */ + enableI2C(1); + + /* Enable the I2C Controller and set the bus speed mode */ + value = PEEK32(I2C_CTRL); + if (busSpeedMode = 0) + value = FIELD_SET(value, I2C_CTRL, MODE, STANDARD); + else + value = FIELD_SET(value, I2C_CTRL, MODE, FAST); + value = FIELD_SET(value, I2C_CTRL, EN, ENABLE); + POKE32(I2C_CTRL, value); + + return 0; } void hwI2CClose(void) { - unsigned int value; + unsigned int value; - /* Disable I2C controller */ - value = PEEK32(I2C_CTRL); - value = FIELD_SET(value, I2C_CTRL, EN, DISABLE); - POKE32(I2C_CTRL, value); + /* Disable I2C controller */ + value = PEEK32(I2C_CTRL); + value = FIELD_SET(value, I2C_CTRL, EN, DISABLE); + POKE32(I2C_CTRL, value); - /* Disable I2C Power */ - enableI2C(0); + /* Disable I2C Power */ + enableI2C(0); - /* Set GPIO 30 & 31 back as GPIO pins */ - value = PEEK32(GPIO_MUX); - value = FIELD_SET(value, GPIO_MUX, 30, GPIO); - value = FIELD_SET(value, GPIO_MUX, 31, GPIO); - POKE32(GPIO_MUX, value); + /* Set GPIO 30 & 31 back as GPIO pins */ + value = PEEK32(GPIO_MUX); + value = FIELD_SET(value, GPIO_MUX, 30, GPIO); + value = FIELD_SET(value, GPIO_MUX, 31, GPIO); + POKE32(GPIO_MUX, value); } static long hwI2CWaitTXDone(void) { - unsigned int timeout; + unsigned int timeout; - /* Wait until the transfer is completed. */ - timeout = HWI2C_WAIT_TIMEOUT; + /* Wait until the transfer is completed. */ + timeout = HWI2C_WAIT_TIMEOUT; while ((FIELD_GET(PEEK32(I2C_STATUS), I2C_STATUS, TX) != I2C_STATUS_TX_COMPLETED) && - (timeout != 0)) + (timeout != 0)) timeout--; if (timeout = 0) - return (-1); + return (-1); - return 0; + return 0; } @@ -91,53 +91,53 @@ static long hwI2CWaitTXDone(void) * Total number of bytes those are actually written. */ static unsigned int hwI2CWriteData( - unsigned char deviceAddress, - unsigned int length, - unsigned char *pBuffer + unsigned char deviceAddress, + unsigned int length, + unsigned char *pBuffer ) { - unsigned char count, i; - unsigned int totalBytes = 0; + unsigned char count, i; + unsigned int totalBytes = 0; - /* Set the Device Address */ - POKE32(I2C_SLAVE_ADDRESS, deviceAddress & ~0x01); + /* Set the Device Address */ + POKE32(I2C_SLAVE_ADDRESS, deviceAddress & ~0x01); - /* Write data. - * Note: - * Only 16 byte can be accessed per i2c start instruction. - */ - do - { - /* Reset I2C by writing 0 to I2C_RESET register to clear the previous status. */ - POKE32(I2C_RESET, 0); + /* Write data. + * Note: + * Only 16 byte can be accessed per i2c start instruction. + */ + do + { + /* Reset I2C by writing 0 to I2C_RESET register to clear the previous status. */ + POKE32(I2C_RESET, 0); - /* Set the number of bytes to be written */ - if (length < MAX_HWI2C_FIFO) - count = length - 1; - else - count = MAX_HWI2C_FIFO - 1; - POKE32(I2C_BYTE_COUNT, count); + /* Set the number of bytes to be written */ + if (length < MAX_HWI2C_FIFO) + count = length - 1; + else + count = MAX_HWI2C_FIFO - 1; + POKE32(I2C_BYTE_COUNT, count); - /* Move the data to the I2C data register */ - for (i = 0; i <= count; i++) - POKE32(I2C_DATA0 + i, *pBuffer++); + /* Move the data to the I2C data register */ + for (i = 0; i <= count; i++) + POKE32(I2C_DATA0 + i, *pBuffer++); - /* Start the I2C */ - POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); + /* Start the I2C */ + POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); - /* Wait until the transfer is completed. */ - if (hwI2CWaitTXDone() != 0) - break; + /* Wait until the transfer is completed. */ + if (hwI2CWaitTXDone() != 0) + break; - /* Substract length */ - length -= (count + 1); + /* Substract length */ + length -= (count + 1); - /* Total byte written */ - totalBytes += (count + 1); + /* Total byte written */ + totalBytes += (count + 1); - } while (length > 0); + } while (length > 0); - return totalBytes; + return totalBytes; } @@ -158,53 +158,53 @@ static unsigned int hwI2CWriteData( * Total number of actual bytes read from the slave device */ static unsigned int hwI2CReadData( - unsigned char deviceAddress, - unsigned int length, - unsigned char *pBuffer + unsigned char deviceAddress, + unsigned int length, + unsigned char *pBuffer ) { - unsigned char count, i; - unsigned int totalBytes = 0; + unsigned char count, i; + unsigned int totalBytes = 0; - /* Set the Device Address */ - POKE32(I2C_SLAVE_ADDRESS, deviceAddress | 0x01); + /* Set the Device Address */ + POKE32(I2C_SLAVE_ADDRESS, deviceAddress | 0x01); - /* Read data and save them to the buffer. - * Note: - * Only 16 byte can be accessed per i2c start instruction. - */ - do - { - /* Reset I2C by writing 0 to I2C_RESET register to clear all the status. */ - POKE32(I2C_RESET, 0); + /* Read data and save them to the buffer. + * Note: + * Only 16 byte can be accessed per i2c start instruction. + */ + do + { + /* Reset I2C by writing 0 to I2C_RESET register to clear all the status. */ + POKE32(I2C_RESET, 0); - /* Set the number of bytes to be read */ - if (length <= MAX_HWI2C_FIFO) - count = length - 1; - else - count = MAX_HWI2C_FIFO - 1; - POKE32(I2C_BYTE_COUNT, count); + /* Set the number of bytes to be read */ + if (length <= MAX_HWI2C_FIFO) + count = length - 1; + else + count = MAX_HWI2C_FIFO - 1; + POKE32(I2C_BYTE_COUNT, count); - /* Start the I2C */ - POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); + /* Start the I2C */ + POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); - /* Wait until transaction done. */ - if (hwI2CWaitTXDone() != 0) - break; + /* Wait until transaction done. */ + if (hwI2CWaitTXDone() != 0) + break; - /* Save the data to the given buffer */ - for (i = 0; i <= count; i++) - *pBuffer++ = PEEK32(I2C_DATA0 + i); + /* Save the data to the given buffer */ + for (i = 0; i <= count; i++) + *pBuffer++ = PEEK32(I2C_DATA0 + i); - /* Substract length by 16 */ - length -= (count + 1); + /* Substract length by 16 */ + length -= (count + 1); - /* Number of bytes read. */ - totalBytes += (count + 1); + /* Number of bytes read. */ + totalBytes += (count + 1); - } while (length > 0); + } while (length > 0); - return totalBytes; + return totalBytes; } @@ -222,16 +222,16 @@ static unsigned int hwI2CReadData( * Register value */ unsigned char hwI2CReadReg( - unsigned char deviceAddress, - unsigned char registerIndex + unsigned char deviceAddress, + unsigned char registerIndex ) { - unsigned char value = (0xFF); + unsigned char value = (0xFF); - if (hwI2CWriteData(deviceAddress, 1, ®isterIndex) = 1) - hwI2CReadData(deviceAddress, 1, &value); + if (hwI2CWriteData(deviceAddress, 1, ®isterIndex) = 1) + hwI2CReadData(deviceAddress, 1, &value); - return value; + return value; } @@ -252,19 +252,19 @@ unsigned char hwI2CReadReg( * -1 - Fail */ int hwI2CWriteReg( - unsigned char deviceAddress, - unsigned char registerIndex, - unsigned char data + unsigned char deviceAddress, + unsigned char registerIndex, + unsigned char data ) { - unsigned char value[2]; + unsigned char value[2]; - value[0] = registerIndex; - value[1] = data; - if (hwI2CWriteData(deviceAddress, 2, value) = 2) - return 0; + value[0] = registerIndex; + value[1] = data; + if (hwI2CWriteData(deviceAddress, 2, value) = 2) + return 0; - return (-1); + return (-1); } diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index 74313ff..1f93d07 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -20,54 +20,54 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam, x = pModeParam->horizontal_display_end; y = pModeParam->vertical_display_end; - /* SM750LE has to set up the top-left and bottom-right - registers as well. - Note that normal SM750/SM718 only use those two register for - auto-centering mode. - */ - POKE32(CRT_AUTO_CENTERING_TL, - FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, TOP, 0) - | FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, LEFT, 0)); - - POKE32(CRT_AUTO_CENTERING_BR, - FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, BOTTOM, y-1) - | FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, RIGHT, x-1)); - - /* Assume common fields in dispControl have been properly set before - calling this function. - This function only sets the extra fields in dispControl. - */ + /* SM750LE has to set up the top-left and bottom-right + registers as well. + Note that normal SM750/SM718 only use those two register for + auto-centering mode. + */ + POKE32(CRT_AUTO_CENTERING_TL, + FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, TOP, 0) + | FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, LEFT, 0)); + + POKE32(CRT_AUTO_CENTERING_BR, + FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, BOTTOM, y-1) + | FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, RIGHT, x-1)); + + /* Assume common fields in dispControl have been properly set before + calling this function. + This function only sets the extra fields in dispControl. + */ /* Clear bit 29:27 of display control register */ - dispControl &= FIELD_CLEAR(CRT_DISPLAY_CTRL, CLK); + dispControl &= FIELD_CLEAR(CRT_DISPLAY_CTRL, CLK); /* Set bit 29:27 of display control register for the right clock */ /* Note that SM750LE only need to supported 7 resoluitons. */ if ( x = 800 && y = 600 ) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL41); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL41); else if (x = 1024 && y = 768) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL65); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL65); else if (x = 1152 && y = 864) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); else if (x = 1280 && y = 768) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); else if (x = 1280 && y = 720) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL74); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL74); else if (x = 1280 && y = 960) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); else if (x = 1280 && y = 1024) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); else /* default to VGA clock */ - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL25); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL25); /* Set bit 25:24 of display controller */ - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CRTSELECT, CRT); - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, RGBBIT, 24BIT); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CRTSELECT, CRT); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, RGBBIT, 24BIT); - /* Set bit 14 of display controller */ - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLOCK_PHASE, ACTIVE_LOW); + /* Set bit 14 of display controller */ + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLOCK_PHASE, ACTIVE_LOW); - POKE32(CRT_DISPLAY_CTRL, dispControl); + POKE32(CRT_DISPLAY_CTRL, dispControl); return dispControl; } @@ -84,21 +84,21 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) { /* programe secondary pixel clock */ POKE32(CRT_PLL_CTRL, formatPllReg(pll)); - POKE32(CRT_HORIZONTAL_TOTAL, - FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) - | FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); + POKE32(CRT_HORIZONTAL_TOTAL, + FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) + | FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); - POKE32(CRT_HORIZONTAL_SYNC, - FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) - | FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); + POKE32(CRT_HORIZONTAL_SYNC, + FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) + | FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); - POKE32(CRT_VERTICAL_TOTAL, - FIELD_VALUE(0, CRT_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) - | FIELD_VALUE(0, CRT_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); + POKE32(CRT_VERTICAL_TOTAL, + FIELD_VALUE(0, CRT_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) + | FIELD_VALUE(0, CRT_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); - POKE32(CRT_VERTICAL_SYNC, - FIELD_VALUE(0, CRT_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) - | FIELD_VALUE(0, CRT_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); + POKE32(CRT_VERTICAL_SYNC, + FIELD_VALUE(0, CRT_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) + | FIELD_VALUE(0, CRT_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); ulTmpValue = FIELD_VALUE(0, CRT_DISPLAY_CTRL, VSYNC_PHASE, pModeParam->vertical_sync_polarity)| @@ -125,39 +125,39 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) unsigned int ulReservedBits; POKE32(PANEL_PLL_CTRL, formatPllReg(pll)); - POKE32(PANEL_HORIZONTAL_TOTAL, - FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) - | FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); + POKE32(PANEL_HORIZONTAL_TOTAL, + FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) + | FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); - POKE32(PANEL_HORIZONTAL_SYNC, - FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) - | FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); + POKE32(PANEL_HORIZONTAL_SYNC, + FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) + | FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); - POKE32(PANEL_VERTICAL_TOTAL, - FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) - | FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); + POKE32(PANEL_VERTICAL_TOTAL, + FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) + | FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); - POKE32(PANEL_VERTICAL_SYNC, - FIELD_VALUE(0, PANEL_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) - | FIELD_VALUE(0, PANEL_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); + POKE32(PANEL_VERTICAL_SYNC, + FIELD_VALUE(0, PANEL_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) + | FIELD_VALUE(0, PANEL_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); ulTmpValue = FIELD_VALUE(0, PANEL_DISPLAY_CTRL, VSYNC_PHASE, pModeParam->vertical_sync_polarity)| - FIELD_VALUE(0, PANEL_DISPLAY_CTRL, HSYNC_PHASE, pModeParam->horizontal_sync_polarity)| - FIELD_VALUE(0, PANEL_DISPLAY_CTRL, CLOCK_PHASE, pModeParam->clock_phase_polarity)| - FIELD_SET(0, PANEL_DISPLAY_CTRL, TIMING, ENABLE)| - FIELD_SET(0, PANEL_DISPLAY_CTRL, PLANE, ENABLE); - - ulReservedBits = FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_1_MASK, ENABLE) | - FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_2_MASK, ENABLE) | - FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_3_MASK, ENABLE)| - FIELD_SET(0, PANEL_DISPLAY_CTRL, VSYNC, ACTIVE_LOW); - - ulReg = (PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, CLOCK_PHASE) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, VSYNC_PHASE) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, HSYNC_PHASE) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, TIMING) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, PLANE); + FIELD_VALUE(0, PANEL_DISPLAY_CTRL, HSYNC_PHASE, pModeParam->horizontal_sync_polarity)| + FIELD_VALUE(0, PANEL_DISPLAY_CTRL, CLOCK_PHASE, pModeParam->clock_phase_polarity)| + FIELD_SET(0, PANEL_DISPLAY_CTRL, TIMING, ENABLE)| + FIELD_SET(0, PANEL_DISPLAY_CTRL, PLANE, ENABLE); + + ulReservedBits = FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_1_MASK, ENABLE) | + FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_2_MASK, ENABLE) | + FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_3_MASK, ENABLE)| + FIELD_SET(0, PANEL_DISPLAY_CTRL, VSYNC, ACTIVE_LOW); + + ulReg = (PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, CLOCK_PHASE) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, VSYNC_PHASE) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, HSYNC_PHASE) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, TIMING) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, PLANE); /* May a hardware bug or just my test chip (not confirmed). diff --git a/drivers/staging/sm750fb/ddk750_mode.h b/drivers/staging/sm750fb/ddk750_mode.h index 4e8fab3..3548d67 100644 --- a/drivers/staging/sm750fb/ddk750_mode.h +++ b/drivers/staging/sm750fb/ddk750_mode.h @@ -5,35 +5,35 @@ typedef enum _spolarity_t { - POS = 0, /* positive */ - NEG, /* negative */ + POS = 0, /* positive */ + NEG, /* negative */ } spolarity_t; typedef struct _mode_parameter_t { - /* Horizontal timing. */ - unsigned long horizontal_total; - unsigned long horizontal_display_end; - unsigned long horizontal_sync_start; - unsigned long horizontal_sync_width; - spolarity_t horizontal_sync_polarity; - - /* Vertical timing. */ - unsigned long vertical_total; - unsigned long vertical_display_end; - unsigned long vertical_sync_start; - unsigned long vertical_sync_height; - spolarity_t vertical_sync_polarity; - - /* Refresh timing. */ - unsigned long pixel_clock; - unsigned long horizontal_frequency; - unsigned long vertical_frequency; - - /* Clock Phase. This clock phase only applies to Panel. */ - spolarity_t clock_phase_polarity; + /* Horizontal timing. */ + unsigned long horizontal_total; + unsigned long horizontal_display_end; + unsigned long horizontal_sync_start; + unsigned long horizontal_sync_width; + spolarity_t horizontal_sync_polarity; + + /* Vertical timing. */ + unsigned long vertical_total; + unsigned long vertical_display_end; + unsigned long vertical_sync_start; + unsigned long vertical_sync_height; + spolarity_t vertical_sync_polarity; + + /* Refresh timing. */ + unsigned long pixel_clock; + unsigned long horizontal_frequency; + unsigned long vertical_frequency; + + /* Clock Phase. This clock phase only applies to Panel. */ + spolarity_t clock_phase_polarity; } mode_parameter_t; diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index 1e5f398..b7a108b 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -19,7 +19,7 @@ unsigned int getPowerMode(void) { if(getChipType() = SM750LE) return 0; - return (FIELD_GET(PEEK32(POWER_MODE_CTRL), POWER_MODE_CTRL, MODE)); + return (FIELD_GET(PEEK32(POWER_MODE_CTRL), POWER_MODE_CTRL, MODE)); } @@ -29,76 +29,76 @@ unsigned int getPowerMode(void) */ void setPowerMode(unsigned int powerMode) { - unsigned int control_value = 0; + unsigned int control_value = 0; - control_value = PEEK32(POWER_MODE_CTRL); + control_value = PEEK32(POWER_MODE_CTRL); if(getChipType() = SM750LE) return; - switch (powerMode) - { - case POWER_MODE_CTRL_MODE_MODE0: - control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE0); - break; + switch (powerMode) + { + case POWER_MODE_CTRL_MODE_MODE0: + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE0); + break; - case POWER_MODE_CTRL_MODE_MODE1: - control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE1); - break; + case POWER_MODE_CTRL_MODE_MODE1: + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE1); + break; - case POWER_MODE_CTRL_MODE_SLEEP: - control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, SLEEP); - break; + case POWER_MODE_CTRL_MODE_SLEEP: + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, SLEEP); + break; - default: - break; - } + default: + break; + } - /* Set up other fields in Power Control Register */ - if (powerMode = POWER_MODE_CTRL_MODE_SLEEP) - { - control_value + /* Set up other fields in Power Control Register */ + if (powerMode = POWER_MODE_CTRL_MODE_SLEEP) + { + control_value #ifdef VALIDATION_CHIP - FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, OFF) | + FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, OFF) | #endif - FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); - } - else - { - control_value + FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); + } + else + { + control_value #ifdef VALIDATION_CHIP - FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, ON) | + FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, ON) | #endif - FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, ON); - } + FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, ON); + } - /* Program new power mode. */ - POKE32(POWER_MODE_CTRL, control_value); + /* Program new power mode. */ + POKE32(POWER_MODE_CTRL, control_value); } void setCurrentGate(unsigned int gate) { - unsigned int gate_reg; - unsigned int mode; - - /* Get current power mode. */ - mode = getPowerMode(); - - switch (mode) - { - case POWER_MODE_CTRL_MODE_MODE0: - gate_reg = MODE0_GATE; - break; - - case POWER_MODE_CTRL_MODE_MODE1: - gate_reg = MODE1_GATE; - break; - - default: - gate_reg = MODE0_GATE; - break; - } - POKE32(gate_reg, gate); + unsigned int gate_reg; + unsigned int mode; + + /* Get current power mode. */ + mode = getPowerMode(); + + switch (mode) + { + case POWER_MODE_CTRL_MODE_MODE0: + gate_reg = MODE0_GATE; + break; + + case POWER_MODE_CTRL_MODE_MODE1: + gate_reg = MODE1_GATE; + break; + + default: + gate_reg = MODE0_GATE; + break; + } + POKE32(gate_reg, gate); } @@ -108,21 +108,21 @@ void setCurrentGate(unsigned int gate) */ void enable2DEngine(unsigned int enable) { - uint32_t gate; - - gate = PEEK32(CURRENT_GATE); - if (enable) - { - gate = FIELD_SET(gate, CURRENT_GATE, DE, ON); - gate = FIELD_SET(gate, CURRENT_GATE, CSC, ON); - } - else - { - gate = FIELD_SET(gate, CURRENT_GATE, DE, OFF); - gate = FIELD_SET(gate, CURRENT_GATE, CSC, OFF); - } - - setCurrentGate(gate); + uint32_t gate; + + gate = PEEK32(CURRENT_GATE); + if (enable) + { + gate = FIELD_SET(gate, CURRENT_GATE, DE, ON); + gate = FIELD_SET(gate, CURRENT_GATE, CSC, ON); + } + else + { + gate = FIELD_SET(gate, CURRENT_GATE, DE, OFF); + gate = FIELD_SET(gate, CURRENT_GATE, CSC, OFF); + } + + setCurrentGate(gate); } @@ -131,58 +131,58 @@ void enable2DEngine(unsigned int enable) */ void enableZVPort(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable ZV Port Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - { - gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, ON); + /* Enable ZV Port Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + { + gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, ON); #if 1 - /* Using Software I2C */ - gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); + /* Using Software I2C */ + gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); #else - /* Using Hardware I2C */ - gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); + /* Using Hardware I2C */ + gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); #endif - } - else - { - /* Disable ZV Port Gate. There is no way to know whether the GPIO pins are being used - or not. Therefore, do not disable the GPIO gate. */ - gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, OFF); - } - - setCurrentGate(gate); + } + else + { + /* Disable ZV Port Gate. There is no way to know whether the GPIO pins are being used + or not. Therefore, do not disable the GPIO gate. */ + gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, OFF); + } + + setCurrentGate(gate); } void enableSSP(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable SSP Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, SSP, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, SSP, OFF); + /* Enable SSP Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, SSP, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, SSP, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } void enableDMA(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable DMA Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, DMA, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, DMA, OFF); + /* Enable DMA Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, DMA, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, DMA, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } /* @@ -190,16 +190,16 @@ void enableDMA(unsigned int enable) */ void enableGPIO(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable GPIO Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, GPIO, OFF); + /* Enable GPIO Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, GPIO, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } /* @@ -207,16 +207,16 @@ void enableGPIO(unsigned int enable) */ void enablePWM(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable PWM Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, PWM, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, PWM, OFF); + /* Enable PWM Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, PWM, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, PWM, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } /* @@ -224,16 +224,16 @@ void enablePWM(unsigned int enable) */ void enableI2C(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable I2C Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, I2C, OFF); + /* Enable I2C Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, I2C, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } diff --git a/drivers/staging/sm750fb/ddk750_power.h b/drivers/staging/sm750fb/ddk750_power.h index 4e00955..a20d438 100644 --- a/drivers/staging/sm750fb/ddk750_power.h +++ b/drivers/staging/sm750fb/ddk750_power.h @@ -3,10 +3,10 @@ typedef enum _DPMS_t { - crtDPMS_ON = 0x0, - crtDPMS_STANDBY = 0x1, - crtDPMS_SUSPEND = 0x2, - crtDPMS_OFF = 0x3, + crtDPMS_ON = 0x0, + crtDPMS_STANDBY = 0x1, + crtDPMS_SUSPEND = 0x2, + crtDPMS_OFF = 0x3, } DPMS_t; diff --git a/drivers/staging/sm750fb/ddk750_reg.h b/drivers/staging/sm750fb/ddk750_reg.h index 1a40dc2..2995625 100644 --- a/drivers/staging/sm750fb/ddk750_reg.h +++ b/drivers/staging/sm750fb/ddk750_reg.h @@ -1640,9 +1640,9 @@ /* CRT Graphics Control */ #define CRT_DISPLAY_CTRL 0x080200 -#define CRT_DISPLAY_CTRL_RESERVED_1_MASK 31:27 -#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_DISABLE 0 -#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_ENABLE 0x1F +#define CRT_DISPLAY_CTRL_RESERVED_1_MASK 31:27 +#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_DISABLE 0 +#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_ENABLE 0x1F /* SM750LE definition */ #define CRT_DISPLAY_CTRL_DPMS 31:30 @@ -1664,9 +1664,9 @@ #define CRT_DISPLAY_CTRL_SHIFT_VGA_DAC_ENABLE 0 -#define CRT_DISPLAY_CTRL_RESERVED_2_MASK 25:24 -#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_ENABLE 3 -#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_DISABLE 0 +#define CRT_DISPLAY_CTRL_RESERVED_2_MASK 25:24 +#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_ENABLE 3 +#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_DISABLE 0 /* SM750LE definition */ #define CRT_DISPLAY_CTRL_CRTSELECT 25:25 @@ -1677,11 +1677,11 @@ #define CRT_DISPLAY_CTRL_RGBBIT_12BIT 1 -#define CRT_DISPLAY_CTRL_RESERVED_3_MASK 15:15 +#define CRT_DISPLAY_CTRL_RESERVED_3_MASK 15:15 #define CRT_DISPLAY_CTRL_RESERVED_3_MASK_DISABLE 0 #define CRT_DISPLAY_CTRL_RESERVED_3_MASK_ENABLE 1 -#define CRT_DISPLAY_CTRL_RESERVED_4_MASK 9:9 +#define CRT_DISPLAY_CTRL_RESERVED_4_MASK 9:9 #define CRT_DISPLAY_CTRL_RESERVED_4_MASK_DISABLE 0 #define CRT_DISPLAY_CTRL_RESERVED_4_MASK_ENABLE 1 @@ -1882,7 +1882,7 @@ #endif /* sm750le new register to control panel output */ -#define DISPLAY_CONTROL_750LE 0x80288 +#define DISPLAY_CONTROL_750LE 0x80288 /* Palette RAM */ /* Panel Palette register starts at 0x080400 ~ 0x0807FC */ diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c index b6395b8..c09748c 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.c +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -36,12 +36,12 @@ static char *gDviCtrlChipName = "Silicon Image SiI 164"; */ unsigned short sii164GetVendorID(void) { - unsigned short vendorID; + unsigned short vendorID; - vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) | - (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW); + vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) | + (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW); - return vendorID; + return vendorID; } /* @@ -53,12 +53,12 @@ unsigned short sii164GetVendorID(void) */ unsigned short sii164GetDeviceID(void) { - unsigned short deviceID; + unsigned short deviceID; - deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) | - (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW); + deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) | + (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW); - return deviceID; + return deviceID; } @@ -113,132 +113,132 @@ unsigned short sii164GetDeviceID(void) * -1 - Fail. */ long sii164InitChip( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue + unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue ) { unsigned char config; - /* Initialize the i2c bus */ + /* Initialize the i2c bus */ #ifdef USE_HW_I2C - /* Use fast mode. */ - hwI2CInit(1); + /* Use fast mode. */ + hwI2CInit(1); #else - swI2CInit(DEFAULT_I2C_SCL, DEFAULT_I2C_SDA); + swI2CInit(DEFAULT_I2C_SCL, DEFAULT_I2C_SDA); #endif - /* Check if SII164 Chip exists */ - if ((sii164GetVendorID() = SII164_VENDOR_ID) && (sii164GetDeviceID() = SII164_DEVICE_ID)) - { - /* - * Initialize SII164 controller chip. - */ - - /* Select the edge */ - if (edgeSelect = 0) - config = SII164_CONFIGURATION_LATCH_FALLING; - else - config = SII164_CONFIGURATION_LATCH_RISING; - - /* Select bus wide */ - if (busSelect = 0) - config |= SII164_CONFIGURATION_BUS_12BITS; - else - config |= SII164_CONFIGURATION_BUS_24BITS; - - /* Select Dual/Single Edge Clock */ - if (dualEdgeClkSelect = 0) - config |= SII164_CONFIGURATION_CLOCK_SINGLE; - else - config |= SII164_CONFIGURATION_CLOCK_DUAL; - - /* Select HSync Enable */ - if (hsyncEnable = 0) - config |= SII164_CONFIGURATION_HSYNC_FORCE_LOW; - else - config |= SII164_CONFIGURATION_HSYNC_AS_IS; - - /* Select VSync Enable */ - if (vsyncEnable = 0) - config |= SII164_CONFIGURATION_VSYNC_FORCE_LOW; - else - config |= SII164_CONFIGURATION_VSYNC_AS_IS; - - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - - /* De-skew enabled with default 111b value. - This will fix some artifacts problem in some mode on board 2.2. - Somehow this fix does not affect board 2.1. - */ - if (deskewEnable = 0) - config = SII164_DESKEW_DISABLE; - else - config = SII164_DESKEW_ENABLE; - - switch (deskewSetting) - { - case 0: - config |= SII164_DESKEW_1_STEP; - break; - case 1: - config |= SII164_DESKEW_2_STEP; - break; - case 2: - config |= SII164_DESKEW_3_STEP; - break; - case 3: - config |= SII164_DESKEW_4_STEP; - break; - case 4: - config |= SII164_DESKEW_5_STEP; - break; - case 5: - config |= SII164_DESKEW_6_STEP; - break; - case 6: - config |= SII164_DESKEW_7_STEP; - break; - case 7: - config |= SII164_DESKEW_8_STEP; - break; - } - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DESKEW, config); - - /* Enable/Disable Continuous Sync. */ - if (continuousSyncEnable = 0) - config = SII164_PLL_FILTER_SYNC_CONTINUOUS_DISABLE; - else - config = SII164_PLL_FILTER_SYNC_CONTINUOUS_ENABLE; - - /* Enable/Disable PLL Filter */ - if (pllFilterEnable = 0) - config |= SII164_PLL_FILTER_DISABLE; - else - config |= SII164_PLL_FILTER_ENABLE; - - /* Set the PLL Filter value */ - config |= ((pllFilterValue & 0x07) << 1); - - i2cWriteReg(SII164_I2C_ADDRESS, SII164_PLL, config); - - /* Recover from Power Down and enable output. */ - config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); - config |= SII164_CONFIGURATION_POWER_NORMAL; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - - return 0; - } - - /* Return -1 if initialization fails. */ - return (-1); + /* Check if SII164 Chip exists */ + if ((sii164GetVendorID() = SII164_VENDOR_ID) && (sii164GetDeviceID() = SII164_DEVICE_ID)) + { + /* + * Initialize SII164 controller chip. + */ + + /* Select the edge */ + if (edgeSelect = 0) + config = SII164_CONFIGURATION_LATCH_FALLING; + else + config = SII164_CONFIGURATION_LATCH_RISING; + + /* Select bus wide */ + if (busSelect = 0) + config |= SII164_CONFIGURATION_BUS_12BITS; + else + config |= SII164_CONFIGURATION_BUS_24BITS; + + /* Select Dual/Single Edge Clock */ + if (dualEdgeClkSelect = 0) + config |= SII164_CONFIGURATION_CLOCK_SINGLE; + else + config |= SII164_CONFIGURATION_CLOCK_DUAL; + + /* Select HSync Enable */ + if (hsyncEnable = 0) + config |= SII164_CONFIGURATION_HSYNC_FORCE_LOW; + else + config |= SII164_CONFIGURATION_HSYNC_AS_IS; + + /* Select VSync Enable */ + if (vsyncEnable = 0) + config |= SII164_CONFIGURATION_VSYNC_FORCE_LOW; + else + config |= SII164_CONFIGURATION_VSYNC_AS_IS; + + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + + /* De-skew enabled with default 111b value. + This will fix some artifacts problem in some mode on board 2.2. + Somehow this fix does not affect board 2.1. + */ + if (deskewEnable = 0) + config = SII164_DESKEW_DISABLE; + else + config = SII164_DESKEW_ENABLE; + + switch (deskewSetting) + { + case 0: + config |= SII164_DESKEW_1_STEP; + break; + case 1: + config |= SII164_DESKEW_2_STEP; + break; + case 2: + config |= SII164_DESKEW_3_STEP; + break; + case 3: + config |= SII164_DESKEW_4_STEP; + break; + case 4: + config |= SII164_DESKEW_5_STEP; + break; + case 5: + config |= SII164_DESKEW_6_STEP; + break; + case 6: + config |= SII164_DESKEW_7_STEP; + break; + case 7: + config |= SII164_DESKEW_8_STEP; + break; + } + i2cWriteReg(SII164_I2C_ADDRESS, SII164_DESKEW, config); + + /* Enable/Disable Continuous Sync. */ + if (continuousSyncEnable = 0) + config = SII164_PLL_FILTER_SYNC_CONTINUOUS_DISABLE; + else + config = SII164_PLL_FILTER_SYNC_CONTINUOUS_ENABLE; + + /* Enable/Disable PLL Filter */ + if (pllFilterEnable = 0) + config |= SII164_PLL_FILTER_DISABLE; + else + config |= SII164_PLL_FILTER_ENABLE; + + /* Set the PLL Filter value */ + config |= ((pllFilterValue & 0x07) << 1); + + i2cWriteReg(SII164_I2C_ADDRESS, SII164_PLL, config); + + /* Recover from Power Down and enable output. */ + config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); + config |= SII164_CONFIGURATION_POWER_NORMAL; + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + + return 0; + } + + /* Return -1 if initialization fails. */ + return (-1); } @@ -255,9 +255,9 @@ long sii164InitChip( */ void sii164ResetChip(void) { - /* Power down */ - sii164SetPower(0); - sii164SetPower(1); + /* Power down */ + sii164SetPower(0); + sii164SetPower(1); } @@ -268,7 +268,7 @@ void sii164ResetChip(void) */ char *sii164GetChipString(void) { - return gDviCtrlChipName; + return gDviCtrlChipName; } @@ -279,27 +279,25 @@ char *sii164GetChipString(void) * Input: * powerUp - Flag to set the power down or up */ -void sii164SetPower( - unsigned char powerUp -) +void sii164SetPower(unsigned char powerUp) { - unsigned char config; - - config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); - if (powerUp = 1) - { - /* Power up the chip */ - config &= ~SII164_CONFIGURATION_POWER_MASK; - config |= SII164_CONFIGURATION_POWER_NORMAL; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - } - else - { - /* Power down the chip */ - config &= ~SII164_CONFIGURATION_POWER_MASK; - config |= SII164_CONFIGURATION_POWER_DOWN; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - } + unsigned char config; + + config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); + if (powerUp = 1) + { + /* Power up the chip */ + config &= ~SII164_CONFIGURATION_POWER_MASK; + config |= SII164_CONFIGURATION_POWER_NORMAL; + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + } + else + { + /* Power down the chip */ + config &= ~SII164_CONFIGURATION_POWER_MASK; + config |= SII164_CONFIGURATION_POWER_DOWN; + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + } } @@ -307,32 +305,30 @@ void sii164SetPower( * sii164SelectHotPlugDetectionMode * This function selects the mode of the hot plug detection. */ -static void sii164SelectHotPlugDetectionMode( - sii164_hot_plug_mode_t hotPlugMode -) +static void sii164SelectHotPlugDetectionMode(sii164_hot_plug_mode_t hotPlugMode) { - unsigned char detectReg; - - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; - switch (hotPlugMode) - { - case SII164_HOTPLUG_DISABLE: - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; - break; - case SII164_HOTPLUG_USE_MDI: - detectReg &= ~SII164_DETECT_INTERRUPT_MASK; - detectReg |= SII164_DETECT_INTERRUPT_BY_HTPLG_PIN; - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI; - break; - case SII164_HOTPLUG_USE_RSEN: - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN; - break; - case SII164_HOTPLUG_USE_HTPLG: - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG; - break; - } - - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg); + unsigned char detectReg; + + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; + switch (hotPlugMode) + { + case SII164_HOTPLUG_DISABLE: + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; + break; + case SII164_HOTPLUG_USE_MDI: + detectReg &= ~SII164_DETECT_INTERRUPT_MASK; + detectReg |= SII164_DETECT_INTERRUPT_BY_HTPLG_PIN; + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI; + break; + case SII164_HOTPLUG_USE_RSEN: + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN; + break; + case SII164_HOTPLUG_USE_HTPLG: + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG; + break; + } + + i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg); } /* @@ -341,19 +337,17 @@ static void sii164SelectHotPlugDetectionMode( * * enableHotPlug - Enable (=1) / disable (=0) Hot Plug detection */ -void sii164EnableHotPlugDetection( - unsigned char enableHotPlug -) +void sii164EnableHotPlugDetection(unsigned char enableHotPlug) { - unsigned char detectReg; - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); - - /* Depending on each DVI controller, need to enable the hot plug based on each - individual chip design. */ - if (enableHotPlug != 0) - sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI); - else - sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_DISABLE); + unsigned char detectReg; + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); + + /* Depending on each DVI controller, need to enable the hot plug based on each + individual chip design. */ + if (enableHotPlug != 0) + sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI); + else + sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_DISABLE); } /* @@ -366,13 +360,13 @@ void sii164EnableHotPlugDetection( */ unsigned char sii164IsConnected(void) { - unsigned char hotPlugValue; + unsigned char hotPlugValue; - hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_HOT_PLUG_STATUS_MASK; - if (hotPlugValue = SII164_DETECT_HOT_PLUG_STATUS_ON) - return 1; - else - return 0; + hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_HOT_PLUG_STATUS_MASK; + if (hotPlugValue = SII164_DETECT_HOT_PLUG_STATUS_ON) + return 1; + else + return 0; } /* @@ -385,13 +379,13 @@ unsigned char sii164IsConnected(void) */ unsigned char sii164CheckInterrupt(void) { - unsigned char detectReg; + unsigned char detectReg; - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_MONITOR_STATE_MASK; - if (detectReg = SII164_DETECT_MONITOR_STATE_CHANGE) - return 1; - else - return 0; + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_MONITOR_STATE_MASK; + if (detectReg = SII164_DETECT_MONITOR_STATE_CHANGE) + return 1; + else + return 0; } /* @@ -400,11 +394,10 @@ unsigned char sii164CheckInterrupt(void) */ void sii164ClearInterrupt(void) { - unsigned char detectReg; + unsigned char detectReg; - /* Clear the MDI interrupt */ - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg | SII164_DETECT_MONITOR_STATE_CLEAR); + /* Clear the MDI interrupt */ + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); } #endif diff --git a/drivers/staging/sm750fb/ddk750_sii164.h b/drivers/staging/sm750fb/ddk750_sii164.h index 2b4c7d3..bb0ed25 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.h +++ b/drivers/staging/sm750fb/ddk750_sii164.h @@ -6,25 +6,24 @@ /* Hot Plug detection mode structure */ typedef enum _sii164_hot_plug_mode_t { - SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit (always high). */ - SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Interrupt bit. */ - SII164_HOTPLUG_USE_RSEN, /* Use Receiver Sense detect bit. */ - SII164_HOTPLUG_USE_HTPLG /* Use Hot Plug detect bit. */ + SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit (always high). */ + SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Interrupt bit. */ + SII164_HOTPLUG_USE_RSEN, /* Use Receiver Sense detect bit. */ + SII164_HOTPLUG_USE_HTPLG /* Use Hot Plug detect bit. */ } sii164_hot_plug_mode_t; /* Silicon Image SiI164 chip prototype */ -long sii164InitChip( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue +long sii164InitChip(unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue ); unsigned short sii164GetVendorID(void); diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index cc80580..bf894cc 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -5,7 +5,7 @@ #define FB_ACCEL_SMI 0xab /* please use revision id to distinguish sm750le and sm750*/ -#define SPC_SM750 0 +#define SPC_SM750 0 #define MB(x) ((x)<<20) #define MHZ(x) ((x) * 1000000) @@ -38,8 +38,8 @@ struct lynx_accel{ }; -/* lynx_share stands for a presentation of two frame buffer - that use one smi adaptor , it is similar to a basic class of C++ +/* lynx_share stands for a presentation of two frame buffer + that use one smi adaptor , it is similar to a basic class of C++ */ struct lynx_share{ /* common members */ @@ -126,17 +126,17 @@ struct lynxfb_crtc{ struct lynxfb_output{ int dpms; int paths; - /* which paths(s) this output stands for,for sm750: - paths=1:means output for panel paths - paths=2:means output for crt paths - paths=3:means output for both panel and crt paths + /* which paths(s) this output stands for,for sm750: + paths=1:means output for panel paths + paths=2:means output for crt paths + paths=3:means output for both panel and crt paths */ int *channel; - /* which channel these outputs linked with,for sm750: - *channel=0 means primary channel - *channel=1 means secondary channel - output->channel => &crtc->channel + /* which channel these outputs linked with,for sm750: + *channel=0 means primary channel + *channel=1 means secondary channel + output->channel => &crtc->channel */ void *priv; @@ -165,7 +165,7 @@ struct lynxfb_par{ #define PS_TO_HZ(ps) \ - ({ \ + ({ \ unsigned long long hz = 1000*1000*1000*1000ULL; \ do_div(hz, ps); \ (unsigned long)hz;}) diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 6eee4cd..806aeed 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -151,97 +151,96 @@ unsigned int width, unsigned int height, /* width and height of rectangle in pixel value */ unsigned int rop2) /* ROP value */ { - unsigned int nDirection, de_ctrl; - int opSign; - nDirection = LEFT_TO_RIGHT; + unsigned int nDirection, de_ctrl; + int opSign; + nDirection = LEFT_TO_RIGHT; /* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */ - opSign = 1; - de_ctrl = 0; - - /* If source and destination are the same surface, need to check for overlay cases */ - if (sBase = dBase && sPitch = dPitch) - { - /* Determine direction of operation */ - if (sy < dy) - { - /* +----------+ - |S | - | +----------+ - | | | | - | | | | - +---|------+ | - | D| - +----------+ */ - - nDirection = BOTTOM_TO_TOP; - } - else if (sy > dy) - { - /* +----------+ - |D | - | +----------+ - | | | | - | | | | - +---|------+ | - | S| - +----------+ */ - - nDirection = TOP_TO_BOTTOM; - } - else - { - /* sy = dy */ - - if (sx <= dx) - { - /* +------+---+------+ - |S | | D| - | | | | - | | | | - | | | | - +------+---+------+ */ - - nDirection = RIGHT_TO_LEFT; - } - else - { - /* sx > dx */ - - /* +------+---+------+ - |D | | S| - | | | | - | | | | - | | | | - +------+---+------+ */ - - nDirection = LEFT_TO_RIGHT; - } - } - } - - if ((nDirection = BOTTOM_TO_TOP) || (nDirection = RIGHT_TO_LEFT)) - { - sx += width - 1; - sy += height - 1; - dx += width - 1; - dy += height - 1; - opSign = (-1); - } - - /* Note: - DE_FOREGROUND are DE_BACKGROUND are don't care. - DE_COLOR_COMPARE and DE_COLOR_COMPARE_MAKS are set by set deSetTransparency(). - */ + opSign = 1; + de_ctrl = 0; - /* 2D Source Base. - It is an address offset (128 bit aligned) from the beginning of frame buffer. - */ - write_dpr(accel, DE_WINDOW_SOURCE_BASE, sBase); /* dpr40 */ + /* If source and destination are the same surface, need to check for overlay cases */ + if (sBase = dBase && sPitch = dPitch) + { + /* Determine direction of operation */ + if (sy < dy) + { + /* +----------+ + |S | + | +----------+ + | | | | + | | | | + +---|------+ | + | D| + +----------+ */ + + nDirection = BOTTOM_TO_TOP; + } + else if (sy > dy) + { + /* +----------+ + |D | + | +----------+ + | | | | + | | | | + +---|------+ | + | S| + +----------+ */ + + nDirection = TOP_TO_BOTTOM; + } + else + { + /* sy = dy */ + if (sx <= dx) + { + /* +------+---+------+ + |S | | D| + | | | | + | | | | + | | | | + +------+---+------+ */ + + nDirection = RIGHT_TO_LEFT; + } + else + { + /* sx > dx */ + + /* +------+---+------+ + |D | | S| + | | | | + | | | | + | | | | + +------+---+------+ */ + + nDirection = LEFT_TO_RIGHT; + } + } + } - /* 2D Destination Base. - It is an address offset (128 bit aligned) from the beginning of frame buffer. - */ - write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); /* dpr44 */ + if ((nDirection = BOTTOM_TO_TOP) || (nDirection = RIGHT_TO_LEFT)) + { + sx += width - 1; + sy += height - 1; + dx += width - 1; + dy += height - 1; + opSign = (-1); + } + + /* Note: + DE_FOREGROUND are DE_BACKGROUND are don't care. + DE_COLOR_COMPARE and DE_COLOR_COMPARE_MAKS are set by set deSetTransparency(). + */ + + /* 2D Source Base. + It is an address offset (128 bit aligned) from the beginning of frame buffer. + */ + write_dpr(accel, DE_WINDOW_SOURCE_BASE, sBase); /* dpr40 */ + + /* 2D Destination Base. + It is an address offset (128 bit aligned) from the beginning of frame buffer. + */ + write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); /* dpr44 */ #if 0 /* Program pitch (distance between the 1st points of two adjacent lines). @@ -267,54 +266,49 @@ unsigned int rop2) /* ROP value */ /* Screen Window width in Pixels. 2D engine uses this value to calculate the linear address in frame buffer for a given point. */ - write_dpr(accel, DE_WINDOW_WIDTH, - FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | - FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp))); /* dpr3c */ + write_dpr(accel, DE_WINDOW_WIDTH, + FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | + FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp))); /* dpr3c */ if (accel->de_wait() != 0){ return -1; } - { - - write_dpr(accel, DE_SOURCE, - FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | - FIELD_VALUE(0, DE_SOURCE, X_K1, sx) | - FIELD_VALUE(0, DE_SOURCE, Y_K2, sy)); /* dpr0 */ - write_dpr(accel, DE_DESTINATION, - FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | - FIELD_VALUE(0, DE_DESTINATION, X, dx) | - FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ - write_dpr(accel, DE_DIMENSION, - FIELD_VALUE(0, DE_DIMENSION, X, width) | - FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */ - - de_ctrl - FIELD_VALUE(0, DE_CONTROL, ROP, rop2) | - FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) | - FIELD_SET(0, DE_CONTROL, COMMAND, BITBLT) | - ((nDirection = RIGHT_TO_LEFT) ? - FIELD_SET(0, DE_CONTROL, DIRECTION, RIGHT_TO_LEFT) - : FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT)) | - FIELD_SET(0, DE_CONTROL, STATUS, START); - write_dpr(accel, DE_CONTROL, de_ctrl); /* dpr0c */ - } - - return 0; + write_dpr(accel, DE_SOURCE, + FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_VALUE(0, DE_SOURCE, X_K1, sx) | + FIELD_VALUE(0, DE_SOURCE, Y_K2, sy)); /* dpr0 */ + write_dpr(accel, DE_DESTINATION, + FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_VALUE(0, DE_DESTINATION, X, dx) | + FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ + write_dpr(accel, DE_DIMENSION, + FIELD_VALUE(0, DE_DIMENSION, X, width) | + FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */ + + de_ctrl = FIELD_VALUE(0, DE_CONTROL, ROP, rop2) | + FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) | + FIELD_SET(0, DE_CONTROL, COMMAND, BITBLT) | + ((nDirection = RIGHT_TO_LEFT) ? + FIELD_SET(0, DE_CONTROL, DIRECTION, RIGHT_TO_LEFT) + : FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT)) | + FIELD_SET(0, DE_CONTROL, STATUS, START); + write_dpr(accel, DE_CONTROL, de_ctrl); /* dpr0c */ + + return 0; } static unsigned int deGetTransparency(struct lynx_accel *accel) { - unsigned int de_ctrl; + unsigned int de_ctrl; - de_ctrl = read_dpr(accel, DE_CONTROL); + de_ctrl = read_dpr(accel, DE_CONTROL); - de_ctrl &- FIELD_MASK(DE_CONTROL_TRANSPARENCY_MATCH) | - FIELD_MASK(DE_CONTROL_TRANSPARENCY_SELECT)| - FIELD_MASK(DE_CONTROL_TRANSPARENCY); + de_ctrl &= FIELD_MASK(DE_CONTROL_TRANSPARENCY_MATCH) | + FIELD_MASK(DE_CONTROL_TRANSPARENCY_SELECT)| + FIELD_MASK(DE_CONTROL_TRANSPARENCY); - return de_ctrl; + return de_ctrl; } int hw_imageblit(struct lynx_accel *accel, @@ -332,32 +326,32 @@ int hw_imageblit(struct lynx_accel *accel, u32 bColor, /* Background color (corresponding to a 0 in the monochrome data */ u32 rop2) /* ROP value */ { - unsigned int ulBytesPerScan; - unsigned int ul4BytesPerScan; - unsigned int ulBytesRemain; - unsigned int de_ctrl = 0; - unsigned char ajRemain[4]; - int i, j; - - startBit &= 7; /* Just make sure the start bit is within legal range */ - ulBytesPerScan = (width + startBit + 7) / 8; - ul4BytesPerScan = ulBytesPerScan & ~3; - ulBytesRemain = ulBytesPerScan & 3; + unsigned int ulBytesPerScan; + unsigned int ul4BytesPerScan; + unsigned int ulBytesRemain; + unsigned int de_ctrl = 0; + unsigned char ajRemain[4]; + int i, j; + + startBit &= 7; /* Just make sure the start bit is within legal range */ + ulBytesPerScan = (width + startBit + 7) / 8; + ul4BytesPerScan = ulBytesPerScan & ~3; + ulBytesRemain = ulBytesPerScan & 3; if(accel->de_wait() != 0) - { - return -1; - } + { + return -1; + } - /* 2D Source Base. - Use 0 for HOST Blt. - */ - write_dpr(accel, DE_WINDOW_SOURCE_BASE, 0); + /* 2D Source Base. + Use 0 for HOST Blt. + */ + write_dpr(accel, DE_WINDOW_SOURCE_BASE, 0); - /* 2D Destination Base. - It is an address offset (128 bit aligned) from the beginning of frame buffer. - */ - write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); + /* 2D Destination Base. + It is an address offset (128 bit aligned) from the beginning of frame buffer. + */ + write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); #if 0 /* Program pitch (distance between the 1st points of two adjacent lines). Note that input pitch is BYTE value, but the 2D Pitch register uses @@ -380,30 +374,30 @@ int hw_imageblit(struct lynx_accel *accel, FIELD_VALUE(0, DE_PITCH, SOURCE, dPitch/bytePerPixel)); /* dpr10 */ } - /* Screen Window width in Pixels. - 2D engine uses this value to calculate the linear address in frame buffer for a given point. - */ - write_dpr(accel, DE_WINDOW_WIDTH, - FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/bytePerPixel)) | - FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (dPitch/bytePerPixel))); + /* Screen Window width in Pixels. + 2D engine uses this value to calculate the linear address in frame buffer for a given point. + */ + write_dpr(accel, DE_WINDOW_WIDTH, + FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/bytePerPixel)) | + FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (dPitch/bytePerPixel))); - /* Note: For 2D Source in Host Write, only X_K1_MONO field is needed, and Y_K2 field is not used. - For mono bitmap, use startBit for X_K1. */ - write_dpr(accel, DE_SOURCE, - FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | - FIELD_VALUE(0, DE_SOURCE, X_K1_MONO, startBit)); /* dpr00 */ + /* Note: For 2D Source in Host Write, only X_K1_MONO field is needed, and Y_K2 field is not used. + For mono bitmap, use startBit for X_K1. */ + write_dpr(accel, DE_SOURCE, + FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_VALUE(0, DE_SOURCE, X_K1_MONO, startBit)); /* dpr00 */ - write_dpr(accel, DE_DESTINATION, - FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | - FIELD_VALUE(0, DE_DESTINATION, X, dx) | - FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ + write_dpr(accel, DE_DESTINATION, + FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_VALUE(0, DE_DESTINATION, X, dx) | + FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ - write_dpr(accel, DE_DIMENSION, - FIELD_VALUE(0, DE_DIMENSION, X, width) | - FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */ + write_dpr(accel, DE_DIMENSION, + FIELD_VALUE(0, DE_DIMENSION, X, width) | + FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */ - write_dpr(accel, DE_FOREGROUND, fColor); - write_dpr(accel, DE_BACKGROUND, bColor); + write_dpr(accel, DE_FOREGROUND, fColor); + write_dpr(accel, DE_BACKGROUND, bColor); de_ctrl = FIELD_VALUE(0, DE_CONTROL, ROP, rop2) | FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) | @@ -413,24 +407,24 @@ int hw_imageblit(struct lynx_accel *accel, write_dpr(accel, DE_CONTROL, de_ctrl | deGetTransparency(accel)); - /* Write MONO data (line by line) to 2D Engine data port */ - for (i=0; i<height; i++) - { - /* For each line, send the data in chunks of 4 bytes */ - for (j=0; j<(ul4BytesPerScan/4); j++) - { - write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4))); - } - - if (ulBytesRemain) - { - memcpy(ajRemain, pSrcbuf+ul4BytesPerScan, ulBytesRemain); - write_dpPort(accel, *(unsigned int *)ajRemain); - } - - pSrcbuf += srcDelta; - } - - return 0; + /* Write MONO data (line by line) to 2D Engine data port */ + for (i=0; i<height; i++) + { + /* For each line, send the data in chunks of 4 bytes */ + for (j=0; j<(ul4BytesPerScan/4); j++) + { + write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4))); + } + + if (ulBytesRemain) + { + memcpy(ajRemain, pSrcbuf+ul4BytesPerScan, ulBytesRemain); + write_dpPort(accel, *(unsigned int *)ajRemain); + } + + pSrcbuf += srcDelta; + } + + return 0; } diff --git a/drivers/staging/sm750fb/sm750_accel.h b/drivers/staging/sm750fb/sm750_accel.h index d3d256c..f252e47 100644 --- a/drivers/staging/sm750fb/sm750_accel.h +++ b/drivers/staging/sm750fb/sm750_accel.h @@ -7,7 +7,7 @@ /* notes: below address are the offset value from de_base_address (0x100000)*/ /* for sm718/750/502 de_base is at mmreg_1mb*/ -#define DE_BASE_ADDR_TYPE1 0x100000 +#define DE_BASE_ADDR_TYPE1 0x100000 /* for sm712,de_base is at mmreg_32kb */ #define DE_BASE_ADDR_TYPE2 0x8000 /* for sm722,de_base is at mmreg_0 */ @@ -26,7 +26,7 @@ #define DE_SOURCE_WRAP_ENABLE 1 #define DE_SOURCE_X_K1 29:16 #define DE_SOURCE_Y_K2 15:0 -#define DE_SOURCE_X_K1_MONO 20:16 +#define DE_SOURCE_X_K1_MONO 20:16 #define DE_DESTINATION 0x4 #define DE_DESTINATION_WRAP 31:31 diff --git a/drivers/staging/sm750fb/sm750_help.h b/drivers/staging/sm750fb/sm750_help.h index 05777f7..8ba4f8d 100644 --- a/drivers/staging/sm750fb/sm750_help.h +++ b/drivers/staging/sm750fb/sm750_help.h @@ -11,9 +11,9 @@ #define GET_FIELD(d, f) (((d) >> _LSB(f)) & RAW_MASK(f)) #define TEST_FIELD(d, f, v) (GET_FIELD(d, f) = f ## _ ## v) #define SET_FIELD(d, f, v) (((d) & ~GET_MASK(f)) | \ - (((f ## _ ## v) & RAW_MASK(f)) << _LSB(f))) + (((f ## _ ## v) & RAW_MASK(f)) << _LSB(f))) #define SET_FIELDV(d, f, v) (((d) & ~GET_MASK(f)) | \ - (((v) & RAW_MASK(f)) << _LSB(f))) + (((v) & RAW_MASK(f)) << _LSB(f))) /* Internal macros */ #define _F_START(f) (0 ? f) @@ -26,24 +26,24 @@ /* Global macros */ #define FIELD_GET(x, reg, field) \ ( \ - _F_NORMALIZE((x), reg ## _ ## field) \ + _F_NORMALIZE((x), reg ## _ ## field) \ ) #define FIELD_SET(x, reg, field, value) \ ( \ - (x & ~_F_MASK(reg ## _ ## field)) \ - | _F_DENORMALIZE(reg ## _ ## field ## _ ## value, reg ## _ ## field) \ + (x & ~_F_MASK(reg ## _ ## field)) \ + | _F_DENORMALIZE(reg ## _ ## field ## _ ## value, reg ## _ ## field) \ ) #define FIELD_VALUE(x, reg, field, value) \ ( \ - (x & ~_F_MASK(reg ## _ ## field)) \ - | _F_DENORMALIZE(value, reg ## _ ## field) \ + (x & ~_F_MASK(reg ## _ ## field)) \ + | _F_DENORMALIZE(value, reg ## _ ## field) \ ) #define FIELD_CLEAR(reg, field) \ ( \ - ~ _F_MASK(reg ## _ ## field) \ + ~ _F_MASK(reg ## _ ## field) \ ) /* Field Macros */ @@ -55,20 +55,20 @@ #define FIELD_DENORMALIZE(field, value) (((value) << FIELD_START(field)) & FIELD_MASK(field)) #define FIELD_INIT(reg, field, value) FIELD_DENORMALIZE(reg ## _ ## field, \ - reg ## _ ## field ## _ ## value) + reg ## _ ## field ## _ ## value) #define FIELD_INIT_VAL(reg, field, value) \ - (FIELD_DENORMALIZE(reg ## _ ## field, value)) + (FIELD_DENORMALIZE(reg ## _ ## field, value)) #define FIELD_VAL_SET(x, r, f, v) x = x & ~FIELD_MASK(r ## _ ## f) \ - | FIELD_DENORMALIZE(r ## _ ## f, r ## _ ## f ## _ ## v) + | FIELD_DENORMALIZE(r ## _ ## f, r ## _ ## f ## _ ## v) #define RGB(r, g, b) \ ( \ - (unsigned long) (((r) << 16) | ((g) << 8) | (b)) \ + (unsigned long) (((r) << 16) | ((g) << 8) | (b)) \ ) #define RGB16(r, g, b) \ ( \ - (unsigned short) ((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | (((b) & 0xF8) >> 3)) \ + (unsigned short) ((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | (((b) & 0xF8) >> 3)) \ ) static inline unsigned int absDiff(unsigned int a, unsigned int b) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 84381bc..28db9c7 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -171,23 +171,23 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) /* Set up GPIO for software I2C to program DVI chip in the Xilinx SP605 board, in order to have video signal. */ - swI2CInit(0, 1); + swI2CInit(0, 1); - /* Customer may NOT use CH7301 DVI chip, which has to be - initialized differently. - */ - if (swI2CReadReg(0xec, 0x4a) = 0x95) - { - /* The following register values for CH7301 are from - Chrontel app note and our experiment. - */ + /* Customer may NOT use CH7301 DVI chip, which has to be + initialized differently. + */ + if (swI2CReadReg(0xec, 0x4a) = 0x95) + { + /* The following register values for CH7301 are from + Chrontel app note and our experiment. + */ pr_info("yes,CH7301 DVI chip found\n"); - swI2CWriteReg(0xec, 0x1d, 0x16); - swI2CWriteReg(0xec, 0x21, 0x9); - swI2CWriteReg(0xec, 0x49, 0xC0); + swI2CWriteReg(0xec, 0x1d, 0x16); + swI2CWriteReg(0xec, 0x21, 0x9); + swI2CWriteReg(0xec, 0x49, 0xC0); pr_info("okay,CH7301 DVI chip setup done\n"); - } + } } /* init 2d engine */ @@ -612,28 +612,28 @@ int hw_sm750_deWait(void) } int hw_sm750_pan_display(struct lynxfb_crtc *crtc, - const struct fb_var_screeninfo *var, - const struct fb_info *info) + const struct fb_var_screeninfo *var, + const struct fb_info *info) { - uint32_t total; - /* check params */ - if ((var->xoffset + var->xres > var->xres_virtual) || - (var->yoffset + var->yres > var->yres_virtual)) { - return -EINVAL; - } - - total = var->yoffset * info->fix.line_length + - ((var->xoffset * var->bits_per_pixel) >> 3); - total += crtc->oScreen; - if (crtc->channel = sm750_primary) { - POKE32(PANEL_FB_ADDRESS, - FIELD_VALUE(PEEK32(PANEL_FB_ADDRESS), - PANEL_FB_ADDRESS, ADDRESS, total)); - } else { - POKE32(CRT_FB_ADDRESS, - FIELD_VALUE(PEEK32(CRT_FB_ADDRESS), - CRT_FB_ADDRESS, ADDRESS, total)); - } - return 0; + uint32_t total; + /* check params */ + if ((var->xoffset + var->xres > var->xres_virtual) || + (var->yoffset + var->yres > var->yres_virtual)) { + return -EINVAL; + } + + total = var->yoffset * info->fix.line_length + + ((var->xoffset * var->bits_per_pixel) >> 3); + total += crtc->oScreen; + if (crtc->channel = sm750_primary) { + POKE32(PANEL_FB_ADDRESS, + FIELD_VALUE(PEEK32(PANEL_FB_ADDRESS), + PANEL_FB_ADDRESS, ADDRESS, total)); + } else { + POKE32(CRT_FB_ADDRESS, + FIELD_VALUE(PEEK32(CRT_FB_ADDRESS), + CRT_FB_ADDRESS, ADDRESS, total)); + } + return 0; } diff --git a/drivers/staging/sm750fb/sm750_hw.h b/drivers/staging/sm750fb/sm750_hw.h index 93288b3..adc61edf 100644 --- a/drivers/staging/sm750fb/sm750_hw.h +++ b/drivers/staging/sm750fb/sm750_hw.h @@ -2,8 +2,8 @@ #define LYNX_HW750_H__ -#define DEFAULT_SM750_CHIP_CLOCK 290 -#define DEFAULT_SM750LE_CHIP_CLOCK 333 +#define DEFAULT_SM750_CHIP_CLOCK 290 +#define DEFAULT_SM750LE_CHIP_CLOCK 333 #ifndef SM750LE_REVISION_ID #define SM750LE_REVISION_ID (unsigned char)0xfe #endif @@ -24,9 +24,9 @@ enum sm750_dataflow{ sm750_simul_sec,/* secondary => all head */ - sm750_dual_normal,/* primary => panel head and secondary => crt */ + sm750_dual_normal,/* primary => panel head and secondary => crt */ - sm750_dual_swap,/* primary => crt head and secondary => panel */ + sm750_dual_swap,/* primary => crt head and secondary => panel */ }; @@ -61,20 +61,20 @@ struct sm750_state{ int yLCD; }; -/* sm750_share stands for a presentation of two frame buffer - that use one sm750 adaptor, it is similar to the super class of lynx_share - in C++ -*/ +/* sm750_share stands for a presentation of two frame buffer + that use one sm750 adaptor, it is similar to the super class of lynx_share + in C++ + */ struct sm750_share{ /* it's better to put lynx_share struct to the first place of sm750_share */ struct lynx_share share; struct sm750_state state; int hwCursor; - /* 0: no hardware cursor - 1: primary crtc hw cursor enabled, - 2: secondary crtc hw cursor enabled - 3: both ctrc hw cursor enabled + /* 0: no hardware cursor + 1: primary crtc hw cursor enabled, + 2: secondary crtc hw cursor enabled + 3: both ctrc hw cursor enabled */ }; @@ -95,7 +95,7 @@ int hw_sm750le_setBLANK(struct lynxfb_output*, int); void hw_sm750_crtc_clear(struct lynxfb_crtc*); void hw_sm750_output_clear(struct lynxfb_output*); int hw_sm750_pan_display(struct lynxfb_crtc *crtc, - const struct fb_var_screeninfo *var, - const struct fb_info *info); + const struct fb_var_screeninfo *var, + const struct fb_info *info); #endif -- 2.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 1/4] staging: sm750fb: use tabs for indentation @ 2015-06-20 8:48 ` Juston Li 0 siblings, 0 replies; 16+ messages in thread From: Juston Li @ 2015-06-20 8:48 UTC (permalink / raw) To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, devel, linux-kernel Cc: Juston Li Replace spaces with tabs for indentation to fix the checkpatch.pl error ERROR: code indent should use tabs where possible WARNING: please, no spaces at the start of a line Signed-off-by: Juston Li <juston.h.li@gmail.com> --- drivers/staging/sm750fb/ddk750_display.c | 100 ++++---- drivers/staging/sm750fb/ddk750_display.h | 2 +- drivers/staging/sm750fb/ddk750_dvi.c | 66 ++--- drivers/staging/sm750fb/ddk750_help.h | 4 +- drivers/staging/sm750fb/ddk750_hwi2c.c | 246 +++++++++---------- drivers/staging/sm750fb/ddk750_mode.c | 142 +++++------ drivers/staging/sm750fb/ddk750_mode.h | 46 ++-- drivers/staging/sm750fb/ddk750_power.c | 254 ++++++++++---------- drivers/staging/sm750fb/ddk750_power.h | 8 +- drivers/staging/sm750fb/ddk750_reg.h | 18 +- drivers/staging/sm750fb/ddk750_sii164.c | 399 +++++++++++++++---------------- drivers/staging/sm750fb/ddk750_sii164.h | 29 ++- drivers/staging/sm750fb/sm750.h | 24 +- drivers/staging/sm750fb/sm750_accel.c | 364 ++++++++++++++-------------- drivers/staging/sm750fb/sm750_accel.h | 4 +- drivers/staging/sm750fb/sm750_help.h | 26 +- drivers/staging/sm750fb/sm750_hw.c | 70 +++--- drivers/staging/sm750fb/sm750_hw.h | 28 +-- 18 files changed, 908 insertions(+), 922 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index a3e6720..1c4049f 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -24,7 +24,7 @@ static void setDisplayControl(int ctrl, int dispState) /* Timing should be enabled first before enabling the plane * because changing at the same time does not guarantee that * the plane will also enabled or disabled. - */ + */ ulDisplayCtrlReg = FIELD_SET(ulDisplayCtrlReg, PANEL_DISPLAY_CTRL, TIMING, ENABLE); POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); @@ -135,8 +135,8 @@ static void waitNextVerticalSync(int ctrl, int delay) if(!ctrl){ /* primary controller */ - /* Do not wait when the Primary PLL is off or display control is already off. - This will prevent the software to wait forever. */ + /* Do not wait when the Primary PLL is off or display control is already off. + This will prevent the software to wait forever. */ if ((FIELD_GET(PEEK32(PANEL_PLL_CTRL), PANEL_PLL_CTRL, POWER) == PANEL_PLL_CTRL_POWER_OFF) || (FIELD_GET(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, TIMING) == @@ -145,26 +145,26 @@ static void waitNextVerticalSync(int ctrl, int delay) return; } - while (delay-- > 0) - { - /* Wait for end of vsync. */ - do - { - status = FIELD_GET(PEEK32(SYSTEM_CTRL), - SYSTEM_CTRL, - PANEL_VSYNC); - } - while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); - - /* Wait for start of vsync. */ - do - { - status = FIELD_GET(PEEK32(SYSTEM_CTRL), - SYSTEM_CTRL, - PANEL_VSYNC); - } - while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); - } + while (delay-- > 0) + { + /* Wait for end of vsync. */ + do + { + status = FIELD_GET(PEEK32(SYSTEM_CTRL), + SYSTEM_CTRL, + PANEL_VSYNC); + } + while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); + + /* Wait for start of vsync. */ + do + { + status = FIELD_GET(PEEK32(SYSTEM_CTRL), + SYSTEM_CTRL, + PANEL_VSYNC); + } + while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); + } }else{ @@ -275,33 +275,33 @@ void ddk750_setLogicalDispOut(disp_output_t output) int ddk750_initDVIDisp(void) { - /* Initialize DVI. If the dviInit fail and the VendorID or the DeviceID are - not zeroed, then set the failure flag. If it is zeroe, it might mean - that the system is in Dual CRT Monitor configuration. */ - - /* De-skew enabled with default 111b value. - This will fix some artifacts problem in some mode on board 2.2. - Somehow this fix does not affect board 2.1. - */ - if ((dviInit(1, /* Select Rising Edge */ - 1, /* Select 24-bit bus */ - 0, /* Select Single Edge clock */ - 1, /* Enable HSync as is */ - 1, /* Enable VSync as is */ - 1, /* Enable De-skew */ - 7, /* Set the de-skew setting to maximum setup */ - 1, /* Enable continuous Sync */ - 1, /* Enable PLL Filter */ - 4 /* Use the recommended value for PLL Filter value */ - ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) - { - return (-1); - } - - /* TODO: Initialize other display component */ - - /* Success */ - return 0; + /* Initialize DVI. If the dviInit fail and the VendorID or the DeviceID are + not zeroed, then set the failure flag. If it is zeroe, it might mean + that the system is in Dual CRT Monitor configuration. */ + + /* De-skew enabled with default 111b value. + This will fix some artifacts problem in some mode on board 2.2. + Somehow this fix does not affect board 2.1. + */ + if ((dviInit(1, /* Select Rising Edge */ + 1, /* Select 24-bit bus */ + 0, /* Select Single Edge clock */ + 1, /* Enable HSync as is */ + 1, /* Enable VSync as is */ + 1, /* Enable De-skew */ + 7, /* Set the de-skew setting to maximum setup */ + 1, /* Enable continuous Sync */ + 1, /* Enable PLL Filter */ + 4 /* Use the recommended value for PLL Filter value */ + ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) + { + return (-1); + } + + /* TODO: Initialize other display component */ + + /* Success */ + return 0; } diff --git a/drivers/staging/sm750fb/ddk750_display.h b/drivers/staging/sm750fb/ddk750_display.h index ae0f84c..018a661 100644 --- a/drivers/staging/sm750fb/ddk750_display.h +++ b/drivers/staging/sm750fb/ddk750_display.h @@ -8,7 +8,7 @@ #define PNL_2_OFFSET 0 #define PNL_2_MASK (3 << PNL_2_OFFSET) #define PNL_2_USAGE (PNL_2_MASK << 16) -#define PNL_2_PRI ((0 << PNL_2_OFFSET)|PNL_2_USAGE) +#define PNL_2_PRI ((0 << PNL_2_OFFSET)|PNL_2_USAGE) #define PNL_2_SEC ((2 << PNL_2_OFFSET)|PNL_2_USAGE) diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index b2bf7e6..35866fa 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -12,35 +12,35 @@ static dvi_ctrl_device_t g_dcftSupportedDviController[] = { #ifdef DVI_CTRL_SII164 - { - .pfnInit = sii164InitChip, - .pfnGetVendorId = sii164GetVendorID, - .pfnGetDeviceId = sii164GetDeviceID, + { + .pfnInit = sii164InitChip, + .pfnGetVendorId = sii164GetVendorID, + .pfnGetDeviceId = sii164GetDeviceID, #ifdef SII164_FULL_FUNCTIONS - .pfnResetChip = sii164ResetChip, - .pfnGetChipString = sii164GetChipString, - .pfnSetPower = sii164SetPower, - .pfnEnableHotPlugDetection = sii164EnableHotPlugDetection, - .pfnIsConnected = sii164IsConnected, - .pfnCheckInterrupt = sii164CheckInterrupt, - .pfnClearInterrupt = sii164ClearInterrupt, + .pfnResetChip = sii164ResetChip, + .pfnGetChipString = sii164GetChipString, + .pfnSetPower = sii164SetPower, + .pfnEnableHotPlugDetection = sii164EnableHotPlugDetection, + .pfnIsConnected = sii164IsConnected, + .pfnCheckInterrupt = sii164CheckInterrupt, + .pfnClearInterrupt = sii164ClearInterrupt, #endif - }, + }, #endif }; int dviInit( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue + unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue ) { dvi_ctrl_device_t *pCurrentDviCtrl; @@ -48,8 +48,8 @@ int dviInit( if(pCurrentDviCtrl->pfnInit != NULL) { return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, - vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, - pllFilterEnable, pllFilterValue); + vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, + pllFilterEnable, pllFilterValue); } return -1; /* error */ } @@ -64,13 +64,13 @@ int dviInit( */ unsigned short dviGetVendorID(void) { - dvi_ctrl_device_t *pCurrentDviCtrl; + dvi_ctrl_device_t *pCurrentDviCtrl; - pCurrentDviCtrl = g_dcftSupportedDviController; - if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) - return pCurrentDviCtrl->pfnGetVendorId(); + pCurrentDviCtrl = g_dcftSupportedDviController; + if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) + return pCurrentDviCtrl->pfnGetVendorId(); - return 0x0000; + return 0x0000; } @@ -83,13 +83,13 @@ unsigned short dviGetVendorID(void) */ unsigned short dviGetDeviceID(void) { - dvi_ctrl_device_t *pCurrentDviCtrl; + dvi_ctrl_device_t *pCurrentDviCtrl; pCurrentDviCtrl = g_dcftSupportedDviController; - if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) - return pCurrentDviCtrl->pfnGetDeviceId(); + if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0) + return pCurrentDviCtrl->pfnGetDeviceId(); - return 0x0000; + return 0x0000; } #endif diff --git a/drivers/staging/sm750fb/ddk750_help.h b/drivers/staging/sm750fb/ddk750_help.h index 4285b05..3b06aed 100644 --- a/drivers/staging/sm750fb/ddk750_help.h +++ b/drivers/staging/sm750fb/ddk750_help.h @@ -12,8 +12,8 @@ #if 0 /* if 718 big endian turned on,be aware that don't use this driver for general use,only for ppc big-endian */ #warning "big endian on target cpu and enable nature big endian support of 718 capability !" -#define PEEK32(addr) __raw_readl(mmio750 + addr) -#define POKE32(addr, data) __raw_writel(data, mmio750 + addr) +#define PEEK32(addr) __raw_readl(mmio750 + addr) +#define POKE32(addr, data) __raw_writel(data, mmio750 + addr) #else /* software control endianness */ #define PEEK32(addr) readl(addr + mmio750) #define POKE32(addr, data) writel(data, addr + mmio750) diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c index 7826376..7f3b1f9 100644 --- a/drivers/staging/sm750fb/ddk750_hwi2c.c +++ b/drivers/staging/sm750fb/ddk750_hwi2c.c @@ -10,70 +10,70 @@ int hwI2CInit( - unsigned char busSpeedMode +unsigned char busSpeedMode ) { - unsigned int value; + unsigned int value; - /* Enable GPIO 30 & 31 as IIC clock & data */ + /* Enable GPIO 30 & 31 as IIC clock & data */ value = PEEK32(GPIO_MUX); - value = FIELD_SET(value, GPIO_MUX, 30, I2C) | - FIELD_SET(0, GPIO_MUX, 31, I2C); + value = FIELD_SET(value, GPIO_MUX, 30, I2C) | + FIELD_SET(0, GPIO_MUX, 31, I2C); POKE32(GPIO_MUX, value); - /* Enable Hardware I2C power. - TODO: Check if we need to enable GPIO power? - */ - enableI2C(1); - - /* Enable the I2C Controller and set the bus speed mode */ - value = PEEK32(I2C_CTRL); - if (busSpeedMode == 0) - value = FIELD_SET(value, I2C_CTRL, MODE, STANDARD); - else - value = FIELD_SET(value, I2C_CTRL, MODE, FAST); - value = FIELD_SET(value, I2C_CTRL, EN, ENABLE); - POKE32(I2C_CTRL, value); - - return 0; + /* Enable Hardware I2C power. + TODO: Check if we need to enable GPIO power? + */ + enableI2C(1); + + /* Enable the I2C Controller and set the bus speed mode */ + value = PEEK32(I2C_CTRL); + if (busSpeedMode == 0) + value = FIELD_SET(value, I2C_CTRL, MODE, STANDARD); + else + value = FIELD_SET(value, I2C_CTRL, MODE, FAST); + value = FIELD_SET(value, I2C_CTRL, EN, ENABLE); + POKE32(I2C_CTRL, value); + + return 0; } void hwI2CClose(void) { - unsigned int value; + unsigned int value; - /* Disable I2C controller */ - value = PEEK32(I2C_CTRL); - value = FIELD_SET(value, I2C_CTRL, EN, DISABLE); - POKE32(I2C_CTRL, value); + /* Disable I2C controller */ + value = PEEK32(I2C_CTRL); + value = FIELD_SET(value, I2C_CTRL, EN, DISABLE); + POKE32(I2C_CTRL, value); - /* Disable I2C Power */ - enableI2C(0); + /* Disable I2C Power */ + enableI2C(0); - /* Set GPIO 30 & 31 back as GPIO pins */ - value = PEEK32(GPIO_MUX); - value = FIELD_SET(value, GPIO_MUX, 30, GPIO); - value = FIELD_SET(value, GPIO_MUX, 31, GPIO); - POKE32(GPIO_MUX, value); + /* Set GPIO 30 & 31 back as GPIO pins */ + value = PEEK32(GPIO_MUX); + value = FIELD_SET(value, GPIO_MUX, 30, GPIO); + value = FIELD_SET(value, GPIO_MUX, 31, GPIO); + POKE32(GPIO_MUX, value); } static long hwI2CWaitTXDone(void) { - unsigned int timeout; + unsigned int timeout; - /* Wait until the transfer is completed. */ - timeout = HWI2C_WAIT_TIMEOUT; + /* Wait until the transfer is completed. */ + timeout = HWI2C_WAIT_TIMEOUT; while ((FIELD_GET(PEEK32(I2C_STATUS), I2C_STATUS, TX) != I2C_STATUS_TX_COMPLETED) && - (timeout != 0)) + (timeout != 0)) timeout--; if (timeout == 0) - return (-1); + return (-1); - return 0; + return 0; } @@ -91,53 +91,53 @@ static long hwI2CWaitTXDone(void) * Total number of bytes those are actually written. */ static unsigned int hwI2CWriteData( - unsigned char deviceAddress, - unsigned int length, - unsigned char *pBuffer + unsigned char deviceAddress, + unsigned int length, + unsigned char *pBuffer ) { - unsigned char count, i; - unsigned int totalBytes = 0; + unsigned char count, i; + unsigned int totalBytes = 0; - /* Set the Device Address */ - POKE32(I2C_SLAVE_ADDRESS, deviceAddress & ~0x01); + /* Set the Device Address */ + POKE32(I2C_SLAVE_ADDRESS, deviceAddress & ~0x01); - /* Write data. - * Note: - * Only 16 byte can be accessed per i2c start instruction. - */ - do - { - /* Reset I2C by writing 0 to I2C_RESET register to clear the previous status. */ - POKE32(I2C_RESET, 0); + /* Write data. + * Note: + * Only 16 byte can be accessed per i2c start instruction. + */ + do + { + /* Reset I2C by writing 0 to I2C_RESET register to clear the previous status. */ + POKE32(I2C_RESET, 0); - /* Set the number of bytes to be written */ - if (length < MAX_HWI2C_FIFO) - count = length - 1; - else - count = MAX_HWI2C_FIFO - 1; - POKE32(I2C_BYTE_COUNT, count); + /* Set the number of bytes to be written */ + if (length < MAX_HWI2C_FIFO) + count = length - 1; + else + count = MAX_HWI2C_FIFO - 1; + POKE32(I2C_BYTE_COUNT, count); - /* Move the data to the I2C data register */ - for (i = 0; i <= count; i++) - POKE32(I2C_DATA0 + i, *pBuffer++); + /* Move the data to the I2C data register */ + for (i = 0; i <= count; i++) + POKE32(I2C_DATA0 + i, *pBuffer++); - /* Start the I2C */ - POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); + /* Start the I2C */ + POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); - /* Wait until the transfer is completed. */ - if (hwI2CWaitTXDone() != 0) - break; + /* Wait until the transfer is completed. */ + if (hwI2CWaitTXDone() != 0) + break; - /* Substract length */ - length -= (count + 1); + /* Substract length */ + length -= (count + 1); - /* Total byte written */ - totalBytes += (count + 1); + /* Total byte written */ + totalBytes += (count + 1); - } while (length > 0); + } while (length > 0); - return totalBytes; + return totalBytes; } @@ -158,53 +158,53 @@ static unsigned int hwI2CWriteData( * Total number of actual bytes read from the slave device */ static unsigned int hwI2CReadData( - unsigned char deviceAddress, - unsigned int length, - unsigned char *pBuffer + unsigned char deviceAddress, + unsigned int length, + unsigned char *pBuffer ) { - unsigned char count, i; - unsigned int totalBytes = 0; + unsigned char count, i; + unsigned int totalBytes = 0; - /* Set the Device Address */ - POKE32(I2C_SLAVE_ADDRESS, deviceAddress | 0x01); + /* Set the Device Address */ + POKE32(I2C_SLAVE_ADDRESS, deviceAddress | 0x01); - /* Read data and save them to the buffer. - * Note: - * Only 16 byte can be accessed per i2c start instruction. - */ - do - { - /* Reset I2C by writing 0 to I2C_RESET register to clear all the status. */ - POKE32(I2C_RESET, 0); + /* Read data and save them to the buffer. + * Note: + * Only 16 byte can be accessed per i2c start instruction. + */ + do + { + /* Reset I2C by writing 0 to I2C_RESET register to clear all the status. */ + POKE32(I2C_RESET, 0); - /* Set the number of bytes to be read */ - if (length <= MAX_HWI2C_FIFO) - count = length - 1; - else - count = MAX_HWI2C_FIFO - 1; - POKE32(I2C_BYTE_COUNT, count); + /* Set the number of bytes to be read */ + if (length <= MAX_HWI2C_FIFO) + count = length - 1; + else + count = MAX_HWI2C_FIFO - 1; + POKE32(I2C_BYTE_COUNT, count); - /* Start the I2C */ - POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); + /* Start the I2C */ + POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START)); - /* Wait until transaction done. */ - if (hwI2CWaitTXDone() != 0) - break; + /* Wait until transaction done. */ + if (hwI2CWaitTXDone() != 0) + break; - /* Save the data to the given buffer */ - for (i = 0; i <= count; i++) - *pBuffer++ = PEEK32(I2C_DATA0 + i); + /* Save the data to the given buffer */ + for (i = 0; i <= count; i++) + *pBuffer++ = PEEK32(I2C_DATA0 + i); - /* Substract length by 16 */ - length -= (count + 1); + /* Substract length by 16 */ + length -= (count + 1); - /* Number of bytes read. */ - totalBytes += (count + 1); + /* Number of bytes read. */ + totalBytes += (count + 1); - } while (length > 0); + } while (length > 0); - return totalBytes; + return totalBytes; } @@ -222,16 +222,16 @@ static unsigned int hwI2CReadData( * Register value */ unsigned char hwI2CReadReg( - unsigned char deviceAddress, - unsigned char registerIndex + unsigned char deviceAddress, + unsigned char registerIndex ) { - unsigned char value = (0xFF); + unsigned char value = (0xFF); - if (hwI2CWriteData(deviceAddress, 1, ®isterIndex) == 1) - hwI2CReadData(deviceAddress, 1, &value); + if (hwI2CWriteData(deviceAddress, 1, ®isterIndex) == 1) + hwI2CReadData(deviceAddress, 1, &value); - return value; + return value; } @@ -252,19 +252,19 @@ unsigned char hwI2CReadReg( * -1 - Fail */ int hwI2CWriteReg( - unsigned char deviceAddress, - unsigned char registerIndex, - unsigned char data + unsigned char deviceAddress, + unsigned char registerIndex, + unsigned char data ) { - unsigned char value[2]; + unsigned char value[2]; - value[0] = registerIndex; - value[1] = data; - if (hwI2CWriteData(deviceAddress, 2, value) == 2) - return 0; + value[0] = registerIndex; + value[1] = data; + if (hwI2CWriteData(deviceAddress, 2, value) == 2) + return 0; - return (-1); + return (-1); } diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index 74313ff..1f93d07 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -20,54 +20,54 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam, x = pModeParam->horizontal_display_end; y = pModeParam->vertical_display_end; - /* SM750LE has to set up the top-left and bottom-right - registers as well. - Note that normal SM750/SM718 only use those two register for - auto-centering mode. - */ - POKE32(CRT_AUTO_CENTERING_TL, - FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, TOP, 0) - | FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, LEFT, 0)); - - POKE32(CRT_AUTO_CENTERING_BR, - FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, BOTTOM, y-1) - | FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, RIGHT, x-1)); - - /* Assume common fields in dispControl have been properly set before - calling this function. - This function only sets the extra fields in dispControl. - */ + /* SM750LE has to set up the top-left and bottom-right + registers as well. + Note that normal SM750/SM718 only use those two register for + auto-centering mode. + */ + POKE32(CRT_AUTO_CENTERING_TL, + FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, TOP, 0) + | FIELD_VALUE(0, CRT_AUTO_CENTERING_TL, LEFT, 0)); + + POKE32(CRT_AUTO_CENTERING_BR, + FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, BOTTOM, y-1) + | FIELD_VALUE(0, CRT_AUTO_CENTERING_BR, RIGHT, x-1)); + + /* Assume common fields in dispControl have been properly set before + calling this function. + This function only sets the extra fields in dispControl. + */ /* Clear bit 29:27 of display control register */ - dispControl &= FIELD_CLEAR(CRT_DISPLAY_CTRL, CLK); + dispControl &= FIELD_CLEAR(CRT_DISPLAY_CTRL, CLK); /* Set bit 29:27 of display control register for the right clock */ /* Note that SM750LE only need to supported 7 resoluitons. */ if ( x == 800 && y == 600 ) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL41); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL41); else if (x == 1024 && y == 768) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL65); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL65); else if (x == 1152 && y == 864) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); else if (x == 1280 && y == 768) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL80); else if (x == 1280 && y == 720) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL74); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL74); else if (x == 1280 && y == 960) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); else if (x == 1280 && y == 1024) - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL108); else /* default to VGA clock */ - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL25); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL25); /* Set bit 25:24 of display controller */ - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CRTSELECT, CRT); - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, RGBBIT, 24BIT); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CRTSELECT, CRT); + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, RGBBIT, 24BIT); - /* Set bit 14 of display controller */ - dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLOCK_PHASE, ACTIVE_LOW); + /* Set bit 14 of display controller */ + dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLOCK_PHASE, ACTIVE_LOW); - POKE32(CRT_DISPLAY_CTRL, dispControl); + POKE32(CRT_DISPLAY_CTRL, dispControl); return dispControl; } @@ -84,21 +84,21 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) { /* programe secondary pixel clock */ POKE32(CRT_PLL_CTRL, formatPllReg(pll)); - POKE32(CRT_HORIZONTAL_TOTAL, - FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) - | FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); + POKE32(CRT_HORIZONTAL_TOTAL, + FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) + | FIELD_VALUE(0, CRT_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); - POKE32(CRT_HORIZONTAL_SYNC, - FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) - | FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); + POKE32(CRT_HORIZONTAL_SYNC, + FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) + | FIELD_VALUE(0, CRT_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); - POKE32(CRT_VERTICAL_TOTAL, - FIELD_VALUE(0, CRT_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) - | FIELD_VALUE(0, CRT_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); + POKE32(CRT_VERTICAL_TOTAL, + FIELD_VALUE(0, CRT_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) + | FIELD_VALUE(0, CRT_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); - POKE32(CRT_VERTICAL_SYNC, - FIELD_VALUE(0, CRT_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) - | FIELD_VALUE(0, CRT_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); + POKE32(CRT_VERTICAL_SYNC, + FIELD_VALUE(0, CRT_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) + | FIELD_VALUE(0, CRT_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); ulTmpValue = FIELD_VALUE(0, CRT_DISPLAY_CTRL, VSYNC_PHASE, pModeParam->vertical_sync_polarity)| @@ -125,39 +125,39 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) unsigned int ulReservedBits; POKE32(PANEL_PLL_CTRL, formatPllReg(pll)); - POKE32(PANEL_HORIZONTAL_TOTAL, - FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) - | FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); + POKE32(PANEL_HORIZONTAL_TOTAL, + FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, TOTAL, pModeParam->horizontal_total - 1) + | FIELD_VALUE(0, PANEL_HORIZONTAL_TOTAL, DISPLAY_END, pModeParam->horizontal_display_end - 1)); - POKE32(PANEL_HORIZONTAL_SYNC, - FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) - | FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); + POKE32(PANEL_HORIZONTAL_SYNC, + FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, WIDTH, pModeParam->horizontal_sync_width) + | FIELD_VALUE(0, PANEL_HORIZONTAL_SYNC, START, pModeParam->horizontal_sync_start - 1)); - POKE32(PANEL_VERTICAL_TOTAL, - FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) - | FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); + POKE32(PANEL_VERTICAL_TOTAL, + FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, TOTAL, pModeParam->vertical_total - 1) + | FIELD_VALUE(0, PANEL_VERTICAL_TOTAL, DISPLAY_END, pModeParam->vertical_display_end - 1)); - POKE32(PANEL_VERTICAL_SYNC, - FIELD_VALUE(0, PANEL_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) - | FIELD_VALUE(0, PANEL_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); + POKE32(PANEL_VERTICAL_SYNC, + FIELD_VALUE(0, PANEL_VERTICAL_SYNC, HEIGHT, pModeParam->vertical_sync_height) + | FIELD_VALUE(0, PANEL_VERTICAL_SYNC, START, pModeParam->vertical_sync_start - 1)); ulTmpValue = FIELD_VALUE(0, PANEL_DISPLAY_CTRL, VSYNC_PHASE, pModeParam->vertical_sync_polarity)| - FIELD_VALUE(0, PANEL_DISPLAY_CTRL, HSYNC_PHASE, pModeParam->horizontal_sync_polarity)| - FIELD_VALUE(0, PANEL_DISPLAY_CTRL, CLOCK_PHASE, pModeParam->clock_phase_polarity)| - FIELD_SET(0, PANEL_DISPLAY_CTRL, TIMING, ENABLE)| - FIELD_SET(0, PANEL_DISPLAY_CTRL, PLANE, ENABLE); - - ulReservedBits = FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_1_MASK, ENABLE) | - FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_2_MASK, ENABLE) | - FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_3_MASK, ENABLE)| - FIELD_SET(0, PANEL_DISPLAY_CTRL, VSYNC, ACTIVE_LOW); - - ulReg = (PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, CLOCK_PHASE) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, VSYNC_PHASE) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, HSYNC_PHASE) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, TIMING) - & FIELD_CLEAR(PANEL_DISPLAY_CTRL, PLANE); + FIELD_VALUE(0, PANEL_DISPLAY_CTRL, HSYNC_PHASE, pModeParam->horizontal_sync_polarity)| + FIELD_VALUE(0, PANEL_DISPLAY_CTRL, CLOCK_PHASE, pModeParam->clock_phase_polarity)| + FIELD_SET(0, PANEL_DISPLAY_CTRL, TIMING, ENABLE)| + FIELD_SET(0, PANEL_DISPLAY_CTRL, PLANE, ENABLE); + + ulReservedBits = FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_1_MASK, ENABLE) | + FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_2_MASK, ENABLE) | + FIELD_SET(0, PANEL_DISPLAY_CTRL, RESERVED_3_MASK, ENABLE)| + FIELD_SET(0, PANEL_DISPLAY_CTRL, VSYNC, ACTIVE_LOW); + + ulReg = (PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, CLOCK_PHASE) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, VSYNC_PHASE) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, HSYNC_PHASE) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, TIMING) + & FIELD_CLEAR(PANEL_DISPLAY_CTRL, PLANE); /* May a hardware bug or just my test chip (not confirmed). diff --git a/drivers/staging/sm750fb/ddk750_mode.h b/drivers/staging/sm750fb/ddk750_mode.h index 4e8fab3..3548d67 100644 --- a/drivers/staging/sm750fb/ddk750_mode.h +++ b/drivers/staging/sm750fb/ddk750_mode.h @@ -5,35 +5,35 @@ typedef enum _spolarity_t { - POS = 0, /* positive */ - NEG, /* negative */ + POS = 0, /* positive */ + NEG, /* negative */ } spolarity_t; typedef struct _mode_parameter_t { - /* Horizontal timing. */ - unsigned long horizontal_total; - unsigned long horizontal_display_end; - unsigned long horizontal_sync_start; - unsigned long horizontal_sync_width; - spolarity_t horizontal_sync_polarity; - - /* Vertical timing. */ - unsigned long vertical_total; - unsigned long vertical_display_end; - unsigned long vertical_sync_start; - unsigned long vertical_sync_height; - spolarity_t vertical_sync_polarity; - - /* Refresh timing. */ - unsigned long pixel_clock; - unsigned long horizontal_frequency; - unsigned long vertical_frequency; - - /* Clock Phase. This clock phase only applies to Panel. */ - spolarity_t clock_phase_polarity; + /* Horizontal timing. */ + unsigned long horizontal_total; + unsigned long horizontal_display_end; + unsigned long horizontal_sync_start; + unsigned long horizontal_sync_width; + spolarity_t horizontal_sync_polarity; + + /* Vertical timing. */ + unsigned long vertical_total; + unsigned long vertical_display_end; + unsigned long vertical_sync_start; + unsigned long vertical_sync_height; + spolarity_t vertical_sync_polarity; + + /* Refresh timing. */ + unsigned long pixel_clock; + unsigned long horizontal_frequency; + unsigned long vertical_frequency; + + /* Clock Phase. This clock phase only applies to Panel. */ + spolarity_t clock_phase_polarity; } mode_parameter_t; diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index 1e5f398..b7a108b 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -19,7 +19,7 @@ unsigned int getPowerMode(void) { if(getChipType() == SM750LE) return 0; - return (FIELD_GET(PEEK32(POWER_MODE_CTRL), POWER_MODE_CTRL, MODE)); + return (FIELD_GET(PEEK32(POWER_MODE_CTRL), POWER_MODE_CTRL, MODE)); } @@ -29,76 +29,76 @@ unsigned int getPowerMode(void) */ void setPowerMode(unsigned int powerMode) { - unsigned int control_value = 0; + unsigned int control_value = 0; - control_value = PEEK32(POWER_MODE_CTRL); + control_value = PEEK32(POWER_MODE_CTRL); if(getChipType() == SM750LE) return; - switch (powerMode) - { - case POWER_MODE_CTRL_MODE_MODE0: - control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE0); - break; + switch (powerMode) + { + case POWER_MODE_CTRL_MODE_MODE0: + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE0); + break; - case POWER_MODE_CTRL_MODE_MODE1: - control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE1); - break; + case POWER_MODE_CTRL_MODE_MODE1: + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE1); + break; - case POWER_MODE_CTRL_MODE_SLEEP: - control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, SLEEP); - break; + case POWER_MODE_CTRL_MODE_SLEEP: + control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, SLEEP); + break; - default: - break; - } + default: + break; + } - /* Set up other fields in Power Control Register */ - if (powerMode == POWER_MODE_CTRL_MODE_SLEEP) - { - control_value = + /* Set up other fields in Power Control Register */ + if (powerMode == POWER_MODE_CTRL_MODE_SLEEP) + { + control_value = #ifdef VALIDATION_CHIP - FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, OFF) | + FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, OFF) | #endif - FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); - } - else - { - control_value = + FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); + } + else + { + control_value = #ifdef VALIDATION_CHIP - FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, ON) | + FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, ON) | #endif - FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, ON); - } + FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, ON); + } - /* Program new power mode. */ - POKE32(POWER_MODE_CTRL, control_value); + /* Program new power mode. */ + POKE32(POWER_MODE_CTRL, control_value); } void setCurrentGate(unsigned int gate) { - unsigned int gate_reg; - unsigned int mode; - - /* Get current power mode. */ - mode = getPowerMode(); - - switch (mode) - { - case POWER_MODE_CTRL_MODE_MODE0: - gate_reg = MODE0_GATE; - break; - - case POWER_MODE_CTRL_MODE_MODE1: - gate_reg = MODE1_GATE; - break; - - default: - gate_reg = MODE0_GATE; - break; - } - POKE32(gate_reg, gate); + unsigned int gate_reg; + unsigned int mode; + + /* Get current power mode. */ + mode = getPowerMode(); + + switch (mode) + { + case POWER_MODE_CTRL_MODE_MODE0: + gate_reg = MODE0_GATE; + break; + + case POWER_MODE_CTRL_MODE_MODE1: + gate_reg = MODE1_GATE; + break; + + default: + gate_reg = MODE0_GATE; + break; + } + POKE32(gate_reg, gate); } @@ -108,21 +108,21 @@ void setCurrentGate(unsigned int gate) */ void enable2DEngine(unsigned int enable) { - uint32_t gate; - - gate = PEEK32(CURRENT_GATE); - if (enable) - { - gate = FIELD_SET(gate, CURRENT_GATE, DE, ON); - gate = FIELD_SET(gate, CURRENT_GATE, CSC, ON); - } - else - { - gate = FIELD_SET(gate, CURRENT_GATE, DE, OFF); - gate = FIELD_SET(gate, CURRENT_GATE, CSC, OFF); - } - - setCurrentGate(gate); + uint32_t gate; + + gate = PEEK32(CURRENT_GATE); + if (enable) + { + gate = FIELD_SET(gate, CURRENT_GATE, DE, ON); + gate = FIELD_SET(gate, CURRENT_GATE, CSC, ON); + } + else + { + gate = FIELD_SET(gate, CURRENT_GATE, DE, OFF); + gate = FIELD_SET(gate, CURRENT_GATE, CSC, OFF); + } + + setCurrentGate(gate); } @@ -131,58 +131,58 @@ void enable2DEngine(unsigned int enable) */ void enableZVPort(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable ZV Port Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - { - gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, ON); + /* Enable ZV Port Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + { + gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, ON); #if 1 - /* Using Software I2C */ - gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); + /* Using Software I2C */ + gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); #else - /* Using Hardware I2C */ - gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); + /* Using Hardware I2C */ + gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); #endif - } - else - { - /* Disable ZV Port Gate. There is no way to know whether the GPIO pins are being used - or not. Therefore, do not disable the GPIO gate. */ - gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, OFF); - } - - setCurrentGate(gate); + } + else + { + /* Disable ZV Port Gate. There is no way to know whether the GPIO pins are being used + or not. Therefore, do not disable the GPIO gate. */ + gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, OFF); + } + + setCurrentGate(gate); } void enableSSP(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable SSP Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, SSP, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, SSP, OFF); + /* Enable SSP Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, SSP, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, SSP, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } void enableDMA(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable DMA Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, DMA, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, DMA, OFF); + /* Enable DMA Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, DMA, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, DMA, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } /* @@ -190,16 +190,16 @@ void enableDMA(unsigned int enable) */ void enableGPIO(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable GPIO Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, GPIO, OFF); + /* Enable GPIO Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, GPIO, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, GPIO, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } /* @@ -207,16 +207,16 @@ void enableGPIO(unsigned int enable) */ void enablePWM(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable PWM Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, PWM, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, PWM, OFF); + /* Enable PWM Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, PWM, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, PWM, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } /* @@ -224,16 +224,16 @@ void enablePWM(unsigned int enable) */ void enableI2C(unsigned int enable) { - uint32_t gate; + uint32_t gate; - /* Enable I2C Gate */ - gate = PEEK32(CURRENT_GATE); - if (enable) - gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); - else - gate = FIELD_SET(gate, CURRENT_GATE, I2C, OFF); + /* Enable I2C Gate */ + gate = PEEK32(CURRENT_GATE); + if (enable) + gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); + else + gate = FIELD_SET(gate, CURRENT_GATE, I2C, OFF); - setCurrentGate(gate); + setCurrentGate(gate); } diff --git a/drivers/staging/sm750fb/ddk750_power.h b/drivers/staging/sm750fb/ddk750_power.h index 4e00955..a20d438 100644 --- a/drivers/staging/sm750fb/ddk750_power.h +++ b/drivers/staging/sm750fb/ddk750_power.h @@ -3,10 +3,10 @@ typedef enum _DPMS_t { - crtDPMS_ON = 0x0, - crtDPMS_STANDBY = 0x1, - crtDPMS_SUSPEND = 0x2, - crtDPMS_OFF = 0x3, + crtDPMS_ON = 0x0, + crtDPMS_STANDBY = 0x1, + crtDPMS_SUSPEND = 0x2, + crtDPMS_OFF = 0x3, } DPMS_t; diff --git a/drivers/staging/sm750fb/ddk750_reg.h b/drivers/staging/sm750fb/ddk750_reg.h index 1a40dc2..2995625 100644 --- a/drivers/staging/sm750fb/ddk750_reg.h +++ b/drivers/staging/sm750fb/ddk750_reg.h @@ -1640,9 +1640,9 @@ /* CRT Graphics Control */ #define CRT_DISPLAY_CTRL 0x080200 -#define CRT_DISPLAY_CTRL_RESERVED_1_MASK 31:27 -#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_DISABLE 0 -#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_ENABLE 0x1F +#define CRT_DISPLAY_CTRL_RESERVED_1_MASK 31:27 +#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_DISABLE 0 +#define CRT_DISPLAY_CTRL_RESERVED_1_MASK_ENABLE 0x1F /* SM750LE definition */ #define CRT_DISPLAY_CTRL_DPMS 31:30 @@ -1664,9 +1664,9 @@ #define CRT_DISPLAY_CTRL_SHIFT_VGA_DAC_ENABLE 0 -#define CRT_DISPLAY_CTRL_RESERVED_2_MASK 25:24 -#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_ENABLE 3 -#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_DISABLE 0 +#define CRT_DISPLAY_CTRL_RESERVED_2_MASK 25:24 +#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_ENABLE 3 +#define CRT_DISPLAY_CTRL_RESERVED_2_MASK_DISABLE 0 /* SM750LE definition */ #define CRT_DISPLAY_CTRL_CRTSELECT 25:25 @@ -1677,11 +1677,11 @@ #define CRT_DISPLAY_CTRL_RGBBIT_12BIT 1 -#define CRT_DISPLAY_CTRL_RESERVED_3_MASK 15:15 +#define CRT_DISPLAY_CTRL_RESERVED_3_MASK 15:15 #define CRT_DISPLAY_CTRL_RESERVED_3_MASK_DISABLE 0 #define CRT_DISPLAY_CTRL_RESERVED_3_MASK_ENABLE 1 -#define CRT_DISPLAY_CTRL_RESERVED_4_MASK 9:9 +#define CRT_DISPLAY_CTRL_RESERVED_4_MASK 9:9 #define CRT_DISPLAY_CTRL_RESERVED_4_MASK_DISABLE 0 #define CRT_DISPLAY_CTRL_RESERVED_4_MASK_ENABLE 1 @@ -1882,7 +1882,7 @@ #endif /* sm750le new register to control panel output */ -#define DISPLAY_CONTROL_750LE 0x80288 +#define DISPLAY_CONTROL_750LE 0x80288 /* Palette RAM */ /* Panel Palette register starts at 0x080400 ~ 0x0807FC */ diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c index b6395b8..c09748c 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.c +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -36,12 +36,12 @@ static char *gDviCtrlChipName = "Silicon Image SiI 164"; */ unsigned short sii164GetVendorID(void) { - unsigned short vendorID; + unsigned short vendorID; - vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) | - (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW); + vendorID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_HIGH) << 8) | + (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_VENDOR_ID_LOW); - return vendorID; + return vendorID; } /* @@ -53,12 +53,12 @@ unsigned short sii164GetVendorID(void) */ unsigned short sii164GetDeviceID(void) { - unsigned short deviceID; + unsigned short deviceID; - deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) | - (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW); + deviceID = ((unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_HIGH) << 8) | + (unsigned short) i2cReadReg(SII164_I2C_ADDRESS, SII164_DEVICE_ID_LOW); - return deviceID; + return deviceID; } @@ -113,132 +113,132 @@ unsigned short sii164GetDeviceID(void) * -1 - Fail. */ long sii164InitChip( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue + unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue ) { unsigned char config; - /* Initialize the i2c bus */ + /* Initialize the i2c bus */ #ifdef USE_HW_I2C - /* Use fast mode. */ - hwI2CInit(1); + /* Use fast mode. */ + hwI2CInit(1); #else - swI2CInit(DEFAULT_I2C_SCL, DEFAULT_I2C_SDA); + swI2CInit(DEFAULT_I2C_SCL, DEFAULT_I2C_SDA); #endif - /* Check if SII164 Chip exists */ - if ((sii164GetVendorID() == SII164_VENDOR_ID) && (sii164GetDeviceID() == SII164_DEVICE_ID)) - { - /* - * Initialize SII164 controller chip. - */ - - /* Select the edge */ - if (edgeSelect == 0) - config = SII164_CONFIGURATION_LATCH_FALLING; - else - config = SII164_CONFIGURATION_LATCH_RISING; - - /* Select bus wide */ - if (busSelect == 0) - config |= SII164_CONFIGURATION_BUS_12BITS; - else - config |= SII164_CONFIGURATION_BUS_24BITS; - - /* Select Dual/Single Edge Clock */ - if (dualEdgeClkSelect == 0) - config |= SII164_CONFIGURATION_CLOCK_SINGLE; - else - config |= SII164_CONFIGURATION_CLOCK_DUAL; - - /* Select HSync Enable */ - if (hsyncEnable == 0) - config |= SII164_CONFIGURATION_HSYNC_FORCE_LOW; - else - config |= SII164_CONFIGURATION_HSYNC_AS_IS; - - /* Select VSync Enable */ - if (vsyncEnable == 0) - config |= SII164_CONFIGURATION_VSYNC_FORCE_LOW; - else - config |= SII164_CONFIGURATION_VSYNC_AS_IS; - - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - - /* De-skew enabled with default 111b value. - This will fix some artifacts problem in some mode on board 2.2. - Somehow this fix does not affect board 2.1. - */ - if (deskewEnable == 0) - config = SII164_DESKEW_DISABLE; - else - config = SII164_DESKEW_ENABLE; - - switch (deskewSetting) - { - case 0: - config |= SII164_DESKEW_1_STEP; - break; - case 1: - config |= SII164_DESKEW_2_STEP; - break; - case 2: - config |= SII164_DESKEW_3_STEP; - break; - case 3: - config |= SII164_DESKEW_4_STEP; - break; - case 4: - config |= SII164_DESKEW_5_STEP; - break; - case 5: - config |= SII164_DESKEW_6_STEP; - break; - case 6: - config |= SII164_DESKEW_7_STEP; - break; - case 7: - config |= SII164_DESKEW_8_STEP; - break; - } - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DESKEW, config); - - /* Enable/Disable Continuous Sync. */ - if (continuousSyncEnable == 0) - config = SII164_PLL_FILTER_SYNC_CONTINUOUS_DISABLE; - else - config = SII164_PLL_FILTER_SYNC_CONTINUOUS_ENABLE; - - /* Enable/Disable PLL Filter */ - if (pllFilterEnable == 0) - config |= SII164_PLL_FILTER_DISABLE; - else - config |= SII164_PLL_FILTER_ENABLE; - - /* Set the PLL Filter value */ - config |= ((pllFilterValue & 0x07) << 1); - - i2cWriteReg(SII164_I2C_ADDRESS, SII164_PLL, config); - - /* Recover from Power Down and enable output. */ - config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); - config |= SII164_CONFIGURATION_POWER_NORMAL; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - - return 0; - } - - /* Return -1 if initialization fails. */ - return (-1); + /* Check if SII164 Chip exists */ + if ((sii164GetVendorID() == SII164_VENDOR_ID) && (sii164GetDeviceID() == SII164_DEVICE_ID)) + { + /* + * Initialize SII164 controller chip. + */ + + /* Select the edge */ + if (edgeSelect == 0) + config = SII164_CONFIGURATION_LATCH_FALLING; + else + config = SII164_CONFIGURATION_LATCH_RISING; + + /* Select bus wide */ + if (busSelect == 0) + config |= SII164_CONFIGURATION_BUS_12BITS; + else + config |= SII164_CONFIGURATION_BUS_24BITS; + + /* Select Dual/Single Edge Clock */ + if (dualEdgeClkSelect == 0) + config |= SII164_CONFIGURATION_CLOCK_SINGLE; + else + config |= SII164_CONFIGURATION_CLOCK_DUAL; + + /* Select HSync Enable */ + if (hsyncEnable == 0) + config |= SII164_CONFIGURATION_HSYNC_FORCE_LOW; + else + config |= SII164_CONFIGURATION_HSYNC_AS_IS; + + /* Select VSync Enable */ + if (vsyncEnable == 0) + config |= SII164_CONFIGURATION_VSYNC_FORCE_LOW; + else + config |= SII164_CONFIGURATION_VSYNC_AS_IS; + + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + + /* De-skew enabled with default 111b value. + This will fix some artifacts problem in some mode on board 2.2. + Somehow this fix does not affect board 2.1. + */ + if (deskewEnable == 0) + config = SII164_DESKEW_DISABLE; + else + config = SII164_DESKEW_ENABLE; + + switch (deskewSetting) + { + case 0: + config |= SII164_DESKEW_1_STEP; + break; + case 1: + config |= SII164_DESKEW_2_STEP; + break; + case 2: + config |= SII164_DESKEW_3_STEP; + break; + case 3: + config |= SII164_DESKEW_4_STEP; + break; + case 4: + config |= SII164_DESKEW_5_STEP; + break; + case 5: + config |= SII164_DESKEW_6_STEP; + break; + case 6: + config |= SII164_DESKEW_7_STEP; + break; + case 7: + config |= SII164_DESKEW_8_STEP; + break; + } + i2cWriteReg(SII164_I2C_ADDRESS, SII164_DESKEW, config); + + /* Enable/Disable Continuous Sync. */ + if (continuousSyncEnable == 0) + config = SII164_PLL_FILTER_SYNC_CONTINUOUS_DISABLE; + else + config = SII164_PLL_FILTER_SYNC_CONTINUOUS_ENABLE; + + /* Enable/Disable PLL Filter */ + if (pllFilterEnable == 0) + config |= SII164_PLL_FILTER_DISABLE; + else + config |= SII164_PLL_FILTER_ENABLE; + + /* Set the PLL Filter value */ + config |= ((pllFilterValue & 0x07) << 1); + + i2cWriteReg(SII164_I2C_ADDRESS, SII164_PLL, config); + + /* Recover from Power Down and enable output. */ + config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); + config |= SII164_CONFIGURATION_POWER_NORMAL; + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + + return 0; + } + + /* Return -1 if initialization fails. */ + return (-1); } @@ -255,9 +255,9 @@ long sii164InitChip( */ void sii164ResetChip(void) { - /* Power down */ - sii164SetPower(0); - sii164SetPower(1); + /* Power down */ + sii164SetPower(0); + sii164SetPower(1); } @@ -268,7 +268,7 @@ void sii164ResetChip(void) */ char *sii164GetChipString(void) { - return gDviCtrlChipName; + return gDviCtrlChipName; } @@ -279,27 +279,25 @@ char *sii164GetChipString(void) * Input: * powerUp - Flag to set the power down or up */ -void sii164SetPower( - unsigned char powerUp -) +void sii164SetPower(unsigned char powerUp) { - unsigned char config; - - config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); - if (powerUp == 1) - { - /* Power up the chip */ - config &= ~SII164_CONFIGURATION_POWER_MASK; - config |= SII164_CONFIGURATION_POWER_NORMAL; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - } - else - { - /* Power down the chip */ - config &= ~SII164_CONFIGURATION_POWER_MASK; - config |= SII164_CONFIGURATION_POWER_DOWN; - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - } + unsigned char config; + + config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); + if (powerUp == 1) + { + /* Power up the chip */ + config &= ~SII164_CONFIGURATION_POWER_MASK; + config |= SII164_CONFIGURATION_POWER_NORMAL; + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + } + else + { + /* Power down the chip */ + config &= ~SII164_CONFIGURATION_POWER_MASK; + config |= SII164_CONFIGURATION_POWER_DOWN; + i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); + } } @@ -307,32 +305,30 @@ void sii164SetPower( * sii164SelectHotPlugDetectionMode * This function selects the mode of the hot plug detection. */ -static void sii164SelectHotPlugDetectionMode( - sii164_hot_plug_mode_t hotPlugMode -) +static void sii164SelectHotPlugDetectionMode(sii164_hot_plug_mode_t hotPlugMode) { - unsigned char detectReg; - - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; - switch (hotPlugMode) - { - case SII164_HOTPLUG_DISABLE: - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; - break; - case SII164_HOTPLUG_USE_MDI: - detectReg &= ~SII164_DETECT_INTERRUPT_MASK; - detectReg |= SII164_DETECT_INTERRUPT_BY_HTPLG_PIN; - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI; - break; - case SII164_HOTPLUG_USE_RSEN: - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN; - break; - case SII164_HOTPLUG_USE_HTPLG: - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG; - break; - } - - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg); + unsigned char detectReg; + + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; + switch (hotPlugMode) + { + case SII164_HOTPLUG_DISABLE: + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; + break; + case SII164_HOTPLUG_USE_MDI: + detectReg &= ~SII164_DETECT_INTERRUPT_MASK; + detectReg |= SII164_DETECT_INTERRUPT_BY_HTPLG_PIN; + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI; + break; + case SII164_HOTPLUG_USE_RSEN: + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN; + break; + case SII164_HOTPLUG_USE_HTPLG: + detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG; + break; + } + + i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg); } /* @@ -341,19 +337,17 @@ static void sii164SelectHotPlugDetectionMode( * * enableHotPlug - Enable (=1) / disable (=0) Hot Plug detection */ -void sii164EnableHotPlugDetection( - unsigned char enableHotPlug -) +void sii164EnableHotPlugDetection(unsigned char enableHotPlug) { - unsigned char detectReg; - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); - - /* Depending on each DVI controller, need to enable the hot plug based on each - individual chip design. */ - if (enableHotPlug != 0) - sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI); - else - sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_DISABLE); + unsigned char detectReg; + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); + + /* Depending on each DVI controller, need to enable the hot plug based on each + individual chip design. */ + if (enableHotPlug != 0) + sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI); + else + sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_DISABLE); } /* @@ -366,13 +360,13 @@ void sii164EnableHotPlugDetection( */ unsigned char sii164IsConnected(void) { - unsigned char hotPlugValue; + unsigned char hotPlugValue; - hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_HOT_PLUG_STATUS_MASK; - if (hotPlugValue == SII164_DETECT_HOT_PLUG_STATUS_ON) - return 1; - else - return 0; + hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_HOT_PLUG_STATUS_MASK; + if (hotPlugValue == SII164_DETECT_HOT_PLUG_STATUS_ON) + return 1; + else + return 0; } /* @@ -385,13 +379,13 @@ unsigned char sii164IsConnected(void) */ unsigned char sii164CheckInterrupt(void) { - unsigned char detectReg; + unsigned char detectReg; - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_MONITOR_STATE_MASK; - if (detectReg == SII164_DETECT_MONITOR_STATE_CHANGE) - return 1; - else - return 0; + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & SII164_DETECT_MONITOR_STATE_MASK; + if (detectReg == SII164_DETECT_MONITOR_STATE_CHANGE) + return 1; + else + return 0; } /* @@ -400,11 +394,10 @@ unsigned char sii164CheckInterrupt(void) */ void sii164ClearInterrupt(void) { - unsigned char detectReg; + unsigned char detectReg; - /* Clear the MDI interrupt */ - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg | SII164_DETECT_MONITOR_STATE_CLEAR); + /* Clear the MDI interrupt */ + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); } #endif diff --git a/drivers/staging/sm750fb/ddk750_sii164.h b/drivers/staging/sm750fb/ddk750_sii164.h index 2b4c7d3..bb0ed25 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.h +++ b/drivers/staging/sm750fb/ddk750_sii164.h @@ -6,25 +6,24 @@ /* Hot Plug detection mode structure */ typedef enum _sii164_hot_plug_mode_t { - SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit (always high). */ - SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Interrupt bit. */ - SII164_HOTPLUG_USE_RSEN, /* Use Receiver Sense detect bit. */ - SII164_HOTPLUG_USE_HTPLG /* Use Hot Plug detect bit. */ + SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit (always high). */ + SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Interrupt bit. */ + SII164_HOTPLUG_USE_RSEN, /* Use Receiver Sense detect bit. */ + SII164_HOTPLUG_USE_HTPLG /* Use Hot Plug detect bit. */ } sii164_hot_plug_mode_t; /* Silicon Image SiI164 chip prototype */ -long sii164InitChip( - unsigned char edgeSelect, - unsigned char busSelect, - unsigned char dualEdgeClkSelect, - unsigned char hsyncEnable, - unsigned char vsyncEnable, - unsigned char deskewEnable, - unsigned char deskewSetting, - unsigned char continuousSyncEnable, - unsigned char pllFilterEnable, - unsigned char pllFilterValue +long sii164InitChip(unsigned char edgeSelect, + unsigned char busSelect, + unsigned char dualEdgeClkSelect, + unsigned char hsyncEnable, + unsigned char vsyncEnable, + unsigned char deskewEnable, + unsigned char deskewSetting, + unsigned char continuousSyncEnable, + unsigned char pllFilterEnable, + unsigned char pllFilterValue ); unsigned short sii164GetVendorID(void); diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index cc80580..bf894cc 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -5,7 +5,7 @@ #define FB_ACCEL_SMI 0xab /* please use revision id to distinguish sm750le and sm750*/ -#define SPC_SM750 0 +#define SPC_SM750 0 #define MB(x) ((x)<<20) #define MHZ(x) ((x) * 1000000) @@ -38,8 +38,8 @@ struct lynx_accel{ }; -/* lynx_share stands for a presentation of two frame buffer - that use one smi adaptor , it is similar to a basic class of C++ +/* lynx_share stands for a presentation of two frame buffer + that use one smi adaptor , it is similar to a basic class of C++ */ struct lynx_share{ /* common members */ @@ -126,17 +126,17 @@ struct lynxfb_crtc{ struct lynxfb_output{ int dpms; int paths; - /* which paths(s) this output stands for,for sm750: - paths=1:means output for panel paths - paths=2:means output for crt paths - paths=3:means output for both panel and crt paths + /* which paths(s) this output stands for,for sm750: + paths=1:means output for panel paths + paths=2:means output for crt paths + paths=3:means output for both panel and crt paths */ int *channel; - /* which channel these outputs linked with,for sm750: - *channel=0 means primary channel - *channel=1 means secondary channel - output->channel ==> &crtc->channel + /* which channel these outputs linked with,for sm750: + *channel=0 means primary channel + *channel=1 means secondary channel + output->channel ==> &crtc->channel */ void *priv; @@ -165,7 +165,7 @@ struct lynxfb_par{ #define PS_TO_HZ(ps) \ - ({ \ + ({ \ unsigned long long hz = 1000*1000*1000*1000ULL; \ do_div(hz, ps); \ (unsigned long)hz;}) diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 6eee4cd..806aeed 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -151,97 +151,96 @@ unsigned int width, unsigned int height, /* width and height of rectangle in pixel value */ unsigned int rop2) /* ROP value */ { - unsigned int nDirection, de_ctrl; - int opSign; - nDirection = LEFT_TO_RIGHT; + unsigned int nDirection, de_ctrl; + int opSign; + nDirection = LEFT_TO_RIGHT; /* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */ - opSign = 1; - de_ctrl = 0; - - /* If source and destination are the same surface, need to check for overlay cases */ - if (sBase == dBase && sPitch == dPitch) - { - /* Determine direction of operation */ - if (sy < dy) - { - /* +----------+ - |S | - | +----------+ - | | | | - | | | | - +---|------+ | - | D| - +----------+ */ - - nDirection = BOTTOM_TO_TOP; - } - else if (sy > dy) - { - /* +----------+ - |D | - | +----------+ - | | | | - | | | | - +---|------+ | - | S| - +----------+ */ - - nDirection = TOP_TO_BOTTOM; - } - else - { - /* sy == dy */ - - if (sx <= dx) - { - /* +------+---+------+ - |S | | D| - | | | | - | | | | - | | | | - +------+---+------+ */ - - nDirection = RIGHT_TO_LEFT; - } - else - { - /* sx > dx */ - - /* +------+---+------+ - |D | | S| - | | | | - | | | | - | | | | - +------+---+------+ */ - - nDirection = LEFT_TO_RIGHT; - } - } - } - - if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) - { - sx += width - 1; - sy += height - 1; - dx += width - 1; - dy += height - 1; - opSign = (-1); - } - - /* Note: - DE_FOREGROUND are DE_BACKGROUND are don't care. - DE_COLOR_COMPARE and DE_COLOR_COMPARE_MAKS are set by set deSetTransparency(). - */ + opSign = 1; + de_ctrl = 0; - /* 2D Source Base. - It is an address offset (128 bit aligned) from the beginning of frame buffer. - */ - write_dpr(accel, DE_WINDOW_SOURCE_BASE, sBase); /* dpr40 */ + /* If source and destination are the same surface, need to check for overlay cases */ + if (sBase == dBase && sPitch == dPitch) + { + /* Determine direction of operation */ + if (sy < dy) + { + /* +----------+ + |S | + | +----------+ + | | | | + | | | | + +---|------+ | + | D| + +----------+ */ + + nDirection = BOTTOM_TO_TOP; + } + else if (sy > dy) + { + /* +----------+ + |D | + | +----------+ + | | | | + | | | | + +---|------+ | + | S| + +----------+ */ + + nDirection = TOP_TO_BOTTOM; + } + else + { + /* sy == dy */ + if (sx <= dx) + { + /* +------+---+------+ + |S | | D| + | | | | + | | | | + | | | | + +------+---+------+ */ + + nDirection = RIGHT_TO_LEFT; + } + else + { + /* sx > dx */ + + /* +------+---+------+ + |D | | S| + | | | | + | | | | + | | | | + +------+---+------+ */ + + nDirection = LEFT_TO_RIGHT; + } + } + } - /* 2D Destination Base. - It is an address offset (128 bit aligned) from the beginning of frame buffer. - */ - write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); /* dpr44 */ + if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) + { + sx += width - 1; + sy += height - 1; + dx += width - 1; + dy += height - 1; + opSign = (-1); + } + + /* Note: + DE_FOREGROUND are DE_BACKGROUND are don't care. + DE_COLOR_COMPARE and DE_COLOR_COMPARE_MAKS are set by set deSetTransparency(). + */ + + /* 2D Source Base. + It is an address offset (128 bit aligned) from the beginning of frame buffer. + */ + write_dpr(accel, DE_WINDOW_SOURCE_BASE, sBase); /* dpr40 */ + + /* 2D Destination Base. + It is an address offset (128 bit aligned) from the beginning of frame buffer. + */ + write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); /* dpr44 */ #if 0 /* Program pitch (distance between the 1st points of two adjacent lines). @@ -267,54 +266,49 @@ unsigned int rop2) /* ROP value */ /* Screen Window width in Pixels. 2D engine uses this value to calculate the linear address in frame buffer for a given point. */ - write_dpr(accel, DE_WINDOW_WIDTH, - FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | - FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp))); /* dpr3c */ + write_dpr(accel, DE_WINDOW_WIDTH, + FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | + FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp))); /* dpr3c */ if (accel->de_wait() != 0){ return -1; } - { - - write_dpr(accel, DE_SOURCE, - FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | - FIELD_VALUE(0, DE_SOURCE, X_K1, sx) | - FIELD_VALUE(0, DE_SOURCE, Y_K2, sy)); /* dpr0 */ - write_dpr(accel, DE_DESTINATION, - FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | - FIELD_VALUE(0, DE_DESTINATION, X, dx) | - FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ - write_dpr(accel, DE_DIMENSION, - FIELD_VALUE(0, DE_DIMENSION, X, width) | - FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */ - - de_ctrl = - FIELD_VALUE(0, DE_CONTROL, ROP, rop2) | - FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) | - FIELD_SET(0, DE_CONTROL, COMMAND, BITBLT) | - ((nDirection == RIGHT_TO_LEFT) ? - FIELD_SET(0, DE_CONTROL, DIRECTION, RIGHT_TO_LEFT) - : FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT)) | - FIELD_SET(0, DE_CONTROL, STATUS, START); - write_dpr(accel, DE_CONTROL, de_ctrl); /* dpr0c */ - } - - return 0; + write_dpr(accel, DE_SOURCE, + FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_VALUE(0, DE_SOURCE, X_K1, sx) | + FIELD_VALUE(0, DE_SOURCE, Y_K2, sy)); /* dpr0 */ + write_dpr(accel, DE_DESTINATION, + FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_VALUE(0, DE_DESTINATION, X, dx) | + FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ + write_dpr(accel, DE_DIMENSION, + FIELD_VALUE(0, DE_DIMENSION, X, width) | + FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */ + + de_ctrl = FIELD_VALUE(0, DE_CONTROL, ROP, rop2) | + FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) | + FIELD_SET(0, DE_CONTROL, COMMAND, BITBLT) | + ((nDirection == RIGHT_TO_LEFT) ? + FIELD_SET(0, DE_CONTROL, DIRECTION, RIGHT_TO_LEFT) + : FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT)) | + FIELD_SET(0, DE_CONTROL, STATUS, START); + write_dpr(accel, DE_CONTROL, de_ctrl); /* dpr0c */ + + return 0; } static unsigned int deGetTransparency(struct lynx_accel *accel) { - unsigned int de_ctrl; + unsigned int de_ctrl; - de_ctrl = read_dpr(accel, DE_CONTROL); + de_ctrl = read_dpr(accel, DE_CONTROL); - de_ctrl &= - FIELD_MASK(DE_CONTROL_TRANSPARENCY_MATCH) | - FIELD_MASK(DE_CONTROL_TRANSPARENCY_SELECT)| - FIELD_MASK(DE_CONTROL_TRANSPARENCY); + de_ctrl &= FIELD_MASK(DE_CONTROL_TRANSPARENCY_MATCH) | + FIELD_MASK(DE_CONTROL_TRANSPARENCY_SELECT)| + FIELD_MASK(DE_CONTROL_TRANSPARENCY); - return de_ctrl; + return de_ctrl; } int hw_imageblit(struct lynx_accel *accel, @@ -332,32 +326,32 @@ int hw_imageblit(struct lynx_accel *accel, u32 bColor, /* Background color (corresponding to a 0 in the monochrome data */ u32 rop2) /* ROP value */ { - unsigned int ulBytesPerScan; - unsigned int ul4BytesPerScan; - unsigned int ulBytesRemain; - unsigned int de_ctrl = 0; - unsigned char ajRemain[4]; - int i, j; - - startBit &= 7; /* Just make sure the start bit is within legal range */ - ulBytesPerScan = (width + startBit + 7) / 8; - ul4BytesPerScan = ulBytesPerScan & ~3; - ulBytesRemain = ulBytesPerScan & 3; + unsigned int ulBytesPerScan; + unsigned int ul4BytesPerScan; + unsigned int ulBytesRemain; + unsigned int de_ctrl = 0; + unsigned char ajRemain[4]; + int i, j; + + startBit &= 7; /* Just make sure the start bit is within legal range */ + ulBytesPerScan = (width + startBit + 7) / 8; + ul4BytesPerScan = ulBytesPerScan & ~3; + ulBytesRemain = ulBytesPerScan & 3; if(accel->de_wait() != 0) - { - return -1; - } + { + return -1; + } - /* 2D Source Base. - Use 0 for HOST Blt. - */ - write_dpr(accel, DE_WINDOW_SOURCE_BASE, 0); + /* 2D Source Base. + Use 0 for HOST Blt. + */ + write_dpr(accel, DE_WINDOW_SOURCE_BASE, 0); - /* 2D Destination Base. - It is an address offset (128 bit aligned) from the beginning of frame buffer. - */ - write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); + /* 2D Destination Base. + It is an address offset (128 bit aligned) from the beginning of frame buffer. + */ + write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); #if 0 /* Program pitch (distance between the 1st points of two adjacent lines). Note that input pitch is BYTE value, but the 2D Pitch register uses @@ -380,30 +374,30 @@ int hw_imageblit(struct lynx_accel *accel, FIELD_VALUE(0, DE_PITCH, SOURCE, dPitch/bytePerPixel)); /* dpr10 */ } - /* Screen Window width in Pixels. - 2D engine uses this value to calculate the linear address in frame buffer for a given point. - */ - write_dpr(accel, DE_WINDOW_WIDTH, - FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/bytePerPixel)) | - FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (dPitch/bytePerPixel))); + /* Screen Window width in Pixels. + 2D engine uses this value to calculate the linear address in frame buffer for a given point. + */ + write_dpr(accel, DE_WINDOW_WIDTH, + FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/bytePerPixel)) | + FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (dPitch/bytePerPixel))); - /* Note: For 2D Source in Host Write, only X_K1_MONO field is needed, and Y_K2 field is not used. - For mono bitmap, use startBit for X_K1. */ - write_dpr(accel, DE_SOURCE, - FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | - FIELD_VALUE(0, DE_SOURCE, X_K1_MONO, startBit)); /* dpr00 */ + /* Note: For 2D Source in Host Write, only X_K1_MONO field is needed, and Y_K2 field is not used. + For mono bitmap, use startBit for X_K1. */ + write_dpr(accel, DE_SOURCE, + FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_VALUE(0, DE_SOURCE, X_K1_MONO, startBit)); /* dpr00 */ - write_dpr(accel, DE_DESTINATION, - FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | - FIELD_VALUE(0, DE_DESTINATION, X, dx) | - FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ + write_dpr(accel, DE_DESTINATION, + FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_VALUE(0, DE_DESTINATION, X, dx) | + FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ - write_dpr(accel, DE_DIMENSION, - FIELD_VALUE(0, DE_DIMENSION, X, width) | - FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */ + write_dpr(accel, DE_DIMENSION, + FIELD_VALUE(0, DE_DIMENSION, X, width) | + FIELD_VALUE(0, DE_DIMENSION, Y_ET, height)); /* dpr08 */ - write_dpr(accel, DE_FOREGROUND, fColor); - write_dpr(accel, DE_BACKGROUND, bColor); + write_dpr(accel, DE_FOREGROUND, fColor); + write_dpr(accel, DE_BACKGROUND, bColor); de_ctrl = FIELD_VALUE(0, DE_CONTROL, ROP, rop2) | FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) | @@ -413,24 +407,24 @@ int hw_imageblit(struct lynx_accel *accel, write_dpr(accel, DE_CONTROL, de_ctrl | deGetTransparency(accel)); - /* Write MONO data (line by line) to 2D Engine data port */ - for (i=0; i<height; i++) - { - /* For each line, send the data in chunks of 4 bytes */ - for (j=0; j<(ul4BytesPerScan/4); j++) - { - write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4))); - } - - if (ulBytesRemain) - { - memcpy(ajRemain, pSrcbuf+ul4BytesPerScan, ulBytesRemain); - write_dpPort(accel, *(unsigned int *)ajRemain); - } - - pSrcbuf += srcDelta; - } - - return 0; + /* Write MONO data (line by line) to 2D Engine data port */ + for (i=0; i<height; i++) + { + /* For each line, send the data in chunks of 4 bytes */ + for (j=0; j<(ul4BytesPerScan/4); j++) + { + write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4))); + } + + if (ulBytesRemain) + { + memcpy(ajRemain, pSrcbuf+ul4BytesPerScan, ulBytesRemain); + write_dpPort(accel, *(unsigned int *)ajRemain); + } + + pSrcbuf += srcDelta; + } + + return 0; } diff --git a/drivers/staging/sm750fb/sm750_accel.h b/drivers/staging/sm750fb/sm750_accel.h index d3d256c..f252e47 100644 --- a/drivers/staging/sm750fb/sm750_accel.h +++ b/drivers/staging/sm750fb/sm750_accel.h @@ -7,7 +7,7 @@ /* notes: below address are the offset value from de_base_address (0x100000)*/ /* for sm718/750/502 de_base is at mmreg_1mb*/ -#define DE_BASE_ADDR_TYPE1 0x100000 +#define DE_BASE_ADDR_TYPE1 0x100000 /* for sm712,de_base is at mmreg_32kb */ #define DE_BASE_ADDR_TYPE2 0x8000 /* for sm722,de_base is at mmreg_0 */ @@ -26,7 +26,7 @@ #define DE_SOURCE_WRAP_ENABLE 1 #define DE_SOURCE_X_K1 29:16 #define DE_SOURCE_Y_K2 15:0 -#define DE_SOURCE_X_K1_MONO 20:16 +#define DE_SOURCE_X_K1_MONO 20:16 #define DE_DESTINATION 0x4 #define DE_DESTINATION_WRAP 31:31 diff --git a/drivers/staging/sm750fb/sm750_help.h b/drivers/staging/sm750fb/sm750_help.h index 05777f7..8ba4f8d 100644 --- a/drivers/staging/sm750fb/sm750_help.h +++ b/drivers/staging/sm750fb/sm750_help.h @@ -11,9 +11,9 @@ #define GET_FIELD(d, f) (((d) >> _LSB(f)) & RAW_MASK(f)) #define TEST_FIELD(d, f, v) (GET_FIELD(d, f) == f ## _ ## v) #define SET_FIELD(d, f, v) (((d) & ~GET_MASK(f)) | \ - (((f ## _ ## v) & RAW_MASK(f)) << _LSB(f))) + (((f ## _ ## v) & RAW_MASK(f)) << _LSB(f))) #define SET_FIELDV(d, f, v) (((d) & ~GET_MASK(f)) | \ - (((v) & RAW_MASK(f)) << _LSB(f))) + (((v) & RAW_MASK(f)) << _LSB(f))) /* Internal macros */ #define _F_START(f) (0 ? f) @@ -26,24 +26,24 @@ /* Global macros */ #define FIELD_GET(x, reg, field) \ ( \ - _F_NORMALIZE((x), reg ## _ ## field) \ + _F_NORMALIZE((x), reg ## _ ## field) \ ) #define FIELD_SET(x, reg, field, value) \ ( \ - (x & ~_F_MASK(reg ## _ ## field)) \ - | _F_DENORMALIZE(reg ## _ ## field ## _ ## value, reg ## _ ## field) \ + (x & ~_F_MASK(reg ## _ ## field)) \ + | _F_DENORMALIZE(reg ## _ ## field ## _ ## value, reg ## _ ## field) \ ) #define FIELD_VALUE(x, reg, field, value) \ ( \ - (x & ~_F_MASK(reg ## _ ## field)) \ - | _F_DENORMALIZE(value, reg ## _ ## field) \ + (x & ~_F_MASK(reg ## _ ## field)) \ + | _F_DENORMALIZE(value, reg ## _ ## field) \ ) #define FIELD_CLEAR(reg, field) \ ( \ - ~ _F_MASK(reg ## _ ## field) \ + ~ _F_MASK(reg ## _ ## field) \ ) /* Field Macros */ @@ -55,20 +55,20 @@ #define FIELD_DENORMALIZE(field, value) (((value) << FIELD_START(field)) & FIELD_MASK(field)) #define FIELD_INIT(reg, field, value) FIELD_DENORMALIZE(reg ## _ ## field, \ - reg ## _ ## field ## _ ## value) + reg ## _ ## field ## _ ## value) #define FIELD_INIT_VAL(reg, field, value) \ - (FIELD_DENORMALIZE(reg ## _ ## field, value)) + (FIELD_DENORMALIZE(reg ## _ ## field, value)) #define FIELD_VAL_SET(x, r, f, v) x = x & ~FIELD_MASK(r ## _ ## f) \ - | FIELD_DENORMALIZE(r ## _ ## f, r ## _ ## f ## _ ## v) + | FIELD_DENORMALIZE(r ## _ ## f, r ## _ ## f ## _ ## v) #define RGB(r, g, b) \ ( \ - (unsigned long) (((r) << 16) | ((g) << 8) | (b)) \ + (unsigned long) (((r) << 16) | ((g) << 8) | (b)) \ ) #define RGB16(r, g, b) \ ( \ - (unsigned short) ((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | (((b) & 0xF8) >> 3)) \ + (unsigned short) ((((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | (((b) & 0xF8) >> 3)) \ ) static inline unsigned int absDiff(unsigned int a, unsigned int b) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 84381bc..28db9c7 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -171,23 +171,23 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) /* Set up GPIO for software I2C to program DVI chip in the Xilinx SP605 board, in order to have video signal. */ - swI2CInit(0, 1); + swI2CInit(0, 1); - /* Customer may NOT use CH7301 DVI chip, which has to be - initialized differently. - */ - if (swI2CReadReg(0xec, 0x4a) == 0x95) - { - /* The following register values for CH7301 are from - Chrontel app note and our experiment. - */ + /* Customer may NOT use CH7301 DVI chip, which has to be + initialized differently. + */ + if (swI2CReadReg(0xec, 0x4a) == 0x95) + { + /* The following register values for CH7301 are from + Chrontel app note and our experiment. + */ pr_info("yes,CH7301 DVI chip found\n"); - swI2CWriteReg(0xec, 0x1d, 0x16); - swI2CWriteReg(0xec, 0x21, 0x9); - swI2CWriteReg(0xec, 0x49, 0xC0); + swI2CWriteReg(0xec, 0x1d, 0x16); + swI2CWriteReg(0xec, 0x21, 0x9); + swI2CWriteReg(0xec, 0x49, 0xC0); pr_info("okay,CH7301 DVI chip setup done\n"); - } + } } /* init 2d engine */ @@ -612,28 +612,28 @@ int hw_sm750_deWait(void) } int hw_sm750_pan_display(struct lynxfb_crtc *crtc, - const struct fb_var_screeninfo *var, - const struct fb_info *info) + const struct fb_var_screeninfo *var, + const struct fb_info *info) { - uint32_t total; - /* check params */ - if ((var->xoffset + var->xres > var->xres_virtual) || - (var->yoffset + var->yres > var->yres_virtual)) { - return -EINVAL; - } - - total = var->yoffset * info->fix.line_length + - ((var->xoffset * var->bits_per_pixel) >> 3); - total += crtc->oScreen; - if (crtc->channel == sm750_primary) { - POKE32(PANEL_FB_ADDRESS, - FIELD_VALUE(PEEK32(PANEL_FB_ADDRESS), - PANEL_FB_ADDRESS, ADDRESS, total)); - } else { - POKE32(CRT_FB_ADDRESS, - FIELD_VALUE(PEEK32(CRT_FB_ADDRESS), - CRT_FB_ADDRESS, ADDRESS, total)); - } - return 0; + uint32_t total; + /* check params */ + if ((var->xoffset + var->xres > var->xres_virtual) || + (var->yoffset + var->yres > var->yres_virtual)) { + return -EINVAL; + } + + total = var->yoffset * info->fix.line_length + + ((var->xoffset * var->bits_per_pixel) >> 3); + total += crtc->oScreen; + if (crtc->channel == sm750_primary) { + POKE32(PANEL_FB_ADDRESS, + FIELD_VALUE(PEEK32(PANEL_FB_ADDRESS), + PANEL_FB_ADDRESS, ADDRESS, total)); + } else { + POKE32(CRT_FB_ADDRESS, + FIELD_VALUE(PEEK32(CRT_FB_ADDRESS), + CRT_FB_ADDRESS, ADDRESS, total)); + } + return 0; } diff --git a/drivers/staging/sm750fb/sm750_hw.h b/drivers/staging/sm750fb/sm750_hw.h index 93288b3..adc61edf 100644 --- a/drivers/staging/sm750fb/sm750_hw.h +++ b/drivers/staging/sm750fb/sm750_hw.h @@ -2,8 +2,8 @@ #define LYNX_HW750_H__ -#define DEFAULT_SM750_CHIP_CLOCK 290 -#define DEFAULT_SM750LE_CHIP_CLOCK 333 +#define DEFAULT_SM750_CHIP_CLOCK 290 +#define DEFAULT_SM750LE_CHIP_CLOCK 333 #ifndef SM750LE_REVISION_ID #define SM750LE_REVISION_ID (unsigned char)0xfe #endif @@ -24,9 +24,9 @@ enum sm750_dataflow{ sm750_simul_sec,/* secondary => all head */ - sm750_dual_normal,/* primary => panel head and secondary => crt */ + sm750_dual_normal,/* primary => panel head and secondary => crt */ - sm750_dual_swap,/* primary => crt head and secondary => panel */ + sm750_dual_swap,/* primary => crt head and secondary => panel */ }; @@ -61,20 +61,20 @@ struct sm750_state{ int yLCD; }; -/* sm750_share stands for a presentation of two frame buffer - that use one sm750 adaptor, it is similar to the super class of lynx_share - in C++ -*/ +/* sm750_share stands for a presentation of two frame buffer + that use one sm750 adaptor, it is similar to the super class of lynx_share + in C++ + */ struct sm750_share{ /* it's better to put lynx_share struct to the first place of sm750_share */ struct lynx_share share; struct sm750_state state; int hwCursor; - /* 0: no hardware cursor - 1: primary crtc hw cursor enabled, - 2: secondary crtc hw cursor enabled - 3: both ctrc hw cursor enabled + /* 0: no hardware cursor + 1: primary crtc hw cursor enabled, + 2: secondary crtc hw cursor enabled + 3: both ctrc hw cursor enabled */ }; @@ -95,7 +95,7 @@ int hw_sm750le_setBLANK(struct lynxfb_output*, int); void hw_sm750_crtc_clear(struct lynxfb_crtc*); void hw_sm750_output_clear(struct lynxfb_output*); int hw_sm750_pan_display(struct lynxfb_crtc *crtc, - const struct fb_var_screeninfo *var, - const struct fb_info *info); + const struct fb_var_screeninfo *var, + const struct fb_info *info); #endif -- 2.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] staging: sm750fb: use tabs for indentation 2015-06-20 8:48 ` Juston Li @ 2015-06-20 10:57 ` Sudip Mukherjee -1 siblings, 0 replies; 16+ messages in thread From: Sudip Mukherjee @ 2015-06-20 10:45 UTC (permalink / raw) To: Juston Li; +Cc: teddy.wang, gregkh, linux-fbdev, devel, linux-kernel On Sat, Jun 20, 2015 at 01:48:32AM -0700, Juston Li wrote: > Replace spaces with tabs for indentation to fix the checkpatch.pl error > ERROR: code indent should use tabs where possible > WARNING: please, no spaces at the start of a line > > Signed-off-by: Juston Li <juston.h.li@gmail.com> > --- <snip> > diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c > index b6395b8..c09748c 100644 > --- a/drivers/staging/sm750fb/ddk750_sii164.c > +++ b/drivers/staging/sm750fb/ddk750_sii164.c <snip> > > @@ -279,27 +279,25 @@ char *sii164GetChipString(void) > * Input: > * powerUp - Flag to set the power down or up > */ > -void sii164SetPower( > - unsigned char powerUp > -) > +void sii164SetPower(unsigned char powerUp) is it that same patch again? different kind of change should go in a separate patch. regards sudip -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] staging: sm750fb: use tabs for indentation @ 2015-06-20 10:57 ` Sudip Mukherjee 0 siblings, 0 replies; 16+ messages in thread From: Sudip Mukherjee @ 2015-06-20 10:57 UTC (permalink / raw) To: Juston Li; +Cc: teddy.wang, gregkh, linux-fbdev, devel, linux-kernel On Sat, Jun 20, 2015 at 01:48:32AM -0700, Juston Li wrote: > Replace spaces with tabs for indentation to fix the checkpatch.pl error > ERROR: code indent should use tabs where possible > WARNING: please, no spaces at the start of a line > > Signed-off-by: Juston Li <juston.h.li@gmail.com> > --- <snip> > diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c > index b6395b8..c09748c 100644 > --- a/drivers/staging/sm750fb/ddk750_sii164.c > +++ b/drivers/staging/sm750fb/ddk750_sii164.c <snip> > > @@ -279,27 +279,25 @@ char *sii164GetChipString(void) > * Input: > * powerUp - Flag to set the power down or up > */ > -void sii164SetPower( > - unsigned char powerUp > -) > +void sii164SetPower(unsigned char powerUp) is it that same patch again? different kind of change should go in a separate patch. regards sudip -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] staging: sm750fb: use tabs for indentation 2015-06-20 10:57 ` Sudip Mukherjee @ 2015-06-20 15:40 ` Juston Li -1 siblings, 0 replies; 16+ messages in thread From: Juston Li @ 2015-06-20 15:40 UTC (permalink / raw) To: Sudip Mukherjee; +Cc: teddy.wang, Greg KH, linux-fbdev, devel, linux-kernel My apologies, I thought I removed all of those. Fixed for real this time, resending. Regards Juston On Sat, Jun 20, 2015 at 3:45 AM, Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote: > On Sat, Jun 20, 2015 at 01:48:32AM -0700, Juston Li wrote: >> Replace spaces with tabs for indentation to fix the checkpatch.pl error >> ERROR: code indent should use tabs where possible >> WARNING: please, no spaces at the start of a line >> >> Signed-off-by: Juston Li <juston.h.li@gmail.com> >> --- > <snip> >> diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c >> index b6395b8..c09748c 100644 >> --- a/drivers/staging/sm750fb/ddk750_sii164.c >> +++ b/drivers/staging/sm750fb/ddk750_sii164.c > <snip> >> >> @@ -279,27 +279,25 @@ char *sii164GetChipString(void) >> * Input: >> * powerUp - Flag to set the power down or up >> */ >> -void sii164SetPower( >> - unsigned char powerUp >> -) >> +void sii164SetPower(unsigned char powerUp) > is it that same patch again? different kind of change should go in a separate patch. > > regards > sudip -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] staging: sm750fb: use tabs for indentation @ 2015-06-20 15:40 ` Juston Li 0 siblings, 0 replies; 16+ messages in thread From: Juston Li @ 2015-06-20 15:40 UTC (permalink / raw) To: Sudip Mukherjee; +Cc: teddy.wang, Greg KH, linux-fbdev, devel, linux-kernel My apologies, I thought I removed all of those. Fixed for real this time, resending. Regards Juston On Sat, Jun 20, 2015 at 3:45 AM, Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote: > On Sat, Jun 20, 2015 at 01:48:32AM -0700, Juston Li wrote: >> Replace spaces with tabs for indentation to fix the checkpatch.pl error >> ERROR: code indent should use tabs where possible >> WARNING: please, no spaces at the start of a line >> >> Signed-off-by: Juston Li <juston.h.li@gmail.com> >> --- > <snip> >> diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c >> index b6395b8..c09748c 100644 >> --- a/drivers/staging/sm750fb/ddk750_sii164.c >> +++ b/drivers/staging/sm750fb/ddk750_sii164.c > <snip> >> >> @@ -279,27 +279,25 @@ char *sii164GetChipString(void) >> * Input: >> * powerUp - Flag to set the power down or up >> */ >> -void sii164SetPower( >> - unsigned char powerUp >> -) >> +void sii164SetPower(unsigned char powerUp) > is it that same patch again? different kind of change should go in a separate patch. > > regards > sudip -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 2/4] staging: sm750fb: fix spacing issues 2015-06-20 8:45 ` Juston Li @ 2015-06-20 8:48 ` Juston Li -1 siblings, 0 replies; 16+ messages in thread From: Juston Li @ 2015-06-20 8:48 UTC (permalink / raw) To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, devel, linux-kernel Cc: Juston Li Fix spacing errors and warnings caught by checkpatch.pl ERROR: space prohibited after that open parenthesis '(' ERROR: space required before the open brace '{' ERROR: need consistent spacing around ERROR: trailing whitespace WARNING: unnecessary whitespace before a quoted newline Signed-off-by: Juston Li <juston.h.li@gmail.com> --- drivers/staging/sm750fb/ddk750_chip.c | 14 ++-- drivers/staging/sm750fb/ddk750_display.c | 22 +++--- drivers/staging/sm750fb/ddk750_display.h | 6 +- drivers/staging/sm750fb/ddk750_dvi.c | 4 +- drivers/staging/sm750fb/ddk750_help.c | 2 +- drivers/staging/sm750fb/ddk750_mode.c | 16 ++--- drivers/staging/sm750fb/ddk750_power.c | 18 ++--- drivers/staging/sm750fb/sm750.c | 2 +- drivers/staging/sm750fb/sm750.h | 34 ++++----- drivers/staging/sm750fb/sm750_accel.c | 26 +++---- drivers/staging/sm750fb/sm750_cursor.c | 40 +++++------ drivers/staging/sm750fb/sm750_help.h | 4 +- drivers/staging/sm750fb/sm750_hw.c | 120 +++++++++++++++---------------- drivers/staging/sm750fb/sm750_hw.h | 14 ++-- 14 files changed, 158 insertions(+), 164 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index f4975d2..d7435d7 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -268,7 +268,7 @@ int ddk750_initHw(initchip_param_t *pInitParam) #endif - if (pInitParam->powerMode != 0 ) + if (pInitParam->powerMode != 0) pInitParam->powerMode = 0; setPowerMode(pInitParam->powerMode); @@ -464,17 +464,17 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll) RN = N * request; quo = RN / input; rem = RN % input;/* rem always small than 14318181 */ - fl_quo = (rem * 10000 /input); + fl_quo = (rem * 10000 / input); for (d = xcnt - 1; d >= 0; d--) { X = xparm[d].value; M = quo*X; M += fl_quo * X / 10000; /* round step */ - M += (fl_quo*X % 10000)>5000?1:0; + M += (fl_quo*X % 10000) > 5000?1:0; if (M < 256 && M > 0) { unsigned int diff; - tmpClock = pll->inputFreq *M / N / X; + tmpClock = pll->inputFreq * M / N / X; diff = absDiff(tmpClock, request_orig); if (diff < miniDiff) { pll->M = M; @@ -599,9 +599,9 @@ unsigned int formatPllReg(pll_value_t *pPLL) On returning a 32 bit number, the value can be applied to any PLL in the calling function. */ ulPllReg - FIELD_SET( 0, PANEL_PLL_CTRL, BYPASS, OFF) - | FIELD_SET( 0, PANEL_PLL_CTRL, POWER, ON) - | FIELD_SET( 0, PANEL_PLL_CTRL, INPUT, OSC) + FIELD_SET(0, PANEL_PLL_CTRL, BYPASS, OFF) + | FIELD_SET(0, PANEL_PLL_CTRL, POWER, ON) + | FIELD_SET(0, PANEL_PLL_CTRL, INPUT, OSC) #ifndef VALIDATION_CHIP | FIELD_VALUE(0, PANEL_PLL_CTRL, POD, pPLL->POD) #endif diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index 1c4049f..4a3cb86 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -49,7 +49,7 @@ static void setDisplayControl(int ctrl, int dispState) { cnt++; POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); - } while((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) !+ } while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) ! (ulDisplayCtrlReg & ~ulReservedBits)); printk("Set Panel Plane enbit:after tried %d times\n", cnt); } @@ -104,7 +104,7 @@ static void setDisplayControl(int ctrl, int dispState) { cnt++; POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg); - } while((PEEK32(CRT_DISPLAY_CTRL) & ~ulReservedBits) !+ } while ((PEEK32(CRT_DISPLAY_CTRL) & ~ulReservedBits) ! (ulDisplayCtrlReg & ~ulReservedBits)); printk("Set Crt Plane enbit:after tried %d times\n", cnt); } @@ -132,7 +132,7 @@ static void setDisplayControl(int ctrl, int dispState) static void waitNextVerticalSync(int ctrl, int delay) { unsigned int status; - if(!ctrl){ + if (!ctrl) { /* primary controller */ /* Do not wait when the Primary PLL is off or display control is already off. @@ -166,7 +166,7 @@ static void waitNextVerticalSync(int ctrl, int delay) while (status = SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); } - }else{ + } else { /* Do not wait when the Primary PLL is off or display control is already off. This will prevent the software to wait forever. */ @@ -233,14 +233,14 @@ static void swPanelPowerSequence(int disp, int delay) void ddk750_setLogicalDispOut(disp_output_t output) { unsigned int reg; - if(output & PNL_2_USAGE){ + if (output & PNL_2_USAGE) { /* set panel path controller select */ reg = PEEK32(PANEL_DISPLAY_CTRL); reg = FIELD_VALUE(reg, PANEL_DISPLAY_CTRL, SELECT, (output & PNL_2_MASK)>>PNL_2_OFFSET); POKE32(PANEL_DISPLAY_CTRL, reg); } - if(output & CRT_2_USAGE){ + if (output & CRT_2_USAGE) { /* set crt path controller select */ reg = PEEK32(CRT_DISPLAY_CTRL); reg = FIELD_VALUE(reg, CRT_DISPLAY_CTRL, SELECT, (output & CRT_2_MASK)>>CRT_2_OFFSET); @@ -250,25 +250,25 @@ void ddk750_setLogicalDispOut(disp_output_t output) } - if(output & PRI_TP_USAGE){ + if (output & PRI_TP_USAGE) { /* set primary timing and plane en_bit */ setDisplayControl(0, (output&PRI_TP_MASK)>>PRI_TP_OFFSET); } - if(output & SEC_TP_USAGE){ + if (output & SEC_TP_USAGE) { /* set secondary timing and plane en_bit*/ setDisplayControl(1, (output&SEC_TP_MASK)>>SEC_TP_OFFSET); } - if(output & PNL_SEQ_USAGE){ + if (output & PNL_SEQ_USAGE) { /* set panel sequence */ swPanelPowerSequence((output&PNL_SEQ_MASK)>>PNL_SEQ_OFFSET, 4); } - if(output & DAC_USAGE) + if (output & DAC_USAGE) setDAC((output & DAC_MASK)>>DAC_OFFSET); - if(output & DPMS_USAGE) + if (output & DPMS_USAGE) ddk750_setDPMS((output & DPMS_MASK) >> DPMS_OFFSET); } diff --git a/drivers/staging/sm750fb/ddk750_display.h b/drivers/staging/sm750fb/ddk750_display.h index 018a661..afdf201 100644 --- a/drivers/staging/sm750fb/ddk750_display.h +++ b/drivers/staging/sm750fb/ddk750_display.h @@ -46,7 +46,7 @@ 0: both off */ #define SEC_TP_OFFSET 5 -#define SEC_TP_MASK (1<< SEC_TP_OFFSET) +#define SEC_TP_MASK (1 << SEC_TP_OFFSET) #define SEC_TP_USAGE (SEC_TP_MASK << 16) #define SEC_TP_ON ((0x1 << SEC_TP_OFFSET)|SEC_TP_USAGE) #define SEC_TP_OFF ((0x0 << SEC_TP_OFFSET)|SEC_TP_USAGE) @@ -67,7 +67,7 @@ #define DAC_OFFSET 7 #define DAC_MASK (1 << DAC_OFFSET) #define DAC_USAGE (DAC_MASK << 16) -#define DAC_ON ((0x0<< DAC_OFFSET)|DAC_USAGE) +#define DAC_ON ((0x0 << DAC_OFFSET)|DAC_USAGE) #define DAC_OFF ((0x1 << DAC_OFFSET)|DAC_USAGE) /* DPMS only affect D-SUB head @@ -129,7 +129,7 @@ typedef enum _disp_output_t } disp_output_t; #else -typedef enum _disp_output_t{ +typedef enum _disp_output_t { do_LCD1_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON|DAC_ON, do_LCD1_SEC = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON|DAC_ON, #if 0 diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index 35866fa..c42db85 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -1,4 +1,4 @@ -#define USE_DVICHIP +#define USE_DVICHIP #ifdef USE_DVICHIP #include "ddk750_help.h" #include "ddk750_reg.h" @@ -45,7 +45,7 @@ int dviInit( { dvi_ctrl_device_t *pCurrentDviCtrl; pCurrentDviCtrl = g_dcftSupportedDviController; - if(pCurrentDviCtrl->pfnInit != NULL) + if (pCurrentDviCtrl->pfnInit != NULL) { return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, diff --git a/drivers/staging/sm750fb/ddk750_help.c b/drivers/staging/sm750fb/ddk750_help.c index 1adcafc..93ed958 100644 --- a/drivers/staging/sm750fb/ddk750_help.c +++ b/drivers/staging/sm750fb/ddk750_help.c @@ -10,7 +10,7 @@ void ddk750_set_mmio(void __iomem *addr, unsigned short devId, char revId) mmio750 = addr; devId750 = devId; revId750 = revId; - if(revId = 0xfe) + if (revId = 0xfe) printk("found sm750le\n"); } diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index 1f93d07..d451e7a 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -43,7 +43,7 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam, /* Set bit 29:27 of display control register for the right clock */ /* Note that SM750LE only need to supported 7 resoluitons. */ - if ( x = 800 && y = 600 ) + if (x = 800 && y = 600) dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL41); else if (x = 1024 && y = 768) dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL65); @@ -80,7 +80,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) int ret = 0; int cnt = 0; unsigned int ulTmpValue, ulReg; - if(pll->clockType = SECONDARY_PLL) + if (pll->clockType = SECONDARY_PLL) { /* programe secondary pixel clock */ POKE32(CRT_PLL_CTRL, formatPllReg(pll)); @@ -107,9 +107,9 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) FIELD_SET(0, CRT_DISPLAY_CTRL, PLANE, ENABLE); - if(getChipType() = SM750LE){ + if (getChipType() = SM750LE) { displayControlAdjust_SM750LE(pModeParam, ulTmpValue); - }else{ + } else { ulReg = PEEK32(CRT_DISPLAY_CTRL) & FIELD_CLEAR(CRT_DISPLAY_CTRL, VSYNC_PHASE) & FIELD_CLEAR(CRT_DISPLAY_CTRL, HSYNC_PHASE) @@ -120,7 +120,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) } } - else if(pll->clockType = PRIMARY_PLL) + else if (pll->clockType = PRIMARY_PLL) { unsigned int ulReservedBits; POKE32(PANEL_PLL_CTRL, formatPllReg(pll)); @@ -170,10 +170,10 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg); #if 1 - while((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) + while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) { cnt++; - if(cnt > 1000) + if (cnt > 1000) break; POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg); } @@ -193,7 +193,7 @@ int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock) pll.clockType = clock; uiActualPixelClk = calcPllValue(parm->pixel_clock, &pll); - if(getChipType() = SM750LE){ + if (getChipType() = SM750LE) { /* set graphic mode via IO method */ outb_p(0x88, 0x3d4); outb_p(0x06, 0x3d5); diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index b7a108b..28d4402 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -5,19 +5,19 @@ void ddk750_setDPMS(DPMS_t state) { unsigned int value; - if(getChipType() = SM750LE){ + if (getChipType() = SM750LE) { value = PEEK32(CRT_DISPLAY_CTRL); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, DPMS, state)); - }else{ + } else { value = PEEK32(SYSTEM_CTRL); - value= FIELD_VALUE(value, SYSTEM_CTRL, DPMS, state); + value = FIELD_VALUE(value, SYSTEM_CTRL, DPMS, state); POKE32(SYSTEM_CTRL, value); } } unsigned int getPowerMode(void) { - if(getChipType() = SM750LE) + if (getChipType() = SM750LE) return 0; return (FIELD_GET(PEEK32(POWER_MODE_CTRL), POWER_MODE_CTRL, MODE)); } @@ -33,7 +33,7 @@ void setPowerMode(unsigned int powerMode) control_value = PEEK32(POWER_MODE_CTRL); - if(getChipType() = SM750LE) + if (getChipType() = SM750LE) return; switch (powerMode) @@ -59,17 +59,17 @@ void setPowerMode(unsigned int powerMode) { control_value #ifdef VALIDATION_CHIP - FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, OFF) | + FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, OFF) | #endif - FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); + FIELD_SET(control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); } else { control_value #ifdef VALIDATION_CHIP - FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, ON) | + FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, ON) | #endif - FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, ON); + FIELD_SET(control_value, POWER_MODE_CTRL, OSC_INPUT, ON); } /* Program new power mode. */ diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 8e201f1..1ff14b2 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -967,7 +967,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) var->accel_flags = 0; var->vmode = FB_VMODE_NONINTERLACED; - pr_debug("#1 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", + pr_debug("#1 show info->cmap :\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", info->cmap.start, info->cmap.len, info->cmap.red, info->cmap.green, info->cmap.blue, info->cmap.transp); diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index bf894cc..db65621 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -10,11 +10,11 @@ #define MB(x) ((x)<<20) #define MHZ(x) ((x) * 1000000) /* align should be 2,4,8,16 */ -#define PADDING(align, data) (((data)+(align)-1)&(~((align) -1))) +#define PADDING(align, data) (((data)+(align)-1)&(~((align) - 1))) extern int smi_indent; -struct lynx_accel{ +struct lynx_accel { /* base virtual address of DPR registers */ volatile unsigned char __iomem * dprBase; /* base virtual address of de data port */ @@ -41,7 +41,7 @@ struct lynx_accel{ /* lynx_share stands for a presentation of two frame buffer that use one smi adaptor , it is similar to a basic class of C++ */ -struct lynx_share{ +struct lynx_share { /* common members */ u16 devid; u8 revid; @@ -51,9 +51,9 @@ struct lynx_share{ int accel_off; int dual; int mtrr_off; - struct{ + struct { int vram; - }mtrr; + } mtrr; /* all smi graphic adaptor got below attributes */ unsigned long vidmem_start; unsigned long vidreg_start; @@ -68,7 +68,7 @@ struct lynx_share{ void (*resume)(struct lynx_share*); }; -struct lynx_cursor{ +struct lynx_cursor { /* cursor width ,height and size */ int w; int h; @@ -92,7 +92,7 @@ struct lynx_cursor{ void (*setData)(struct lynx_cursor *, u16, const u8*, const u8*); }; -struct lynxfb_crtc{ +struct lynxfb_crtc { unsigned char __iomem *vCursor; /* virtual address of cursor */ unsigned char __iomem *vScreen; /* virtual address of on_screen */ int oCursor; /* cursor address offset in vidmem */ @@ -108,12 +108,12 @@ struct lynxfb_crtc{ void *priv; - int(*proc_setMode)(struct lynxfb_crtc*, + int (*proc_setMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*, struct fb_fix_screeninfo*); - int(*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*); - int(*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, ushort); + int (*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*); + int (*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, ushort); void (*clear)(struct lynxfb_crtc*); /* pan display */ int (*proc_panDisplay)(struct lynxfb_crtc *, @@ -123,7 +123,7 @@ struct lynxfb_crtc{ struct lynx_cursor cursor; }; -struct lynxfb_output{ +struct lynxfb_output { int dpms; int paths; /* which paths(s) this output stands for,for sm750: @@ -140,16 +140,16 @@ struct lynxfb_output{ */ void *priv; - int(*proc_setMode)(struct lynxfb_output*, + int (*proc_setMode)(struct lynxfb_output*, struct fb_var_screeninfo*, struct fb_fix_screeninfo*); - int(*proc_checkMode)(struct lynxfb_output*, struct fb_var_screeninfo*); - int(*proc_setBLANK)(struct lynxfb_output*, int); + int (*proc_checkMode)(struct lynxfb_output*, struct fb_var_screeninfo*); + int (*proc_setBLANK)(struct lynxfb_output*, int); void (*clear)(struct lynxfb_output*); }; -struct lynxfb_par{ +struct lynxfb_par { /* either 0 or 1 for dual head adaptor,0 is the older one registered */ int index; unsigned int pseudo_palette[256]; @@ -168,11 +168,11 @@ struct lynxfb_par{ ({ \ unsigned long long hz = 1000*1000*1000*1000ULL; \ do_div(hz, ps); \ - (unsigned long)hz;}) + (unsigned long)hz; }) static inline unsigned long ps_to_hz(unsigned int psvalue) { - unsigned long long numerator\x1000*1000*1000*1000ULL; + unsigned long long numerator = 1000*1000*1000*1000ULL; /* 10^12 / picosecond period gives frequency in Hz */ do_div(numerator, psvalue); return (unsigned long)numerator; diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 806aeed..391fced 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -37,7 +37,7 @@ void hw_de_init(struct lynx_accel *accel) { /* setup 2d engine registers */ u32 reg, clr; - + write_dpr(accel, DE_MASKS, 0xFFFFFFFF); /* dpr1c */ @@ -82,7 +82,7 @@ void hw_de_init(struct lynx_accel *accel) void hw_set2dformat(struct lynx_accel *accel, int fmt) { u32 reg; - + /* fmt=0,1,2 for 8,16,32,bpp on sm718/750/502 */ reg = read_dpr(accel, DE_STRETCH_FORMAT); reg = FIELD_VALUE(reg, DE_STRETCH_FORMAT, PIXEL_FORMAT, fmt); @@ -96,7 +96,7 @@ int hw_fillrect(struct lynx_accel *accel, { u32 deCtrl; - if(accel->de_wait() != 0) + if (accel->de_wait() != 0) { /* int time wait and always busy,seems hardware * got something error */ @@ -247,7 +247,7 @@ unsigned int rop2) /* ROP value */ Note that input pitch is BYTE value, but the 2D Pitch register uses pixel values. Need Byte to pixel conversion. */ - if(Bpp = 3){ + if (Bpp = 3) { sx *= 3; dx *= 3; width *= 3; @@ -270,16 +270,16 @@ unsigned int rop2) /* ROP value */ FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp))); /* dpr3c */ - if (accel->de_wait() != 0){ + if (accel->de_wait() != 0) { return -1; } write_dpr(accel, DE_SOURCE, - FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) | FIELD_VALUE(0, DE_SOURCE, X_K1, sx) | FIELD_VALUE(0, DE_SOURCE, Y_K2, sy)); /* dpr0 */ write_dpr(accel, DE_DESTINATION, - FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) | FIELD_VALUE(0, DE_DESTINATION, X, dx) | FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ write_dpr(accel, DE_DIMENSION, @@ -338,7 +338,7 @@ int hw_imageblit(struct lynx_accel *accel, ul4BytesPerScan = ulBytesPerScan & ~3; ulBytesRemain = ulBytesPerScan & 3; - if(accel->de_wait() != 0) + if (accel->de_wait() != 0) { return -1; } @@ -357,7 +357,7 @@ int hw_imageblit(struct lynx_accel *accel, Note that input pitch is BYTE value, but the 2D Pitch register uses pixel values. Need Byte to pixel conversion. */ - if(bytePerPixel = 3 ){ + if (bytePerPixel = 3) { dx *= 3; width *= 3; startBit *= 3; @@ -384,11 +384,11 @@ int hw_imageblit(struct lynx_accel *accel, /* Note: For 2D Source in Host Write, only X_K1_MONO field is needed, and Y_K2 field is not used. For mono bitmap, use startBit for X_K1. */ write_dpr(accel, DE_SOURCE, - FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) | FIELD_VALUE(0, DE_SOURCE, X_K1_MONO, startBit)); /* dpr00 */ write_dpr(accel, DE_DESTINATION, - FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) | FIELD_VALUE(0, DE_DESTINATION, X, dx) | FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ @@ -408,10 +408,10 @@ int hw_imageblit(struct lynx_accel *accel, write_dpr(accel, DE_CONTROL, de_ctrl | deGetTransparency(accel)); /* Write MONO data (line by line) to 2D Engine data port */ - for (i=0; i<height; i++) + for (i = 0; i < height; i++) { /* For each line, send the data in chunks of 4 bytes */ - for (j=0; j<(ul4BytesPerScan/4); j++) + for (j = 0; j < (ul4BytesPerScan/4); j++) { write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4))); } diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index 405e24b..4ed7ca2 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -122,7 +122,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, odd=0; */ - for(i=0;i<count;i++) + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; @@ -132,26 +132,26 @@ void hw_cursor_setData(struct lynx_cursor *cursor, * but method 2 shows no lag * and method 1 seems a bit wrong*/ #if 0 - if(rop = ROP_XOR) + if (rop = ROP_XOR) opr = mask ^ color; else opr = mask & color; - for(j=0;j<8;j++) + for (j = 0; j < 8; j++) { - if(opr & (0x80 >> j)) + if (opr & (0x80 >> j)) { /* use fg color,id = 2 */ data |= 2 << (j*2); - }else{ + } else { /* use bg color,id = 1 */ data |= 1 << (j*2); } } #else - for(j=0;j<8;j++){ - if(mask & (0x80>>j)){ - if(rop = ROP_XOR) + for (j = 0; j < 8; j++) { + if (mask & (0x80>>j)) { + if (rop = ROP_XOR) opr = mask ^ color; else opr = mask & color; @@ -165,15 +165,15 @@ void hw_cursor_setData(struct lynx_cursor *cursor, /* assume pitch is 1,2,4,8,...*/ #if 0 - if(!((i+1)&(pitch-1))) /* below line equal to is line */ + if (!((i+1)&(pitch-1))) /* below line equal to is line */ #else - if((i+1) % pitch = 0) + if ((i+1) % pitch = 0) #endif { /* need a return */ pstart += offset; pbuffer = pstart; - }else{ + } else { pbuffer += sizeof(u16); } @@ -204,7 +204,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, pstart = cursor->vstart; pbuffer = pstart; - for(i=0;i<count;i++) + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; @@ -212,37 +212,37 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, /* either method below works well, but method 2 shows no lag */ #if 0 - if(rop = ROP_XOR) + if (rop = ROP_XOR) opr = mask ^ color; else opr = mask & color; - for(j=0;j<8;j++) + for (j = 0; j < 8; j++) { - if(opr & (0x80 >> j)) + if (opr & (0x80 >> j)) { /* use fg color,id = 2 */ data |= 2 << (j*2); - }else{ + } else { /* use bg color,id = 1 */ data |= 1 << (j*2); } } #else - for(j=0;j<8;j++){ - if(mask & (1<<j)) + for (j = 0; j < 8; j++) { + if (mask & (1<<j)) data |= ((color & (1<<j))?1:2)<<(j*2); } #endif iowrite16(data, pbuffer); /* assume pitch is 1,2,4,8,...*/ - if(!(i&(pitch-1))) + if (!(i&(pitch-1))) { /* need a return */ pstart += offset; pbuffer = pstart; - }else{ + } else { pbuffer += sizeof(u16); } diff --git a/drivers/staging/sm750fb/sm750_help.h b/drivers/staging/sm750fb/sm750_help.h index 8ba4f8d..e7d74e6 100644 --- a/drivers/staging/sm750fb/sm750_help.h +++ b/drivers/staging/sm750fb/sm750_help.h @@ -43,7 +43,7 @@ #define FIELD_CLEAR(reg, field) \ ( \ - ~ _F_MASK(reg ## _ ## field) \ + ~_F_MASK(reg ## _ ## field) \ ) /* Field Macros */ @@ -73,7 +73,7 @@ static inline unsigned int absDiff(unsigned int a, unsigned int b) { - if(a<b) + if (a < b) return b-a; else return a-b; diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 28db9c7..af7ea2e 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -28,7 +28,6 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) { int ret; struct sm750_share *spec_share; - spec_share = container_of(share, struct sm750_share, share); ret = 0; @@ -44,7 +43,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) * successfully * */ - if((ret = pci_request_region(pdev, 1, "sm750fb"))) + if ((ret = pci_request_region(pdev, 1, "sm750fb"))) { pr_err("Can not request PCI regions.\n"); goto exit; @@ -52,15 +51,15 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) /* now map mmio and vidmem*/ share->pvReg = ioremap_nocache(share->vidreg_start, share->vidreg_size); - if(!share->pvReg){ + if (!share->pvReg) { pr_err("mmio failed\n"); ret = -EFAULT; goto exit; - }else{ + } else { pr_info("mmio virtual addr = %p\n", share->pvReg); } - + share->accel.dprBase = share->pvReg + DE_BASE_ADDR_TYPE1; share->accel.dpPortBase = share->pvReg + DE_PORT_ADDR_TYPE1; @@ -78,7 +77,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) /* reserve the vidmem space of smi adaptor */ #if 0 - if((ret = pci_request_region(pdev, 0, _moduleName_))) + if ((ret = pci_request_region(pdev, 0, _moduleName_))) { pr_err("Can not request PCI regions.\n"); goto exit; @@ -87,11 +86,11 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) share->pvMem = ioremap_wc(share->vidmem_start, share->vidmem_size); - if(!share->pvMem){ + if (!share->pvMem) { pr_err("Map video memory failed\n"); ret = -EFAULT; goto exit; - }else{ + } else { pr_info("video memory vaddr = %p\n", share->pvMem); } exit: @@ -104,22 +103,22 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) { struct sm750_share *spec_share; struct init_status *parm; - + spec_share = container_of(share, struct sm750_share, share); parm = &spec_share->state.initParm; - if(parm->chip_clk = 0) - parm->chip_clk = (getChipType() = SM750LE)? + if (parm->chip_clk = 0) + parm->chip_clk = (getChipType() = SM750LE) ? DEFAULT_SM750LE_CHIP_CLOCK : DEFAULT_SM750_CHIP_CLOCK; - if(parm->mem_clk = 0) + if (parm->mem_clk = 0) parm->mem_clk = parm->chip_clk; - if(parm->master_clk = 0) + if (parm->master_clk = 0) parm->master_clk = parm->chip_clk/3; ddk750_initHw((initchip_param_t *)&spec_share->state.initParm); /* for sm718,open pci burst */ - if(share->devid = 0x718){ + if (share->devid = 0x718) { POKE32(SYSTEM_CTRL, FIELD_SET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PCI_BURST, ON)); } @@ -130,10 +129,10 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) ddk750_initDVIDisp(); #endif - if(getChipType() != SM750LE) + if (getChipType() != SM750LE) { /* does user need CRT ?*/ - if(spec_share->state.nocrt){ + if (spec_share->state.nocrt) { POKE32(MISC_CTRL, FIELD_SET(PEEK32(MISC_CTRL), MISC_CTRL, @@ -143,7 +142,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) FIELD_SET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, DPMS, VNHN)); - }else{ + } else { POKE32(MISC_CTRL, FIELD_SET(PEEK32(MISC_CTRL), MISC_CTRL, @@ -155,7 +154,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) DPMS, VPHP)); } - switch (spec_share->state.pnltype){ + switch (spec_share->state.pnltype) { case sm750_doubleTFT: case sm750_24TFT: case sm750_dualTFT: @@ -166,7 +165,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) spec_share->state.pnltype)); break; } - }else{ + } else { /* for 750LE ,no DVI chip initilization makes Monitor no signal */ /* Set up GPIO for software I2C to program DVI chip in the Xilinx SP605 board, in order to have video signal. @@ -191,7 +190,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) } /* init 2d engine */ - if(!share->accel_off){ + if (!share->accel_off) { hw_sm750_initAccel(share); } @@ -202,7 +201,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) resource_size_t hw_sm750_getVMSize(struct lynx_share *share) { resource_size_t ret; - + ret = ddk750_getVMSize(); return ret; } @@ -211,7 +210,6 @@ resource_size_t hw_sm750_getVMSize(struct lynx_share *share) int hw_sm750_output_checkMode(struct lynxfb_output* output, struct fb_var_screeninfo* var) { - return 0; } @@ -222,30 +220,30 @@ int hw_sm750_output_setMode(struct lynxfb_output* output, int ret; disp_output_t dispSet; int channel; - + ret = 0; dispSet = 0; channel = *output->channel; - if(getChipType() != SM750LE){ - if(channel = sm750_primary){ + if (getChipType() != SM750LE) { + if (channel = sm750_primary) { pr_info("primary channel\n"); - if(output->paths & sm750_panel) + if (output->paths & sm750_panel) dispSet |= do_LCD1_PRI; - if(output->paths & sm750_crt) + if (output->paths & sm750_crt) dispSet |= do_CRT_PRI; - }else{ + } else { pr_info("secondary channel\n"); - if(output->paths & sm750_panel) + if (output->paths & sm750_panel) dispSet |= do_LCD1_SEC; - if(output->paths & sm750_crt) + if (output->paths & sm750_crt) dispSet |= do_CRT_SEC; } ddk750_setLogicalDispOut(dispSet); - }else{ + } else { /* just open DISPLAY_CONTROL_750LE register bit 3:0*/ u32 reg; reg = PEEK32(DISPLAY_CONTROL_750LE); @@ -253,24 +251,22 @@ int hw_sm750_output_setMode(struct lynxfb_output* output, POKE32(DISPLAY_CONTROL_750LE, reg); } - pr_info("ddk setlogicdispout done \n"); + pr_info("ddk setlogicdispout done\n"); return ret; } void hw_sm750_output_clear(struct lynxfb_output* output) { - return; } int hw_sm750_crtc_checkMode(struct lynxfb_crtc* crtc, struct fb_var_screeninfo* var) { struct lynx_share *share; - share = container_of(crtc, struct lynxfb_par, crtc)->share; - switch (var->bits_per_pixel){ + switch (var->bits_per_pixel) { case 8: case 16: break; @@ -303,14 +299,13 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, struct lynx_share *share; struct lynxfb_par *par; - ret = 0; par = container_of(crtc, struct lynxfb_par, crtc); share = par->share; #if 1 - if(!share->accel_off){ + if (!share->accel_off) { /* set 2d engine pixel format according to mode bpp */ - switch(var->bits_per_pixel){ + switch (var->bits_per_pixel) { case 8: fmt = 0; break; @@ -330,7 +325,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, modparm.pixel_clock = ps_to_hz(var->pixclock); modparm.vertical_sync_polarity = (var->sync & FB_SYNC_HOR_HIGH_ACT) ? POS:NEG; modparm.horizontal_sync_polarity = (var->sync & FB_SYNC_VERT_HIGH_ACT) ? POS:NEG; - modparm.clock_phase_polarity = (var->sync& FB_SYNC_COMP_HIGH_ACT) ? POS:NEG; + modparm.clock_phase_polarity = (var->sync & FB_SYNC_COMP_HIGH_ACT) ? POS:NEG; modparm.horizontal_display_end = var->xres; modparm.horizontal_sync_width = var->hsync_len; modparm.horizontal_sync_start = var->xres + var->right_margin; @@ -341,19 +336,19 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, modparm.vertical_total = var->yres + var->upper_margin + var->lower_margin + var->vsync_len; /* choose pll */ - if(crtc->channel != sm750_secondary) + if (crtc->channel != sm750_secondary) clock = PRIMARY_PLL; else clock = SECONDARY_PLL; pr_debug("Request pixel clock = %lu\n", modparm.pixel_clock); ret = ddk750_setModeTiming(&modparm, clock); - if(ret){ + if (ret) { pr_err("Set mode timing failed\n"); goto exit; } - if(crtc->channel != sm750_secondary){ + if (crtc->channel != sm750_secondary) { /* set pitch, offset ,width,start address ,etc... */ POKE32(PANEL_FB_ADDRESS, FIELD_SET(0, PANEL_FB_ADDRESS, STATUS, CURRENT)| @@ -369,7 +364,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, FIELD_VALUE(0, PANEL_FB_WIDTH, OFFSET, fix->line_length)); POKE32(PANEL_WINDOW_WIDTH, - FIELD_VALUE(0, PANEL_WINDOW_WIDTH, WIDTH, var->xres -1)| + FIELD_VALUE(0, PANEL_WINDOW_WIDTH, WIDTH, var->xres - 1)| FIELD_VALUE(0, PANEL_WINDOW_WIDTH, X, var->xoffset)); POKE32(PANEL_WINDOW_HEIGHT, @@ -389,7 +384,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, PANEL_DISPLAY_CTRL, FORMAT, (var->bits_per_pixel >> 4) )); - }else{ + } else { /* not implemented now */ POKE32(CRT_FB_ADDRESS, crtc->oScreen); reg = var->xres * (var->bits_per_pixel >> 3); @@ -414,22 +409,21 @@ exit: void hw_sm750_crtc_clear(struct lynxfb_crtc* crtc) { - return; } int hw_sm750_setColReg(struct lynxfb_crtc* crtc, ushort index, ushort red, ushort green, ushort blue) { - static unsigned int add[]={PANEL_PALETTE_RAM, CRT_PALETTE_RAM}; + static unsigned int add[] = {PANEL_PALETTE_RAM, CRT_PALETTE_RAM}; POKE32(add[crtc->channel] + index*4, (red<<16)|(green<<8)|blue); return 0; } -int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank){ +int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank) { int dpms, crtdb; - - switch(blank) + + switch (blank) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) case FB_BLANK_UNBLANK: @@ -473,7 +467,7 @@ int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank){ return -EINVAL; } - if(output->paths & sm750_crt){ + if (output->paths & sm750_crt) { POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, DPMS, dpms)); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, BLANK, crtdb)); } @@ -483,7 +477,7 @@ int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank){ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) { unsigned int dpms, pps, crtdb; - + dpms = pps = crtdb = 0; switch (blank) @@ -493,14 +487,14 @@ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) #else case VESA_NO_BLANKING: #endif - pr_info("flag = FB_BLANK_UNBLANK \n"); + pr_info("flag = FB_BLANK_UNBLANK\n"); dpms = SYSTEM_CTRL_DPMS_VPHP; pps = PANEL_DISPLAY_CTRL_DATA_ENABLE; crtdb = CRT_DISPLAY_CTRL_BLANK_OFF; break; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) case FB_BLANK_NORMAL: - pr_info("flag = FB_BLANK_NORMAL \n"); + pr_info("flag = FB_BLANK_NORMAL\n"); dpms = SYSTEM_CTRL_DPMS_VPHP; pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; crtdb = CRT_DISPLAY_CTRL_BLANK_ON; @@ -535,13 +529,13 @@ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) break; } - if(output->paths & sm750_crt){ + if (output->paths & sm750_crt) { POKE32(SYSTEM_CTRL, FIELD_VALUE(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, DPMS, dpms)); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, BLANK, crtdb)); } - if(output->paths & sm750_panel){ + if (output->paths & sm750_panel) { POKE32(PANEL_DISPLAY_CTRL, FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, DATA, pps)); } @@ -554,7 +548,7 @@ void hw_sm750_initAccel(struct lynx_share *share) u32 reg; enable2DEngine(1); - if(getChipType() = SM750LE){ + if (getChipType() = SM750LE) { reg = PEEK32(DE_STATE1); reg = FIELD_SET(reg, DE_STATE1, DE_ABORT, ON); POKE32(DE_STATE1, reg); @@ -563,7 +557,7 @@ void hw_sm750_initAccel(struct lynx_share *share) reg = FIELD_SET(reg, DE_STATE1, DE_ABORT, OFF); POKE32(DE_STATE1, reg); - }else{ + } else { /* engine reset */ reg = PEEK32(SYSTEM_CTRL); reg = FIELD_SET(reg, SYSTEM_CTRL, DE_ABORT, ON); @@ -580,10 +574,10 @@ void hw_sm750_initAccel(struct lynx_share *share) int hw_sm750le_deWait(void) { - int i=0x10000000; - while(i--){ + int i = 0x10000000; + while (i--) { unsigned int dwVal = PEEK32(DE_STATE2); - if((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) = DE_STATE2_DE_STATUS_IDLE) && + if ((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) = DE_STATE2_DE_STATUS_IDLE) && (FIELD_GET(dwVal, DE_STATE2, DE_FIFO) = DE_STATE2_DE_FIFO_EMPTY) && (FIELD_GET(dwVal, DE_STATE2, DE_MEM_FIFO) = DE_STATE2_DE_MEM_FIFO_EMPTY)) { @@ -597,10 +591,10 @@ int hw_sm750le_deWait(void) int hw_sm750_deWait(void) { - int i=0x10000000; - while(i--){ + int i = 0x10000000; + while (i--) { unsigned int dwVal = PEEK32(SYSTEM_CTRL); - if((FIELD_GET(dwVal, SYSTEM_CTRL, DE_STATUS) = SYSTEM_CTRL_DE_STATUS_IDLE) && + if ((FIELD_GET(dwVal, SYSTEM_CTRL, DE_STATUS) = SYSTEM_CTRL_DE_STATUS_IDLE) && (FIELD_GET(dwVal, SYSTEM_CTRL, DE_FIFO) = SYSTEM_CTRL_DE_FIFO_EMPTY) && (FIELD_GET(dwVal, SYSTEM_CTRL, DE_MEM_FIFO) = SYSTEM_CTRL_DE_MEM_FIFO_EMPTY)) { diff --git a/drivers/staging/sm750fb/sm750_hw.h b/drivers/staging/sm750fb/sm750_hw.h index adc61edf..ef0a16f 100644 --- a/drivers/staging/sm750fb/sm750_hw.h +++ b/drivers/staging/sm750fb/sm750_hw.h @@ -9,7 +9,7 @@ #endif -enum sm750_pnltype{ +enum sm750_pnltype { sm750_24TFT = 0,/* 24bit tft */ @@ -19,7 +19,7 @@ enum sm750_pnltype{ }; /* vga channel is not concerned */ -enum sm750_dataflow{ +enum sm750_dataflow { sm750_simul_pri,/* primary => all head */ sm750_simul_sec,/* secondary => all head */ @@ -30,19 +30,19 @@ enum sm750_dataflow{ }; -enum sm750_channel{ +enum sm750_channel { sm750_primary = 0, /* enum value equal to the register filed data */ sm750_secondary = 1, }; -enum sm750_path{ +enum sm750_path { sm750_panel = 1, sm750_crt = 2, sm750_pnc = 3,/* panel and crt */ }; -struct init_status{ +struct init_status { ushort powerMode; /* below three clocks are in unit of MHZ*/ ushort chip_clk; @@ -52,7 +52,7 @@ struct init_status{ ushort resetMemory; }; -struct sm750_state{ +struct sm750_state { struct init_status initParm; enum sm750_pnltype pnltype; enum sm750_dataflow dataflow; @@ -66,7 +66,7 @@ struct sm750_state{ in C++ */ -struct sm750_share{ +struct sm750_share { /* it's better to put lynx_share struct to the first place of sm750_share */ struct lynx_share share; struct sm750_state state; -- 2.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/4] staging: sm750fb: fix spacing issues @ 2015-06-20 8:48 ` Juston Li 0 siblings, 0 replies; 16+ messages in thread From: Juston Li @ 2015-06-20 8:48 UTC (permalink / raw) To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, devel, linux-kernel Cc: Juston Li Fix spacing errors and warnings caught by checkpatch.pl ERROR: space prohibited after that open parenthesis '(' ERROR: space required before the open brace '{' ERROR: need consistent spacing around ERROR: trailing whitespace WARNING: unnecessary whitespace before a quoted newline Signed-off-by: Juston Li <juston.h.li@gmail.com> --- drivers/staging/sm750fb/ddk750_chip.c | 14 ++-- drivers/staging/sm750fb/ddk750_display.c | 22 +++--- drivers/staging/sm750fb/ddk750_display.h | 6 +- drivers/staging/sm750fb/ddk750_dvi.c | 4 +- drivers/staging/sm750fb/ddk750_help.c | 2 +- drivers/staging/sm750fb/ddk750_mode.c | 16 ++--- drivers/staging/sm750fb/ddk750_power.c | 18 ++--- drivers/staging/sm750fb/sm750.c | 2 +- drivers/staging/sm750fb/sm750.h | 34 ++++----- drivers/staging/sm750fb/sm750_accel.c | 26 +++---- drivers/staging/sm750fb/sm750_cursor.c | 40 +++++------ drivers/staging/sm750fb/sm750_help.h | 4 +- drivers/staging/sm750fb/sm750_hw.c | 120 +++++++++++++++---------------- drivers/staging/sm750fb/sm750_hw.h | 14 ++-- 14 files changed, 158 insertions(+), 164 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index f4975d2..d7435d7 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -268,7 +268,7 @@ int ddk750_initHw(initchip_param_t *pInitParam) #endif - if (pInitParam->powerMode != 0 ) + if (pInitParam->powerMode != 0) pInitParam->powerMode = 0; setPowerMode(pInitParam->powerMode); @@ -464,17 +464,17 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll) RN = N * request; quo = RN / input; rem = RN % input;/* rem always small than 14318181 */ - fl_quo = (rem * 10000 /input); + fl_quo = (rem * 10000 / input); for (d = xcnt - 1; d >= 0; d--) { X = xparm[d].value; M = quo*X; M += fl_quo * X / 10000; /* round step */ - M += (fl_quo*X % 10000)>5000?1:0; + M += (fl_quo*X % 10000) > 5000?1:0; if (M < 256 && M > 0) { unsigned int diff; - tmpClock = pll->inputFreq *M / N / X; + tmpClock = pll->inputFreq * M / N / X; diff = absDiff(tmpClock, request_orig); if (diff < miniDiff) { pll->M = M; @@ -599,9 +599,9 @@ unsigned int formatPllReg(pll_value_t *pPLL) On returning a 32 bit number, the value can be applied to any PLL in the calling function. */ ulPllReg = - FIELD_SET( 0, PANEL_PLL_CTRL, BYPASS, OFF) - | FIELD_SET( 0, PANEL_PLL_CTRL, POWER, ON) - | FIELD_SET( 0, PANEL_PLL_CTRL, INPUT, OSC) + FIELD_SET(0, PANEL_PLL_CTRL, BYPASS, OFF) + | FIELD_SET(0, PANEL_PLL_CTRL, POWER, ON) + | FIELD_SET(0, PANEL_PLL_CTRL, INPUT, OSC) #ifndef VALIDATION_CHIP | FIELD_VALUE(0, PANEL_PLL_CTRL, POD, pPLL->POD) #endif diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index 1c4049f..4a3cb86 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -49,7 +49,7 @@ static void setDisplayControl(int ctrl, int dispState) { cnt++; POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); - } while((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != + } while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulDisplayCtrlReg & ~ulReservedBits)); printk("Set Panel Plane enbit:after tried %d times\n", cnt); } @@ -104,7 +104,7 @@ static void setDisplayControl(int ctrl, int dispState) { cnt++; POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg); - } while((PEEK32(CRT_DISPLAY_CTRL) & ~ulReservedBits) != + } while ((PEEK32(CRT_DISPLAY_CTRL) & ~ulReservedBits) != (ulDisplayCtrlReg & ~ulReservedBits)); printk("Set Crt Plane enbit:after tried %d times\n", cnt); } @@ -132,7 +132,7 @@ static void setDisplayControl(int ctrl, int dispState) static void waitNextVerticalSync(int ctrl, int delay) { unsigned int status; - if(!ctrl){ + if (!ctrl) { /* primary controller */ /* Do not wait when the Primary PLL is off or display control is already off. @@ -166,7 +166,7 @@ static void waitNextVerticalSync(int ctrl, int delay) while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); } - }else{ + } else { /* Do not wait when the Primary PLL is off or display control is already off. This will prevent the software to wait forever. */ @@ -233,14 +233,14 @@ static void swPanelPowerSequence(int disp, int delay) void ddk750_setLogicalDispOut(disp_output_t output) { unsigned int reg; - if(output & PNL_2_USAGE){ + if (output & PNL_2_USAGE) { /* set panel path controller select */ reg = PEEK32(PANEL_DISPLAY_CTRL); reg = FIELD_VALUE(reg, PANEL_DISPLAY_CTRL, SELECT, (output & PNL_2_MASK)>>PNL_2_OFFSET); POKE32(PANEL_DISPLAY_CTRL, reg); } - if(output & CRT_2_USAGE){ + if (output & CRT_2_USAGE) { /* set crt path controller select */ reg = PEEK32(CRT_DISPLAY_CTRL); reg = FIELD_VALUE(reg, CRT_DISPLAY_CTRL, SELECT, (output & CRT_2_MASK)>>CRT_2_OFFSET); @@ -250,25 +250,25 @@ void ddk750_setLogicalDispOut(disp_output_t output) } - if(output & PRI_TP_USAGE){ + if (output & PRI_TP_USAGE) { /* set primary timing and plane en_bit */ setDisplayControl(0, (output&PRI_TP_MASK)>>PRI_TP_OFFSET); } - if(output & SEC_TP_USAGE){ + if (output & SEC_TP_USAGE) { /* set secondary timing and plane en_bit*/ setDisplayControl(1, (output&SEC_TP_MASK)>>SEC_TP_OFFSET); } - if(output & PNL_SEQ_USAGE){ + if (output & PNL_SEQ_USAGE) { /* set panel sequence */ swPanelPowerSequence((output&PNL_SEQ_MASK)>>PNL_SEQ_OFFSET, 4); } - if(output & DAC_USAGE) + if (output & DAC_USAGE) setDAC((output & DAC_MASK)>>DAC_OFFSET); - if(output & DPMS_USAGE) + if (output & DPMS_USAGE) ddk750_setDPMS((output & DPMS_MASK) >> DPMS_OFFSET); } diff --git a/drivers/staging/sm750fb/ddk750_display.h b/drivers/staging/sm750fb/ddk750_display.h index 018a661..afdf201 100644 --- a/drivers/staging/sm750fb/ddk750_display.h +++ b/drivers/staging/sm750fb/ddk750_display.h @@ -46,7 +46,7 @@ 0: both off */ #define SEC_TP_OFFSET 5 -#define SEC_TP_MASK (1<< SEC_TP_OFFSET) +#define SEC_TP_MASK (1 << SEC_TP_OFFSET) #define SEC_TP_USAGE (SEC_TP_MASK << 16) #define SEC_TP_ON ((0x1 << SEC_TP_OFFSET)|SEC_TP_USAGE) #define SEC_TP_OFF ((0x0 << SEC_TP_OFFSET)|SEC_TP_USAGE) @@ -67,7 +67,7 @@ #define DAC_OFFSET 7 #define DAC_MASK (1 << DAC_OFFSET) #define DAC_USAGE (DAC_MASK << 16) -#define DAC_ON ((0x0<< DAC_OFFSET)|DAC_USAGE) +#define DAC_ON ((0x0 << DAC_OFFSET)|DAC_USAGE) #define DAC_OFF ((0x1 << DAC_OFFSET)|DAC_USAGE) /* DPMS only affect D-SUB head @@ -129,7 +129,7 @@ typedef enum _disp_output_t } disp_output_t; #else -typedef enum _disp_output_t{ +typedef enum _disp_output_t { do_LCD1_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON|DAC_ON, do_LCD1_SEC = PNL_2_SEC|SEC_TP_ON|PNL_SEQ_ON|DAC_ON, #if 0 diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index 35866fa..c42db85 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -1,4 +1,4 @@ -#define USE_DVICHIP +#define USE_DVICHIP #ifdef USE_DVICHIP #include "ddk750_help.h" #include "ddk750_reg.h" @@ -45,7 +45,7 @@ int dviInit( { dvi_ctrl_device_t *pCurrentDviCtrl; pCurrentDviCtrl = g_dcftSupportedDviController; - if(pCurrentDviCtrl->pfnInit != NULL) + if (pCurrentDviCtrl->pfnInit != NULL) { return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, diff --git a/drivers/staging/sm750fb/ddk750_help.c b/drivers/staging/sm750fb/ddk750_help.c index 1adcafc..93ed958 100644 --- a/drivers/staging/sm750fb/ddk750_help.c +++ b/drivers/staging/sm750fb/ddk750_help.c @@ -10,7 +10,7 @@ void ddk750_set_mmio(void __iomem *addr, unsigned short devId, char revId) mmio750 = addr; devId750 = devId; revId750 = revId; - if(revId == 0xfe) + if (revId == 0xfe) printk("found sm750le\n"); } diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index 1f93d07..d451e7a 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -43,7 +43,7 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam, /* Set bit 29:27 of display control register for the right clock */ /* Note that SM750LE only need to supported 7 resoluitons. */ - if ( x == 800 && y == 600 ) + if (x == 800 && y == 600) dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL41); else if (x == 1024 && y == 768) dispControl = FIELD_SET(dispControl, CRT_DISPLAY_CTRL, CLK, PLL65); @@ -80,7 +80,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) int ret = 0; int cnt = 0; unsigned int ulTmpValue, ulReg; - if(pll->clockType == SECONDARY_PLL) + if (pll->clockType == SECONDARY_PLL) { /* programe secondary pixel clock */ POKE32(CRT_PLL_CTRL, formatPllReg(pll)); @@ -107,9 +107,9 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) FIELD_SET(0, CRT_DISPLAY_CTRL, PLANE, ENABLE); - if(getChipType() == SM750LE){ + if (getChipType() == SM750LE) { displayControlAdjust_SM750LE(pModeParam, ulTmpValue); - }else{ + } else { ulReg = PEEK32(CRT_DISPLAY_CTRL) & FIELD_CLEAR(CRT_DISPLAY_CTRL, VSYNC_PHASE) & FIELD_CLEAR(CRT_DISPLAY_CTRL, HSYNC_PHASE) @@ -120,7 +120,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) } } - else if(pll->clockType == PRIMARY_PLL) + else if (pll->clockType == PRIMARY_PLL) { unsigned int ulReservedBits; POKE32(PANEL_PLL_CTRL, formatPllReg(pll)); @@ -170,10 +170,10 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg); #if 1 - while((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) + while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) { cnt++; - if(cnt > 1000) + if (cnt > 1000) break; POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg); } @@ -193,7 +193,7 @@ int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock) pll.clockType = clock; uiActualPixelClk = calcPllValue(parm->pixel_clock, &pll); - if(getChipType() == SM750LE){ + if (getChipType() == SM750LE) { /* set graphic mode via IO method */ outb_p(0x88, 0x3d4); outb_p(0x06, 0x3d5); diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index b7a108b..28d4402 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -5,19 +5,19 @@ void ddk750_setDPMS(DPMS_t state) { unsigned int value; - if(getChipType() == SM750LE){ + if (getChipType() == SM750LE) { value = PEEK32(CRT_DISPLAY_CTRL); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, DPMS, state)); - }else{ + } else { value = PEEK32(SYSTEM_CTRL); - value= FIELD_VALUE(value, SYSTEM_CTRL, DPMS, state); + value = FIELD_VALUE(value, SYSTEM_CTRL, DPMS, state); POKE32(SYSTEM_CTRL, value); } } unsigned int getPowerMode(void) { - if(getChipType() == SM750LE) + if (getChipType() == SM750LE) return 0; return (FIELD_GET(PEEK32(POWER_MODE_CTRL), POWER_MODE_CTRL, MODE)); } @@ -33,7 +33,7 @@ void setPowerMode(unsigned int powerMode) control_value = PEEK32(POWER_MODE_CTRL); - if(getChipType() == SM750LE) + if (getChipType() == SM750LE) return; switch (powerMode) @@ -59,17 +59,17 @@ void setPowerMode(unsigned int powerMode) { control_value = #ifdef VALIDATION_CHIP - FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, OFF) | + FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, OFF) | #endif - FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); + FIELD_SET(control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); } else { control_value = #ifdef VALIDATION_CHIP - FIELD_SET( control_value, POWER_MODE_CTRL, 336CLK, ON) | + FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, ON) | #endif - FIELD_SET( control_value, POWER_MODE_CTRL, OSC_INPUT, ON); + FIELD_SET(control_value, POWER_MODE_CTRL, OSC_INPUT, ON); } /* Program new power mode. */ diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 8e201f1..1ff14b2 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -967,7 +967,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) var->accel_flags = 0; var->vmode = FB_VMODE_NONINTERLACED; - pr_debug("#1 show info->cmap : \nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", + pr_debug("#1 show info->cmap :\nstart=%d,len=%d,red=%p,green=%p,blue=%p,transp=%p\n", info->cmap.start, info->cmap.len, info->cmap.red, info->cmap.green, info->cmap.blue, info->cmap.transp); diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index bf894cc..db65621 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -10,11 +10,11 @@ #define MB(x) ((x)<<20) #define MHZ(x) ((x) * 1000000) /* align should be 2,4,8,16 */ -#define PADDING(align, data) (((data)+(align)-1)&(~((align) -1))) +#define PADDING(align, data) (((data)+(align)-1)&(~((align) - 1))) extern int smi_indent; -struct lynx_accel{ +struct lynx_accel { /* base virtual address of DPR registers */ volatile unsigned char __iomem * dprBase; /* base virtual address of de data port */ @@ -41,7 +41,7 @@ struct lynx_accel{ /* lynx_share stands for a presentation of two frame buffer that use one smi adaptor , it is similar to a basic class of C++ */ -struct lynx_share{ +struct lynx_share { /* common members */ u16 devid; u8 revid; @@ -51,9 +51,9 @@ struct lynx_share{ int accel_off; int dual; int mtrr_off; - struct{ + struct { int vram; - }mtrr; + } mtrr; /* all smi graphic adaptor got below attributes */ unsigned long vidmem_start; unsigned long vidreg_start; @@ -68,7 +68,7 @@ struct lynx_share{ void (*resume)(struct lynx_share*); }; -struct lynx_cursor{ +struct lynx_cursor { /* cursor width ,height and size */ int w; int h; @@ -92,7 +92,7 @@ struct lynx_cursor{ void (*setData)(struct lynx_cursor *, u16, const u8*, const u8*); }; -struct lynxfb_crtc{ +struct lynxfb_crtc { unsigned char __iomem *vCursor; /* virtual address of cursor */ unsigned char __iomem *vScreen; /* virtual address of on_screen */ int oCursor; /* cursor address offset in vidmem */ @@ -108,12 +108,12 @@ struct lynxfb_crtc{ void *priv; - int(*proc_setMode)(struct lynxfb_crtc*, + int (*proc_setMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*, struct fb_fix_screeninfo*); - int(*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*); - int(*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, ushort); + int (*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*); + int (*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, ushort); void (*clear)(struct lynxfb_crtc*); /* pan display */ int (*proc_panDisplay)(struct lynxfb_crtc *, @@ -123,7 +123,7 @@ struct lynxfb_crtc{ struct lynx_cursor cursor; }; -struct lynxfb_output{ +struct lynxfb_output { int dpms; int paths; /* which paths(s) this output stands for,for sm750: @@ -140,16 +140,16 @@ struct lynxfb_output{ */ void *priv; - int(*proc_setMode)(struct lynxfb_output*, + int (*proc_setMode)(struct lynxfb_output*, struct fb_var_screeninfo*, struct fb_fix_screeninfo*); - int(*proc_checkMode)(struct lynxfb_output*, struct fb_var_screeninfo*); - int(*proc_setBLANK)(struct lynxfb_output*, int); + int (*proc_checkMode)(struct lynxfb_output*, struct fb_var_screeninfo*); + int (*proc_setBLANK)(struct lynxfb_output*, int); void (*clear)(struct lynxfb_output*); }; -struct lynxfb_par{ +struct lynxfb_par { /* either 0 or 1 for dual head adaptor,0 is the older one registered */ int index; unsigned int pseudo_palette[256]; @@ -168,11 +168,11 @@ struct lynxfb_par{ ({ \ unsigned long long hz = 1000*1000*1000*1000ULL; \ do_div(hz, ps); \ - (unsigned long)hz;}) + (unsigned long)hz; }) static inline unsigned long ps_to_hz(unsigned int psvalue) { - unsigned long long numerator=1000*1000*1000*1000ULL; + unsigned long long numerator = 1000*1000*1000*1000ULL; /* 10^12 / picosecond period gives frequency in Hz */ do_div(numerator, psvalue); return (unsigned long)numerator; diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 806aeed..391fced 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -37,7 +37,7 @@ void hw_de_init(struct lynx_accel *accel) { /* setup 2d engine registers */ u32 reg, clr; - + write_dpr(accel, DE_MASKS, 0xFFFFFFFF); /* dpr1c */ @@ -82,7 +82,7 @@ void hw_de_init(struct lynx_accel *accel) void hw_set2dformat(struct lynx_accel *accel, int fmt) { u32 reg; - + /* fmt=0,1,2 for 8,16,32,bpp on sm718/750/502 */ reg = read_dpr(accel, DE_STRETCH_FORMAT); reg = FIELD_VALUE(reg, DE_STRETCH_FORMAT, PIXEL_FORMAT, fmt); @@ -96,7 +96,7 @@ int hw_fillrect(struct lynx_accel *accel, { u32 deCtrl; - if(accel->de_wait() != 0) + if (accel->de_wait() != 0) { /* int time wait and always busy,seems hardware * got something error */ @@ -247,7 +247,7 @@ unsigned int rop2) /* ROP value */ Note that input pitch is BYTE value, but the 2D Pitch register uses pixel values. Need Byte to pixel conversion. */ - if(Bpp == 3){ + if (Bpp == 3) { sx *= 3; dx *= 3; width *= 3; @@ -270,16 +270,16 @@ unsigned int rop2) /* ROP value */ FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp))); /* dpr3c */ - if (accel->de_wait() != 0){ + if (accel->de_wait() != 0) { return -1; } write_dpr(accel, DE_SOURCE, - FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) | FIELD_VALUE(0, DE_SOURCE, X_K1, sx) | FIELD_VALUE(0, DE_SOURCE, Y_K2, sy)); /* dpr0 */ write_dpr(accel, DE_DESTINATION, - FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) | FIELD_VALUE(0, DE_DESTINATION, X, dx) | FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ write_dpr(accel, DE_DIMENSION, @@ -338,7 +338,7 @@ int hw_imageblit(struct lynx_accel *accel, ul4BytesPerScan = ulBytesPerScan & ~3; ulBytesRemain = ulBytesPerScan & 3; - if(accel->de_wait() != 0) + if (accel->de_wait() != 0) { return -1; } @@ -357,7 +357,7 @@ int hw_imageblit(struct lynx_accel *accel, Note that input pitch is BYTE value, but the 2D Pitch register uses pixel values. Need Byte to pixel conversion. */ - if(bytePerPixel == 3 ){ + if (bytePerPixel == 3) { dx *= 3; width *= 3; startBit *= 3; @@ -384,11 +384,11 @@ int hw_imageblit(struct lynx_accel *accel, /* Note: For 2D Source in Host Write, only X_K1_MONO field is needed, and Y_K2 field is not used. For mono bitmap, use startBit for X_K1. */ write_dpr(accel, DE_SOURCE, - FIELD_SET (0, DE_SOURCE, WRAP, DISABLE) | + FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) | FIELD_VALUE(0, DE_SOURCE, X_K1_MONO, startBit)); /* dpr00 */ write_dpr(accel, DE_DESTINATION, - FIELD_SET (0, DE_DESTINATION, WRAP, DISABLE) | + FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) | FIELD_VALUE(0, DE_DESTINATION, X, dx) | FIELD_VALUE(0, DE_DESTINATION, Y, dy)); /* dpr04 */ @@ -408,10 +408,10 @@ int hw_imageblit(struct lynx_accel *accel, write_dpr(accel, DE_CONTROL, de_ctrl | deGetTransparency(accel)); /* Write MONO data (line by line) to 2D Engine data port */ - for (i=0; i<height; i++) + for (i = 0; i < height; i++) { /* For each line, send the data in chunks of 4 bytes */ - for (j=0; j<(ul4BytesPerScan/4); j++) + for (j = 0; j < (ul4BytesPerScan/4); j++) { write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4))); } diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index 405e24b..4ed7ca2 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -122,7 +122,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, odd=0; */ - for(i=0;i<count;i++) + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; @@ -132,26 +132,26 @@ void hw_cursor_setData(struct lynx_cursor *cursor, * but method 2 shows no lag * and method 1 seems a bit wrong*/ #if 0 - if(rop == ROP_XOR) + if (rop == ROP_XOR) opr = mask ^ color; else opr = mask & color; - for(j=0;j<8;j++) + for (j = 0; j < 8; j++) { - if(opr & (0x80 >> j)) + if (opr & (0x80 >> j)) { /* use fg color,id = 2 */ data |= 2 << (j*2); - }else{ + } else { /* use bg color,id = 1 */ data |= 1 << (j*2); } } #else - for(j=0;j<8;j++){ - if(mask & (0x80>>j)){ - if(rop == ROP_XOR) + for (j = 0; j < 8; j++) { + if (mask & (0x80>>j)) { + if (rop == ROP_XOR) opr = mask ^ color; else opr = mask & color; @@ -165,15 +165,15 @@ void hw_cursor_setData(struct lynx_cursor *cursor, /* assume pitch is 1,2,4,8,...*/ #if 0 - if(!((i+1)&(pitch-1))) /* below line equal to is line */ + if (!((i+1)&(pitch-1))) /* below line equal to is line */ #else - if((i+1) % pitch == 0) + if ((i+1) % pitch == 0) #endif { /* need a return */ pstart += offset; pbuffer = pstart; - }else{ + } else { pbuffer += sizeof(u16); } @@ -204,7 +204,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, pstart = cursor->vstart; pbuffer = pstart; - for(i=0;i<count;i++) + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; @@ -212,37 +212,37 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, /* either method below works well, but method 2 shows no lag */ #if 0 - if(rop == ROP_XOR) + if (rop == ROP_XOR) opr = mask ^ color; else opr = mask & color; - for(j=0;j<8;j++) + for (j = 0; j < 8; j++) { - if(opr & (0x80 >> j)) + if (opr & (0x80 >> j)) { /* use fg color,id = 2 */ data |= 2 << (j*2); - }else{ + } else { /* use bg color,id = 1 */ data |= 1 << (j*2); } } #else - for(j=0;j<8;j++){ - if(mask & (1<<j)) + for (j = 0; j < 8; j++) { + if (mask & (1<<j)) data |= ((color & (1<<j))?1:2)<<(j*2); } #endif iowrite16(data, pbuffer); /* assume pitch is 1,2,4,8,...*/ - if(!(i&(pitch-1))) + if (!(i&(pitch-1))) { /* need a return */ pstart += offset; pbuffer = pstart; - }else{ + } else { pbuffer += sizeof(u16); } diff --git a/drivers/staging/sm750fb/sm750_help.h b/drivers/staging/sm750fb/sm750_help.h index 8ba4f8d..e7d74e6 100644 --- a/drivers/staging/sm750fb/sm750_help.h +++ b/drivers/staging/sm750fb/sm750_help.h @@ -43,7 +43,7 @@ #define FIELD_CLEAR(reg, field) \ ( \ - ~ _F_MASK(reg ## _ ## field) \ + ~_F_MASK(reg ## _ ## field) \ ) /* Field Macros */ @@ -73,7 +73,7 @@ static inline unsigned int absDiff(unsigned int a, unsigned int b) { - if(a<b) + if (a < b) return b-a; else return a-b; diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index 28db9c7..af7ea2e 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -28,7 +28,6 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) { int ret; struct sm750_share *spec_share; - spec_share = container_of(share, struct sm750_share, share); ret = 0; @@ -44,7 +43,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) * successfully * */ - if((ret = pci_request_region(pdev, 1, "sm750fb"))) + if ((ret = pci_request_region(pdev, 1, "sm750fb"))) { pr_err("Can not request PCI regions.\n"); goto exit; @@ -52,15 +51,15 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) /* now map mmio and vidmem*/ share->pvReg = ioremap_nocache(share->vidreg_start, share->vidreg_size); - if(!share->pvReg){ + if (!share->pvReg) { pr_err("mmio failed\n"); ret = -EFAULT; goto exit; - }else{ + } else { pr_info("mmio virtual addr = %p\n", share->pvReg); } - + share->accel.dprBase = share->pvReg + DE_BASE_ADDR_TYPE1; share->accel.dpPortBase = share->pvReg + DE_PORT_ADDR_TYPE1; @@ -78,7 +77,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) /* reserve the vidmem space of smi adaptor */ #if 0 - if((ret = pci_request_region(pdev, 0, _moduleName_))) + if ((ret = pci_request_region(pdev, 0, _moduleName_))) { pr_err("Can not request PCI regions.\n"); goto exit; @@ -87,11 +86,11 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) share->pvMem = ioremap_wc(share->vidmem_start, share->vidmem_size); - if(!share->pvMem){ + if (!share->pvMem) { pr_err("Map video memory failed\n"); ret = -EFAULT; goto exit; - }else{ + } else { pr_info("video memory vaddr = %p\n", share->pvMem); } exit: @@ -104,22 +103,22 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) { struct sm750_share *spec_share; struct init_status *parm; - + spec_share = container_of(share, struct sm750_share, share); parm = &spec_share->state.initParm; - if(parm->chip_clk == 0) - parm->chip_clk = (getChipType() == SM750LE)? + if (parm->chip_clk == 0) + parm->chip_clk = (getChipType() == SM750LE) ? DEFAULT_SM750LE_CHIP_CLOCK : DEFAULT_SM750_CHIP_CLOCK; - if(parm->mem_clk == 0) + if (parm->mem_clk == 0) parm->mem_clk = parm->chip_clk; - if(parm->master_clk == 0) + if (parm->master_clk == 0) parm->master_clk = parm->chip_clk/3; ddk750_initHw((initchip_param_t *)&spec_share->state.initParm); /* for sm718,open pci burst */ - if(share->devid == 0x718){ + if (share->devid == 0x718) { POKE32(SYSTEM_CTRL, FIELD_SET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PCI_BURST, ON)); } @@ -130,10 +129,10 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) ddk750_initDVIDisp(); #endif - if(getChipType() != SM750LE) + if (getChipType() != SM750LE) { /* does user need CRT ?*/ - if(spec_share->state.nocrt){ + if (spec_share->state.nocrt) { POKE32(MISC_CTRL, FIELD_SET(PEEK32(MISC_CTRL), MISC_CTRL, @@ -143,7 +142,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) FIELD_SET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, DPMS, VNHN)); - }else{ + } else { POKE32(MISC_CTRL, FIELD_SET(PEEK32(MISC_CTRL), MISC_CTRL, @@ -155,7 +154,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) DPMS, VPHP)); } - switch (spec_share->state.pnltype){ + switch (spec_share->state.pnltype) { case sm750_doubleTFT: case sm750_24TFT: case sm750_dualTFT: @@ -166,7 +165,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) spec_share->state.pnltype)); break; } - }else{ + } else { /* for 750LE ,no DVI chip initilization makes Monitor no signal */ /* Set up GPIO for software I2C to program DVI chip in the Xilinx SP605 board, in order to have video signal. @@ -191,7 +190,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) } /* init 2d engine */ - if(!share->accel_off){ + if (!share->accel_off) { hw_sm750_initAccel(share); } @@ -202,7 +201,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) resource_size_t hw_sm750_getVMSize(struct lynx_share *share) { resource_size_t ret; - + ret = ddk750_getVMSize(); return ret; } @@ -211,7 +210,6 @@ resource_size_t hw_sm750_getVMSize(struct lynx_share *share) int hw_sm750_output_checkMode(struct lynxfb_output* output, struct fb_var_screeninfo* var) { - return 0; } @@ -222,30 +220,30 @@ int hw_sm750_output_setMode(struct lynxfb_output* output, int ret; disp_output_t dispSet; int channel; - + ret = 0; dispSet = 0; channel = *output->channel; - if(getChipType() != SM750LE){ - if(channel == sm750_primary){ + if (getChipType() != SM750LE) { + if (channel == sm750_primary) { pr_info("primary channel\n"); - if(output->paths & sm750_panel) + if (output->paths & sm750_panel) dispSet |= do_LCD1_PRI; - if(output->paths & sm750_crt) + if (output->paths & sm750_crt) dispSet |= do_CRT_PRI; - }else{ + } else { pr_info("secondary channel\n"); - if(output->paths & sm750_panel) + if (output->paths & sm750_panel) dispSet |= do_LCD1_SEC; - if(output->paths & sm750_crt) + if (output->paths & sm750_crt) dispSet |= do_CRT_SEC; } ddk750_setLogicalDispOut(dispSet); - }else{ + } else { /* just open DISPLAY_CONTROL_750LE register bit 3:0*/ u32 reg; reg = PEEK32(DISPLAY_CONTROL_750LE); @@ -253,24 +251,22 @@ int hw_sm750_output_setMode(struct lynxfb_output* output, POKE32(DISPLAY_CONTROL_750LE, reg); } - pr_info("ddk setlogicdispout done \n"); + pr_info("ddk setlogicdispout done\n"); return ret; } void hw_sm750_output_clear(struct lynxfb_output* output) { - return; } int hw_sm750_crtc_checkMode(struct lynxfb_crtc* crtc, struct fb_var_screeninfo* var) { struct lynx_share *share; - share = container_of(crtc, struct lynxfb_par, crtc)->share; - switch (var->bits_per_pixel){ + switch (var->bits_per_pixel) { case 8: case 16: break; @@ -303,14 +299,13 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, struct lynx_share *share; struct lynxfb_par *par; - ret = 0; par = container_of(crtc, struct lynxfb_par, crtc); share = par->share; #if 1 - if(!share->accel_off){ + if (!share->accel_off) { /* set 2d engine pixel format according to mode bpp */ - switch(var->bits_per_pixel){ + switch (var->bits_per_pixel) { case 8: fmt = 0; break; @@ -330,7 +325,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, modparm.pixel_clock = ps_to_hz(var->pixclock); modparm.vertical_sync_polarity = (var->sync & FB_SYNC_HOR_HIGH_ACT) ? POS:NEG; modparm.horizontal_sync_polarity = (var->sync & FB_SYNC_VERT_HIGH_ACT) ? POS:NEG; - modparm.clock_phase_polarity = (var->sync& FB_SYNC_COMP_HIGH_ACT) ? POS:NEG; + modparm.clock_phase_polarity = (var->sync & FB_SYNC_COMP_HIGH_ACT) ? POS:NEG; modparm.horizontal_display_end = var->xres; modparm.horizontal_sync_width = var->hsync_len; modparm.horizontal_sync_start = var->xres + var->right_margin; @@ -341,19 +336,19 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, modparm.vertical_total = var->yres + var->upper_margin + var->lower_margin + var->vsync_len; /* choose pll */ - if(crtc->channel != sm750_secondary) + if (crtc->channel != sm750_secondary) clock = PRIMARY_PLL; else clock = SECONDARY_PLL; pr_debug("Request pixel clock = %lu\n", modparm.pixel_clock); ret = ddk750_setModeTiming(&modparm, clock); - if(ret){ + if (ret) { pr_err("Set mode timing failed\n"); goto exit; } - if(crtc->channel != sm750_secondary){ + if (crtc->channel != sm750_secondary) { /* set pitch, offset ,width,start address ,etc... */ POKE32(PANEL_FB_ADDRESS, FIELD_SET(0, PANEL_FB_ADDRESS, STATUS, CURRENT)| @@ -369,7 +364,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, FIELD_VALUE(0, PANEL_FB_WIDTH, OFFSET, fix->line_length)); POKE32(PANEL_WINDOW_WIDTH, - FIELD_VALUE(0, PANEL_WINDOW_WIDTH, WIDTH, var->xres -1)| + FIELD_VALUE(0, PANEL_WINDOW_WIDTH, WIDTH, var->xres - 1)| FIELD_VALUE(0, PANEL_WINDOW_WIDTH, X, var->xoffset)); POKE32(PANEL_WINDOW_HEIGHT, @@ -389,7 +384,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc* crtc, PANEL_DISPLAY_CTRL, FORMAT, (var->bits_per_pixel >> 4) )); - }else{ + } else { /* not implemented now */ POKE32(CRT_FB_ADDRESS, crtc->oScreen); reg = var->xres * (var->bits_per_pixel >> 3); @@ -414,22 +409,21 @@ exit: void hw_sm750_crtc_clear(struct lynxfb_crtc* crtc) { - return; } int hw_sm750_setColReg(struct lynxfb_crtc* crtc, ushort index, ushort red, ushort green, ushort blue) { - static unsigned int add[]={PANEL_PALETTE_RAM, CRT_PALETTE_RAM}; + static unsigned int add[] = {PANEL_PALETTE_RAM, CRT_PALETTE_RAM}; POKE32(add[crtc->channel] + index*4, (red<<16)|(green<<8)|blue); return 0; } -int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank){ +int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank) { int dpms, crtdb; - - switch(blank) + + switch (blank) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) case FB_BLANK_UNBLANK: @@ -473,7 +467,7 @@ int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank){ return -EINVAL; } - if(output->paths & sm750_crt){ + if (output->paths & sm750_crt) { POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, DPMS, dpms)); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, BLANK, crtdb)); } @@ -483,7 +477,7 @@ int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank){ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) { unsigned int dpms, pps, crtdb; - + dpms = pps = crtdb = 0; switch (blank) @@ -493,14 +487,14 @@ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) #else case VESA_NO_BLANKING: #endif - pr_info("flag = FB_BLANK_UNBLANK \n"); + pr_info("flag = FB_BLANK_UNBLANK\n"); dpms = SYSTEM_CTRL_DPMS_VPHP; pps = PANEL_DISPLAY_CTRL_DATA_ENABLE; crtdb = CRT_DISPLAY_CTRL_BLANK_OFF; break; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) case FB_BLANK_NORMAL: - pr_info("flag = FB_BLANK_NORMAL \n"); + pr_info("flag = FB_BLANK_NORMAL\n"); dpms = SYSTEM_CTRL_DPMS_VPHP; pps = PANEL_DISPLAY_CTRL_DATA_DISABLE; crtdb = CRT_DISPLAY_CTRL_BLANK_ON; @@ -535,13 +529,13 @@ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) break; } - if(output->paths & sm750_crt){ + if (output->paths & sm750_crt) { POKE32(SYSTEM_CTRL, FIELD_VALUE(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, DPMS, dpms)); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, BLANK, crtdb)); } - if(output->paths & sm750_panel){ + if (output->paths & sm750_panel) { POKE32(PANEL_DISPLAY_CTRL, FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, DATA, pps)); } @@ -554,7 +548,7 @@ void hw_sm750_initAccel(struct lynx_share *share) u32 reg; enable2DEngine(1); - if(getChipType() == SM750LE){ + if (getChipType() == SM750LE) { reg = PEEK32(DE_STATE1); reg = FIELD_SET(reg, DE_STATE1, DE_ABORT, ON); POKE32(DE_STATE1, reg); @@ -563,7 +557,7 @@ void hw_sm750_initAccel(struct lynx_share *share) reg = FIELD_SET(reg, DE_STATE1, DE_ABORT, OFF); POKE32(DE_STATE1, reg); - }else{ + } else { /* engine reset */ reg = PEEK32(SYSTEM_CTRL); reg = FIELD_SET(reg, SYSTEM_CTRL, DE_ABORT, ON); @@ -580,10 +574,10 @@ void hw_sm750_initAccel(struct lynx_share *share) int hw_sm750le_deWait(void) { - int i=0x10000000; - while(i--){ + int i = 0x10000000; + while (i--) { unsigned int dwVal = PEEK32(DE_STATE2); - if((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) == DE_STATE2_DE_STATUS_IDLE) && + if ((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) == DE_STATE2_DE_STATUS_IDLE) && (FIELD_GET(dwVal, DE_STATE2, DE_FIFO) == DE_STATE2_DE_FIFO_EMPTY) && (FIELD_GET(dwVal, DE_STATE2, DE_MEM_FIFO) == DE_STATE2_DE_MEM_FIFO_EMPTY)) { @@ -597,10 +591,10 @@ int hw_sm750le_deWait(void) int hw_sm750_deWait(void) { - int i=0x10000000; - while(i--){ + int i = 0x10000000; + while (i--) { unsigned int dwVal = PEEK32(SYSTEM_CTRL); - if((FIELD_GET(dwVal, SYSTEM_CTRL, DE_STATUS) == SYSTEM_CTRL_DE_STATUS_IDLE) && + if ((FIELD_GET(dwVal, SYSTEM_CTRL, DE_STATUS) == SYSTEM_CTRL_DE_STATUS_IDLE) && (FIELD_GET(dwVal, SYSTEM_CTRL, DE_FIFO) == SYSTEM_CTRL_DE_FIFO_EMPTY) && (FIELD_GET(dwVal, SYSTEM_CTRL, DE_MEM_FIFO) == SYSTEM_CTRL_DE_MEM_FIFO_EMPTY)) { diff --git a/drivers/staging/sm750fb/sm750_hw.h b/drivers/staging/sm750fb/sm750_hw.h index adc61edf..ef0a16f 100644 --- a/drivers/staging/sm750fb/sm750_hw.h +++ b/drivers/staging/sm750fb/sm750_hw.h @@ -9,7 +9,7 @@ #endif -enum sm750_pnltype{ +enum sm750_pnltype { sm750_24TFT = 0,/* 24bit tft */ @@ -19,7 +19,7 @@ enum sm750_pnltype{ }; /* vga channel is not concerned */ -enum sm750_dataflow{ +enum sm750_dataflow { sm750_simul_pri,/* primary => all head */ sm750_simul_sec,/* secondary => all head */ @@ -30,19 +30,19 @@ enum sm750_dataflow{ }; -enum sm750_channel{ +enum sm750_channel { sm750_primary = 0, /* enum value equal to the register filed data */ sm750_secondary = 1, }; -enum sm750_path{ +enum sm750_path { sm750_panel = 1, sm750_crt = 2, sm750_pnc = 3,/* panel and crt */ }; -struct init_status{ +struct init_status { ushort powerMode; /* below three clocks are in unit of MHZ*/ ushort chip_clk; @@ -52,7 +52,7 @@ struct init_status{ ushort resetMemory; }; -struct sm750_state{ +struct sm750_state { struct init_status initParm; enum sm750_pnltype pnltype; enum sm750_dataflow dataflow; @@ -66,7 +66,7 @@ struct sm750_state{ in C++ */ -struct sm750_share{ +struct sm750_share { /* it's better to put lynx_share struct to the first place of sm750_share */ struct lynx_share share; struct sm750_state state; -- 2.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 2/4] staging: sm750fb: fix spacing issues 2015-06-20 8:48 ` Juston Li @ 2015-06-20 10:59 ` Sudip Mukherjee -1 siblings, 0 replies; 16+ messages in thread From: Sudip Mukherjee @ 2015-06-20 10:47 UTC (permalink / raw) To: Juston Li; +Cc: teddy.wang, gregkh, linux-fbdev, devel, linux-kernel On Sat, Jun 20, 2015 at 01:48:33AM -0700, Juston Li wrote: > Fix spacing errors and warnings caught by checkpatch.pl > ERROR: space prohibited after that open parenthesis '(' > ERROR: space required before the open brace '{' > ERROR: need consistent spacing around > ERROR: trailing whitespace > WARNING: unnecessary whitespace before a quoted newline these are again too many changes in a single patch. please break them up so that each patch does a single type of change. regards sudip -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/4] staging: sm750fb: fix spacing issues @ 2015-06-20 10:59 ` Sudip Mukherjee 0 siblings, 0 replies; 16+ messages in thread From: Sudip Mukherjee @ 2015-06-20 10:59 UTC (permalink / raw) To: Juston Li; +Cc: teddy.wang, gregkh, linux-fbdev, devel, linux-kernel On Sat, Jun 20, 2015 at 01:48:33AM -0700, Juston Li wrote: > Fix spacing errors and warnings caught by checkpatch.pl > ERROR: space prohibited after that open parenthesis '(' > ERROR: space required before the open brace '{' > ERROR: need consistent spacing around > ERROR: trailing whitespace > WARNING: unnecessary whitespace before a quoted newline these are again too many changes in a single patch. please break them up so that each patch does a single type of change. regards sudip -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 3/4] staging: sm750fb: fix brace placement 2015-06-20 8:45 ` Juston Li @ 2015-06-20 8:48 ` Juston Li -1 siblings, 0 replies; 16+ messages in thread From: Juston Li @ 2015-06-20 8:48 UTC (permalink / raw) To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, devel, linux-kernel Cc: Juston Li Fix brace placement errors and warnings caught by checkpatch.pl ERROR: that open brace { should be on the previous line WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Juston Li <juston.h.li@gmail.com> --- drivers/staging/sm750fb/ddk750_chip.h | 12 ++---- drivers/staging/sm750fb/ddk750_display.c | 66 ++++++++++---------------------- drivers/staging/sm750fb/ddk750_display.h | 3 +- drivers/staging/sm750fb/ddk750_dvi.c | 6 +-- drivers/staging/sm750fb/ddk750_dvi.h | 3 +- drivers/staging/sm750fb/ddk750_hwi2c.c | 6 +-- drivers/staging/sm750fb/ddk750_mode.c | 13 ++----- drivers/staging/sm750fb/ddk750_mode.h | 6 +-- drivers/staging/sm750fb/ddk750_power.c | 27 ++++--------- drivers/staging/sm750fb/ddk750_power.h | 3 +- drivers/staging/sm750fb/ddk750_sii164.c | 16 +++----- drivers/staging/sm750fb/ddk750_sii164.h | 3 +- drivers/staging/sm750fb/sm750_accel.c | 46 +++++++--------------- drivers/staging/sm750fb/sm750_cursor.c | 23 +++++------ drivers/staging/sm750fb/sm750_hw.c | 33 ++++++---------- 15 files changed, 86 insertions(+), 180 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_chip.h b/drivers/staging/sm750fb/ddk750_chip.h index 4e030e8..6ff0436 100644 --- a/drivers/staging/sm750fb/ddk750_chip.h +++ b/drivers/staging/sm750fb/ddk750_chip.h @@ -8,8 +8,7 @@ #include <linux/io.h> /* This is all the chips recognized by this library */ -typedef enum _logical_chip_type_t -{ +typedef enum _logical_chip_type_t { SM_UNKNOWN, SM718, SM750, @@ -18,8 +17,7 @@ typedef enum _logical_chip_type_t logical_chip_type_t; -typedef enum _clock_type_t -{ +typedef enum _clock_type_t { MXCLK_PLL, PRIMARY_PLL, SECONDARY_PLL, @@ -28,8 +26,7 @@ typedef enum _clock_type_t } clock_type_t; -typedef struct _pll_value_t -{ +typedef struct _pll_value_t { clock_type_t clockType; unsigned long inputFreq; /* Input clock frequency to the PLL */ @@ -42,8 +39,7 @@ typedef struct _pll_value_t pll_value_t; /* input struct to initChipParam() function */ -typedef struct _initchip_param_t -{ +typedef struct _initchip_param_t { unsigned short powerMode; /* Use power mode 0 or 1 */ unsigned short chipClock; /** * Speed of main chip clock in MHz unit diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index 4a3cb86..90c5c9e 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -15,12 +15,10 @@ static void setDisplayControl(int ctrl, int dispState) cnt = 0; /* Set the primary display control */ - if (!ctrl) - { + if (!ctrl) { ulDisplayCtrlReg = PEEK32(PANEL_DISPLAY_CTRL); /* Turn on/off the Panel display control */ - if (dispState) - { + if (dispState) { /* Timing should be enabled first before enabling the plane * because changing at the same time does not guarantee that * the plane will also enabled or disabled. @@ -45,16 +43,13 @@ static void setDisplayControl(int ctrl, int dispState) * until a few delay. Need to write * and read it a couple times */ - do - { + do { cnt++; POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); } while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) ! (ulDisplayCtrlReg & ~ulReservedBits)); printk("Set Panel Plane enbit:after tried %d times\n", cnt); - } - else - { + } else { /* When turning off, there is no rule on the programming * sequence since whenever the clock is off, then it does not * matter whether the plane is enabled or disabled. @@ -71,14 +66,11 @@ static void setDisplayControl(int ctrl, int dispState) POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); } - } /* Set the secondary display control */ - else - { + } else { ulDisplayCtrlReg = PEEK32(CRT_DISPLAY_CTRL); - if (dispState) - { + if (dispState) { /* Timing should be enabled first before enabling the plane because changing at the same time does not guarantee that the plane will also enabled or disabled. */ @@ -100,16 +92,13 @@ static void setDisplayControl(int ctrl, int dispState) FIELD_SET(0, CRT_DISPLAY_CTRL, RESERVED_3_MASK, ENABLE) | FIELD_SET(0, CRT_DISPLAY_CTRL, RESERVED_4_MASK, ENABLE); - do - { + do { cnt++; POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg); } while ((PEEK32(CRT_DISPLAY_CTRL) & ~ulReservedBits) ! (ulDisplayCtrlReg & ~ulReservedBits)); printk("Set Crt Plane enbit:after tried %d times\n", cnt); - } - else - { + } else { /* When turning off, there is no rule on the programming * sequence since whenever the clock is off, then it does not * matter whether the plane is enabled or disabled. @@ -140,30 +129,24 @@ static void waitNextVerticalSync(int ctrl, int delay) if ((FIELD_GET(PEEK32(PANEL_PLL_CTRL), PANEL_PLL_CTRL, POWER) = PANEL_PLL_CTRL_POWER_OFF) || (FIELD_GET(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, TIMING) = - PANEL_DISPLAY_CTRL_TIMING_DISABLE)) - { + PANEL_DISPLAY_CTRL_TIMING_DISABLE)) { return; } - while (delay-- > 0) - { + while (delay-- > 0) { /* Wait for end of vsync. */ - do - { + do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PANEL_VSYNC); - } - while (status = SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); + } while (status = SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); /* Wait for start of vsync. */ - do - { + do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PANEL_VSYNC); - } - while (status = SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); + } while (status = SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); } } else { @@ -173,30 +156,24 @@ static void waitNextVerticalSync(int ctrl, int delay) if ((FIELD_GET(PEEK32(CRT_PLL_CTRL), CRT_PLL_CTRL, POWER) = CRT_PLL_CTRL_POWER_OFF) || (FIELD_GET(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, TIMING) = - CRT_DISPLAY_CTRL_TIMING_DISABLE)) - { + CRT_DISPLAY_CTRL_TIMING_DISABLE)) { return; } - while (delay-- > 0) - { + while (delay-- > 0) { /* Wait for end of vsync. */ - do - { + do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, CRT_VSYNC); - } - while (status = SYSTEM_CTRL_CRT_VSYNC_ACTIVE); + } while (status = SYSTEM_CTRL_CRT_VSYNC_ACTIVE); /* Wait for start of vsync. */ - do - { + do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, CRT_VSYNC); - } - while (status = SYSTEM_CTRL_CRT_VSYNC_INACTIVE); + } while (status = SYSTEM_CTRL_CRT_VSYNC_INACTIVE); } } } @@ -293,8 +270,7 @@ int ddk750_initDVIDisp(void) 1, /* Enable continuous Sync */ 1, /* Enable PLL Filter */ 4 /* Use the recommended value for PLL Filter value */ - ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) - { + ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) { return (-1); } diff --git a/drivers/staging/sm750fb/ddk750_display.h b/drivers/staging/sm750fb/ddk750_display.h index afdf201..abccf84 100644 --- a/drivers/staging/sm750fb/ddk750_display.h +++ b/drivers/staging/sm750fb/ddk750_display.h @@ -86,8 +86,7 @@ CRT means crt path DSUB */ #if 0 -typedef enum _disp_output_t -{ +typedef enum _disp_output_t { NO_DISPLAY = DPMS_OFF, LCD1_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON|DPMS_OFF|DAC_ON, diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index c42db85..a18bb4c 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -9,8 +9,7 @@ /* This global variable contains all the supported driver and its corresponding function API. Please set the function pointer to NULL whenever the function is not supported. */ -static dvi_ctrl_device_t g_dcftSupportedDviController[] -{ +static dvi_ctrl_device_t g_dcftSupportedDviController[] = { #ifdef DVI_CTRL_SII164 { .pfnInit = sii164InitChip, @@ -45,8 +44,7 @@ int dviInit( { dvi_ctrl_device_t *pCurrentDviCtrl; pCurrentDviCtrl = g_dcftSupportedDviController; - if (pCurrentDviCtrl->pfnInit != NULL) - { + if (pCurrentDviCtrl->pfnInit != NULL) { return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, pllFilterEnable, pllFilterValue); diff --git a/drivers/staging/sm750fb/ddk750_dvi.h b/drivers/staging/sm750fb/ddk750_dvi.h index 83bbd6d..e1d4c9a 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.h +++ b/drivers/staging/sm750fb/ddk750_dvi.h @@ -26,8 +26,7 @@ typedef unsigned char (*PFN_DVICTRL_CHECKINTERRUPT)(void); typedef void (*PFN_DVICTRL_CLEARINTERRUPT)(void); /* Structure to hold all the function pointer to the DVI Controller. */ -typedef struct _dvi_ctrl_device_t -{ +typedef struct _dvi_ctrl_device_t { PFN_DVICTRL_INIT pfnInit; PFN_DVICTRL_RESETCHIP pfnResetChip; PFN_DVICTRL_GETCHIPSTRING pfnGetChipString; diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c index 7f3b1f9..5ddac43 100644 --- a/drivers/staging/sm750fb/ddk750_hwi2c.c +++ b/drivers/staging/sm750fb/ddk750_hwi2c.c @@ -106,8 +106,7 @@ static unsigned int hwI2CWriteData( * Note: * Only 16 byte can be accessed per i2c start instruction. */ - do - { + do { /* Reset I2C by writing 0 to I2C_RESET register to clear the previous status. */ POKE32(I2C_RESET, 0); @@ -173,8 +172,7 @@ static unsigned int hwI2CReadData( * Note: * Only 16 byte can be accessed per i2c start instruction. */ - do - { + do { /* Reset I2C by writing 0 to I2C_RESET register to clear all the status. */ POKE32(I2C_RESET, 0); diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index d451e7a..9d10446 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -80,8 +80,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) int ret = 0; int cnt = 0; unsigned int ulTmpValue, ulReg; - if (pll->clockType = SECONDARY_PLL) - { + if (pll->clockType = SECONDARY_PLL) { /* programe secondary pixel clock */ POKE32(CRT_PLL_CTRL, formatPllReg(pll)); POKE32(CRT_HORIZONTAL_TOTAL, @@ -119,9 +118,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) POKE32(CRT_DISPLAY_CTRL, ulTmpValue|ulReg); } - } - else if (pll->clockType = PRIMARY_PLL) - { + } else if (pll->clockType = PRIMARY_PLL) { unsigned int ulReservedBits; POKE32(PANEL_PLL_CTRL, formatPllReg(pll)); @@ -170,16 +167,14 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg); #if 1 - while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) - { + while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) { cnt++; if (cnt > 1000) break; POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg); } #endif - } - else{ + } else { ret = -1; } return ret; diff --git a/drivers/staging/sm750fb/ddk750_mode.h b/drivers/staging/sm750fb/ddk750_mode.h index 3548d67..e846dc2 100644 --- a/drivers/staging/sm750fb/ddk750_mode.h +++ b/drivers/staging/sm750fb/ddk750_mode.h @@ -3,16 +3,14 @@ #include "ddk750_chip.h" -typedef enum _spolarity_t -{ +typedef enum _spolarity_t { POS = 0, /* positive */ NEG, /* negative */ } spolarity_t; -typedef struct _mode_parameter_t -{ +typedef struct _mode_parameter_t { /* Horizontal timing. */ unsigned long horizontal_total; unsigned long horizontal_display_end; diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index 28d4402..c545c2d 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -36,8 +36,7 @@ void setPowerMode(unsigned int powerMode) if (getChipType() = SM750LE) return; - switch (powerMode) - { + switch (powerMode) { case POWER_MODE_CTRL_MODE_MODE0: control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE0); break; @@ -55,16 +54,13 @@ void setPowerMode(unsigned int powerMode) } /* Set up other fields in Power Control Register */ - if (powerMode = POWER_MODE_CTRL_MODE_SLEEP) - { + if (powerMode = POWER_MODE_CTRL_MODE_SLEEP) { control_value #ifdef VALIDATION_CHIP FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, OFF) | #endif FIELD_SET(control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); - } - else - { + } else { control_value #ifdef VALIDATION_CHIP FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, ON) | @@ -84,8 +80,7 @@ void setCurrentGate(unsigned int gate) /* Get current power mode. */ mode = getPowerMode(); - switch (mode) - { + switch (mode) { case POWER_MODE_CTRL_MODE_MODE0: gate_reg = MODE0_GATE; break; @@ -111,13 +106,10 @@ void enable2DEngine(unsigned int enable) uint32_t gate; gate = PEEK32(CURRENT_GATE); - if (enable) - { + if (enable) { gate = FIELD_SET(gate, CURRENT_GATE, DE, ON); gate = FIELD_SET(gate, CURRENT_GATE, CSC, ON); - } - else - { + } else { gate = FIELD_SET(gate, CURRENT_GATE, DE, OFF); gate = FIELD_SET(gate, CURRENT_GATE, CSC, OFF); } @@ -135,8 +127,7 @@ void enableZVPort(unsigned int enable) /* Enable ZV Port Gate */ gate = PEEK32(CURRENT_GATE); - if (enable) - { + if (enable) { gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, ON); #if 1 /* Using Software I2C */ @@ -145,9 +136,7 @@ void enableZVPort(unsigned int enable) /* Using Hardware I2C */ gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); #endif - } - else - { + } else { /* Disable ZV Port Gate. There is no way to know whether the GPIO pins are being used or not. Therefore, do not disable the GPIO gate. */ gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, OFF); diff --git a/drivers/staging/sm750fb/ddk750_power.h b/drivers/staging/sm750fb/ddk750_power.h index a20d438..b7cf6b2 100644 --- a/drivers/staging/sm750fb/ddk750_power.h +++ b/drivers/staging/sm750fb/ddk750_power.h @@ -1,8 +1,7 @@ #ifndef DDK750_POWER_H__ #define DDK750_POWER_H__ -typedef enum _DPMS_t -{ +typedef enum _DPMS_t { crtDPMS_ON = 0x0, crtDPMS_STANDBY = 0x1, crtDPMS_SUSPEND = 0x2, diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c index c09748c..3c55df1 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.c +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -136,8 +136,7 @@ long sii164InitChip( #endif /* Check if SII164 Chip exists */ - if ((sii164GetVendorID() = SII164_VENDOR_ID) && (sii164GetDeviceID() = SII164_DEVICE_ID)) - { + if ((sii164GetVendorID() = SII164_VENDOR_ID) && (sii164GetDeviceID() = SII164_DEVICE_ID)) { /* * Initialize SII164 controller chip. */ @@ -183,8 +182,7 @@ long sii164InitChip( else config = SII164_DESKEW_ENABLE; - switch (deskewSetting) - { + switch (deskewSetting) { case 0: config |= SII164_DESKEW_1_STEP; break; @@ -284,15 +282,12 @@ void sii164SetPower(unsigned char powerUp) unsigned char config; config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); - if (powerUp = 1) - { + if (powerUp = 1) { /* Power up the chip */ config &= ~SII164_CONFIGURATION_POWER_MASK; config |= SII164_CONFIGURATION_POWER_NORMAL; i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - } - else - { + } else { /* Power down the chip */ config &= ~SII164_CONFIGURATION_POWER_MASK; config |= SII164_CONFIGURATION_POWER_DOWN; @@ -310,8 +305,7 @@ static void sii164SelectHotPlugDetectionMode(sii164_hot_plug_mode_t hotPlugMode) unsigned char detectReg; detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; - switch (hotPlugMode) - { + switch (hotPlugMode) { case SII164_HOTPLUG_DISABLE: detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; break; diff --git a/drivers/staging/sm750fb/ddk750_sii164.h b/drivers/staging/sm750fb/ddk750_sii164.h index bb0ed25..18c1c3e 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.h +++ b/drivers/staging/sm750fb/ddk750_sii164.h @@ -4,8 +4,7 @@ #define USE_DVICHIP /* Hot Plug detection mode structure */ -typedef enum _sii164_hot_plug_mode_t -{ +typedef enum _sii164_hot_plug_mode_t { SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit (always high). */ SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Interrupt bit. */ SII164_HOTPLUG_USE_RSEN, /* Use Receiver Sense detect bit. */ diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 391fced..0b5758b 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -96,8 +96,7 @@ int hw_fillrect(struct lynx_accel *accel, { u32 deCtrl; - if (accel->de_wait() != 0) - { + if (accel->de_wait() != 0) { /* int time wait and always busy,seems hardware * got something error */ pr_debug("%s:De engine always bussy\n", __func__); @@ -159,11 +158,9 @@ unsigned int rop2) /* ROP value */ de_ctrl = 0; /* If source and destination are the same surface, need to check for overlay cases */ - if (sBase = dBase && sPitch = dPitch) - { + if (sBase = dBase && sPitch = dPitch) { /* Determine direction of operation */ - if (sy < dy) - { + if (sy < dy) { /* +----------+ |S | | +----------+ @@ -174,9 +171,7 @@ unsigned int rop2) /* ROP value */ +----------+ */ nDirection = BOTTOM_TO_TOP; - } - else if (sy > dy) - { + } else if (sy > dy) { /* +----------+ |D | | +----------+ @@ -187,12 +182,9 @@ unsigned int rop2) /* ROP value */ +----------+ */ nDirection = TOP_TO_BOTTOM; - } - else - { + } else { /* sy = dy */ - if (sx <= dx) - { + if (sx <= dx) { /* +------+---+------+ |S | | D| | | | | @@ -201,9 +193,7 @@ unsigned int rop2) /* ROP value */ +------+---+------+ */ nDirection = RIGHT_TO_LEFT; - } - else - { + } else { /* sx > dx */ /* +------+---+------+ @@ -218,8 +208,7 @@ unsigned int rop2) /* ROP value */ } } - if ((nDirection = BOTTOM_TO_TOP) || (nDirection = RIGHT_TO_LEFT)) - { + if ((nDirection = BOTTOM_TO_TOP) || (nDirection = RIGHT_TO_LEFT)) { sx += width - 1; sy += height - 1; dx += width - 1; @@ -254,8 +243,7 @@ unsigned int rop2) /* ROP value */ write_dpr(accel, DE_PITCH, FIELD_VALUE(0, DE_PITCH, DESTINATION, dPitch) | FIELD_VALUE(0, DE_PITCH, SOURCE, sPitch)); /* dpr10 */ - } - else + } else #endif { write_dpr(accel, DE_PITCH, @@ -270,9 +258,8 @@ unsigned int rop2) /* ROP value */ FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp))); /* dpr3c */ - if (accel->de_wait() != 0) { + if (accel->de_wait() != 0) return -1; - } write_dpr(accel, DE_SOURCE, FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) | @@ -339,9 +326,7 @@ int hw_imageblit(struct lynx_accel *accel, ulBytesRemain = ulBytesPerScan & 3; if (accel->de_wait() != 0) - { return -1; - } /* 2D Source Base. Use 0 for HOST Blt. @@ -365,8 +350,7 @@ int hw_imageblit(struct lynx_accel *accel, FIELD_VALUE(0, DE_PITCH, DESTINATION, dPitch) | FIELD_VALUE(0, DE_PITCH, SOURCE, dPitch)); /* dpr10 */ - } - else + } else #endif { write_dpr(accel, DE_PITCH, @@ -408,16 +392,12 @@ int hw_imageblit(struct lynx_accel *accel, write_dpr(accel, DE_CONTROL, de_ctrl | deGetTransparency(accel)); /* Write MONO data (line by line) to 2D Engine data port */ - for (i = 0; i < height; i++) - { + for (i = 0; i < height; i++) { /* For each line, send the data in chunks of 4 bytes */ for (j = 0; j < (ul4BytesPerScan/4); j++) - { write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4))); - } - if (ulBytesRemain) - { + if (ulBytesRemain) { memcpy(ajRemain, pSrcbuf+ul4BytesPerScan, ulBytesRemain); write_dpPort(accel, *(unsigned int *)ajRemain); } diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index 4ed7ca2..ab61fe6 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -122,8 +122,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, odd=0; */ - for (i = 0; i < count; i++) - { + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; data = 0; @@ -137,11 +136,10 @@ void hw_cursor_setData(struct lynx_cursor *cursor, else opr = mask & color; - for (j = 0; j < 8; j++) - { + for (j = 0; j < 8; j++) { - if (opr & (0x80 >> j)) - { /* use fg color,id = 2 */ + if (opr & (0x80 >> j)) { + /* use fg color,id = 2 */ data |= 2 << (j*2); } else { /* use bg color,id = 1 */ @@ -204,8 +202,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, pstart = cursor->vstart; pbuffer = pstart; - for (i = 0; i < count; i++) - { + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; data = 0; @@ -217,11 +214,10 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, else opr = mask & color; - for (j = 0; j < 8; j++) - { + for (j = 0; j < 8; j++) { - if (opr & (0x80 >> j)) - { /* use fg color,id = 2 */ + if (opr & (0x80 >> j)) { + /* use fg color,id = 2 */ data |= 2 << (j*2); } else { /* use bg color,id = 1 */ @@ -237,8 +233,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, iowrite16(data, pbuffer); /* assume pitch is 1,2,4,8,...*/ - if (!(i&(pitch-1))) - { + if (!(i&(pitch-1))) { /* need a return */ pstart += offset; pbuffer = pstart; diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index af7ea2e..a3362d8 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -43,8 +43,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) * successfully * */ - if ((ret = pci_request_region(pdev, 1, "sm750fb"))) - { + if ((ret = pci_request_region(pdev, 1, "sm750fb"))) { pr_err("Can not request PCI regions.\n"); goto exit; } @@ -77,8 +76,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) /* reserve the vidmem space of smi adaptor */ #if 0 - if ((ret = pci_request_region(pdev, 0, _moduleName_))) - { + if ((ret = pci_request_region(pdev, 0, _moduleName_))) { pr_err("Can not request PCI regions.\n"); goto exit; } @@ -129,8 +127,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) ddk750_initDVIDisp(); #endif - if (getChipType() != SM750LE) - { + if (getChipType() != SM750LE) { /* does user need CRT ?*/ if (spec_share->state.nocrt) { POKE32(MISC_CTRL, @@ -176,8 +173,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) /* Customer may NOT use CH7301 DVI chip, which has to be initialized differently. */ - if (swI2CReadReg(0xec, 0x4a) = 0x95) - { + if (swI2CReadReg(0xec, 0x4a) = 0x95) { /* The following register values for CH7301 are from Chrontel app note and our experiment. */ @@ -190,9 +186,8 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) } /* init 2d engine */ - if (!share->accel_off) { + if (!share->accel_off) hw_sm750_initAccel(share); - } return 0; } @@ -420,11 +415,11 @@ int hw_sm750_setColReg(struct lynxfb_crtc* crtc, ushort index, return 0; } -int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank) { +int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank) +{ int dpms, crtdb; - switch (blank) - { + switch (blank) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) case FB_BLANK_UNBLANK: #else @@ -480,8 +475,7 @@ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) dpms = pps = crtdb = 0; - switch (blank) - { + switch (blank) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) case FB_BLANK_UNBLANK: #else @@ -535,9 +529,8 @@ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, BLANK, crtdb)); } - if (output->paths & sm750_panel) { + if (output->paths & sm750_panel) POKE32(PANEL_DISPLAY_CTRL, FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, DATA, pps)); - } return 0; } @@ -579,8 +572,7 @@ int hw_sm750le_deWait(void) unsigned int dwVal = PEEK32(DE_STATE2); if ((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) = DE_STATE2_DE_STATUS_IDLE) && (FIELD_GET(dwVal, DE_STATE2, DE_FIFO) = DE_STATE2_DE_FIFO_EMPTY) && - (FIELD_GET(dwVal, DE_STATE2, DE_MEM_FIFO) = DE_STATE2_DE_MEM_FIFO_EMPTY)) - { + (FIELD_GET(dwVal, DE_STATE2, DE_MEM_FIFO) = DE_STATE2_DE_MEM_FIFO_EMPTY)) { return 0; } } @@ -596,8 +588,7 @@ int hw_sm750_deWait(void) unsigned int dwVal = PEEK32(SYSTEM_CTRL); if ((FIELD_GET(dwVal, SYSTEM_CTRL, DE_STATUS) = SYSTEM_CTRL_DE_STATUS_IDLE) && (FIELD_GET(dwVal, SYSTEM_CTRL, DE_FIFO) = SYSTEM_CTRL_DE_FIFO_EMPTY) && - (FIELD_GET(dwVal, SYSTEM_CTRL, DE_MEM_FIFO) = SYSTEM_CTRL_DE_MEM_FIFO_EMPTY)) - { + (FIELD_GET(dwVal, SYSTEM_CTRL, DE_MEM_FIFO) = SYSTEM_CTRL_DE_MEM_FIFO_EMPTY)) { return 0; } } -- 2.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/4] staging: sm750fb: fix brace placement @ 2015-06-20 8:48 ` Juston Li 0 siblings, 0 replies; 16+ messages in thread From: Juston Li @ 2015-06-20 8:48 UTC (permalink / raw) To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, devel, linux-kernel Cc: Juston Li Fix brace placement errors and warnings caught by checkpatch.pl ERROR: that open brace { should be on the previous line WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Juston Li <juston.h.li@gmail.com> --- drivers/staging/sm750fb/ddk750_chip.h | 12 ++---- drivers/staging/sm750fb/ddk750_display.c | 66 ++++++++++---------------------- drivers/staging/sm750fb/ddk750_display.h | 3 +- drivers/staging/sm750fb/ddk750_dvi.c | 6 +-- drivers/staging/sm750fb/ddk750_dvi.h | 3 +- drivers/staging/sm750fb/ddk750_hwi2c.c | 6 +-- drivers/staging/sm750fb/ddk750_mode.c | 13 ++----- drivers/staging/sm750fb/ddk750_mode.h | 6 +-- drivers/staging/sm750fb/ddk750_power.c | 27 ++++--------- drivers/staging/sm750fb/ddk750_power.h | 3 +- drivers/staging/sm750fb/ddk750_sii164.c | 16 +++----- drivers/staging/sm750fb/ddk750_sii164.h | 3 +- drivers/staging/sm750fb/sm750_accel.c | 46 +++++++--------------- drivers/staging/sm750fb/sm750_cursor.c | 23 +++++------ drivers/staging/sm750fb/sm750_hw.c | 33 ++++++---------- 15 files changed, 86 insertions(+), 180 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_chip.h b/drivers/staging/sm750fb/ddk750_chip.h index 4e030e8..6ff0436 100644 --- a/drivers/staging/sm750fb/ddk750_chip.h +++ b/drivers/staging/sm750fb/ddk750_chip.h @@ -8,8 +8,7 @@ #include <linux/io.h> /* This is all the chips recognized by this library */ -typedef enum _logical_chip_type_t -{ +typedef enum _logical_chip_type_t { SM_UNKNOWN, SM718, SM750, @@ -18,8 +17,7 @@ typedef enum _logical_chip_type_t logical_chip_type_t; -typedef enum _clock_type_t -{ +typedef enum _clock_type_t { MXCLK_PLL, PRIMARY_PLL, SECONDARY_PLL, @@ -28,8 +26,7 @@ typedef enum _clock_type_t } clock_type_t; -typedef struct _pll_value_t -{ +typedef struct _pll_value_t { clock_type_t clockType; unsigned long inputFreq; /* Input clock frequency to the PLL */ @@ -42,8 +39,7 @@ typedef struct _pll_value_t pll_value_t; /* input struct to initChipParam() function */ -typedef struct _initchip_param_t -{ +typedef struct _initchip_param_t { unsigned short powerMode; /* Use power mode 0 or 1 */ unsigned short chipClock; /** * Speed of main chip clock in MHz unit diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index 4a3cb86..90c5c9e 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -15,12 +15,10 @@ static void setDisplayControl(int ctrl, int dispState) cnt = 0; /* Set the primary display control */ - if (!ctrl) - { + if (!ctrl) { ulDisplayCtrlReg = PEEK32(PANEL_DISPLAY_CTRL); /* Turn on/off the Panel display control */ - if (dispState) - { + if (dispState) { /* Timing should be enabled first before enabling the plane * because changing at the same time does not guarantee that * the plane will also enabled or disabled. @@ -45,16 +43,13 @@ static void setDisplayControl(int ctrl, int dispState) * until a few delay. Need to write * and read it a couple times */ - do - { + do { cnt++; POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); } while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulDisplayCtrlReg & ~ulReservedBits)); printk("Set Panel Plane enbit:after tried %d times\n", cnt); - } - else - { + } else { /* When turning off, there is no rule on the programming * sequence since whenever the clock is off, then it does not * matter whether the plane is enabled or disabled. @@ -71,14 +66,11 @@ static void setDisplayControl(int ctrl, int dispState) POKE32(PANEL_DISPLAY_CTRL, ulDisplayCtrlReg); } - } /* Set the secondary display control */ - else - { + } else { ulDisplayCtrlReg = PEEK32(CRT_DISPLAY_CTRL); - if (dispState) - { + if (dispState) { /* Timing should be enabled first before enabling the plane because changing at the same time does not guarantee that the plane will also enabled or disabled. */ @@ -100,16 +92,13 @@ static void setDisplayControl(int ctrl, int dispState) FIELD_SET(0, CRT_DISPLAY_CTRL, RESERVED_3_MASK, ENABLE) | FIELD_SET(0, CRT_DISPLAY_CTRL, RESERVED_4_MASK, ENABLE); - do - { + do { cnt++; POKE32(CRT_DISPLAY_CTRL, ulDisplayCtrlReg); } while ((PEEK32(CRT_DISPLAY_CTRL) & ~ulReservedBits) != (ulDisplayCtrlReg & ~ulReservedBits)); printk("Set Crt Plane enbit:after tried %d times\n", cnt); - } - else - { + } else { /* When turning off, there is no rule on the programming * sequence since whenever the clock is off, then it does not * matter whether the plane is enabled or disabled. @@ -140,30 +129,24 @@ static void waitNextVerticalSync(int ctrl, int delay) if ((FIELD_GET(PEEK32(PANEL_PLL_CTRL), PANEL_PLL_CTRL, POWER) == PANEL_PLL_CTRL_POWER_OFF) || (FIELD_GET(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, TIMING) == - PANEL_DISPLAY_CTRL_TIMING_DISABLE)) - { + PANEL_DISPLAY_CTRL_TIMING_DISABLE)) { return; } - while (delay-- > 0) - { + while (delay-- > 0) { /* Wait for end of vsync. */ - do - { + do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PANEL_VSYNC); - } - while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); + } while (status == SYSTEM_CTRL_PANEL_VSYNC_ACTIVE); /* Wait for start of vsync. */ - do - { + do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, PANEL_VSYNC); - } - while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); + } while (status == SYSTEM_CTRL_PANEL_VSYNC_INACTIVE); } } else { @@ -173,30 +156,24 @@ static void waitNextVerticalSync(int ctrl, int delay) if ((FIELD_GET(PEEK32(CRT_PLL_CTRL), CRT_PLL_CTRL, POWER) == CRT_PLL_CTRL_POWER_OFF) || (FIELD_GET(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, TIMING) == - CRT_DISPLAY_CTRL_TIMING_DISABLE)) - { + CRT_DISPLAY_CTRL_TIMING_DISABLE)) { return; } - while (delay-- > 0) - { + while (delay-- > 0) { /* Wait for end of vsync. */ - do - { + do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, CRT_VSYNC); - } - while (status == SYSTEM_CTRL_CRT_VSYNC_ACTIVE); + } while (status == SYSTEM_CTRL_CRT_VSYNC_ACTIVE); /* Wait for start of vsync. */ - do - { + do { status = FIELD_GET(PEEK32(SYSTEM_CTRL), SYSTEM_CTRL, CRT_VSYNC); - } - while (status == SYSTEM_CTRL_CRT_VSYNC_INACTIVE); + } while (status == SYSTEM_CTRL_CRT_VSYNC_INACTIVE); } } } @@ -293,8 +270,7 @@ int ddk750_initDVIDisp(void) 1, /* Enable continuous Sync */ 1, /* Enable PLL Filter */ 4 /* Use the recommended value for PLL Filter value */ - ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) - { + ) != 0) && (dviGetVendorID() != 0x0000) && (dviGetDeviceID() != 0x0000)) { return (-1); } diff --git a/drivers/staging/sm750fb/ddk750_display.h b/drivers/staging/sm750fb/ddk750_display.h index afdf201..abccf84 100644 --- a/drivers/staging/sm750fb/ddk750_display.h +++ b/drivers/staging/sm750fb/ddk750_display.h @@ -86,8 +86,7 @@ CRT means crt path DSUB */ #if 0 -typedef enum _disp_output_t -{ +typedef enum _disp_output_t { NO_DISPLAY = DPMS_OFF, LCD1_PRI = PNL_2_PRI|PRI_TP_ON|PNL_SEQ_ON|DPMS_OFF|DAC_ON, diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index c42db85..a18bb4c 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -9,8 +9,7 @@ /* This global variable contains all the supported driver and its corresponding function API. Please set the function pointer to NULL whenever the function is not supported. */ -static dvi_ctrl_device_t g_dcftSupportedDviController[] = -{ +static dvi_ctrl_device_t g_dcftSupportedDviController[] = { #ifdef DVI_CTRL_SII164 { .pfnInit = sii164InitChip, @@ -45,8 +44,7 @@ int dviInit( { dvi_ctrl_device_t *pCurrentDviCtrl; pCurrentDviCtrl = g_dcftSupportedDviController; - if (pCurrentDviCtrl->pfnInit != NULL) - { + if (pCurrentDviCtrl->pfnInit != NULL) { return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable, pllFilterEnable, pllFilterValue); diff --git a/drivers/staging/sm750fb/ddk750_dvi.h b/drivers/staging/sm750fb/ddk750_dvi.h index 83bbd6d..e1d4c9a 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.h +++ b/drivers/staging/sm750fb/ddk750_dvi.h @@ -26,8 +26,7 @@ typedef unsigned char (*PFN_DVICTRL_CHECKINTERRUPT)(void); typedef void (*PFN_DVICTRL_CLEARINTERRUPT)(void); /* Structure to hold all the function pointer to the DVI Controller. */ -typedef struct _dvi_ctrl_device_t -{ +typedef struct _dvi_ctrl_device_t { PFN_DVICTRL_INIT pfnInit; PFN_DVICTRL_RESETCHIP pfnResetChip; PFN_DVICTRL_GETCHIPSTRING pfnGetChipString; diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c index 7f3b1f9..5ddac43 100644 --- a/drivers/staging/sm750fb/ddk750_hwi2c.c +++ b/drivers/staging/sm750fb/ddk750_hwi2c.c @@ -106,8 +106,7 @@ static unsigned int hwI2CWriteData( * Note: * Only 16 byte can be accessed per i2c start instruction. */ - do - { + do { /* Reset I2C by writing 0 to I2C_RESET register to clear the previous status. */ POKE32(I2C_RESET, 0); @@ -173,8 +172,7 @@ static unsigned int hwI2CReadData( * Note: * Only 16 byte can be accessed per i2c start instruction. */ - do - { + do { /* Reset I2C by writing 0 to I2C_RESET register to clear all the status. */ POKE32(I2C_RESET, 0); diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index d451e7a..9d10446 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -80,8 +80,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) int ret = 0; int cnt = 0; unsigned int ulTmpValue, ulReg; - if (pll->clockType == SECONDARY_PLL) - { + if (pll->clockType == SECONDARY_PLL) { /* programe secondary pixel clock */ POKE32(CRT_PLL_CTRL, formatPllReg(pll)); POKE32(CRT_HORIZONTAL_TOTAL, @@ -119,9 +118,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) POKE32(CRT_DISPLAY_CTRL, ulTmpValue|ulReg); } - } - else if (pll->clockType == PRIMARY_PLL) - { + } else if (pll->clockType == PRIMARY_PLL) { unsigned int ulReservedBits; POKE32(PANEL_PLL_CTRL, formatPllReg(pll)); @@ -170,16 +167,14 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg); #if 1 - while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) - { + while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != (ulTmpValue|ulReg)) { cnt++; if (cnt > 1000) break; POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg); } #endif - } - else{ + } else { ret = -1; } return ret; diff --git a/drivers/staging/sm750fb/ddk750_mode.h b/drivers/staging/sm750fb/ddk750_mode.h index 3548d67..e846dc2 100644 --- a/drivers/staging/sm750fb/ddk750_mode.h +++ b/drivers/staging/sm750fb/ddk750_mode.h @@ -3,16 +3,14 @@ #include "ddk750_chip.h" -typedef enum _spolarity_t -{ +typedef enum _spolarity_t { POS = 0, /* positive */ NEG, /* negative */ } spolarity_t; -typedef struct _mode_parameter_t -{ +typedef struct _mode_parameter_t { /* Horizontal timing. */ unsigned long horizontal_total; unsigned long horizontal_display_end; diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index 28d4402..c545c2d 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -36,8 +36,7 @@ void setPowerMode(unsigned int powerMode) if (getChipType() == SM750LE) return; - switch (powerMode) - { + switch (powerMode) { case POWER_MODE_CTRL_MODE_MODE0: control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, MODE0); break; @@ -55,16 +54,13 @@ void setPowerMode(unsigned int powerMode) } /* Set up other fields in Power Control Register */ - if (powerMode == POWER_MODE_CTRL_MODE_SLEEP) - { + if (powerMode == POWER_MODE_CTRL_MODE_SLEEP) { control_value = #ifdef VALIDATION_CHIP FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, OFF) | #endif FIELD_SET(control_value, POWER_MODE_CTRL, OSC_INPUT, OFF); - } - else - { + } else { control_value = #ifdef VALIDATION_CHIP FIELD_SET(control_value, POWER_MODE_CTRL, 336CLK, ON) | @@ -84,8 +80,7 @@ void setCurrentGate(unsigned int gate) /* Get current power mode. */ mode = getPowerMode(); - switch (mode) - { + switch (mode) { case POWER_MODE_CTRL_MODE_MODE0: gate_reg = MODE0_GATE; break; @@ -111,13 +106,10 @@ void enable2DEngine(unsigned int enable) uint32_t gate; gate = PEEK32(CURRENT_GATE); - if (enable) - { + if (enable) { gate = FIELD_SET(gate, CURRENT_GATE, DE, ON); gate = FIELD_SET(gate, CURRENT_GATE, CSC, ON); - } - else - { + } else { gate = FIELD_SET(gate, CURRENT_GATE, DE, OFF); gate = FIELD_SET(gate, CURRENT_GATE, CSC, OFF); } @@ -135,8 +127,7 @@ void enableZVPort(unsigned int enable) /* Enable ZV Port Gate */ gate = PEEK32(CURRENT_GATE); - if (enable) - { + if (enable) { gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, ON); #if 1 /* Using Software I2C */ @@ -145,9 +136,7 @@ void enableZVPort(unsigned int enable) /* Using Hardware I2C */ gate = FIELD_SET(gate, CURRENT_GATE, I2C, ON); #endif - } - else - { + } else { /* Disable ZV Port Gate. There is no way to know whether the GPIO pins are being used or not. Therefore, do not disable the GPIO gate. */ gate = FIELD_SET(gate, CURRENT_GATE, ZVPORT, OFF); diff --git a/drivers/staging/sm750fb/ddk750_power.h b/drivers/staging/sm750fb/ddk750_power.h index a20d438..b7cf6b2 100644 --- a/drivers/staging/sm750fb/ddk750_power.h +++ b/drivers/staging/sm750fb/ddk750_power.h @@ -1,8 +1,7 @@ #ifndef DDK750_POWER_H__ #define DDK750_POWER_H__ -typedef enum _DPMS_t -{ +typedef enum _DPMS_t { crtDPMS_ON = 0x0, crtDPMS_STANDBY = 0x1, crtDPMS_SUSPEND = 0x2, diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c index c09748c..3c55df1 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.c +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -136,8 +136,7 @@ long sii164InitChip( #endif /* Check if SII164 Chip exists */ - if ((sii164GetVendorID() == SII164_VENDOR_ID) && (sii164GetDeviceID() == SII164_DEVICE_ID)) - { + if ((sii164GetVendorID() == SII164_VENDOR_ID) && (sii164GetDeviceID() == SII164_DEVICE_ID)) { /* * Initialize SII164 controller chip. */ @@ -183,8 +182,7 @@ long sii164InitChip( else config = SII164_DESKEW_ENABLE; - switch (deskewSetting) - { + switch (deskewSetting) { case 0: config |= SII164_DESKEW_1_STEP; break; @@ -284,15 +282,12 @@ void sii164SetPower(unsigned char powerUp) unsigned char config; config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); - if (powerUp == 1) - { + if (powerUp == 1) { /* Power up the chip */ config &= ~SII164_CONFIGURATION_POWER_MASK; config |= SII164_CONFIGURATION_POWER_NORMAL; i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); - } - else - { + } else { /* Power down the chip */ config &= ~SII164_CONFIGURATION_POWER_MASK; config |= SII164_CONFIGURATION_POWER_DOWN; @@ -310,8 +305,7 @@ static void sii164SelectHotPlugDetectionMode(sii164_hot_plug_mode_t hotPlugMode) unsigned char detectReg; detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; - switch (hotPlugMode) - { + switch (hotPlugMode) { case SII164_HOTPLUG_DISABLE: detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; break; diff --git a/drivers/staging/sm750fb/ddk750_sii164.h b/drivers/staging/sm750fb/ddk750_sii164.h index bb0ed25..18c1c3e 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.h +++ b/drivers/staging/sm750fb/ddk750_sii164.h @@ -4,8 +4,7 @@ #define USE_DVICHIP /* Hot Plug detection mode structure */ -typedef enum _sii164_hot_plug_mode_t -{ +typedef enum _sii164_hot_plug_mode_t { SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit (always high). */ SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Interrupt bit. */ SII164_HOTPLUG_USE_RSEN, /* Use Receiver Sense detect bit. */ diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c index 391fced..0b5758b 100644 --- a/drivers/staging/sm750fb/sm750_accel.c +++ b/drivers/staging/sm750fb/sm750_accel.c @@ -96,8 +96,7 @@ int hw_fillrect(struct lynx_accel *accel, { u32 deCtrl; - if (accel->de_wait() != 0) - { + if (accel->de_wait() != 0) { /* int time wait and always busy,seems hardware * got something error */ pr_debug("%s:De engine always bussy\n", __func__); @@ -159,11 +158,9 @@ unsigned int rop2) /* ROP value */ de_ctrl = 0; /* If source and destination are the same surface, need to check for overlay cases */ - if (sBase == dBase && sPitch == dPitch) - { + if (sBase == dBase && sPitch == dPitch) { /* Determine direction of operation */ - if (sy < dy) - { + if (sy < dy) { /* +----------+ |S | | +----------+ @@ -174,9 +171,7 @@ unsigned int rop2) /* ROP value */ +----------+ */ nDirection = BOTTOM_TO_TOP; - } - else if (sy > dy) - { + } else if (sy > dy) { /* +----------+ |D | | +----------+ @@ -187,12 +182,9 @@ unsigned int rop2) /* ROP value */ +----------+ */ nDirection = TOP_TO_BOTTOM; - } - else - { + } else { /* sy == dy */ - if (sx <= dx) - { + if (sx <= dx) { /* +------+---+------+ |S | | D| | | | | @@ -201,9 +193,7 @@ unsigned int rop2) /* ROP value */ +------+---+------+ */ nDirection = RIGHT_TO_LEFT; - } - else - { + } else { /* sx > dx */ /* +------+---+------+ @@ -218,8 +208,7 @@ unsigned int rop2) /* ROP value */ } } - if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) - { + if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) { sx += width - 1; sy += height - 1; dx += width - 1; @@ -254,8 +243,7 @@ unsigned int rop2) /* ROP value */ write_dpr(accel, DE_PITCH, FIELD_VALUE(0, DE_PITCH, DESTINATION, dPitch) | FIELD_VALUE(0, DE_PITCH, SOURCE, sPitch)); /* dpr10 */ - } - else + } else #endif { write_dpr(accel, DE_PITCH, @@ -270,9 +258,8 @@ unsigned int rop2) /* ROP value */ FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, (dPitch/Bpp)) | FIELD_VALUE(0, DE_WINDOW_WIDTH, SOURCE, (sPitch/Bpp))); /* dpr3c */ - if (accel->de_wait() != 0) { + if (accel->de_wait() != 0) return -1; - } write_dpr(accel, DE_SOURCE, FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) | @@ -339,9 +326,7 @@ int hw_imageblit(struct lynx_accel *accel, ulBytesRemain = ulBytesPerScan & 3; if (accel->de_wait() != 0) - { return -1; - } /* 2D Source Base. Use 0 for HOST Blt. @@ -365,8 +350,7 @@ int hw_imageblit(struct lynx_accel *accel, FIELD_VALUE(0, DE_PITCH, DESTINATION, dPitch) | FIELD_VALUE(0, DE_PITCH, SOURCE, dPitch)); /* dpr10 */ - } - else + } else #endif { write_dpr(accel, DE_PITCH, @@ -408,16 +392,12 @@ int hw_imageblit(struct lynx_accel *accel, write_dpr(accel, DE_CONTROL, de_ctrl | deGetTransparency(accel)); /* Write MONO data (line by line) to 2D Engine data port */ - for (i = 0; i < height; i++) - { + for (i = 0; i < height; i++) { /* For each line, send the data in chunks of 4 bytes */ for (j = 0; j < (ul4BytesPerScan/4); j++) - { write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4))); - } - if (ulBytesRemain) - { + if (ulBytesRemain) { memcpy(ajRemain, pSrcbuf+ul4BytesPerScan, ulBytesRemain); write_dpPort(accel, *(unsigned int *)ajRemain); } diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c index 4ed7ca2..ab61fe6 100644 --- a/drivers/staging/sm750fb/sm750_cursor.c +++ b/drivers/staging/sm750fb/sm750_cursor.c @@ -122,8 +122,7 @@ void hw_cursor_setData(struct lynx_cursor *cursor, odd=0; */ - for (i = 0; i < count; i++) - { + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; data = 0; @@ -137,11 +136,10 @@ void hw_cursor_setData(struct lynx_cursor *cursor, else opr = mask & color; - for (j = 0; j < 8; j++) - { + for (j = 0; j < 8; j++) { - if (opr & (0x80 >> j)) - { /* use fg color,id = 2 */ + if (opr & (0x80 >> j)) { + /* use fg color,id = 2 */ data |= 2 << (j*2); } else { /* use bg color,id = 1 */ @@ -204,8 +202,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, pstart = cursor->vstart; pbuffer = pstart; - for (i = 0; i < count; i++) - { + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; data = 0; @@ -217,11 +214,10 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, else opr = mask & color; - for (j = 0; j < 8; j++) - { + for (j = 0; j < 8; j++) { - if (opr & (0x80 >> j)) - { /* use fg color,id = 2 */ + if (opr & (0x80 >> j)) { + /* use fg color,id = 2 */ data |= 2 << (j*2); } else { /* use bg color,id = 1 */ @@ -237,8 +233,7 @@ void hw_cursor_setData2(struct lynx_cursor *cursor, iowrite16(data, pbuffer); /* assume pitch is 1,2,4,8,...*/ - if (!(i&(pitch-1))) - { + if (!(i&(pitch-1))) { /* need a return */ pstart += offset; pbuffer = pstart; diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index af7ea2e..a3362d8 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -43,8 +43,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) * successfully * */ - if ((ret = pci_request_region(pdev, 1, "sm750fb"))) - { + if ((ret = pci_request_region(pdev, 1, "sm750fb"))) { pr_err("Can not request PCI regions.\n"); goto exit; } @@ -77,8 +76,7 @@ int hw_sm750_map(struct lynx_share* share, struct pci_dev* pdev) /* reserve the vidmem space of smi adaptor */ #if 0 - if ((ret = pci_request_region(pdev, 0, _moduleName_))) - { + if ((ret = pci_request_region(pdev, 0, _moduleName_))) { pr_err("Can not request PCI regions.\n"); goto exit; } @@ -129,8 +127,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) ddk750_initDVIDisp(); #endif - if (getChipType() != SM750LE) - { + if (getChipType() != SM750LE) { /* does user need CRT ?*/ if (spec_share->state.nocrt) { POKE32(MISC_CTRL, @@ -176,8 +173,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) /* Customer may NOT use CH7301 DVI chip, which has to be initialized differently. */ - if (swI2CReadReg(0xec, 0x4a) == 0x95) - { + if (swI2CReadReg(0xec, 0x4a) == 0x95) { /* The following register values for CH7301 are from Chrontel app note and our experiment. */ @@ -190,9 +186,8 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev) } /* init 2d engine */ - if (!share->accel_off) { + if (!share->accel_off) hw_sm750_initAccel(share); - } return 0; } @@ -420,11 +415,11 @@ int hw_sm750_setColReg(struct lynxfb_crtc* crtc, ushort index, return 0; } -int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank) { +int hw_sm750le_setBLANK(struct lynxfb_output * output, int blank) +{ int dpms, crtdb; - switch (blank) - { + switch (blank) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) case FB_BLANK_UNBLANK: #else @@ -480,8 +475,7 @@ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) dpms = pps = crtdb = 0; - switch (blank) - { + switch (blank) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10) case FB_BLANK_UNBLANK: #else @@ -535,9 +529,8 @@ int hw_sm750_setBLANK(struct lynxfb_output* output, int blank) POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(PEEK32(CRT_DISPLAY_CTRL), CRT_DISPLAY_CTRL, BLANK, crtdb)); } - if (output->paths & sm750_panel) { + if (output->paths & sm750_panel) POKE32(PANEL_DISPLAY_CTRL, FIELD_VALUE(PEEK32(PANEL_DISPLAY_CTRL), PANEL_DISPLAY_CTRL, DATA, pps)); - } return 0; } @@ -579,8 +572,7 @@ int hw_sm750le_deWait(void) unsigned int dwVal = PEEK32(DE_STATE2); if ((FIELD_GET(dwVal, DE_STATE2, DE_STATUS) == DE_STATE2_DE_STATUS_IDLE) && (FIELD_GET(dwVal, DE_STATE2, DE_FIFO) == DE_STATE2_DE_FIFO_EMPTY) && - (FIELD_GET(dwVal, DE_STATE2, DE_MEM_FIFO) == DE_STATE2_DE_MEM_FIFO_EMPTY)) - { + (FIELD_GET(dwVal, DE_STATE2, DE_MEM_FIFO) == DE_STATE2_DE_MEM_FIFO_EMPTY)) { return 0; } } @@ -596,8 +588,7 @@ int hw_sm750_deWait(void) unsigned int dwVal = PEEK32(SYSTEM_CTRL); if ((FIELD_GET(dwVal, SYSTEM_CTRL, DE_STATUS) == SYSTEM_CTRL_DE_STATUS_IDLE) && (FIELD_GET(dwVal, SYSTEM_CTRL, DE_FIFO) == SYSTEM_CTRL_DE_FIFO_EMPTY) && - (FIELD_GET(dwVal, SYSTEM_CTRL, DE_MEM_FIFO) == SYSTEM_CTRL_DE_MEM_FIFO_EMPTY)) - { + (FIELD_GET(dwVal, SYSTEM_CTRL, DE_MEM_FIFO) == SYSTEM_CTRL_DE_MEM_FIFO_EMPTY)) { return 0; } } -- 2.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 4/4] staging: sm750fb: add missing blank line after declarations 2015-06-20 8:45 ` Juston Li @ 2015-06-20 8:48 ` Juston Li -1 siblings, 0 replies; 16+ messages in thread From: Juston Li @ 2015-06-20 8:48 UTC (permalink / raw) To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, devel, linux-kernel Cc: Juston Li fixes checkpatch.pl WARNING: Missing a blank line after declarations Signed-off-by: Juston Li <juston.h.li@gmail.com> --- drivers/staging/sm750fb/ddk750_chip.c | 1 + drivers/staging/sm750fb/ddk750_display.c | 2 ++ drivers/staging/sm750fb/ddk750_dvi.c | 1 + drivers/staging/sm750fb/ddk750_mode.c | 3 +++ drivers/staging/sm750fb/ddk750_power.c | 1 + drivers/staging/sm750fb/ddk750_sii164.c | 1 + 6 files changed, 9 insertions(+) diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index d7435d7..5e6798e 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -474,6 +474,7 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll) M += (fl_quo*X % 10000) > 5000?1:0; if (M < 256 && M > 0) { unsigned int diff; + tmpClock = pll->inputFreq * M / N / X; diff = absDiff(tmpClock, request_orig); if (diff < miniDiff) { diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index 90c5c9e..70e7f10 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -121,6 +121,7 @@ static void setDisplayControl(int ctrl, int dispState) static void waitNextVerticalSync(int ctrl, int delay) { unsigned int status; + if (!ctrl) { /* primary controller */ @@ -210,6 +211,7 @@ static void swPanelPowerSequence(int disp, int delay) void ddk750_setLogicalDispOut(disp_output_t output) { unsigned int reg; + if (output & PNL_2_USAGE) { /* set panel path controller select */ reg = PEEK32(PANEL_DISPLAY_CTRL); diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index a18bb4c..a7a2351 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -43,6 +43,7 @@ int dviInit( ) { dvi_ctrl_device_t *pCurrentDviCtrl; + pCurrentDviCtrl = g_dcftSupportedDviController; if (pCurrentDviCtrl->pfnInit != NULL) { return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index 9d10446..2399b17 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -80,6 +80,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) int ret = 0; int cnt = 0; unsigned int ulTmpValue, ulReg; + if (pll->clockType = SECONDARY_PLL) { /* programe secondary pixel clock */ POKE32(CRT_PLL_CTRL, formatPllReg(pll)); @@ -120,6 +121,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) } else if (pll->clockType = PRIMARY_PLL) { unsigned int ulReservedBits; + POKE32(PANEL_PLL_CTRL, formatPllReg(pll)); POKE32(PANEL_HORIZONTAL_TOTAL, @@ -184,6 +186,7 @@ int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock) { pll_value_t pll; unsigned int uiActualPixelClk; + pll.inputFreq = DEFAULT_INPUT_CLOCK; pll.clockType = clock; diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index c545c2d..c8c51be 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -5,6 +5,7 @@ void ddk750_setDPMS(DPMS_t state) { unsigned int value; + if (getChipType() = SM750LE) { value = PEEK32(CRT_DISPLAY_CTRL); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, DPMS, state)); diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c index 3c55df1..e476584 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.c +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -334,6 +334,7 @@ static void sii164SelectHotPlugDetectionMode(sii164_hot_plug_mode_t hotPlugMode) void sii164EnableHotPlugDetection(unsigned char enableHotPlug) { unsigned char detectReg; + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); /* Depending on each DVI controller, need to enable the hot plug based on each -- 2.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 4/4] staging: sm750fb: add missing blank line after declarations @ 2015-06-20 8:48 ` Juston Li 0 siblings, 0 replies; 16+ messages in thread From: Juston Li @ 2015-06-20 8:48 UTC (permalink / raw) To: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, devel, linux-kernel Cc: Juston Li fixes checkpatch.pl WARNING: Missing a blank line after declarations Signed-off-by: Juston Li <juston.h.li@gmail.com> --- drivers/staging/sm750fb/ddk750_chip.c | 1 + drivers/staging/sm750fb/ddk750_display.c | 2 ++ drivers/staging/sm750fb/ddk750_dvi.c | 1 + drivers/staging/sm750fb/ddk750_mode.c | 3 +++ drivers/staging/sm750fb/ddk750_power.c | 1 + drivers/staging/sm750fb/ddk750_sii164.c | 1 + 6 files changed, 9 insertions(+) diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index d7435d7..5e6798e 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -474,6 +474,7 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll) M += (fl_quo*X % 10000) > 5000?1:0; if (M < 256 && M > 0) { unsigned int diff; + tmpClock = pll->inputFreq * M / N / X; diff = absDiff(tmpClock, request_orig); if (diff < miniDiff) { diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c index 90c5c9e..70e7f10 100644 --- a/drivers/staging/sm750fb/ddk750_display.c +++ b/drivers/staging/sm750fb/ddk750_display.c @@ -121,6 +121,7 @@ static void setDisplayControl(int ctrl, int dispState) static void waitNextVerticalSync(int ctrl, int delay) { unsigned int status; + if (!ctrl) { /* primary controller */ @@ -210,6 +211,7 @@ static void swPanelPowerSequence(int disp, int delay) void ddk750_setLogicalDispOut(disp_output_t output) { unsigned int reg; + if (output & PNL_2_USAGE) { /* set panel path controller select */ reg = PEEK32(PANEL_DISPLAY_CTRL); diff --git a/drivers/staging/sm750fb/ddk750_dvi.c b/drivers/staging/sm750fb/ddk750_dvi.c index a18bb4c..a7a2351 100644 --- a/drivers/staging/sm750fb/ddk750_dvi.c +++ b/drivers/staging/sm750fb/ddk750_dvi.c @@ -43,6 +43,7 @@ int dviInit( ) { dvi_ctrl_device_t *pCurrentDviCtrl; + pCurrentDviCtrl = g_dcftSupportedDviController; if (pCurrentDviCtrl->pfnInit != NULL) { return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable, diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c index 9d10446..2399b17 100644 --- a/drivers/staging/sm750fb/ddk750_mode.c +++ b/drivers/staging/sm750fb/ddk750_mode.c @@ -80,6 +80,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) int ret = 0; int cnt = 0; unsigned int ulTmpValue, ulReg; + if (pll->clockType == SECONDARY_PLL) { /* programe secondary pixel clock */ POKE32(CRT_PLL_CTRL, formatPllReg(pll)); @@ -120,6 +121,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll) } else if (pll->clockType == PRIMARY_PLL) { unsigned int ulReservedBits; + POKE32(PANEL_PLL_CTRL, formatPllReg(pll)); POKE32(PANEL_HORIZONTAL_TOTAL, @@ -184,6 +186,7 @@ int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock) { pll_value_t pll; unsigned int uiActualPixelClk; + pll.inputFreq = DEFAULT_INPUT_CLOCK; pll.clockType = clock; diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c index c545c2d..c8c51be 100644 --- a/drivers/staging/sm750fb/ddk750_power.c +++ b/drivers/staging/sm750fb/ddk750_power.c @@ -5,6 +5,7 @@ void ddk750_setDPMS(DPMS_t state) { unsigned int value; + if (getChipType() == SM750LE) { value = PEEK32(CRT_DISPLAY_CTRL); POKE32(CRT_DISPLAY_CTRL, FIELD_VALUE(value, CRT_DISPLAY_CTRL, DPMS, state)); diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c index 3c55df1..e476584 100644 --- a/drivers/staging/sm750fb/ddk750_sii164.c +++ b/drivers/staging/sm750fb/ddk750_sii164.c @@ -334,6 +334,7 @@ static void sii164SelectHotPlugDetectionMode(sii164_hot_plug_mode_t hotPlugMode) void sii164EnableHotPlugDetection(unsigned char enableHotPlug) { unsigned char detectReg; + detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); /* Depending on each DVI controller, need to enable the hot plug based on each -- 2.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2015-06-20 15:40 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-06-20 8:45 [PATCH 0/4] staging: sm750fb: checkpatch.pl fixes Juston Li 2015-06-20 8:45 ` Juston Li 2015-06-20 8:48 ` [PATCH 1/4] staging: sm750fb: use tabs for indentation Juston Li 2015-06-20 8:48 ` Juston Li 2015-06-20 10:45 ` Sudip Mukherjee 2015-06-20 10:57 ` Sudip Mukherjee 2015-06-20 15:40 ` Juston Li 2015-06-20 15:40 ` Juston Li 2015-06-20 8:48 ` [PATCH 2/4] staging: sm750fb: fix spacing issues Juston Li 2015-06-20 8:48 ` Juston Li 2015-06-20 10:47 ` Sudip Mukherjee 2015-06-20 10:59 ` Sudip Mukherjee 2015-06-20 8:48 ` [PATCH 3/4] staging: sm750fb: fix brace placement Juston Li 2015-06-20 8:48 ` Juston Li 2015-06-20 8:48 ` [PATCH 4/4] staging: sm750fb: add missing blank line after declarations Juston Li 2015-06-20 8:48 ` Juston Li
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.